react-dropzone 11.5.2 → 11.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,32 @@
1
+ If you'd like to use [react without JSX](https://reactjs.org/docs/react-without-jsx.html) you can:
2
+
3
+ ```js harmony
4
+ import React, {useCallback, useState} from 'react';
5
+ import {useDropzone} from 'react-dropzone';
6
+
7
+ const e = React.createElement
8
+
9
+ function Basic () {
10
+ const [files, setFiles] = useState([]);
11
+ const onDrop = useCallback(files => setFiles(files), [setFiles]);
12
+
13
+ const {getRootProps, getInputProps} = useDropzone({onDrop});
14
+
15
+ const fileList = files.map(
16
+ file => React.createElement('li', {key: file.name}, `${file.name} - ${file.size} bytes`)
17
+ );
18
+
19
+ return e('section', {className: 'container'}, [
20
+ e('div', getRootProps({className: 'dropzone', key: 'dropzone'}), [
21
+ e('input', getInputProps({key: 'input'})),
22
+ e('p', {key: 'desc'}, "Drag 'n' drop some files here, or click to select files")
23
+ ]),
24
+ e('aside', {key: 'filesContainer'}, [
25
+ e('h4', {key: 'title'}, 'Files'),
26
+ e('ul', {key: 'fileList'}, fileList)
27
+ ])
28
+ ]);
29
+ }
30
+
31
+ Basic()
32
+ ```
package/package.json CHANGED
@@ -5,19 +5,21 @@
5
5
  "module": "dist/es/index.js",
6
6
  "sideEffects": false,
7
7
  "scripts": {
8
- "ci": "git-cz",
8
+ "cz": "git-cz",
9
9
  "clean": "rimraf ./dist",
10
- "build": "npm run clean && npm run build:umd && npm run build:es",
10
+ "build": "yarn clean && yarn build:umd && yarn build:es",
11
11
  "build:umd": "cross-env NODE_ENV=es rollup -c",
12
12
  "build:es": "cross-env BABEL_ENV=es babel ./src --out-dir ./dist/es --ignore '**/*.spec.js'",
13
13
  "start": "styleguidist server",
14
14
  "styleguide": "styleguidist build",
15
- "test": "cross-env NODE_ENV=test npm run eslint:src && jest --coverage && npm run typescript",
15
+ "test": "cross-env NODE_ENV=test yarn eslint:src && jest --coverage && yarn typescript",
16
16
  "test:watch": "cross-env NODE_ENV=test jest --watch",
17
17
  "eslint:src": "eslint .",
18
18
  "commitmsg": "commitlint -e",
19
- "precommit": "lint-staged",
20
- "prepublish": "npm run build && npm run size",
19
+ "prepublish": "yarn build && yarn size",
20
+ "_postinstall": "husky install",
21
+ "prepublishOnly": "pinst --disable",
22
+ "postpublish": "pinst --enable",
21
23
  "logo": "cd logo && sketchtool export artboards logo.sketch",
22
24
  "imagemin": "imagemin --out-dir=logo --plugin=pngquant --plugin=svgo",
23
25
  "size": "size-limit",
@@ -36,18 +38,22 @@
36
38
  ],
37
39
  "lint-staged": {
38
40
  "*.js": [
39
- "eslint --fix",
40
- "git add"
41
+ "eslint --fix"
41
42
  ],
42
43
  "*.ts": [
43
- "tslint"
44
+ "eslint ."
44
45
  ],
45
46
  "*.{svg,png}": [
46
- "imagemin",
47
- "git add"
47
+ "imagemin"
48
48
  ]
49
49
  },
