@availity/mui-file-selector 1.3.0 → 1.3.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/CHANGELOG.md +14 -0
- package/dist/index.d.mts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +47 -21
- package/dist/index.mjs +51 -25
- package/package.json +1 -1
- package/src/lib/FileList.tsx +10 -10
- package/src/lib/FileSelector.tsx +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [1.3.2](https://github.com/Availity/element/compare/@availity/mui-file-selector@1.3.1...@availity/mui-file-selector@1.3.2) (2025-03-31)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **mui-file-selector:** check if upload is defined before attempting to render CustomRow ([26d22cc](https://github.com/Availity/element/commit/26d22cc44e18ac9c0fce9ea64c2d8d6c8a4cff47))
|
|
11
|
+
* **mui-file-selector:** update customFileRow type on FileSelector ([8020d04](https://github.com/Availity/element/commit/8020d045d68b744fddd21b8f4953a4fd63c551de))
|
|
12
|
+
|
|
13
|
+
## [1.3.1](https://github.com/Availity/element/compare/@availity/mui-file-selector@1.3.0...@availity/mui-file-selector@1.3.1) (2025-03-27)
|
|
14
|
+
|
|
15
|
+
### Dependency Updates
|
|
16
|
+
|
|
17
|
+
* `mui-dialog` updated to version `1.3.0`
|
|
18
|
+
* `mui-textfield` updated to version `1.3.0`
|
|
5
19
|
## [1.3.0](https://github.com/Availity/element/compare/@availity/mui-file-selector@1.2.1...@availity/mui-file-selector@1.3.0) (2025-03-24)
|
|
6
20
|
|
|
7
21
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { MouseEvent, Dispatch, ChangeEvent, RefObject, ReactNode
|
|
2
|
+
import { MouseEvent, Dispatch, ChangeEvent, RefObject, ReactNode } from 'react';
|
|
3
3
|
import { DropEvent, FileRejection, FileError, DropzoneInputProps } from 'react-dropzone';
|
|
4
4
|
import Upload, { UploadOptions } from '@availity/upload-core';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
@@ -205,7 +205,11 @@ type FileSelectorProps = {
|
|
|
205
205
|
/**
|
|
206
206
|
* Componet to render the File information. This should return a `ListItem`
|
|
207
207
|
*/
|
|
208
|
-
customFileRow?: ElementType<
|
|
208
|
+
customFileRow?: React.ElementType<{
|
|
209
|
+
upload?: Upload;
|
|
210
|
+
options: Options;
|
|
211
|
+
onRemoveFile: (id: string, upload: Upload) => void;
|
|
212
|
+
}>;
|
|
209
213
|
/**
|
|
210
214
|
* Whether to use the cloud upload endpoint
|
|
211
215
|
* When true, uses '/cloud/web/appl/vault/upload/v1/resumable'
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { MouseEvent, Dispatch, ChangeEvent, RefObject, ReactNode
|
|
2
|
+
import { MouseEvent, Dispatch, ChangeEvent, RefObject, ReactNode } from 'react';
|
|
3
3
|
import { DropEvent, FileRejection, FileError, DropzoneInputProps } from 'react-dropzone';
|
|
4
4
|
import Upload, { UploadOptions } from '@availity/upload-core';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
@@ -205,7 +205,11 @@ type FileSelectorProps = {
|
|
|
205
205
|
/**
|
|
206
206
|
* Componet to render the File information. This should return a `ListItem`
|
|
207
207
|
*/
|
|
208
|
-
customFileRow?: ElementType<
|
|
208
|
+
customFileRow?: React.ElementType<{
|
|
209
|
+
upload?: Upload;
|
|
210
|
+
options: Options;
|
|
211
|
+
onRemoveFile: (id: string, upload: Upload) => void;
|
|
212
|
+
}>;
|
|
209
213
|
/**
|
|
210
214
|
* Whether to use the cloud upload endpoint
|
|
211
215
|
* When true, uses '/cloud/web/appl/vault/upload/v1/resumable'
|
package/dist/index.js
CHANGED
|
@@ -454,6 +454,7 @@ var import_react2 = require("react");
|
|
|
454
454
|
var import_TextField = __toESM(require("@mui/material/TextField"));
|
|
455
455
|
var import_mui_form_utils2 = require("@availity/mui-form-utils");
|
|
456
456
|
var import_mui_layout2 = require("@availity/mui-layout");
|
|
457
|
+
var import_mui_typography2 = require("@availity/mui-typography");
|
|
457
458
|
var import_styles4 = require("@mui/material/styles");
|
|
458
459
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
459
460
|
var SelectPlaceholder = (0, import_styles4.styled)("span", {
|
|
@@ -461,6 +462,24 @@ var SelectPlaceholder = (0, import_styles4.styled)("span", {
|
|
|
461
462
|
slot: "SelectPlaceholder",
|
|
462
463
|
overridesResolver: (props, styles) => styles.avFilled
|
|
463
464
|
})(({ theme }) => ({ opacity: 1, color: theme.palette.grey[400] }));
|
|
465
|
+
var TextFieldFormHelperText = ({
|
|
466
|
+
charCount,
|
|
467
|
+
helperText,
|
|
468
|
+
maxLength,
|
|
469
|
+
showCharacterCount
|
|
470
|
+
}) => {
|
|
471
|
+
if (showCharacterCount) {
|
|
472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_mui_layout2.Grid, { container: true, justifyContent: "space-between", flexWrap: "nowrap", children: [
|
|
473
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_mui_form_utils2.FormHelperText, { sx: { marginRight: "12px" }, children: helperText }),
|
|
474
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_mui_typography2.Typography, { variant: "caption", marginTop: "4px", lineHeight: "1.25rem", children: [
|
|
475
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_mui_typography2.Typography, { component: "span", variant: "inherit", color: charCount > maxLength ? "error" : "textPrimary", children: charCount || 0 }),
|
|
476
|
+
"/",
|
|
477
|
+
maxLength
|
|
478
|
+
] })
|
|
479
|
+
] });
|
|
480
|
+
}
|
|
481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_mui_form_utils2.FormHelperText, { children: helperText });
|
|
482
|
+
};
|
|
464
483
|
var TextField = (0, import_react2.forwardRef)((props, ref) => {
|
|
465
484
|
var _b, _c, _d, _e, _f, _g, _h;
|
|
466
485
|
const _a = props, {
|
|
@@ -472,7 +491,8 @@ var TextField = (0, import_react2.forwardRef)((props, ref) => {
|
|
|
472
491
|
SelectProps: SelectProps2,
|
|
473
492
|
inputProps,
|
|
474
493
|
helperText,
|
|
475
|
-
showCharacterCount = false
|
|
494
|
+
showCharacterCount = false,
|
|
495
|
+
displayOverflowMaxLength = false
|
|
476
496
|
} = _a, rest = __objRest(_a, [
|
|
477
497
|
"InputProps",
|
|
478
498
|
"helpTopicId",
|
|
@@ -482,10 +502,12 @@ var TextField = (0, import_react2.forwardRef)((props, ref) => {
|
|
|
482
502
|
"SelectProps",
|
|
483
503
|
"inputProps",
|
|
484
504
|
"helperText",
|
|
485
|
-
"showCharacterCount"
|
|
505
|
+
"showCharacterCount",
|
|
506
|
+
"displayOverflowMaxLength"
|
|
486
507
|
]);
|
|
487
508
|
const [openDetected, setOpenDetected] = (0, import_react2.useState)(false);
|
|
488
509
|
const [charCount, setCharCount] = (0, import_react2.useState)(0);
|
|
510
|
+
const maxLength = (inputProps == null ? void 0 : inputProps.maxLength) || ((_c = (_b = rest.slotProps) == null ? void 0 : _b.htmlInput) == null ? void 0 : _c.maxLength);
|
|
489
511
|
const resolvedProps = (props2) => !props2 || Object.keys(props2).length === 0 ? void 0 : props2;
|
|
490
512
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
491
513
|
import_TextField.default,
|
|
@@ -494,19 +516,15 @@ var TextField = (0, import_react2.forwardRef)((props, ref) => {
|
|
|
494
516
|
setCharCount(event.target.value.length);
|
|
495
517
|
if (rest.onChange) rest.onChange(event);
|
|
496
518
|
},
|
|
497
|
-
helperText:
|
|
498
|
-
|
|
499
|
-
" ",
|
|
500
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { style: { marginLeft: 4 }, children: [
|
|
501
|
-
charCount || 0,
|
|
502
|
-
"/",
|
|
503
|
-
(inputProps == null ? void 0 : inputProps.maxLength) || ((_c = (_b = rest.slotProps) == null ? void 0 : _b.htmlInput) == null ? void 0 : _c.maxLength)
|
|
504
|
-
] })
|
|
505
|
-
] }) : helperText,
|
|
506
|
-
slots: { formHelperText: import_mui_form_utils2.FormHelperText },
|
|
519
|
+
helperText: helperText || /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, {}),
|
|
520
|
+
slots: { formHelperText: TextFieldFormHelperText },
|
|
507
521
|
slotProps: {
|
|
508
522
|
input: resolvedProps(__spreadValues(__spreadValues(__spreadValues({}, InputProps2), import_mui_form_utils2.InputPropOverrides), (_d = rest.slotProps) == null ? void 0 : _d.input)),
|
|
509
|
-
htmlInput: resolvedProps(__spreadValues(__spreadValues({
|
|
523
|
+
htmlInput: resolvedProps(__spreadProps(__spreadValues(__spreadValues({
|
|
524
|
+
"aria-required": required
|
|
525
|
+
}, inputProps), (_e = rest.slotProps) == null ? void 0 : _e.htmlInput), {
|
|
526
|
+
maxLength: !displayOverflowMaxLength ? maxLength : void 0
|
|
527
|
+
})),
|
|
510
528
|
select: resolvedProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
511
529
|
displayEmpty: !!rest.placeholder,
|
|
512
530
|
renderValue: (value) => rest.placeholder && (!value || Array.isArray(value) && value.length === 0) ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SelectPlaceholder, { className: "MuiSelect-placeholder", children: rest.placeholder }) : value
|
|
@@ -517,7 +535,15 @@ var TextField = (0, import_react2.forwardRef)((props, ref) => {
|
|
|
517
535
|
required,
|
|
518
536
|
shrink: true
|
|
519
537
|
}, InputLabelProps), (_g = rest.slotProps) == null ? void 0 : _g.inputLabel)),
|
|
520
|
-
formHelperText: resolvedProps(__spreadValues(__spreadValues({
|
|
538
|
+
formHelperText: resolvedProps(__spreadProps(__spreadValues(__spreadValues({
|
|
539
|
+
component: "div"
|
|
540
|
+
}, FormHelperTextProps2), (_h = rest.slotProps) == null ? void 0 : _h.formHelperText), {
|
|
541
|
+
charCount,
|
|
542
|
+
helperText,
|
|
543
|
+
maxLength,
|
|
544
|
+
displayOverflowMaxLength,
|
|
545
|
+
showCharacterCount
|
|
546
|
+
}))
|
|
521
547
|
},
|
|
522
548
|
ref
|
|
523
549
|
})
|
|
@@ -666,8 +692,8 @@ var FileRow = ({
|
|
|
666
692
|
}) => {
|
|
667
693
|
const Icon = getFileExtIcon(file.name);
|
|
668
694
|
const { data: upload } = useUploadCore(file, options, queryOptions);
|
|
669
|
-
if (CustomRow) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CustomRow, { upload, options, onRemoveFile });
|
|
670
695
|
if (!upload) return null;
|
|
696
|
+
if (CustomRow) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CustomRow, { upload, options, onRemoveFile });
|
|
671
697
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
672
698
|
import_mui_list3.ListItem,
|
|
673
699
|
{
|
|
@@ -725,10 +751,10 @@ var import_react4 = require("react");
|
|
|
725
751
|
var import_react_hook_form3 = require("react-hook-form");
|
|
726
752
|
var import_react_query2 = require("@tanstack/react-query");
|
|
727
753
|
var import_mui_layout5 = require("@availity/mui-layout");
|
|
728
|
-
var
|
|
754
|
+
var import_mui_typography5 = require("@availity/mui-typography");
|
|
729
755
|
|
|
730
756
|
// src/lib/FileTypesMessage.tsx
|
|
731
|
-
var
|
|
757
|
+
var import_mui_typography3 = require("@availity/mui-typography");
|
|
732
758
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
733
759
|
var FileTypesMessage = ({
|
|
734
760
|
allowedFileTypes = [],
|
|
@@ -737,17 +763,17 @@ var FileTypesMessage = ({
|
|
|
737
763
|
}) => {
|
|
738
764
|
const fileSizeMsg = typeof maxFileSize === "number" ? `Maximum file size is ${formatBytes(maxFileSize)}. ` : null;
|
|
739
765
|
const fileTypesMsg = allowedFileTypes.length > 0 ? `Supported file types include: ${allowedFileTypes.join(", ")}` : "All file types allowed.";
|
|
740
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_mui_typography3.Typography, { variant, children: [
|
|
741
767
|
fileSizeMsg,
|
|
742
768
|
fileTypesMsg
|
|
743
769
|
] });
|
|
744
770
|
};
|
|
745
771
|
|
|
746
772
|
// src/lib/HeaderMessage.tsx
|
|
747
|
-
var
|
|
773
|
+
var import_mui_typography4 = require("@availity/mui-typography");
|
|
748
774
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
749
775
|
var HeaderMessage = ({ maxFiles, maxSize }) => {
|
|
750
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_mui_typography4.Typography, { variant: "h6", children: [
|
|
751
777
|
"Attach up to ",
|
|
752
778
|
maxFiles,
|
|
753
779
|
" file(s), with a maximum individual size of ",
|
|
@@ -820,7 +846,7 @@ var FileSelector = ({
|
|
|
820
846
|
};
|
|
821
847
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
822
848
|
enableDropArea ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
823
|
-
label ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
849
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_mui_typography5.Typography, { marginBottom: "4px", children: label }) : null,
|
|
824
850
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
825
851
|
Dropzone,
|
|
826
852
|
{
|
package/dist/index.mjs
CHANGED
|
@@ -418,13 +418,32 @@ import {
|
|
|
418
418
|
SelectPropOverrides
|
|
419
419
|
} from "@availity/mui-form-utils";
|
|
420
420
|
import { Grid } from "@availity/mui-layout";
|
|
421
|
+
import { Typography as Typography2 } from "@availity/mui-typography";
|
|
421
422
|
import { styled as styled4 } from "@mui/material/styles";
|
|
422
|
-
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
423
|
+
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
423
424
|
var SelectPlaceholder = styled4("span", {
|
|
424
425
|
name: "MuiTextField",
|
|
425
426
|
slot: "SelectPlaceholder",
|
|
426
427
|
overridesResolver: (props, styles) => styles.avFilled
|
|
427
428
|
})(({ theme }) => ({ opacity: 1, color: theme.palette.grey[400] }));
|
|
429
|
+
var TextFieldFormHelperText = ({
|
|
430
|
+
charCount,
|
|
431
|
+
helperText,
|
|
432
|
+
maxLength,
|
|
433
|
+
showCharacterCount
|
|
434
|
+
}) => {
|
|
435
|
+
if (showCharacterCount) {
|
|
436
|
+
return /* @__PURE__ */ jsxs6(Grid, { container: true, justifyContent: "space-between", flexWrap: "nowrap", children: [
|
|
437
|
+
/* @__PURE__ */ jsx9(FormHelperText, { sx: { marginRight: "12px" }, children: helperText }),
|
|
438
|
+
/* @__PURE__ */ jsxs6(Typography2, { variant: "caption", marginTop: "4px", lineHeight: "1.25rem", children: [
|
|
439
|
+
/* @__PURE__ */ jsx9(Typography2, { component: "span", variant: "inherit", color: charCount > maxLength ? "error" : "textPrimary", children: charCount || 0 }),
|
|
440
|
+
"/",
|
|
441
|
+
maxLength
|
|
442
|
+
] })
|
|
443
|
+
] });
|
|
444
|
+
}
|
|
445
|
+
return /* @__PURE__ */ jsx9(FormHelperText, { children: helperText });
|
|
446
|
+
};
|
|
428
447
|
var TextField = forwardRef((props, ref) => {
|
|
429
448
|
var _b, _c, _d, _e, _f, _g, _h;
|
|
430
449
|
const _a = props, {
|
|
@@ -436,7 +455,8 @@ var TextField = forwardRef((props, ref) => {
|
|
|
436
455
|
SelectProps: SelectProps2,
|
|
437
456
|
inputProps,
|
|
438
457
|
helperText,
|
|
439
|
-
showCharacterCount = false
|
|
458
|
+
showCharacterCount = false,
|
|
459
|
+
displayOverflowMaxLength = false
|
|
440
460
|
} = _a, rest = __objRest(_a, [
|
|
441
461
|
"InputProps",
|
|
442
462
|
"helpTopicId",
|
|
@@ -446,10 +466,12 @@ var TextField = forwardRef((props, ref) => {
|
|
|
446
466
|
"SelectProps",
|
|
447
467
|
"inputProps",
|
|
448
468
|
"helperText",
|
|
449
|
-
"showCharacterCount"
|
|
469
|
+
"showCharacterCount",
|
|
470
|
+
"displayOverflowMaxLength"
|
|
450
471
|
]);
|
|
451
472
|
const [openDetected, setOpenDetected] = useState(false);
|
|
452
473
|
const [charCount, setCharCount] = useState(0);
|
|
474
|
+
const maxLength = (inputProps == null ? void 0 : inputProps.maxLength) || ((_c = (_b = rest.slotProps) == null ? void 0 : _b.htmlInput) == null ? void 0 : _c.maxLength);
|
|
453
475
|
const resolvedProps = (props2) => !props2 || Object.keys(props2).length === 0 ? void 0 : props2;
|
|
454
476
|
return /* @__PURE__ */ jsx9(
|
|
455
477
|
MuiTextField,
|
|
@@ -458,19 +480,15 @@ var TextField = forwardRef((props, ref) => {
|
|
|
458
480
|
setCharCount(event.target.value.length);
|
|
459
481
|
if (rest.onChange) rest.onChange(event);
|
|
460
482
|
},
|
|
461
|
-
helperText:
|
|
462
|
-
|
|
463
|
-
" ",
|
|
464
|
-
/* @__PURE__ */ jsxs6("span", { style: { marginLeft: 4 }, children: [
|
|
465
|
-
charCount || 0,
|
|
466
|
-
"/",
|
|
467
|
-
(inputProps == null ? void 0 : inputProps.maxLength) || ((_c = (_b = rest.slotProps) == null ? void 0 : _b.htmlInput) == null ? void 0 : _c.maxLength)
|
|
468
|
-
] })
|
|
469
|
-
] }) : helperText,
|
|
470
|
-
slots: { formHelperText: FormHelperText },
|
|
483
|
+
helperText: helperText || /* @__PURE__ */ jsx9(Fragment4, {}),
|
|
484
|
+
slots: { formHelperText: TextFieldFormHelperText },
|
|
471
485
|
slotProps: {
|
|
472
486
|
input: resolvedProps(__spreadValues(__spreadValues(__spreadValues({}, InputProps2), InputPropOverrides), (_d = rest.slotProps) == null ? void 0 : _d.input)),
|
|
473
|
-
htmlInput: resolvedProps(__spreadValues(__spreadValues({
|
|
487
|
+
htmlInput: resolvedProps(__spreadProps(__spreadValues(__spreadValues({
|
|
488
|
+
"aria-required": required
|
|
489
|
+
}, inputProps), (_e = rest.slotProps) == null ? void 0 : _e.htmlInput), {
|
|
490
|
+
maxLength: !displayOverflowMaxLength ? maxLength : void 0
|
|
491
|
+
})),
|
|
474
492
|
select: resolvedProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
475
493
|
displayEmpty: !!rest.placeholder,
|
|
476
494
|
renderValue: (value) => rest.placeholder && (!value || Array.isArray(value) && value.length === 0) ? /* @__PURE__ */ jsx9(SelectPlaceholder, { className: "MuiSelect-placeholder", children: rest.placeholder }) : value
|
|
@@ -481,7 +499,15 @@ var TextField = forwardRef((props, ref) => {
|
|
|
481
499
|
required,
|
|
482
500
|
shrink: true
|
|
483
501
|
}, InputLabelProps), (_g = rest.slotProps) == null ? void 0 : _g.inputLabel)),
|
|
484
|
-
formHelperText: resolvedProps(__spreadValues(__spreadValues({
|
|
502
|
+
formHelperText: resolvedProps(__spreadProps(__spreadValues(__spreadValues({
|
|
503
|
+
component: "div"
|
|
504
|
+
}, FormHelperTextProps2), (_h = rest.slotProps) == null ? void 0 : _h.formHelperText), {
|
|
505
|
+
charCount,
|
|
506
|
+
helperText,
|
|
507
|
+
maxLength,
|
|
508
|
+
displayOverflowMaxLength,
|
|
509
|
+
showCharacterCount
|
|
510
|
+
}))
|
|
485
511
|
},
|
|
486
512
|
ref
|
|
487
513
|
})
|
|
@@ -641,8 +667,8 @@ var FileRow = ({
|
|
|
641
667
|
}) => {
|
|
642
668
|
const Icon = getFileExtIcon(file.name);
|
|
643
669
|
const { data: upload } = useUploadCore(file, options, queryOptions);
|
|
644
|
-
if (CustomRow) return /* @__PURE__ */ jsx11(CustomRow, { upload, options, onRemoveFile });
|
|
645
670
|
if (!upload) return null;
|
|
671
|
+
if (CustomRow) return /* @__PURE__ */ jsx11(CustomRow, { upload, options, onRemoveFile });
|
|
646
672
|
return /* @__PURE__ */ jsxs8(
|
|
647
673
|
ListItem2,
|
|
648
674
|
{
|
|
@@ -700,10 +726,10 @@ import { useState as useState3 } from "react";
|
|
|
700
726
|
import { useFormContext as useFormContext2 } from "react-hook-form";
|
|
701
727
|
import { useQueryClient } from "@tanstack/react-query";
|
|
702
728
|
import { Grid as Grid3 } from "@availity/mui-layout";
|
|
703
|
-
import { Typography as
|
|
729
|
+
import { Typography as Typography5 } from "@availity/mui-typography";
|
|
704
730
|
|
|
705
731
|
// src/lib/FileTypesMessage.tsx
|
|
706
|
-
import { Typography as
|
|
732
|
+
import { Typography as Typography3 } from "@availity/mui-typography";
|
|
707
733
|
import { jsxs as jsxs9 } from "react/jsx-runtime";
|
|
708
734
|
var FileTypesMessage = ({
|
|
709
735
|
allowedFileTypes = [],
|
|
@@ -712,17 +738,17 @@ var FileTypesMessage = ({
|
|
|
712
738
|
}) => {
|
|
713
739
|
const fileSizeMsg = typeof maxFileSize === "number" ? `Maximum file size is ${formatBytes(maxFileSize)}. ` : null;
|
|
714
740
|
const fileTypesMsg = allowedFileTypes.length > 0 ? `Supported file types include: ${allowedFileTypes.join(", ")}` : "All file types allowed.";
|
|
715
|
-
return /* @__PURE__ */ jsxs9(
|
|
741
|
+
return /* @__PURE__ */ jsxs9(Typography3, { variant, children: [
|
|
716
742
|
fileSizeMsg,
|
|
717
743
|
fileTypesMsg
|
|
718
744
|
] });
|
|
719
745
|
};
|
|
720
746
|
|
|
721
747
|
// src/lib/HeaderMessage.tsx
|
|
722
|
-
import { Typography as
|
|
748
|
+
import { Typography as Typography4 } from "@availity/mui-typography";
|
|
723
749
|
import { jsxs as jsxs10 } from "react/jsx-runtime";
|
|
724
750
|
var HeaderMessage = ({ maxFiles, maxSize }) => {
|
|
725
|
-
return /* @__PURE__ */ jsxs10(
|
|
751
|
+
return /* @__PURE__ */ jsxs10(Typography4, { variant: "h6", children: [
|
|
726
752
|
"Attach up to ",
|
|
727
753
|
maxFiles,
|
|
728
754
|
" file(s), with a maximum individual size of ",
|
|
@@ -731,7 +757,7 @@ var HeaderMessage = ({ maxFiles, maxSize }) => {
|
|
|
731
757
|
};
|
|
732
758
|
|
|
733
759
|
// src/lib/FileSelector.tsx
|
|
734
|
-
import { Fragment as
|
|
760
|
+
import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
735
761
|
var CLOUD_URL = "/cloud/web/appl/vault/upload/v1/resumable";
|
|
736
762
|
var FileSelector = ({
|
|
737
763
|
name,
|
|
@@ -793,9 +819,9 @@ var FileSelector = ({
|
|
|
793
819
|
const rejections = fileRejections.filter((value) => value.id !== id);
|
|
794
820
|
setFileRejections(rejections);
|
|
795
821
|
};
|
|
796
|
-
return /* @__PURE__ */ jsxs11(
|
|
797
|
-
enableDropArea ? /* @__PURE__ */ jsxs11(
|
|
798
|
-
label ? /* @__PURE__ */ jsx12(
|
|
822
|
+
return /* @__PURE__ */ jsxs11(Fragment5, { children: [
|
|
823
|
+
enableDropArea ? /* @__PURE__ */ jsxs11(Fragment5, { children: [
|
|
824
|
+
label ? /* @__PURE__ */ jsx12(Typography5, { marginBottom: "4px", children: label }) : null,
|
|
799
825
|
/* @__PURE__ */ jsx12(
|
|
800
826
|
Dropzone,
|
|
801
827
|
{
|
package/package.json
CHANGED
package/src/lib/FileList.tsx
CHANGED
|
@@ -53,10 +53,10 @@ export const FileRow = ({
|
|
|
53
53
|
|
|
54
54
|
const { data: upload } = useUploadCore(file, options, queryOptions);
|
|
55
55
|
|
|
56
|
-
if (CustomRow) return <CustomRow upload={upload} options={options} onRemoveFile={onRemoveFile} />;
|
|
57
|
-
|
|
58
56
|
if (!upload) return null;
|
|
59
57
|
|
|
58
|
+
if (CustomRow) return <CustomRow upload={upload} options={options} onRemoveFile={onRemoveFile} />;
|
|
59
|
+
|
|
60
60
|
return (
|
|
61
61
|
<ListItem
|
|
62
62
|
disableGutters
|
|
@@ -74,19 +74,19 @@ export const FileRow = ({
|
|
|
74
74
|
)
|
|
75
75
|
}
|
|
76
76
|
>
|
|
77
|
-
<Grid container spacing={2} alignItems="center" justifyContent="space-between" width="100%"
|
|
78
|
-
<Grid size={{ xs:
|
|
79
|
-
<ListItemIcon sx={{minWidth: '1.5rem'}}>
|
|
77
|
+
<Grid container spacing={2} alignItems="center" justifyContent="space-between" width="100%" flexWrap="wrap">
|
|
78
|
+
<Grid size={{ xs: 'auto' }}>
|
|
79
|
+
<ListItemIcon sx={{ minWidth: '1.5rem' }}>
|
|
80
80
|
<Icon />
|
|
81
81
|
</ListItemIcon>
|
|
82
82
|
</Grid>
|
|
83
|
-
<Grid size={{ xs: 4 }} sx={{minWidth: '8rem'}}>
|
|
84
|
-
<ListItemText sx={{wordBreak: 'break-all'}}>{upload.trimFileName(upload.file.name)}</ListItemText>
|
|
83
|
+
<Grid size={{ xs: 4 }} sx={{ minWidth: '8rem' }}>
|
|
84
|
+
<ListItemText sx={{ wordBreak: 'break-all' }}>{upload.trimFileName(upload.file.name)}</ListItemText>
|
|
85
85
|
</Grid>
|
|
86
|
-
<Grid size={{ xs: 2 }} sx={{minWidth: '3rem'}}>
|
|
87
|
-
<ListItemText sx={{textAlign: 'end'}}>{formatBytes(upload.file.size)}</ListItemText>
|
|
86
|
+
<Grid size={{ xs: 2 }} sx={{ minWidth: '3rem' }}>
|
|
87
|
+
<ListItemText sx={{ textAlign: 'end' }}>{formatBytes(upload.file.size)}</ListItemText>
|
|
88
88
|
</Grid>
|
|
89
|
-
<Grid size={{ xs: 'grow' }} sx={{minWidth: '6rem'}}>
|
|
89
|
+
<Grid size={{ xs: 'grow' }} sx={{ minWidth: '6rem' }}>
|
|
90
90
|
<UploadProgressBar upload={upload} />
|
|
91
91
|
</Grid>
|
|
92
92
|
</Grid>
|
package/src/lib/FileSelector.tsx
CHANGED
|
@@ -66,7 +66,11 @@ export type FileSelectorProps = {
|
|
|
66
66
|
/**
|
|
67
67
|
* Componet to render the File information. This should return a `ListItem`
|
|
68
68
|
*/
|
|
69
|
-
customFileRow?: ElementType<
|
|
69
|
+
customFileRow?: React.ElementType<{
|
|
70
|
+
upload?: Upload;
|
|
71
|
+
options: Options;
|
|
72
|
+
onRemoveFile: (id: string, upload: Upload) => void;
|
|
73
|
+
}>;
|
|
70
74
|
/**
|
|
71
75
|
* Whether to use the cloud upload endpoint
|
|
72
76
|
* When true, uses '/cloud/web/appl/vault/upload/v1/resumable'
|