@trinitydesign/design-system 1.2.0
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 +167 -0
- package/CONTRIBUTING.md +394 -0
- package/MIGRATION.md +347 -0
- package/README.md +142 -0
- package/dist/ai.js +6155 -0
- package/dist/charts.js +2650 -0
- package/dist/data.js +1516 -0
- package/dist/forms.js +971 -0
- package/dist/index.js +5897 -0
- package/dist/navigation.js +2977 -0
- package/dist/theme.js +1289 -0
- package/dist/tokens.js +25 -0
- package/package.json +129 -0
package/dist/forms.js
ADDED
|
@@ -0,0 +1,971 @@
|
|
|
1
|
+
import { jsxs as L, Fragment as Se, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as a from "react";
|
|
3
|
+
import { createElement as Le, useState as ie, useRef as Ie, useCallback as K } from "react";
|
|
4
|
+
import { useTheme as ce, Paper as oe, Divider as ge, Button as ae, alpha as de, Autocomplete as ze, Typography as te, ListItem as ye, ListItemIcon as se, Checkbox as we, Box as J, ListItemText as ve, Popper as Fe, Chip as Ce, TextField as De, Alert as ue, Stack as Be, List as Re, LinearProgress as Te, ListItemSecondaryAction as Ee, IconButton as V, Tooltip as g, ToggleButtonGroup as Pe, ToggleButton as q, FormControl as Ue, Select as Ae, MenuItem as X } from "@mui/material";
|
|
5
|
+
import { Add as qe, Close as me, Check as he, FullscreenExit as Me, Fullscreen as Oe, FormatClear as je, Redo as He, Undo as We, FormatAlignLeft as $e, FormatAlignCenter as Ke, FormatAlignRight as Ve, FormatAlignJustify as Ge, Image as Ne, Link as _e, Code as Je, FormatQuote as Qe, FormatListNumbered as Ye, FormatListBulleted as Ze, StrikethroughS as Xe, FormatUnderlined as et, FormatItalic as tt, FormatBold as rt } from "@mui/icons-material";
|
|
6
|
+
import le from "@mui/icons-material/CloudUpload";
|
|
7
|
+
import nt from "@mui/icons-material/InsertDriveFile";
|
|
8
|
+
import ot from "@mui/icons-material/Delete";
|
|
9
|
+
import xe from "@mui/icons-material/CheckCircle";
|
|
10
|
+
import it from "@mui/icons-material/Error";
|
|
11
|
+
import lt from "@mui/icons-material/PictureAsPdf";
|
|
12
|
+
import at from "@mui/icons-material/Image";
|
|
13
|
+
import st from "@mui/icons-material/VideoLibrary";
|
|
14
|
+
import ct from "@mui/icons-material/Description";
|
|
15
|
+
const fe = () => `new-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, dt = (l) => /* @__PURE__ */ e(
|
|
16
|
+
Fe,
|
|
17
|
+
{
|
|
18
|
+
...l,
|
|
19
|
+
placement: "bottom-start",
|
|
20
|
+
modifiers: [
|
|
21
|
+
{
|
|
22
|
+
name: "offset",
|
|
23
|
+
options: {
|
|
24
|
+
offset: [0, 4]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
), wt = ({
|
|
30
|
+
options: l,
|
|
31
|
+
value: h,
|
|
32
|
+
defaultValue: s,
|
|
33
|
+
onChange: v,
|
|
34
|
+
creatable: m = !1,
|
|
35
|
+
onCreate: C,
|
|
36
|
+
createText: I = 'Create "{value}"',
|
|
37
|
+
multiple: f = !1,
|
|
38
|
+
placeholder: G = "Select...",
|
|
39
|
+
label: M,
|
|
40
|
+
helperText: u,
|
|
41
|
+
error: T = !1,
|
|
42
|
+
errorMessage: Q,
|
|
43
|
+
disabled: O = !1,
|
|
44
|
+
fullWidth: p = !1,
|
|
45
|
+
size: c = "medium",
|
|
46
|
+
limitTags: d = 3,
|
|
47
|
+
showCheckbox: j = !0,
|
|
48
|
+
groupBy: E = !1,
|
|
49
|
+
loading: w = !1,
|
|
50
|
+
noOptionsText: H = "No options",
|
|
51
|
+
filterOptions: x,
|
|
52
|
+
renderOption: y,
|
|
53
|
+
renderTag: k,
|
|
54
|
+
freeSolo: F = !1,
|
|
55
|
+
autoHighlight: re = !0,
|
|
56
|
+
clearOnEscape: N = !0,
|
|
57
|
+
className: ne,
|
|
58
|
+
sx: ee
|
|
59
|
+
}) => {
|
|
60
|
+
const R = ce(), [D, P] = a.useState(""), [Y, W] = a.useState(
|
|
61
|
+
s || []
|
|
62
|
+
), b = h !== void 0 ? h : Y, _ = a.useCallback(
|
|
63
|
+
(t, o) => {
|
|
64
|
+
if (x)
|
|
65
|
+
return x(t, o);
|
|
66
|
+
const i = o.inputValue.toLowerCase();
|
|
67
|
+
return t.filter(
|
|
68
|
+
(U) => U.label.toLowerCase().includes(i) || U.secondary?.toLowerCase().includes(i)
|
|
69
|
+
);
|
|
70
|
+
},
|
|
71
|
+
[x]
|
|
72
|
+
), $ = a.useMemo(() => !m || !D.trim() ? !1 : !l.some(
|
|
73
|
+
(o) => o.label.toLowerCase() === D.toLowerCase()
|
|
74
|
+
), [m, D, l]), n = async (t, o) => {
|
|
75
|
+
let i;
|
|
76
|
+
if (f) {
|
|
77
|
+
const U = o || [];
|
|
78
|
+
i = await Promise.all(
|
|
79
|
+
U.map(async (A) => typeof A == "string" ? m && C ? await C(A) : { id: fe(), label: A } : A)
|
|
80
|
+
);
|
|
81
|
+
} else
|
|
82
|
+
o === null ? i = [] : typeof o == "string" ? m && C ? i = [await C(o)] : i = [{ id: fe(), label: o }] : i = [o];
|
|
83
|
+
W(i), v?.(i);
|
|
84
|
+
}, S = a.useCallback(async () => {
|
|
85
|
+
if (!$ || !C) return;
|
|
86
|
+
const t = await C(D), o = f ? [...b, t] : [t];
|
|
87
|
+
W(o), v?.(o), P("");
|
|
88
|
+
}, [$, C, D, f, b, v]), B = (t) => /* @__PURE__ */ e(
|
|
89
|
+
De,
|
|
90
|
+
{
|
|
91
|
+
...t,
|
|
92
|
+
label: M,
|
|
93
|
+
placeholder: b.length === 0 ? G : void 0,
|
|
94
|
+
error: T,
|
|
95
|
+
helperText: T ? Q : u,
|
|
96
|
+
size: c,
|
|
97
|
+
InputProps: {
|
|
98
|
+
...t.InputProps,
|
|
99
|
+
sx: {
|
|
100
|
+
"& .MuiAutocomplete-input": {
|
|
101
|
+
minWidth: "60px !important"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
), Z = (t, o) => t.map((i, U) => {
|
|
107
|
+
const A = o({ index: U });
|
|
108
|
+
return k ? k(i, A.onDelete) : /* @__PURE__ */ Le(
|
|
109
|
+
Ce,
|
|
110
|
+
{
|
|
111
|
+
...A,
|
|
112
|
+
key: i.id,
|
|
113
|
+
label: i.label,
|
|
114
|
+
size: c,
|
|
115
|
+
deleteIcon: /* @__PURE__ */ e(me, { fontSize: "small" }),
|
|
116
|
+
sx: {
|
|
117
|
+
maxWidth: 150,
|
|
118
|
+
"& .MuiChip-label": {
|
|
119
|
+
overflow: "hidden",
|
|
120
|
+
textOverflow: "ellipsis"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
}), z = a.useCallback(
|
|
126
|
+
(t) => /* @__PURE__ */ L(oe, { ...t, elevation: 8, children: [
|
|
127
|
+
t.children,
|
|
128
|
+
$ && /* @__PURE__ */ L(Se, { children: [
|
|
129
|
+
/* @__PURE__ */ e(ge, {}),
|
|
130
|
+
/* @__PURE__ */ e(
|
|
131
|
+
ae,
|
|
132
|
+
{
|
|
133
|
+
fullWidth: !0,
|
|
134
|
+
startIcon: /* @__PURE__ */ e(qe, {}),
|
|
135
|
+
onClick: S,
|
|
136
|
+
sx: {
|
|
137
|
+
justifyContent: "flex-start",
|
|
138
|
+
py: 1.5,
|
|
139
|
+
px: 2,
|
|
140
|
+
textTransform: "none",
|
|
141
|
+
color: "primary.main",
|
|
142
|
+
borderRadius: 0,
|
|
143
|
+
"&:hover": {
|
|
144
|
+
backgroundColor: de(R.palette.primary.main, 0.08)
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
children: I.replace("{value}", D)
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
] })
|
|
151
|
+
] }),
|
|
152
|
+
[$, I, D, R.palette.primary.main, S]
|
|
153
|
+
), r = l;
|
|
154
|
+
return /* @__PURE__ */ e(
|
|
155
|
+
ze,
|
|
156
|
+
{
|
|
157
|
+
className: ne,
|
|
158
|
+
sx: {
|
|
159
|
+
width: p ? "100%" : 300,
|
|
160
|
+
...ee
|
|
161
|
+
},
|
|
162
|
+
multiple: f,
|
|
163
|
+
options: r,
|
|
164
|
+
value: f ? b : b[0] || null,
|
|
165
|
+
onChange: n,
|
|
166
|
+
inputValue: D,
|
|
167
|
+
onInputChange: (t, o) => P(o),
|
|
168
|
+
getOptionLabel: (t) => typeof t == "string" ? t : t.label,
|
|
169
|
+
isOptionEqualToValue: (t, o) => t.id === o.id,
|
|
170
|
+
getOptionDisabled: (t) => typeof t == "object" && t.disabled === !0,
|
|
171
|
+
groupBy: E ? (t) => t.group || "" : void 0,
|
|
172
|
+
filterOptions: _,
|
|
173
|
+
renderInput: B,
|
|
174
|
+
renderTags: f ? Z : void 0,
|
|
175
|
+
renderOption: (t, o, { selected: i }) => {
|
|
176
|
+
const { key: U, ...A } = t;
|
|
177
|
+
return y ? /* @__PURE__ */ e("li", { ...A, children: y(o, { selected: i }) }, U) : /* @__PURE__ */ L(ye, { ...A, dense: !0, children: [
|
|
178
|
+
f && j && /* @__PURE__ */ e(se, { sx: { minWidth: 36 }, children: /* @__PURE__ */ e(
|
|
179
|
+
we,
|
|
180
|
+
{
|
|
181
|
+
icon: /* @__PURE__ */ e(J, { sx: { width: 18, height: 18 } }),
|
|
182
|
+
checkedIcon: /* @__PURE__ */ e(
|
|
183
|
+
he,
|
|
184
|
+
{
|
|
185
|
+
sx: {
|
|
186
|
+
width: 18,
|
|
187
|
+
height: 18,
|
|
188
|
+
color: "primary.main"
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
),
|
|
192
|
+
checked: i,
|
|
193
|
+
size: "small"
|
|
194
|
+
}
|
|
195
|
+
) }),
|
|
196
|
+
o.icon && /* @__PURE__ */ e(se, { sx: { minWidth: 36 }, children: o.icon }),
|
|
197
|
+
/* @__PURE__ */ e(
|
|
198
|
+
ve,
|
|
199
|
+
{
|
|
200
|
+
primary: o.label,
|
|
201
|
+
secondary: o.secondary,
|
|
202
|
+
primaryTypographyProps: { variant: "body2" },
|
|
203
|
+
secondaryTypographyProps: { variant: "caption" }
|
|
204
|
+
}
|
|
205
|
+
),
|
|
206
|
+
!f && i && /* @__PURE__ */ e(he, { sx: { ml: 1, color: "primary.main" }, fontSize: "small" })
|
|
207
|
+
] }, U);
|
|
208
|
+
},
|
|
209
|
+
PaperComponent: m ? z : oe,
|
|
210
|
+
PopperComponent: dt,
|
|
211
|
+
limitTags: d,
|
|
212
|
+
disabled: O,
|
|
213
|
+
loading: w,
|
|
214
|
+
noOptionsText: $ ? /* @__PURE__ */ e(te, { variant: "body2", color: "text.secondary", children: "Press Enter or click below to create" }) : H,
|
|
215
|
+
freeSolo: F || m,
|
|
216
|
+
autoHighlight: re,
|
|
217
|
+
clearOnEscape: N,
|
|
218
|
+
disableCloseOnSelect: f,
|
|
219
|
+
ChipProps: {
|
|
220
|
+
size: c,
|
|
221
|
+
deleteIcon: /* @__PURE__ */ e(me, { fontSize: "small" })
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
);
|
|
225
|
+
}, ke = (l) => {
|
|
226
|
+
if (l === 0) return "0 Bytes";
|
|
227
|
+
const h = 1024, s = ["Bytes", "KB", "MB", "GB"], v = Math.floor(Math.log(l) / Math.log(h));
|
|
228
|
+
return parseFloat((l / Math.pow(h, v)).toFixed(2)) + " " + s[v];
|
|
229
|
+
}, be = (l) => l.startsWith("image/") ? /* @__PURE__ */ e(at, {}) : l.startsWith("video/") ? /* @__PURE__ */ e(st, {}) : l === "application/pdf" ? /* @__PURE__ */ e(lt, {}) : l.includes("document") || l.includes("text") ? /* @__PURE__ */ e(ct, {}) : /* @__PURE__ */ e(nt, {}), ut = () => `file-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, Ft = ({
|
|
230
|
+
variant: l = "dropzone",
|
|
231
|
+
accept: h,
|
|
232
|
+
multiple: s = !1,
|
|
233
|
+
maxSize: v,
|
|
234
|
+
maxFiles: m,
|
|
235
|
+
files: C,
|
|
236
|
+
onFilesChange: I,
|
|
237
|
+
onFileSelect: f,
|
|
238
|
+
onFileRemove: G,
|
|
239
|
+
onUpload: M,
|
|
240
|
+
disabled: u = !1,
|
|
241
|
+
helperText: T,
|
|
242
|
+
error: Q,
|
|
243
|
+
showFileList: O = !0,
|
|
244
|
+
size: p = "medium",
|
|
245
|
+
sx: c
|
|
246
|
+
}) => {
|
|
247
|
+
const [d, j] = ie([]), [E, w] = ie(!1), [H, x] = ie(null), y = Ie(null), k = C ?? d, F = K((n) => {
|
|
248
|
+
typeof n == "function" ? I ? I(n(C ?? d)) : j(n) : I ? I(n) : j(n);
|
|
249
|
+
}, [C, d, I]), re = (n) => v && n.size > v ? `File "${n.name}" exceeds maximum size of ${ke(v)}` : m && k.length >= m ? `Maximum ${m} files allowed` : null, N = K(
|
|
250
|
+
async (n) => {
|
|
251
|
+
const S = Array.from(n), B = [], Z = [];
|
|
252
|
+
for (const z of S) {
|
|
253
|
+
const r = re(z);
|
|
254
|
+
if (r) {
|
|
255
|
+
Z.push(r);
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
const t = {
|
|
259
|
+
id: ut(),
|
|
260
|
+
file: z,
|
|
261
|
+
name: z.name,
|
|
262
|
+
size: z.size,
|
|
263
|
+
type: z.type,
|
|
264
|
+
progress: 0,
|
|
265
|
+
status: "pending",
|
|
266
|
+
preview: z.type.startsWith("image/") ? URL.createObjectURL(z) : void 0
|
|
267
|
+
};
|
|
268
|
+
B.push(t);
|
|
269
|
+
}
|
|
270
|
+
if (Z.length > 0 ? x(Z[0]) : x(null), B.length > 0) {
|
|
271
|
+
const z = s ? [...k, ...B] : B;
|
|
272
|
+
if (F(z), f?.(B.map((r) => r.file)), M)
|
|
273
|
+
for (const r of B)
|
|
274
|
+
try {
|
|
275
|
+
F(
|
|
276
|
+
(o) => o.map(
|
|
277
|
+
(i) => i.id === r.id ? { ...i, status: "uploading" } : i
|
|
278
|
+
)
|
|
279
|
+
);
|
|
280
|
+
const t = setInterval(() => {
|
|
281
|
+
F(
|
|
282
|
+
(o) => o.map(
|
|
283
|
+
(i) => i.id === r.id && i.progress < 90 ? { ...i, progress: i.progress + 10 } : i
|
|
284
|
+
)
|
|
285
|
+
);
|
|
286
|
+
}, 200);
|
|
287
|
+
await M(r.file), clearInterval(t), F(
|
|
288
|
+
(o) => o.map(
|
|
289
|
+
(i) => i.id === r.id ? { ...i, status: "complete", progress: 100 } : i
|
|
290
|
+
)
|
|
291
|
+
);
|
|
292
|
+
} catch (t) {
|
|
293
|
+
F(
|
|
294
|
+
(o) => o.map(
|
|
295
|
+
(i) => i.id === r.id ? {
|
|
296
|
+
...i,
|
|
297
|
+
status: "error",
|
|
298
|
+
error: t instanceof Error ? t.message : "Upload failed"
|
|
299
|
+
} : i
|
|
300
|
+
)
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
[k, F, v, m, s, f, M]
|
|
306
|
+
), ne = K((n) => {
|
|
307
|
+
n.preventDefault(), n.stopPropagation(), u || w(!0);
|
|
308
|
+
}, [u]), ee = K((n) => {
|
|
309
|
+
n.preventDefault(), n.stopPropagation(), w(!1);
|
|
310
|
+
}, []), R = K((n) => {
|
|
311
|
+
n.preventDefault(), n.stopPropagation();
|
|
312
|
+
}, []), D = K(
|
|
313
|
+
(n) => {
|
|
314
|
+
if (n.preventDefault(), n.stopPropagation(), w(!1), u) return;
|
|
315
|
+
const S = n.dataTransfer.files;
|
|
316
|
+
S.length > 0 && N(S);
|
|
317
|
+
},
|
|
318
|
+
[u, N]
|
|
319
|
+
), P = K(
|
|
320
|
+
(n) => {
|
|
321
|
+
const S = n.target.files;
|
|
322
|
+
S && S.length > 0 && N(S), y.current && (y.current.value = "");
|
|
323
|
+
},
|
|
324
|
+
[N]
|
|
325
|
+
), Y = K(
|
|
326
|
+
(n) => {
|
|
327
|
+
n.preview && URL.revokeObjectURL(n.preview);
|
|
328
|
+
const S = k.filter((B) => B.id !== n.id);
|
|
329
|
+
F(S), G?.(n);
|
|
330
|
+
},
|
|
331
|
+
[k, F, G]
|
|
332
|
+
), W = () => {
|
|
333
|
+
y.current?.click();
|
|
334
|
+
}, b = Q || H, _ = /* @__PURE__ */ e(
|
|
335
|
+
"input",
|
|
336
|
+
{
|
|
337
|
+
ref: y,
|
|
338
|
+
type: "file",
|
|
339
|
+
accept: h,
|
|
340
|
+
multiple: s,
|
|
341
|
+
onChange: P,
|
|
342
|
+
style: { display: "none" },
|
|
343
|
+
disabled: u
|
|
344
|
+
}
|
|
345
|
+
), $ = K(
|
|
346
|
+
(n) => {
|
|
347
|
+
(n.key === "Enter" || n.key === " ") && !u && (n.preventDefault(), W());
|
|
348
|
+
},
|
|
349
|
+
[u]
|
|
350
|
+
);
|
|
351
|
+
return l === "dropzone" ? /* @__PURE__ */ L(J, { sx: c, children: [
|
|
352
|
+
_,
|
|
353
|
+
/* @__PURE__ */ L(
|
|
354
|
+
oe,
|
|
355
|
+
{
|
|
356
|
+
role: "button",
|
|
357
|
+
tabIndex: u ? -1 : 0,
|
|
358
|
+
"aria-label": `Upload files${h ? `. Accepted formats: ${h}` : ""}. Drag and drop or press Enter to browse`,
|
|
359
|
+
"aria-disabled": u,
|
|
360
|
+
onDragEnter: ne,
|
|
361
|
+
onDragLeave: ee,
|
|
362
|
+
onDragOver: R,
|
|
363
|
+
onDrop: D,
|
|
364
|
+
onClick: W,
|
|
365
|
+
onKeyDown: $,
|
|
366
|
+
sx: {
|
|
367
|
+
p: p === "small" ? 3 : 4,
|
|
368
|
+
border: "2px dashed",
|
|
369
|
+
borderColor: b ? "error.main" : E ? "primary.main" : "divider",
|
|
370
|
+
borderRadius: "12px",
|
|
371
|
+
bgcolor: E ? "action.hover" : u ? "action.disabledBackground" : "background.paper",
|
|
372
|
+
textAlign: "center",
|
|
373
|
+
cursor: u ? "not-allowed" : "pointer",
|
|
374
|
+
transition: "all 0.2s ease",
|
|
375
|
+
"&:hover": {
|
|
376
|
+
bgcolor: u ? void 0 : "action.hover",
|
|
377
|
+
borderColor: u ? void 0 : "primary.main"
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
children: [
|
|
381
|
+
/* @__PURE__ */ e(
|
|
382
|
+
le,
|
|
383
|
+
{
|
|
384
|
+
sx: {
|
|
385
|
+
fontSize: p === "small" ? 40 : 56,
|
|
386
|
+
color: E ? "primary.main" : "action.active",
|
|
387
|
+
mb: 2
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
),
|
|
391
|
+
/* @__PURE__ */ e(te, { variant: p === "small" ? "body1" : "h6", gutterBottom: !0, children: E ? "Drop files here" : "Drag & drop files here" }),
|
|
392
|
+
/* @__PURE__ */ e(te, { variant: "body2", color: "text.secondary", gutterBottom: !0, children: "or click to browse" }),
|
|
393
|
+
T && /* @__PURE__ */ e(te, { variant: "caption", color: "text.secondary", children: T })
|
|
394
|
+
]
|
|
395
|
+
}
|
|
396
|
+
),
|
|
397
|
+
b && /* @__PURE__ */ e(ue, { severity: "error", sx: { mt: 2 }, children: b }),
|
|
398
|
+
O && k.length > 0 && /* @__PURE__ */ e(pe, { files: k, onRemove: Y })
|
|
399
|
+
] }) : l === "button" ? /* @__PURE__ */ L(J, { sx: c, children: [
|
|
400
|
+
_,
|
|
401
|
+
/* @__PURE__ */ L(
|
|
402
|
+
ae,
|
|
403
|
+
{
|
|
404
|
+
variant: "contained",
|
|
405
|
+
startIcon: /* @__PURE__ */ e(le, {}),
|
|
406
|
+
onClick: W,
|
|
407
|
+
disabled: u,
|
|
408
|
+
size: p,
|
|
409
|
+
children: [
|
|
410
|
+
"Upload ",
|
|
411
|
+
s ? "Files" : "File"
|
|
412
|
+
]
|
|
413
|
+
}
|
|
414
|
+
),
|
|
415
|
+
b && /* @__PURE__ */ e(ue, { severity: "error", sx: { mt: 2 }, children: b }),
|
|
416
|
+
O && k.length > 0 && /* @__PURE__ */ e(pe, { files: k, onRemove: Y })
|
|
417
|
+
] }) : /* @__PURE__ */ L(J, { sx: c, children: [
|
|
418
|
+
_,
|
|
419
|
+
/* @__PURE__ */ L(Be, { direction: "row", spacing: 1, alignItems: "center", flexWrap: "wrap", useFlexGap: !0, children: [
|
|
420
|
+
/* @__PURE__ */ e(
|
|
421
|
+
ae,
|
|
422
|
+
{
|
|
423
|
+
variant: "outlined",
|
|
424
|
+
size: "small",
|
|
425
|
+
startIcon: /* @__PURE__ */ e(le, {}),
|
|
426
|
+
onClick: W,
|
|
427
|
+
disabled: u,
|
|
428
|
+
children: "Browse"
|
|
429
|
+
}
|
|
430
|
+
),
|
|
431
|
+
k.map((n) => /* @__PURE__ */ e(
|
|
432
|
+
Ce,
|
|
433
|
+
{
|
|
434
|
+
icon: n.status === "complete" ? /* @__PURE__ */ e(xe, {}) : be(n.type),
|
|
435
|
+
label: n.name,
|
|
436
|
+
onDelete: () => Y(n),
|
|
437
|
+
color: n.status === "error" ? "error" : n.status === "complete" ? "success" : "default",
|
|
438
|
+
size: "small",
|
|
439
|
+
sx: {
|
|
440
|
+
maxWidth: 200,
|
|
441
|
+
"& .MuiChip-label": {
|
|
442
|
+
overflow: "hidden",
|
|
443
|
+
textOverflow: "ellipsis"
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
n.id
|
|
448
|
+
))
|
|
449
|
+
] }),
|
|
450
|
+
b && /* @__PURE__ */ e(te, { variant: "caption", color: "error", sx: { mt: 0.5, display: "block" }, children: b })
|
|
451
|
+
] });
|
|
452
|
+
}, pe = ({ files: l, onRemove: h }) => /* @__PURE__ */ e(Re, { dense: !0, sx: { mt: 2 }, children: l.map((s) => /* @__PURE__ */ L(
|
|
453
|
+
ye,
|
|
454
|
+
{
|
|
455
|
+
sx: {
|
|
456
|
+
bgcolor: "background.paper",
|
|
457
|
+
borderRadius: "8px",
|
|
458
|
+
mb: 1,
|
|
459
|
+
border: "1px solid",
|
|
460
|
+
borderColor: s.status === "error" ? "error.light" : "divider"
|
|
461
|
+
},
|
|
462
|
+
children: [
|
|
463
|
+
/* @__PURE__ */ e(se, { children: s.status === "complete" ? /* @__PURE__ */ e(xe, { color: "success" }) : s.status === "error" ? /* @__PURE__ */ e(it, { color: "error" }) : be(s.type) }),
|
|
464
|
+
/* @__PURE__ */ e(
|
|
465
|
+
ve,
|
|
466
|
+
{
|
|
467
|
+
primary: s.name,
|
|
468
|
+
secondary: /* @__PURE__ */ L(J, { component: "span", children: [
|
|
469
|
+
ke(s.size),
|
|
470
|
+
s.error && /* @__PURE__ */ L(te, { component: "span", color: "error", sx: { ml: 1 }, children: [
|
|
471
|
+
"• ",
|
|
472
|
+
s.error
|
|
473
|
+
] })
|
|
474
|
+
] }),
|
|
475
|
+
sx: {
|
|
476
|
+
"& .MuiListItemText-primary": {
|
|
477
|
+
overflow: "hidden",
|
|
478
|
+
textOverflow: "ellipsis",
|
|
479
|
+
whiteSpace: "nowrap"
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
),
|
|
484
|
+
s.status === "uploading" && /* @__PURE__ */ e(J, { sx: { width: 100, mr: 2 }, children: /* @__PURE__ */ e(Te, { variant: "determinate", value: s.progress }) }),
|
|
485
|
+
/* @__PURE__ */ e(Ee, { children: /* @__PURE__ */ e(V, { edge: "end", onClick: () => h(s), size: "small", children: /* @__PURE__ */ e(ot, { fontSize: "small" }) }) })
|
|
486
|
+
]
|
|
487
|
+
},
|
|
488
|
+
s.id
|
|
489
|
+
)) }), mt = [
|
|
490
|
+
"heading",
|
|
491
|
+
"divider",
|
|
492
|
+
"bold",
|
|
493
|
+
"italic",
|
|
494
|
+
"underline",
|
|
495
|
+
"strike",
|
|
496
|
+
"divider",
|
|
497
|
+
"bulletList",
|
|
498
|
+
"numberList",
|
|
499
|
+
"quote",
|
|
500
|
+
"code",
|
|
501
|
+
"divider",
|
|
502
|
+
"align",
|
|
503
|
+
"divider",
|
|
504
|
+
"link",
|
|
505
|
+
"image",
|
|
506
|
+
"divider",
|
|
507
|
+
"undo",
|
|
508
|
+
"redo",
|
|
509
|
+
"clearFormat",
|
|
510
|
+
"divider",
|
|
511
|
+
"fullscreen"
|
|
512
|
+
], ht = ({
|
|
513
|
+
items: l,
|
|
514
|
+
formats: h,
|
|
515
|
+
headingLevel: s,
|
|
516
|
+
textAlign: v,
|
|
517
|
+
onFormat: m,
|
|
518
|
+
onHeadingChange: C,
|
|
519
|
+
onAlignChange: I,
|
|
520
|
+
onUndo: f,
|
|
521
|
+
onRedo: G,
|
|
522
|
+
onClearFormat: M,
|
|
523
|
+
onLinkInsert: u,
|
|
524
|
+
onImageInsert: T,
|
|
525
|
+
onFullscreen: Q,
|
|
526
|
+
isFullscreen: O,
|
|
527
|
+
canUndo: p,
|
|
528
|
+
canRedo: c,
|
|
529
|
+
disabled: d
|
|
530
|
+
}) => {
|
|
531
|
+
const j = ce(), E = (w, H) => {
|
|
532
|
+
switch (w) {
|
|
533
|
+
case "divider":
|
|
534
|
+
return /* @__PURE__ */ e(
|
|
535
|
+
ge,
|
|
536
|
+
{
|
|
537
|
+
orientation: "vertical",
|
|
538
|
+
flexItem: !0,
|
|
539
|
+
sx: { mx: 0.5 }
|
|
540
|
+
},
|
|
541
|
+
`divider-${H}`
|
|
542
|
+
);
|
|
543
|
+
case "heading":
|
|
544
|
+
return /* @__PURE__ */ e(Ue, { size: "small", sx: { minWidth: 100, mr: 1 }, children: /* @__PURE__ */ L(
|
|
545
|
+
Ae,
|
|
546
|
+
{
|
|
547
|
+
value: s,
|
|
548
|
+
onChange: (x) => C(x.target.value),
|
|
549
|
+
disabled: d,
|
|
550
|
+
sx: {
|
|
551
|
+
"& .MuiSelect-select": {
|
|
552
|
+
py: 0.5,
|
|
553
|
+
fontSize: "0.875rem"
|
|
554
|
+
}
|
|
555
|
+
},
|
|
556
|
+
children: [
|
|
557
|
+
/* @__PURE__ */ e(X, { value: "p", children: "Paragraph" }),
|
|
558
|
+
/* @__PURE__ */ e(X, { value: "h1", children: "Heading 1" }),
|
|
559
|
+
/* @__PURE__ */ e(X, { value: "h2", children: "Heading 2" }),
|
|
560
|
+
/* @__PURE__ */ e(X, { value: "h3", children: "Heading 3" }),
|
|
561
|
+
/* @__PURE__ */ e(X, { value: "h4", children: "Heading 4" }),
|
|
562
|
+
/* @__PURE__ */ e(X, { value: "h5", children: "Heading 5" }),
|
|
563
|
+
/* @__PURE__ */ e(X, { value: "h6", children: "Heading 6" })
|
|
564
|
+
]
|
|
565
|
+
}
|
|
566
|
+
) }, "heading");
|
|
567
|
+
case "bold":
|
|
568
|
+
return /* @__PURE__ */ e(g, { title: "Bold (Ctrl+B)", children: /* @__PURE__ */ e(
|
|
569
|
+
q,
|
|
570
|
+
{
|
|
571
|
+
value: "bold",
|
|
572
|
+
selected: h.has("bold"),
|
|
573
|
+
onChange: () => m("bold"),
|
|
574
|
+
disabled: d,
|
|
575
|
+
size: "small",
|
|
576
|
+
children: /* @__PURE__ */ e(rt, { fontSize: "small" })
|
|
577
|
+
}
|
|
578
|
+
) }, "bold");
|
|
579
|
+
case "italic":
|
|
580
|
+
return /* @__PURE__ */ e(g, { title: "Italic (Ctrl+I)", children: /* @__PURE__ */ e(
|
|
581
|
+
q,
|
|
582
|
+
{
|
|
583
|
+
value: "italic",
|
|
584
|
+
selected: h.has("italic"),
|
|
585
|
+
onChange: () => m("italic"),
|
|
586
|
+
disabled: d,
|
|
587
|
+
size: "small",
|
|
588
|
+
children: /* @__PURE__ */ e(tt, { fontSize: "small" })
|
|
589
|
+
}
|
|
590
|
+
) }, "italic");
|
|
591
|
+
case "underline":
|
|
592
|
+
return /* @__PURE__ */ e(g, { title: "Underline (Ctrl+U)", children: /* @__PURE__ */ e(
|
|
593
|
+
q,
|
|
594
|
+
{
|
|
595
|
+
value: "underline",
|
|
596
|
+
selected: h.has("underline"),
|
|
597
|
+
onChange: () => m("underline"),
|
|
598
|
+
disabled: d,
|
|
599
|
+
size: "small",
|
|
600
|
+
children: /* @__PURE__ */ e(et, { fontSize: "small" })
|
|
601
|
+
}
|
|
602
|
+
) }, "underline");
|
|
603
|
+
case "strike":
|
|
604
|
+
return /* @__PURE__ */ e(g, { title: "Strikethrough", children: /* @__PURE__ */ e(
|
|
605
|
+
q,
|
|
606
|
+
{
|
|
607
|
+
value: "strikeThrough",
|
|
608
|
+
selected: h.has("strikeThrough"),
|
|
609
|
+
onChange: () => m("strikeThrough"),
|
|
610
|
+
disabled: d,
|
|
611
|
+
size: "small",
|
|
612
|
+
children: /* @__PURE__ */ e(Xe, { fontSize: "small" })
|
|
613
|
+
}
|
|
614
|
+
) }, "strike");
|
|
615
|
+
case "bulletList":
|
|
616
|
+
return /* @__PURE__ */ e(g, { title: "Bullet List", children: /* @__PURE__ */ e(
|
|
617
|
+
q,
|
|
618
|
+
{
|
|
619
|
+
value: "insertUnorderedList",
|
|
620
|
+
selected: h.has("insertUnorderedList"),
|
|
621
|
+
onChange: () => m("insertUnorderedList"),
|
|
622
|
+
disabled: d,
|
|
623
|
+
size: "small",
|
|
624
|
+
children: /* @__PURE__ */ e(Ze, { fontSize: "small" })
|
|
625
|
+
}
|
|
626
|
+
) }, "bulletList");
|
|
627
|
+
case "numberList":
|
|
628
|
+
return /* @__PURE__ */ e(g, { title: "Numbered List", children: /* @__PURE__ */ e(
|
|
629
|
+
q,
|
|
630
|
+
{
|
|
631
|
+
value: "insertOrderedList",
|
|
632
|
+
selected: h.has("insertOrderedList"),
|
|
633
|
+
onChange: () => m("insertOrderedList"),
|
|
634
|
+
disabled: d,
|
|
635
|
+
size: "small",
|
|
636
|
+
children: /* @__PURE__ */ e(Ye, { fontSize: "small" })
|
|
637
|
+
}
|
|
638
|
+
) }, "numberList");
|
|
639
|
+
case "quote":
|
|
640
|
+
return /* @__PURE__ */ e(g, { title: "Block Quote", children: /* @__PURE__ */ e(
|
|
641
|
+
V,
|
|
642
|
+
{
|
|
643
|
+
onClick: () => m("formatBlock"),
|
|
644
|
+
disabled: d,
|
|
645
|
+
size: "small",
|
|
646
|
+
children: /* @__PURE__ */ e(Qe, { fontSize: "small" })
|
|
647
|
+
}
|
|
648
|
+
) }, "quote");
|
|
649
|
+
case "code":
|
|
650
|
+
return /* @__PURE__ */ e(g, { title: "Code Block", children: /* @__PURE__ */ e(
|
|
651
|
+
V,
|
|
652
|
+
{
|
|
653
|
+
onClick: () => m("code"),
|
|
654
|
+
disabled: d,
|
|
655
|
+
size: "small",
|
|
656
|
+
children: /* @__PURE__ */ e(Je, { fontSize: "small" })
|
|
657
|
+
}
|
|
658
|
+
) }, "code");
|
|
659
|
+
case "link":
|
|
660
|
+
return /* @__PURE__ */ e(g, { title: "Insert Link", children: /* @__PURE__ */ e(
|
|
661
|
+
V,
|
|
662
|
+
{
|
|
663
|
+
onClick: u,
|
|
664
|
+
disabled: d,
|
|
665
|
+
size: "small",
|
|
666
|
+
children: /* @__PURE__ */ e(_e, { fontSize: "small" })
|
|
667
|
+
}
|
|
668
|
+
) }, "link");
|
|
669
|
+
case "image":
|
|
670
|
+
return /* @__PURE__ */ e(g, { title: "Insert Image", children: /* @__PURE__ */ e(
|
|
671
|
+
V,
|
|
672
|
+
{
|
|
673
|
+
onClick: T,
|
|
674
|
+
disabled: d,
|
|
675
|
+
size: "small",
|
|
676
|
+
children: /* @__PURE__ */ e(Ne, { fontSize: "small" })
|
|
677
|
+
}
|
|
678
|
+
) }, "image");
|
|
679
|
+
case "align":
|
|
680
|
+
return /* @__PURE__ */ L(
|
|
681
|
+
Pe,
|
|
682
|
+
{
|
|
683
|
+
value: v,
|
|
684
|
+
exclusive: !0,
|
|
685
|
+
onChange: (x, y) => y && I(y),
|
|
686
|
+
size: "small",
|
|
687
|
+
disabled: d,
|
|
688
|
+
children: [
|
|
689
|
+
/* @__PURE__ */ e(q, { value: "left", children: /* @__PURE__ */ e(g, { title: "Align Left", children: /* @__PURE__ */ e($e, { fontSize: "small" }) }) }),
|
|
690
|
+
/* @__PURE__ */ e(q, { value: "center", children: /* @__PURE__ */ e(g, { title: "Align Center", children: /* @__PURE__ */ e(Ke, { fontSize: "small" }) }) }),
|
|
691
|
+
/* @__PURE__ */ e(q, { value: "right", children: /* @__PURE__ */ e(g, { title: "Align Right", children: /* @__PURE__ */ e(Ve, { fontSize: "small" }) }) }),
|
|
692
|
+
/* @__PURE__ */ e(q, { value: "justify", children: /* @__PURE__ */ e(g, { title: "Justify", children: /* @__PURE__ */ e(Ge, { fontSize: "small" }) }) })
|
|
693
|
+
]
|
|
694
|
+
},
|
|
695
|
+
"align"
|
|
696
|
+
);
|
|
697
|
+
case "undo":
|
|
698
|
+
return /* @__PURE__ */ e(g, { title: "Undo (Ctrl+Z)", children: /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
|
|
699
|
+
V,
|
|
700
|
+
{
|
|
701
|
+
onClick: f,
|
|
702
|
+
disabled: d || !p,
|
|
703
|
+
size: "small",
|
|
704
|
+
children: /* @__PURE__ */ e(We, { fontSize: "small" })
|
|
705
|
+
}
|
|
706
|
+
) }) }, "undo");
|
|
707
|
+
case "redo":
|
|
708
|
+
return /* @__PURE__ */ e(g, { title: "Redo (Ctrl+Y)", children: /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
|
|
709
|
+
V,
|
|
710
|
+
{
|
|
711
|
+
onClick: G,
|
|
712
|
+
disabled: d || !c,
|
|
713
|
+
size: "small",
|
|
714
|
+
children: /* @__PURE__ */ e(He, { fontSize: "small" })
|
|
715
|
+
}
|
|
716
|
+
) }) }, "redo");
|
|
717
|
+
case "clearFormat":
|
|
718
|
+
return /* @__PURE__ */ e(g, { title: "Clear Formatting", children: /* @__PURE__ */ e(
|
|
719
|
+
V,
|
|
720
|
+
{
|
|
721
|
+
onClick: M,
|
|
722
|
+
disabled: d,
|
|
723
|
+
size: "small",
|
|
724
|
+
children: /* @__PURE__ */ e(je, { fontSize: "small" })
|
|
725
|
+
}
|
|
726
|
+
) }, "clearFormat");
|
|
727
|
+
case "fullscreen":
|
|
728
|
+
return /* @__PURE__ */ e(g, { title: O ? "Exit Fullscreen" : "Fullscreen", children: /* @__PURE__ */ e(
|
|
729
|
+
V,
|
|
730
|
+
{
|
|
731
|
+
onClick: Q,
|
|
732
|
+
disabled: d,
|
|
733
|
+
size: "small",
|
|
734
|
+
children: O ? /* @__PURE__ */ e(Me, { fontSize: "small" }) : /* @__PURE__ */ e(Oe, { fontSize: "small" })
|
|
735
|
+
}
|
|
736
|
+
) }, "fullscreen");
|
|
737
|
+
default:
|
|
738
|
+
return null;
|
|
739
|
+
}
|
|
740
|
+
};
|
|
741
|
+
return /* @__PURE__ */ e(
|
|
742
|
+
J,
|
|
743
|
+
{
|
|
744
|
+
sx: {
|
|
745
|
+
display: "flex",
|
|
746
|
+
alignItems: "center",
|
|
747
|
+
gap: 0.5,
|
|
748
|
+
px: 1,
|
|
749
|
+
py: 0.5,
|
|
750
|
+
borderBottom: `1px solid ${j.palette.divider}`,
|
|
751
|
+
backgroundColor: de(j.palette.background.default, 0.5),
|
|
752
|
+
flexWrap: "wrap",
|
|
753
|
+
"& .MuiToggleButton-root": {
|
|
754
|
+
border: "none",
|
|
755
|
+
borderRadius: 1,
|
|
756
|
+
p: 0.5
|
|
757
|
+
},
|
|
758
|
+
"& .MuiIconButton-root": {
|
|
759
|
+
p: 0.5
|
|
760
|
+
}
|
|
761
|
+
},
|
|
762
|
+
children: l.map((w, H) => E(w, H))
|
|
763
|
+
}
|
|
764
|
+
);
|
|
765
|
+
}, Dt = ({
|
|
766
|
+
value: l = "",
|
|
767
|
+
onChange: h,
|
|
768
|
+
placeholder: s = "Start typing...",
|
|
769
|
+
height: v = 300,
|
|
770
|
+
minHeight: m = 150,
|
|
771
|
+
maxHeight: C,
|
|
772
|
+
readOnly: I = !1,
|
|
773
|
+
disabled: f = !1,
|
|
774
|
+
showToolbar: G = !0,
|
|
775
|
+
toolbarItems: M = mt,
|
|
776
|
+
onImageUpload: u,
|
|
777
|
+
autoFocus: T = !1,
|
|
778
|
+
className: Q,
|
|
779
|
+
sx: O
|
|
780
|
+
}) => {
|
|
781
|
+
const p = ce(), c = a.useRef(null), [d, j] = a.useState(/* @__PURE__ */ new Set()), [E, w] = a.useState("p"), [H, x] = a.useState("left"), [y, k] = a.useState(!1), [F, re] = a.useState(!1), [N, ne] = a.useState(!1), ee = a.useRef(null);
|
|
782
|
+
a.useEffect(() => {
|
|
783
|
+
c.current && l !== c.current.innerHTML && (c.current.innerHTML = l);
|
|
784
|
+
}, [l]), a.useEffect(() => {
|
|
785
|
+
T && c.current && c.current.focus();
|
|
786
|
+
}, [T]);
|
|
787
|
+
const R = a.useCallback(() => {
|
|
788
|
+
const r = /* @__PURE__ */ new Set();
|
|
789
|
+
document.queryCommandState("bold") && r.add("bold"), document.queryCommandState("italic") && r.add("italic"), document.queryCommandState("underline") && r.add("underline"), document.queryCommandState("strikeThrough") && r.add("strikeThrough"), document.queryCommandState("insertUnorderedList") && r.add("insertUnorderedList"), document.queryCommandState("insertOrderedList") && r.add("insertOrderedList"), j(r);
|
|
790
|
+
const t = document.queryCommandValue("formatBlock");
|
|
791
|
+
t && ["h1", "h2", "h3", "h4", "h5", "h6", "p"].includes(t.toLowerCase()) && w(t.toLowerCase()), document.queryCommandState("justifyLeft") ? x("left") : document.queryCommandState("justifyCenter") ? x("center") : document.queryCommandState("justifyRight") ? x("right") : document.queryCommandState("justifyFull") && x("justify");
|
|
792
|
+
}, []), D = a.useCallback(() => {
|
|
793
|
+
c.current && (h?.(c.current.innerHTML), R());
|
|
794
|
+
}, [h, R]), P = a.useCallback((r) => {
|
|
795
|
+
r === "code" ? document.execCommand("formatBlock", !1, "pre") : r === "formatBlock" ? document.execCommand("formatBlock", !1, "blockquote") : document.execCommand(r, !1), R(), c.current?.focus();
|
|
796
|
+
}, [R]), Y = a.useCallback((r) => {
|
|
797
|
+
document.execCommand("formatBlock", !1, r), w(r), c.current?.focus();
|
|
798
|
+
}, []), W = a.useCallback((r) => {
|
|
799
|
+
const t = {
|
|
800
|
+
left: "justifyLeft",
|
|
801
|
+
center: "justifyCenter",
|
|
802
|
+
right: "justifyRight",
|
|
803
|
+
justify: "justifyFull"
|
|
804
|
+
};
|
|
805
|
+
document.execCommand(t[r], !1), x(r), c.current?.focus();
|
|
806
|
+
}, []), b = () => document.execCommand("undo"), _ = () => document.execCommand("redo"), $ = () => {
|
|
807
|
+
document.execCommand("removeFormat"), R();
|
|
808
|
+
}, n = a.useCallback(() => {
|
|
809
|
+
const r = window.prompt("Enter URL:");
|
|
810
|
+
r && document.execCommand("createLink", !1, r), c.current?.focus();
|
|
811
|
+
}, []), S = a.useCallback(() => {
|
|
812
|
+
ee.current?.click();
|
|
813
|
+
}, []), B = a.useCallback(async (r) => {
|
|
814
|
+
const t = r.target.files?.[0];
|
|
815
|
+
if (!t) return;
|
|
816
|
+
let o;
|
|
817
|
+
u ? o = await u(t) : o = URL.createObjectURL(t), document.execCommand("insertImage", !1, o), r.target.value = "", c.current?.focus();
|
|
818
|
+
}, [u]), Z = () => {
|
|
819
|
+
k(!y);
|
|
820
|
+
}, z = a.useCallback((r) => {
|
|
821
|
+
if (r.ctrlKey || r.metaKey)
|
|
822
|
+
switch (r.key.toLowerCase()) {
|
|
823
|
+
case "b":
|
|
824
|
+
r.preventDefault(), P("bold");
|
|
825
|
+
break;
|
|
826
|
+
case "i":
|
|
827
|
+
r.preventDefault(), P("italic");
|
|
828
|
+
break;
|
|
829
|
+
case "u":
|
|
830
|
+
r.preventDefault(), P("underline");
|
|
831
|
+
break;
|
|
832
|
+
case "z":
|
|
833
|
+
r.shiftKey && (r.preventDefault(), _());
|
|
834
|
+
break;
|
|
835
|
+
}
|
|
836
|
+
}, [P]);
|
|
837
|
+
return a.useEffect(() => {
|
|
838
|
+
const r = () => {
|
|
839
|
+
re(document.queryCommandEnabled("undo")), ne(document.queryCommandEnabled("redo"));
|
|
840
|
+
}, t = c.current;
|
|
841
|
+
if (t)
|
|
842
|
+
return t.addEventListener("input", r), () => t.removeEventListener("input", r);
|
|
843
|
+
}, []), /* @__PURE__ */ L(
|
|
844
|
+
oe,
|
|
845
|
+
{
|
|
846
|
+
className: Q,
|
|
847
|
+
variant: "outlined",
|
|
848
|
+
sx: {
|
|
849
|
+
display: "flex",
|
|
850
|
+
flexDirection: "column",
|
|
851
|
+
overflow: "hidden",
|
|
852
|
+
...y && {
|
|
853
|
+
position: "fixed",
|
|
854
|
+
top: 0,
|
|
855
|
+
left: 0,
|
|
856
|
+
right: 0,
|
|
857
|
+
bottom: 0,
|
|
858
|
+
zIndex: p.zIndex.modal,
|
|
859
|
+
borderRadius: 0
|
|
860
|
+
},
|
|
861
|
+
...O
|
|
862
|
+
},
|
|
863
|
+
children: [
|
|
864
|
+
G && !I && /* @__PURE__ */ e(
|
|
865
|
+
ht,
|
|
866
|
+
{
|
|
867
|
+
items: M,
|
|
868
|
+
formats: d,
|
|
869
|
+
headingLevel: E,
|
|
870
|
+
textAlign: H,
|
|
871
|
+
onFormat: P,
|
|
872
|
+
onHeadingChange: Y,
|
|
873
|
+
onAlignChange: W,
|
|
874
|
+
onUndo: b,
|
|
875
|
+
onRedo: _,
|
|
876
|
+
onClearFormat: $,
|
|
877
|
+
onLinkInsert: n,
|
|
878
|
+
onImageInsert: S,
|
|
879
|
+
onFullscreen: Z,
|
|
880
|
+
isFullscreen: y,
|
|
881
|
+
canUndo: F,
|
|
882
|
+
canRedo: N,
|
|
883
|
+
disabled: f
|
|
884
|
+
}
|
|
885
|
+
),
|
|
886
|
+
/* @__PURE__ */ e(
|
|
887
|
+
J,
|
|
888
|
+
{
|
|
889
|
+
ref: c,
|
|
890
|
+
contentEditable: !I && !f,
|
|
891
|
+
onInput: D,
|
|
892
|
+
onKeyDown: z,
|
|
893
|
+
onSelect: R,
|
|
894
|
+
sx: {
|
|
895
|
+
flex: 1,
|
|
896
|
+
p: 2,
|
|
897
|
+
overflow: "auto",
|
|
898
|
+
outline: "none",
|
|
899
|
+
height: y ? "auto" : v,
|
|
900
|
+
minHeight: y ? "auto" : m,
|
|
901
|
+
maxHeight: y ? "none" : C,
|
|
902
|
+
fontFamily: p.typography.fontFamily,
|
|
903
|
+
fontSize: p.typography.body1.fontSize,
|
|
904
|
+
lineHeight: 1.6,
|
|
905
|
+
color: f ? p.palette.text.disabled : p.palette.text.primary,
|
|
906
|
+
cursor: f ? "not-allowed" : "text",
|
|
907
|
+
"&:empty::before": {
|
|
908
|
+
content: `"${s}"`,
|
|
909
|
+
color: p.palette.text.secondary,
|
|
910
|
+
fontStyle: "italic"
|
|
911
|
+
},
|
|
912
|
+
"& h1, & h2, & h3, & h4, & h5, & h6": {
|
|
913
|
+
marginTop: 0,
|
|
914
|
+
marginBottom: "0.5em",
|
|
915
|
+
fontWeight: 600
|
|
916
|
+
},
|
|
917
|
+
"& h1": { fontSize: "2em" },
|
|
918
|
+
"& h2": { fontSize: "1.5em" },
|
|
919
|
+
"& h3": { fontSize: "1.25em" },
|
|
920
|
+
"& h4": { fontSize: "1em" },
|
|
921
|
+
"& p": { marginBottom: "1em" },
|
|
922
|
+
"& ul, & ol": {
|
|
923
|
+
paddingLeft: "1.5em",
|
|
924
|
+
marginBottom: "1em"
|
|
925
|
+
},
|
|
926
|
+
"& blockquote": {
|
|
927
|
+
borderLeft: `4px solid ${p.palette.divider}`,
|
|
928
|
+
paddingLeft: 2,
|
|
929
|
+
marginLeft: 0,
|
|
930
|
+
color: p.palette.text.secondary,
|
|
931
|
+
fontStyle: "italic"
|
|
932
|
+
},
|
|
933
|
+
"& pre": {
|
|
934
|
+
backgroundColor: de(p.palette.text.primary, 0.05),
|
|
935
|
+
padding: 2,
|
|
936
|
+
borderRadius: 1,
|
|
937
|
+
fontFamily: "monospace",
|
|
938
|
+
overflow: "auto"
|
|
939
|
+
},
|
|
940
|
+
"& a": {
|
|
941
|
+
color: p.palette.primary.main,
|
|
942
|
+
textDecoration: "underline"
|
|
943
|
+
},
|
|
944
|
+
"& img": {
|
|
945
|
+
maxWidth: "100%",
|
|
946
|
+
height: "auto",
|
|
947
|
+
borderRadius: 1
|
|
948
|
+
}
|
|
949
|
+
},
|
|
950
|
+
suppressContentEditableWarning: !0
|
|
951
|
+
}
|
|
952
|
+
),
|
|
953
|
+
/* @__PURE__ */ e(
|
|
954
|
+
"input",
|
|
955
|
+
{
|
|
956
|
+
ref: ee,
|
|
957
|
+
type: "file",
|
|
958
|
+
accept: "image/*",
|
|
959
|
+
onChange: B,
|
|
960
|
+
style: { display: "none" }
|
|
961
|
+
}
|
|
962
|
+
)
|
|
963
|
+
]
|
|
964
|
+
}
|
|
965
|
+
);
|
|
966
|
+
};
|
|
967
|
+
export {
|
|
968
|
+
wt as C,
|
|
969
|
+
Ft as F,
|
|
970
|
+
Dt as R
|
|
971
|
+
};
|