50
+ "config": {
51
+ "commitizen": {
52
+ "path": "@commitlint/prompt"
53
+ }
54
+ },
50
55
  "jest": {
56
+ "testEnvironment": "jsdom",
51
57
  "clearMocks": true,
52
58
  "setupFilesAfterEnv": [
53
59
  "<rootDir>/testSetup.js"
@@ -91,85 +97,82 @@
91
97
  "react": ">= 16.8"
92
98
  },
93
99
  "dependencies": {
94
- "attr-accept": "^2.2.1",
95
- "file-selector": "^0.2.2",
96
- "prop-types": "^15.7.2"
100
+ "attr-accept": "^2.2.2",
101
+ "file-selector": "^0.4.0",
102
+ "prop-types": "^15.8.1"
97
103
  },
98
104
  "devDependencies": {
99
- "@babel/cli": "^7.11.6",
100
- "@babel/core": "^7.11.6",
101
- "@babel/plugin-external-helpers": "^7.10.4",
102
- "@babel/plugin-proposal-do-expressions": "^7.10.4",
103
- "@babel/plugin-proposal-export-default-from": "^7.10.4",
104
- "@babel/plugin-proposal-logical-assignment-operators": "^7.11.0",
105
- "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.4",
106
- "@babel/plugin-proposal-optional-chaining": "^7.11.0",
107
- "@babel/plugin-proposal-pipeline-operator": "^7.10.5",
108
- "@babel/plugin-transform-runtime": "^7.11.5",
109
- "@babel/preset-env": "^7.11.5",
110
- "@babel/preset-react": "^7.10.4",
111
- "@babel/register": "^7.11.5",
112
- "@commitlint/cli": "^9.1.2",
113
- "@commitlint/config-angular": "^9.1.2",
114
- "@commitlint/prompt": "^9.1.2",
115
- "@commitlint/prompt-cli": "^9.1.2",
116
- "@size-limit/preset-small-lib": "^4.5.7",
117
- "@testing-library/dom": "^8.0.0",
118
- "@testing-library/jest-dom": "^5.11.4",
119
- "@testing-library/react": "^12.0.0",
120
- "@testing-library/react-hooks": "^7.0.0",
105
+ "@babel/cli": "^7.16.8",
106
+ "@babel/core": "^7.16.12",
107
+ "@babel/eslint-parser": "^7.16.5",
108
+ "@babel/plugin-external-helpers": "^7.16.7",
109
+ "@babel/plugin-proposal-do-expressions": "^7.16.7",
110
+ "@babel/plugin-proposal-export-default-from": "^7.16.7",
111
+ "@babel/plugin-proposal-logical-assignment-operators": "^7.16.7",
112
+ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
113
+ "@babel/plugin-proposal-optional-chaining": "^7.16.7",
114
+ "@babel/plugin-proposal-pipeline-operator": "^7.16.7",
115
+ "@babel/plugin-transform-runtime": "^7.16.10",
116
+ "@babel/preset-env": "^7.16.11",
117
+ "@babel/preset-react": "^7.16.7",
118
+ "@babel/register": "^7.16.9",
119
+ "@commitlint/cli": "^16.1.0",
120
+ "@commitlint/config-angular": "^16.0.0",
121
+ "@commitlint/prompt": "^16.1.0",
122
+ "@commitlint/prompt-cli": "^16.1.0",
123
+ "@rollup/plugin-babel": "^5.3.0",
124
+ "@rollup/plugin-commonjs": "^21.0.1",
125
+ "@rollup/plugin-node-resolve": "^13.1.3",
126
+ "@size-limit/preset-small-lib": "^7.0.5",
127
+ "@size-limit/webpack": "^7.0.5",
128
+ "@size-limit/webpack-why": "^7.0.5",
129
+ "@testing-library/dom": "^8.11.3",
130
+ "@testing-library/jest-dom": "^5.16.1",
131
+ "@testing-library/react": "^12.1.2",
132
+ "@testing-library/react-hooks": "^7.0.2",
121
133
  "@types/react": "^17.0.0",
122
134
  "@types/react-dom": "^17.0.0",
123
- "babel-eslint": "10.x",
124
- "babel-jest": "^26.3.0",
125
- "babel-plugin-add-module-exports": "^1.0.2",
135
+ "@typescript-eslint/eslint-plugin": "^5.10.1",
136
+ "@typescript-eslint/parser": "^5.10.1",
137
+ "babel-jest": "^27.4.6",
138
+ "babel-plugin-add-module-exports": "^1.0.4",
126
139
  "babel-plugin-dynamic-import-node": "^2.3.3",
127
- "commitizen": "^4.2.1",
128
- "cross-env": "^7.0.2",
129
- "eslint": "7.x",
130
- "eslint-config-okonet": "^7.0.2",
131
- "eslint-config-prettier": "6.x",
132
- "eslint-plugin-import": "2.x",
133
- "eslint-plugin-jsx-a11y": "6.x",
134
- "eslint-plugin-node": "11.x",
135
- "eslint-plugin-prettier": "3.x",
136
- "eslint-plugin-react": "7.x",
137
- "eslint-plugin-react-hooks": "4.x",
138
- "husky": "^4.2.5",
139
- "imagemin-cli": "^6.0.0",
140
- "imagemin-pngquant": "^9.0.0",
141
- "jest": "^26.4.2",
142
- "lint-staged": "^10.3.0",
143
- "markdownlint-cli": "^0.23.2",
144
- "prettier": "*",
140
+ "commitizen": "^4.2.4",
141
+ "cross-env": "^7.0.3",
142
+ "eslint": "^8.8.0",
143
+ "eslint-config-prettier": "^8.3.0",
144
+ "eslint-plugin-import": "^2.25.4",
145
+ "eslint-plugin-jsx-a11y": "^6.5.1",
146
+ "eslint-plugin-node": "^11.1.0",
147
+ "eslint-plugin-prettier": "^4.0.0",
148
+ "eslint-plugin-react": "^7.28.0",
149
+ "eslint-plugin-react-hooks": "^4.3.0",
150
+ "husky": "^7.0.4",
151
+ "imagemin-cli": "^7.0.0",
152
+ "imagemin-pngquant": "^9.0.2",
153
+ "jest": "^27.4.7",
154
+ "lint-staged": "^12.3.2",
155
+ "markdownlint-cli": "^0.30.0",
156
+ "pinst": "^2.1.6",
157
+ "prettier": "^2.5.1",
145
158
  "react": "^17.0.0",
146
159
  "react-dom": "^17.0.0",
147
- "react-styleguidist": "^11.0.10",
160
+ "react-styleguidist": "^11.2.0",
148
161
  "react-test-renderer": "^17.0.0",
149
162
  "rimraf": "^3.0.2",
150
- "rollup": "^2.26.10",
151
- "rollup-plugin-babel": "^4.4.0",
152
- "rollup-plugin-commonjs": "^10.1.0",
153
- "rollup-plugin-node-resolve": "^5.2.0",
154
- "rollup-plugin-uglify": "^6.0.4",
155
- "sinon": "^9.0.3",
156
- "size-limit": "^4.5.7",
157
- "style-loader": "^1.2.1",
158
- "styled-components": "^5.2.0",
159
- "tslint": "^6.1.3",
163
+ "rollup": "^2.66.1",
164
+ "rollup-plugin-terser": "^7.0.2",
165
+ "size-limit": "^7.0.5",
166
+ "style-loader": "^3.3.1",
167
+ "styled-components": "^5.3.3",
160
168
  "typescript": "^4.0.2",
161
- "webpack": "^4.44.1",
169
+ "webpack": "^5.67.0",
162
170
  "webpack-blocks": "^2.1.0"
163
171
  },
164
172
  "typings": "typings/react-dropzone.d.ts",
165
- "config": {
166
- "commitizen": {
167
- "path": "@commitlint/prompt"
168
- }
169
- },
170
- "version": "11.5.2",
173
+ "version": "11.7.1",
171
174
  "engines": {
172
- "node": ">= 10"
175
+ "node": ">= 10.13"
173
176
  },
174
177
  "browserslist": [
175
178
  "defaults"
package/rollup.config.js CHANGED
@@ -1,7 +1,7 @@
1
- const nodeResolve = require('rollup-plugin-node-resolve')
2
- const commonjs = require('rollup-plugin-commonjs')
3
- const babel = require('rollup-plugin-babel')
4
- const { uglify } = require('rollup-plugin-uglify')
1
+ const { nodeResolve } = require('@rollup/plugin-node-resolve')
2
+ const commonjs = require('@rollup/plugin-commonjs')
3
+ const { babel } = require('@rollup/plugin-babel')
4
+ const { terser } = require('rollup-plugin-terser')
5
5
 
6
6
  const umdGlobals = {
7
7
  react: 'React',
@@ -23,8 +23,11 @@ module.exports = [
23
23
  plugins: [
24
24
  nodeResolve(),
25
25
  commonjs({ include: '**/node_modules/**' }),
26
- babel({ exclude: '**/node_modules/**' }),
27
- uglify()
26
+ babel({
27
+ exclude: '**/node_modules/**',
28
+ babelHelpers: 'bundled',
29
+ }),
30
+ terser()
28
31
  ]
29
32
  }
30
33
  ]
package/src/.eslintrc CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "root": true,
3
- "parser": "babel-eslint",
3
+ "parser": "@babel/eslint-parser",
4
4
  "parserOptions": {
5
5
  "ecmaVersion": 2017,
6
6
  "sourceType": "module"
@@ -23,12 +23,16 @@
23
23
  "eslint:recommended",
24
24
  "plugin:react/recommended",
25
25
  "plugin:jsx-a11y/recommended",
26
- "prettier",
27
- "prettier/react"
26
+ "prettier"
28
27
  ],
29
28
  "rules": {
30
29
  "react-hooks/rules-of-hooks": 2,
31
30
  "react/forbid-prop-types": 0,
32
31
  "react/require-default-props": 0
32
+ },
33
+ "settings": {
34
+ "react": {
35
+ "version": "detect"
36
+ }
33
37
  }
34
38
  }
@@ -1,3 +1,3 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`useDropzone() hook behavior renders the root and input nodes with the necessary props 1`] = `"<div tabindex=\\"0\\"><input multiple=\\"\\" type=\\"file\\" style=\\"display: none;\\" autocomplete=\\"off\\" tabindex=\\"-1\\"></div>"`;
3
+ exports[`useDropzone() hook behavior renders the root and input nodes with the necessary props 1`] = `"<div role=\\"button\\" tabindex=\\"0\\"><input multiple=\\"\\" type=\\"file\\" style=\\"display: none;\\" autocomplete=\\"off\\" tabindex=\\"-1\\"></div>"`;