react-dropzone
Advanced tools
Comparing version 11.1.0 to 11.2.0
@@ -137,2 +137,8 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } | ||
/** | ||
* Maximum accepted number of files | ||
* The default value is 0 which means there is no limitation to how many files are accepted. | ||
*/ | ||
maxFiles: PropTypes.number, | ||
/** | ||
* Enable/disable the dropzone | ||
@@ -181,3 +187,3 @@ */ | ||
* `accept` must be a valid [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml) according to [input element specification](https://www.w3.org/wiki/HTML/Elements/input/file) or a valid file extension. | ||
* If `multiple` is set to false and additional files are droppped, | ||
* If `multiple` is set to false and additional files are dropped, | ||
* all files besides the first will be rejected. | ||
@@ -349,3 +355,3 @@ * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well. | ||
* `accept` must be a valid [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml) according to [input element specification](https://www.w3.org/wiki/HTML/Elements/input/file) or a valid file extension. | ||
* If `multiple` is set to false and additional files are droppped, | ||
* If `multiple` is set to false and additional files are dropped, | ||
* all files besides the first will be rejected. | ||
@@ -388,2 +394,4 @@ * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well. | ||
multiple = _ref2$multiple === void 0 ? true : _ref2$multiple, | ||
_ref2$maxFiles = _ref2.maxFiles, | ||
maxFiles = _ref2$maxFiles === void 0 ? 0 : _ref2$maxFiles, | ||
onDragEnter = _ref2.onDragEnter, | ||
@@ -634,3 +642,3 @@ onDragLeave = _ref2.onDragLeave, | ||
if (!multiple && acceptedFiles.length > 1) { | ||
if (!multiple && acceptedFiles.length > 1 || multiple && maxFiles >= 1 && acceptedFiles.length > maxFiles) { | ||
// Reject everything and empty accepted files | ||
@@ -637,0 +645,0 @@ acceptedFiles.forEach(function (file) { |
@@ -168,3 +168,3 @@ { | ||
}, | ||
"version": "11.1.0", | ||
"version": "11.2.0", | ||
"engines": { | ||
@@ -171,0 +171,0 @@ "node": ">= 8" |
@@ -119,2 +119,7 @@ /* eslint prefer-template: 0 */ | ||
maxSize: PropTypes.number, | ||
/** | ||
* Maximum accepted number of files | ||
* The default value is 0 which means there is no limitation to how many files are accepted. | ||
*/ | ||
maxFiles: PropTypes.number, | ||
@@ -165,3 +170,3 @@ /** | ||
* `accept` must be a valid [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml) according to [input element specification](https://www.w3.org/wiki/HTML/Elements/input/file) or a valid file extension. | ||
* If `multiple` is set to false and additional files are droppped, | ||
* If `multiple` is set to false and additional files are dropped, | ||
* all files besides the first will be rejected. | ||
@@ -336,3 +341,3 @@ * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well. | ||
* `accept` must be a valid [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml) according to [input element specification](https://www.w3.org/wiki/HTML/Elements/input/file) or a valid file extension. | ||
* If `multiple` is set to false and additional files are droppped, | ||
* If `multiple` is set to false and additional files are dropped, | ||
* all files besides the first will be rejected. | ||
@@ -368,2 +373,3 @@ * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well. | ||
multiple = true, | ||
maxFiles = 0, | ||
onDragEnter, | ||
@@ -601,3 +607,3 @@ onDragLeave, | ||
if (!multiple && acceptedFiles.length > 1) { | ||
if ((!multiple && acceptedFiles.length > 1) || (multiple && maxFiles >= 1 && acceptedFiles.length > maxFiles)) { | ||
// Reject everything and empty accepted files | ||
@@ -609,3 +615,3 @@ acceptedFiles.forEach(file => { | ||
} | ||
dispatch({ | ||
@@ -612,0 +618,0 @@ acceptedFiles, |
@@ -49,2 +49,6 @@ /* eslint import/no-extraneous-dependencies: 0 */ | ||
{ | ||
name: 'Accepting specific number of files', | ||
content: 'examples/maxFiles/README.md' | ||
}, | ||
{ | ||
name: 'Opening File Dialog Programmatically', | ||
@@ -51,0 +55,0 @@ content: 'examples/file-dialog/README.md' |
@@ -25,2 +25,3 @@ import * as React from "react"; | ||
maxSize?: number; | ||
maxFiles?: number; | ||
preventDropOnDocument?: boolean; | ||
@@ -27,0 +28,0 @@ noClick?: boolean; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
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
333091
43
5293