@trinityui/design-system 2.2.1 → 2.2.3

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 (41) hide show
  1. package/CHANGELOG.md +114 -0
  2. package/dist/Legend.js +12 -15
  3. package/dist/app-shell.js +145 -163
  4. package/dist/charts.js +2820 -2777
  5. package/dist/components/AI/AIChat.d.ts.map +1 -1
  6. package/dist/components/AI/AIMessage.d.ts.map +1 -1
  7. package/dist/components/AI/AISources.d.ts.map +1 -1
  8. package/dist/components/AI/ChatHeader.d.ts.map +1 -1
  9. package/dist/components/AI/ChatHistoryList.d.ts.map +1 -1
  10. package/dist/components/AI/ChatThread.d.ts.map +1 -1
  11. package/dist/components/AI/InsightEngineInput.d.ts.map +1 -1
  12. package/dist/components/AppLayout/InsightEnginePanel.d.ts.map +1 -1
  13. package/dist/components/AppLayout/ThreadHistorySidebar.d.ts.map +1 -1
  14. package/dist/components/Autocomplete/Autocomplete.d.ts.map +1 -1
  15. package/dist/components/Combobox/Combobox.d.ts.map +1 -1
  16. package/dist/components/CommandPalette/CommandPalette.d.ts.map +1 -1
  17. package/dist/components/DataCard/DataCard.d.ts.map +1 -1
  18. package/dist/components/DataTable/CellRenderers.d.ts.map +1 -1
  19. package/dist/components/DockLayout/DockLayout.d.ts.map +1 -1
  20. package/dist/components/IllustratedMessage.d.ts.map +1 -1
  21. package/dist/components/MentionsInput/MentionsInput.d.ts +1 -1
  22. package/dist/components/MentionsInput/MentionsInput.d.ts.map +1 -1
  23. package/dist/components/PageHeader/PageHeader.d.ts.map +1 -1
  24. package/dist/components/PredictiveTextInput/PredictiveTextInput.d.ts.map +1 -1
  25. package/dist/components/SearchInput/SearchInput.d.ts.map +1 -1
  26. package/dist/components/StatusIndicator/Legend.d.ts.map +1 -1
  27. package/dist/components/StatusIndicator/StatusIndicator.d.ts.map +1 -1
  28. package/dist/components/Timeline/Timeline.d.ts.map +1 -1
  29. package/dist/components/TopNavHeader.d.ts.map +1 -1
  30. package/dist/components/TopNavWithSidebar.d.ts.map +1 -1
  31. package/dist/components/TransferList/TransferList.d.ts.map +1 -1
  32. package/dist/components/navigation/components.d.ts.map +1 -1
  33. package/dist/components/templates/ListDetail/ListDetailTemplate.d.ts.map +1 -1
  34. package/dist/components/templates/Settings/SettingsTemplate.d.ts.map +1 -1
  35. package/dist/data-table2.js +1383 -1382
  36. package/dist/data.js +5 -5
  37. package/dist/essentials.js +4 -4
  38. package/dist/forms.js +292 -339
  39. package/dist/index.js +15472 -15476
  40. package/dist/trinity.css +1 -1
  41. package/package.json +32 -32
package/dist/forms.js CHANGED
@@ -1,22 +1,22 @@
1
- import { jsxs as m, jsx as e, Fragment as Pe } from "react/jsx-runtime";
2
- import * as F from "react";
3
- import Le, { createElement as Re, useState as ie, useRef as Oe, useCallback as S } from "react";
4
- import { useTheme as Fe, Paper as ce, Box as k, ListItem as de, alpha as me, ListItemIcon as ee, Checkbox as fe, ListItemText as pe, Divider as he, Button as ue, Autocomplete as Se, Typography as _, Popper as Me, Chip as xe, TextField as Te, Alert as ge, Stack as Be, List as Ee, LinearProgress as Ae, ListItemSecondaryAction as We, IconButton as ze } from "@mui/material";
5
- import { Check as ae, Add as $e, Close as ye } from "@mui/icons-material";
6
- import le from "@mui/icons-material/CloudUpload";
7
- import je from "@mui/icons-material/InsertDriveFile";
8
- import Ue from "@mui/icons-material/Delete";
9
- import we from "@mui/icons-material/CheckCircle";
10
- import _e from "@mui/icons-material/Error";
1
+ import { jsxs as f, jsx as e, Fragment as Re } from "react/jsx-runtime";
2
+ import * as O from "react";
3
+ import Fe, { createElement as Oe, useState as ae, useRef as Se, useCallback as S } from "react";
4
+ import { useTheme as Me, Paper as de, Box as C, ListItem as pe, alpha as he, ListItemIcon as re, Checkbox as ge, ListItemText as ue, Divider as ye, Button as me, Autocomplete as Ae, Typography as _, Popper as Be, Chip as Ie, TextField as Ee, Alert as ve, Stack as ze, List as We, LinearProgress as je, ListItemSecondaryAction as Te, IconButton as $e } from "@mui/material";
5
+ import { Check as le, Add as Ue, Close as be } from "@mui/icons-material";
6
+ import ce from "@mui/icons-material/CloudUpload";
7
+ import Ve from "@mui/icons-material/InsertDriveFile";
8
+ import _e from "@mui/icons-material/Delete";
9
+ import ke from "@mui/icons-material/CheckCircle";
10
+ import Ge from "@mui/icons-material/Error";
11
11
  import Ke from "@mui/icons-material/PictureAsPdf";
