@trinityui/design-system 2.2.1 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +152 -0
- package/dist/Legend.js +12 -15
- package/dist/app-shell.js +145 -163
- package/dist/charts.js +2820 -2777
- package/dist/components/AI/AIChat.d.ts.map +1 -1
- package/dist/components/AI/AIMessage.d.ts.map +1 -1
- package/dist/components/AI/AISources.d.ts.map +1 -1
- package/dist/components/AI/ChatHeader.d.ts.map +1 -1
- package/dist/components/AI/ChatHistoryList.d.ts.map +1 -1
- package/dist/components/AI/ChatThread.d.ts.map +1 -1
- package/dist/components/AI/InsightEngineInput.d.ts.map +1 -1
- package/dist/components/AppLayout/InsightEnginePanel.d.ts.map +1 -1
- package/dist/components/AppLayout/ThreadHistorySidebar.d.ts.map +1 -1
- package/dist/components/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/components/Combobox/Combobox.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/components/DataCard/DataCard.d.ts.map +1 -1
- package/dist/components/DataTable/CellRenderers.d.ts.map +1 -1
- package/dist/components/DockLayout/DockLayout.d.ts.map +1 -1
- package/dist/components/IllustratedMessage.d.ts.map +1 -1
- package/dist/components/MentionsInput/MentionsInput.d.ts +1 -1
- package/dist/components/MentionsInput/MentionsInput.d.ts.map +1 -1
- package/dist/components/PageHeader/PageHeader.d.ts.map +1 -1
- package/dist/components/PredictiveTextInput/PredictiveTextInput.d.ts.map +1 -1
- package/dist/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/components/StatusIndicator/Legend.d.ts.map +1 -1
- package/dist/components/StatusIndicator/StatusIndicator.d.ts.map +1 -1
- package/dist/components/Timeline/Timeline.d.ts.map +1 -1
- package/dist/components/TopNavHeader.d.ts.map +1 -1
- package/dist/components/TopNavWithSidebar.d.ts.map +1 -1
- package/dist/components/TransferList/TransferList.d.ts.map +1 -1
- package/dist/components/navigation/components.d.ts.map +1 -1
- package/dist/components/templates/ListDetail/ListDetailTemplate.d.ts.map +1 -1
- package/dist/components/templates/Settings/SettingsTemplate.d.ts.map +1 -1
- package/dist/data-table2.js +1383 -1382
- package/dist/data.js +5 -5
- package/dist/essentials.js +4 -4
- package/dist/forms.js +292 -339
- package/dist/index.js +15472 -15476
- package/dist/trinity.css +1 -1
- package/package.json +32 -32
package/dist/forms.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import { useTheme as
|
|
5
|
-
import { Check as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
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
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import { s as
|
|
16
|
-
const
|
|
17
|
-
|
|
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
|
-
...
|
|
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
|
-
),
|
|
31
|
-
options:
|
|
32
|
-
value:
|
|
30
|
+
), pr = O.forwardRef(function({
|
|
31
|
+
options: d,
|
|
32
|
+
value: n,
|
|
33
33
|
defaultValue: D,
|
|
34
|
-
onChange:
|
|
35
|
-
creatable:
|
|
36
|
-
onCreate:
|
|
34
|
+
onChange: b,
|
|
35
|
+
creatable: x = !1,
|
|
36
|
+
onCreate: w,
|
|
37
37
|
createText: M = 'Create "{value}"',
|
|
38
|
-
multiple:
|
|
39
|
-
placeholder:
|
|
40
|
-
label:
|
|
38
|
+
multiple: p = !1,
|
|
39
|
+
placeholder: X = "Select...",
|
|
40
|
+
label: G,
|
|
41
41
|
helperText: a,
|
|
42
|
-
error:
|
|
43
|
-
errorMessage:
|
|
44
|
-
disabled:
|
|
45
|
-
fullWidth:
|
|
46
|
-
size:
|
|
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:
|
|
49
|
-
groupBy:
|
|
50
|
-
loading:
|
|
51
|
-
noOptionsText:
|
|
52
|
-
filterOptions:
|
|
53
|
-
renderOption:
|
|
54
|
-
renderTag:
|
|
55
|
-
freeSolo:
|
|
56
|
-
autoHighlight:
|
|
57
|
-
clearOnEscape:
|
|
58
|
-
showSelectAll:
|
|
59
|
-
selectAllText:
|
|
60
|
-
className:
|
|
61
|
-
sx:
|
|
62
|
-
},
|
|
63
|
-
const
|
|
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 =
|
|
65
|
+
), L = n !== void 0 ? n : P, r = O.useCallback(
|
|
66
66
|
(t, o) => {
|
|
67
|
-
if (
|
|
68
|
-
return
|
|
69
|
-
const
|
|
67
|
+
if (H)
|
|
68
|
+
return H(t, o);
|
|
69
|
+
const s = o.inputValue.toLowerCase();
|
|
70
70
|
return t.filter(
|
|
71
|
-
(
|
|
71
|
+
(u) => u.label.toLowerCase().includes(s) || u.secondary?.toLowerCase().includes(s)
|
|
72
72
|
);
|
|
73
73
|
},
|
|
74
|
-
[
|
|
75
|
-
), l =
|
|
76
|
-
(o) => o.label.toLowerCase() ===
|
|
77
|
-
), [
|
|
78
|
-
let
|
|
79
|
-
if (
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
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 ?
|
|
86
|
-
B(
|
|
87
|
-
}, R =
|
|
88
|
-
const t =
|
|
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((
|
|
90
|
+
(o) => L.some((s) => s.id === o.id)
|
|
91
91
|
);
|
|
92
|
-
}, [
|
|
92
|
+
}, [d, L]), v = O.useCallback(() => {
|
|
93
93
|
if (R)
|
|
94
|
-
B([]),
|
|
94
|
+
B([]), b?.([]);
|
|
95
95
|
else {
|
|
96
|
-
const t =
|
|
97
|
-
B(t),
|
|
96
|
+
const t = d.filter((o) => !o.disabled);
|
|
97
|
+
B(t), b?.(t);
|
|
98
98
|
}
|
|
99
|
-
}, [R,
|
|
100
|
-
if (!l || !
|
|
101
|
-
const t = await
|
|
102
|
-
B(o),
|
|
103
|
-
}, [l,
|
|
104
|
-
|
|
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:
|
|
108
|
-
placeholder: L.length === 0 ?
|
|
109
|
-
error:
|
|
110
|
-
helperText:
|
|
111
|
-
size:
|
|
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
|
-
),
|
|
122
|
-
const
|
|
123
|
-
return
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
|
-
}
|
|
133
|
+
);
|
|
134
|
+
});
|
|
135
|
+
}, i = O.useCallback(
|
|
141
136
|
(t) => {
|
|
142
|
-
const { children: o, ...
|
|
143
|
-
return /* @__PURE__ */
|
|
144
|
-
|
|
145
|
-
|
|
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: (
|
|
148
|
-
|
|
142
|
+
onMouseDown: (u) => {
|
|
143
|
+
u.preventDefault(), u.stopPropagation();
|
|
149
144
|
},
|
|
150
|
-
onClick: (
|
|
151
|
-
|
|
145
|
+
onClick: (u) => {
|
|
146
|
+
u.preventDefault(), u.stopPropagation(), v();
|
|
152
147
|
},
|
|
153
148
|
children: [
|
|
154
|
-
/* @__PURE__ */
|
|
155
|
-
|
|
149
|
+
/* @__PURE__ */ f(
|
|
150
|
+
pe,
|
|
156
151
|
{
|
|
157
152
|
dense: !0,
|
|
158
153
|
sx: {
|
|
159
154
|
cursor: "pointer",
|
|
160
155
|
"&:hover": {
|
|
161
|
-
backgroundColor:
|
|
156
|
+
backgroundColor: he(Q.palette.primary.main, 0.08)
|
|
162
157
|
}
|
|
163
158
|
},
|
|
164
159
|
children: [
|
|
165
|
-
|
|
166
|
-
|
|
160
|
+
j && /* @__PURE__ */ e(re, { sx: { minWidth: 36, pointerEvents: "none" }, children: /* @__PURE__ */ e(
|
|
161
|
+
ge,
|
|
167
162
|
{
|
|
168
163
|
icon: /* @__PURE__ */ e(
|
|
169
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
209
|
+
ue,
|
|
215
210
|
{
|
|
216
|
-
primary: R ? "Deselect All" :
|
|
217
|
-
|
|
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(
|
|
221
|
+
/* @__PURE__ */ e(ye, {})
|
|
227
222
|
]
|
|
228
223
|
}
|
|
229
224
|
),
|
|
230
225
|
o,
|
|
231
|
-
l && /* @__PURE__ */
|
|
232
|
-
/* @__PURE__ */ e(
|
|
226
|
+
l && /* @__PURE__ */ f(Re, { children: [
|
|
227
|
+
/* @__PURE__ */ e(ye, {}),
|
|
233
228
|
/* @__PURE__ */ e(
|
|
234
|
-
|
|
229
|
+
me,
|
|
235
230
|
{
|
|
236
231
|
fullWidth: !0,
|
|
237
|
-
startIcon: /* @__PURE__ */ e(
|
|
238
|
-
onClick:
|
|
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:
|
|
242
|
+
backgroundColor: he(Q.palette.primary.main, 0.08)
|
|
248
243
|
}
|
|
249
244
|
},
|
|
250
|
-
children: M.replace("{value}",
|
|
245
|
+
children: M.replace("{value}", y)
|
|
251
246
|
}
|
|
252
247
|
)
|
|
253
248
|
] })
|
|
254
249
|
] });
|
|
255
250
|
},
|
|
256
|
-
[l, M,
|
|
257
|
-
),
|
|
251
|
+
[l, M, y, Q.palette.primary.main, h, p, A, j, v, R, ee]
|
|
252
|
+
), Le = d;
|
|
258
253
|
return /* @__PURE__ */ e(
|
|
259
|
-
|
|
254
|
+
Ae,
|
|
260
255
|
{
|
|
261
|
-
ref:
|
|
262
|
-
className:
|
|
263
|
-
sx: {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
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:
|
|
268
|
+
groupBy: Z ? (t) => t.group || "" : void 0,
|
|
277
269
|
filterOptions: r,
|
|
278
270
|
renderInput: E,
|
|
279
|
-
|
|
280
|
-
renderOption: (t, o, { selected:
|
|
281
|
-
const { key:
|
|
282
|
-
return
|
|
283
|
-
|
|
284
|
-
|
|
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
|
-
|
|
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
|
-
|
|
284
|
+
z.icon && /* @__PURE__ */ e(re, { sx: { minWidth: 36 }, children: z.icon }),
|
|
330
285
|
/* @__PURE__ */ e(
|
|
331
|
-
|
|
286
|
+
ue,
|
|
332
287
|
{
|
|
333
|
-
primary:
|
|
334
|
-
secondary:
|
|
335
|
-
|
|
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
|
-
!
|
|
340
|
-
] },
|
|
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:
|
|
346
|
-
loading:
|
|
347
|
-
noOptionsText: l ? /* @__PURE__ */ e(_, { variant: "body2", color: "text.secondary", children: "Press Enter or click below to create" }) :
|
|
348
|
-
freeSolo:
|
|
349
|
-
autoHighlight:
|
|
350
|
-
clearOnEscape:
|
|
351
|
-
disableCloseOnSelect:
|
|
352
|
-
|
|
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
|
-
}),
|
|
359
|
-
if (
|
|
360
|
-
const
|
|
361
|
-
return parseFloat((
|
|
362
|
-
},
|
|
363
|
-
variant:
|
|
364
|
-
accept:
|
|
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:
|
|
367
|
-
maxFiles:
|
|
368
|
-
files:
|
|
319
|
+
maxSize: b,
|
|
320
|
+
maxFiles: x,
|
|
321
|
+
files: w,
|
|
369
322
|
onFilesChange: M,
|
|
370
|
-
onFileSelect:
|
|
371
|
-
onFileRemove:
|
|
372
|
-
onUpload:
|
|
323
|
+
onFileSelect: p,
|
|
324
|
+
onFileRemove: X,
|
|
325
|
+
onUpload: G,
|
|
373
326
|
disabled: a = !1,
|
|
374
|
-
helperText:
|
|
375
|
-
error:
|
|
376
|
-
showFileList:
|
|
377
|
-
size:
|
|
378
|
-
sx:
|
|
327
|
+
helperText: K,
|
|
328
|
+
error: te,
|
|
329
|
+
showFileList: Y = !0,
|
|
330
|
+
size: U = "medium",
|
|
331
|
+
sx: W
|
|
379
332
|
}, q) {
|
|
380
|
-
const [
|
|
381
|
-
typeof r == "function" ? M ? M(r(
|
|
382
|
-
}, [
|
|
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),
|
|
385
|
-
for (const
|
|
386
|
-
const
|
|
387
|
-
if (
|
|
388
|
-
R.push(
|
|
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:
|
|
393
|
-
file:
|
|
394
|
-
name:
|
|
395
|
-
size:
|
|
396
|
-
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:
|
|
352
|
+
preview: v.type.startsWith("image/") ? URL.createObjectURL(v) : void 0
|
|
400
353
|
};
|
|
401
|
-
|
|
354
|
+
k.push(E);
|
|
402
355
|
}
|
|
403
|
-
if (R.length > 0 ?
|
|
404
|
-
const
|
|
405
|
-
if (
|
|
406
|
-
for (const
|
|
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
|
-
|
|
409
|
-
(
|
|
410
|
-
(i) => i.id ===
|
|
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
|
-
|
|
415
|
-
(
|
|
416
|
-
(i) => i.id ===
|
|
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
|
|
421
|
-
(
|
|
422
|
-
(i) => i.id ===
|
|
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
|
-
|
|
427
|
-
(
|
|
428
|
-
(i) => i.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
|
-
[
|
|
439
|
-
),
|
|
440
|
-
r.preventDefault(), r.stopPropagation(), a ||
|
|
441
|
-
}, [a]),
|
|
442
|
-
r.preventDefault(), r.stopPropagation(),
|
|
443
|
-
}, []),
|
|
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
|
-
}, []),
|
|
398
|
+
}, []), ie = S(
|
|
446
399
|
(r) => {
|
|
447
|
-
if (r.preventDefault(), r.stopPropagation(),
|
|
400
|
+
if (r.preventDefault(), r.stopPropagation(), N(!1), a) return;
|
|
448
401
|
const l = r.dataTransfer.files;
|
|
449
|
-
l.length > 0 &&
|
|
402
|
+
l.length > 0 && A(l);
|
|
450
403
|
},
|
|
451
|
-
[a,
|
|
452
|
-
),
|
|
404
|
+
[a, A]
|
|
405
|
+
), Q = S(
|
|
453
406
|
(r) => {
|
|
454
407
|
const l = r.target.files;
|
|
455
|
-
l && l.length > 0 &&
|
|
408
|
+
l && l.length > 0 && A(l), T.current && (T.current.value = "");
|
|
456
409
|
},
|
|
457
|
-
[
|
|
458
|
-
),
|
|
410
|
+
[A]
|
|
411
|
+
), y = S(
|
|
459
412
|
(r) => {
|
|
460
413
|
r.preview && URL.revokeObjectURL(r.preview);
|
|
461
|
-
const l =
|
|
462
|
-
|
|
414
|
+
const l = g.filter((k) => k.id !== r.id);
|
|
415
|
+
I(l), X?.(r);
|
|
463
416
|
},
|
|
464
|
-
[
|
|
417
|
+
[g, I, X]
|
|
465
418
|
), $ = () => {
|
|
466
|
-
|
|
467
|
-
}, P =
|
|
419
|
+
T.current?.click();
|
|
420
|
+
}, P = te || H, B = /* @__PURE__ */ e(
|
|
468
421
|
"input",
|
|
469
422
|
{
|
|
470
|
-
ref:
|
|
423
|
+
ref: T,
|
|
471
424
|
type: "file",
|
|
472
|
-
accept:
|
|
425
|
+
accept: n,
|
|
473
426
|
multiple: D,
|
|
474
|
-
onChange:
|
|
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
|
|
437
|
+
return d === "dropzone" ? /* @__PURE__ */ f(C, { ref: q, sx: W, children: [
|
|
485
438
|
B,
|
|
486
|
-
/* @__PURE__ */
|
|
487
|
-
|
|
439
|
+
/* @__PURE__ */ f(
|
|
440
|
+
de,
|
|
488
441
|
{
|
|
489
442
|
role: "button",
|
|
490
443
|
tabIndex: a ? -1 : 0,
|
|
491
|
-
"aria-label": `Upload files${
|
|
444
|
+
"aria-label": `Upload files${n ? `. Accepted formats: ${n}` : ""}. Drag and drop or press Enter to browse`,
|
|
492
445
|
"aria-disabled": a,
|
|
493
|
-
onDragEnter:
|
|
494
|
-
onDragLeave:
|
|
495
|
-
onDragOver:
|
|
496
|
-
onDrop:
|
|
446
|
+
onDragEnter: ee,
|
|
447
|
+
onDragLeave: ne,
|
|
448
|
+
onDragOver: se,
|
|
449
|
+
onDrop: ie,
|
|
497
450
|
onClick: $,
|
|
498
451
|
onKeyDown: L,
|
|
499
452
|
sx: {
|
|
500
|
-
p:
|
|
453
|
+
p: U === "small" ? 3 : 4,
|
|
501
454
|
border: "2px dashed",
|
|
502
|
-
borderColor: P ? "error.main" :
|
|
503
|
-
borderRadius:
|
|
504
|
-
bgcolor:
|
|
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
|
-
|
|
468
|
+
ce,
|
|
516
469
|
{
|
|
517
470
|
sx: {
|
|
518
|
-
fontSize:
|
|
519
|
-
color:
|
|
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:
|
|
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
|
-
|
|
479
|
+
K && /* @__PURE__ */ e(_, { variant: "caption", color: "text.secondary", children: K })
|
|
527
480
|
]
|
|
528
481
|
}
|
|
529
482
|
),
|
|
530
|
-
P && /* @__PURE__ */ e(
|
|
531
|
-
|
|
532
|
-
] }) :
|
|
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__ */
|
|
535
|
-
|
|
487
|
+
/* @__PURE__ */ f(
|
|
488
|
+
me,
|
|
536
489
|
{
|
|
537
490
|
variant: "contained",
|
|
538
|
-
startIcon: /* @__PURE__ */ e(
|
|
491
|
+
startIcon: /* @__PURE__ */ e(ce, {}),
|
|
539
492
|
onClick: $,
|
|
540
493
|
disabled: a,
|
|
541
|
-
size:
|
|
494
|
+
size: U,
|
|
542
495
|
children: [
|
|
543
496
|
"Upload ",
|
|
544
497
|
D ? "Files" : "File"
|
|
545
498
|
]
|
|
546
499
|
}
|
|
547
500
|
),
|
|
548
|
-
P && /* @__PURE__ */ e(
|
|
549
|
-
|
|
550
|
-
] }) : /* @__PURE__ */
|
|
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__ */
|
|
505
|
+
/* @__PURE__ */ f(ze, { direction: "row", spacing: 1, useFlexGap: !0, sx: { alignItems: "center", flexWrap: "wrap" }, children: [
|
|
553
506
|
/* @__PURE__ */ e(
|
|
554
|
-
|
|
507
|
+
me,
|
|
555
508
|
{
|
|
556
509
|
variant: "outlined",
|
|
557
510
|
size: "small",
|
|
558
|
-
startIcon: /* @__PURE__ */ e(
|
|
511
|
+
startIcon: /* @__PURE__ */ e(ce, {}),
|
|
559
512
|
onClick: $,
|
|
560
513
|
disabled: a,
|
|
561
514
|
children: "Browse"
|
|
562
515
|
}
|
|
563
516
|
),
|
|
564
|
-
|
|
565
|
-
|
|
517
|
+
g.map((r) => /* @__PURE__ */ e(
|
|
518
|
+
Ie,
|
|
566
519
|
{
|
|
567
|
-
icon: r.status === "complete" ? /* @__PURE__ */ e(
|
|
520
|
+
icon: r.status === "complete" ? /* @__PURE__ */ e(ke, {}) : Pe(r.type),
|
|
568
521
|
label: r.name,
|
|
569
|
-
onDelete: () =>
|
|
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
|
-
}),
|
|
586
|
-
|
|
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:
|
|
543
|
+
borderRadius: Ce.borders.radiusPx.md,
|
|
591
544
|
mb: 1,
|
|
592
545
|
border: "1px solid",
|
|
593
|
-
borderColor:
|
|
546
|
+
borderColor: n.status === "error" ? "error.light" : "divider"
|
|
594
547
|
},
|
|
595
548
|
children: [
|
|
596
|
-
/* @__PURE__ */ e(
|
|
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
|
-
|
|
551
|
+
ue,
|
|
599
552
|
{
|
|
600
|
-
primary:
|
|
601
|
-
secondary: /* @__PURE__ */
|
|
602
|
-
|
|
603
|
-
|
|
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
|
-
|
|
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
|
-
|
|
618
|
-
/* @__PURE__ */ e(
|
|
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
|
-
|
|
574
|
+
n.id
|
|
622
575
|
)) });
|
|
623
576
|
export {
|
|
624
|
-
|
|
625
|
-
|
|
577
|
+
pr as C,
|
|
578
|
+
ur as F
|
|
626
579
|
};
|