@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.
Files changed (254) hide show
  1. package/dist/AutocompleteField-653233JU.mjs +203 -0
  2. package/dist/AutocompleteField-653233JU.mjs.map +1 -0
  3. package/dist/AvatarField-KFASMVZU.mjs +378 -0
  4. package/dist/AvatarField-KFASMVZU.mjs.map +1 -0
  5. package/dist/{DateField-ZYMZFHL4.mjs → DateField-CDJ6W6XF.mjs} +19 -7
  6. package/dist/DateField-CDJ6W6XF.mjs.map +1 -0
  7. package/dist/DateRangeField-ZWSFT5KV.mjs +118 -0
  8. package/dist/DateRangeField-ZWSFT5KV.mjs.map +1 -0
  9. package/dist/{DateTimeField-TPTJ7YIZ.mjs → DateTimeField-SFAF4I6A.mjs} +36 -11
  10. package/dist/DateTimeField-SFAF4I6A.mjs.map +1 -0
  11. package/dist/FileUploadField-TSNCSLXX.mjs +101 -0
  12. package/dist/FileUploadField-TSNCSLXX.mjs.map +1 -0
  13. package/dist/{JSONEditorField-TMRWGXVR.mjs → JSONEditorField-3KXC2GOG.mjs} +7 -6
  14. package/dist/{JSONEditorField-TMRWGXVR.mjs.map → JSONEditorField-3KXC2GOG.mjs.map} +1 -1
  15. package/dist/{PopperMenu-LJ36RPBW.mjs → PopperMenu-PSHLKIEZ.mjs} +26 -12
  16. package/dist/{PopperMenu-LJ36RPBW.mjs.map → PopperMenu-PSHLKIEZ.mjs.map} +1 -1
  17. package/dist/{TelField-LOGRVZ4I.mjs → TelField-FRQT2UBJ.mjs} +8 -7
  18. package/dist/{TelField-LOGRVZ4I.mjs.map → TelField-FRQT2UBJ.mjs.map} +1 -1
  19. package/dist/TimeField-XVWXBJID.mjs +94 -0
  20. package/dist/TimeField-XVWXBJID.mjs.map +1 -0
  21. package/dist/alert.d.mts +148 -18
  22. package/dist/alert.d.ts +148 -18
  23. package/dist/alert.js +698 -254
  24. package/dist/alert.js.map +1 -1
  25. package/dist/alert.mjs +46 -10
  26. package/dist/autocomplete.d.mts +438 -4
  27. package/dist/autocomplete.d.ts +438 -4
  28. package/dist/autocomplete.js +632 -21
  29. package/dist/autocomplete.js.map +1 -1
  30. package/dist/autocomplete.mjs +26 -7
  31. package/dist/avatar.js +2 -1
  32. package/dist/avatar.js.map +1 -1
  33. package/dist/avatar.mjs +12 -11
  34. package/dist/box.mjs +2 -1
  35. package/dist/button.mjs +3 -2
  36. package/dist/chart.mjs +3 -2
  37. package/dist/checkbox.mjs +3 -2
  38. package/dist/chunk-2FK24ZPJ.mjs +78 -0
  39. package/dist/chunk-2FK24ZPJ.mjs.map +1 -0
  40. package/dist/{chunk-V26V2S3W.mjs → chunk-3O3N6X6D.mjs} +3 -3
  41. package/dist/{chunk-Y74ALKBL.mjs → chunk-4MSPA7U7.mjs} +11 -9
  42. package/dist/{chunk-Y74ALKBL.mjs.map → chunk-4MSPA7U7.mjs.map} +1 -1
  43. package/dist/{chunk-24XDGNJ6.mjs → chunk-4P45Z5LR.mjs} +63 -41
  44. package/dist/chunk-4P45Z5LR.mjs.map +1 -0
  45. package/dist/chunk-4SSJY32J.mjs +1182 -0
  46. package/dist/chunk-4SSJY32J.mjs.map +1 -0
  47. package/dist/{chunk-XJ2SXC2Q.mjs → chunk-6B6I27TT.mjs} +18 -16
  48. package/dist/{chunk-XJ2SXC2Q.mjs.map → chunk-6B6I27TT.mjs.map} +1 -1
  49. package/dist/chunk-6JKMEH2L.mjs +205 -0
  50. package/dist/chunk-6JKMEH2L.mjs.map +1 -0
  51. package/dist/{chunk-IN3O4R7Q.mjs → chunk-7O526A2D.mjs} +6 -4
  52. package/dist/{chunk-IN3O4R7Q.mjs.map → chunk-7O526A2D.mjs.map} +1 -1
  53. package/dist/chunk-AFLEG5ZC.mjs +28 -0
  54. package/dist/chunk-AFLEG5ZC.mjs.map +1 -0
  55. package/dist/{chunk-UGMRJMFZ.mjs → chunk-BO5CU4ZM.mjs} +4 -4
  56. package/dist/{chunk-JIU5GVM7.mjs → chunk-D4XPNSSI.mjs} +5 -3
  57. package/dist/{chunk-JIU5GVM7.mjs.map → chunk-D4XPNSSI.mjs.map} +1 -1
  58. package/dist/chunk-DPIMA5IO.mjs +72 -0
  59. package/dist/chunk-DPIMA5IO.mjs.map +1 -0
  60. package/dist/chunk-F2CGFVIZ.mjs +83 -0
  61. package/dist/chunk-F2CGFVIZ.mjs.map +1 -0
  62. package/dist/{chunk-R5MKQN6D.mjs → chunk-FBLSJQWK.mjs} +3 -3
  63. package/dist/{chunk-BGB7JHIU.mjs → chunk-FMGZCOJC.mjs} +5 -3
  64. package/dist/{chunk-BGB7JHIU.mjs.map → chunk-FMGZCOJC.mjs.map} +1 -1
  65. package/dist/{chunk-UTVSYS6S.mjs → chunk-FNSIQ2B7.mjs} +18 -6
  66. package/dist/chunk-FNSIQ2B7.mjs.map +1 -0
  67. package/dist/{chunk-JWANK42G.mjs → chunk-FUZ2JNTZ.mjs} +3 -3
  68. package/dist/{chunk-CRYIEYZZ.mjs → chunk-HAJWE62X.mjs} +66 -42
  69. package/dist/chunk-HAJWE62X.mjs.map +1 -0
  70. package/dist/{chunk-CWFWRZWU.mjs → chunk-KSN33A6I.mjs} +3 -2
  71. package/dist/{chunk-CWFWRZWU.mjs.map → chunk-KSN33A6I.mjs.map} +1 -1
  72. package/dist/chunk-KYTHGFFY.mjs +866 -0
  73. package/dist/chunk-KYTHGFFY.mjs.map +1 -0
  74. package/dist/{chunk-QKGCW37O.mjs → chunk-LDFM46LV.mjs} +5 -3
  75. package/dist/{chunk-QKGCW37O.mjs.map → chunk-LDFM46LV.mjs.map} +1 -1
  76. package/dist/chunk-LQNDBPHU.mjs +142 -0
  77. package/dist/chunk-LQNDBPHU.mjs.map +1 -0
  78. package/dist/{chunk-E3I2VDHZ.mjs → chunk-M2PYXSAF.mjs} +6 -4
  79. package/dist/{chunk-E3I2VDHZ.mjs.map → chunk-M2PYXSAF.mjs.map} +1 -1
  80. package/dist/{chunk-DELCADNF.mjs → chunk-ODVKRIVN.mjs} +30 -30
  81. package/dist/{chunk-HR3A4H4E.mjs → chunk-PEJL2T2K.mjs} +13 -11
  82. package/dist/{chunk-HR3A4H4E.mjs.map → chunk-PEJL2T2K.mjs.map} +1 -1
  83. package/dist/{chunk-OGNGPI3M.mjs → chunk-PL55YKT4.mjs} +2 -2
  84. package/dist/{chunk-S6EZVRZC.mjs → chunk-PNSJC6PC.mjs} +5 -28
  85. package/dist/chunk-PNSJC6PC.mjs.map +1 -0
  86. package/dist/{chunk-TDRA5EZI.mjs → chunk-PUREEN2J.mjs} +7 -7
  87. package/dist/chunk-QFS5CENY.mjs +659 -0
  88. package/dist/chunk-QFS5CENY.mjs.map +1 -0
  89. package/dist/chunk-RSN7NH2J.mjs +250 -0
  90. package/dist/chunk-RSN7NH2J.mjs.map +1 -0
  91. package/dist/{chunk-UDREPVEY.mjs → chunk-RVSMEZE3.mjs} +12 -78
  92. package/dist/chunk-RVSMEZE3.mjs.map +1 -0
  93. package/dist/{chunk-SRWPHN2N.mjs → chunk-S64IYJ6Y.mjs} +2 -2
  94. package/dist/{chunk-ZG3NQI77.mjs → chunk-SMD7OEUW.mjs} +6 -4
  95. package/dist/{chunk-ZG3NQI77.mjs.map → chunk-SMD7OEUW.mjs.map} +1 -1
  96. package/dist/{chunk-NJYNJLT7.mjs → chunk-SWFB3A3G.mjs} +2 -2
  97. package/dist/{chunk-RXBQ7KXF.mjs → chunk-USXGNKWJ.mjs} +98 -44
  98. package/dist/chunk-USXGNKWJ.mjs.map +1 -0
  99. package/dist/{chunk-OJV6V7YZ.mjs → chunk-VL7V52YD.mjs} +27 -20
  100. package/dist/chunk-VL7V52YD.mjs.map +1 -0
  101. package/dist/{chunk-2ZZJTBTE.mjs → chunk-WJZ3IYET.mjs} +2 -2
  102. package/dist/chunk-XAJAMVAG.mjs +1720 -0
  103. package/dist/chunk-XAJAMVAG.mjs.map +1 -0
  104. package/dist/chunk-YIJ5QVJ6.mjs +277 -0
  105. package/dist/chunk-YIJ5QVJ6.mjs.map +1 -0
  106. package/dist/{chunk-T6AMRENK.mjs → chunk-YRW5NKD7.mjs} +148 -112
  107. package/dist/chunk-YRW5NKD7.mjs.map +1 -0
  108. package/dist/chunk-ZMJKG2UI.mjs +71 -0
  109. package/dist/chunk-ZMJKG2UI.mjs.map +1 -0
  110. package/dist/confirm.d.mts +48 -0
  111. package/dist/confirm.d.ts +48 -0
  112. package/dist/confirm.js +334 -0
  113. package/dist/confirm.js.map +1 -0
  114. package/dist/confirm.mjs +20 -0
  115. package/dist/datePicker.d.mts +256 -14
  116. package/dist/datePicker.d.ts +256 -14
  117. package/dist/datePicker.js +1624 -145
  118. package/dist/datePicker.js.map +1 -1
  119. package/dist/datePicker.mjs +19 -6
  120. package/dist/dialog.d.mts +166 -0
  121. package/dist/dialog.d.ts +166 -0
  122. package/dist/dialog.js +362 -0
  123. package/dist/dialog.js.map +1 -0
  124. package/dist/dialog.mjs +45 -0
  125. package/dist/emptyState.d.mts +17 -0
  126. package/dist/emptyState.d.ts +17 -0
  127. package/dist/emptyState.js +253 -0
  128. package/dist/emptyState.js.map +1 -0
  129. package/dist/emptyState.mjs +12 -0
  130. package/dist/emptyState.mjs.map +1 -0
  131. package/dist/errorState.d.mts +18 -0
  132. package/dist/errorState.d.ts +18 -0
  133. package/dist/{displayFile.js → errorState.js} +107 -156
  134. package/dist/errorState.js.map +1 -0
  135. package/dist/errorState.mjs +15 -0
  136. package/dist/errorState.mjs.map +1 -0
  137. package/dist/fileUpload.d.mts +197 -0
  138. package/dist/fileUpload.d.ts +197 -0
  139. package/dist/fileUpload.js +1483 -0
  140. package/dist/fileUpload.js.map +1 -0
  141. package/dist/fileUpload.mjs +65 -0
  142. package/dist/fileUpload.mjs.map +1 -0
  143. package/dist/flowMap.mjs +7 -6
  144. package/dist/flowMap.mjs.map +1 -1
  145. package/dist/image.js +1195 -429
  146. package/dist/image.js.map +1 -1
  147. package/dist/image.mjs +8 -6
  148. package/dist/index.d.ts +7 -2
  149. package/dist/index.js +8606 -4087
  150. package/dist/index.js.map +1 -1
  151. package/dist/index.mjs +314 -152
  152. package/dist/inlineError.d.mts +16 -0
  153. package/dist/inlineError.d.ts +16 -0
  154. package/dist/inlineError.js +297 -0
  155. package/dist/inlineError.js.map +1 -0
  156. package/dist/inlineError.mjs +15 -0
  157. package/dist/inlineError.mjs.map +1 -0
  158. package/dist/input.mjs +8 -7
  159. package/dist/jsonEditor.mjs +3 -2
  160. package/dist/list.mjs +7 -6
  161. package/dist/loading.mjs +8 -6
  162. package/dist/markdown.mjs +7 -6
  163. package/dist/markdown.mjs.map +1 -1
  164. package/dist/menu.mjs +9 -8
  165. package/dist/modal.js +2 -1
  166. package/dist/modal.js.map +1 -1
  167. package/dist/modal.mjs +7 -5
  168. package/dist/process.d.mts +33 -75
  169. package/dist/process.d.ts +33 -75
  170. package/dist/process.js +1275 -203
  171. package/dist/process.js.map +1 -1
  172. package/dist/process.mjs +12 -9
  173. package/dist/scrollToLoad.mjs +4 -3
  174. package/dist/select.mjs +10 -9
  175. package/dist/skeleton.d.mts +15 -1
  176. package/dist/skeleton.d.ts +15 -1
  177. package/dist/skeleton.js +114 -2
  178. package/dist/skeleton.js.map +1 -1
  179. package/dist/skeleton.mjs +6 -3
  180. package/dist/stepper.mjs +4 -3
  181. package/dist/tab.mjs +10 -9
  182. package/dist/table.d.mts +269 -85
  183. package/dist/table.d.ts +269 -85
  184. package/dist/table.js +5102 -3153
  185. package/dist/table.js.map +1 -1
  186. package/dist/table.mjs +21 -19
  187. package/dist/theme.js +1766 -432
  188. package/dist/theme.js.map +1 -1
  189. package/dist/theme.mjs +32 -25
  190. package/dist/timeline.mjs +4 -3
  191. package/dist/toast.d.mts +49 -0
  192. package/dist/toast.d.ts +49 -0
  193. package/dist/toast.js +175 -0
  194. package/dist/toast.js.map +1 -0
  195. package/dist/toast.mjs +9 -0
  196. package/dist/toast.mjs.map +1 -0
  197. package/dist/toggleButtonGroup.mjs +3 -2
  198. package/dist/useForm.d.mts +270 -86
  199. package/dist/useForm.d.ts +270 -86
  200. package/dist/useForm.js +4672 -2727
  201. package/dist/useForm.js.map +1 -1
  202. package/dist/useForm.mjs +18 -16
  203. package/dist/useSearch.mjs +13 -12
  204. package/dist/variablesRenderer.mjs +8 -7
  205. package/package.json +3 -3
  206. package/dist/AutocompleteField-ZKNU2IRR.mjs +0 -181
  207. package/dist/AutocompleteField-ZKNU2IRR.mjs.map +0 -1
  208. package/dist/AvatarField-SAODT3CZ.mjs +0 -275
  209. package/dist/AvatarField-SAODT3CZ.mjs.map +0 -1
  210. package/dist/DateField-ZYMZFHL4.mjs.map +0 -1
  211. package/dist/DateTimeField-TPTJ7YIZ.mjs.map +0 -1
  212. package/dist/FileUploadField-NTMWBJER.mjs +0 -78
  213. package/dist/FileUploadField-NTMWBJER.mjs.map +0 -1
  214. package/dist/chunk-24XDGNJ6.mjs.map +0 -1
  215. package/dist/chunk-27KYFU7R.mjs +0 -30
  216. package/dist/chunk-27KYFU7R.mjs.map +0 -1
  217. package/dist/chunk-AAH2O24U.mjs +0 -325
  218. package/dist/chunk-AAH2O24U.mjs.map +0 -1
  219. package/dist/chunk-CRYIEYZZ.mjs.map +0 -1
  220. package/dist/chunk-EEH7HACG.mjs +0 -249
  221. package/dist/chunk-EEH7HACG.mjs.map +0 -1
  222. package/dist/chunk-EKPULYPU.mjs +0 -497
  223. package/dist/chunk-EKPULYPU.mjs.map +0 -1
  224. package/dist/chunk-OJV6V7YZ.mjs.map +0 -1
  225. package/dist/chunk-RXBQ7KXF.mjs.map +0 -1
  226. package/dist/chunk-S6EZVRZC.mjs.map +0 -1
  227. package/dist/chunk-SGCUDWO3.mjs +0 -396
  228. package/dist/chunk-SGCUDWO3.mjs.map +0 -1
  229. package/dist/chunk-T6AMRENK.mjs.map +0 -1
  230. package/dist/chunk-UDREPVEY.mjs.map +0 -1
  231. package/dist/chunk-UTVSYS6S.mjs.map +0 -1
  232. package/dist/chunk-XIMFP6RB.mjs +0 -161
  233. package/dist/chunk-XIMFP6RB.mjs.map +0 -1
  234. package/dist/displayFile.d.mts +0 -95
  235. package/dist/displayFile.d.ts +0 -95
  236. package/dist/displayFile.js.map +0 -1
  237. package/dist/displayFile.mjs +0 -19
  238. package/dist/fileUploader.d.mts +0 -86
  239. package/dist/fileUploader.d.ts +0 -86
  240. package/dist/fileUploader.js +0 -722
  241. package/dist/fileUploader.js.map +0 -1
  242. package/dist/fileUploader.mjs +0 -16
  243. /package/dist/{chunk-V26V2S3W.mjs.map → chunk-3O3N6X6D.mjs.map} +0 -0
  244. /package/dist/{chunk-UGMRJMFZ.mjs.map → chunk-BO5CU4ZM.mjs.map} +0 -0
  245. /package/dist/{chunk-R5MKQN6D.mjs.map → chunk-FBLSJQWK.mjs.map} +0 -0
  246. /package/dist/{chunk-JWANK42G.mjs.map → chunk-FUZ2JNTZ.mjs.map} +0 -0
  247. /package/dist/{chunk-DELCADNF.mjs.map → chunk-ODVKRIVN.mjs.map} +0 -0
  248. /package/dist/{chunk-OGNGPI3M.mjs.map → chunk-PL55YKT4.mjs.map} +0 -0
  249. /package/dist/{chunk-TDRA5EZI.mjs.map → chunk-PUREEN2J.mjs.map} +0 -0
  250. /package/dist/{chunk-SRWPHN2N.mjs.map → chunk-S64IYJ6Y.mjs.map} +0 -0
  251. /package/dist/{chunk-NJYNJLT7.mjs.map → chunk-SWFB3A3G.mjs.map} +0 -0
  252. /package/dist/{chunk-2ZZJTBTE.mjs.map → chunk-WJZ3IYET.mjs.map} +0 -0
  253. /package/dist/{displayFile.mjs.map → confirm.mjs.map} +0 -0
  254. /package/dist/{fileUploader.mjs.map → dialog.mjs.map} +0 -0
