react-dropzone
Advanced tools
Comparing version 3.3.2 to 3.3.3
// import es6 | ||
require('babel/register'); | ||
require('babel-core/register'); | ||
// jsdom | ||
var jsdom = require('jsdom'); | ||
var jsdom = require('jsdom'); // eslint-disable-line | ||
@@ -12,8 +12,8 @@ global.document = jsdom.jsdom('<!doctype html><html><body></body></html>'); | ||
global.window.URL = { | ||
createObjectURL: function(arg) { | ||
return "data://" + arg.name; | ||
createObjectURL: function (arg) { // eslint-disable-line | ||
return 'data://' + arg.name; | ||
} | ||
} | ||
global.window.addEventListener('load', function() { | ||
console.log('JSDOM Loaded'); | ||
}; | ||
global.window.addEventListener('load', function () { | ||
console.log('JSDOM Loaded'); // eslint-disable-line | ||
}); |
{ | ||
"name": "react-dropzone", | ||
"version": "3.3.2", | ||
"version": "3.3.3", | ||
"description": "Simple HTML5 drag-drop zone with React.js", | ||
"main": "lib/index.js", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"build": "babel ./src --out-dir ./lib", | ||
"prepublish": "npm run lint && npm test && npm run build", | ||
"build": "npm run clean && webpack", | ||
"clean": "rimraf ./dist", | ||
"prepublish": "npm run lint && npm run test:build && npm run build", | ||
"test": "mocha --require ./mocha-environment.js './src/test.js'", | ||
"lint": "eslint ./src", | ||
"lint:fix": "eslint --fix ./src", | ||
"test:build": "NODE_ENV=production npm run test", | ||
"lint": "eslint ./src ./*.js", | ||
"lint:fix": "npm run lint -- --fix", | ||
"precommit-check": "npm run lint" | ||
@@ -45,4 +47,10 @@ }, | ||
"devDependencies": { | ||
"babel": "^5.8.29", | ||
"babel-cli": "^6.4.5", | ||
"babel-core": "^6.4.5", | ||
"babel-eslint": "^4.1.6", | ||
"babel-loader": "^6.2.2", | ||
"babel-plugin-add-module-exports": "^0.1.2", | ||
"babel-preset-es2015": "^6.3.13", | ||
"babel-preset-react": "^6.3.13", | ||
"babel-preset-stage-0": "^6.3.13", | ||
"chai": "^3.4.1", | ||
@@ -59,4 +67,6 @@ "eslint": "^1.10.3", | ||
"react-testutils-additions": "^0.2.0", | ||
"sinon": "^1.17.2" | ||
"rimraf": "^2.5.2", | ||
"sinon": "^1.17.2", | ||
"webpack": "^1.12.11" | ||
} | ||
} |
@@ -72,3 +72,6 @@ react-dropzone [![Build Status](https://travis-ci.org/okonet/react-dropzone.svg)](https://travis-ci.org/okonet/react-dropzone) | ||
- `multiple` - To accept only a single file, set this to `false`. | ||
- `accept` - Filters the file types that are valid. It should have a valid MIME type according to [input element](http://www.w3.org/TR/html-markup/input.file.html), e.g. accept="application/pdf". | ||
- `accept` - Filters the file types that are valid. It should have a valid MIME type according to [input element](http://www.w3.org/TR/html-markup/input.file.html), for example: | ||
* `application/pdf` | ||
* `image/*` | ||
* `audio/aiff,audio/midi` | ||
@@ -75,0 +78,0 @@ To show a preview of the dropped file while it uploads, use the `file.preview` property. Use `<img src={file.preview} />` to display a preview of the image dropped. |
@@ -85,3 +85,3 @@ import accepts from 'attr-accept'; | ||
const droppedFiles = e.dataTransfer ? e.dataTransfer.files : e.target.files; | ||
const max = this.props.multiple ? droppedFiles.length : 1; | ||
const max = this.props.multiple ? droppedFiles.length : Math.min(droppedFiles.length, 1); | ||
const files = []; | ||
@@ -88,0 +88,0 @@ |
@@ -7,3 +7,3 @@ /* eslint no-unused-expressions: 0 */ | ||
import TestUtils from 'react-testutils-additions'; | ||
import Dropzone from './index'; | ||
const Dropzone = require(process.env.NODE_ENV === 'production' ? '../dist/index' : './index'); | ||
@@ -44,2 +44,10 @@ describe('Dropzone', () => { | ||
it('does not throw an error when html is dropped instead of files and multiple is false', () => { | ||
const dropzone = TestUtils.renderIntoDocument(<Dropzone multiple={false}><div className="dropzone-content">some content</div></Dropzone>); | ||
const content = TestUtils.findRenderedDOMComponentWithClass(dropzone, 'dropzone-content'); | ||
const fn = () => TestUtils.Simulate.drop(content, { dataTransfer: { files: [] } }); | ||
expect(fn).not.to.throw(); | ||
}); | ||
describe('ref', () => { | ||
@@ -46,0 +54,0 @@ it('sets ref properly', () => { |
@@ -1,14 +0,32 @@ | ||
{ | ||
module.exports = { | ||
entry: "./lib/index.js", | ||
output: { | ||
path: __dirname, | ||
filename: "./dist/react-dropzone.js", | ||
libraryTarget: "var", | ||
library: "Dropzone" | ||
}, | ||
externals: { | ||
"react": "React" | ||
} | ||
} | ||
var webpack = require('webpack'); // eslint-disable-line | ||
var path = require('path'); // eslint-disable-line | ||
module.exports = { | ||
entry: './src/index.js', | ||
devtool: 'source-map', | ||
output: { | ||
path: __dirname + '/dist/', | ||
filename: 'index.js', | ||
libraryTarget: 'umd', | ||
library: 'Dropzone' | ||
}, | ||
module: { | ||
loaders: [ | ||
{ | ||
include: [ | ||
path.resolve(__dirname, 'src') | ||
], | ||
test: /\.js$/, | ||
loader: 'babel-loader' | ||
} | ||
] | ||
}, | ||
resolve: { | ||
// Can require('file') instead of require('file.js') etc. | ||
extensions: ['', '.js', '.json'] | ||
}, | ||
externals: { | ||
react: 'React' | ||
}, | ||
plugins: [] | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
103212
28
682
146
22
2
2