@thebuoyant-tsdev/mui-ts-library 3.2.1 → 3.6.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/README.de.md +31 -0
- package/README.md +31 -0
- package/dist/components/chord-chart/ChordChart.js +284 -0
- package/dist/components/chord-chart/ChordChart.types.js +4 -0
- package/dist/components/circle-packing-chart/CirclePackingChart.js +382 -0
- package/dist/components/circle-packing-chart/CirclePackingChart.types.js +4 -0
- package/dist/components/gantt-chart/GanttBarRow.js +202 -0
- package/dist/components/gantt-chart/GanttChart.constants.js +14 -0
- package/dist/components/gantt-chart/GanttChart.js +258 -0
- package/dist/components/gantt-chart/GanttChart.store.js +119 -0
- package/dist/components/gantt-chart/GanttChart.types.js +47 -0
- package/dist/components/gantt-chart/GanttDeleteDialog.js +30 -0
- package/dist/components/gantt-chart/GanttDependencyArrows.js +54 -0
- package/dist/components/gantt-chart/GanttStatusContextMenu.js +36 -0
- package/dist/components/gantt-chart/GanttTaskDialog.js +324 -0
- package/dist/components/gantt-chart/GanttTaskPanel.js +415 -0
- package/dist/components/gantt-chart/GanttTimeline.js +223 -0
- package/dist/components/gantt-chart/GanttTimelineHeader.js +90 -0
- package/dist/components/gantt-chart/GanttToolbar.js +157 -0
- package/dist/components/gantt-chart/GanttWeekendStrips.js +29 -0
- package/dist/components/gantt-chart/hooks/useGanttDrag.js +104 -0
- package/dist/components/gantt-chart/util/gantt-chart.util.js +150 -0
- package/dist/components/horizontal-tree-chart/HorizontalTreeChart.js +488 -0
- package/dist/components/horizontal-tree-chart/HorizontalTreeChart.types.js +8 -0
- package/dist/components/json-editor/JsonEditor.js +102 -0
- package/dist/components/json-editor/JsonEditor.types.js +21 -0
- package/dist/components/json-editor/JsonEditorContent.js +185 -0
- package/dist/components/json-editor/JsonEditorFooter.js +55 -0
- package/dist/components/json-editor/JsonEditorToolbar.js +148 -0
- package/dist/components/password-strength-meter/PasswordStrengthBar.js +66 -0
- package/dist/components/password-strength-meter/PasswordStrengthMeter.js +272 -0
- package/dist/components/password-strength-meter/PasswordStrengthMeter.types.js +27 -0
- package/dist/components/password-strength-meter/util/password-strength.util.js +38 -0
- package/dist/components/radial-tree-chart/RadialTreeChart.js +447 -0
- package/dist/components/radial-tree-chart/RadialTreeChart.types.js +8 -0
- package/dist/components/rich-text-editor/RichTextEditor.js +135 -0
- package/dist/components/rich-text-editor/RichTextEditor.types.js +74 -0
- package/dist/components/rich-text-editor/RichTextEditorColorPicker.js +185 -0
- package/dist/components/rich-text-editor/RichTextEditorContent.js +129 -0
- package/dist/components/rich-text-editor/RichTextEditorEmojiPicker.js +110 -0
- package/dist/components/rich-text-editor/RichTextEditorFooter.js +33 -0
- package/dist/components/rich-text-editor/RichTextEditorImageDialog.js +74 -0
- package/dist/components/rich-text-editor/RichTextEditorLinkDialog.js +70 -0
- package/dist/components/rich-text-editor/RichTextEditorTableMenu.js +97 -0
- package/dist/components/rich-text-editor/RichTextEditorToolbar.js +362 -0
- package/dist/components/rich-text-editor/util/emojis.js +739 -0
- package/dist/components/shared/ToolbarButton.js +22 -0
- package/dist/components/shared/normalizeSize.js +6 -0
- package/dist/components/sql-editor/SqlEditor.d.ts +1 -1
- package/dist/components/sql-editor/SqlEditor.js +113 -0
- package/dist/components/sql-editor/SqlEditor.types.d.ts +9 -0
- package/dist/components/sql-editor/SqlEditor.types.js +24 -0
- package/dist/components/sql-editor/SqlEditorContent.js +248 -0
- package/dist/components/sql-editor/SqlEditorFooter.js +45 -0
- package/dist/components/sql-editor/SqlEditorHistoryMenu.d.ts +11 -0
- package/dist/components/sql-editor/SqlEditorHistoryMenu.js +75 -0
- package/dist/components/sql-editor/SqlEditorToolbar.d.ts +5 -1
- package/dist/components/sql-editor/SqlEditorToolbar.js +163 -0
- package/dist/components/sql-editor/useSqlQueryHistory.d.ts +6 -0
- package/dist/components/sql-editor/useSqlQueryHistory.js +20 -0
- package/dist/components/sql-editor/util/sqlQueryHistory.util.d.ts +12 -0
- package/dist/components/sql-editor/util/sqlQueryHistory.util.js +28 -0
- package/dist/components/sunburst-chart/SunburstChart.js +292 -0
- package/dist/components/sunburst-chart/SunburstChart.types.js +4 -0
- package/dist/components/tag-selection/TagSelection.js +102 -0
- package/dist/components/tag-selection/TagSelection.store.js +40 -0
- package/dist/components/tag-selection/TagSelection.types.d.ts +2 -0
- package/dist/components/tag-selection/TagSelection.types.js +18 -0
- package/dist/components/tag-selection/TagSelectionAutocomplete.js +382 -0
- package/dist/components/tag-selection/TagSelectionChip.js +30 -0
- package/dist/components/tag-selection/TagSelectionSelectedTags.js +73 -0
- package/dist/index.cjs +2 -2
- package/dist/index.js +23 -8035
- package/package.json +1 -1
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { useRef as e } from "react";
|
|
2
|
+
import { Box as t, IconButton as n, Popover as r, Tooltip as i } from "@mui/material";
|
|
3
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
4
|
+
import s from "@mui/icons-material/FormatColorReset";
|
|
5
|
+
//#region src/components/rich-text-editor/RichTextEditorColorPicker.tsx
|
|
6
|
+
var c = [
|
|
7
|
+
"#000000",
|
|
8
|
+
"#434343",
|
|
9
|
+
"#666666",
|
|
10
|
+
"#999999",
|
|
11
|
+
"#b7b7b7",
|
|
12
|
+
"#ffffff",
|
|
13
|
+
"#ff0000",
|
|
14
|
+
"#ff4500",
|
|
15
|
+
"#ff8c00",
|
|
16
|
+
"#ffd700",
|
|
17
|
+
"#9acd32",
|
|
18
|
+
"#008000",
|
|
19
|
+
"#00ced1",
|
|
20
|
+
"#1e90ff",
|
|
21
|
+
"#0000ff",
|
|
22
|
+
"#8a2be2",
|
|
23
|
+
"#ff1493",
|
|
24
|
+
"#a52a2a"
|
|
25
|
+
], l = [
|
|
26
|
+
"#ffff00",
|
|
27
|
+
"#ffd700",
|
|
28
|
+
"#ffa500",
|
|
29
|
+
"#ff69b4",
|
|
30
|
+
"#ff6347",
|
|
31
|
+
"#fa8072",
|
|
32
|
+
"#adff2f",
|
|
33
|
+
"#90ee90",
|
|
34
|
+
"#00fa9a",
|
|
35
|
+
"#00ffff",
|
|
36
|
+
"#87ceeb",
|
|
37
|
+
"#add8e6",
|
|
38
|
+
"#dda0dd",
|
|
39
|
+
"#ee82ee",
|
|
40
|
+
"#d2b48c",
|
|
41
|
+
"#f5f5dc",
|
|
42
|
+
"#ffffff",
|
|
43
|
+
"#000000"
|
|
44
|
+
];
|
|
45
|
+
function u({ color: e, active: n, onClick: r }) {
|
|
46
|
+
return /* @__PURE__ */ a(i, {
|
|
47
|
+
title: e,
|
|
48
|
+
placement: "top",
|
|
49
|
+
arrow: !0,
|
|
50
|
+
children: /* @__PURE__ */ a(t, {
|
|
51
|
+
component: "button",
|
|
52
|
+
type: "button",
|
|
53
|
+
onClick: () => r(e),
|
|
54
|
+
"aria-label": e,
|
|
55
|
+
"aria-pressed": n,
|
|
56
|
+
sx: {
|
|
57
|
+
width: 22,
|
|
58
|
+
height: 22,
|
|
59
|
+
bgcolor: e,
|
|
60
|
+
border: n ? "2px solid" : "1px solid",
|
|
61
|
+
borderColor: n ? "primary.main" : e === "#ffffff" || e === "#f5f5dc" ? "divider" : "transparent",
|
|
62
|
+
borderRadius: .5,
|
|
63
|
+
cursor: "pointer",
|
|
64
|
+
p: 0,
|
|
65
|
+
display: "flex",
|
|
66
|
+
alignItems: "center",
|
|
67
|
+
justifyContent: "center",
|
|
68
|
+
transition: "transform 0.1s",
|
|
69
|
+
"&:hover": {
|
|
70
|
+
transform: "scale(1.2)",
|
|
71
|
+
zIndex: 1
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
children: n && /* @__PURE__ */ a(t, {
|
|
75
|
+
component: "span",
|
|
76
|
+
sx: {
|
|
77
|
+
width: 10,
|
|
78
|
+
height: 6,
|
|
79
|
+
borderLeft: "2px solid",
|
|
80
|
+
borderBottom: "2px solid",
|
|
81
|
+
borderColor: e === "#ffffff" || e === "#f5f5dc" || e === "#ffd700" || e === "#ffff00" || e === "#adff2f" || e === "#ffa500" || e === "#b7b7b7" || e === "#d2b48c" ? "#000" : "#fff",
|
|
82
|
+
transform: "rotate(-45deg) translateY(-1px)",
|
|
83
|
+
display: "block"
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
})
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function d({ anchorEl: d, open: f, onClose: p, mode: m, activeColor: h, onSelectColor: g, onRemoveColor: _, removeLabel: v }) {
|
|
90
|
+
let y = e(null), b = m === "highlight" ? l : c;
|
|
91
|
+
function x(e) {
|
|
92
|
+
g(e.target.value);
|
|
93
|
+
}
|
|
94
|
+
return /* @__PURE__ */ o(r, {
|
|
95
|
+
open: f,
|
|
96
|
+
anchorEl: d,
|
|
97
|
+
onClose: p,
|
|
98
|
+
anchorOrigin: {
|
|
99
|
+
vertical: "bottom",
|
|
100
|
+
horizontal: "left"
|
|
101
|
+
},
|
|
102
|
+
transformOrigin: {
|
|
103
|
+
vertical: "top",
|
|
104
|
+
horizontal: "left"
|
|
105
|
+
},
|
|
106
|
+
slotProps: { paper: { sx: { p: 1.5 } } },
|
|
107
|
+
children: [/* @__PURE__ */ a(t, {
|
|
108
|
+
sx: {
|
|
109
|
+
display: "grid",
|
|
110
|
+
gridTemplateColumns: "repeat(6, 22px)",
|
|
111
|
+
gap: .5,
|
|
112
|
+
mb: 1
|
|
113
|
+
},
|
|
114
|
+
children: b.map((e) => /* @__PURE__ */ a(u, {
|
|
115
|
+
color: e,
|
|
116
|
+
active: h?.toLowerCase() === e.toLowerCase(),
|
|
117
|
+
onClick: (e) => {
|
|
118
|
+
g(e), p();
|
|
119
|
+
}
|
|
120
|
+
}, e))
|
|
121
|
+
}), /* @__PURE__ */ o(t, {
|
|
122
|
+
sx: {
|
|
123
|
+
display: "flex",
|
|
124
|
+
alignItems: "center",
|
|
125
|
+
gap: .5
|
|
126
|
+
},
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ a(i, {
|
|
129
|
+
title: "Custom color",
|
|
130
|
+
arrow: !0,
|
|
131
|
+
children: /* @__PURE__ */ a(t, {
|
|
132
|
+
component: "button",
|
|
133
|
+
type: "button",
|
|
134
|
+
onClick: () => y.current?.click(),
|
|
135
|
+
"aria-label": "Custom color",
|
|
136
|
+
sx: {
|
|
137
|
+
width: 22,
|
|
138
|
+
height: 22,
|
|
139
|
+
background: "conic-gradient(red, yellow, lime, cyan, blue, magenta, red)",
|
|
140
|
+
border: "1px solid",
|
|
141
|
+
borderColor: "divider",
|
|
142
|
+
borderRadius: .5,
|
|
143
|
+
cursor: "pointer",
|
|
144
|
+
p: 0,
|
|
145
|
+
flexShrink: 0,
|
|
146
|
+
"&:hover": { transform: "scale(1.2)" },
|
|
147
|
+
transition: "transform 0.1s"
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
}),
|
|
151
|
+
/* @__PURE__ */ a("input", {
|
|
152
|
+
ref: y,
|
|
153
|
+
type: "color",
|
|
154
|
+
defaultValue: h ?? "#000000",
|
|
155
|
+
onChange: x,
|
|
156
|
+
onBlur: p,
|
|
157
|
+
style: {
|
|
158
|
+
visibility: "hidden",
|
|
159
|
+
width: 0,
|
|
160
|
+
height: 0,
|
|
161
|
+
position: "absolute"
|
|
162
|
+
}
|
|
163
|
+
}),
|
|
164
|
+
/* @__PURE__ */ a(i, {
|
|
165
|
+
title: v,
|
|
166
|
+
arrow: !0,
|
|
167
|
+
children: /* @__PURE__ */ a(n, {
|
|
168
|
+
size: "small",
|
|
169
|
+
onClick: () => {
|
|
170
|
+
_(), p();
|
|
171
|
+
},
|
|
172
|
+
"aria-label": v,
|
|
173
|
+
sx: {
|
|
174
|
+
borderRadius: 1,
|
|
175
|
+
ml: "auto"
|
|
176
|
+
},
|
|
177
|
+
children: /* @__PURE__ */ a(s, { fontSize: "small" })
|
|
178
|
+
})
|
|
179
|
+
})
|
|
180
|
+
]
|
|
181
|
+
})]
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
//#endregion
|
|
185
|
+
export { d as RichTextEditorColorPicker };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { Box as e } from "@mui/material";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { EditorContent as n } from "@tiptap/react";
|
|
4
|
+
//#region src/components/rich-text-editor/RichTextEditorContent.tsx
|
|
5
|
+
function r({ editor: r, error: i, disabled: a, readonly: o }) {
|
|
6
|
+
return /* @__PURE__ */ t(e, {
|
|
7
|
+
sx: {
|
|
8
|
+
flex: 1,
|
|
9
|
+
minHeight: 0,
|
|
10
|
+
display: "flex",
|
|
11
|
+
flexDirection: "column",
|
|
12
|
+
px: 1.5,
|
|
13
|
+
py: 1,
|
|
14
|
+
cursor: a || o ? "default" : "text",
|
|
15
|
+
opacity: a ? .5 : 1,
|
|
16
|
+
"& > div": {
|
|
17
|
+
flex: 1,
|
|
18
|
+
display: "flex",
|
|
19
|
+
flexDirection: "column",
|
|
20
|
+
minHeight: 0
|
|
21
|
+
},
|
|
22
|
+
"& .ProseMirror": {
|
|
23
|
+
flex: 1,
|
|
24
|
+
minHeight: 0,
|
|
25
|
+
overflowY: "auto",
|
|
26
|
+
overflowX: "hidden",
|
|
27
|
+
wordBreak: "break-word",
|
|
28
|
+
overflowWrap: "break-word",
|
|
29
|
+
outline: "none",
|
|
30
|
+
"& p.is-editor-empty:first-of-type::before": {
|
|
31
|
+
content: "attr(data-placeholder)",
|
|
32
|
+
color: "text.disabled",
|
|
33
|
+
pointerEvents: "none",
|
|
34
|
+
float: "left",
|
|
35
|
+
height: 0
|
|
36
|
+
},
|
|
37
|
+
"& h1": {
|
|
38
|
+
typography: "h4",
|
|
39
|
+
mb: 1
|
|
40
|
+
},
|
|
41
|
+
"& h2": {
|
|
42
|
+
typography: "h5",
|
|
43
|
+
mb: 1
|
|
44
|
+
},
|
|
45
|
+
"& h3": {
|
|
46
|
+
typography: "h6",
|
|
47
|
+
mb: 1
|
|
48
|
+
},
|
|
49
|
+
"& p": { my: .5 },
|
|
50
|
+
"& ul, & ol": { pl: 3 },
|
|
51
|
+
"& blockquote": {
|
|
52
|
+
borderLeft: "4px solid",
|
|
53
|
+
borderColor: i ? "error.main" : "divider",
|
|
54
|
+
pl: 2,
|
|
55
|
+
color: "text.secondary",
|
|
56
|
+
my: 1
|
|
57
|
+
},
|
|
58
|
+
"& code": {
|
|
59
|
+
bgcolor: "action.hover",
|
|
60
|
+
px: .5,
|
|
61
|
+
borderRadius: .5,
|
|
62
|
+
fontFamily: "monospace",
|
|
63
|
+
fontSize: "0.875em"
|
|
64
|
+
},
|
|
65
|
+
"& pre": {
|
|
66
|
+
bgcolor: "action.hover",
|
|
67
|
+
p: 1.5,
|
|
68
|
+
borderRadius: 1,
|
|
69
|
+
overflowX: "auto",
|
|
70
|
+
"& code": {
|
|
71
|
+
bgcolor: "transparent",
|
|
72
|
+
px: 0
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"& a": {
|
|
76
|
+
color: "primary.main",
|
|
77
|
+
cursor: "pointer"
|
|
78
|
+
},
|
|
79
|
+
"& mark": {
|
|
80
|
+
borderRadius: .5,
|
|
81
|
+
px: .25
|
|
82
|
+
},
|
|
83
|
+
"& hr": {
|
|
84
|
+
borderColor: "divider",
|
|
85
|
+
my: 2
|
|
86
|
+
},
|
|
87
|
+
"& table": {
|
|
88
|
+
borderCollapse: "collapse",
|
|
89
|
+
tableLayout: "fixed",
|
|
90
|
+
width: "100%",
|
|
91
|
+
margin: "8px 0",
|
|
92
|
+
overflowX: "auto"
|
|
93
|
+
},
|
|
94
|
+
"& table td, & table th": {
|
|
95
|
+
border: "1px solid",
|
|
96
|
+
borderColor: "divider",
|
|
97
|
+
padding: "6px 8px",
|
|
98
|
+
verticalAlign: "top",
|
|
99
|
+
boxSizing: "border-box",
|
|
100
|
+
minWidth: "2em",
|
|
101
|
+
position: "relative"
|
|
102
|
+
},
|
|
103
|
+
"& table th": {
|
|
104
|
+
fontWeight: "bold",
|
|
105
|
+
bgcolor: "action.hover"
|
|
106
|
+
},
|
|
107
|
+
"& table .selectedCell::after": {
|
|
108
|
+
content: "\"\"",
|
|
109
|
+
position: "absolute",
|
|
110
|
+
inset: 0,
|
|
111
|
+
bgcolor: "primary.main",
|
|
112
|
+
opacity: .12,
|
|
113
|
+
pointerEvents: "none",
|
|
114
|
+
zIndex: 2
|
|
115
|
+
},
|
|
116
|
+
"& img": {
|
|
117
|
+
maxWidth: "100%",
|
|
118
|
+
height: "auto",
|
|
119
|
+
borderRadius: "4px",
|
|
120
|
+
display: "block",
|
|
121
|
+
my: 1
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
children: /* @__PURE__ */ t(n, { editor: r })
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
//#endregion
|
|
129
|
+
export { r as RichTextEditorContent };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { EMOJI_CATEGORIES as e } from "./util/emojis.js";
|
|
2
|
+
import { useMemo as t, useState as n } from "react";
|
|
3
|
+
import { Box as r, InputAdornment as i, Popover as a, TextField as o, Typography as s } from "@mui/material";
|
|
4
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
5
|
+
import u from "@mui/icons-material/Search";
|
|
6
|
+
//#region src/components/rich-text-editor/RichTextEditorEmojiPicker.tsx
|
|
7
|
+
function d({ anchorEl: d, open: f, onClose: p, onSelect: m, translation: h }) {
|
|
8
|
+
let [g, _] = n(""), v = t(() => {
|
|
9
|
+
let t = g.trim().toLowerCase();
|
|
10
|
+
return t ? e.map((e) => ({
|
|
11
|
+
...e,
|
|
12
|
+
emojis: e.emojis.filter((e) => e.name.includes(t) || e.emoji === t)
|
|
13
|
+
})).filter((e) => e.emojis.length > 0) : e;
|
|
14
|
+
}, [g]);
|
|
15
|
+
function y(e) {
|
|
16
|
+
m(e), p(), _("");
|
|
17
|
+
}
|
|
18
|
+
function b() {
|
|
19
|
+
p(), _("");
|
|
20
|
+
}
|
|
21
|
+
return /* @__PURE__ */ l(a, {
|
|
22
|
+
open: f,
|
|
23
|
+
anchorEl: d,
|
|
24
|
+
onClose: b,
|
|
25
|
+
anchorOrigin: {
|
|
26
|
+
vertical: "bottom",
|
|
27
|
+
horizontal: "left"
|
|
28
|
+
},
|
|
29
|
+
transformOrigin: {
|
|
30
|
+
vertical: "top",
|
|
31
|
+
horizontal: "left"
|
|
32
|
+
},
|
|
33
|
+
slotProps: { paper: { sx: {
|
|
34
|
+
width: 320,
|
|
35
|
+
maxHeight: 380,
|
|
36
|
+
display: "flex",
|
|
37
|
+
flexDirection: "column"
|
|
38
|
+
} } },
|
|
39
|
+
children: [/* @__PURE__ */ c(r, {
|
|
40
|
+
sx: {
|
|
41
|
+
p: 1,
|
|
42
|
+
borderBottom: 1,
|
|
43
|
+
borderColor: "divider"
|
|
44
|
+
},
|
|
45
|
+
children: /* @__PURE__ */ c(o, {
|
|
46
|
+
autoFocus: !0,
|
|
47
|
+
fullWidth: !0,
|
|
48
|
+
size: "small",
|
|
49
|
+
placeholder: h.emojiSearchPlaceholder,
|
|
50
|
+
value: g,
|
|
51
|
+
onChange: (e) => _(e.target.value),
|
|
52
|
+
slotProps: { input: { startAdornment: /* @__PURE__ */ c(i, {
|
|
53
|
+
position: "start",
|
|
54
|
+
children: /* @__PURE__ */ c(u, { fontSize: "small" })
|
|
55
|
+
}) } }
|
|
56
|
+
})
|
|
57
|
+
}), /* @__PURE__ */ l(r, {
|
|
58
|
+
sx: {
|
|
59
|
+
overflowY: "auto",
|
|
60
|
+
flex: 1,
|
|
61
|
+
px: 1,
|
|
62
|
+
pb: 1
|
|
63
|
+
},
|
|
64
|
+
children: [v.map((e) => /* @__PURE__ */ l(r, { children: [/* @__PURE__ */ c(s, {
|
|
65
|
+
variant: "caption",
|
|
66
|
+
sx: {
|
|
67
|
+
display: "block",
|
|
68
|
+
color: "text.secondary",
|
|
69
|
+
mt: 1,
|
|
70
|
+
mb: .5,
|
|
71
|
+
px: .5
|
|
72
|
+
},
|
|
73
|
+
children: e.label
|
|
74
|
+
}), /* @__PURE__ */ c(r, {
|
|
75
|
+
sx: {
|
|
76
|
+
display: "flex",
|
|
77
|
+
flexWrap: "wrap",
|
|
78
|
+
gap: .25
|
|
79
|
+
},
|
|
80
|
+
children: e.emojis.map((e) => /* @__PURE__ */ c(r, {
|
|
81
|
+
component: "button",
|
|
82
|
+
title: e.name,
|
|
83
|
+
"aria-label": e.name,
|
|
84
|
+
onClick: () => y(e.emoji),
|
|
85
|
+
sx: {
|
|
86
|
+
border: "none",
|
|
87
|
+
background: "none",
|
|
88
|
+
cursor: "pointer",
|
|
89
|
+
fontSize: "1.375rem",
|
|
90
|
+
lineHeight: 1,
|
|
91
|
+
p: .5,
|
|
92
|
+
borderRadius: 1,
|
|
93
|
+
"&:hover": { bgcolor: "action.hover" }
|
|
94
|
+
},
|
|
95
|
+
children: e.emoji
|
|
96
|
+
}, e.emoji))
|
|
97
|
+
})] }, e.label)), v.length === 0 && /* @__PURE__ */ c(s, {
|
|
98
|
+
variant: "body2",
|
|
99
|
+
color: "text.secondary",
|
|
100
|
+
sx: {
|
|
101
|
+
p: 2,
|
|
102
|
+
textAlign: "center"
|
|
103
|
+
},
|
|
104
|
+
children: "No emoji found"
|
|
105
|
+
})]
|
|
106
|
+
})]
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
export { d as RichTextEditorEmojiPicker };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Box as e, FormHelperText as t } from "@mui/material";
|
|
2
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/rich-text-editor/RichTextEditorFooter.tsx
|
|
4
|
+
function i({ helperText: i, error: a, showCharacterCount: o, charCount: s, maxCharacters: c, showWordCount: l, wordCount: u, translation: d }) {
|
|
5
|
+
let f = c === void 0 ? d.characterCount.replace("{count}", String(s)) : d.characterCountMax.replace("{count}", String(s)).replace("{max}", String(c)), p = c !== void 0 && s >= c ? "error" : "text.secondary", m = d.wordCount.replace("{count}", String(u));
|
|
6
|
+
return /* @__PURE__ */ r(e, {
|
|
7
|
+
sx: {
|
|
8
|
+
display: "flex",
|
|
9
|
+
justifyContent: "space-between",
|
|
10
|
+
mt: .5,
|
|
11
|
+
px: .5
|
|
12
|
+
},
|
|
13
|
+
children: [/* @__PURE__ */ n(t, {
|
|
14
|
+
error: a,
|
|
15
|
+
children: i ?? ""
|
|
16
|
+
}), (o || l) && /* @__PURE__ */ r(e, {
|
|
17
|
+
sx: {
|
|
18
|
+
display: "flex",
|
|
19
|
+
gap: 1.5,
|
|
20
|
+
alignItems: "center"
|
|
21
|
+
},
|
|
22
|
+
children: [l && /* @__PURE__ */ n(t, {
|
|
23
|
+
sx: { color: "text.secondary" },
|
|
24
|
+
children: m
|
|
25
|
+
}), o && /* @__PURE__ */ n(t, {
|
|
26
|
+
sx: { color: p },
|
|
27
|
+
children: f
|
|
28
|
+
})]
|
|
29
|
+
})]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { i as RichTextEditorFooter };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { useState as e } from "react";
|
|
2
|
+
import { Button as t, Dialog as n, DialogActions as r, DialogContent as i, DialogTitle as a, TextField as o } from "@mui/material";
|
|
3
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/rich-text-editor/RichTextEditorImageDialog.tsx
|
|
5
|
+
function l({ open: l, onClose: u, editor: d, translation: f }) {
|
|
6
|
+
let [p, m] = e(""), [h, g] = e("");
|
|
7
|
+
function _() {
|
|
8
|
+
let e = p.trim();
|
|
9
|
+
e && (d.chain().focus().setImage({
|
|
10
|
+
src: e,
|
|
11
|
+
alt: h.trim() || void 0
|
|
12
|
+
}).run(), m(""), g(""), u());
|
|
13
|
+
}
|
|
14
|
+
function v() {
|
|
15
|
+
m(""), g(""), u();
|
|
16
|
+
}
|
|
17
|
+
function y(e) {
|
|
18
|
+
e.key === "Enter" && _();
|
|
19
|
+
}
|
|
20
|
+
return /* @__PURE__ */ c(n, {
|
|
21
|
+
open: l,
|
|
22
|
+
onClose: v,
|
|
23
|
+
maxWidth: "sm",
|
|
24
|
+
fullWidth: !0,
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ s(a, { children: f.imageDialogTitle }),
|
|
27
|
+
/* @__PURE__ */ c(i, {
|
|
28
|
+
sx: {
|
|
29
|
+
display: "flex",
|
|
30
|
+
flexDirection: "column",
|
|
31
|
+
gap: 2,
|
|
32
|
+
pt: "16px !important"
|
|
33
|
+
},
|
|
34
|
+
children: [/* @__PURE__ */ s(o, {
|
|
35
|
+
autoFocus: !0,
|
|
36
|
+
fullWidth: !0,
|
|
37
|
+
label: f.imageDialogUrlLabel,
|
|
38
|
+
value: p,
|
|
39
|
+
onChange: (e) => m(e.target.value),
|
|
40
|
+
onKeyDown: y,
|
|
41
|
+
variant: "outlined",
|
|
42
|
+
size: "small",
|
|
43
|
+
placeholder: "https://example.com/image.png"
|
|
44
|
+
}), /* @__PURE__ */ s(o, {
|
|
45
|
+
fullWidth: !0,
|
|
46
|
+
label: f.imageDialogAltLabel,
|
|
47
|
+
value: h,
|
|
48
|
+
onChange: (e) => g(e.target.value),
|
|
49
|
+
onKeyDown: y,
|
|
50
|
+
variant: "outlined",
|
|
51
|
+
size: "small"
|
|
52
|
+
})]
|
|
53
|
+
}),
|
|
54
|
+
/* @__PURE__ */ c(r, {
|
|
55
|
+
sx: {
|
|
56
|
+
px: 3,
|
|
57
|
+
pb: 2,
|
|
58
|
+
gap: 1
|
|
59
|
+
},
|
|
60
|
+
children: [/* @__PURE__ */ s(t, {
|
|
61
|
+
onClick: v,
|
|
62
|
+
children: f.imageDialogCancel
|
|
63
|
+
}), /* @__PURE__ */ s(t, {
|
|
64
|
+
onClick: _,
|
|
65
|
+
variant: "contained",
|
|
66
|
+
disabled: !p.trim(),
|
|
67
|
+
children: f.imageDialogSave
|
|
68
|
+
})]
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
export { l as RichTextEditorImageDialog };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { useEffect as e, useState as t } from "react";
|
|
2
|
+
import { Button as n, Dialog as r, DialogActions as i, DialogContent as a, DialogTitle as o, TextField as s } from "@mui/material";
|
|
3
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/rich-text-editor/RichTextEditorLinkDialog.tsx
|
|
5
|
+
function u({ open: u, onClose: d, editor: f, translation: p }) {
|
|
6
|
+
let [m, h] = t("");
|
|
7
|
+
e(() => {
|
|
8
|
+
if (u) {
|
|
9
|
+
let e = f.getAttributes("link").href;
|
|
10
|
+
h(e ?? "");
|
|
11
|
+
}
|
|
12
|
+
}, [u, f]);
|
|
13
|
+
let g = f.isActive("link");
|
|
14
|
+
function _() {
|
|
15
|
+
m.trim() ? f.chain().focus().extendMarkRange("link").setLink({ href: m.trim() }).run() : f.chain().focus().extendMarkRange("link").unsetLink().run(), d();
|
|
16
|
+
}
|
|
17
|
+
function v() {
|
|
18
|
+
f.chain().focus().extendMarkRange("link").unsetLink().run(), d();
|
|
19
|
+
}
|
|
20
|
+
function y(e) {
|
|
21
|
+
e.key === "Enter" && _();
|
|
22
|
+
}
|
|
23
|
+
return /* @__PURE__ */ l(r, {
|
|
24
|
+
open: u,
|
|
25
|
+
onClose: d,
|
|
26
|
+
maxWidth: "sm",
|
|
27
|
+
fullWidth: !0,
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ c(o, { children: p.linkDialogTitle }),
|
|
30
|
+
/* @__PURE__ */ c(a, { children: /* @__PURE__ */ c(s, {
|
|
31
|
+
autoFocus: !0,
|
|
32
|
+
fullWidth: !0,
|
|
33
|
+
label: p.linkDialogUrlLabel,
|
|
34
|
+
value: m,
|
|
35
|
+
onChange: (e) => h(e.target.value),
|
|
36
|
+
onKeyDown: y,
|
|
37
|
+
variant: "outlined",
|
|
38
|
+
size: "small",
|
|
39
|
+
sx: { mt: 1 },
|
|
40
|
+
placeholder: "https://"
|
|
41
|
+
}) }),
|
|
42
|
+
/* @__PURE__ */ l(i, {
|
|
43
|
+
sx: {
|
|
44
|
+
px: 3,
|
|
45
|
+
pb: 2,
|
|
46
|
+
gap: 1
|
|
47
|
+
},
|
|
48
|
+
children: [
|
|
49
|
+
g && /* @__PURE__ */ c(n, {
|
|
50
|
+
onClick: v,
|
|
51
|
+
color: "error",
|
|
52
|
+
sx: { mr: "auto" },
|
|
53
|
+
children: p.linkDialogRemove
|
|
54
|
+
}),
|
|
55
|
+
/* @__PURE__ */ c(n, {
|
|
56
|
+
onClick: d,
|
|
57
|
+
children: p.linkDialogCancel
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ c(n, {
|
|
60
|
+
onClick: _,
|
|
61
|
+
variant: "contained",
|
|
62
|
+
children: p.linkDialogSave
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
})
|
|
66
|
+
]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { u as RichTextEditorLinkDialog };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { useState as e } from "react";
|
|
2
|
+
import { Divider as t, IconButton as n, ListItemIcon as r, ListItemText as i, Menu as a, MenuItem as o, Tooltip as s } from "@mui/material";
|
|
3
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
4
|
+
import d from "@mui/icons-material/Delete";
|
|
5
|
+
import f from "@mui/icons-material/Add";
|
|
6
|
+
import p from "@mui/icons-material/TableChart";
|
|
7
|
+
//#region src/components/rich-text-editor/RichTextEditorTableMenu.tsx
|
|
8
|
+
function m({ editor: m, translation: h, disabled: g }) {
|
|
9
|
+
let [_, v] = e(null), y = g || !m, b = m?.isActive("table") ?? !1;
|
|
10
|
+
function x() {
|
|
11
|
+
v(null);
|
|
12
|
+
}
|
|
13
|
+
function S(e) {
|
|
14
|
+
e(), x();
|
|
15
|
+
}
|
|
16
|
+
return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(s, {
|
|
17
|
+
title: h.table,
|
|
18
|
+
arrow: !0,
|
|
19
|
+
children: /* @__PURE__ */ l("span", { children: /* @__PURE__ */ l(n, {
|
|
20
|
+
size: "small",
|
|
21
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
22
|
+
onClick: (e) => v(e.currentTarget),
|
|
23
|
+
disabled: y,
|
|
24
|
+
color: b ? "primary" : "default",
|
|
25
|
+
sx: { borderRadius: 1 },
|
|
26
|
+
"aria-label": h.table,
|
|
27
|
+
"aria-pressed": b,
|
|
28
|
+
children: /* @__PURE__ */ l(p, { fontSize: "small" })
|
|
29
|
+
}) })
|
|
30
|
+
}), /* @__PURE__ */ u(a, {
|
|
31
|
+
anchorEl: _,
|
|
32
|
+
open: !!_,
|
|
33
|
+
onClose: x,
|
|
34
|
+
slotProps: { paper: { sx: { minWidth: 220 } } },
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ u(o, {
|
|
37
|
+
onClick: () => S(() => m?.chain().focus().insertTable({
|
|
38
|
+
rows: 3,
|
|
39
|
+
cols: 3,
|
|
40
|
+
withHeaderRow: !0
|
|
41
|
+
}).run()),
|
|
42
|
+
children: [/* @__PURE__ */ l(r, { children: /* @__PURE__ */ l(p, { fontSize: "small" }) }), /* @__PURE__ */ l(i, { children: h.insertTable })]
|
|
43
|
+
}),
|
|
44
|
+
b && /* @__PURE__ */ l(t, {}),
|
|
45
|
+
b && /* @__PURE__ */ u(o, {
|
|
46
|
+
onClick: () => S(() => m?.chain().focus().addRowBefore().run()),
|
|
47
|
+
children: [/* @__PURE__ */ l(r, { children: /* @__PURE__ */ l(f, { fontSize: "small" }) }), /* @__PURE__ */ l(i, { children: h.addRowBefore })]
|
|
48
|
+
}),
|
|
49
|
+
b && /* @__PURE__ */ u(o, {
|
|
50
|
+
onClick: () => S(() => m?.chain().focus().addRowAfter().run()),
|
|
51
|
+
children: [/* @__PURE__ */ l(r, { children: /* @__PURE__ */ l(f, { fontSize: "small" }) }), /* @__PURE__ */ l(i, { children: h.addRowAfter })]
|
|
52
|
+
}),
|
|
53
|
+
b && /* @__PURE__ */ u(o, {
|
|
54
|
+
onClick: () => S(() => m?.chain().focus().deleteRow().run()),
|
|
55
|
+
children: [/* @__PURE__ */ l(r, { children: /* @__PURE__ */ l(d, {
|
|
56
|
+
fontSize: "small",
|
|
57
|
+
color: "error"
|
|
58
|
+
}) }), /* @__PURE__ */ l(i, {
|
|
59
|
+
sx: { color: "error.main" },
|
|
60
|
+
children: h.deleteRow
|
|
61
|
+
})]
|
|
62
|
+
}),
|
|
63
|
+
b && /* @__PURE__ */ l(t, {}),
|
|
64
|
+
b && /* @__PURE__ */ u(o, {
|
|
65
|
+
onClick: () => S(() => m?.chain().focus().addColumnBefore().run()),
|
|
66
|
+
children: [/* @__PURE__ */ l(r, { children: /* @__PURE__ */ l(f, { fontSize: "small" }) }), /* @__PURE__ */ l(i, { children: h.addColumnBefore })]
|
|
67
|
+
}),
|
|
68
|
+
b && /* @__PURE__ */ u(o, {
|
|
69
|
+
onClick: () => S(() => m?.chain().focus().addColumnAfter().run()),
|
|
70
|
+
children: [/* @__PURE__ */ l(r, { children: /* @__PURE__ */ l(f, { fontSize: "small" }) }), /* @__PURE__ */ l(i, { children: h.addColumnAfter })]
|
|
71
|
+
}),
|
|
72
|
+
b && /* @__PURE__ */ u(o, {
|
|
73
|
+
onClick: () => S(() => m?.chain().focus().deleteColumn().run()),
|
|
74
|
+
children: [/* @__PURE__ */ l(r, { children: /* @__PURE__ */ l(d, {
|
|
75
|
+
fontSize: "small",
|
|
76
|
+
color: "error"
|
|
77
|
+
}) }), /* @__PURE__ */ l(i, {
|
|
78
|
+
sx: { color: "error.main" },
|
|
79
|
+
children: h.deleteColumn
|
|
80
|
+
})]
|
|
81
|
+
}),
|
|
82
|
+
b && /* @__PURE__ */ l(t, {}),
|
|
83
|
+
b && /* @__PURE__ */ u(o, {
|
|
84
|
+
onClick: () => S(() => m?.chain().focus().deleteTable().run()),
|
|
85
|
+
children: [/* @__PURE__ */ l(r, { children: /* @__PURE__ */ l(d, {
|
|
86
|
+
fontSize: "small",
|
|
87
|
+
color: "error"
|
|
88
|
+
}) }), /* @__PURE__ */ l(i, {
|
|
89
|
+
sx: { color: "error.main" },
|
|
90
|
+
children: h.deleteTable
|
|
91
|
+
})]
|
|
92
|
+
})
|
|
93
|
+
]
|
|
94
|
+
})] });
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
export { m as RichTextEditorTableMenu };
|