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