react-dropzone 14.4.1 → 15.0.0
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/CHANGELOG.md +6 -3
- package/dist/es/index.js +10 -7
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/src/index.js +10 -7
- package/src/index.spec.js +62 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
# [15.0.0](https://github.com/react-dropzone/react-dropzone/compare/v14.4.1...v15.0.0) (2026-02-10)
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
* fix!: reset isDragReject after drop ([c9d1c31](https://github.com/react-dropzone/react-dropzone/commit/c9d1c3197fcef7ebff8b50f933720f48b982c895))
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
### BREAKING CHANGES
|
|
8
|
+
|
|
9
|
+
* isDragReject only reflects active drag state and is cleared after drop. Use fileRejections or onDropRejected/onDrop for post-drop rejection UI.
|
package/dist/es/index.js
CHANGED
|
@@ -102,10 +102,10 @@ Dropzone.propTypes = {
|
|
|
102
102
|
* @param {boolean} params.isFileDialogActive File dialog is opened
|
|
103
103
|
* @param {boolean} params.isDragActive Active drag is in progress
|
|
104
104
|
* @param {boolean} params.isDragAccept Dragged files are accepted
|
|
105
|
-
* @param {boolean} params.isDragReject
|
|
105
|
+
* @param {boolean} params.isDragReject True only during an active drag when some dragged files would be rejected. After drop, this resets to false. Use fileRejections for post-drop errors.
|
|
106
106
|
* @param {boolean} params.isDragGlobal Files are being dragged anywhere on the document
|
|
107
107
|
* @param {File[]} params.acceptedFiles Accepted files
|
|
108
|
-
* @param {FileRejection[]} params.fileRejections Rejected files and why they were rejected
|
|
108
|
+
* @param {FileRejection[]} params.fileRejections Rejected files and why they were rejected. This persists after drop and is the source of truth for post-drop rejections.
|
|
109
109
|
*/
|
|
110
110
|
children: PropTypes.func,
|
|
111
111
|
|
|
@@ -299,7 +299,7 @@ export default Dropzone;
|
|
|
299
299
|
*
|
|
300
300
|
* @callback dropCb
|
|
301
301
|
* @param {File[]} acceptedFiles List of accepted files
|
|
302
|
-
* @param {FileRejection[]} fileRejections List of rejected files and why they were rejected
|
|
302
|
+
* @param {FileRejection[]} fileRejections List of rejected files and why they were rejected. This is the authoritative source for post-drop file rejections.
|
|
303
303
|
* @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
|
|
304
304
|
*/
|
|
305
305
|
|
|
@@ -339,10 +339,10 @@ export default Dropzone;
|
|
|
339
339
|
* @property {boolean} isFileDialogActive File dialog is opened
|
|
340
340
|
* @property {boolean} isDragActive Active drag is in progress
|
|
341
341
|
* @property {boolean} isDragAccept Dragged files are accepted
|
|
342
|
-
* @property {boolean} isDragReject
|
|
342
|
+
* @property {boolean} isDragReject True only during an active drag when some dragged files would be rejected. After drop, this resets to false. Use fileRejections for post-drop errors.
|
|
343
343
|
* @property {boolean} isDragGlobal Files are being dragged anywhere on the document
|
|
344
344
|
* @property {File[]} acceptedFiles Accepted files
|
|
345
|
-
* @property {FileRejection[]} fileRejections Rejected files and why they were rejected
|
|
345
|
+
* @property {FileRejection[]} fileRejections Rejected files and why they were rejected. This persists after drop and is the source of truth for post-drop rejections.
|
|
346
346
|
*/
|
|
347
347
|
|
|
348
348
|
/**
|
|
@@ -422,6 +422,10 @@ var initialState = {
|
|
|
422
422
|
* Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected.
|
|
423
423
|
* If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props.
|
|
424
424
|
*
|
|
425
|
+
* The second parameter (fileRejections) is the authoritative list of rejected files after a drop.
|
|
426
|
+
* Use this parameter or the fileRejections state property to handle post-drop file rejections,
|
|
427
|
+
* as isDragReject only indicates rejection state during active drag operations.
|
|
428
|
+
*
|
|
425
429
|
* `onDrop` will provide you with an array of [File](https://developer.mozilla.org/en-US/docs/Web/API/File) objects which you can then process and send to a server.
|
|
426
430
|
* For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
|
|
427
431
|
*
|
|
@@ -761,7 +765,6 @@ export function useDropzone() {
|
|
|
761
765
|
dispatch({
|
|
762
766
|
acceptedFiles: acceptedFiles,
|
|
763
767
|
fileRejections: fileRejections,
|
|
764
|
-
isDragReject: fileRejections.length > 0,
|
|
765
768
|
type: "setFiles"
|
|
766
769
|
});
|
|
767
770
|
|
|
@@ -1027,7 +1030,7 @@ function reducer(state, action) {
|
|
|
1027
1030
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
1028
1031
|
acceptedFiles: action.acceptedFiles,
|
|
1029
1032
|
fileRejections: action.fileRejections,
|
|
1030
|
-
isDragReject:
|
|
1033
|
+
isDragReject: false
|
|
1031
1034
|
});
|
|
1032
1035
|
|
|
1033
1036
|
case "setDragGlobal":
|