12
- import Ve from "@mui/icons-material/Image";
13
- import qe from "@mui/icons-material/VideoLibrary";
14
- import Ge from "@mui/icons-material/Description";
15
- import { s as Ie } from "./app-shell.js";
16
- const ve = () => `new-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, Ne = (d) => /* @__PURE__ */ e(
17
- Me,
12
+ import qe from "@mui/icons-material/Image";
13
+ import Ne from "@mui/icons-material/VideoLibrary";
14
+ import He from "@mui/icons-material/Description";
15
+ import { s as Ce } from "./app-shell.js";
16
+ const xe = () => `new-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, Je = (c) => /* @__PURE__ */ e(
17
+ Be,
18
18
  {
19
- ...d,
19
+ ...c,
20
20
  placement: "bottom-start",
21
21
  modifiers: [
22
22
  {
@@ -27,146 +27,141 @@ const ve = () => `new-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
27
27
  }
28
28
  ]
29
29
  }
30
- ), cr = F.forwardRef(function({
31
- options: p,
32
- value: s,
30
+ ), pr = O.forwardRef(function({
31
+ options: d,
32
+ value: n,
33
33
  defaultValue: D,
34
- onChange: v,
35
- creatable: b = !1,
36
- onCreate: x,
34
+ onChange: b,
35
+ creatable: x = !1,
36
+ onCreate: w,
37
37
  createText: M = 'Create "{value}"',
38
- multiple: u = !1,
39
- placeholder: Q = "Select...",
40
- label: K,
38
+ multiple: p = !1,
39
+ placeholder: X = "Select...",
40
+ label: G,
41
41
  helperText: a,
42
- error: V = !1,
43
- errorMessage: re,
44
- disabled: X = !1,
45
- fullWidth: j = !1,
46
- size: A = "medium",
42
+ error: K = !1,
43
+ errorMessage: te,
44
+ disabled: Y = !1,
45
+ fullWidth: U = !1,
46
+ size: W = "medium",
47
47
  limitTags: q = 3,
48
- showCheckbox: W = !0,
49
- groupBy: Y = !1,
50
- loading: U = !1,
51
- noOptionsText: G = "No options",
52
- filterOptions: N,
53
- renderOption: H,
54
- renderTag: z,
55
- freeSolo: h = !1,
56
- autoHighlight: w = !0,
57
- clearOnEscape: te = !0,
58
- showSelectAll: T = !1,
59
- selectAllText: Z = "Select All",
60
- className: oe,
61
- sx: ne
62
- }, se) {
63
- const J = Fe(), [g, $] = F.useState(""), [P, B] = F.useState(
48
+ showCheckbox: j = !0,
49
+ groupBy: Z = !1,
50
+ loading: V = !1,
51
+ noOptionsText: N = "No options",
52
+ filterOptions: H,
53
+ renderOption: J,
54
+ renderTag: T,
55
+ freeSolo: g = !1,
56
+ autoHighlight: I = !0,
57
+ clearOnEscape: oe = !0,
58
+ showSelectAll: A = !1,
59
+ selectAllText: ee = "Select All",
60
+ className: ne,
61
+ sx: se
62
+ }, ie) {
63
+ const Q = Me(), [y, $] = O.useState(""), [P, B] = O.useState(
64
64
  D || []
65
- ), L = s !== void 0 ? s : P, r = F.useCallback(
65
+ ), L = n !== void 0 ? n : P, r = O.useCallback(
66
66
  (t, o) => {
67
- if (N)
68
- return N(t, o);
69
- const n = o.inputValue.toLowerCase();
67
+ if (H)
68
+ return H(t, o);
69
+ const s = o.inputValue.toLowerCase();
70
70
  return t.filter(
71
- (c) => c.label.toLowerCase().includes(n) || c.secondary?.toLowerCase().includes(n)
71
+ (u) => u.label.toLowerCase().includes(s) || u.secondary?.toLowerCase().includes(s)
72
72
  );
73
73
  },
74
- [N]
75
- ), l = F.useMemo(() => !b || !g.trim() ? !1 : !p.some(
76
- (o) => o.label.toLowerCase() === g.toLowerCase()
77
- ), [b, g, p]), I = async (t, o) => {
78
- let n;
79
- if (u) {
80
- const c = o || [];
81
- n = await Promise.all(
82
- c.map(async (C) => typeof C == "string" ? b && x ? await x(C) : { id: ve(), label: C } : C)
74
+ [H]
75
+ ), l = O.useMemo(() => !x || !y.trim() ? !1 : !d.some(
76
+ (o) => o.label.toLowerCase() === y.toLowerCase()
77
+ ), [x, y, d]), k = async (t, o) => {
78
+ let s;
79
+ if (p) {
80
+ const u = o || [];
81
+ s = await Promise.all(
82
+ u.map(async (m) => typeof m == "string" ? x && w ? await w(m) : { id: xe(), label: m } : m)
83
83
  );
84
84
  } else
85
- o === null ? n = [] : typeof o == "string" ? b && x ? n = [await x(o)] : n = [{ id: ve(), label: o }] : n = [o];
86
- B(n), v?.(n);
87
- }, R = F.useMemo(() => {
88
- const t = p.filter((o) => !o.disabled);
85
+ o === null ? s = [] : typeof o == "string" ? x && w ? s = [await w(o)] : s = [{ id: xe(), label: o }] : s = [o];
86
+ B(s), b?.(s);
87
+ }, R = O.useMemo(() => {
88
+ const t = d.filter((o) => !o.disabled);
89
89
  return t.length > 0 && t.every(
90
- (o) => L.some((n) => n.id === o.id)
90
+ (o) => L.some((s) => s.id === o.id)
91
91
  );
92
- }, [p, L]), y = F.useCallback(() => {
92
+ }, [d, L]), v = O.useCallback(() => {
93
93
  if (R)
94
- B([]), v?.([]);
94
+ B([]), b?.([]);
95
95
  else {
96
- const t = p.filter((o) => !o.disabled);
97
- B(t), v?.(t);
96
+ const t = d.filter((o) => !o.disabled);
97
+ B(t), b?.(t);
98
98
  }
99
- }, [R, p, v]), f = F.useCallback(async () => {
100
- if (!l || !x) return;
101
- const t = await x(g), o = u ? [...L, t] : [t];
102
- B(o), v?.(o), $("");
103
- }, [l, x, g, u, L, v]), E = (t) => /* @__PURE__ */ e(
104
- Te,
99
+ }, [R, d, b]), h = O.useCallback(async () => {
100
+ if (!l || !w) return;
101
+ const t = await w(y), o = p ? [...L, t] : [t];
102
+ B(o), b?.(o), $("");
103
+ }, [l, w, y, p, L, b]), E = (t) => /* @__PURE__ */ e(
104
+ Ee,
105
105
  {
106
106
  ...t,
107
- label: K,
108
- placeholder: L.length === 0 ? Q : void 0,
109
- error: V,
110
- helperText: V ? re : a,
111
- size: A,
112
- InputProps: {
113
- ...t.InputProps,
114
- sx: {
115
- "& .MuiAutocomplete-input": {
116
- minWidth: "60px !important"
117
- }
118
- }
119
- }
107
+ label: G,
108
+ placeholder: L.length === 0 ? X : void 0,
109
+ error: K,
110
+ helperText: K ? te : a,
111
+ size: W
120
112
  }
121
- ), O = (t, o) => t.map((n, c) => {
122
- const C = o({ index: c });
123
- return z ? z(n, C.onDelete) : /* @__PURE__ */ Re(
124
- xe,
125
- {
126
- ...C,
127
- key: n.id,
128
- label: n.label,
129
- size: A,
130
- deleteIcon: /* @__PURE__ */ e(ye, { fontSize: "small" }),
131
- sx: {
132
- maxWidth: 150,
133
- "& .MuiChip-label": {
134
- overflow: "hidden",
135
- textOverflow: "ellipsis"
113
+ ), F = (t, o) => {
114
+ const s = o;
115
+ return (Array.isArray(t) ? t : []).map((m, z) => {
116
+ const fe = s({ index: z });
117
+ return T ? T(m, fe.onDelete) : /* @__PURE__ */ Oe(
118
+ Ie,
119
+ {
120
+ ...fe,
121
+ key: typeof m == "object" ? m.id : z,
122
+ label: typeof m == "object" ? m.label : String(m),
123
+ size: W,
124
+ deleteIcon: /* @__PURE__ */ e(be, { fontSize: "small" }),
125
+ sx: {
126
+ maxWidth: 150,
127
+ "& .MuiChip-label": {
128
+ overflow: "hidden",
129
+ textOverflow: "ellipsis"
130
+ }
136
131
  }
137
132
  }
138
- }
139
- );
140
- }), i = F.useCallback(
133
+ );
134
+ });
135
+ }, i = O.useCallback(
141
136
  (t) => {
142
- const { children: o, ...n } = t;
143
- return /* @__PURE__ */ m(ce, { ...n, elevation: 8, children: [
144
- u && T && /* @__PURE__ */ m(
145
- k,
137
+ const { children: o, ...s } = t;
138
+ return /* @__PURE__ */ f(de, { ...s, elevation: 8, children: [
139
+ p && A && /* @__PURE__ */ f(
140
+ C,
146
141
  {
147
- onMouseDown: (c) => {
148
- c.preventDefault(), c.stopPropagation();
142
+ onMouseDown: (u) => {
143
+ u.preventDefault(), u.stopPropagation();
149
144
  },
150
- onClick: (c) => {
151
- c.preventDefault(), c.stopPropagation(), y();
145
+ onClick: (u) => {
146
+ u.preventDefault(), u.stopPropagation(), v();
152
147
  },
153
148
  children: [
154
- /* @__PURE__ */ m(
155
- de,
149
+ /* @__PURE__ */ f(
150
+ pe,
156
151
  {
157
152
  dense: !0,
158
153
  sx: {
159
154
  cursor: "pointer",
160
155
  "&:hover": {
161
- backgroundColor: me(J.palette.primary.main, 0.08)
156
+ backgroundColor: he(Q.palette.primary.main, 0.08)
162
157
  }
163
158
  },
164
159
  children: [
165
- W && /* @__PURE__ */ e(ee, { sx: { minWidth: 36, pointerEvents: "none" }, children: /* @__PURE__ */ e(
166
- fe,
160
+ j && /* @__PURE__ */ e(re, { sx: { minWidth: 36, pointerEvents: "none" }, children: /* @__PURE__ */ e(
161
+ ge,
167
162
  {
168
163
  icon: /* @__PURE__ */ e(
169
- k,
164
+ C,
170
165
  {
171
166
  sx: {
172
167
  width: 18,
@@ -179,7 +174,7 @@ const ve = () => `new-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
179
174
  }
180
175
  ),
181
176
  checkedIcon: /* @__PURE__ */ e(
182
- k,
177
+ C,
183
178
  {
184
179
  sx: {
185
180
  width: 18,
@@ -193,7 +188,7 @@ const ve = () => `new-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
193
188
  justifyContent: "center"
194
189
  },
195
190
  children: /* @__PURE__ */ e(
196
- ae,
191
+ le,
197
192
  {
198
193
  sx: {
199
194
  width: 14,
@@ -211,31 +206,31 @@ const ve = () => `new-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
211
206
  }
212
207
  ) }),
213
208
  /* @__PURE__ */ e(
214
- pe,
209
+ ue,
215
210
  {
216
- primary: R ? "Deselect All" : Z,
217
- primaryTypographyProps: {
211
+ primary: R ? "Deselect All" : ee,
212
+ slotProps: { primary: {
218
213
  variant: "body2",
219
- fontWeight: 500
220
- }
214
+ sx: { fontWeight: 500 }
215
+ } }
221
216
  }
222
217
  )
223
218
  ]
