@availity/mui-file-selector 1.7.1 → 1.8.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/CHANGELOG.md +21 -0
- package/dist/index.d.mts +37 -7
- package/dist/index.d.ts +37 -7
- package/dist/index.js +214 -66
- package/dist/index.mjs +222 -74
- package/package.json +1 -1
- package/src/lib/Dropzone.tsx +101 -4
- package/src/lib/Dropzone2.tsx +91 -5
- package/src/lib/ErrorAlert.tsx +1 -0
- package/src/lib/FileSelector.tsx +21 -1
- package/src/lib/FileSelector2.tsx +8 -1
- package/src/lib/FileTypesMessage.tsx +14 -0
- package/src/lib/HeaderMessage.tsx +8 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [1.8.1](https://github.com/Availity/element/compare/@availity/mui-file-selector@1.8.0...@availity/mui-file-selector@1.8.1) (2025-06-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **mui-file-selector:** ensure allowedFileTypes and allowedFileNameCharacters validation ([bb0f3ea](https://github.com/Availity/element/commit/bb0f3eaa1dcab2e82f5037f534e959321366701a))
|
|
11
|
+
|
|
12
|
+
## [1.8.0](https://github.com/Availity/element/compare/@availity/mui-file-selector@1.7.1...@availity/mui-file-selector@1.8.0) (2025-06-16)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **mui-file-selector:** add maxTotalSize check to FileSelector ([03f78d6](https://github.com/Availity/element/commit/03f78d674243a76cc6d3e65a20b6e8ce3a46b8ca))
|
|
18
|
+
* **mui-file-selector:** add maxTotalSize check to FileSelector ([802e2ae](https://github.com/Availity/element/commit/802e2ae502aa8727037e2998849acf01a6ea0382))
|
|
19
|
+
* **mui-file-selector:** add maxTotalSize check to FileSelector2 ([ccd0cfa](https://github.com/Availity/element/commit/ccd0cfa95610d6e354402a3fa698b63b6659644c))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* **mui-file-selector:** ensure only the maximum amount of files are uploaded ([5d80d2b](https://github.com/Availity/element/commit/5d80d2b046ea928ea432d7f269d1bfc99dd43782))
|
|
25
|
+
|
|
5
26
|
## [1.7.1](https://github.com/Availity/element/compare/@availity/mui-file-selector@1.7.0...@availity/mui-file-selector@1.7.1) (2025-05-30)
|
|
6
27
|
|
|
7
28
|
|
package/dist/index.d.mts
CHANGED
|
@@ -38,6 +38,11 @@ type DropzoneProps = {
|
|
|
38
38
|
* List of allowed file extensions (e.g. ['.pdf', '.doc']). Each extension must start with a dot
|
|
39
39
|
*/
|
|
40
40
|
allowedFileTypes?: `.${string}`[];
|
|
41
|
+
/**
|
|
42
|
+
* Regular expression pattern of allowed characters in file names
|
|
43
|
+
* @example "a-zA-Z0-9-_."
|
|
44
|
+
*/
|
|
45
|
+
allowedFileNameCharacters?: string;
|
|
41
46
|
/**
|
|
42
47
|
* Whether the dropzone is disabled
|
|
43
48
|
*/
|
|
@@ -54,6 +59,10 @@ type DropzoneProps = {
|
|
|
54
59
|
* Maximum size of each file in bytes
|
|
55
60
|
*/
|
|
56
61
|
maxSize?: number;
|
|
62
|
+
/**
|
|
63
|
+
* Maximum size of total upload in bytes
|
|
64
|
+
*/
|
|
65
|
+
maxTotalSize?: number;
|
|
57
66
|
/**
|
|
58
67
|
* Whether multiple file selection is allowed
|
|
59
68
|
*/
|
|
@@ -88,7 +97,7 @@ type DropzoneProps = {
|
|
|
88
97
|
validator?: (file: File) => FileError | FileError[] | null;
|
|
89
98
|
};
|
|
90
99
|
declare const DropzoneContainer: typeof MuiBox;
|
|
91
|
-
declare const Dropzone: ({ allowedFileTypes, disabled, enableDropArea, maxFiles, maxSize, multiple, name, onChange, onClick, onDrop, setFileRejections, setTotalSize, validator, }: DropzoneProps) => react_jsx_runtime.JSX.Element;
|
|
100
|
+
declare const Dropzone: ({ allowedFileTypes, allowedFileNameCharacters, disabled, enableDropArea, maxFiles, maxSize, maxTotalSize, multiple, name, onChange, onClick, onDrop, setFileRejections, setTotalSize, validator, }: DropzoneProps) => react_jsx_runtime.JSX.Element;
|
|
92
101
|
|
|
93
102
|
type Dropzone2Props = DropzoneProps & {
|
|
94
103
|
uploadOptions: UploadOptions;
|
|
@@ -101,7 +110,7 @@ type Dropzone2Props = DropzoneProps & {
|
|
|
101
110
|
* `<Dropzone2 />` adds the `uploadOptions` prop that previously existed on
|
|
102
111
|
* `<FileSelector />`.
|
|
103
112
|
*/
|
|
104
|
-
declare const Dropzone2: ({ allowedFileTypes, disabled, enableDropArea, maxFiles, maxSize, multiple, name, onChange, onClick, onDrop, setFileRejections, setTotalSize, uploadOptions, validator, }: Dropzone2Props) => react_jsx_runtime.JSX.Element;
|
|
113
|
+
declare const Dropzone2: ({ allowedFileTypes, disabled, enableDropArea, maxFiles, maxSize, maxTotalSize, multiple, name, onChange, onClick, onDrop, setFileRejections, setTotalSize, uploadOptions, validator, }: Dropzone2Props) => react_jsx_runtime.JSX.Element;
|
|
105
114
|
|
|
106
115
|
type ErrorAlertProps = {
|
|
107
116
|
/**
|
|
@@ -268,6 +277,10 @@ type FileSelectorProps = {
|
|
|
268
277
|
* Overrides the standard file size message
|
|
269
278
|
*/
|
|
270
279
|
customSizeMessage?: React.ReactNode;
|
|
280
|
+
/**
|
|
281
|
+
* Overrides the standard total upload size message
|
|
282
|
+
*/
|
|
283
|
+
customTotalSizeMessage?: React.ReactNode;
|
|
271
284
|
/**
|
|
272
285
|
* Overrides the standard file types message
|
|
273
286
|
*/
|
|
@@ -307,6 +320,11 @@ type FileSelectorProps = {
|
|
|
307
320
|
* Use Kibi or Mibibytes. eg: 1kb = 1024 bytes; 1mb = 1024kb
|
|
308
321
|
*/
|
|
309
322
|
maxSize: number;
|
|
323
|
+
/**
|
|
324
|
+
* Maximum size allowed for total upload in bytes
|
|
325
|
+
* Use Kibi or Mibibytes. eg: 1kb = 1024 bytes; 1mb = 1024kb
|
|
326
|
+
*/
|
|
327
|
+
maxTotalSize?: number;
|
|
310
328
|
/**
|
|
311
329
|
* Whether multiple file selection is allowed
|
|
312
330
|
* @default true
|
|
@@ -347,7 +365,7 @@ type FileSelectorProps = {
|
|
|
347
365
|
*/
|
|
348
366
|
disableRemove?: boolean;
|
|
349
367
|
};
|
|
350
|
-
declare const FileSelector: ({ name, allowedFileNameCharacters, allowedFileTypes, bucketId, clientId, children, customSizeMessage, customTypesMessage, customerId, customFileRow, disabled, enableDropArea, endpoint, isCloud, label, maxFiles, maxSize, multiple, onChange, onDrop, onUploadRemove, queryOptions, uploadOptions, validator, disableRemove, }: FileSelectorProps) => react_jsx_runtime.JSX.Element;
|
|
368
|
+
declare const FileSelector: ({ name, allowedFileNameCharacters, allowedFileTypes, bucketId, clientId, children, customSizeMessage, customTotalSizeMessage, customTypesMessage, customerId, customFileRow, disabled, enableDropArea, endpoint, isCloud, label, maxFiles, maxSize, maxTotalSize, multiple, onChange, onDrop, onUploadRemove, queryOptions, uploadOptions, validator, disableRemove, }: FileSelectorProps) => react_jsx_runtime.JSX.Element;
|
|
351
369
|
|
|
352
370
|
type FileSelector2Props = Omit<FileSelectorProps, 'onUploadRemove' | 'queryOptions'> & {
|
|
353
371
|
onUploadRemove?: (uploads: Upload[], removedUploadId: string) => void;
|
|
@@ -361,7 +379,7 @@ type FileSelector2Props = Omit<FileSelectorProps, 'onUploadRemove' | 'queryOptio
|
|
|
361
379
|
* `<FileSelector2 />` removes the reliance on `@tanstack/react-query`. The
|
|
362
380
|
* `Upload` object can now be accessed from the form state.
|
|
363
381
|
*/
|
|
364
|
-
declare const FileSelector2: ({ name, allowedFileNameCharacters, allowedFileTypes, bucketId, clientId, children, customSizeMessage, customTypesMessage, customerId, customFileRow, disabled, enableDropArea, endpoint, isCloud, label, maxFiles, maxSize, multiple, onChange, onDrop, onUploadRemove, uploadOptions, validator, disableRemove, }: FileSelector2Props) => react_jsx_runtime.JSX.Element;
|
|
382
|
+
declare const FileSelector2: ({ name, allowedFileNameCharacters, allowedFileTypes, bucketId, clientId, children, customSizeMessage, customTotalSizeMessage, customTypesMessage, customerId, customFileRow, disabled, enableDropArea, endpoint, isCloud, label, maxFiles, maxSize, maxTotalSize, multiple, onChange, onDrop, onUploadRemove, uploadOptions, validator, disableRemove, }: FileSelector2Props) => react_jsx_runtime.JSX.Element;
|
|
365
383
|
|
|
366
384
|
type FileTypesMessageProps = {
|
|
367
385
|
/**
|
|
@@ -372,6 +390,10 @@ type FileTypesMessageProps = {
|
|
|
372
390
|
* Overrides the standard file size message
|
|
373
391
|
*/
|
|
374
392
|
customSizeMessage?: React.ReactNode;
|
|
393
|
+
/**
|
|
394
|
+
* Overrides the standard total upload size message
|
|
395
|
+
*/
|
|
396
|
+
customTotalSizeMessage?: React.ReactNode;
|
|
375
397
|
/**
|
|
376
398
|
* Overrides the standard file types message
|
|
377
399
|
*/
|
|
@@ -380,9 +402,13 @@ type FileTypesMessageProps = {
|
|
|
380
402
|
* Maximum size per file in bytes. This will be formatted. eg: 1024 * 20 = 20 KB
|
|
381
403
|
*/
|
|
382
404
|
maxFileSize?: number;
|
|
405
|
+
/**
|
|
406
|
+
* Maximum size of the total upload in bytes. This will be formatted. eg: 1024 * 20 = 20 KB
|
|
407
|
+
*/
|
|
408
|
+
maxTotalSize?: number;
|
|
383
409
|
variant?: 'caption' | 'body2';
|
|
384
410
|
};
|
|
385
|
-
declare const FileTypesMessage: ({ allowedFileTypes, customSizeMessage, customTypesMessage, maxFileSize, variant, }: FileTypesMessageProps) => react_jsx_runtime.JSX.Element;
|
|
411
|
+
declare const FileTypesMessage: ({ allowedFileTypes, customSizeMessage, customTotalSizeMessage, customTypesMessage, maxFileSize, maxTotalSize, variant, }: FileTypesMessageProps) => react_jsx_runtime.JSX.Element;
|
|
386
412
|
|
|
387
413
|
type HeaderMessageProps = {
|
|
388
414
|
/**
|
|
@@ -390,11 +416,15 @@ type HeaderMessageProps = {
|
|
|
390
416
|
*/
|
|
391
417
|
maxFiles: number;
|
|
392
418
|
/**
|
|
393
|
-
* Maximum
|
|
419
|
+
* Maximum size of each file
|
|
394
420
|
*/
|
|
395
421
|
maxSize: number;
|
|
422
|
+
/**
|
|
423
|
+
* Maximum combined total size of all files
|
|
424
|
+
*/
|
|
425
|
+
maxTotalSize?: number;
|
|
396
426
|
};
|
|
397
|
-
declare const HeaderMessage: ({ maxFiles, maxSize }: HeaderMessageProps) => react_jsx_runtime.JSX.Element;
|
|
427
|
+
declare const HeaderMessage: ({ maxFiles, maxSize, maxTotalSize }: HeaderMessageProps) => react_jsx_runtime.JSX.Element;
|
|
398
428
|
|
|
399
429
|
type UploadProgressBarProps = {
|
|
400
430
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -38,6 +38,11 @@ type DropzoneProps = {
|
|
|
38
38
|
* List of allowed file extensions (e.g. ['.pdf', '.doc']). Each extension must start with a dot
|
|
39
39
|
*/
|
|
40
40
|
allowedFileTypes?: `.${string}`[];
|
|
41
|
+
/**
|
|
42
|
+
* Regular expression pattern of allowed characters in file names
|
|
43
|
+
* @example "a-zA-Z0-9-_."
|
|
44
|
+
*/
|
|
45
|
+
allowedFileNameCharacters?: string;
|
|
41
46
|
/**
|
|
42
47
|
* Whether the dropzone is disabled
|
|
43
48
|
*/
|
|
@@ -54,6 +59,10 @@ type DropzoneProps = {
|
|
|
54
59
|
* Maximum size of each file in bytes
|
|
55
60
|
*/
|
|
56
61
|
maxSize?: number;
|
|
62
|
+
/**
|
|
63
|
+
* Maximum size of total upload in bytes
|
|
64
|
+
*/
|
|
65
|
+
maxTotalSize?: number;
|
|
57
66
|
/**
|
|
58
67
|
* Whether multiple file selection is allowed
|
|
59
68
|
*/
|
|
@@ -88,7 +97,7 @@ type DropzoneProps = {
|
|
|
88
97
|
validator?: (file: File) => FileError | FileError[] | null;
|
|
89
98
|
};
|
|
90
99
|
declare const DropzoneContainer: typeof MuiBox;
|
|
91
|
-
declare const Dropzone: ({ allowedFileTypes, disabled, enableDropArea, maxFiles, maxSize, multiple, name, onChange, onClick, onDrop, setFileRejections, setTotalSize, validator, }: DropzoneProps) => react_jsx_runtime.JSX.Element;
|
|
100
|
+
declare const Dropzone: ({ allowedFileTypes, allowedFileNameCharacters, disabled, enableDropArea, maxFiles, maxSize, maxTotalSize, multiple, name, onChange, onClick, onDrop, setFileRejections, setTotalSize, validator, }: DropzoneProps) => react_jsx_runtime.JSX.Element;
|
|
92
101
|
|
|
93
102
|
type Dropzone2Props = DropzoneProps & {
|
|
94
103
|
uploadOptions: UploadOptions;
|
|
@@ -101,7 +110,7 @@ type Dropzone2Props = DropzoneProps & {
|
|
|
101
110
|
* `<Dropzone2 />` adds the `uploadOptions` prop that previously existed on
|
|
102
111
|
* `<FileSelector />`.
|
|
103
112
|
*/
|
|
104
|
-
declare const Dropzone2: ({ allowedFileTypes, disabled, enableDropArea, maxFiles, maxSize, multiple, name, onChange, onClick, onDrop, setFileRejections, setTotalSize, uploadOptions, validator, }: Dropzone2Props) => react_jsx_runtime.JSX.Element;
|
|
113
|
+
declare const Dropzone2: ({ allowedFileTypes, disabled, enableDropArea, maxFiles, maxSize, maxTotalSize, multiple, name, onChange, onClick, onDrop, setFileRejections, setTotalSize, uploadOptions, validator, }: Dropzone2Props) => react_jsx_runtime.JSX.Element;
|
|
105
114
|
|
|
106
115
|
type ErrorAlertProps = {
|
|
107
116
|
/**
|
|
@@ -268,6 +277,10 @@ type FileSelectorProps = {
|
|
|
268
277
|
* Overrides the standard file size message
|
|
269
278
|
*/
|
|
270
279
|
customSizeMessage?: React.ReactNode;
|
|
280
|
+
/**
|
|
281
|
+
* Overrides the standard total upload size message
|
|
282
|
+
*/
|
|
283
|
+
customTotalSizeMessage?: React.ReactNode;
|
|
271
284
|
/**
|
|
272
285
|
* Overrides the standard file types message
|
|
273
286
|
*/
|
|
@@ -307,6 +320,11 @@ type FileSelectorProps = {
|
|
|
307
320
|
* Use Kibi or Mibibytes. eg: 1kb = 1024 bytes; 1mb = 1024kb
|
|
308
321
|
*/
|
|
309
322
|
maxSize: number;
|
|
323
|
+
/**
|
|
324
|
+
* Maximum size allowed for total upload in bytes
|
|
325
|
+
* Use Kibi or Mibibytes. eg: 1kb = 1024 bytes; 1mb = 1024kb
|
|
326
|
+
*/
|
|
327
|
+
maxTotalSize?: number;
|
|
310
328
|
/**
|
|
311
329
|
* Whether multiple file selection is allowed
|
|
312
330
|
* @default true
|
|
@@ -347,7 +365,7 @@ type FileSelectorProps = {
|
|
|
347
365
|
*/
|
|
348
366
|
disableRemove?: boolean;
|
|
349
367
|
};
|
|
350
|
-
declare const FileSelector: ({ name, allowedFileNameCharacters, allowedFileTypes, bucketId, clientId, children, customSizeMessage, customTypesMessage, customerId, customFileRow, disabled, enableDropArea, endpoint, isCloud, label, maxFiles, maxSize, multiple, onChange, onDrop, onUploadRemove, queryOptions, uploadOptions, validator, disableRemove, }: FileSelectorProps) => react_jsx_runtime.JSX.Element;
|
|
368
|
+
declare const FileSelector: ({ name, allowedFileNameCharacters, allowedFileTypes, bucketId, clientId, children, customSizeMessage, customTotalSizeMessage, customTypesMessage, customerId, customFileRow, disabled, enableDropArea, endpoint, isCloud, label, maxFiles, maxSize, maxTotalSize, multiple, onChange, onDrop, onUploadRemove, queryOptions, uploadOptions, validator, disableRemove, }: FileSelectorProps) => react_jsx_runtime.JSX.Element;
|
|
351
369
|
|
|
352
370
|
type FileSelector2Props = Omit<FileSelectorProps, 'onUploadRemove' | 'queryOptions'> & {
|
|
353
371
|
onUploadRemove?: (uploads: Upload[], removedUploadId: string) => void;
|
|
@@ -361,7 +379,7 @@ type FileSelector2Props = Omit<FileSelectorProps, 'onUploadRemove' | 'queryOptio
|
|
|
361
379
|
* `<FileSelector2 />` removes the reliance on `@tanstack/react-query`. The
|
|
362
380
|
* `Upload` object can now be accessed from the form state.
|
|
363
381
|
*/
|
|
364
|
-
declare const FileSelector2: ({ name, allowedFileNameCharacters, allowedFileTypes, bucketId, clientId, children, customSizeMessage, customTypesMessage, customerId, customFileRow, disabled, enableDropArea, endpoint, isCloud, label, maxFiles, maxSize, multiple, onChange, onDrop, onUploadRemove, uploadOptions, validator, disableRemove, }: FileSelector2Props) => react_jsx_runtime.JSX.Element;
|
|
382
|
+
declare const FileSelector2: ({ name, allowedFileNameCharacters, allowedFileTypes, bucketId, clientId, children, customSizeMessage, customTotalSizeMessage, customTypesMessage, customerId, customFileRow, disabled, enableDropArea, endpoint, isCloud, label, maxFiles, maxSize, maxTotalSize, multiple, onChange, onDrop, onUploadRemove, uploadOptions, validator, disableRemove, }: FileSelector2Props) => react_jsx_runtime.JSX.Element;
|
|
365
383
|
|
|
366
384
|
type FileTypesMessageProps = {
|
|
367
385
|
/**
|
|
@@ -372,6 +390,10 @@ type FileTypesMessageProps = {
|
|
|
372
390
|
* Overrides the standard file size message
|
|
373
391
|
*/
|
|
374
392
|
customSizeMessage?: React.ReactNode;
|
|
393
|
+
/**
|
|
394
|
+
* Overrides the standard total upload size message
|
|
395
|
+
*/
|
|
396
|
+
customTotalSizeMessage?: React.ReactNode;
|
|
375
397
|
/**
|
|
376
398
|
* Overrides the standard file types message
|
|
377
399
|
*/
|
|
@@ -380,9 +402,13 @@ type FileTypesMessageProps = {
|
|
|
380
402
|
* Maximum size per file in bytes. This will be formatted. eg: 1024 * 20 = 20 KB
|
|
381
403
|
*/
|
|
382
404
|
maxFileSize?: number;
|
|
405
|
+
/**
|
|
406
|
+
* Maximum size of the total upload in bytes. This will be formatted. eg: 1024 * 20 = 20 KB
|
|
407
|
+
*/
|
|
408
|
+
maxTotalSize?: number;
|
|
383
409
|
variant?: 'caption' | 'body2';
|
|
384
410
|
};
|
|
385
|
-
declare const FileTypesMessage: ({ allowedFileTypes, customSizeMessage, customTypesMessage, maxFileSize, variant, }: FileTypesMessageProps) => react_jsx_runtime.JSX.Element;
|
|
411
|
+
declare const FileTypesMessage: ({ allowedFileTypes, customSizeMessage, customTotalSizeMessage, customTypesMessage, maxFileSize, maxTotalSize, variant, }: FileTypesMessageProps) => react_jsx_runtime.JSX.Element;
|
|
386
412
|
|
|
387
413
|
type HeaderMessageProps = {
|
|
388
414
|
/**
|
|
@@ -390,11 +416,15 @@ type HeaderMessageProps = {
|
|
|
390
416
|
*/
|
|
391
417
|
maxFiles: number;
|
|
392
418
|
/**
|
|
393
|
-
* Maximum
|
|
419
|
+
* Maximum size of each file
|
|
394
420
|
*/
|
|
395
421
|
maxSize: number;
|
|
422
|
+
/**
|
|
423
|
+
* Maximum combined total size of all files
|
|
424
|
+
*/
|
|
425
|
+
maxTotalSize?: number;
|
|
396
426
|
};
|
|
397
|
-
declare const HeaderMessage: ({ maxFiles, maxSize }: HeaderMessageProps) => react_jsx_runtime.JSX.Element;
|
|
427
|
+
declare const HeaderMessage: ({ maxFiles, maxSize, maxTotalSize }: HeaderMessageProps) => react_jsx_runtime.JSX.Element;
|
|
398
428
|
|
|
399
429
|
type UploadProgressBarProps = {
|
|
400
430
|
/**
|