@@ -0,0 +1,1182 @@
1
+ import {
2
+ MuiFormLabel,
3
+ default2 as default7
4
+ } from "./chunk-T4X375IG.mjs";
5
+ import {
6
+ LinearProgress
7
+ } from "./chunk-WYYP3Y34.mjs";
8
+ import {
9
+ default54 as default5,
10
+ default90 as default6
11
+ } from "./chunk-ZVFYOXDE.mjs";
12
+ import {
13
+ Button,
14
+ IconButton_default
15
+ } from "./chunk-D4XPNSSI.mjs";
16
+ import {
17
+ default as default4
18
+ } from "./chunk-4RPFRNXG.mjs";
19
+ import {
20
+ default as default2,
21
+ default2 as default3
22
+ } from "./chunk-PNSJC6PC.mjs";
23
+
24
+ // src/components/elemental/FileUpload/src/FileUpload.tsx
25
+ import {
26
+ forwardRef,
27
+ useCallback,
28
+ useEffect,
29
+ useId,
30
+ useMemo,
31
+ useRef,
32
+ useState
33
+ } from "react";
34
+ import { FileIcon, defaultStyles } from "react-file-icon";
35
+
36
+ // src/components/elemental/FileUpload/src/theme.ts
37
+ var fileUploadRootSx = {
38
+ "--fu-border": "var(--mui-palette-border-1)",
39
+ "--fu-border-hover": "var(--mui-palette-border-hover-1, var(--mui-palette-text-secondary))",
40
+ "--fu-border-active": "color-mix(in srgb, var(--mui-palette-text-secondary) 65%, transparent)",
41
+ "--fu-border-error": "var(--mui-palette-error-main)",
42
+ "--fu-surface": "color-mix(in srgb, var(--mui-palette-background-paper) 78%, transparent)",
43
+ "--fu-surface-hover": "color-mix(in srgb, var(--mui-palette-background-paper) 92%, transparent)",
44
+ "--fu-surface-active": "color-mix(in srgb, var(--mui-palette-primary-main) 8%, var(--mui-palette-background-paper))",
45
+ "--fu-item-bg": "color-mix(in srgb, var(--mui-palette-background-paper) 88%, transparent)",
46
+ "--fu-icon": "var(--mui-palette-text-secondary)",
47
+ "--fu-text": "var(--mui-palette-text-primary)",
48
+ "--fu-text-secondary": "var(--mui-palette-text-secondary)",
49
+ "--fu-shadow": "inset 0 1px 0 color-mix(in srgb, var(--mui-palette-common-white) 6%, transparent)",
50
+ "--fu-radius": "16px",
51
+ "--fu-item-radius": "12px",
52
+ display: "flex",
53
+ flexDirection: "column",
54
+ gap: 1,
55
+ width: "100%",
56
+ boxSizing: "border-box",
57
+ '[color-scheme="dark"] &': {
58
+ "--fu-surface": "color-mix(in srgb, var(--mui-palette-background-paper) 70%, transparent)",
59
+ "--fu-surface-hover": "color-mix(in srgb, var(--mui-palette-background-paper) 88%, transparent)",
60
+ "--fu-item-bg": "color-mix(in srgb, var(--mui-palette-background-paper) 82%, transparent)",
61
+ "--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)"
62
+ }
63
+ };
64
+ var fileUploadDropzoneSx = {
65
+ display: "flex",
66
+ flexDirection: "column",
67
+ alignItems: "center",
68
+ justifyContent: "center",
69
+ textAlign: "center",
70
+ gap: 0.75,
71
+ px: 3,
72
+ py: 3.5,
73
+ minHeight: 140,
74
+ borderRadius: "var(--fu-radius)",
75
+ border: "1px dashed var(--fu-drop-border, var(--fu-border))",
76
+ backgroundColor: "var(--fu-drop-bg, var(--fu-surface))",
77
+ boxShadow: "var(--fu-shadow)",
78
+ color: "var(--fu-text-secondary)",
79
+ cursor: "pointer",
80
+ outline: "none",
81
+ boxSizing: "border-box",
82
+ transition: "border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease",
83
+ "&:hover": {
84
+ borderColor: "var(--fu-border-hover)",
85
+ backgroundColor: "var(--fu-surface-hover)"
86
+ },
87
+ "&:focus-visible": {
88
+ borderColor: "var(--fu-border-active)",
89
+ borderStyle: "solid"
90
+ },
91
+ '&[data-active="true"]': {
92
+ borderColor: "var(--fu-border-active)",
93
+ borderStyle: "solid",
94
+ backgroundColor: "var(--fu-surface-active)"
95
+ },
96
+ '&[data-error="true"]': {
97
+ "--fu-drop-border": "var(--fu-border-error)"
98
+ },
99
+ '&[data-disabled="true"]': {
100
+ opacity: 0.58,
101
+ cursor: "default",
102
+ pointerEvents: "none"
103
+ }
104
+ };
105
+ var fileUploadItemSx = {
106
+ display: "flex",
107
+ alignItems: "center",
108
+ gap: 1.25,
109
+ px: 1.25,
110
+ py: 1,
111
+ borderRadius: "var(--fu-item-radius)",
112
+ border: "1px solid var(--fu-border)",
113
+ backgroundColor: "var(--fu-item-bg)",
114
+ boxShadow: "var(--fu-shadow)",
115
+ boxSizing: "border-box",
116
+ minWidth: 0,
117
+ '&[data-status="error"]': {
118
+ borderColor: "color-mix(in srgb, var(--mui-palette-error-main) 55%, var(--fu-border))",
119
+ backgroundColor: "color-mix(in srgb, var(--mui-palette-error-main) 8%, var(--fu-item-bg))"
120
+ }
121
+ };
122
+ var fileUploadThumbSx = {
123
+ width: 36,
124
+ height: 36,
125
+ minWidth: 36,
126
+ borderRadius: "8px",
127
+ objectFit: "cover",
128
+ flexShrink: 0,
129
+ border: "1px solid var(--fu-border)",
130
+ backgroundColor: "var(--fu-item-bg)",
131
+ display: "block",
132
+ boxSizing: "border-box"
133
+ };
134
+ var fileUploadIconWellSx = {
135
+ width: 36,
136
+ height: 36,
137
+ minWidth: 36,
138
+ borderRadius: "8px",
139
+ flexShrink: 0,
140
+ display: "flex",
141
+ alignItems: "center",
142
+ justifyContent: "center",
143
+ border: "1px solid var(--fu-border)",
144
+ backgroundColor: "color-mix(in srgb, var(--mui-palette-background-paper) 55%, transparent)",
145
+ boxSizing: "border-box",
146
+ overflow: "hidden"
147
+ };
148
+ var fileUploadLibIconSx = {
149
+ width: 24,
150
+ height: 30,
151
+ lineHeight: 0,
152
+ flexShrink: 0,
153
+ // Keep library colors vivid (no opacity / filter / color overrides).
154
+ color: "unset",
155
+ filter: "none",
156
+ opacity: 1,
157
+ "& svg": {
158
+ width: "100%",
159
+ height: "100%",
160
+ display: "block",
161
+ // Prevent inherited MUI text color from washing glyph/label fills.
162
+ color: "unset"
163
+ }
164
+ };
165
+ var fileUploadButtonSx = {
166
+ alignSelf: "flex-start",
167
+ textTransform: "none",
168
+ fontWeight: 600,
169
+ fontSize: "0.8125rem",
170
+ lineHeight: 1.25,
171
+ borderRadius: "10px",
172
+ px: 1.5,
173
+ py: 0.75,
174
+ minHeight: 36,
175
+ border: "1px solid var(--fu-border)",
176
+ backgroundColor: "var(--fu-surface)",
177
+ color: "var(--fu-text)",
178
+ boxShadow: "var(--fu-shadow)",
179
+ transition: "border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease",
180
+ "&:hover": {
181
+ borderColor: "var(--fu-border-hover)",
182
+ backgroundColor: "var(--fu-surface-hover)"
183
+ },
184
+ "&:focus-visible": {
185
+ borderColor: "var(--fu-border-active)",
186
+ outline: "none"
187
+ },
188
+ '&[data-active="true"]': {
189
+ borderColor: "var(--fu-border-active)",
190
+ backgroundColor: "var(--fu-surface-active)"
191
+ },
192
+ '&[data-error="true"]': {
193
+ borderColor: "var(--fu-border-error)",
194
+ color: "var(--fu-border-error)"
195
+ },
196
+ "&.Mui-disabled": {
197
+ opacity: 0.58,
198
+ borderColor: "var(--fu-border)",
199
+ color: "var(--fu-text-secondary)"
200
+ },
201
+ "& .MuiButton-startIcon": {
202
+ marginRight: "8px",
203
+ marginLeft: 0,
204
+ color: "var(--fu-icon)"
205
+ }
206
+ };
207
+ var fileUploadTileListSx = {
208
+ display: "flex",
209
+ flexWrap: "wrap",
210
+ gap: 1.25,
211
+ m: 0,
212
+ p: 0,
213
+ listStyle: "none"
214
+ };
215
+ var fileUploadTileSx = {
216
+ "--fu-tile-size": "80px",
217
+ position: "relative",
218
+ width: "var(--fu-tile-size)",
219
+ height: "var(--fu-tile-size)",
220
+ minWidth: "var(--fu-tile-size)",
221
+ borderRadius: "12px",
222
+ border: "1px solid var(--fu-border)",
223
+ backgroundColor: "var(--fu-item-bg)",
224
+ boxShadow: "var(--fu-shadow)",
225
+ boxSizing: "border-box",
226
+ overflow: "hidden",
227
+ flexShrink: 0,
228
+ '&[data-status="error"]': {
229
+ borderColor: "color-mix(in srgb, var(--mui-palette-error-main) 55%, var(--fu-border))"
230
+ },
231
+ "&:hover .fu-tile-remove, &:focus-within .fu-tile-remove": {
232
+ opacity: 1,
233
+ pointerEvents: "auto"
234
+ }
235
+ };
236
+ var fileUploadTileMediaSx = {
237
+ width: "100%",
238
+ height: "100%",
239
+ objectFit: "cover",
240
+ display: "block",
241
+ borderRadius: "inherit"
242
+ };
243
+ var fileUploadTileIconWellSx = {
244
+ width: "100%",
245
+ height: "100%",
246
+ display: "flex",
247
+ alignItems: "center",
248
+ justifyContent: "center",
249
+ backgroundColor: "color-mix(in srgb, var(--mui-palette-background-paper) 55%, transparent)",
250
+ border: "none",
251
+ borderRadius: 0,
252
+ boxSizing: "border-box",
253
+ overflow: "hidden"
254
+ };
255
+ var fileUploadTileLibIconSx = {
256
+ width: 36,
257
+ height: 44,
258
+ lineHeight: 0,
259
+ flexShrink: 0,
260
+ color: "unset",
261
+ filter: "none",
262
+ opacity: 1,
263
+ "& svg": {
264
+ width: "100%",
265
+ height: "100%",
266
+ display: "block",
267
+ color: "unset"
268
+ }
269
+ };
270
+ var fileUploadTileRemoveSx = {
271
+ position: "absolute",
272
+ top: 4,
273
+ right: 4,
274
+ zIndex: 2,
275
+ width: 22,
276
+ height: 22,
277
+ p: 0,
278
+ opacity: 0,
279
+ pointerEvents: "none",
280
+ backgroundColor: "#fff",
281
+ color: "rgba(15, 23, 42, 0.72)",
282
+ boxShadow: "0 1px 3px rgba(0,0,0,0.22)",
283
+ border: "1px solid color-mix(in srgb, var(--mui-palette-common-black) 8%, transparent)",
284
+ transition: "opacity 140ms ease, background-color 140ms ease",
285
+ "&:hover": {
286
+ backgroundColor: "#fff",
287
+ color: "rgba(15, 23, 42, 0.92)"
288
+ },
289
+ "&.Mui-disabled": {
290
+ opacity: 0
291
+ }
292
+ };
293
+ var fileUploadTileProgressSx = {
294
+ position: "absolute",
295
+ left: 0,
296
+ right: 0,
297
+ bottom: 0,
298
+ zIndex: 1,
299
+ height: 3,
300
+ borderRadius: 0,
301
+ backgroundColor: "color-mix(in srgb, var(--mui-palette-common-black) 25%, transparent)",
302
+ "& .MuiLinearProgress-bar": {
303
+ borderRadius: 0
304
+ }
305
+ };
306
+
307
+ // src/components/elemental/FileUpload/src/utils.ts
308
+ var idSeq = 0;
309
+ function createFileUploadId() {
310
+ if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
311
+ return crypto.randomUUID();
312
+ }
313
+ idSeq += 1;
314
+ return `fu-${Date.now()}-${idSeq}`;
315
+ }
316
+ function createFileUploadItem(file) {
317
+ return {
318
+ id: createFileUploadId(),
319
+ file,
320
+ status: "idle",
321
+ progress: 0
322
+ };
323
+ }
324
+ function formatFileSize(bytes) {
325
+ if (!Number.isFinite(bytes) || bytes < 0) return "\u2014";
326
+ if (bytes < 1024) return `${bytes} B`;
327
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
328
+ if (bytes < 1024 * 1024 * 1024) {
329
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
330
+ }
331
+ return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`;
332
+ }
333
+ function parseAccept(accept) {
334
+ if (!accept || !accept.trim()) return [];
335
+ return accept.split(",").map((p) => p.trim()).filter(Boolean).map((token) => {
336
+ if (token.startsWith(".")) {
337
+ return { type: "ext", value: token.toLowerCase() };
338
+ }
339
+ return { type: "mime", value: token.toLowerCase() };
340
+ });
341
+ }
342
+ function matchesAccept(file, rules) {
343
+ if (rules.length === 0) return true;
344
+ const name = file.name.toLowerCase();
345
+ const mime = (file.type || "").toLowerCase();
346
+ return rules.some((rule) => {
347
+ if (rule.type === "ext") {
348
+ return name.endsWith(rule.value);
349
+ }
350
+ if (rule.value.endsWith("/*")) {
351
+ const prefix = rule.value.slice(0, -1);
352
+ return mime.startsWith(prefix);
353
+ }
354
+ return mime === rule.value;
355
+ });
356
+ }
357
+ function validateFiles(incoming, opts) {
358
+ const rules = parseAccept(opts.accept);
359
+ const accepted = [];
360
+ const rejections = [];
361
+ const hardCap = opts.multiple ? opts.maxFiles != null && opts.maxFiles > 0 ? opts.maxFiles : Infinity : 1;
362
+ for (const file of incoming) {
363
+ const errors = [];
364
+ if (!matchesAccept(file, rules)) {
365
+ errors.push("file-invalid-type");
366
+ }
367
+ if (opts.maxSize != null && opts.maxSize > 0 && file.size > opts.maxSize) {
368
+ errors.push("file-too-large");
369
+ }
370
+ if (opts.currentCount + accepted.length >= hardCap) {
371
+ errors.push("too-many-files");
372
+ }
373
+ if (errors.length > 0) {
374
+ rejections.push({ file, errors });
375
+ } else {
376
+ accepted.push(file);
377
+ }
378
+ }
379
+ return { accepted, rejections };
380
+ }
381
+ var MIME_TO_EXT = {
382
+ "application/pdf": "pdf",
383
+ "application/zip": "zip",
384
+ "application/x-zip-compressed": "zip",
385
+ "application/gzip": "gz",
386
+ "application/x-gzip": "gz",
387
+ "application/x-rar-compressed": "rar",
388
+ "application/vnd.rar": "rar",
389
+ "application/x-7z-compressed": "7z",
390
+ "application/x-tar": "tar",
391
+ "application/json": "json",
392
+ "application/msword": "doc",
393
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
394
+ "application/vnd.ms-excel": "xls",
395
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx",
396
+ "application/vnd.ms-powerpoint": "ppt",
397
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation": "pptx",
398
+ "text/plain": "txt",
399
+ "text/csv": "csv",
400
+ "text/markdown": "md",
401
+ "image/jpeg": "jpg",
402
+ "image/png": "png",
403
+ "image/gif": "gif",
404
+ "image/webp": "webp",
405
+ "image/svg+xml": "svg",
406
+ "audio/mpeg": "mp3",
407
+ "audio/wav": "wav",
408
+ "video/mp4": "mp4",
409
+ "video/webm": "webm"
410
+ };
411
+ function getFileExtension(file) {
412
+ const name = file.name || "";
413
+ const dot = name.lastIndexOf(".");
414
+ if (dot > 0 && dot < name.length - 1) {
415
+ return name.slice(dot + 1).toLowerCase();
416
+ }
417
+ const mime = (file.type || "").toLowerCase();
418
+ return MIME_TO_EXT[mime] ?? "";
419
+ }
420
+ function isImageFile(file) {
421
+ return typeof file.type === "string" && file.type.startsWith("image/");
422
+ }
423
+ var EXT_ALIASES = {
424
+ "7z": "7zip",
425
+ tgz: "gz",
426
+ tbz: "gz",
427
+ tbz2: "gz"
428
+ };
429
+ var ARCHIVE_FILE_ICON_STYLE = {
430
+ type: "compressed",
431
+ labelColor: "#E2A903",
432
+ labelTextColor: "#1A1A1A",
433
+ labelUppercase: true,
434
+ foldColor: "#C48E02",
435
+ color: "#F6E7A8",
436
+ glyphColor: "rgba(40, 30, 0, 0.35)"
437
+ };
438
+ var ARCHIVE_EXTS = /* @__PURE__ */ new Set([
439
+ "zip",
440
+ "zipx",
441
+ "rar",
442
+ "7z",
443
+ "7zip",
444
+ "gz",
445
+ "tar",
446
+ "tgz",
447
+ "sitx",
448
+ "bz2"
449
+ ]);
450
+ var TYPE_COLOR_FALLBACKS = {
451
+ "3d": {
452
+ type: "3d",
453
+ labelColor: "#5FB9AD",
454
+ foldColor: "#4A9E94",
455
+ color: "#E5F6F4"
456
+ },
457
+ acrobat: {
458
+ type: "acrobat",
459
+ labelColor: "#D93831",
460
+ foldColor: "#B82E28",
461
+ color: "#FCE8E7"
462
+ },
463
+ android: {
464
+ type: "android",
465
+ labelColor: "#3DDC84",
466
+ foldColor: "#2BB86A",
467
+ color: "#E6FBF0"
468
+ },
469
+ audio: {
470
+ type: "audio",
471
+ labelColor: "#9B59B6",
472
+ foldColor: "#7E3F9A",
473
+ color: "#F3E9F8"
474
+ },
475
+ binary: {
476
+ type: "binary",
477
+ labelColor: "#E67E22",
478
+ foldColor: "#C86A1A",
479
+ color: "#FDF0E4"
480
+ },
481
+ code: {
482
+ type: "code",
483
+ labelColor: "#3498DB",
484
+ foldColor: "#2A7AB0",
485
+ color: "#E7F3FB"
486
+ },
487
+ compressed: { ...ARCHIVE_FILE_ICON_STYLE },
488
+ document: {
489
+ type: "document",
490
+ labelColor: "#5B8DEF",
491
+ labelUppercase: true,
492
+ foldColor: "#4A75C9",
493
+ color: "#E8EEF9",
494
+ glyphColor: "rgba(40, 60, 120, 0.35)"
495
+ },
496
+ drive: {
497
+ type: "drive",
498
+ labelColor: "#27AE60",
499
+ foldColor: "#1E8A4B",
500
+ color: "#E5F7ED"
501
+ },
502
+ font: {
503
+ type: "font",
504
+ labelColor: "#8E44AD",
505
+ foldColor: "#71368A",
506
+ color: "#F2E8F7"
507
+ },
508
+ image: {
509
+ type: "image",
510
+ labelColor: "#1ABC9C",
511
+ foldColor: "#14967C",
512
+ color: "#E4F8F3"
513
+ },
514
+ presentation: {
515
+ type: "presentation",
516
+ labelColor: "#D35400",
517
+ labelUppercase: true,
518
+ foldColor: "#A84300",
519
+ color: "#FCEADE",
520
+ glyphColor: "rgba(120, 50, 0, 0.35)"
521
+ },
522
+ settings: {
523
+ type: "settings",
524
+ labelColor: "#16A085",
525
+ foldColor: "#117A65",
526
+ color: "#E4F6F2"
527
+ },
528
+ spreadsheet: {
529
+ type: "spreadsheet",
530
+ labelColor: "#2D7D46",
531
+ labelUppercase: true,
532
+ foldColor: "#246338",
533
+ color: "#E5F2EA",
534
+ glyphColor: "rgba(20, 60, 30, 0.35)"
535
+ },
536
+ vector: {
537
+ type: "vector",
538
+ labelColor: "#FF7F18",
539
+ foldColor: "#D96A12",
540
+ color: "#FFF0E4"
541
+ },
542
+ video: {
543
+ type: "video",
544
+ labelColor: "#E74C3C",
545
+ foldColor: "#C0392B",
546
+ color: "#FCE9E7"
547
+ }
548
+ };
549
+ var UNKNOWN_FILE_ICON_STYLE = {
550
+ type: "document",
551
+ labelColor: "#5B8DEF",
552
+ labelTextColor: "#FFFFFF",
553
+ labelUppercase: true,
554
+ foldColor: "#4A75C9",
555
+ color: "#E8EEF9",
556
+ glyphColor: "rgba(40, 60, 120, 0.35)"
557
+ };
558
+ var MONO_PAGE_COLORS = /* @__PURE__ */ new Set([
559
+ "",
560
+ "whitesmoke",
561
+ "#fff",
562
+ "#ffffff",
563
+ "white",
564
+ "#f5f5f5",
565
+ "#fafafa"
566
+ ]);
567
+ function hasVividColor(style) {
568
+ if (typeof style.labelColor === "string" && style.labelColor.trim()) {
569
+ return true;
570
+ }
571
+ if (typeof style.color === "string") {
572
+ const c = style.color.trim().toLowerCase();
573
+ if (c && !MONO_PAGE_COLORS.has(c)) return true;
574
+ }
575
+ return false;
576
+ }
577
+ function mergeColorEnrichment(lib, enrichment) {
578
+ return {
579
+ ...enrichment,
580
+ ...lib,
581
+ labelColor: lib.labelColor ?? enrichment.labelColor,
582
+ labelTextColor: lib.labelTextColor ?? enrichment.labelTextColor,
583
+ foldColor: lib.foldColor ?? enrichment.foldColor,
584
+ color: lib.color ?? enrichment.color,
585
+ glyphColor: lib.glyphColor ?? enrichment.glyphColor,
586
+ labelUppercase: lib.labelUppercase ?? enrichment.labelUppercase,
587
+ type: lib.type ?? enrichment.type
588
+ };
589
+ }
590
+ function resolveFileIconStyle(file, defaultStyles2) {
591
+ const rawExt = getFileExtension(file);
592
+ const styleKey = (EXT_ALIASES[rawExt] ?? rawExt).toLowerCase();
593
+ const displayExt = rawExt || styleKey || void 0;
594
+ const lib = {
595
+ ...(styleKey ? defaultStyles2[styleKey] : void 0) ?? {}
596
+ };
597
+ const isArchive = ARCHIVE_EXTS.has(rawExt) || ARCHIVE_EXTS.has(styleKey) || lib.type === "compressed";
598
+ let style;
599
+ if (isArchive) {
600
+ style = { ...lib, ...ARCHIVE_FILE_ICON_STYLE };
601
+ } else if (hasVividColor(lib)) {
602
+ style = { ...lib };
603
+ } else if (lib.type && TYPE_COLOR_FALLBACKS[lib.type]) {
604
+ style = mergeColorEnrichment(lib, TYPE_COLOR_FALLBACKS[lib.type]);
605
+ } else {
606
+ style = mergeColorEnrichment(lib, UNKNOWN_FILE_ICON_STYLE);
607
+ }
608
+ return {
609
+ extension: displayExt,
610
+ styleKey,
611
+ style
612
+ };
613
+ }
614
+
615
+ // src/components/elemental/FileUpload/src/FileUpload.tsx
616
+ import { jsx, jsxs } from "react/jsx-runtime";
617
+ function mergeSx(...parts) {
618
+ const out = [];
619
+ for (const p of parts) {
620
+ if (!p) continue;
621
+ if (Array.isArray(p)) out.push(...p);
622
+ else out.push(p);
623
+ }
624
+ return out;
625
+ }
626
+ var FileUpload = forwardRef(
627
+ function FileUpload2(props, ref) {
628
+ const {
629
+ value: valueProp,
630
+ defaultValue,
631
+ onChange,
632
+ onRemove,
633
+ onReject,
634
+ multiple = true,
635
+ accept,
636
+ maxSize,
637
+ maxFiles,
638
+ disabled = false,
639
+ hideDropzone = false,
640
+ disableRemove = false,
641
+ readOnly = false,
642
+ label,
643
+ name,
644
+ helperText,
645
+ error = false,
646
+ required = false,
647
+ variant = "dropzone",
648
+ itemVariant = "row",
649
+ buttonLabel = "Upload file",
650
+ dropzoneTitle = "Drag & drop files here",
651
+ dropzoneDescription = "or click to browse",
652
+ id: idProp,
653
+ className,
654
+ sx,
655
+ "data-testid": dataTestId = "file-upload"
656
+ } = props;
657
+ const reactId = useId();
658
+ const inputId = idProp ?? `file-upload-${reactId}`;
659
+ const helperId = `${inputId}-helper`;
660
+ const inputRef = useRef(null);
661
+ const isControlled = valueProp !== void 0;
662
+ const [uncontrolled, setUncontrolled] = useState(
663
+ () => defaultValue ?? []
664
+ );
665
+ const items = useMemo(
666
+ () => isControlled ? valueProp ?? [] : uncontrolled,
667
+ [isControlled, valueProp, uncontrolled]
668
+ );
669
+ const [active, setActive] = useState(false);
670
+ const dragDepth = useRef(0);
671
+ const atCapacity = useMemo(() => {
672
+ if (!multiple) return items.length >= 1;
673
+ if (maxFiles != null && maxFiles > 0) return items.length >= maxFiles;
674
+ return false;
675
+ }, [items.length, maxFiles, multiple]);
676
+ const commit = useCallback(
677
+ (next) => {
678
+ if (!isControlled) setUncontrolled(next);
679
+ onChange?.(next);
680
+ },
681
+ [isControlled, onChange]
682
+ );
683
+ const ingest = useCallback(
684
+ (fileList) => {
685
+ if (disabled) return;
686
+ const incoming = Array.from(fileList);
687
+ if (incoming.length === 0) return;
688
+ const { accepted, rejections } = validateFiles(incoming, {
689
+ accept,
690
+ maxSize,
691
+ maxFiles,
692
+ currentCount: items.length,
693
+ multiple
694
+ });
695
+ if (rejections.length > 0) {
696
+ onReject?.(rejections);
697
+ }
698
+ if (accepted.length === 0) return;
699
+ const nextItems = accepted.map(createFileUploadItem);
700
+ if (!multiple) {
701
+ commit(nextItems.slice(0, 1));
702
+ return;
703
+ }
704
+ commit([...items, ...nextItems]);
705
+ },
706
+ [
707
+ accept,
708
+ disabled,
709
+ items,
710
+ maxFiles,
711
+ maxSize,
712
+ multiple,
713
+ onReject,
714
+ commit
715
+ ]
716
+ );
717
+ const handleRemove = useCallback(
718
+ (item) => {
719
+ if (disabled) return;
720
+ const next = items.filter((i) => i.id !== item.id);
721
+ commit(next);
722
+ onRemove?.(item, next);
723
+ if (inputRef.current) inputRef.current.value = "";
724
+ },
725
+ [commit, disabled, items, onRemove]
726
+ );
727
+ const openPicker = useCallback(() => {
728
+ if (disabled || atCapacity) return;
729
+ inputRef.current?.click();
730
+ }, [atCapacity, disabled]);
731
+ const onInputChange = useCallback(
732
+ (e) => {
733
+ if (e.target.files) ingest(e.target.files);
734
+ e.target.value = "";
735
+ },
736
+ [ingest]
737
+ );
738
+ const onDragEnter = useCallback(
739
+ (e) => {
740
+ e.preventDefault();
741
+ e.stopPropagation();
742
+ if (disabled || atCapacity) return;
743
+ dragDepth.current += 1;
744
+ setActive(true);
745
+ },
746
+ [atCapacity, disabled]
747
+ );
748
+ const onDragLeave = useCallback((e) => {
749
+ e.preventDefault();
750
+ e.stopPropagation();
751
+ dragDepth.current = Math.max(0, dragDepth.current - 1);
752
+ if (dragDepth.current === 0) setActive(false);
753
+ }, []);
754
+ const onDragOver = useCallback((e) => {
755
+ e.preventDefault();
756
+ e.stopPropagation();
757
+ }, []);
758
+ const onDrop = useCallback(
759
+ (e) => {
760
+ e.preventDefault();
761
+ e.stopPropagation();
762
+ dragDepth.current = 0;
763
+ setActive(false);
764
+ if (disabled || atCapacity) return;
765
+ if (e.dataTransfer.files?.length) {
766
+ ingest(e.dataTransfer.files);
767
+ }
768
+ },
769
+ [atCapacity, disabled, ingest]
770
+ );
771
+ const queueOnly = readOnly || hideDropzone;
772
+ const removeDisabled = readOnly || disableRemove || disabled;
773
+ const showTrigger = !queueOnly && !atCapacity;
774
+ const isButton = variant === "button";
775
+ const fileInput = /* @__PURE__ */ jsx(
776
+ "input",
777
+ {
778
+ ref: inputRef,
779
+ id: inputId,
780
+ name,
781
+ type: "file",
782
+ accept,
783
+ multiple,
784
+ disabled,
785
+ onChange: onInputChange,
786
+ style: { display: "none" },
787
+ "aria-hidden": true,
788
+ tabIndex: -1
789
+ }
790
+ );
791
+ const dragHandlers = {
792
+ onDragEnter,
793
+ onDragLeave,
794
+ onDragOver,
795
+ onDrop
796
+ };
797
+ return /* @__PURE__ */ jsxs(
798
+ default2,
799
+ {
800
+ ref,
801
+ className,
802
+ "data-testid": dataTestId,
803
+ "data-variant": variant,
804
+ "data-readonly": readOnly || queueOnly ? "true" : void 0,
805
+ sx: mergeSx(fileUploadRootSx, sx),
806
+ children: [
807
+ label ? /* @__PURE__ */ jsx(
808
+ MuiFormLabel,
809
+ {
810
+ htmlFor: showTrigger ? inputId : void 0,
811
+ required,
812
+ error,
813
+ sx: {
814
+ mb: 0.25,
815
+ color: error ? "error.main" : "text.secondary",
816
+ fontSize: "0.8rem",
817
+ fontWeight: 600
818
+ },
819
+ children: label
820
+ }
821
+ ) : null,
822
+ fileInput,
823
+ showTrigger ? isButton ? /* @__PURE__ */ jsx(
824
+ Button,
825
+ {
826
+ type: "button",
827
+ disableElevation: true,
828
+ disabled,
829
+ "aria-invalid": error || void 0,
830
+ "aria-describedby": helperText ? helperId : void 0,
831
+ "data-active": active ? "true" : "false",
832
+ "data-error": error ? "true" : "false",
833
+ "data-testid": `${dataTestId}-button`,
834
+ startIcon: /* @__PURE__ */ jsx(default6, { sx: { fontSize: "1.15rem" } }),
835
+ onClick: openPicker,
836
+ sx: fileUploadButtonSx,
837
+ ...dragHandlers,
838
+ children: buttonLabel
839
+ }
840
+ ) : /* @__PURE__ */ jsxs(
841
+ default2,
842
+ {
843
+ role: "button",
844
+ tabIndex: disabled ? -1 : 0,
845
+ "aria-disabled": disabled || void 0,
846
+ "aria-invalid": error || void 0,
847
+ "aria-describedby": helperText ? helperId : void 0,
848
+ "data-active": active ? "true" : "false",
849
+ "data-error": error ? "true" : "false",
850
+ "data-disabled": disabled ? "true" : "false",
851
+ "data-testid": `${dataTestId}-dropzone`,
852
+ sx: fileUploadDropzoneSx,
853
+ onClick: openPicker,
854
+ onKeyDown: (e) => {
855
+ if (e.key === "Enter" || e.key === " ") {
856
+ e.preventDefault();
857
+ openPicker();
858
+ }
859
+ },
860
+ ...dragHandlers,
861
+ children: [
862
+ /* @__PURE__ */ jsx(
863
+ default6,
864
+ {
865
+ "aria-hidden": true,
866
+ sx: { fontSize: 36, color: "var(--fu-icon)", opacity: 0.9 }
867
+ }
868
+ ),
869
+ typeof dropzoneTitle === "string" ? /* @__PURE__ */ jsx(
870
+ default4,
871
+ {
872
+ variant: "subtitle2",
873
+ sx: { m: 0, color: "var(--fu-text)", fontWeight: 600 },
874
+ children: dropzoneTitle
875
+ }
876
+ ) : dropzoneTitle,
877
+ dropzoneDescription ? typeof dropzoneDescription === "string" ? /* @__PURE__ */ jsx(
878
+ default4,
879
+ {
880
+ variant: "caption",
881
+ sx: { m: 0, color: "var(--fu-text-secondary)" },
882
+ children: dropzoneDescription
883
+ }
884
+ ) : dropzoneDescription : null
885
+ ]
886
+ }
887
+ ) : null,
888
+ items.length > 0 ? itemVariant === "tile" ? /* @__PURE__ */ jsx(
889
+ default2,
890
+ {
891
+ component: "ul",
892
+ "data-testid": `${dataTestId}-list`,
893
+ "data-item-variant": "tile",
894
+ sx: fileUploadTileListSx,
895
+ children: items.map((item) => /* @__PURE__ */ jsx(
896
+ FileUploadListItem,
897
+ {
898
+ item,
899
+ disabled,
900
+ disableRemove: removeDisabled,
901
+ onRemove: handleRemove,
902
+ testId: `${dataTestId}-item`,
903
+ itemVariant: "tile"
904
+ },
905
+ item.id
906
+ ))
907
+ }
908
+ ) : /* @__PURE__ */ jsx(
909
+ default3,
910
+ {
911
+ component: "ul",
912
+ spacing: 1,
913
+ "data-testid": `${dataTestId}-list`,
914
+ "data-item-variant": "row",
915
+ sx: { m: 0, p: 0, listStyle: "none" },
916
+ children: items.map((item) => /* @__PURE__ */ jsx(
917
+ FileUploadListItem,
918
+ {
919
+ item,
920
+ disabled,
921
+ disableRemove: removeDisabled,
922
+ onRemove: handleRemove,
923
+ testId: `${dataTestId}-item`,
924
+ itemVariant: "row"
925
+ },
926
+ item.id
927
+ ))
928
+ }
929
+ ) : null,
930
+ helperText ? /* @__PURE__ */ jsx(
931
+ default7,
932
+ {
933
+ id: helperId,
934
+ error,
935
+ sx: { mx: 0.5, mt: 0 },
936
+ children: helperText
937
+ }
938
+ ) : null
939
+ ]
940
+ }
941
+ );
942
+ }
943
+ );
944
+ function FileUploadTypeIcon({
945
+ file,
946
+ tile = false
947
+ }) {
948
+ const resolved = resolveFileIconStyle(
949
+ file,
950
+ defaultStyles
951
+ );
952
+ const { extension, styleKey } = resolved;
953
+ const iconStyle = resolved.style;
954
+ return /* @__PURE__ */ jsx(
955
+ default2,
956
+ {
957
+ "aria-hidden": true,
958
+ "data-testid": "file-upload-icon",
959
+ "data-ext": extension || void 0,
960
+ "data-style-key": styleKey || void 0,
961
+ sx: tile ? fileUploadTileIconWellSx : fileUploadIconWellSx,
962
+ children: /* @__PURE__ */ jsx(default2, { sx: tile ? fileUploadTileLibIconSx : fileUploadLibIconSx, children: /* @__PURE__ */ jsx(
963
+ FileIcon,
964
+ {
965
+ fold: true,
966
+ radius: 3,
967
+ extension,
968
+ ...iconStyle
969
+ }
970
+ ) })
971
+ }
972
+ );
973
+ }
974
+ function FileUploadThumb({
975
+ file,
976
+ tile = false
977
+ }) {
978
+ const [url, setUrl] = useState(null);
979
+ const [previewFailed, setPreviewFailed] = useState(false);
980
+ useEffect(() => {
981
+ setPreviewFailed(false);
982
+ if (!isImageFile(file)) {
983
+ setUrl(null);
984
+ return;
985
+ }
986
+ const objectUrl = URL.createObjectURL(file);
987
+ setUrl(objectUrl);
988
+ return () => {
989
+ URL.revokeObjectURL(objectUrl);
990
+ };
991
+ }, [file]);
992
+ if (url && !previewFailed) {
993
+ return /* @__PURE__ */ jsx(
994
+ default2,
995
+ {
996
+ component: "img",
997
+ src: url,
998
+ alt: "",
999
+ "data-testid": "file-upload-thumb",
1000
+ sx: tile ? fileUploadTileMediaSx : fileUploadThumbSx,
1001
+ onError: () => setPreviewFailed(true)
1002
+ }
1003
+ );
1004
+ }
1005
+ return /* @__PURE__ */ jsx(FileUploadTypeIcon, { file, tile });
1006
+ }
1007
+ function FileUploadListItem({
1008
+ item,
1009
+ disabled,
1010
+ disableRemove = false,
1011
+ onRemove,
1012
+ testId,
1013
+ itemVariant
1014
+ }) {
1015
+ if (itemVariant === "tile") {
1016
+ return /* @__PURE__ */ jsx(
1017
+ FileUploadTileItem,
1018
+ {
1019
+ item,
1020
+ disabled,
1021
+ disableRemove,
1022
+ onRemove,
1023
+ testId
1024
+ }
1025
+ );
1026
+ }
1027
+ const status = item.status ?? (item.error ? "error" : "idle");
1028
+ const showProgress = status === "uploading" || typeof item.progress === "number" && item.progress > 0 && item.progress < 100 && status !== "error" && status !== "success";
1029
+ return /* @__PURE__ */ jsxs(
1030
+ default2,
1031
+ {
1032
+ component: "li",
1033
+ "data-testid": testId,
1034
+ "data-status": status,
1035
+ "data-item-variant": "row",
1036
+ sx: fileUploadItemSx,
1037
+ children: [
1038
+ /* @__PURE__ */ jsx(FileUploadThumb, { file: item.file }),
1039
+ /* @__PURE__ */ jsxs(default2, { sx: { flex: 1, minWidth: 0 }, children: [
1040
+ /* @__PURE__ */ jsx(
1041
+ default4,
1042
+ {
1043
+ variant: "body2",
1044
+ noWrap: true,
1045
+ title: item.file.name,
1046
+ sx: { m: 0, fontWeight: 500, color: "var(--fu-text)" },
1047
+ children: item.file.name
1048
+ }
1049
+ ),
1050
+ /* @__PURE__ */ jsxs(
1051
+ default4,
1052
+ {
1053
+ variant: "caption",
1054
+ sx: { m: 0, color: "var(--fu-text-secondary)" },
1055
+ children: [
1056
+ formatFileSize(item.file.size),
1057
+ item.error ? ` \xB7 ${item.error}` : null,
1058
+ status === "success" && !item.error ? " \xB7 Done" : null
1059
+ ]
1060
+ }
1061
+ ),
1062
+ showProgress ? /* @__PURE__ */ jsx(
1063
+ LinearProgress,
1064
+ {
1065
+ variant: "determinate",
1066
+ value: Math.max(0, Math.min(100, item.progress ?? 0)),
1067
+ "aria-label": `Upload progress ${item.progress ?? 0}%`,
1068
+ sx: { mt: 0.75, height: 4, borderRadius: 2 }
1069
+ }
1070
+ ) : null,
1071
+ status === "uploading" && item.progress == null ? /* @__PURE__ */ jsx(
1072
+ LinearProgress,
1073
+ {
1074
+ "aria-label": "Uploading",
1075
+ sx: { mt: 0.75, height: 4, borderRadius: 2 }
1076
+ }
1077
+ ) : null
1078
+ ] }),
1079
+ disableRemove ? null : /* @__PURE__ */ jsx(
1080
+ IconButton_default,
1081
+ {
1082
+ size: "small",
1083
+ "aria-label": `Remove ${item.file.name}`,
1084
+ disabled,
1085
+ onClick: () => onRemove(item),
1086
+ sx: {
1087
+ flexShrink: 0,
1088
+ color: "var(--fu-text-secondary)",
1089
+ p: 0.35
1090
+ },
1091
+ children: /* @__PURE__ */ jsx(default5, { sx: { fontSize: "1rem" } })
1092
+ }
1093
+ )
1094
+ ]
1095
+ }
1096
+ );
1097
+ }
1098
+ function FileUploadTileItem({
1099
+ item,
1100
+ disabled,
1101
+ disableRemove = false,
1102
+ onRemove,
1103
+ testId
1104
+ }) {
1105
+ const status = item.status ?? (item.error ? "error" : "idle");
1106
+ const showProgress = status === "uploading" || typeof item.progress === "number" && item.progress > 0 && item.progress < 100 && status !== "error" && status !== "success";
1107
+ const indeterminate = status === "uploading" && item.progress == null;
1108
+ return /* @__PURE__ */ jsxs(
1109
+ default2,
1110
+ {
1111
+ component: "li",
1112
+ "data-testid": testId,
1113
+ "data-status": status,
1114
+ "data-item-variant": "tile",
1115
+ title: item.file.name,
1116
+ sx: fileUploadTileSx,
1117
+ children: [
1118
+ /* @__PURE__ */ jsx(FileUploadThumb, { file: item.file, tile: true }),
1119
+ showProgress ? /* @__PURE__ */ jsx(
1120
+ LinearProgress,
1121
+ {
1122
+ variant: "determinate",
1123
+ value: Math.max(0, Math.min(100, item.progress ?? 0)),
1124
+ "aria-label": `Upload progress ${item.progress ?? 0}%`,
1125
+ sx: fileUploadTileProgressSx
1126
+ }
1127
+ ) : null,
1128
+ indeterminate ? /* @__PURE__ */ jsx(
1129
+ LinearProgress,
1130
+ {
1131
+ "aria-label": "Uploading",
1132
+ sx: fileUploadTileProgressSx
1133
+ }
1134
+ ) : null,
1135
+ disableRemove ? null : /* @__PURE__ */ jsx(
1136
+ IconButton_default,
1137
+ {
1138
+ className: "fu-tile-remove",
1139
+ size: "small",
1140
+ "aria-label": `Remove ${item.file.name}`,
1141
+ disabled,
1142
+ onClick: (e) => {
1143
+ e.stopPropagation();
1144
+ onRemove(item);
1145
+ },
1146
+ sx: fileUploadTileRemoveSx,
1147
+ children: /* @__PURE__ */ jsx(default5, { sx: { fontSize: "0.85rem" } })
1148
+ }
1149
+ )
1150
+ ]
1151
+ }
1152
+ );
1153
+ }
1154
+
1155
+ export {
1156
+ fileUploadRootSx,
1157
+ fileUploadDropzoneSx,
1158
+ fileUploadItemSx,
1159
+ fileUploadThumbSx,
1160
+ fileUploadIconWellSx,
1161
+ fileUploadLibIconSx,
1162
+ fileUploadButtonSx,
1163
+ fileUploadTileListSx,
1164
+ fileUploadTileSx,
1165
+ fileUploadTileMediaSx,
1166
+ fileUploadTileIconWellSx,
1167
+ fileUploadTileLibIconSx,
1168
+ fileUploadTileRemoveSx,
1169
+ fileUploadTileProgressSx,
1170
+ createFileUploadId,
1171
+ createFileUploadItem,
1172
+ formatFileSize,
1173
+ validateFiles,
1174
+ getFileExtension,
1175
+ isImageFile,
1176
+ ARCHIVE_FILE_ICON_STYLE,
1177
+ TYPE_COLOR_FALLBACKS,
1178
+ UNKNOWN_FILE_ICON_STYLE,
1179
+ resolveFileIconStyle,
1180
+ FileUpload
1181
+ };
1182
+ //# sourceMappingURL=chunk-4SSJY32J.mjs.map