@startdownnotez404/ui 1.3.5 → 1.3.6
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/dist/AutocompleteField-653233JU.mjs +203 -0
- package/dist/AutocompleteField-653233JU.mjs.map +1 -0
- package/dist/AvatarField-KFASMVZU.mjs +378 -0
- package/dist/AvatarField-KFASMVZU.mjs.map +1 -0
- package/dist/{DateField-ZYMZFHL4.mjs → DateField-CDJ6W6XF.mjs} +19 -7
- package/dist/DateField-CDJ6W6XF.mjs.map +1 -0
- package/dist/DateRangeField-ZWSFT5KV.mjs +118 -0
- package/dist/DateRangeField-ZWSFT5KV.mjs.map +1 -0
- package/dist/{DateTimeField-TPTJ7YIZ.mjs → DateTimeField-SFAF4I6A.mjs} +36 -11
- package/dist/DateTimeField-SFAF4I6A.mjs.map +1 -0
- package/dist/FileUploadField-TSNCSLXX.mjs +101 -0
- package/dist/FileUploadField-TSNCSLXX.mjs.map +1 -0
- package/dist/{JSONEditorField-TMRWGXVR.mjs → JSONEditorField-3KXC2GOG.mjs} +7 -6
- package/dist/{JSONEditorField-TMRWGXVR.mjs.map → JSONEditorField-3KXC2GOG.mjs.map} +1 -1
- package/dist/{PopperMenu-LJ36RPBW.mjs → PopperMenu-PSHLKIEZ.mjs} +26 -12
- package/dist/{PopperMenu-LJ36RPBW.mjs.map → PopperMenu-PSHLKIEZ.mjs.map} +1 -1
- package/dist/{TelField-LOGRVZ4I.mjs → TelField-FRQT2UBJ.mjs} +8 -7
- package/dist/{TelField-LOGRVZ4I.mjs.map → TelField-FRQT2UBJ.mjs.map} +1 -1
- package/dist/TimeField-XVWXBJID.mjs +94 -0
- package/dist/TimeField-XVWXBJID.mjs.map +1 -0
- package/dist/alert.d.mts +148 -18
- package/dist/alert.d.ts +148 -18
- package/dist/alert.js +698 -254
- package/dist/alert.js.map +1 -1
- package/dist/alert.mjs +46 -10
- package/dist/autocomplete.d.mts +438 -4
- package/dist/autocomplete.d.ts +438 -4
- package/dist/autocomplete.js +632 -21
- package/dist/autocomplete.js.map +1 -1
- package/dist/autocomplete.mjs +26 -7
- package/dist/avatar.js +2 -1
- package/dist/avatar.js.map +1 -1
- package/dist/avatar.mjs +12 -11
- package/dist/box.mjs +2 -1
- package/dist/button.mjs +3 -2
- package/dist/chart.mjs +3 -2
- package/dist/checkbox.mjs +3 -2
- package/dist/chunk-2FK24ZPJ.mjs +78 -0
- package/dist/chunk-2FK24ZPJ.mjs.map +1 -0
- package/dist/{chunk-V26V2S3W.mjs → chunk-3O3N6X6D.mjs} +3 -3
- package/dist/{chunk-Y74ALKBL.mjs → chunk-4MSPA7U7.mjs} +11 -9
- package/dist/{chunk-Y74ALKBL.mjs.map → chunk-4MSPA7U7.mjs.map} +1 -1
- package/dist/{chunk-24XDGNJ6.mjs → chunk-4P45Z5LR.mjs} +63 -41
- package/dist/chunk-4P45Z5LR.mjs.map +1 -0
- package/dist/chunk-4SSJY32J.mjs +1182 -0
- package/dist/chunk-4SSJY32J.mjs.map +1 -0
- package/dist/{chunk-XJ2SXC2Q.mjs → chunk-6B6I27TT.mjs} +18 -16
- package/dist/{chunk-XJ2SXC2Q.mjs.map → chunk-6B6I27TT.mjs.map} +1 -1
- package/dist/chunk-6JKMEH2L.mjs +205 -0
- package/dist/chunk-6JKMEH2L.mjs.map +1 -0
- package/dist/{chunk-IN3O4R7Q.mjs → chunk-7O526A2D.mjs} +6 -4
- package/dist/{chunk-IN3O4R7Q.mjs.map → chunk-7O526A2D.mjs.map} +1 -1
- package/dist/chunk-AFLEG5ZC.mjs +28 -0
- package/dist/chunk-AFLEG5ZC.mjs.map +1 -0
- package/dist/{chunk-UGMRJMFZ.mjs → chunk-BO5CU4ZM.mjs} +4 -4
- package/dist/{chunk-JIU5GVM7.mjs → chunk-D4XPNSSI.mjs} +5 -3
- package/dist/{chunk-JIU5GVM7.mjs.map → chunk-D4XPNSSI.mjs.map} +1 -1
- package/dist/chunk-DPIMA5IO.mjs +72 -0
- package/dist/chunk-DPIMA5IO.mjs.map +1 -0
- package/dist/chunk-F2CGFVIZ.mjs +83 -0
- package/dist/chunk-F2CGFVIZ.mjs.map +1 -0
- package/dist/{chunk-R5MKQN6D.mjs → chunk-FBLSJQWK.mjs} +3 -3
- package/dist/{chunk-BGB7JHIU.mjs → chunk-FMGZCOJC.mjs} +5 -3
- package/dist/{chunk-BGB7JHIU.mjs.map → chunk-FMGZCOJC.mjs.map} +1 -1
- package/dist/{chunk-UTVSYS6S.mjs → chunk-FNSIQ2B7.mjs} +18 -6
- package/dist/chunk-FNSIQ2B7.mjs.map +1 -0
- package/dist/{chunk-JWANK42G.mjs → chunk-FUZ2JNTZ.mjs} +3 -3
- package/dist/{chunk-CRYIEYZZ.mjs → chunk-HAJWE62X.mjs} +66 -42
- package/dist/chunk-HAJWE62X.mjs.map +1 -0
- package/dist/{chunk-CWFWRZWU.mjs → chunk-KSN33A6I.mjs} +3 -2
- package/dist/{chunk-CWFWRZWU.mjs.map → chunk-KSN33A6I.mjs.map} +1 -1
- package/dist/chunk-KYTHGFFY.mjs +866 -0
- package/dist/chunk-KYTHGFFY.mjs.map +1 -0
- package/dist/{chunk-QKGCW37O.mjs → chunk-LDFM46LV.mjs} +5 -3
- package/dist/{chunk-QKGCW37O.mjs.map → chunk-LDFM46LV.mjs.map} +1 -1
- package/dist/chunk-LQNDBPHU.mjs +142 -0
- package/dist/chunk-LQNDBPHU.mjs.map +1 -0
- package/dist/{chunk-E3I2VDHZ.mjs → chunk-M2PYXSAF.mjs} +6 -4
- package/dist/{chunk-E3I2VDHZ.mjs.map → chunk-M2PYXSAF.mjs.map} +1 -1
- package/dist/{chunk-DELCADNF.mjs → chunk-ODVKRIVN.mjs} +30 -30
- package/dist/{chunk-HR3A4H4E.mjs → chunk-PEJL2T2K.mjs} +13 -11
- package/dist/{chunk-HR3A4H4E.mjs.map → chunk-PEJL2T2K.mjs.map} +1 -1
- package/dist/{chunk-OGNGPI3M.mjs → chunk-PL55YKT4.mjs} +2 -2
- package/dist/{chunk-S6EZVRZC.mjs → chunk-PNSJC6PC.mjs} +5 -28
- package/dist/chunk-PNSJC6PC.mjs.map +1 -0
- package/dist/{chunk-TDRA5EZI.mjs → chunk-PUREEN2J.mjs} +7 -7
- package/dist/chunk-QFS5CENY.mjs +659 -0
- package/dist/chunk-QFS5CENY.mjs.map +1 -0
- package/dist/chunk-RSN7NH2J.mjs +250 -0
- package/dist/chunk-RSN7NH2J.mjs.map +1 -0
- package/dist/{chunk-UDREPVEY.mjs → chunk-RVSMEZE3.mjs} +12 -78
- package/dist/chunk-RVSMEZE3.mjs.map +1 -0
- package/dist/{chunk-SRWPHN2N.mjs → chunk-S64IYJ6Y.mjs} +2 -2
- package/dist/{chunk-ZG3NQI77.mjs → chunk-SMD7OEUW.mjs} +6 -4
- package/dist/{chunk-ZG3NQI77.mjs.map → chunk-SMD7OEUW.mjs.map} +1 -1
- package/dist/{chunk-NJYNJLT7.mjs → chunk-SWFB3A3G.mjs} +2 -2
- package/dist/{chunk-RXBQ7KXF.mjs → chunk-USXGNKWJ.mjs} +98 -44
- package/dist/chunk-USXGNKWJ.mjs.map +1 -0
- package/dist/{chunk-OJV6V7YZ.mjs → chunk-VL7V52YD.mjs} +27 -20
- package/dist/chunk-VL7V52YD.mjs.map +1 -0
- package/dist/{chunk-2ZZJTBTE.mjs → chunk-WJZ3IYET.mjs} +2 -2
- package/dist/chunk-XAJAMVAG.mjs +1720 -0
- package/dist/chunk-XAJAMVAG.mjs.map +1 -0
- package/dist/chunk-YIJ5QVJ6.mjs +277 -0
- package/dist/chunk-YIJ5QVJ6.mjs.map +1 -0
- package/dist/{chunk-T6AMRENK.mjs → chunk-YRW5NKD7.mjs} +148 -112
- package/dist/chunk-YRW5NKD7.mjs.map +1 -0
- package/dist/chunk-ZMJKG2UI.mjs +71 -0
- package/dist/chunk-ZMJKG2UI.mjs.map +1 -0
- package/dist/confirm.d.mts +48 -0
- package/dist/confirm.d.ts +48 -0
- package/dist/confirm.js +334 -0
- package/dist/confirm.js.map +1 -0
- package/dist/confirm.mjs +20 -0
- package/dist/datePicker.d.mts +256 -14
- package/dist/datePicker.d.ts +256 -14
- package/dist/datePicker.js +1624 -145
- package/dist/datePicker.js.map +1 -1
- package/dist/datePicker.mjs +19 -6
- package/dist/dialog.d.mts +166 -0
- package/dist/dialog.d.ts +166 -0
- package/dist/dialog.js +362 -0
- package/dist/dialog.js.map +1 -0
- package/dist/dialog.mjs +45 -0
- package/dist/emptyState.d.mts +17 -0
- package/dist/emptyState.d.ts +17 -0
- package/dist/emptyState.js +253 -0
- package/dist/emptyState.js.map +1 -0
- package/dist/emptyState.mjs +12 -0
- package/dist/emptyState.mjs.map +1 -0
- package/dist/errorState.d.mts +18 -0
- package/dist/errorState.d.ts +18 -0
- package/dist/{displayFile.js → errorState.js} +107 -156
- package/dist/errorState.js.map +1 -0
- package/dist/errorState.mjs +15 -0
- package/dist/errorState.mjs.map +1 -0
- package/dist/fileUpload.d.mts +197 -0
- package/dist/fileUpload.d.ts +197 -0
- package/dist/fileUpload.js +1483 -0
- package/dist/fileUpload.js.map +1 -0
- package/dist/fileUpload.mjs +65 -0
- package/dist/fileUpload.mjs.map +1 -0
- package/dist/flowMap.mjs +7 -6
- package/dist/flowMap.mjs.map +1 -1
- package/dist/image.js +1195 -429
- package/dist/image.js.map +1 -1
- package/dist/image.mjs +8 -6
- package/dist/index.d.ts +7 -2
- package/dist/index.js +8606 -4087
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +314 -152
- package/dist/inlineError.d.mts +16 -0
- package/dist/inlineError.d.ts +16 -0
- package/dist/inlineError.js +297 -0
- package/dist/inlineError.js.map +1 -0
- package/dist/inlineError.mjs +15 -0
- package/dist/inlineError.mjs.map +1 -0
- package/dist/input.mjs +8 -7
- package/dist/jsonEditor.mjs +3 -2
- package/dist/list.mjs +7 -6
- package/dist/loading.mjs +8 -6
- package/dist/markdown.mjs +7 -6
- package/dist/markdown.mjs.map +1 -1
- package/dist/menu.mjs +9 -8
- package/dist/modal.js +2 -1
- package/dist/modal.js.map +1 -1
- package/dist/modal.mjs +7 -5
- package/dist/process.d.mts +33 -75
- package/dist/process.d.ts +33 -75
- package/dist/process.js +1275 -203
- package/dist/process.js.map +1 -1
- package/dist/process.mjs +12 -9
- package/dist/scrollToLoad.mjs +4 -3
- package/dist/select.mjs +10 -9
- package/dist/skeleton.d.mts +15 -1
- package/dist/skeleton.d.ts +15 -1
- package/dist/skeleton.js +114 -2
- package/dist/skeleton.js.map +1 -1
- package/dist/skeleton.mjs +6 -3
- package/dist/stepper.mjs +4 -3
- package/dist/tab.mjs +10 -9
- package/dist/table.d.mts +269 -85
- package/dist/table.d.ts +269 -85
- package/dist/table.js +5102 -3153
- package/dist/table.js.map +1 -1
- package/dist/table.mjs +21 -19
- package/dist/theme.js +1766 -432
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +32 -25
- package/dist/timeline.mjs +4 -3
- package/dist/toast.d.mts +49 -0
- package/dist/toast.d.ts +49 -0
- package/dist/toast.js +175 -0
- package/dist/toast.js.map +1 -0
- package/dist/toast.mjs +9 -0
- package/dist/toast.mjs.map +1 -0
- package/dist/toggleButtonGroup.mjs +3 -2
- package/dist/useForm.d.mts +270 -86
- package/dist/useForm.d.ts +270 -86
- package/dist/useForm.js +4672 -2727
- package/dist/useForm.js.map +1 -1
- package/dist/useForm.mjs +18 -16
- package/dist/useSearch.mjs +13 -12
- package/dist/variablesRenderer.mjs +8 -7
- package/package.json +3 -3
- package/dist/AutocompleteField-ZKNU2IRR.mjs +0 -181
- package/dist/AutocompleteField-ZKNU2IRR.mjs.map +0 -1
- package/dist/AvatarField-SAODT3CZ.mjs +0 -275
- package/dist/AvatarField-SAODT3CZ.mjs.map +0 -1
- package/dist/DateField-ZYMZFHL4.mjs.map +0 -1
- package/dist/DateTimeField-TPTJ7YIZ.mjs.map +0 -1
- package/dist/FileUploadField-NTMWBJER.mjs +0 -78
- package/dist/FileUploadField-NTMWBJER.mjs.map +0 -1
- package/dist/chunk-24XDGNJ6.mjs.map +0 -1
- package/dist/chunk-27KYFU7R.mjs +0 -30
- package/dist/chunk-27KYFU7R.mjs.map +0 -1
- package/dist/chunk-AAH2O24U.mjs +0 -325
- package/dist/chunk-AAH2O24U.mjs.map +0 -1
- package/dist/chunk-CRYIEYZZ.mjs.map +0 -1
- package/dist/chunk-EEH7HACG.mjs +0 -249
- package/dist/chunk-EEH7HACG.mjs.map +0 -1
- package/dist/chunk-EKPULYPU.mjs +0 -497
- package/dist/chunk-EKPULYPU.mjs.map +0 -1
- package/dist/chunk-OJV6V7YZ.mjs.map +0 -1
- package/dist/chunk-RXBQ7KXF.mjs.map +0 -1
- package/dist/chunk-S6EZVRZC.mjs.map +0 -1
- package/dist/chunk-SGCUDWO3.mjs +0 -396
- package/dist/chunk-SGCUDWO3.mjs.map +0 -1
- package/dist/chunk-T6AMRENK.mjs.map +0 -1
- package/dist/chunk-UDREPVEY.mjs.map +0 -1
- package/dist/chunk-UTVSYS6S.mjs.map +0 -1
- package/dist/chunk-XIMFP6RB.mjs +0 -161
- package/dist/chunk-XIMFP6RB.mjs.map +0 -1
- package/dist/displayFile.d.mts +0 -95
- package/dist/displayFile.d.ts +0 -95
- package/dist/displayFile.js.map +0 -1
- package/dist/displayFile.mjs +0 -19
- package/dist/fileUploader.d.mts +0 -86
- package/dist/fileUploader.d.ts +0 -86
- package/dist/fileUploader.js +0 -722
- package/dist/fileUploader.js.map +0 -1
- package/dist/fileUploader.mjs +0 -16
- /package/dist/{chunk-V26V2S3W.mjs.map → chunk-3O3N6X6D.mjs.map} +0 -0
- /package/dist/{chunk-UGMRJMFZ.mjs.map → chunk-BO5CU4ZM.mjs.map} +0 -0
- /package/dist/{chunk-R5MKQN6D.mjs.map → chunk-FBLSJQWK.mjs.map} +0 -0
- /package/dist/{chunk-JWANK42G.mjs.map → chunk-FUZ2JNTZ.mjs.map} +0 -0
- /package/dist/{chunk-DELCADNF.mjs.map → chunk-ODVKRIVN.mjs.map} +0 -0
- /package/dist/{chunk-OGNGPI3M.mjs.map → chunk-PL55YKT4.mjs.map} +0 -0
- /package/dist/{chunk-TDRA5EZI.mjs.map → chunk-PUREEN2J.mjs.map} +0 -0
- /package/dist/{chunk-SRWPHN2N.mjs.map → chunk-S64IYJ6Y.mjs.map} +0 -0
- /package/dist/{chunk-NJYNJLT7.mjs.map → chunk-SWFB3A3G.mjs.map} +0 -0
- /package/dist/{chunk-2ZZJTBTE.mjs.map → chunk-WJZ3IYET.mjs.map} +0 -0
- /package/dist/{displayFile.mjs.map → confirm.mjs.map} +0 -0
- /package/dist/{fileUploader.mjs.map → dialog.mjs.map} +0 -0
package/dist/process.js
CHANGED
|
@@ -102,7 +102,7 @@ __export(Process_exports, {
|
|
|
102
102
|
module.exports = __toCommonJS(Process_exports);
|
|
103
103
|
|
|
104
104
|
// src/components/compound/Process/src/ProcessModal.tsx
|
|
105
|
-
var
|
|
105
|
+
var import_react7 = require("react");
|
|
106
106
|
|
|
107
107
|
// src/_utils/_func/random.ts
|
|
108
108
|
function randomStrGenerator(length = 20) {
|
|
@@ -386,7 +386,8 @@ var CLASSNAMEs = {
|
|
|
386
386
|
// button variant used by AvatarButton and related controls
|
|
387
387
|
button: "Elemental-AvatarButton"
|
|
388
388
|
},
|
|
389
|
-
modal: "Elemental-Modal"
|
|
389
|
+
modal: "Elemental-Modal",
|
|
390
|
+
dialog: "Elemental-Dialog"
|
|
390
391
|
},
|
|
391
392
|
compound: {
|
|
392
393
|
useForm: {
|
|
@@ -899,174 +900,1171 @@ function MuiModalHeader({
|
|
|
899
900
|
] });
|
|
900
901
|
}
|
|
901
902
|
|
|
903
|
+
// src/components/elemental/FileUpload/src/FileUpload.tsx
|
|
904
|
+
var import_react3 = require("react");
|
|
905
|
+
|
|
906
|
+
// src/components/elemental/Form/src/FormLabel/FormLabel.tsx
|
|
907
|
+
var import_FormLabel = __toESM(require("@mui/material/FormLabel"));
|
|
908
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
909
|
+
function MuiFormLabel(props) {
|
|
910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_FormLabel.default, { ...props });
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
// src/components/elemental/Form/src/index.ts
|
|
914
|
+
var import_FormControl = __toESM(require("@mui/material/FormControl"));
|
|
915
|
+
var import_FormHelperText = __toESM(require("@mui/material/FormHelperText"));
|
|
916
|
+
var import_InputAdornment = __toESM(require("@mui/material/InputAdornment"));
|
|
917
|
+
var import_InputLabel = __toESM(require("@mui/material/InputLabel"));
|
|
918
|
+
|
|
902
919
|
// src/components/elemental/Progress/src/LinearProgress.tsx
|
|
903
920
|
var import_LinearProgress = __toESM(require("@mui/material/LinearProgress"));
|
|
904
|
-
var
|
|
921
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
905
922
|
var LinearProgress = (props) => {
|
|
906
|
-
return /* @__PURE__ */ (0,
|
|
923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_LinearProgress.default, { ...props });
|
|
907
924
|
};
|
|
908
925
|
|
|
909
926
|
// src/components/elemental/Progress/src/CircularProgress.tsx
|
|
910
927
|
var import_CircularProgress = __toESM(require("@mui/material/CircularProgress"));
|
|
911
|
-
var
|
|
928
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
912
929
|
var CircularProgress = (props) => {
|
|
913
|
-
return /* @__PURE__ */ (0,
|
|
930
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_CircularProgress.default, { ...props });
|
|
914
931
|
};
|
|
915
932
|
|
|
916
|
-
// src/
|
|
917
|
-
var
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
933
|
+
// src/components/elemental/FileUpload/src/FileUpload.tsx
|
|
934
|
+
var import_react_file_icon = require("react-file-icon");
|
|
935
|
+
|
|
936
|
+
// src/components/elemental/FileUpload/src/theme.ts
|
|
937
|
+
var fileUploadRootSx = {
|
|
938
|
+
"--fu-border": "var(--mui-palette-border-1)",
|
|
939
|
+
"--fu-border-hover": "var(--mui-palette-border-hover-1, var(--mui-palette-text-secondary))",
|
|
940
|
+
"--fu-border-active": "color-mix(in srgb, var(--mui-palette-text-secondary) 65%, transparent)",
|
|
941
|
+
"--fu-border-error": "var(--mui-palette-error-main)",
|
|
942
|
+
"--fu-surface": "color-mix(in srgb, var(--mui-palette-background-paper) 78%, transparent)",
|
|
943
|
+
"--fu-surface-hover": "color-mix(in srgb, var(--mui-palette-background-paper) 92%, transparent)",
|
|
944
|
+
"--fu-surface-active": "color-mix(in srgb, var(--mui-palette-primary-main) 8%, var(--mui-palette-background-paper))",
|
|
945
|
+
"--fu-item-bg": "color-mix(in srgb, var(--mui-palette-background-paper) 88%, transparent)",
|
|
946
|
+
"--fu-icon": "var(--mui-palette-text-secondary)",
|
|
947
|
+
"--fu-text": "var(--mui-palette-text-primary)",
|
|
948
|
+
"--fu-text-secondary": "var(--mui-palette-text-secondary)",
|
|
949
|
+
"--fu-shadow": "inset 0 1px 0 color-mix(in srgb, var(--mui-palette-common-white) 6%, transparent)",
|
|
950
|
+
"--fu-radius": "16px",
|
|
951
|
+
"--fu-item-radius": "12px",
|
|
952
|
+
display: "flex",
|
|
953
|
+
flexDirection: "column",
|
|
954
|
+
gap: 1,
|
|
955
|
+
width: "100%",
|
|
956
|
+
boxSizing: "border-box",
|
|
957
|
+
'[color-scheme="dark"] &': {
|
|
958
|
+
"--fu-surface": "color-mix(in srgb, var(--mui-palette-background-paper) 70%, transparent)",
|
|
959
|
+
"--fu-surface-hover": "color-mix(in srgb, var(--mui-palette-background-paper) 88%, transparent)",
|
|
960
|
+
"--fu-item-bg": "color-mix(in srgb, var(--mui-palette-background-paper) 82%, transparent)",
|
|
961
|
+
"--fu-shadow": "inset 0 1px 0 color-mix(in srgb, var(--mui-palette-common-white) 8%, transparent), 0 1px 2px rgba(0,0,0,0.18)"
|
|
962
|
+
}
|
|
963
|
+
};
|
|
964
|
+
var fileUploadDropzoneSx = {
|
|
965
|
+
display: "flex",
|
|
966
|
+
flexDirection: "column",
|
|
967
|
+
alignItems: "center",
|
|
968
|
+
justifyContent: "center",
|
|
969
|
+
textAlign: "center",
|
|
970
|
+
gap: 0.75,
|
|
971
|
+
px: 3,
|
|
972
|
+
py: 3.5,
|
|
973
|
+
minHeight: 140,
|
|
974
|
+
borderRadius: "var(--fu-radius)",
|
|
975
|
+
border: "1px dashed var(--fu-drop-border, var(--fu-border))",
|
|
976
|
+
backgroundColor: "var(--fu-drop-bg, var(--fu-surface))",
|
|
977
|
+
boxShadow: "var(--fu-shadow)",
|
|
978
|
+
color: "var(--fu-text-secondary)",
|
|
979
|
+
cursor: "pointer",
|
|
980
|
+
outline: "none",
|
|
981
|
+
boxSizing: "border-box",
|
|
982
|
+
transition: "border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease",
|
|
983
|
+
"&:hover": {
|
|
984
|
+
borderColor: "var(--fu-border-hover)",
|
|
985
|
+
backgroundColor: "var(--fu-surface-hover)"
|
|
986
|
+
},
|
|
987
|
+
"&:focus-visible": {
|
|
988
|
+
borderColor: "var(--fu-border-active)",
|
|
989
|
+
borderStyle: "solid"
|
|
990
|
+
},
|
|
991
|
+
'&[data-active="true"]': {
|
|
992
|
+
borderColor: "var(--fu-border-active)",
|
|
993
|
+
borderStyle: "solid",
|
|
994
|
+
backgroundColor: "var(--fu-surface-active)"
|
|
995
|
+
},
|
|
996
|
+
'&[data-error="true"]': {
|
|
997
|
+
"--fu-drop-border": "var(--fu-border-error)"
|
|
998
|
+
},
|
|
999
|
+
'&[data-disabled="true"]': {
|
|
1000
|
+
opacity: 0.58,
|
|
1001
|
+
cursor: "default",
|
|
1002
|
+
pointerEvents: "none"
|
|
1003
|
+
}
|
|
1004
|
+
};
|
|
1005
|
+
var fileUploadItemSx = {
|
|
1006
|
+
display: "flex",
|
|
1007
|
+
alignItems: "center",
|
|
1008
|
+
gap: 1.25,
|
|
1009
|
+
px: 1.25,
|
|
1010
|
+
py: 1,
|
|
1011
|
+
borderRadius: "var(--fu-item-radius)",
|
|
1012
|
+
border: "1px solid var(--fu-border)",
|
|
1013
|
+
backgroundColor: "var(--fu-item-bg)",
|
|
1014
|
+
boxShadow: "var(--fu-shadow)",
|
|
1015
|
+
boxSizing: "border-box",
|
|
1016
|
+
minWidth: 0,
|
|
1017
|
+
'&[data-status="error"]': {
|
|
1018
|
+
borderColor: "color-mix(in srgb, var(--mui-palette-error-main) 55%, var(--fu-border))",
|
|
1019
|
+
backgroundColor: "color-mix(in srgb, var(--mui-palette-error-main) 8%, var(--fu-item-bg))"
|
|
1020
|
+
}
|
|
1021
|
+
};
|
|
1022
|
+
var fileUploadThumbSx = {
|
|
1023
|
+
width: 36,
|
|
1024
|
+
height: 36,
|
|
1025
|
+
minWidth: 36,
|
|
1026
|
+
borderRadius: "8px",
|
|
1027
|
+
objectFit: "cover",
|
|
1028
|
+
flexShrink: 0,
|
|
1029
|
+
border: "1px solid var(--fu-border)",
|
|
1030
|
+
backgroundColor: "var(--fu-item-bg)",
|
|
1031
|
+
display: "block",
|
|
1032
|
+
boxSizing: "border-box"
|
|
1033
|
+
};
|
|
1034
|
+
var fileUploadIconWellSx = {
|
|
1035
|
+
width: 36,
|
|
1036
|
+
height: 36,
|
|
1037
|
+
minWidth: 36,
|
|
1038
|
+
borderRadius: "8px",
|
|
1039
|
+
flexShrink: 0,
|
|
1040
|
+
display: "flex",
|
|
1041
|
+
alignItems: "center",
|
|
1042
|
+
justifyContent: "center",
|
|
1043
|
+
border: "1px solid var(--fu-border)",
|
|
1044
|
+
backgroundColor: "color-mix(in srgb, var(--mui-palette-background-paper) 55%, transparent)",
|
|
1045
|
+
boxSizing: "border-box",
|
|
1046
|
+
overflow: "hidden"
|
|
1047
|
+
};
|
|
1048
|
+
var fileUploadLibIconSx = {
|
|
1049
|
+
width: 24,
|
|
1050
|
+
height: 30,
|
|
1051
|
+
lineHeight: 0,
|
|
1052
|
+
flexShrink: 0,
|
|
1053
|
+
// Keep library colors vivid (no opacity / filter / color overrides).
|
|
1054
|
+
color: "unset",
|
|
1055
|
+
filter: "none",
|
|
1056
|
+
opacity: 1,
|
|
1057
|
+
"& svg": {
|
|
1058
|
+
width: "100%",
|
|
1059
|
+
height: "100%",
|
|
1060
|
+
display: "block",
|
|
1061
|
+
// Prevent inherited MUI text color from washing glyph/label fills.
|
|
1062
|
+
color: "unset"
|
|
1063
|
+
}
|
|
1064
|
+
};
|
|
1065
|
+
var fileUploadButtonSx = {
|
|
1066
|
+
alignSelf: "flex-start",
|
|
1067
|
+
textTransform: "none",
|
|
1068
|
+
fontWeight: 600,
|
|
1069
|
+
fontSize: "0.8125rem",
|
|
1070
|
+
lineHeight: 1.25,
|
|
1071
|
+
borderRadius: "10px",
|
|
1072
|
+
px: 1.5,
|
|
1073
|
+
py: 0.75,
|
|
1074
|
+
minHeight: 36,
|
|
1075
|
+
border: "1px solid var(--fu-border)",
|
|
1076
|
+
backgroundColor: "var(--fu-surface)",
|
|
1077
|
+
color: "var(--fu-text)",
|
|
1078
|
+
boxShadow: "var(--fu-shadow)",
|
|
1079
|
+
transition: "border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease",
|
|
1080
|
+
"&:hover": {
|
|
1081
|
+
borderColor: "var(--fu-border-hover)",
|
|
1082
|
+
backgroundColor: "var(--fu-surface-hover)"
|
|
1083
|
+
},
|
|
1084
|
+
"&:focus-visible": {
|
|
1085
|
+
borderColor: "var(--fu-border-active)",
|
|
1086
|
+
outline: "none"
|
|
1087
|
+
},
|
|
1088
|
+
'&[data-active="true"]': {
|
|
1089
|
+
borderColor: "var(--fu-border-active)",
|
|
1090
|
+
backgroundColor: "var(--fu-surface-active)"
|
|
1091
|
+
},
|
|
1092
|
+
'&[data-error="true"]': {
|
|
1093
|
+
borderColor: "var(--fu-border-error)",
|
|
1094
|
+
color: "var(--fu-border-error)"
|
|
1095
|
+
},
|
|
1096
|
+
"&.Mui-disabled": {
|
|
1097
|
+
opacity: 0.58,
|
|
1098
|
+
borderColor: "var(--fu-border)",
|
|
1099
|
+
color: "var(--fu-text-secondary)"
|
|
1100
|
+
},
|
|
1101
|
+
"& .MuiButton-startIcon": {
|
|
1102
|
+
marginRight: "8px",
|
|
1103
|
+
marginLeft: 0,
|
|
1104
|
+
color: "var(--fu-icon)"
|
|
1105
|
+
}
|
|
1106
|
+
};
|
|
1107
|
+
var fileUploadTileListSx = {
|
|
1108
|
+
display: "flex",
|
|
1109
|
+
flexWrap: "wrap",
|
|
1110
|
+
gap: 1.25,
|
|
1111
|
+
m: 0,
|
|
1112
|
+
p: 0,
|
|
1113
|
+
listStyle: "none"
|
|
1114
|
+
};
|
|
1115
|
+
var fileUploadTileSx = {
|
|
1116
|
+
"--fu-tile-size": "80px",
|
|
1117
|
+
position: "relative",
|
|
1118
|
+
width: "var(--fu-tile-size)",
|
|
1119
|
+
height: "var(--fu-tile-size)",
|
|
1120
|
+
minWidth: "var(--fu-tile-size)",
|
|
1121
|
+
borderRadius: "12px",
|
|
1122
|
+
border: "1px solid var(--fu-border)",
|
|
1123
|
+
backgroundColor: "var(--fu-item-bg)",
|
|
1124
|
+
boxShadow: "var(--fu-shadow)",
|
|
1125
|
+
boxSizing: "border-box",
|
|
1126
|
+
overflow: "hidden",
|
|
1127
|
+
flexShrink: 0,
|
|
1128
|
+
'&[data-status="error"]': {
|
|
1129
|
+
borderColor: "color-mix(in srgb, var(--mui-palette-error-main) 55%, var(--fu-border))"
|
|
1130
|
+
},
|
|
1131
|
+
"&:hover .fu-tile-remove, &:focus-within .fu-tile-remove": {
|
|
1132
|
+
opacity: 1,
|
|
1133
|
+
pointerEvents: "auto"
|
|
1134
|
+
}
|
|
1135
|
+
};
|
|
1136
|
+
var fileUploadTileMediaSx = {
|
|
1137
|
+
width: "100%",
|
|
1138
|
+
height: "100%",
|
|
1139
|
+
objectFit: "cover",
|
|
1140
|
+
display: "block",
|
|
1141
|
+
borderRadius: "inherit"
|
|
1142
|
+
};
|
|
1143
|
+
var fileUploadTileIconWellSx = {
|
|
1144
|
+
width: "100%",
|
|
1145
|
+
height: "100%",
|
|
1146
|
+
display: "flex",
|
|
1147
|
+
alignItems: "center",
|
|
1148
|
+
justifyContent: "center",
|
|
1149
|
+
backgroundColor: "color-mix(in srgb, var(--mui-palette-background-paper) 55%, transparent)",
|
|
1150
|
+
border: "none",
|
|
1151
|
+
borderRadius: 0,
|
|
1152
|
+
boxSizing: "border-box",
|
|
1153
|
+
overflow: "hidden"
|
|
1154
|
+
};
|
|
1155
|
+
var fileUploadTileLibIconSx = {
|
|
1156
|
+
width: 36,
|
|
1157
|
+
height: 44,
|
|
1158
|
+
lineHeight: 0,
|
|
1159
|
+
flexShrink: 0,
|
|
1160
|
+
color: "unset",
|
|
1161
|
+
filter: "none",
|
|
1162
|
+
opacity: 1,
|
|
1163
|
+
"& svg": {
|
|
1164
|
+
width: "100%",
|
|
1165
|
+
height: "100%",
|
|
1166
|
+
display: "block",
|
|
1167
|
+
color: "unset"
|
|
1168
|
+
}
|
|
1169
|
+
};
|
|
1170
|
+
var fileUploadTileRemoveSx = {
|
|
1171
|
+
position: "absolute",
|
|
1172
|
+
top: 4,
|
|
1173
|
+
right: 4,
|
|
1174
|
+
zIndex: 2,
|
|
1175
|
+
width: 22,
|
|
1176
|
+
height: 22,
|
|
1177
|
+
p: 0,
|
|
1178
|
+
opacity: 0,
|
|
1179
|
+
pointerEvents: "none",
|
|
1180
|
+
backgroundColor: "#fff",
|
|
1181
|
+
color: "rgba(15, 23, 42, 0.72)",
|
|
1182
|
+
boxShadow: "0 1px 3px rgba(0,0,0,0.22)",
|
|
1183
|
+
border: "1px solid color-mix(in srgb, var(--mui-palette-common-black) 8%, transparent)",
|
|
1184
|
+
transition: "opacity 140ms ease, background-color 140ms ease",
|
|
1185
|
+
"&:hover": {
|
|
1186
|
+
backgroundColor: "#fff",
|
|
1187
|
+
color: "rgba(15, 23, 42, 0.92)"
|
|
1188
|
+
},
|
|
1189
|
+
"&.Mui-disabled": {
|
|
1190
|
+
opacity: 0
|
|
1191
|
+
}
|
|
1192
|
+
};
|
|
1193
|
+
var fileUploadTileProgressSx = {
|
|
1194
|
+
position: "absolute",
|
|
1195
|
+
left: 0,
|
|
1196
|
+
right: 0,
|
|
1197
|
+
bottom: 0,
|
|
1198
|
+
zIndex: 1,
|
|
1199
|
+
height: 3,
|
|
1200
|
+
borderRadius: 0,
|
|
1201
|
+
backgroundColor: "color-mix(in srgb, var(--mui-palette-common-black) 25%, transparent)",
|
|
1202
|
+
"& .MuiLinearProgress-bar": {
|
|
1203
|
+
borderRadius: 0
|
|
1204
|
+
}
|
|
929
1205
|
};
|
|
930
1206
|
|
|
931
|
-
// src/components/
|
|
932
|
-
var
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
1207
|
+
// src/components/elemental/FileUpload/src/utils.ts
|
|
1208
|
+
var idSeq = 0;
|
|
1209
|
+
function createFileUploadId() {
|
|
1210
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
1211
|
+
return crypto.randomUUID();
|
|
1212
|
+
}
|
|
1213
|
+
idSeq += 1;
|
|
1214
|
+
return `fu-${Date.now()}-${idSeq}`;
|
|
1215
|
+
}
|
|
1216
|
+
function createFileUploadItem(file) {
|
|
1217
|
+
return {
|
|
1218
|
+
id: createFileUploadId(),
|
|
1219
|
+
file,
|
|
1220
|
+
status: "idle",
|
|
1221
|
+
progress: 0
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1224
|
+
function formatFileSize(bytes) {
|
|
1225
|
+
if (!Number.isFinite(bytes) || bytes < 0) return "\u2014";
|
|
1226
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
1227
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
1228
|
+
if (bytes < 1024 * 1024 * 1024) {
|
|
1229
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
1230
|
+
}
|
|
1231
|
+
return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`;
|
|
1232
|
+
}
|
|
1233
|
+
function parseAccept(accept) {
|
|
1234
|
+
if (!accept || !accept.trim()) return [];
|
|
1235
|
+
return accept.split(",").map((p) => p.trim()).filter(Boolean).map((token) => {
|
|
1236
|
+
if (token.startsWith(".")) {
|
|
1237
|
+
return { type: "ext", value: token.toLowerCase() };
|
|
1238
|
+
}
|
|
1239
|
+
return { type: "mime", value: token.toLowerCase() };
|
|
1240
|
+
});
|
|
1241
|
+
}
|
|
1242
|
+
function matchesAccept(file, rules) {
|
|
1243
|
+
if (rules.length === 0) return true;
|
|
1244
|
+
const name = file.name.toLowerCase();
|
|
1245
|
+
const mime = (file.type || "").toLowerCase();
|
|
1246
|
+
return rules.some((rule) => {
|
|
1247
|
+
if (rule.type === "ext") {
|
|
1248
|
+
return name.endsWith(rule.value);
|
|
1249
|
+
}
|
|
1250
|
+
if (rule.value.endsWith("/*")) {
|
|
1251
|
+
const prefix = rule.value.slice(0, -1);
|
|
1252
|
+
return mime.startsWith(prefix);
|
|
1253
|
+
}
|
|
1254
|
+
return mime === rule.value;
|
|
1255
|
+
});
|
|
1256
|
+
}
|
|
1257
|
+
function validateFiles(incoming, opts) {
|
|
1258
|
+
const rules = parseAccept(opts.accept);
|
|
1259
|
+
const accepted = [];
|
|
1260
|
+
const rejections = [];
|
|
1261
|
+
const hardCap = opts.multiple ? opts.maxFiles != null && opts.maxFiles > 0 ? opts.maxFiles : Infinity : 1;
|
|
1262
|
+
for (const file of incoming) {
|
|
1263
|
+
const errors = [];
|
|
1264
|
+
if (!matchesAccept(file, rules)) {
|
|
1265
|
+
errors.push("file-invalid-type");
|
|
1266
|
+
}
|
|
1267
|
+
if (opts.maxSize != null && opts.maxSize > 0 && file.size > opts.maxSize) {
|
|
1268
|
+
errors.push("file-too-large");
|
|
1269
|
+
}
|
|
1270
|
+
if (opts.currentCount + accepted.length >= hardCap) {
|
|
1271
|
+
errors.push("too-many-files");
|
|
1272
|
+
}
|
|
1273
|
+
if (errors.length > 0) {
|
|
1274
|
+
rejections.push({ file, errors });
|
|
1275
|
+
} else {
|
|
1276
|
+
accepted.push(file);
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
return { accepted, rejections };
|
|
1280
|
+
}
|
|
1281
|
+
var MIME_TO_EXT = {
|
|
1282
|
+
"application/pdf": "pdf",
|
|
1283
|
+
"application/zip": "zip",
|
|
1284
|
+
"application/x-zip-compressed": "zip",
|
|
1285
|
+
"application/gzip": "gz",
|
|
1286
|
+
"application/x-gzip": "gz",
|
|
1287
|
+
"application/x-rar-compressed": "rar",
|
|
1288
|
+
"application/vnd.rar": "rar",
|
|
1289
|
+
"application/x-7z-compressed": "7z",
|
|
1290
|
+
"application/x-tar": "tar",
|
|
1291
|
+
"application/json": "json",
|
|
1292
|
+
"application/msword": "doc",
|
|
1293
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
|
|
1294
|
+
"application/vnd.ms-excel": "xls",
|
|
1295
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx",
|
|
1296
|
+
"application/vnd.ms-powerpoint": "ppt",
|
|
1297
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation": "pptx",
|
|
1298
|
+
"text/plain": "txt",
|
|
1299
|
+
"text/csv": "csv",
|
|
1300
|
+
"text/markdown": "md",
|
|
1301
|
+
"image/jpeg": "jpg",
|
|
1302
|
+
"image/png": "png",
|
|
1303
|
+
"image/gif": "gif",
|
|
1304
|
+
"image/webp": "webp",
|
|
1305
|
+
"image/svg+xml": "svg",
|
|
1306
|
+
"audio/mpeg": "mp3",
|
|
1307
|
+
"audio/wav": "wav",
|
|
1308
|
+
"video/mp4": "mp4",
|
|
1309
|
+
"video/webm": "webm"
|
|
1310
|
+
};
|
|
1311
|
+
function getFileExtension(file) {
|
|
1312
|
+
const name = file.name || "";
|
|
1313
|
+
const dot = name.lastIndexOf(".");
|
|
1314
|
+
if (dot > 0 && dot < name.length - 1) {
|
|
1315
|
+
return name.slice(dot + 1).toLowerCase();
|
|
955
1316
|
}
|
|
1317
|
+
const mime = (file.type || "").toLowerCase();
|
|
1318
|
+
return MIME_TO_EXT[mime] ?? "";
|
|
1319
|
+
}
|
|
1320
|
+
function isImageFile(file) {
|
|
1321
|
+
return typeof file.type === "string" && file.type.startsWith("image/");
|
|
1322
|
+
}
|
|
1323
|
+
var EXT_ALIASES = {
|
|
1324
|
+
"7z": "7zip",
|
|
1325
|
+
tgz: "gz",
|
|
1326
|
+
tbz: "gz",
|
|
1327
|
+
tbz2: "gz"
|
|
1328
|
+
};
|
|
1329
|
+
var ARCHIVE_FILE_ICON_STYLE = {
|
|
1330
|
+
type: "compressed",
|
|
1331
|
+
labelColor: "#E2A903",
|
|
1332
|
+
labelTextColor: "#1A1A1A",
|
|
1333
|
+
labelUppercase: true,
|
|
1334
|
+
foldColor: "#C48E02",
|
|
1335
|
+
color: "#F6E7A8",
|
|
1336
|
+
glyphColor: "rgba(40, 30, 0, 0.35)"
|
|
956
1337
|
};
|
|
957
|
-
var
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
1338
|
+
var ARCHIVE_EXTS = /* @__PURE__ */ new Set([
|
|
1339
|
+
"zip",
|
|
1340
|
+
"zipx",
|
|
1341
|
+
"rar",
|
|
1342
|
+
"7z",
|
|
1343
|
+
"7zip",
|
|
1344
|
+
"gz",
|
|
1345
|
+
"tar",
|
|
1346
|
+
"tgz",
|
|
1347
|
+
"sitx",
|
|
1348
|
+
"bz2"
|
|
1349
|
+
]);
|
|
1350
|
+
var TYPE_COLOR_FALLBACKS = {
|
|
1351
|
+
"3d": {
|
|
1352
|
+
type: "3d",
|
|
1353
|
+
labelColor: "#5FB9AD",
|
|
1354
|
+
foldColor: "#4A9E94",
|
|
1355
|
+
color: "#E5F6F4"
|
|
1356
|
+
},
|
|
1357
|
+
acrobat: {
|
|
1358
|
+
type: "acrobat",
|
|
1359
|
+
labelColor: "#D93831",
|
|
1360
|
+
foldColor: "#B82E28",
|
|
1361
|
+
color: "#FCE8E7"
|
|
1362
|
+
},
|
|
1363
|
+
android: {
|
|
1364
|
+
type: "android",
|
|
1365
|
+
labelColor: "#3DDC84",
|
|
1366
|
+
foldColor: "#2BB86A",
|
|
1367
|
+
color: "#E6FBF0"
|
|
1368
|
+
},
|
|
1369
|
+
audio: {
|
|
1370
|
+
type: "audio",
|
|
1371
|
+
labelColor: "#9B59B6",
|
|
1372
|
+
foldColor: "#7E3F9A",
|
|
1373
|
+
color: "#F3E9F8"
|
|
1374
|
+
},
|
|
1375
|
+
binary: {
|
|
1376
|
+
type: "binary",
|
|
1377
|
+
labelColor: "#E67E22",
|
|
1378
|
+
foldColor: "#C86A1A",
|
|
1379
|
+
color: "#FDF0E4"
|
|
1380
|
+
},
|
|
1381
|
+
code: {
|
|
1382
|
+
type: "code",
|
|
1383
|
+
labelColor: "#3498DB",
|
|
1384
|
+
foldColor: "#2A7AB0",
|
|
1385
|
+
color: "#E7F3FB"
|
|
1386
|
+
},
|
|
1387
|
+
compressed: { ...ARCHIVE_FILE_ICON_STYLE },
|
|
1388
|
+
document: {
|
|
1389
|
+
type: "document",
|
|
1390
|
+
labelColor: "#5B8DEF",
|
|
1391
|
+
labelUppercase: true,
|
|
1392
|
+
foldColor: "#4A75C9",
|
|
1393
|
+
color: "#E8EEF9",
|
|
1394
|
+
glyphColor: "rgba(40, 60, 120, 0.35)"
|
|
1395
|
+
},
|
|
1396
|
+
drive: {
|
|
1397
|
+
type: "drive",
|
|
1398
|
+
labelColor: "#27AE60",
|
|
1399
|
+
foldColor: "#1E8A4B",
|
|
1400
|
+
color: "#E5F7ED"
|
|
1401
|
+
},
|
|
1402
|
+
font: {
|
|
1403
|
+
type: "font",
|
|
1404
|
+
labelColor: "#8E44AD",
|
|
1405
|
+
foldColor: "#71368A",
|
|
1406
|
+
color: "#F2E8F7"
|
|
1407
|
+
},
|
|
1408
|
+
image: {
|
|
1409
|
+
type: "image",
|
|
1410
|
+
labelColor: "#1ABC9C",
|
|
1411
|
+
foldColor: "#14967C",
|
|
1412
|
+
color: "#E4F8F3"
|
|
1413
|
+
},
|
|
1414
|
+
presentation: {
|
|
1415
|
+
type: "presentation",
|
|
1416
|
+
labelColor: "#D35400",
|
|
1417
|
+
labelUppercase: true,
|
|
1418
|
+
foldColor: "#A84300",
|
|
1419
|
+
color: "#FCEADE",
|
|
1420
|
+
glyphColor: "rgba(120, 50, 0, 0.35)"
|
|
1421
|
+
},
|
|
1422
|
+
settings: {
|
|
1423
|
+
type: "settings",
|
|
1424
|
+
labelColor: "#16A085",
|
|
1425
|
+
foldColor: "#117A65",
|
|
1426
|
+
color: "#E4F6F2"
|
|
1427
|
+
},
|
|
1428
|
+
spreadsheet: {
|
|
1429
|
+
type: "spreadsheet",
|
|
1430
|
+
labelColor: "#2D7D46",
|
|
1431
|
+
labelUppercase: true,
|
|
1432
|
+
foldColor: "#246338",
|
|
1433
|
+
color: "#E5F2EA",
|
|
1434
|
+
glyphColor: "rgba(20, 60, 30, 0.35)"
|
|
1435
|
+
},
|
|
1436
|
+
vector: {
|
|
1437
|
+
type: "vector",
|
|
1438
|
+
labelColor: "#FF7F18",
|
|
1439
|
+
foldColor: "#D96A12",
|
|
1440
|
+
color: "#FFF0E4"
|
|
1441
|
+
},
|
|
1442
|
+
video: {
|
|
1443
|
+
type: "video",
|
|
1444
|
+
labelColor: "#E74C3C",
|
|
1445
|
+
foldColor: "#C0392B",
|
|
1446
|
+
color: "#FCE9E7"
|
|
1447
|
+
}
|
|
1448
|
+
};
|
|
1449
|
+
var UNKNOWN_FILE_ICON_STYLE = {
|
|
1450
|
+
type: "document",
|
|
1451
|
+
labelColor: "#5B8DEF",
|
|
1452
|
+
labelTextColor: "#FFFFFF",
|
|
1453
|
+
labelUppercase: true,
|
|
1454
|
+
foldColor: "#4A75C9",
|
|
1455
|
+
color: "#E8EEF9",
|
|
1456
|
+
glyphColor: "rgba(40, 60, 120, 0.35)"
|
|
1457
|
+
};
|
|
1458
|
+
var MONO_PAGE_COLORS = /* @__PURE__ */ new Set([
|
|
1459
|
+
"",
|
|
1460
|
+
"whitesmoke",
|
|
1461
|
+
"#fff",
|
|
1462
|
+
"#ffffff",
|
|
1463
|
+
"white",
|
|
1464
|
+
"#f5f5f5",
|
|
1465
|
+
"#fafafa"
|
|
1466
|
+
]);
|
|
1467
|
+
function hasVividColor(style) {
|
|
1468
|
+
if (typeof style.labelColor === "string" && style.labelColor.trim()) {
|
|
1469
|
+
return true;
|
|
1470
|
+
}
|
|
1471
|
+
if (typeof style.color === "string") {
|
|
1472
|
+
const c = style.color.trim().toLowerCase();
|
|
1473
|
+
if (c && !MONO_PAGE_COLORS.has(c)) return true;
|
|
1474
|
+
}
|
|
1475
|
+
return false;
|
|
1476
|
+
}
|
|
1477
|
+
function mergeColorEnrichment(lib, enrichment) {
|
|
1478
|
+
return {
|
|
1479
|
+
...enrichment,
|
|
1480
|
+
...lib,
|
|
1481
|
+
labelColor: lib.labelColor ?? enrichment.labelColor,
|
|
1482
|
+
labelTextColor: lib.labelTextColor ?? enrichment.labelTextColor,
|
|
1483
|
+
foldColor: lib.foldColor ?? enrichment.foldColor,
|
|
1484
|
+
color: lib.color ?? enrichment.color,
|
|
1485
|
+
glyphColor: lib.glyphColor ?? enrichment.glyphColor,
|
|
1486
|
+
labelUppercase: lib.labelUppercase ?? enrichment.labelUppercase,
|
|
1487
|
+
type: lib.type ?? enrichment.type
|
|
1488
|
+
};
|
|
1489
|
+
}
|
|
1490
|
+
function resolveFileIconStyle(file, defaultStyles2) {
|
|
1491
|
+
const rawExt = getFileExtension(file);
|
|
1492
|
+
const styleKey = (EXT_ALIASES[rawExt] ?? rawExt).toLowerCase();
|
|
1493
|
+
const displayExt = rawExt || styleKey || void 0;
|
|
1494
|
+
const lib = {
|
|
1495
|
+
...(styleKey ? defaultStyles2[styleKey] : void 0) ?? {}
|
|
1496
|
+
};
|
|
1497
|
+
const isArchive = ARCHIVE_EXTS.has(rawExt) || ARCHIVE_EXTS.has(styleKey) || lib.type === "compressed";
|
|
1498
|
+
let style;
|
|
1499
|
+
if (isArchive) {
|
|
1500
|
+
style = { ...lib, ...ARCHIVE_FILE_ICON_STYLE };
|
|
1501
|
+
} else if (hasVividColor(lib)) {
|
|
1502
|
+
style = { ...lib };
|
|
1503
|
+
} else if (lib.type && TYPE_COLOR_FALLBACKS[lib.type]) {
|
|
1504
|
+
style = mergeColorEnrichment(lib, TYPE_COLOR_FALLBACKS[lib.type]);
|
|
1505
|
+
} else {
|
|
1506
|
+
style = mergeColorEnrichment(lib, UNKNOWN_FILE_ICON_STYLE);
|
|
1507
|
+
}
|
|
1508
|
+
return {
|
|
1509
|
+
extension: displayExt,
|
|
1510
|
+
styleKey,
|
|
1511
|
+
style
|
|
1512
|
+
};
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
// src/components/elemental/FileUpload/src/FileUpload.tsx
|
|
1516
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1517
|
+
function mergeSx2(...parts) {
|
|
1518
|
+
const out = [];
|
|
1519
|
+
for (const p of parts) {
|
|
1520
|
+
if (!p) continue;
|
|
1521
|
+
if (Array.isArray(p)) out.push(...p);
|
|
1522
|
+
else out.push(p);
|
|
1523
|
+
}
|
|
1524
|
+
return out;
|
|
1525
|
+
}
|
|
1526
|
+
var FileUpload = (0, import_react3.forwardRef)(
|
|
1527
|
+
function FileUpload2(props, ref) {
|
|
1528
|
+
const {
|
|
1529
|
+
value: valueProp,
|
|
1530
|
+
defaultValue,
|
|
1531
|
+
onChange,
|
|
1532
|
+
onRemove,
|
|
1533
|
+
onReject,
|
|
1534
|
+
multiple = true,
|
|
1535
|
+
accept,
|
|
1536
|
+
maxSize,
|
|
1537
|
+
maxFiles,
|
|
1538
|
+
disabled = false,
|
|
1539
|
+
hideDropzone = false,
|
|
1540
|
+
disableRemove = false,
|
|
1541
|
+
readOnly = false,
|
|
1542
|
+
label,
|
|
1543
|
+
name,
|
|
1544
|
+
helperText,
|
|
1545
|
+
error = false,
|
|
1546
|
+
required = false,
|
|
1547
|
+
variant = "dropzone",
|
|
1548
|
+
itemVariant = "row",
|
|
1549
|
+
buttonLabel = "Upload file",
|
|
1550
|
+
dropzoneTitle = "Drag & drop files here",
|
|
1551
|
+
dropzoneDescription = "or click to browse",
|
|
1552
|
+
id: idProp,
|
|
1553
|
+
className,
|
|
1554
|
+
sx,
|
|
1555
|
+
"data-testid": dataTestId = "file-upload"
|
|
1556
|
+
} = props;
|
|
1557
|
+
const reactId = (0, import_react3.useId)();
|
|
1558
|
+
const inputId = idProp ?? `file-upload-${reactId}`;
|
|
1559
|
+
const helperId = `${inputId}-helper`;
|
|
1560
|
+
const inputRef = (0, import_react3.useRef)(null);
|
|
1561
|
+
const isControlled = valueProp !== void 0;
|
|
1562
|
+
const [uncontrolled, setUncontrolled] = (0, import_react3.useState)(
|
|
1563
|
+
() => defaultValue ?? []
|
|
1564
|
+
);
|
|
1565
|
+
const items = (0, import_react3.useMemo)(
|
|
1566
|
+
() => isControlled ? valueProp ?? [] : uncontrolled,
|
|
1567
|
+
[isControlled, valueProp, uncontrolled]
|
|
1568
|
+
);
|
|
1569
|
+
const [active, setActive] = (0, import_react3.useState)(false);
|
|
1570
|
+
const dragDepth = (0, import_react3.useRef)(0);
|
|
1571
|
+
const atCapacity = (0, import_react3.useMemo)(() => {
|
|
1572
|
+
if (!multiple) return items.length >= 1;
|
|
1573
|
+
if (maxFiles != null && maxFiles > 0) return items.length >= maxFiles;
|
|
1574
|
+
return false;
|
|
1575
|
+
}, [items.length, maxFiles, multiple]);
|
|
1576
|
+
const commit = (0, import_react3.useCallback)(
|
|
1577
|
+
(next) => {
|
|
1578
|
+
if (!isControlled) setUncontrolled(next);
|
|
1579
|
+
onChange?.(next);
|
|
1580
|
+
},
|
|
1581
|
+
[isControlled, onChange]
|
|
1582
|
+
);
|
|
1583
|
+
const ingest = (0, import_react3.useCallback)(
|
|
1584
|
+
(fileList) => {
|
|
1585
|
+
if (disabled) return;
|
|
1586
|
+
const incoming = Array.from(fileList);
|
|
1587
|
+
if (incoming.length === 0) return;
|
|
1588
|
+
const { accepted, rejections } = validateFiles(incoming, {
|
|
1589
|
+
accept,
|
|
1590
|
+
maxSize,
|
|
1591
|
+
maxFiles,
|
|
1592
|
+
currentCount: items.length,
|
|
1593
|
+
multiple
|
|
1594
|
+
});
|
|
1595
|
+
if (rejections.length > 0) {
|
|
1596
|
+
onReject?.(rejections);
|
|
1597
|
+
}
|
|
1598
|
+
if (accepted.length === 0) return;
|
|
1599
|
+
const nextItems = accepted.map(createFileUploadItem);
|
|
1600
|
+
if (!multiple) {
|
|
1601
|
+
commit(nextItems.slice(0, 1));
|
|
1602
|
+
return;
|
|
1603
|
+
}
|
|
1604
|
+
commit([...items, ...nextItems]);
|
|
1605
|
+
},
|
|
1606
|
+
[
|
|
1607
|
+
accept,
|
|
1608
|
+
disabled,
|
|
1609
|
+
items,
|
|
1610
|
+
maxFiles,
|
|
1611
|
+
maxSize,
|
|
1612
|
+
multiple,
|
|
1613
|
+
onReject,
|
|
1614
|
+
commit
|
|
1615
|
+
]
|
|
1616
|
+
);
|
|
1617
|
+
const handleRemove = (0, import_react3.useCallback)(
|
|
1618
|
+
(item) => {
|
|
1619
|
+
if (disabled) return;
|
|
1620
|
+
const next = items.filter((i) => i.id !== item.id);
|
|
1621
|
+
commit(next);
|
|
1622
|
+
onRemove?.(item, next);
|
|
1623
|
+
if (inputRef.current) inputRef.current.value = "";
|
|
1624
|
+
},
|
|
1625
|
+
[commit, disabled, items, onRemove]
|
|
1626
|
+
);
|
|
1627
|
+
const openPicker = (0, import_react3.useCallback)(() => {
|
|
1628
|
+
if (disabled || atCapacity) return;
|
|
1629
|
+
inputRef.current?.click();
|
|
1630
|
+
}, [atCapacity, disabled]);
|
|
1631
|
+
const onInputChange = (0, import_react3.useCallback)(
|
|
1632
|
+
(e) => {
|
|
1633
|
+
if (e.target.files) ingest(e.target.files);
|
|
1634
|
+
e.target.value = "";
|
|
1635
|
+
},
|
|
1636
|
+
[ingest]
|
|
1637
|
+
);
|
|
1638
|
+
const onDragEnter = (0, import_react3.useCallback)(
|
|
1639
|
+
(e) => {
|
|
1640
|
+
e.preventDefault();
|
|
1641
|
+
e.stopPropagation();
|
|
1642
|
+
if (disabled || atCapacity) return;
|
|
1643
|
+
dragDepth.current += 1;
|
|
1644
|
+
setActive(true);
|
|
1645
|
+
},
|
|
1646
|
+
[atCapacity, disabled]
|
|
1647
|
+
);
|
|
1648
|
+
const onDragLeave = (0, import_react3.useCallback)((e) => {
|
|
1649
|
+
e.preventDefault();
|
|
1650
|
+
e.stopPropagation();
|
|
1651
|
+
dragDepth.current = Math.max(0, dragDepth.current - 1);
|
|
1652
|
+
if (dragDepth.current === 0) setActive(false);
|
|
1653
|
+
}, []);
|
|
1654
|
+
const onDragOver = (0, import_react3.useCallback)((e) => {
|
|
1655
|
+
e.preventDefault();
|
|
1656
|
+
e.stopPropagation();
|
|
1657
|
+
}, []);
|
|
1658
|
+
const onDrop = (0, import_react3.useCallback)(
|
|
1659
|
+
(e) => {
|
|
1660
|
+
e.preventDefault();
|
|
1661
|
+
e.stopPropagation();
|
|
1662
|
+
dragDepth.current = 0;
|
|
1663
|
+
setActive(false);
|
|
1664
|
+
if (disabled || atCapacity) return;
|
|
1665
|
+
if (e.dataTransfer.files?.length) {
|
|
1666
|
+
ingest(e.dataTransfer.files);
|
|
1667
|
+
}
|
|
1668
|
+
},
|
|
1669
|
+
[atCapacity, disabled, ingest]
|
|
1670
|
+
);
|
|
1671
|
+
const queueOnly = readOnly || hideDropzone;
|
|
1672
|
+
const removeDisabled = readOnly || disableRemove || disabled;
|
|
1673
|
+
const showTrigger = !queueOnly && !atCapacity;
|
|
1674
|
+
const isButton = variant === "button";
|
|
1675
|
+
const fileInput = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1676
|
+
"input",
|
|
1677
|
+
{
|
|
1678
|
+
ref: inputRef,
|
|
1679
|
+
id: inputId,
|
|
1680
|
+
name,
|
|
1681
|
+
type: "file",
|
|
1682
|
+
accept,
|
|
1683
|
+
multiple,
|
|
1684
|
+
disabled,
|
|
1685
|
+
onChange: onInputChange,
|
|
1686
|
+
style: { display: "none" },
|
|
1687
|
+
"aria-hidden": true,
|
|
1688
|
+
tabIndex: -1
|
|
1689
|
+
}
|
|
1690
|
+
);
|
|
1691
|
+
const dragHandlers = {
|
|
1692
|
+
onDragEnter,
|
|
1693
|
+
onDragLeave,
|
|
1694
|
+
onDragOver,
|
|
1695
|
+
onDrop
|
|
1696
|
+
};
|
|
1697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1698
|
+
import_Box.default,
|
|
1699
|
+
{
|
|
1700
|
+
ref,
|
|
1701
|
+
className,
|
|
1702
|
+
"data-testid": dataTestId,
|
|
1703
|
+
"data-variant": variant,
|
|
1704
|
+
"data-readonly": readOnly || queueOnly ? "true" : void 0,
|
|
1705
|
+
sx: mergeSx2(fileUploadRootSx, sx),
|
|
1706
|
+
children: [
|
|
1707
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1708
|
+
MuiFormLabel,
|
|
1709
|
+
{
|
|
1710
|
+
htmlFor: showTrigger ? inputId : void 0,
|
|
1711
|
+
required,
|
|
1712
|
+
error,
|
|
1713
|
+
sx: {
|
|
1714
|
+
mb: 0.25,
|
|
1715
|
+
color: error ? "error.main" : "text.secondary",
|
|
1716
|
+
fontSize: "0.8rem",
|
|
1717
|
+
fontWeight: 600
|
|
1718
|
+
},
|
|
1719
|
+
children: label
|
|
1720
|
+
}
|
|
1721
|
+
) : null,
|
|
1722
|
+
fileInput,
|
|
1723
|
+
showTrigger ? isButton ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1724
|
+
Button,
|
|
1725
|
+
{
|
|
1726
|
+
type: "button",
|
|
1727
|
+
disableElevation: true,
|
|
1728
|
+
disabled,
|
|
1729
|
+
"aria-invalid": error || void 0,
|
|
1730
|
+
"aria-describedby": helperText ? helperId : void 0,
|
|
1731
|
+
"data-active": active ? "true" : "false",
|
|
1732
|
+
"data-error": error ? "true" : "false",
|
|
1733
|
+
"data-testid": `${dataTestId}-button`,
|
|
1734
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_CloudUpload.default, { sx: { fontSize: "1.15rem" } }),
|
|
1735
|
+
onClick: openPicker,
|
|
1736
|
+
sx: fileUploadButtonSx,
|
|
1737
|
+
...dragHandlers,
|
|
1738
|
+
children: buttonLabel
|
|
1739
|
+
}
|
|
1740
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1741
|
+
import_Box.default,
|
|
1742
|
+
{
|
|
1743
|
+
role: "button",
|
|
1744
|
+
tabIndex: disabled ? -1 : 0,
|
|
1745
|
+
"aria-disabled": disabled || void 0,
|
|
1746
|
+
"aria-invalid": error || void 0,
|
|
1747
|
+
"aria-describedby": helperText ? helperId : void 0,
|
|
1748
|
+
"data-active": active ? "true" : "false",
|
|
1749
|
+
"data-error": error ? "true" : "false",
|
|
1750
|
+
"data-disabled": disabled ? "true" : "false",
|
|
1751
|
+
"data-testid": `${dataTestId}-dropzone`,
|
|
1752
|
+
sx: fileUploadDropzoneSx,
|
|
1753
|
+
onClick: openPicker,
|
|
1754
|
+
onKeyDown: (e) => {
|
|
1755
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1756
|
+
e.preventDefault();
|
|
1757
|
+
openPicker();
|
|
1758
|
+
}
|
|
1759
|
+
},
|
|
1760
|
+
...dragHandlers,
|
|
1761
|
+
children: [
|
|
1762
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1763
|
+
import_CloudUpload.default,
|
|
1764
|
+
{
|
|
1765
|
+
"aria-hidden": true,
|
|
1766
|
+
sx: { fontSize: 36, color: "var(--fu-icon)", opacity: 0.9 }
|
|
1767
|
+
}
|
|
1768
|
+
),
|
|
1769
|
+
typeof dropzoneTitle === "string" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1770
|
+
import_Typography.default,
|
|
1771
|
+
{
|
|
1772
|
+
variant: "subtitle2",
|
|
1773
|
+
sx: { m: 0, color: "var(--fu-text)", fontWeight: 600 },
|
|
1774
|
+
children: dropzoneTitle
|
|
1775
|
+
}
|
|
1776
|
+
) : dropzoneTitle,
|
|
1777
|
+
dropzoneDescription ? typeof dropzoneDescription === "string" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1778
|
+
import_Typography.default,
|
|
1779
|
+
{
|
|
1780
|
+
variant: "caption",
|
|
1781
|
+
sx: { m: 0, color: "var(--fu-text-secondary)" },
|
|
1782
|
+
children: dropzoneDescription
|
|
1783
|
+
}
|
|
1784
|
+
) : dropzoneDescription : null
|
|
1785
|
+
]
|
|
1786
|
+
}
|
|
1787
|
+
) : null,
|
|
1788
|
+
items.length > 0 ? itemVariant === "tile" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1789
|
+
import_Box.default,
|
|
1790
|
+
{
|
|
1791
|
+
component: "ul",
|
|
1792
|
+
"data-testid": `${dataTestId}-list`,
|
|
1793
|
+
"data-item-variant": "tile",
|
|
1794
|
+
sx: fileUploadTileListSx,
|
|
1795
|
+
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1796
|
+
FileUploadListItem,
|
|
1797
|
+
{
|
|
1798
|
+
item,
|
|
1799
|
+
disabled,
|
|
1800
|
+
disableRemove: removeDisabled,
|
|
1801
|
+
onRemove: handleRemove,
|
|
1802
|
+
testId: `${dataTestId}-item`,
|
|
1803
|
+
itemVariant: "tile"
|
|
1804
|
+
},
|
|
1805
|
+
item.id
|
|
1806
|
+
))
|
|
1807
|
+
}
|
|
1808
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1809
|
+
import_Stack.default,
|
|
1810
|
+
{
|
|
1811
|
+
component: "ul",
|
|
1812
|
+
spacing: 1,
|
|
1813
|
+
"data-testid": `${dataTestId}-list`,
|
|
1814
|
+
"data-item-variant": "row",
|
|
1815
|
+
sx: { m: 0, p: 0, listStyle: "none" },
|
|
1816
|
+
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1817
|
+
FileUploadListItem,
|
|
1818
|
+
{
|
|
1819
|
+
item,
|
|
1820
|
+
disabled,
|
|
1821
|
+
disableRemove: removeDisabled,
|
|
1822
|
+
onRemove: handleRemove,
|
|
1823
|
+
testId: `${dataTestId}-item`,
|
|
1824
|
+
itemVariant: "row"
|
|
1825
|
+
},
|
|
1826
|
+
item.id
|
|
1827
|
+
))
|
|
1828
|
+
}
|
|
1829
|
+
) : null,
|
|
1830
|
+
helperText ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1831
|
+
import_FormHelperText.default,
|
|
1832
|
+
{
|
|
1833
|
+
id: helperId,
|
|
1834
|
+
error,
|
|
1835
|
+
sx: { mx: 0.5, mt: 0 },
|
|
1836
|
+
children: helperText
|
|
1837
|
+
}
|
|
1838
|
+
) : null
|
|
1839
|
+
]
|
|
1840
|
+
}
|
|
1841
|
+
);
|
|
1842
|
+
}
|
|
1843
|
+
);
|
|
1844
|
+
function FileUploadTypeIcon({
|
|
1845
|
+
file,
|
|
1846
|
+
tile = false
|
|
1847
|
+
}) {
|
|
1848
|
+
const resolved = resolveFileIconStyle(
|
|
1849
|
+
file,
|
|
1850
|
+
import_react_file_icon.defaultStyles
|
|
1851
|
+
);
|
|
1852
|
+
const { extension, styleKey } = resolved;
|
|
1853
|
+
const iconStyle = resolved.style;
|
|
1854
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
961
1855
|
import_Box.default,
|
|
962
1856
|
{
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
bgcolor: "transparent",
|
|
971
|
-
borderRadius: 1,
|
|
972
|
-
overflow: "hidden"
|
|
973
|
-
},
|
|
974
|
-
children: isImage && file.blobUrl ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
975
|
-
import_Box.default,
|
|
1857
|
+
"aria-hidden": true,
|
|
1858
|
+
"data-testid": "file-upload-icon",
|
|
1859
|
+
"data-ext": extension || void 0,
|
|
1860
|
+
"data-style-key": styleKey || void 0,
|
|
1861
|
+
sx: tile ? fileUploadTileIconWellSx : fileUploadIconWellSx,
|
|
1862
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_Box.default, { sx: tile ? fileUploadTileLibIconSx : fileUploadLibIconSx, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1863
|
+
import_react_file_icon.FileIcon,
|
|
976
1864
|
{
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
1865
|
+
fold: true,
|
|
1866
|
+
radius: 3,
|
|
1867
|
+
extension,
|
|
1868
|
+
...iconStyle
|
|
981
1869
|
}
|
|
982
|
-
)
|
|
1870
|
+
) })
|
|
983
1871
|
}
|
|
984
1872
|
);
|
|
985
|
-
}
|
|
986
|
-
|
|
1873
|
+
}
|
|
1874
|
+
function FileUploadThumb({
|
|
987
1875
|
file,
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
] }),
|
|
1008
|
-
onDelete && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1009
|
-
IconButton_default,
|
|
1876
|
+
tile = false
|
|
1877
|
+
}) {
|
|
1878
|
+
const [url, setUrl] = (0, import_react3.useState)(null);
|
|
1879
|
+
const [previewFailed, setPreviewFailed] = (0, import_react3.useState)(false);
|
|
1880
|
+
(0, import_react3.useEffect)(() => {
|
|
1881
|
+
setPreviewFailed(false);
|
|
1882
|
+
if (!isImageFile(file)) {
|
|
1883
|
+
setUrl(null);
|
|
1884
|
+
return;
|
|
1885
|
+
}
|
|
1886
|
+
const objectUrl = URL.createObjectURL(file);
|
|
1887
|
+
setUrl(objectUrl);
|
|
1888
|
+
return () => {
|
|
1889
|
+
URL.revokeObjectURL(objectUrl);
|
|
1890
|
+
};
|
|
1891
|
+
}, [file]);
|
|
1892
|
+
if (url && !previewFailed) {
|
|
1893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1894
|
+
import_Box.default,
|
|
1010
1895
|
{
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1896
|
+
component: "img",
|
|
1897
|
+
src: url,
|
|
1898
|
+
alt: "",
|
|
1899
|
+
"data-testid": "file-upload-thumb",
|
|
1900
|
+
sx: tile ? fileUploadTileMediaSx : fileUploadThumbSx,
|
|
1901
|
+
onError: () => setPreviewFailed(true)
|
|
1015
1902
|
}
|
|
1016
|
-
)
|
|
1017
|
-
|
|
1018
|
-
};
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1903
|
+
);
|
|
1904
|
+
}
|
|
1905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(FileUploadTypeIcon, { file, tile });
|
|
1906
|
+
}
|
|
1907
|
+
function FileUploadListItem({
|
|
1908
|
+
item,
|
|
1909
|
+
disabled,
|
|
1910
|
+
disableRemove = false,
|
|
1911
|
+
onRemove,
|
|
1912
|
+
testId,
|
|
1913
|
+
itemVariant
|
|
1914
|
+
}) {
|
|
1915
|
+
if (itemVariant === "tile") {
|
|
1916
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1917
|
+
FileUploadTileItem,
|
|
1918
|
+
{
|
|
1919
|
+
item,
|
|
1920
|
+
disabled,
|
|
1921
|
+
disableRemove,
|
|
1922
|
+
onRemove,
|
|
1923
|
+
testId
|
|
1924
|
+
}
|
|
1925
|
+
);
|
|
1926
|
+
}
|
|
1927
|
+
const status = item.status ?? (item.error ? "error" : "idle");
|
|
1928
|
+
const showProgress = status === "uploading" || typeof item.progress === "number" && item.progress > 0 && item.progress < 100 && status !== "error" && status !== "success";
|
|
1929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1930
|
+
import_Box.default,
|
|
1931
|
+
{
|
|
1932
|
+
component: "li",
|
|
1933
|
+
"data-testid": testId,
|
|
1934
|
+
"data-status": status,
|
|
1935
|
+
"data-item-variant": "row",
|
|
1936
|
+
sx: fileUploadItemSx,
|
|
1937
|
+
children: [
|
|
1938
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(FileUploadThumb, { file: item.file }),
|
|
1939
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_Box.default, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
1940
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1941
|
+
import_Typography.default,
|
|
1942
|
+
{
|
|
1943
|
+
variant: "body2",
|
|
1944
|
+
noWrap: true,
|
|
1945
|
+
title: item.file.name,
|
|
1946
|
+
sx: { m: 0, fontWeight: 500, color: "var(--fu-text)" },
|
|
1947
|
+
children: item.file.name
|
|
1948
|
+
}
|
|
1949
|
+
),
|
|
1950
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1951
|
+
import_Typography.default,
|
|
1952
|
+
{
|
|
1953
|
+
variant: "caption",
|
|
1954
|
+
sx: { m: 0, color: "var(--fu-text-secondary)" },
|
|
1955
|
+
children: [
|
|
1956
|
+
formatFileSize(item.file.size),
|
|
1957
|
+
item.error ? ` \xB7 ${item.error}` : null,
|
|
1958
|
+
status === "success" && !item.error ? " \xB7 Done" : null
|
|
1959
|
+
]
|
|
1960
|
+
}
|
|
1961
|
+
),
|
|
1962
|
+
showProgress ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1963
|
+
LinearProgress,
|
|
1964
|
+
{
|
|
1965
|
+
variant: "determinate",
|
|
1966
|
+
value: Math.max(0, Math.min(100, item.progress ?? 0)),
|
|
1967
|
+
"aria-label": `Upload progress ${item.progress ?? 0}%`,
|
|
1968
|
+
sx: { mt: 0.75, height: 4, borderRadius: 2 }
|
|
1969
|
+
}
|
|
1970
|
+
) : null,
|
|
1971
|
+
status === "uploading" && item.progress == null ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1972
|
+
LinearProgress,
|
|
1973
|
+
{
|
|
1974
|
+
"aria-label": "Uploading",
|
|
1975
|
+
sx: { mt: 0.75, height: 4, borderRadius: 2 }
|
|
1976
|
+
}
|
|
1977
|
+
) : null
|
|
1978
|
+
] }),
|
|
1979
|
+
disableRemove ? null : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1980
|
+
IconButton_default,
|
|
1981
|
+
{
|
|
1982
|
+
size: "small",
|
|
1983
|
+
"aria-label": `Remove ${item.file.name}`,
|
|
1984
|
+
disabled,
|
|
1985
|
+
onClick: () => onRemove(item),
|
|
1986
|
+
sx: {
|
|
1987
|
+
flexShrink: 0,
|
|
1988
|
+
color: "var(--fu-text-secondary)",
|
|
1989
|
+
p: 0.35
|
|
1990
|
+
},
|
|
1991
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_Close.default, { sx: { fontSize: "1rem" } })
|
|
1992
|
+
}
|
|
1993
|
+
)
|
|
1994
|
+
]
|
|
1995
|
+
}
|
|
1996
|
+
);
|
|
1997
|
+
}
|
|
1998
|
+
function FileUploadTileItem({
|
|
1999
|
+
item,
|
|
2000
|
+
disabled,
|
|
2001
|
+
disableRemove = false,
|
|
2002
|
+
onRemove,
|
|
2003
|
+
testId
|
|
2004
|
+
}) {
|
|
2005
|
+
const status = item.status ?? (item.error ? "error" : "idle");
|
|
2006
|
+
const showProgress = status === "uploading" || typeof item.progress === "number" && item.progress > 0 && item.progress < 100 && status !== "error" && status !== "success";
|
|
2007
|
+
const indeterminate = status === "uploading" && item.progress == null;
|
|
2008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2009
|
+
import_Box.default,
|
|
2010
|
+
{
|
|
2011
|
+
component: "li",
|
|
2012
|
+
"data-testid": testId,
|
|
2013
|
+
"data-status": status,
|
|
2014
|
+
"data-item-variant": "tile",
|
|
2015
|
+
title: item.file.name,
|
|
2016
|
+
sx: fileUploadTileSx,
|
|
2017
|
+
children: [
|
|
2018
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(FileUploadThumb, { file: item.file, tile: true }),
|
|
2019
|
+
showProgress ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1037
2020
|
LinearProgress,
|
|
1038
2021
|
{
|
|
1039
2022
|
variant: "determinate",
|
|
1040
|
-
value: progress,
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
height: 6
|
|
1044
|
-
}
|
|
2023
|
+
value: Math.max(0, Math.min(100, item.progress ?? 0)),
|
|
2024
|
+
"aria-label": `Upload progress ${item.progress ?? 0}%`,
|
|
2025
|
+
sx: fileUploadTileProgressSx
|
|
1045
2026
|
}
|
|
1046
|
-
),
|
|
1047
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
2027
|
+
) : null,
|
|
2028
|
+
indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2029
|
+
LinearProgress,
|
|
2030
|
+
{
|
|
2031
|
+
"aria-label": "Uploading",
|
|
2032
|
+
sx: fileUploadTileProgressSx
|
|
2033
|
+
}
|
|
2034
|
+
) : null,
|
|
2035
|
+
disableRemove ? null : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2036
|
+
IconButton_default,
|
|
2037
|
+
{
|
|
2038
|
+
className: "fu-tile-remove",
|
|
2039
|
+
size: "small",
|
|
2040
|
+
"aria-label": `Remove ${item.file.name}`,
|
|
2041
|
+
disabled,
|
|
2042
|
+
onClick: (e) => {
|
|
2043
|
+
e.stopPropagation();
|
|
2044
|
+
onRemove(item);
|
|
2045
|
+
},
|
|
2046
|
+
sx: fileUploadTileRemoveSx,
|
|
2047
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_Close.default, { sx: { fontSize: "0.85rem" } })
|
|
2048
|
+
}
|
|
2049
|
+
)
|
|
2050
|
+
]
|
|
2051
|
+
}
|
|
2052
|
+
);
|
|
2053
|
+
}
|
|
1056
2054
|
|
|
1057
2055
|
// src/components/compound/Process/src/hooks/useProgressTracking.ts
|
|
1058
|
-
var
|
|
2056
|
+
var import_react4 = require("react");
|
|
1059
2057
|
function useProgressTracking(files, observerRef) {
|
|
1060
|
-
const [progressMap, setProgressMap] = (0,
|
|
1061
|
-
const handleProgress = (0,
|
|
2058
|
+
const [progressMap, setProgressMap] = (0, import_react4.useState)(/* @__PURE__ */ new Map());
|
|
2059
|
+
const handleProgress = (0, import_react4.useCallback)((file, progress) => {
|
|
1062
2060
|
setProgressMap((prev) => {
|
|
1063
|
-
if (prev.get(file.
|
|
1064
|
-
const
|
|
1065
|
-
|
|
1066
|
-
return
|
|
2061
|
+
if (prev.get(file.id) === progress) return prev;
|
|
2062
|
+
const next = new Map(prev);
|
|
2063
|
+
next.set(file.id, progress);
|
|
2064
|
+
return next;
|
|
1067
2065
|
});
|
|
1068
2066
|
}, []);
|
|
1069
|
-
(0,
|
|
2067
|
+
(0, import_react4.useEffect)(() => {
|
|
1070
2068
|
if (files.length === 0) return;
|
|
1071
2069
|
let total = 0;
|
|
1072
2070
|
let completed = 0;
|
|
@@ -1077,15 +2075,15 @@ function useProgressTracking(files, observerRef) {
|
|
|
1077
2075
|
const avg = Math.round(total / files.length);
|
|
1078
2076
|
observerRef.current.update(files.length, completed, avg);
|
|
1079
2077
|
}, [progressMap, files, observerRef]);
|
|
1080
|
-
const allComplete = (0,
|
|
2078
|
+
const allComplete = (0, import_react4.useMemo)(() => {
|
|
1081
2079
|
if (files.length === 0) return false;
|
|
1082
|
-
return files.every((f) => (progressMap.get(f.
|
|
2080
|
+
return files.every((f) => (progressMap.get(f.id) || 0) >= 100);
|
|
1083
2081
|
}, [files, progressMap]);
|
|
1084
2082
|
return { progressMap, handleProgress, allComplete };
|
|
1085
2083
|
}
|
|
1086
2084
|
|
|
1087
2085
|
// src/components/compound/Process/src/hooks/useProcessAlert.ts
|
|
1088
|
-
var
|
|
2086
|
+
var import_react6 = __toESM(require("react"));
|
|
1089
2087
|
|
|
1090
2088
|
// src/components/compound/Alert/src/_utils/utils.ts
|
|
1091
2089
|
var import_notistack = require("notistack");
|
|
@@ -1102,6 +2100,8 @@ var ALERT_VARIANTs = {
|
|
|
1102
2100
|
};
|
|
1103
2101
|
var DEFAULTs = {
|
|
1104
2102
|
AUTO_HIDE_DURATION: 3e3,
|
|
2103
|
+
/** Quiet glass toast look is the default snackbar chrome. */
|
|
2104
|
+
STYLE_VARIANT: "soft",
|
|
1105
2105
|
ANCHOR_ORIGIN: { horizontal: "right", vertical: "top" },
|
|
1106
2106
|
PROVIDER_CONFIGs: {
|
|
1107
2107
|
maxSnack: 3,
|
|
@@ -1119,6 +2119,8 @@ function enqueueAlertWith(enqueue, {
|
|
|
1119
2119
|
autoHideDuration = DEFAULTs.AUTO_HIDE_DURATION,
|
|
1120
2120
|
anchorOrigin = DEFAULTs.ANCHOR_ORIGIN,
|
|
1121
2121
|
icon,
|
|
2122
|
+
styleVariant,
|
|
2123
|
+
action,
|
|
1122
2124
|
...rest
|
|
1123
2125
|
}) {
|
|
1124
2126
|
try {
|
|
@@ -1129,6 +2131,8 @@ function enqueueAlertWith(enqueue, {
|
|
|
1129
2131
|
key: id,
|
|
1130
2132
|
id,
|
|
1131
2133
|
icon,
|
|
2134
|
+
styleVariant,
|
|
2135
|
+
alertAction: action,
|
|
1132
2136
|
...rest
|
|
1133
2137
|
});
|
|
1134
2138
|
return { success: true, data: id };
|
|
@@ -1141,20 +2145,20 @@ function enqueueCollapsableWith(enqueue, {
|
|
|
1141
2145
|
id = randomStrGenerator(10),
|
|
1142
2146
|
autoHideDuration = DEFAULTs.AUTO_HIDE_DURATION,
|
|
1143
2147
|
anchorOrigin = DEFAULTs.ANCHOR_ORIGIN,
|
|
2148
|
+
styleVariant,
|
|
1144
2149
|
componentProps = {},
|
|
1145
|
-
componentWrapperProps = {
|
|
1146
|
-
Renderer: () => null
|
|
1147
|
-
},
|
|
2150
|
+
componentWrapperProps = {},
|
|
1148
2151
|
...rest
|
|
1149
2152
|
}) {
|
|
1150
2153
|
try {
|
|
1151
|
-
enqueue({
|
|
2154
|
+
enqueue("", {
|
|
1152
2155
|
variant: ALERT_VARIANTs.collapsable,
|
|
1153
2156
|
anchorOrigin,
|
|
1154
2157
|
autoHideDuration,
|
|
1155
2158
|
componentProps,
|
|
1156
2159
|
componentWrapperProps,
|
|
1157
2160
|
id,
|
|
2161
|
+
styleVariant,
|
|
1158
2162
|
...rest
|
|
1159
2163
|
});
|
|
1160
2164
|
return { success: true, data: id };
|
|
@@ -1187,7 +2191,7 @@ function useAlert() {
|
|
|
1187
2191
|
}
|
|
1188
2192
|
|
|
1189
2193
|
// src/components/compound/Process/src/ProcessAlert.tsx
|
|
1190
|
-
var
|
|
2194
|
+
var import_react5 = require("react");
|
|
1191
2195
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1192
2196
|
var ProcessAlertContent = ({
|
|
1193
2197
|
allComplete,
|
|
@@ -1213,8 +2217,8 @@ var ProcessAlertContent = ({
|
|
|
1213
2217
|
] });
|
|
1214
2218
|
};
|
|
1215
2219
|
var ProcessAlertObserver = ({ observer, onMaximize }) => {
|
|
1216
|
-
const [state, setState] = (0,
|
|
1217
|
-
(0,
|
|
2220
|
+
const [state, setState] = (0, import_react5.useState)({ fileCount: 0, completedCount: 0, totalProgress: 0, minimized: false });
|
|
2221
|
+
(0, import_react5.useEffect)(() => {
|
|
1218
2222
|
return observer.subscribe((newState) => {
|
|
1219
2223
|
setState(newState);
|
|
1220
2224
|
});
|
|
@@ -1269,21 +2273,21 @@ function useProcessAlert({
|
|
|
1269
2273
|
onMaximize
|
|
1270
2274
|
}) {
|
|
1271
2275
|
const { enqueueInfo, closeSnackbar } = useAlert();
|
|
1272
|
-
const observerRef = (0,
|
|
1273
|
-
const snackbarIdRef = (0,
|
|
1274
|
-
const alertAnchorOrigin = (0,
|
|
2276
|
+
const observerRef = (0, import_react6.useRef)(new ProgressObserver());
|
|
2277
|
+
const snackbarIdRef = (0, import_react6.useRef)(null);
|
|
2278
|
+
const alertAnchorOrigin = (0, import_react6.useMemo)(() => ({
|
|
1275
2279
|
"bottom-right": { vertical: "bottom", horizontal: "right" },
|
|
1276
2280
|
"bottom-left": { vertical: "bottom", horizontal: "left" },
|
|
1277
2281
|
"top-right": { vertical: "top", horizontal: "right" },
|
|
1278
2282
|
"top-left": { vertical: "top", horizontal: "left" }
|
|
1279
2283
|
})[minimizePlacement], [minimizePlacement]);
|
|
1280
|
-
(0,
|
|
2284
|
+
(0, import_react6.useEffect)(() => {
|
|
1281
2285
|
observerRef.current.setMinimized(minimized);
|
|
1282
2286
|
}, [minimized]);
|
|
1283
|
-
(0,
|
|
2287
|
+
(0, import_react6.useEffect)(() => {
|
|
1284
2288
|
if (open) {
|
|
1285
2289
|
if (!snackbarIdRef.current) {
|
|
1286
|
-
const message =
|
|
2290
|
+
const message = import_react6.default.createElement(ProcessAlertObserver, {
|
|
1287
2291
|
observer: observerRef.current,
|
|
1288
2292
|
onMaximize
|
|
1289
2293
|
});
|
|
@@ -1303,7 +2307,7 @@ function useProcessAlert({
|
|
|
1303
2307
|
}
|
|
1304
2308
|
}
|
|
1305
2309
|
}, [alertAnchorOrigin, closeSnackbar, enqueueInfo, open, onMaximize]);
|
|
1306
|
-
(0,
|
|
2310
|
+
(0, import_react6.useEffect)(() => {
|
|
1307
2311
|
return () => {
|
|
1308
2312
|
if (snackbarIdRef.current) {
|
|
1309
2313
|
closeSnackbar(snackbarIdRef.current);
|
|
@@ -1318,7 +2322,7 @@ function useProcessAlert({
|
|
|
1318
2322
|
var processModalRootSx = {
|
|
1319
2323
|
"--process-description-color": "var(--mui-palette-text-secondary)",
|
|
1320
2324
|
"--process-item-secondary-color": "var(--mui-palette-text-secondary)",
|
|
1321
|
-
"--process-item-border": "var(--mui-palette-
|
|
2325
|
+
"--process-item-border": "var(--mui-palette-border-1)"
|
|
1322
2326
|
};
|
|
1323
2327
|
|
|
1324
2328
|
// src/components/compound/Process/src/ProcessModal.tsx
|
|
@@ -1331,7 +2335,7 @@ var ProcessLogicRunner = ({
|
|
|
1331
2335
|
paused
|
|
1332
2336
|
}) => {
|
|
1333
2337
|
const progress = useProgress(file, paused);
|
|
1334
|
-
(0,
|
|
2338
|
+
(0, import_react7.useEffect)(() => {
|
|
1335
2339
|
onProgress(file, progress);
|
|
1336
2340
|
}, [file, progress, onProgress]);
|
|
1337
2341
|
return null;
|
|
@@ -1346,20 +2350,36 @@ var ProcessModal = ({
|
|
|
1346
2350
|
onStop,
|
|
1347
2351
|
minimizable = false,
|
|
1348
2352
|
minimizePlacement = "bottom-right",
|
|
1349
|
-
autoClose = false
|
|
2353
|
+
autoClose = false,
|
|
2354
|
+
itemVariant = "row"
|
|
1350
2355
|
}) => {
|
|
1351
2356
|
const [open, setOpen] = openProps;
|
|
1352
|
-
const [minimized, setMinimized] = (0,
|
|
1353
|
-
const [paused, setPaused] = (0,
|
|
1354
|
-
const handleMaximize = (0,
|
|
2357
|
+
const [minimized, setMinimized] = (0, import_react7.useState)(false);
|
|
2358
|
+
const [paused, setPaused] = (0, import_react7.useState)(false);
|
|
2359
|
+
const handleMaximize = (0, import_react7.useCallback)(() => setMinimized(false), []);
|
|
1355
2360
|
const { observerRef } = useProcessAlert({
|
|
1356
2361
|
open,
|
|
1357
2362
|
minimized,
|
|
1358
2363
|
minimizePlacement,
|
|
1359
2364
|
onMaximize: handleMaximize
|
|
1360
2365
|
});
|
|
1361
|
-
const { progressMap, handleProgress, allComplete } = useProgressTracking(
|
|
1362
|
-
|
|
2366
|
+
const { progressMap, handleProgress, allComplete } = useProgressTracking(
|
|
2367
|
+
files,
|
|
2368
|
+
observerRef
|
|
2369
|
+
);
|
|
2370
|
+
const queueValue = (0, import_react7.useMemo)(
|
|
2371
|
+
() => files.map((file) => {
|
|
2372
|
+
const progress = progressMap.get(file.id) ?? 0;
|
|
2373
|
+
const clamped = Math.max(0, Math.min(100, progress));
|
|
2374
|
+
return {
|
|
2375
|
+
...file,
|
|
2376
|
+
progress: clamped,
|
|
2377
|
+
status: clamped >= 100 ? "success" : "uploading"
|
|
2378
|
+
};
|
|
2379
|
+
}),
|
|
2380
|
+
[files, progressMap]
|
|
2381
|
+
);
|
|
2382
|
+
(0, import_react7.useEffect)(() => {
|
|
1363
2383
|
if (autoClose && allComplete && open) {
|
|
1364
2384
|
const timer = setTimeout(() => {
|
|
1365
2385
|
setOpen(false);
|
|
@@ -1385,7 +2405,7 @@ var ProcessModal = ({
|
|
|
1385
2405
|
onProgress: handleProgress,
|
|
1386
2406
|
paused
|
|
1387
2407
|
},
|
|
1388
|
-
file.
|
|
2408
|
+
file.id
|
|
1389
2409
|
)),
|
|
1390
2410
|
minimized ? null : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1391
2411
|
MuiModal,
|
|
@@ -1403,55 +2423,107 @@ var ProcessModal = ({
|
|
|
1403
2423
|
} : void 0
|
|
1404
2424
|
},
|
|
1405
2425
|
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_Box.default, { sx: mergeSx({ py: 2 }, processModalRootSx), children: [
|
|
1406
|
-
description
|
|
1407
|
-
|
|
1408
|
-
ProcessItem,
|
|
2426
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2427
|
+
import_Typography.default,
|
|
1409
2428
|
{
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
)
|
|
1415
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
children: "Stop"
|
|
1425
|
-
}
|
|
1426
|
-
),
|
|
1427
|
-
onPause && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1428
|
-
Button,
|
|
2429
|
+
variant: "body2",
|
|
2430
|
+
sx: { mb: 3, color: "var(--process-description-color)" },
|
|
2431
|
+
children: description
|
|
2432
|
+
}
|
|
2433
|
+
) : null,
|
|
2434
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2435
|
+
import_Box.default,
|
|
2436
|
+
{
|
|
2437
|
+
sx: {
|
|
2438
|
+
maxHeight: "60vh",
|
|
2439
|
+
overflowY: "auto"
|
|
2440
|
+
},
|
|
2441
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2442
|
+
FileUpload,
|
|
1429
2443
|
{
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
2444
|
+
value: queueValue,
|
|
2445
|
+
readOnly: true,
|
|
2446
|
+
hideDropzone: true,
|
|
2447
|
+
disableRemove: true,
|
|
2448
|
+
itemVariant,
|
|
2449
|
+
"data-testid": "process-file-queue"
|
|
1435
2450
|
}
|
|
1436
2451
|
)
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
2452
|
+
}
|
|
2453
|
+
),
|
|
2454
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2455
|
+
import_Box.default,
|
|
2456
|
+
{
|
|
2457
|
+
sx: { mt: 3, display: "flex", justifyContent: "flex-end", gap: 2 },
|
|
2458
|
+
children: [
|
|
2459
|
+
!allComplete ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
2460
|
+
onStop ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2461
|
+
Button,
|
|
2462
|
+
{
|
|
2463
|
+
variant: "outlined",
|
|
2464
|
+
color: "error",
|
|
2465
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_StopRounded.default, {}),
|
|
2466
|
+
onClick: handleStop,
|
|
2467
|
+
children: "Stop"
|
|
2468
|
+
}
|
|
2469
|
+
) : null,
|
|
2470
|
+
onPause ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2471
|
+
Button,
|
|
2472
|
+
{
|
|
2473
|
+
variant: "outlined",
|
|
2474
|
+
color: "warning",
|
|
2475
|
+
startIcon: paused ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_PlayArrow.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_PauseOutlined.default, {}),
|
|
2476
|
+
onClick: handlePauseToggle,
|
|
2477
|
+
children: paused ? "Resume" : "Pause"
|
|
2478
|
+
}
|
|
2479
|
+
) : null
|
|
2480
|
+
] }) : null,
|
|
2481
|
+
allComplete ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2482
|
+
Button,
|
|
2483
|
+
{
|
|
2484
|
+
variant: "contained",
|
|
2485
|
+
onClick: () => setOpen(false),
|
|
2486
|
+
disabled: !allComplete && !onStop,
|
|
2487
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_CheckCircle.default, {}),
|
|
2488
|
+
color: "success",
|
|
2489
|
+
children: "Done"
|
|
2490
|
+
}
|
|
2491
|
+
) : null
|
|
2492
|
+
]
|
|
2493
|
+
}
|
|
2494
|
+
)
|
|
1450
2495
|
] })
|
|
1451
2496
|
}
|
|
1452
2497
|
)
|
|
1453
2498
|
] });
|
|
1454
2499
|
};
|
|
2500
|
+
|
|
2501
|
+
// src/components/compound/Process/src/ProcessItem.tsx
|
|
2502
|
+
var import_react8 = require("react");
|
|
2503
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2504
|
+
var ProcessItem = ({ file, progress }) => {
|
|
2505
|
+
const value = (0, import_react8.useMemo)(() => {
|
|
2506
|
+
const clamped = Math.max(0, Math.min(100, progress));
|
|
2507
|
+
return [
|
|
2508
|
+
{
|
|
2509
|
+
...file,
|
|
2510
|
+
progress: clamped,
|
|
2511
|
+
status: clamped >= 100 ? "success" : "uploading"
|
|
2512
|
+
}
|
|
2513
|
+
];
|
|
2514
|
+
}, [file, progress]);
|
|
2515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2516
|
+
FileUpload,
|
|
2517
|
+
{
|
|
2518
|
+
value,
|
|
2519
|
+
readOnly: true,
|
|
2520
|
+
hideDropzone: true,
|
|
2521
|
+
disableRemove: true,
|
|
2522
|
+
itemVariant: "row",
|
|
2523
|
+
"data-testid": "process-item"
|
|
2524
|
+
}
|
|
2525
|
+
);
|
|
2526
|
+
};
|
|
1455
2527
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1456
2528
|
0 && (module.exports = {
|
|
1457
2529
|
ProcessAlertContent,
|