react-dropzone 11.6.0 → 12.0.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.
package/.eslintrc CHANGED
@@ -15,10 +15,8 @@
15
15
  "prettier"
16
16
  ],
17
17
  "extends": [
18
- // TODO: Fix this so we can use
19
- // "okonet/node"
20
18
  "eslint:recommended",
21
- "prettier"
19
+ "plugin:prettier/recommended"
22
20
  ],
23
21
  "rules": {
24
22
  "strict": 0,
package/README.md CHANGED
@@ -6,7 +6,8 @@
6
6
  [![codecov](https://img.shields.io/codecov/c/gh/react-dropzone/react-dropzone/master.svg?style=flat-square)](https://codecov.io/gh/react-dropzone/react-dropzone)
7
7
  [![Open Collective Backers](https://img.shields.io/opencollective/backers/react-dropzone.svg?style=flat-square)](#backers)
8
8
  [![Open Collective Sponsors](https://img.shields.io/opencollective/sponsors/react-dropzone.svg?style=flat-square)](#sponsors)
9
- [![Gitpod](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod&style=flat-square)](https://gitpod.io/#https://github.com/react-dropzone/react-dropzone)
9
+ [![Gitpod](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod&style=flat-square)](https://gitpod.io/#https://github.com/react-dropzone/react-dropzone)
10
+ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg?style=flat-square)](https://github.com/react-dropzone/.github/blob/main/CODE_OF_CONDUCT.md)
10
11
 
11
12
  Simple React hook to create a HTML5-compliant drag'n'drop zone for files.
12
13
 
@@ -1 +1 @@
1
- module.exports = { extends: ['@commitlint/config-angular'] }
1
+ module.exports = { extends: ["@commitlint/config-angular"] };
package/dist/es/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var _excluded = ["children"],
2
2
  _excluded2 = ["open"],
3
- _excluded3 = ["refKey", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"],
3
+ _excluded3 = ["refKey", "role", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"],
4
4
  _excluded4 = ["refKey", "onChange", "onClick"];
5
5
 
6
6
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
@@ -34,10 +34,10 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
34
34
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
35
35
 
36
36
  /* eslint prefer-template: 0 */
37
- import React, { forwardRef, Fragment, useCallback, useEffect, useImperativeHandle, useMemo, useReducer, useRef } from 'react';
38
- import PropTypes from 'prop-types';
39
- import { fromEvent } from 'file-selector';
40
- import { allFilesAccepted, composeEventHandlers, fileAccepted, fileMatchSize, filePickerOptionsTypes, canUseFileSystemAccessAPI, isEvtWithFiles, isIeOrEdge, isPropagationStopped, onDocumentDragOver, TOO_MANY_FILES_REJECTION } from './utils/index';
37
+ import React, { forwardRef, Fragment, useCallback, useEffect, useImperativeHandle, useMemo, useReducer, useRef } from "react";
38
+ import PropTypes from "prop-types";
39
+ import { fromEvent } from "file-selector";
40
+ import { allFilesAccepted, composeEventHandlers, fileAccepted, fileMatchSize, filePickerOptionsTypes, canUseFileSystemAccessAPI, isEvtWithFiles, isIeOrEdge, isPropagationStopped, onDocumentDragOver, TOO_MANY_FILES_REJECTION } from "./utils/index";
41
41
  /**
42
42
  * Convenience wrapper component for the `useDropzone` hook
43
43
  *
@@ -71,7 +71,7 @@ var Dropzone = /*#__PURE__*/forwardRef(function (_ref, ref) {
71
71
  open: open
72
72
  })));
73
73
  });
74
- Dropzone.displayName = 'Dropzone'; // Add default props for react-docgen
74
+ Dropzone.displayName = "Dropzone"; // Add default props for react-docgen
75
75
 
76
76
  var defaultProps = {
77
77
  disabled: false,
@@ -85,7 +85,8 @@ var defaultProps = {
85
85
  noKeyboard: false,
86
86
  noDrag: false,
87
87
  noDragEventsBubbling: false,
88
- validator: null
88
+ validator: null,
89
+ useFsAccessApi: true
89
90
  };
90
91
  Dropzone.defaultProps = defaultProps;
91
92
  Dropzone.propTypes = {
@@ -186,6 +187,12 @@ Dropzone.propTypes = {
186
187
  */
187
188
  onFileDialogOpen: PropTypes.func,
188
189
 
190
+ /**
191
+ * Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
192
+ * to open the file picker instead of using an `<input type="file">` click event.
193
+ */
194
+ useFsAccessApi: PropTypes.bool,
195
+
189
196
  /**
190
197
  * Cb for when the `dragenter` event occurs.
191
198
  *
@@ -379,6 +386,8 @@ var initialState = {
379
386
  * @param {boolean} [props.disabled=false] Enable/disable the dropzone
380
387
  * @param {getFilesFromEvent} [props.getFilesFromEvent] Use this to provide a custom file aggregator
381
388
  * @param {Function} [props.onFileDialogCancel] Cb for when closing the file dialog with no selection
389
+ * @param {boolean} [props.useFsAccessApi] Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
390
+ * to open the file picker instead of using an `<input type="file">` click event.
382
391
  * @param {Function} [props.onFileDialogOpen] Cb for when opening the file dialog
383
392
  * @param {dragCb} [props.onDragEnter] Cb for when the `dragenter` event occurs.
384
393
  * @param {dragCb} [props.onDragLeave] Cb for when the `dragleave` event occurs
@@ -432,6 +441,7 @@ export function useDropzone() {
432
441
  onDropRejected = _defaultProps$options.onDropRejected,
433
442
  onFileDialogCancel = _defaultProps$options.onFileDialogCancel,
434
443
  onFileDialogOpen = _defaultProps$options.onFileDialogOpen,
444
+ useFsAccessApi = _defaultProps$options.useFsAccessApi,
435
445
  preventDropOnDocument = _defaultProps$options.preventDropOnDocument,
436
446
  noClick = _defaultProps$options.noClick,
437
447
  noKeyboard = _defaultProps$options.noKeyboard,
@@ -440,10 +450,10 @@ export function useDropzone() {
440
450
  validator = _defaultProps$options.validator;
441
451
 
442
452
  var onFileDialogOpenCb = useMemo(function () {
443
- return typeof onFileDialogOpen === 'function' ? onFileDialogOpen : noop;
453
+ return typeof onFileDialogOpen === "function" ? onFileDialogOpen : noop;
444
454
  }, [onFileDialogOpen]);
445
455
  var onFileDialogCancelCb = useMemo(function () {
446
- return typeof onFileDialogCancel === 'function' ? onFileDialogCancel : noop;
456
+ return typeof onFileDialogCancel === "function" ? onFileDialogCancel : noop;
447
457
  }, [onFileDialogCancel]);
448
458
  var rootRef = useRef(null);
449
459
  var inputRef = useRef(null);
@@ -466,7 +476,7 @@ export function useDropzone() {
466
476
 
467
477
  if (!files.length) {
468
478
  dispatch({
469
- type: 'closeDialog'
479
+ type: "closeDialog"
470
480
  });
471
481
  onFileDialogCancelCb();
472
482
  }
@@ -476,15 +486,15 @@ export function useDropzone() {
476
486
  };
477
487
 
478
488
  useEffect(function () {
479
- if (canUseFileSystemAccessAPI()) {
489
+ if (useFsAccessApi && canUseFileSystemAccessAPI()) {
480
490
  return function () {};
481
491
  }
482
492
 
483
- window.addEventListener('focus', onWindowFocus, false);
493
+ window.addEventListener("focus", onWindowFocus, false);
484
494
  return function () {
485
- window.removeEventListener('focus', onWindowFocus, false);
495
+ window.removeEventListener("focus", onWindowFocus, false);
486
496
  };
487
- }, [inputRef, isFileDialogActive, onFileDialogCancelCb]);
497
+ }, [inputRef, isFileDialogActive, onFileDialogCancelCb, useFsAccessApi]);
488
498
  var dragTargetsRef = useRef([]);
489
499
 
490
500
  var onDocumentDrop = function onDocumentDrop(event) {
@@ -499,14 +509,14 @@ export function useDropzone() {
499
509
 
500
510
  useEffect(function () {
501
511
  if (preventDropOnDocument) {
502
- document.addEventListener('dragover', onDocumentDragOver, false);
503
- document.addEventListener('drop', onDocumentDrop, false);
512
+ document.addEventListener("dragover", onDocumentDragOver, false);
513
+ document.addEventListener("drop", onDocumentDrop, false);
504
514
  }
505
515
 
506
516
  return function () {
507
517
  if (preventDropOnDocument) {
508
- document.removeEventListener('dragover', onDocumentDragOver);
509
- document.removeEventListener('drop', onDocumentDrop);
518
+ document.removeEventListener("dragover", onDocumentDragOver);
519
+ document.removeEventListener("drop", onDocumentDrop);
510
520
  }
511
521
  };
512
522
  }, [rootRef, preventDropOnDocument]);
@@ -526,7 +536,7 @@ export function useDropzone() {
526
536
  dispatch({
527
537
  draggedFiles: draggedFiles,
528
538
  isDragActive: true,
529
- type: 'setDraggedFiles'
539
+ type: "setDraggedFiles"
530
540
  });
531
541
 
532
542
  if (onDragEnter) {
@@ -543,7 +553,7 @@ export function useDropzone() {
543
553
 
544
554
  if (hasFiles && event.dataTransfer) {
545
555
  try {
546
- event.dataTransfer.dropEffect = 'copy';
556
+ event.dataTransfer.dropEffect = "copy";
547
557
  } catch (_unused) {}
548
558
  /* eslint-disable-line no-empty */
549
559
 
@@ -579,7 +589,7 @@ export function useDropzone() {
579
589
 
580
590
  dispatch({
581
591
  isDragActive: false,
582
- type: 'setDraggedFiles',
592
+ type: "setDraggedFiles",
583
593
  draggedFiles: []
584
594
  });
585
595
 
@@ -635,7 +645,7 @@ export function useDropzone() {
635
645
  dispatch({
636
646
  acceptedFiles: acceptedFiles,
637
647
  fileRejections: fileRejections,
638
- type: 'setFiles'
648
+ type: "setFiles"
639
649
  });
640
650
 
641
651
  if (onDrop) {
@@ -668,14 +678,14 @@ export function useDropzone() {
668
678
  }
669
679
 
670
680
  dispatch({
671
- type: 'reset'
681
+ type: "reset"
672
682
  });
673
683
  }, [getFilesFromEvent, setFiles, noDragEventsBubbling]); // Fn for opening the file dialog programmatically
674
684
 
675
685
  var openFileDialog = useCallback(function () {
676
- if (canUseFileSystemAccessAPI()) {
686
+ if (useFsAccessApi && canUseFileSystemAccessAPI()) {
677
687
  dispatch({
678
- type: 'openDialog'
688
+ type: "openDialog"
679
689
  });
680
690
  onFileDialogOpenCb(); // https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker
681
691
 
@@ -691,7 +701,7 @@ export function useDropzone() {
691
701
  return onFileDialogCancelCb(e);
692
702
  }).finally(function () {
693
703
  return dispatch({
694
- type: 'closeDialog'
704
+ type: "closeDialog"
695
705
  });
696
706
  });
697
707
  return;
@@ -699,13 +709,13 @@ export function useDropzone() {
699
709
 
700
710
  if (inputRef.current) {
701
711
  dispatch({
702
- type: 'openDialog'
712
+ type: "openDialog"
703
713
  });
704
714
  onFileDialogOpenCb();
705
715
  inputRef.current.value = null;
706
716
  inputRef.current.click();
707
717
  }
708
- }, [dispatch, onFileDialogOpenCb, onFileDialogCancelCb, setFiles, accept, multiple]); // Cb to open the file dialog when SPACE/ENTER occurs on the dropzone
718
+ }, [dispatch, onFileDialogOpenCb, onFileDialogCancelCb, useFsAccessApi, setFiles, accept, multiple]); // Cb to open the file dialog when SPACE/ENTER occurs on the dropzone
709
719
 
710
720
  var onKeyDownCb = useCallback(function (event) {
711
721
  // Ignore keyboard events bubbling up the DOM tree
@@ -721,12 +731,12 @@ export function useDropzone() {
721
731
 
722
732
  var onFocusCb = useCallback(function () {
723
733
  dispatch({
724
- type: 'focus'
734
+ type: "focus"
725
735
  });
726
736
  }, []);
727
737
  var onBlurCb = useCallback(function () {
728
738
  dispatch({
729
- type: 'blur'
739
+ type: "blur"
730
740
  });
731
741
  }, []); // Cb to open the file dialog when click occurs on the dropzone
732
742
 
@@ -767,7 +777,8 @@ export function useDropzone() {
767
777
  return function () {
768
778
  var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
769
779
  _ref2$refKey = _ref2.refKey,
770
- refKey = _ref2$refKey === void 0 ? 'ref' : _ref2$refKey,
780
+ refKey = _ref2$refKey === void 0 ? "ref" : _ref2$refKey,
781
+ role = _ref2.role,
771
782
  onKeyDown = _ref2.onKeyDown,
772
783
  onFocus = _ref2.onFocus,
773
784
  onBlur = _ref2.onBlur,
@@ -786,7 +797,8 @@ export function useDropzone() {
786
797
  onDragEnter: composeDragHandler(composeEventHandlers(onDragEnter, onDragEnterCb)),
787
798
  onDragOver: composeDragHandler(composeEventHandlers(onDragOver, onDragOverCb)),
788
799
  onDragLeave: composeDragHandler(composeEventHandlers(onDragLeave, onDragLeaveCb)),
789
- onDrop: composeDragHandler(composeEventHandlers(onDrop, onDropCb))
800
+ onDrop: composeDragHandler(composeEventHandlers(onDrop, onDropCb)),
801
+ role: typeof role === "string" && role !== "" ? role : "button"
790
802
  }, refKey, rootRef), !disabled && !noKeyboard ? {
791
803
  tabIndex: 0
792
804
  } : {}), rest);
@@ -799,7 +811,7 @@ export function useDropzone() {
799
811
  return function () {
800
812
  var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
801
813
  _ref3$refKey = _ref3.refKey,
802
- refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
814
+ refKey = _ref3$refKey === void 0 ? "ref" : _ref3$refKey,
803
815
  onChange = _ref3.onChange,
804
816
  onClick = _ref3.onClick,
805
817
  rest = _objectWithoutProperties(_ref3, _excluded4);
@@ -807,13 +819,13 @@ export function useDropzone() {
807
819
  var inputProps = _defineProperty({
808
820
  accept: accept,
809
821
  multiple: multiple,
810
- type: 'file',
822
+ type: "file",
811
823
  style: {
812
- display: 'none'
824
+ display: "none"
813
825
  },
814
826
  onChange: composeHandler(composeEventHandlers(onChange, onDropCb)),
815
827
  onClick: composeHandler(composeEventHandlers(onClick, onInputElementClick)),
816
- autoComplete: 'off',
828
+ autoComplete: "off",
817
829
  tabIndex: -1
818
830
  }, refKey, inputRef);
819
831
 
@@ -845,27 +857,27 @@ export function useDropzone() {
845
857
  function reducer(state, action) {
846
858
  /* istanbul ignore next */
847
859
  switch (action.type) {
848
- case 'focus':
860
+ case "focus":
849
861
  return _objectSpread(_objectSpread({}, state), {}, {
850
862
  isFocused: true
851
863
  });
852
864
 
853
- case 'blur':
865
+ case "blur":
854
866
  return _objectSpread(_objectSpread({}, state), {}, {
855
867
  isFocused: false
856
868
  });
857
869
 
858
- case 'openDialog':
870
+ case "openDialog":
859
871
  return _objectSpread(_objectSpread({}, initialState), {}, {
860
872
  isFileDialogActive: true
861
873
  });
862
874
 
863
- case 'closeDialog':
875
+ case "closeDialog":
864
876
  return _objectSpread(_objectSpread({}, state), {}, {
865
877
  isFileDialogActive: false
866
878
  });
867
879
 
868
- case 'setDraggedFiles':
880
+ case "setDraggedFiles":
869
881
  /* eslint no-case-declarations: 0 */
870
882
  var isDragActive = action.isDragActive,
871
883
  draggedFiles = action.draggedFiles;
@@ -874,13 +886,13 @@ function reducer(state, action) {
874
886
  isDragActive: isDragActive
875
887
  });
876
888
 
877
- case 'setFiles':
889
+ case "setFiles":
878
890
  return _objectSpread(_objectSpread({}, state), {}, {
879
891
  acceptedFiles: action.acceptedFiles,
880
892
  fileRejections: action.fileRejections
881
893
  });
882
894
 
883
- case 'reset':
895
+ case "reset":
884
896
  return _objectSpread({}, initialState);
885
897
 
886
898
  default:
@@ -890,4 +902,4 @@ function reducer(state, action) {
890
902
 
891
903
  function noop() {}
892
904
 
893
- export { ErrorCode } from './utils';
905
+ export { ErrorCode } from "./utils";
@@ -18,12 +18,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
18
18
 
19
19
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
20
 
21
- import accepts from 'attr-accept'; // Error codes
21
+ import accepts from "attr-accept"; // Error codes
22
22
 
23
- export var FILE_INVALID_TYPE = 'file-invalid-type';
24
- export var FILE_TOO_LARGE = 'file-too-large';
25
- export var FILE_TOO_SMALL = 'file-too-small';
26
- export var TOO_MANY_FILES = 'too-many-files';
23
+ export var FILE_INVALID_TYPE = "file-invalid-type";
24
+ export var FILE_TOO_LARGE = "file-too-large";
25
+ export var FILE_TOO_SMALL = "file-too-small";
26
+ export var TOO_MANY_FILES = "too-many-files";
27
27
  export var ErrorCode = {
28
28
  FileInvalidType: FILE_INVALID_TYPE,
29
29
  FileTooLarge: FILE_TOO_LARGE,
@@ -33,7 +33,7 @@ export var ErrorCode = {
33
33
 
34
34
  export var getInvalidTypeRejectionErr = function getInvalidTypeRejectionErr(accept) {
35
35
  accept = Array.isArray(accept) && accept.length === 1 ? accept[0] : accept;
36
- var messageSuffix = Array.isArray(accept) ? "one of ".concat(accept.join(', ')) : accept;
36
+ var messageSuffix = Array.isArray(accept) ? "one of ".concat(accept.join(", ")) : accept;
37
37
  return {
38
38
  code: FILE_INVALID_TYPE,
39
39
  message: "File type must be ".concat(messageSuffix)
@@ -42,23 +42,23 @@ export var getInvalidTypeRejectionErr = function getInvalidTypeRejectionErr(acce
42
42
  export var getTooLargeRejectionErr = function getTooLargeRejectionErr(maxSize) {
43
43
  return {
44
44
  code: FILE_TOO_LARGE,
45
- message: "File is larger than ".concat(maxSize, " ").concat(maxSize === 1 ? 'byte' : 'bytes')
45
+ message: "File is larger than ".concat(maxSize, " ").concat(maxSize === 1 ? "byte" : "bytes")
46
46
  };
47
47
  };
48
48
  export var getTooSmallRejectionErr = function getTooSmallRejectionErr(minSize) {
49
49
  return {
50
50
  code: FILE_TOO_SMALL,
51
- message: "File is smaller than ".concat(minSize, " ").concat(minSize === 1 ? 'byte' : 'bytes')
51
+ message: "File is smaller than ".concat(minSize, " ").concat(minSize === 1 ? "byte" : "bytes")
52
52
  };
53
53
  };
54
54
  export var TOO_MANY_FILES_REJECTION = {
55
55
  code: TOO_MANY_FILES,
56
- message: 'Too many files'
56
+ message: "Too many files"
57
57
  }; // Firefox versions prior to 53 return a bogus MIME type for every file drag, so dragovers with
58
58
  // that MIME type will always be accepted
59
59
 
60
60
  export function fileAccepted(file, accept) {
61
- var isAcceptable = file.type === 'application/x-moz-file' || accepts(file, accept);
61
+ var isAcceptable = file.type === "application/x-moz-file" || accepts(file, accept);
62
62
  return [isAcceptable, isAcceptable ? null : getInvalidTypeRejectionErr(accept)];
63
63
  }
64
64
  export function fileMatchSize(file, minSize, maxSize) {
@@ -104,9 +104,9 @@ export function allFilesAccepted(_ref) {
104
104
  // to check event.cancelBubble
105
105
 
106
106
  export function isPropagationStopped(event) {
107
- if (typeof event.isPropagationStopped === 'function') {
107
+ if (typeof event.isPropagationStopped === "function") {
108
108
  return event.isPropagationStopped();
109
- } else if (typeof event.cancelBubble !== 'undefined') {
109
+ } else if (typeof event.cancelBubble !== "undefined") {
110
110
  return event.cancelBubble;
111
111
  }
112
112
 
@@ -120,11 +120,11 @@ export function isEvtWithFiles(event) {
120
120
 
121
121
 
122
122
  return Array.prototype.some.call(event.dataTransfer.types, function (type) {
123
- return type === 'Files' || type === 'application/x-moz-file';
123
+ return type === "Files" || type === "application/x-moz-file";
124
124
  });
125
125
  }
126
126
  export function isKindFile(item) {
127
- return _typeof(item) === 'object' && item !== null && item.kind === 'file';
127
+ return _typeof(item) === "object" && item !== null && item.kind === "file";
128
128
  } // allow the entire document to be a drag target
129
129
 
130
130
  export function onDocumentDragOver(event) {
@@ -132,11 +132,11 @@ export function onDocumentDragOver(event) {
132
132
  }
133
133
 
134
134
  function isIe(userAgent) {
135
- return userAgent.indexOf('MSIE') !== -1 || userAgent.indexOf('Trident/') !== -1;
135
+ return userAgent.indexOf("MSIE") !== -1 || userAgent.indexOf("Trident/") !== -1;
136
136
  }
137
137
 
138
138
  function isEdge(userAgent) {
139
- return userAgent.indexOf('Edge/') !== -1;
139
+ return userAgent.indexOf("Edge/") !== -1;
140
140
  }
141
141
 
142
142
  export function isIeOrEdge() {
@@ -180,7 +180,7 @@ export function composeEventHandlers() {
180
180
  */
181
181
 
182
182
  export function canUseFileSystemAccessAPI() {
183
- return 'showOpenFilePicker' in window;
183
+ return "showOpenFilePicker" in window;
184
184
  }
185
185
  /**
186
186
  * filePickerOptionsTypes returns the {types} option for https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker
@@ -190,14 +190,14 @@ export function canUseFileSystemAccessAPI() {
190
190
  */
191
191
 
192
192
  export function filePickerOptionsTypes(accept) {
193
- accept = typeof accept === 'string' ? accept.split(',') : accept;
193
+ accept = typeof accept === "string" ? accept.split(",") : accept;
194
194
  return [{
195
- description: 'everything',
195
+ description: "everything",
196
196
  // TODO: Need to handle filtering more elegantly than this!
197
- accept: Array.isArray(accept) // Accept just MIME types as per spec
197
+ accept: Array.isArray(accept) ? // Accept just MIME types as per spec
198
198
  // NOTE: accept can be https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers
199
- ? accept.filter(function (item) {
200
- return item === 'audio/*' || item === 'video/*' || item === 'image/*' || item === 'text/*' || /\w+\/[-+.\w]+/g.test(item);
199
+ accept.filter(function (item) {
200
+ return item === "audio/*" || item === "video/*" || item === "image/*" || item === "text/*" || /\w+\/[-+.\w]+/g.test(item);
201
201
  }).reduce(function (a, b) {
202
202
  return _objectSpread(_objectSpread({}, a), {}, _defineProperty({}, b, []));
203
203
  }, {}) : {}