224
219
  }
225
220
  ),
226
- /* @__PURE__ */ e(he, {})
221
+ /* @__PURE__ */ e(ye, {})
227
222
  ]
228
223
  }
229
224
  ),
230
225
  o,
231
- l && /* @__PURE__ */ m(Pe, { children: [
232
- /* @__PURE__ */ e(he, {}),
226
+ l && /* @__PURE__ */ f(Re, { children: [
227
+ /* @__PURE__ */ e(ye, {}),
233
228
  /* @__PURE__ */ e(
234
- ue,
229
+ me,
235
230
  {
236
231
  fullWidth: !0,
237
- startIcon: /* @__PURE__ */ e($e, {}),
238
- onClick: f,
232
+ startIcon: /* @__PURE__ */ e(Ue, {}),
233
+ onClick: h,
239
234
  sx: {
240
235
  justifyContent: "flex-start",
241
236
  py: 1.5,
@@ -244,188 +239,146 @@ const ve = () => `new-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
244
239
  color: "primary.main",
245
240
  borderRadius: 0,
246
241
  "&:hover": {
247
- backgroundColor: me(J.palette.primary.main, 0.08)
242
+ backgroundColor: he(Q.palette.primary.main, 0.08)
248
243
  }
249
244
  },
250
- children: M.replace("{value}", g)
245
+ children: M.replace("{value}", y)
251
246
  }
252
247
  )
253
248
  ] })
254
249
  ] });
255
250
  },
256
- [l, M, g, J.palette.primary.main, f, u, T, W, y, R, Z]
257
- ), De = p;
251
+ [l, M, y, Q.palette.primary.main, h, p, A, j, v, R, ee]
252
+ ), Le = d;
258
253
  return /* @__PURE__ */ e(
259
- Se,
254
+ Ae,
260
255
  {
261
- ref: se,
262
- className: oe,
263
- sx: {
264
- width: j ? "100%" : 300,
265
- ...ne
266
- },
267
- multiple: u,
268
- options: De,
269
- value: u ? L : L[0] || null,
270
- onChange: I,
271
- inputValue: g,
256
+ ref: ie,
257
+ className: ne,
258
+ sx: { width: U ? "100%" : 300, ...se },
259
+ multiple: p,
260
+ options: Le,
261
+ value: p ? L : L[0] || null,
262
+ onChange: k,
263
+ inputValue: y,
272
264
  onInputChange: (t, o) => $(o),
273
265
  getOptionLabel: (t) => typeof t == "string" ? t : t.label,
274
266
  isOptionEqualToValue: (t, o) => t.id === o.id,
275
267
  getOptionDisabled: (t) => typeof t == "object" && t.disabled === !0,
276
- groupBy: Y ? (t) => t.group || "" : void 0,
268
+ groupBy: Z ? (t) => t.group || "" : void 0,
277
269
  filterOptions: r,
278
270
  renderInput: E,
279
- renderTags: u ? O : void 0,
280
- renderOption: (t, o, { selected: n }) => {
281
- const { key: c, ...C } = t;
282
- return H ? /* @__PURE__ */ e("li", { ...C, children: H(o, { selected: n }) }, c) : /* @__PURE__ */ m(de, { ...C, dense: !0, children: [
283
- u && W && /* @__PURE__ */ e(ee, { sx: { minWidth: 36 }, children: /* @__PURE__ */ e(
284
- fe,
271
+ renderValue: p ? F : void 0,
272
+ renderOption: (t, o, { selected: s }) => {
273
+ const { key: u, ...m } = t, z = o;
274
+ return J ? /* @__PURE__ */ e("li", { ...m, children: J(z, { selected: s }) }, u) : /* @__PURE__ */ f(pe, { ...m, dense: !0, children: [
275
+ p && j && /* @__PURE__ */ e(re, { sx: { minWidth: 36 }, children: /* @__PURE__ */ e(
276
+ ge,
285
277
  {
286
- icon: /* @__PURE__ */ e(
287
- k,
288
- {
289
- sx: {
290
- width: 18,
291
- height: 18,
292
- border: "2px solid",
293
- borderColor: "action.active",
294
- borderRadius: 0.5,
295
- backgroundColor: "transparent"
296
- }
297
- }
298
- ),
299
- checkedIcon: /* @__PURE__ */ e(
300
- k,
301
- {
302
- sx: {
303
- width: 18,
304
- height: 18,
305
- border: "2px solid",
306
- borderColor: "primary.main",
307
- borderRadius: 0.5,
308
- backgroundColor: "primary.main",
309
- display: "flex",
310
- alignItems: "center",
311
- justifyContent: "center"
312
- },
313
- children: /* @__PURE__ */ e(
314
- ae,
315
- {
316
- sx: {
317
- width: 14,
318
- height: 14,
319
- color: "primary.contrastText"
320
- }
321
- }
322
- )
323
- }
324
- ),
325
- checked: n,
278
+ icon: /* @__PURE__ */ e(C, { sx: { width: 18, height: 18, border: "2px solid", borderColor: "action.active", borderRadius: 0.5, backgroundColor: "transparent" } }),
279
+ checkedIcon: /* @__PURE__ */ e(C, { sx: { width: 18, height: 18, border: "2px solid", borderColor: "primary.main", borderRadius: 0.5, backgroundColor: "primary.main", display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ e(le, { sx: { width: 14, height: 14, color: "primary.contrastText" } }) }),
280
+ checked: s,
326
281
  size: "small"
327
282
  }
328
283
  ) }),
329
- o.icon && /* @__PURE__ */ e(ee, { sx: { minWidth: 36 }, children: o.icon }),
284
+ z.icon && /* @__PURE__ */ e(re, { sx: { minWidth: 36 }, children: z.icon }),
330
285
  /* @__PURE__ */ e(
331
- pe,
286
+ ue,
332
287
  {
333
- primary: o.label,
334
- secondary: o.secondary,
335
- primaryTypographyProps: { variant: "body2" },
336
- secondaryTypographyProps: { variant: "caption" }
288
+ primary: z.label,
289
+ secondary: z.secondary,
290
+ slotProps: { primary: { variant: "body2" }, secondary: { variant: "caption" } }
337
291
  }
338
292
  ),
339
- !u && n && /* @__PURE__ */ e(ae, { sx: { ml: 1, color: "primary.main" }, fontSize: "small" })
340
- ] }, c);
293
+ !p && s && /* @__PURE__ */ e(le, { sx: { ml: 1, color: "primary.main" }, fontSize: "small" })
294
+ ] }, u);
295
+ },
296
+ slots: {
297
+ paper: x || p && A ? i : de,
298
+ popper: Je
341
299
  },
342
- PaperComponent: b || u && T ? i : ce,
343
- PopperComponent: Ne,
344
300
  limitTags: q,
345
- disabled: X,
346
- loading: U,
347
- noOptionsText: l ? /* @__PURE__ */ e(_, { variant: "body2", color: "text.secondary", children: "Press Enter or click below to create" }) : G,
348
- freeSolo: h || b,
349
- autoHighlight: w,
350
- clearOnEscape: te,
351
- disableCloseOnSelect: u,
352
- ChipProps: {
353
- size: A,
354
- deleteIcon: /* @__PURE__ */ e(ye, { fontSize: "small" })
355
- }
301
+ disabled: Y,
302
+ loading: V,
303
+ noOptionsText: l ? /* @__PURE__ */ e(_, { variant: "body2", color: "text.secondary", children: "Press Enter or click below to create" }) : N,
304
+ freeSolo: g || x,
305
+ autoHighlight: I,
306
+ clearOnEscape: oe,
307
+ disableCloseOnSelect: p,
308
+ slotProps: { chip: { size: W, deleteIcon: /* @__PURE__ */ e(be, { fontSize: "small" }) } }
356
309
  }
357
310
  );
358
- }), Ce = (d) => {
359
- if (d === 0) return "0 Bytes";
360
- const p = 1024, s = ["Bytes", "KB", "MB", "GB"], D = Math.floor(Math.log(d) / Math.log(p));
361
- return parseFloat((d / Math.pow(p, D)).toFixed(2)) + " " + s[D];
362
- }, ke = (d) => d.startsWith("image/") ? /* @__PURE__ */ e(Ve, {}) : d.startsWith("video/") ? /* @__PURE__ */ e(qe, {}) : d === "application/pdf" ? /* @__PURE__ */ e(Ke, {}) : d.includes("document") || d.includes("text") ? /* @__PURE__ */ e(Ge, {}) : /* @__PURE__ */ e(je, {}), He = () => `file-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, dr = Le.forwardRef(function({
363
- variant: p = "dropzone",
364
- accept: s,
311
+ }), De = (c) => {
312
+ if (c === 0) return "0 Bytes";
313
+ const d = 1024, n = ["Bytes", "KB", "MB", "GB"], D = Math.floor(Math.log(c) / Math.log(d));
314
+ return parseFloat((c / Math.pow(d, D)).toFixed(2)) + " " + n[D];
315
+ }, Pe = (c) => c.startsWith("image/") ? /* @__PURE__ */ e(qe, {}) : c.startsWith("video/") ? /* @__PURE__ */ e(Ne, {}) : c === "application/pdf" ? /* @__PURE__ */ e(Ke, {}) : c.includes("document") || c.includes("text") ? /* @__PURE__ */ e(He, {}) : /* @__PURE__ */ e(Ve, {}), Qe = () => `file-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, ur = Fe.forwardRef(function({
316
+ variant: d = "dropzone",
317
+ accept: n,
365
318
  multiple: D = !1,
366
- maxSize: v,
367
- maxFiles: b,
368
- files: x,
319
+ maxSize: b,
320
+ maxFiles: x,
321
+ files: w,
369
322
  onFilesChange: M,
370
- onFileSelect: u,
371
- onFileRemove: Q,
372
- onUpload: K,
323
+ onFileSelect: p,
324
+ onFileRemove: X,
325
+ onUpload: G,
373
326
  disabled: a = !1,
374
- helperText: V,
375
- error: re,
376
- showFileList: X = !0,
377
- size: j = "medium",
378
- sx: A
327
+ helperText: K,
328
+ error: te,
329
+ showFileList: Y = !0,
330
+ size: U = "medium",
331
+ sx: W
379
332
  }, q) {
380
- const [W, Y] = ie([]), [U, G] = ie(!1), [N, H] = ie(null), z = Oe(null), h = x ?? W, w = S((r) => {
381
- typeof r == "function" ? M ? M(r(x ?? W)) : Y(r) : M ? M(r) : Y(r);
382
- }, [x, W, M]), te = (r) => v && r.size > v ? `File "${r.name}" exceeds maximum size of ${Ce(v)}` : b && h.length >= b ? `Maximum ${b} files allowed` : null, T = S(
333
+ const [j, Z] = ae([]), [V, N] = ae(!1), [H, J] = ae(null), T = Se(null), g = w ?? j, I = S((r) => {
334
+ typeof r == "function" ? M ? M(r(w ?? j)) : Z(r) : M ? M(r) : Z(r);
335
+ }, [w, j, M]), oe = (r) => b && r.size > b ? `File "${r.name}" exceeds maximum size of ${De(b)}` : x && g.length >= x ? `Maximum ${x} files allowed` : null, A = S(
383
336
  async (r) => {
384
- const l = Array.from(r), I = [], R = [];
385
- for (const y of l) {
386
- const f = te(y);
387
- if (f) {
388
- R.push(f);
337
+ const l = Array.from(r), k = [], R = [];
338
+ for (const v of l) {
339
+ const h = oe(v);
340
+ if (h) {
341
+ R.push(h);
389
342
  continue;
390
343
  }
391
344
  const E = {
392
- id: He(),
393
- file: y,
394
- name: y.name,
395
- size: y.size,
396
- type: y.type,
345
+ id: Qe(),
346
+ file: v,
347
+ name: v.name,
348
+ size: v.size,
349
+ type: v.type,
397
350
  progress: 0,
398
351
  status: "pending",
399
- preview: y.type.startsWith("image/") ? URL.createObjectURL(y) : void 0
352
+ preview: v.type.startsWith("image/") ? URL.createObjectURL(v) : void 0
400
353
  };
401
- I.push(E);
354
+ k.push(E);
402
355
  }
403
- if (R.length > 0 ? H(R[0]) : H(null), I.length > 0) {
404
- const y = D ? [...h, ...I] : I;
405
- if (w(y), u?.(I.map((f) => f.file)), K)
406
- for (const f of I)
356
+ if (R.length > 0 ? J(R[0]) : J(null), k.length > 0) {
357
+ const v = D ? [...g, ...k] : k;
358
+ if (I(v), p?.(k.map((h) => h.file)), G)
359
+ for (const h of k)
407
360
  try {
408
- w(
409
- (O) => O.map(
410
- (i) => i.id === f.id ? { ...i, status: "uploading" } : i
361
+ I(
362
+ (F) => F.map(
363
+ (i) => i.id === h.id ? { ...i, status: "uploading" } : i
411
364
  )
412
365
  );
413
366
  const E = setInterval(() => {
414
- w(
415
- (O) => O.map(
416
- (i) => i.id === f.id && i.progress < 90 ? { ...i, progress: i.progress + 10 } : i
367
+ I(
368
+ (F) => F.map(
369
+ (i) => i.id === h.id && i.progress < 90 ? { ...i, progress: i.progress + 10 } : i
417
370
  )
418
371
  );
419
372
  }, 200);
420
- await K(f.file), clearInterval(E), w(
421
- (O) => O.map(
422
- (i) => i.id === f.id ? { ...i, status: "complete", progress: 100 } : i
373
+ await G(h.file), clearInterval(E), I(
374
+ (F) => F.map(
375
+ (i) => i.id === h.id ? { ...i, status: "complete", progress: 100 } : i
423
376
  )
424
377
  );
425
378
  } catch (E) {
426
- w(
427
- (O) => O.map(
428
- (i) => i.id === f.id ? {
379
+ I(
380
+ (F) => F.map(
381
+ (i) => i.id === h.id ? {
429
382
  ...i,
430
383
  status: "error",
431
384
  error: E instanceof Error ? E.message : "Upload failed"
@@ -435,43 +388,43 @@ const ve = () => `new-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
435
388
  }
436
389
  }
437
390
  },
438
- [h, w, v, b, D, u, K]
439
- ), Z = S((r) => {
440
- r.preventDefault(), r.stopPropagation(), a || G(!0);
441
- }, [a]), oe = S((r) => {
442
- r.preventDefault(), r.stopPropagation(), G(!1);
443
- }, []), ne = S((r) => {
391
+ [g, I, b, x, D, p, G]
392
+ ), ee = S((r) => {
393
+ r.preventDefault(), r.stopPropagation(), a || N(!0);
394
+ }, [a]), ne = S((r) => {
395
+ r.preventDefault(), r.stopPropagation(), N(!1);
396
+ }, []), se = S((r) => {
444
397
  r.preventDefault(), r.stopPropagation();
445
- }, []), se = S(
398
+ }, []), ie = S(
446
399
  (r) => {
447
- if (r.preventDefault(), r.stopPropagation(), G(!1), a) return;
400
+ if (r.preventDefault(), r.stopPropagation(), N(!1), a) return;
448
401
  const l = r.dataTransfer.files;
449
- l.length > 0 && T(l);
402
+ l.length > 0 && A(l);
450
403
  },
451
- [a, T]
452
- ), J = S(
404
+ [a, A]
405
+ ), Q = S(
453
406
  (r) => {
454
407
  const l = r.target.files;
455
- l && l.length > 0 && T(l), z.current && (z.current.value = "");
408
+ l && l.length > 0 && A(l), T.current && (T.current.value = "");
456
409
  },
457
- [T]
458
- ), g = S(
410
+ [A]
411
+ ), y = S(
459
412
  (r) => {
460
413
  r.preview && URL.revokeObjectURL(r.preview);
461
- const l = h.filter((I) => I.id !== r.id);
462
- w(l), Q?.(r);
414
+ const l = g.filter((k) => k.id !== r.id);
415
+ I(l), X?.(r);
463
416
  },
464
- [h, w, Q]
417
+ [g, I, X]
465
418
  ), $ = () => {
466
- z.current?.click();
467
- }, P = re || N, B = /* @__PURE__ */ e(
419
+ T.current?.click();
420
+ }, P = te || H, B = /* @__PURE__ */ e(
468
421
  "input",
469
422
  {
470
- ref: z,
423
+ ref: T,
471
424
  type: "file",
472
- accept: s,
425
+ accept: n,
473
426
  multiple: D,
474
- onChange: J,
427
+ onChange: Q,
475
428
  style: { display: "none" },
476
429
  disabled: a
477
430
  }
@@ -481,27 +434,27 @@ const ve = () => `new-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
481
434
  },
482
435
  [a]
483
436
  );
484
- return p === "dropzone" ? /* @__PURE__ */ m(k, { ref: q, sx: A, children: [
437
+ return d === "dropzone" ? /* @__PURE__ */ f(C, { ref: q, sx: W, children: [
485
438
  B,
486
- /* @__PURE__ */ m(
487
- ce,
439
+ /* @__PURE__ */ f(
440
+ de,
488
441
  {
489
442
  role: "button",
490
443
  tabIndex: a ? -1 : 0,
491
- "aria-label": `Upload files${s ? `. Accepted formats: ${s}` : ""}. Drag and drop or press Enter to browse`,
444
+ "aria-label": `Upload files${n ? `. Accepted formats: ${n}` : ""}. Drag and drop or press Enter to browse`,
492
445
  "aria-disabled": a,
493
- onDragEnter: Z,
494
- onDragLeave: oe,
495
- onDragOver: ne,
496
- onDrop: se,
446
+ onDragEnter: ee,
447
+ onDragLeave: ne,
448
+ onDragOver: se,
449
+ onDrop: ie,
497
450
  onClick: $,
498
451
  onKeyDown: L,
499
452
  sx: {
500
- p: j === "small" ? 3 : 4,
453
+ p: U === "small" ? 3 : 4,
501
454
  border: "2px dashed",
502
- borderColor: P ? "error.main" : U ? "primary.main" : "divider",
503
- borderRadius: Ie.borders.radiusPx.lg,
504
- bgcolor: U ? "action.hover" : a ? "action.disabledBackground" : "background.paper",
455
+ borderColor: P ? "error.main" : V ? "primary.main" : "divider",
456
+ borderRadius: Ce.borders.radiusPx.lg,
457
+ bgcolor: V ? "action.hover" : a ? "action.disabledBackground" : "background.paper",
505
458
  textAlign: "center",
506
459
  cursor: a ? "not-allowed" : "pointer",
507
460
  transition: "all 0.2s ease",
@@ -512,61 +465,61 @@ const ve = () => `new-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
512
465
  },
513
466
  children: [
514
467
  /* @__PURE__ */ e(
515
- le,
468
+ ce,
516
469
  {
517
470
  sx: {
518
- fontSize: j === "small" ? 40 : 56,
519
- color: U ? "primary.main" : "action.active",
471
+ fontSize: U === "small" ? 40 : 56,
472
+ color: V ? "primary.main" : "action.active",
520
473
  mb: 2
521
474
  }
522
475
  }
523
476
  ),
524
- /* @__PURE__ */ e(_, { variant: j === "small" ? "body1" : "h6", gutterBottom: !0, children: U ? "Drop files here" : "Drag & drop files here" }),
477
+ /* @__PURE__ */ e(_, { variant: U === "small" ? "body1" : "h6", gutterBottom: !0, children: V ? "Drop files here" : "Drag & drop files here" }),
525
478
  /* @__PURE__ */ e(_, { variant: "body2", color: "text.secondary", gutterBottom: !0, children: "or click to browse" }),
526
- V && /* @__PURE__ */ e(_, { variant: "caption", color: "text.secondary", children: V })
479
+ K && /* @__PURE__ */ e(_, { variant: "caption", color: "text.secondary", children: K })
527
480
  ]
528
481
  }
529
482
  ),
530
- P && /* @__PURE__ */ e(ge, { severity: "error", sx: { mt: 2 }, children: P }),
531
- X && h.length > 0 && /* @__PURE__ */ e(be, { files: h, onRemove: g })
532
- ] }) : p === "button" ? /* @__PURE__ */ m(k, { ref: q, sx: A, children: [
483
+ P && /* @__PURE__ */ e(ve, { severity: "error", sx: { mt: 2 }, children: P }),
484
+ Y && g.length > 0 && /* @__PURE__ */ e(we, { files: g, onRemove: y })
485
+ ] }) : d === "button" ? /* @__PURE__ */ f(C, { ref: q, sx: W, children: [
533
486
  B,
534
- /* @__PURE__ */ m(
535
- ue,
487
+ /* @__PURE__ */ f(
488
+ me,
536
489
  {
537
490
  variant: "contained",
538
- startIcon: /* @__PURE__ */ e(le, {}),
491
+ startIcon: /* @__PURE__ */ e(ce, {}),
539
492
  onClick: $,
540
493
  disabled: a,
541
- size: j,
494
+ size: U,
542
495
  children: [
543
496
  "Upload ",
544
497
  D ? "Files" : "File"
545
498
  ]
546
499
  }
547
500
  ),
548
- P && /* @__PURE__ */ e(ge, { severity: "error", sx: { mt: 2 }, children: P }),
549
- X && h.length > 0 && /* @__PURE__ */ e(be, { files: h, onRemove: g })
550
- ] }) : /* @__PURE__ */ m(k, { ref: q, sx: A, children: [
501
+ P && /* @__PURE__ */ e(ve, { severity: "error", sx: { mt: 2 }, children: P }),
502
+ Y && g.length > 0 && /* @__PURE__ */ e(we, { files: g, onRemove: y })
503
+ ] }) : /* @__PURE__ */ f(C, { ref: q, sx: W, children: [
551
504
  B,
552
- /* @__PURE__ */ m(Be, { direction: "row", spacing: 1, alignItems: "center", flexWrap: "wrap", useFlexGap: !0, children: [
505
+ /* @__PURE__ */ f(ze, { direction: "row", spacing: 1, useFlexGap: !0, sx: { alignItems: "center", flexWrap: "wrap" }, children: [
553
506
  /* @__PURE__ */ e(
554
- ue,
507
+ me,
555
508
  {
556
509
  variant: "outlined",
557
510
  size: "small",
558
- startIcon: /* @__PURE__ */ e(le, {}),
511
+ startIcon: /* @__PURE__ */ e(ce, {}),
559
512
  onClick: $,
560
513
  disabled: a,
561
514
  children: "Browse"
562
515
  }
563
516
  ),
564
- h.map((r) => /* @__PURE__ */ e(
565
- xe,
517
+ g.map((r) => /* @__PURE__ */ e(
518
+ Ie,
566
519
  {
567
- icon: r.status === "complete" ? /* @__PURE__ */ e(we, {}) : ke(r.type),
520
+ icon: r.status === "complete" ? /* @__PURE__ */ e(ke, {}) : Pe(r.type),
568
521
  label: r.name,
569
- onDelete: () => g(r),
522
+ onDelete: () => y(r),
570
523
  color: r.status === "error" ? "error" : r.status === "complete" ? "success" : "default",
571
524
  size: "small",
572
525
  sx: {
@@ -582,27 +535,27 @@ const ve = () => `new-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
582
535
  ] }),
583
536
  P && /* @__PURE__ */ e(_, { variant: "caption", color: "error", sx: { mt: 0.5, display: "block" }, children: P })
584
537
  ] });
585
- }), be = ({ files: d, onRemove: p }) => /* @__PURE__ */ e(Ee, { dense: !0, sx: { mt: 2 }, children: d.map((s) => /* @__PURE__ */ m(
586
- de,
538
+ }), we = ({ files: c, onRemove: d }) => /* @__PURE__ */ e(We, { dense: !0, sx: { mt: 2 }, children: c.map((n) => /* @__PURE__ */ f(
539
+ pe,
587
540
  {
588
541
  sx: {
589
542
  bgcolor: "background.paper",
590
- borderRadius: Ie.borders.radiusPx.md,
543
+ borderRadius: Ce.borders.radiusPx.md,
591
544
  mb: 1,
592
545
  border: "1px solid",
593
- borderColor: s.status === "error" ? "error.light" : "divider"
546
+ borderColor: n.status === "error" ? "error.light" : "divider"
594
547
  },
595
548
  children: [
596
- /* @__PURE__ */ e(ee, { children: s.status === "complete" ? /* @__PURE__ */ e(we, { color: "success" }) : s.status === "error" ? /* @__PURE__ */ e(_e, { color: "error" }) : ke(s.type) }),
549
+ /* @__PURE__ */ e(re, { children: n.status === "complete" ? /* @__PURE__ */ e(ke, { color: "success" }) : n.status === "error" ? /* @__PURE__ */ e(Ge, { color: "error" }) : Pe(n.type) }),
597
550
  /* @__PURE__ */ e(
598
- pe,
551
+ ue,
599
552
  {
600
- primary: s.name,
601
- secondary: /* @__PURE__ */ m(k, { component: "span", children: [
602
- Ce(s.size),
603
- s.error && /* @__PURE__ */ m(_, { component: "span", color: "error", sx: { ml: 1 }, children: [
553
+ primary: n.name,
554
+ secondary: /* @__PURE__ */ f(C, { component: "span", children: [
555
+ De(n.size),
556
+ n.error && /* @__PURE__ */ f(_, { component: "span", color: "error", sx: { ml: 1 }, children: [
604
557
  "• ",
605
- s.error
558
+ n.error
606
559
  ] })
607
560
  ] }),
608
561
  sx: {
@@ -614,13 +567,13 @@ const ve = () => `new-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
614
567
  }
615
568
  }
616
569
  ),
617
- s.status === "uploading" && /* @__PURE__ */ e(k, { sx: { width: 100, mr: 2 }, children: /* @__PURE__ */ e(Ae, { variant: "determinate", value: s.progress }) }),
618
- /* @__PURE__ */ e(We, { children: /* @__PURE__ */ e(ze, { edge: "end", onClick: () => p(s), size: "small", children: /* @__PURE__ */ e(Ue, { fontSize: "small" }) }) })
570
+ n.status === "uploading" && /* @__PURE__ */ e(C, { sx: { width: 100, mr: 2 }, children: /* @__PURE__ */ e(je, { variant: "determinate", value: n.progress }) }),
571
+ /* @__PURE__ */ e(Te, { children: /* @__PURE__ */ e($e, { edge: "end", onClick: () => d(n), size: "small", children: /* @__PURE__ */ e(_e, { fontSize: "small" }) }) })
619
572
  ]
620
573
  },
621
- s.id
574
+ n.id
622
575
  )) });
623
576
  export {
624
- cr as C,
625
- dr as F
577
+ pr as C,
578
+ ur as F
626
579
  };