react-dropzone 11.3.4 → 11.4.2
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.
- package/README.md +5 -3
- package/dist/es/index.js +15 -8
- package/dist/es/utils/index.js +8 -2
- package/dist/index.js +2 -2
- package/examples/accept/README.md +1 -1
- package/examples/events/README.md +1 -1
- package/package.json +9 -9
- package/src/index.js +2 -0
- package/src/utils/index.js +7 -0
- package/src/utils/index.spec.js +15 -0
- package/typings/react-dropzone.d.ts +8 -1
- package/vendor/doka/doka.esm.min.js +0 -10
- package/vendor/doka/doka.min.css +0 -11
package/README.md
CHANGED
|
@@ -142,7 +142,7 @@ This is in order to avoid your props being overridden (or overriding the props r
|
|
|
142
142
|
In the example above, the provided `{onClick}` handler will be invoked before the internal one, therefore, internal callbacks can be prevented by simply using [stopPropagation](https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation).
|
|
143
143
|
See [Events](https://react-dropzone.js.org#events) for more examples.
|
|
144
144
|
|
|
145
|
-
*Important*: if you
|
|
145
|
+
*Important*: if you omit rendering an `<input>` and/or binding the props from `getInputProps()`, opening a file dialog will not be possible.
|
|
146
146
|
|
|
147
147
|
## Refs
|
|
148
148
|
|
|
@@ -294,9 +294,11 @@ More examples for this can be found in `react-dropzone`s own [test suites](https
|
|
|
294
294
|
|
|
295
295
|
## Need image editing?
|
|
296
296
|
|
|
297
|
-
React Dropzone integrates perfectly with [Doka Image Editor](https://pqina.nl/doka/?ref=react-dropzone), creating a modern image editing experience. Doka supports crop aspect ratios, resizing, rotating, cropping, annotating, filtering, and much more.
|
|
298
297
|
|
|
299
|
-
|
|
298
|
+
|
|
299
|
+
React Dropzone integrates perfectly with [Pintura Image Editor](https://pqina.nl/pintura/?ref=react-dropzone), creating a modern image editing experience. Pintura supports crop aspect ratios, resizing, rotating, cropping, annotating, filtering, and much more.
|
|
300
|
+
|
|
301
|
+
Checkout the [Pintura integration example](https://codesandbox.io/s/react-dropzone-pintura-40xh4?file=/src/App.js).
|
|
300
302
|
|
|
301
303
|
## Supported Browsers
|
|
302
304
|
|
package/dist/es/index.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
var _excluded = ["children"],
|
|
2
|
+
_excluded2 = ["open"],
|
|
3
|
+
_excluded3 = ["refKey", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"],
|
|
4
|
+
_excluded4 = ["refKey", "onChange", "onClick"];
|
|
5
|
+
|
|
1
6
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
7
|
|
|
3
8
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
9
|
|
|
5
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator
|
|
10
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
11
|
|
|
7
12
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
8
13
|
|
|
@@ -14,11 +19,11 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
14
19
|
|
|
15
20
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
16
21
|
|
|
17
|
-
function _iterableToArrayLimit(arr, i) {
|
|
22
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
18
23
|
|
|
19
24
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
25
|
|
|
21
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
26
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
22
27
|
|
|
23
28
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
24
29
|
|
|
@@ -50,11 +55,11 @@ import { allFilesAccepted, composeEventHandlers, fileAccepted, fileMatchSize, is
|
|
|
50
55
|
|
|
51
56
|
var Dropzone = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
52
57
|
var children = _ref.children,
|
|
53
|
-
params = _objectWithoutProperties(_ref,
|
|
58
|
+
params = _objectWithoutProperties(_ref, _excluded);
|
|
54
59
|
|
|
55
60
|
var _useDropzone = useDropzone(params),
|
|
56
61
|
open = _useDropzone.open,
|
|
57
|
-
props = _objectWithoutProperties(_useDropzone,
|
|
62
|
+
props = _objectWithoutProperties(_useDropzone, _excluded2);
|
|
58
63
|
|
|
59
64
|
useImperativeHandle(ref, function () {
|
|
60
65
|
return {
|
|
@@ -729,7 +734,7 @@ export function useDropzone() {
|
|
|
729
734
|
onDragOver = _ref2.onDragOver,
|
|
730
735
|
onDragLeave = _ref2.onDragLeave,
|
|
731
736
|
onDrop = _ref2.onDrop,
|
|
732
|
-
rest = _objectWithoutProperties(_ref2,
|
|
737
|
+
rest = _objectWithoutProperties(_ref2, _excluded3);
|
|
733
738
|
|
|
734
739
|
return _objectSpread(_objectSpread(_defineProperty({
|
|
735
740
|
onKeyDown: composeKeyboardHandler(composeEventHandlers(onKeyDown, onKeyDownCb)),
|
|
@@ -755,7 +760,7 @@ export function useDropzone() {
|
|
|
755
760
|
refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
|
|
756
761
|
onChange = _ref3.onChange,
|
|
757
762
|
onClick = _ref3.onClick,
|
|
758
|
-
rest = _objectWithoutProperties(_ref3,
|
|
763
|
+
rest = _objectWithoutProperties(_ref3, _excluded4);
|
|
759
764
|
|
|
760
765
|
var inputProps = _defineProperty({
|
|
761
766
|
accept: accept,
|
|
@@ -839,4 +844,6 @@ function reducer(state, action) {
|
|
|
839
844
|
default:
|
|
840
845
|
return state;
|
|
841
846
|
}
|
|
842
|
-
}
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
export { ErrorCode } from './utils';
|
package/dist/es/utils/index.js
CHANGED
|
@@ -8,7 +8,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
8
8
|
|
|
9
9
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
10
10
|
|
|
11
|
-
function _iterableToArrayLimit(arr, i) {
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
12
12
|
|
|
13
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
14
|
|
|
@@ -17,7 +17,13 @@ import accepts from 'attr-accept'; // Error codes
|
|
|
17
17
|
export var FILE_INVALID_TYPE = 'file-invalid-type';
|
|
18
18
|
export var FILE_TOO_LARGE = 'file-too-large';
|
|
19
19
|
export var FILE_TOO_SMALL = 'file-too-small';
|
|
20
|
-
export var TOO_MANY_FILES = 'too-many-files';
|
|
20
|
+
export var TOO_MANY_FILES = 'too-many-files';
|
|
21
|
+
export var ErrorCode = {
|
|
22
|
+
FileInvalidType: FILE_INVALID_TYPE,
|
|
23
|
+
FileTooLarge: FILE_TOO_LARGE,
|
|
24
|
+
FileTooSmall: FILE_TOO_SMALL,
|
|
25
|
+
TooManyFiles: TOO_MANY_FILES
|
|
26
|
+
}; // File Errors
|
|
21
27
|
|
|
22
28
|
export var getInvalidTypeRejectionErr = function getInvalidTypeRejectionErr(accept) {
|
|
23
29
|
accept = Array.isArray(accept) && accept.length === 1 ? accept[0] : accept;
|