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/src/utils/index.spec.js
CHANGED
|
@@ -260,3 +260,18 @@ function createFile(name, size, type) {
|
|
|
260
260
|
return file
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
+
describe('ErrorCode', () => {
|
|
264
|
+
let utils
|
|
265
|
+
beforeEach(async done => {
|
|
266
|
+
utils = await import('./index')
|
|
267
|
+
done()
|
|
268
|
+
})
|
|
269
|
+
|
|
270
|
+
it('should exist and have known error code properties', () => {
|
|
271
|
+
expect(utils.ErrorCode.FileInvalidType).toEqual(utils.FILE_INVALID_TYPE)
|
|
272
|
+
expect(utils.ErrorCode.FileTooLarge).toEqual(utils.FILE_TOO_LARGE)
|
|
273
|
+
expect(utils.ErrorCode.FileTooSmall).toEqual(utils.FILE_TOO_SMALL)
|
|
274
|
+
expect(utils.ErrorCode.TooManyFiles).toEqual(utils.TOO_MANY_FILES)
|
|
275
|
+
})
|
|
276
|
+
})
|
|
277
|
+
|
|
@@ -8,9 +8,16 @@ export interface DropzoneProps extends DropzoneOptions {
|
|
|
8
8
|
children?(state: DropzoneState): JSX.Element;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
export enum ErrorCode {
|
|
12
|
+
FileInvalidType = 'file-invalid-type',
|
|
13
|
+
FileTooLarge = 'file-too-large',
|
|
14
|
+
FileTooSmall = 'file-too-small',
|
|
15
|
+
TooManyFiles = 'too-many-files',
|
|
16
|
+
}
|
|
17
|
+
|
|
11
18
|
export interface FileError {
|
|
12
19
|
message: string;
|
|
13
|
-
code:
|
|
20
|
+
code: ErrorCode | string;
|
|
14
21
|
}
|
|
15
22
|
|
|
16
23
|
export interface FileRejection {
|