@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,18 @@
|
|
|
1
|
+
//#region src/components/tag-selection/TagSelection.types.ts
|
|
2
|
+
var e = {
|
|
3
|
+
selectedTagsLabel: "Selected tags",
|
|
4
|
+
autoCompleteLabel: "Search and add tags",
|
|
5
|
+
noSelectedTagsText: "No tags selected.",
|
|
6
|
+
noAvailableTagsText: "No tags available.",
|
|
7
|
+
placeholder: "Type to search...",
|
|
8
|
+
loadingText: "Loading...",
|
|
9
|
+
maxTagsReachedText: "Maximum number of tags reached.",
|
|
10
|
+
colorPickerLabel: "Custom color",
|
|
11
|
+
backgroundColorLabel: "Background color",
|
|
12
|
+
textColorLabel: "Text color",
|
|
13
|
+
autoTextColorLabel: "Auto",
|
|
14
|
+
confirmCreateLabel: "Confirm new tag",
|
|
15
|
+
cancelCreateLabel: "Cancel new tag"
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { e as DEFAULT_TAG_SELECTION_TRANSLATION };
|
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
import { useState as e } from "react";
|
|
2
|
+
import { Autocomplete as t, Box as n, Chip as r, IconButton as i, Stack as a, Switch as ee, TextField as o, Tooltip as s, Typography as c } from "@mui/material";
|
|
3
|
+
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
4
|
+
import te from "@mui/icons-material/Check";
|
|
5
|
+
import f from "@mui/icons-material/Close";
|
|
6
|
+
//#region src/components/tag-selection/TagSelectionAutocomplete.tsx
|
|
7
|
+
var ne = [
|
|
8
|
+
"default",
|
|
9
|
+
"primary",
|
|
10
|
+
"secondary",
|
|
11
|
+
"error",
|
|
12
|
+
"info",
|
|
13
|
+
"success",
|
|
14
|
+
"warning"
|
|
15
|
+
], p = [
|
|
16
|
+
"#f44336",
|
|
17
|
+
"#e91e63",
|
|
18
|
+
"#9c27b0",
|
|
19
|
+
"#673ab7",
|
|
20
|
+
"#3f51b5",
|
|
21
|
+
"#2196f3",
|
|
22
|
+
"#03a9f4",
|
|
23
|
+
"#00bcd4",
|
|
24
|
+
"#009688",
|
|
25
|
+
"#4caf50",
|
|
26
|
+
"#8bc34a",
|
|
27
|
+
"#cddc39",
|
|
28
|
+
"#ffeb3b",
|
|
29
|
+
"#ffc107",
|
|
30
|
+
"#ff9800",
|
|
31
|
+
"#ff5722",
|
|
32
|
+
"#795548",
|
|
33
|
+
"#9e9e9e",
|
|
34
|
+
"#607d8b",
|
|
35
|
+
"#000000"
|
|
36
|
+
];
|
|
37
|
+
function m(e) {
|
|
38
|
+
return /^#[0-9A-Fa-f]{6}$/.test(e);
|
|
39
|
+
}
|
|
40
|
+
function h(e) {
|
|
41
|
+
let t = parseInt(e.slice(1, 3), 16), n = parseInt(e.slice(3, 5), 16), r = parseInt(e.slice(5, 7), 16);
|
|
42
|
+
return (.299 * t + .587 * n + .114 * r) / 255 > .5 ? "#000000" : "#ffffff";
|
|
43
|
+
}
|
|
44
|
+
function g(e, t) {
|
|
45
|
+
let n = t.trim();
|
|
46
|
+
if (!n) return e;
|
|
47
|
+
let r = e.toLowerCase().indexOf(n.toLowerCase());
|
|
48
|
+
return r === -1 ? e : /* @__PURE__ */ d(l, { children: [
|
|
49
|
+
e.slice(0, r),
|
|
50
|
+
/* @__PURE__ */ u("strong", { children: e.slice(r, r + n.length) }),
|
|
51
|
+
e.slice(r + n.length)
|
|
52
|
+
] });
|
|
53
|
+
}
|
|
54
|
+
function _({ color: e, selected: t, onClick: r }) {
|
|
55
|
+
return /* @__PURE__ */ u(n, {
|
|
56
|
+
onClick: r,
|
|
57
|
+
sx: {
|
|
58
|
+
width: 24,
|
|
59
|
+
height: 24,
|
|
60
|
+
borderRadius: .5,
|
|
61
|
+
backgroundColor: e,
|
|
62
|
+
cursor: "pointer",
|
|
63
|
+
border: "2px solid",
|
|
64
|
+
borderColor: t ? "primary.main" : "transparent",
|
|
65
|
+
outline: t ? "1px solid" : "none",
|
|
66
|
+
outlineColor: "primary.main",
|
|
67
|
+
outlineOffset: 1,
|
|
68
|
+
flexShrink: 0,
|
|
69
|
+
"&:hover": {
|
|
70
|
+
transform: "scale(1.2)",
|
|
71
|
+
borderColor: "primary.main"
|
|
72
|
+
},
|
|
73
|
+
transition: "transform 0.1s"
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function v({ value: e, onChange: t, disabled: r = !1 }) {
|
|
78
|
+
return /* @__PURE__ */ u(o, {
|
|
79
|
+
size: "small",
|
|
80
|
+
fullWidth: !0,
|
|
81
|
+
value: e,
|
|
82
|
+
onChange: (e) => t(e.target.value),
|
|
83
|
+
placeholder: "#rrggbb",
|
|
84
|
+
disabled: r,
|
|
85
|
+
error: !r && e.length > 1 && !m(e),
|
|
86
|
+
sx: {
|
|
87
|
+
"& .MuiInputBase-root": { height: 28 },
|
|
88
|
+
"& .MuiInputBase-input": {
|
|
89
|
+
py: 0,
|
|
90
|
+
px: .5,
|
|
91
|
+
fontSize: "0.72rem",
|
|
92
|
+
fontFamily: "monospace"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
slotProps: { input: { startAdornment: /* @__PURE__ */ u(n, { sx: {
|
|
96
|
+
width: 12,
|
|
97
|
+
height: 12,
|
|
98
|
+
borderRadius: .25,
|
|
99
|
+
flexShrink: 0,
|
|
100
|
+
mr: .5,
|
|
101
|
+
backgroundColor: m(e) ? e : "action.disabledBackground",
|
|
102
|
+
border: "1px solid",
|
|
103
|
+
borderColor: "divider"
|
|
104
|
+
} }) } }
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function y({ availableTags: y, searchValue: b, translation: x, onSearchChange: S, onTagSelect: re, onTagCreate: C, inputSize: w = "medium", chipSize: T = "medium", disabled: E = !1, loading: ie = !1, isMaxReached: D = !1, allowCreate: O = !1, listboxMaxHeight: k }) {
|
|
108
|
+
let [A, j] = e("default"), [M, N] = e(null), [P, F] = e(null), [I, L] = e(!0), [R, z] = e(!1), [B, V] = e(!1), [H, U] = e("#1976d2"), [W, G] = e("#ffffff"), K = E || D, q = M !== null, J = y.filter((e) => e.label.toLowerCase().includes(b.trim().toLowerCase())), Y = O && b.trim() !== "" && J.length === 0, ae = B && !Y, X = q ? I ? h(M) : P ?? "#000000" : void 0, Z = () => {
|
|
109
|
+
let e = b.trim(), t = e.toLowerCase().replace(/\s+/g, "-");
|
|
110
|
+
C?.(q && M ? {
|
|
111
|
+
id: t,
|
|
112
|
+
label: e,
|
|
113
|
+
selected: !0,
|
|
114
|
+
color: "default",
|
|
115
|
+
backgroundColor: M,
|
|
116
|
+
foregroundColor: X
|
|
117
|
+
} : {
|
|
118
|
+
id: t,
|
|
119
|
+
label: e,
|
|
120
|
+
selected: !0,
|
|
121
|
+
color: A
|
|
122
|
+
}), j("default"), N(null), F(null), L(!0), z(!1), S("");
|
|
123
|
+
}, Q = () => {
|
|
124
|
+
S(""), j("default"), N(null), F(null), L(!0), z(!1);
|
|
125
|
+
}, oe = (e) => {
|
|
126
|
+
N(e), U(e), j("default");
|
|
127
|
+
}, se = (e) => {
|
|
128
|
+
U(e), m(e) && (N(e), j("default"));
|
|
129
|
+
}, ce = (e) => {
|
|
130
|
+
F(e), G(e);
|
|
131
|
+
}, le = (e) => {
|
|
132
|
+
G(e), m(e) && F(e);
|
|
133
|
+
}, ue = (e) => {
|
|
134
|
+
if (L(e), e) F(null);
|
|
135
|
+
else if (M) {
|
|
136
|
+
let e = h(M);
|
|
137
|
+
F(e), G(e);
|
|
138
|
+
}
|
|
139
|
+
}, $ = (e) => e.preventDefault();
|
|
140
|
+
return /* @__PURE__ */ d(n, {
|
|
141
|
+
sx: { mb: 2 },
|
|
142
|
+
children: [/* @__PURE__ */ u(t, {
|
|
143
|
+
options: y,
|
|
144
|
+
value: null,
|
|
145
|
+
open: ae,
|
|
146
|
+
onOpen: () => {
|
|
147
|
+
Y || V(!0);
|
|
148
|
+
},
|
|
149
|
+
onClose: () => V(!1),
|
|
150
|
+
size: w,
|
|
151
|
+
disabled: K,
|
|
152
|
+
loading: ie,
|
|
153
|
+
getOptionLabel: (e) => e.label,
|
|
154
|
+
inputValue: b,
|
|
155
|
+
onInputChange: (e, t) => S(t),
|
|
156
|
+
onChange: (e, t) => {
|
|
157
|
+
t && re(t);
|
|
158
|
+
},
|
|
159
|
+
slotProps: { listbox: { sx: {
|
|
160
|
+
display: "flex",
|
|
161
|
+
flexWrap: "wrap",
|
|
162
|
+
gap: 1,
|
|
163
|
+
padding: 1,
|
|
164
|
+
...k !== void 0 && {
|
|
165
|
+
maxHeight: k,
|
|
166
|
+
overflowY: "auto"
|
|
167
|
+
}
|
|
168
|
+
} } },
|
|
169
|
+
renderInput: (e) => /* @__PURE__ */ u(o, {
|
|
170
|
+
...e,
|
|
171
|
+
label: x.autoCompleteLabel,
|
|
172
|
+
placeholder: x.placeholder,
|
|
173
|
+
helperText: D && !E ? x.maxTagsReachedText : void 0,
|
|
174
|
+
onKeyDown: (e) => {
|
|
175
|
+
Y && e.key === "Enter" && (e.preventDefault(), Z());
|
|
176
|
+
},
|
|
177
|
+
slotProps: {
|
|
178
|
+
...e.slotProps,
|
|
179
|
+
input: {
|
|
180
|
+
...e.slotProps?.input,
|
|
181
|
+
endAdornment: /* @__PURE__ */ d(l, { children: [Y && /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(i, {
|
|
182
|
+
size: "small",
|
|
183
|
+
sx: { color: "success.main" },
|
|
184
|
+
onMouseDown: $,
|
|
185
|
+
onClick: Z,
|
|
186
|
+
"aria-label": x.confirmCreateLabel,
|
|
187
|
+
children: /* @__PURE__ */ u(te, { fontSize: "small" })
|
|
188
|
+
}), /* @__PURE__ */ u(i, {
|
|
189
|
+
size: "small",
|
|
190
|
+
onMouseDown: $,
|
|
191
|
+
onClick: Q,
|
|
192
|
+
"aria-label": x.cancelCreateLabel,
|
|
193
|
+
children: /* @__PURE__ */ u(f, { fontSize: "small" })
|
|
194
|
+
})] }), e.slotProps?.input?.endAdornment] })
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}),
|
|
198
|
+
renderOption: ({ key: e, ...t }, n) => {
|
|
199
|
+
let i = !!(n.foregroundColor || n.backgroundColor);
|
|
200
|
+
return /* @__PURE__ */ u("li", {
|
|
201
|
+
...t,
|
|
202
|
+
style: {
|
|
203
|
+
width: "auto",
|
|
204
|
+
padding: 0,
|
|
205
|
+
margin: 0
|
|
206
|
+
},
|
|
207
|
+
children: /* @__PURE__ */ u(r, {
|
|
208
|
+
size: T,
|
|
209
|
+
label: g(n.label, b),
|
|
210
|
+
color: i ? void 0 : n.color ?? "default",
|
|
211
|
+
sx: i ? {
|
|
212
|
+
color: n.foregroundColor ?? "inherit",
|
|
213
|
+
backgroundColor: n.backgroundColor ?? "transparent"
|
|
214
|
+
} : void 0
|
|
215
|
+
})
|
|
216
|
+
}, e);
|
|
217
|
+
},
|
|
218
|
+
isOptionEqualToValue: (e, t) => e.id === t.id,
|
|
219
|
+
noOptionsText: x.noAvailableTagsText,
|
|
220
|
+
loadingText: x.loadingText
|
|
221
|
+
}), Y && /* @__PURE__ */ d(n, {
|
|
222
|
+
sx: { position: "relative" },
|
|
223
|
+
onMouseDown: $,
|
|
224
|
+
children: [/* @__PURE__ */ d(a, {
|
|
225
|
+
direction: "row",
|
|
226
|
+
sx: {
|
|
227
|
+
mt: .5,
|
|
228
|
+
flexWrap: "wrap",
|
|
229
|
+
gap: .5,
|
|
230
|
+
alignItems: "center"
|
|
231
|
+
},
|
|
232
|
+
children: [ne.map((e) => /* @__PURE__ */ u(r, {
|
|
233
|
+
size: T,
|
|
234
|
+
color: e,
|
|
235
|
+
label: e,
|
|
236
|
+
variant: !q && A === e ? "filled" : "outlined",
|
|
237
|
+
onClick: () => {
|
|
238
|
+
j(e), N(null), F(null), z(!1);
|
|
239
|
+
},
|
|
240
|
+
clickable: !0
|
|
241
|
+
}, e)), /* @__PURE__ */ u(s, {
|
|
242
|
+
title: x.colorPickerLabel,
|
|
243
|
+
children: /* @__PURE__ */ u(r, {
|
|
244
|
+
size: T,
|
|
245
|
+
label: q ? M : "···",
|
|
246
|
+
variant: "outlined",
|
|
247
|
+
onClick: () => {
|
|
248
|
+
z((e) => !e), M && U(M), P && G(P);
|
|
249
|
+
},
|
|
250
|
+
sx: (e) => ({
|
|
251
|
+
cursor: "pointer",
|
|
252
|
+
fontFamily: "monospace",
|
|
253
|
+
fontSize: "0.7rem",
|
|
254
|
+
...q ? {
|
|
255
|
+
backgroundColor: M,
|
|
256
|
+
color: X,
|
|
257
|
+
border: "1.5px solid transparent",
|
|
258
|
+
backgroundImage: `linear-gradient(${M}, ${M}), linear-gradient(90deg, #f44336, #ff9800, #ffeb3b, #4caf50, #2196f3, #9c27b0)`,
|
|
259
|
+
backgroundOrigin: "border-box",
|
|
260
|
+
backgroundClip: "padding-box, border-box"
|
|
261
|
+
} : {
|
|
262
|
+
border: "1.5px solid transparent",
|
|
263
|
+
backgroundImage: `linear-gradient(${e.palette.background.paper}, ${e.palette.background.paper}), linear-gradient(90deg, #f44336, #ff9800, #ffeb3b, #4caf50, #2196f3, #9c27b0)`,
|
|
264
|
+
backgroundOrigin: "border-box",
|
|
265
|
+
backgroundClip: "padding-box, border-box"
|
|
266
|
+
}
|
|
267
|
+
}),
|
|
268
|
+
clickable: !0
|
|
269
|
+
})
|
|
270
|
+
})]
|
|
271
|
+
}), R && /* @__PURE__ */ u(n, {
|
|
272
|
+
sx: {
|
|
273
|
+
position: "absolute",
|
|
274
|
+
top: "calc(100% + 4px)",
|
|
275
|
+
left: 0,
|
|
276
|
+
zIndex: 1400,
|
|
277
|
+
backgroundColor: "background.paper",
|
|
278
|
+
border: "1px solid",
|
|
279
|
+
borderColor: "divider",
|
|
280
|
+
borderRadius: 1,
|
|
281
|
+
boxShadow: 8,
|
|
282
|
+
p: 1.25,
|
|
283
|
+
width: "max-content"
|
|
284
|
+
},
|
|
285
|
+
children: /* @__PURE__ */ d(n, {
|
|
286
|
+
sx: {
|
|
287
|
+
display: "grid",
|
|
288
|
+
gridTemplateColumns: "auto auto",
|
|
289
|
+
gap: 2
|
|
290
|
+
},
|
|
291
|
+
children: [/* @__PURE__ */ d(n, { children: [/* @__PURE__ */ u(c, {
|
|
292
|
+
variant: "caption",
|
|
293
|
+
sx: {
|
|
294
|
+
fontWeight: 700,
|
|
295
|
+
color: "text.primary",
|
|
296
|
+
display: "block",
|
|
297
|
+
mb: .5
|
|
298
|
+
},
|
|
299
|
+
children: x.backgroundColorLabel
|
|
300
|
+
}), /* @__PURE__ */ d(n, {
|
|
301
|
+
sx: {
|
|
302
|
+
display: "grid",
|
|
303
|
+
gridTemplateColumns: "repeat(5, 24px)",
|
|
304
|
+
gap: .5
|
|
305
|
+
},
|
|
306
|
+
children: [p.map((e) => /* @__PURE__ */ u(_, {
|
|
307
|
+
color: e,
|
|
308
|
+
selected: M === e,
|
|
309
|
+
onClick: () => oe(e)
|
|
310
|
+
}, e)), /* @__PURE__ */ u(n, {
|
|
311
|
+
sx: {
|
|
312
|
+
gridColumn: "span 5",
|
|
313
|
+
mt: .25
|
|
314
|
+
},
|
|
315
|
+
children: /* @__PURE__ */ u(v, {
|
|
316
|
+
value: H,
|
|
317
|
+
onChange: se
|
|
318
|
+
})
|
|
319
|
+
})]
|
|
320
|
+
})] }), /* @__PURE__ */ d(n, { children: [
|
|
321
|
+
/* @__PURE__ */ u(c, {
|
|
322
|
+
variant: "caption",
|
|
323
|
+
sx: {
|
|
324
|
+
fontWeight: 700,
|
|
325
|
+
color: "text.primary",
|
|
326
|
+
display: "block",
|
|
327
|
+
mb: .5
|
|
328
|
+
},
|
|
329
|
+
children: x.textColorLabel
|
|
330
|
+
}),
|
|
331
|
+
/* @__PURE__ */ d(n, {
|
|
332
|
+
sx: {
|
|
333
|
+
display: "grid",
|
|
334
|
+
gridTemplateColumns: "repeat(5, 24px)",
|
|
335
|
+
gap: .5,
|
|
336
|
+
opacity: I ? .3 : 1,
|
|
337
|
+
pointerEvents: I ? "none" : "auto",
|
|
338
|
+
transition: "opacity 0.15s"
|
|
339
|
+
},
|
|
340
|
+
children: [p.map((e) => /* @__PURE__ */ u(_, {
|
|
341
|
+
color: e,
|
|
342
|
+
selected: P === e,
|
|
343
|
+
onClick: () => ce(e)
|
|
344
|
+
}, e)), /* @__PURE__ */ u(n, {
|
|
345
|
+
sx: {
|
|
346
|
+
gridColumn: "span 5",
|
|
347
|
+
mt: .25
|
|
348
|
+
},
|
|
349
|
+
children: /* @__PURE__ */ u(v, {
|
|
350
|
+
value: I ? X ?? "#000000" : W,
|
|
351
|
+
onChange: le,
|
|
352
|
+
disabled: I
|
|
353
|
+
})
|
|
354
|
+
})]
|
|
355
|
+
}),
|
|
356
|
+
/* @__PURE__ */ d(a, {
|
|
357
|
+
direction: "row",
|
|
358
|
+
sx: {
|
|
359
|
+
width: "100%",
|
|
360
|
+
alignItems: "center",
|
|
361
|
+
justifyContent: "flex-end",
|
|
362
|
+
gap: .5,
|
|
363
|
+
mt: .25
|
|
364
|
+
},
|
|
365
|
+
children: [/* @__PURE__ */ u(c, {
|
|
366
|
+
variant: "caption",
|
|
367
|
+
color: "text.secondary",
|
|
368
|
+
children: x.autoTextColorLabel
|
|
369
|
+
}), /* @__PURE__ */ u(ee, {
|
|
370
|
+
size: "small",
|
|
371
|
+
checked: I,
|
|
372
|
+
onChange: (e) => ue(e.target.checked)
|
|
373
|
+
})]
|
|
374
|
+
})
|
|
375
|
+
] })]
|
|
376
|
+
})
|
|
377
|
+
})]
|
|
378
|
+
})]
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
//#endregion
|
|
382
|
+
export { y as TagSelectionAutocomplete };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Chip as e } from "@mui/material";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/tag-selection/TagSelectionChip.tsx
|
|
4
|
+
function n({ tag: n, onDelete: r, onClick: i, chipSize: a = "medium", disabled: o = !1 }) {
|
|
5
|
+
let s = !!(n.foregroundColor || n.backgroundColor);
|
|
6
|
+
return /* @__PURE__ */ t(e, {
|
|
7
|
+
size: a,
|
|
8
|
+
label: n.label,
|
|
9
|
+
onDelete: r ? () => r(n) : void 0,
|
|
10
|
+
onClick: i ? () => i(n) : void 0,
|
|
11
|
+
clickable: !!i && !n.disabled && !o,
|
|
12
|
+
disabled: o || n.disabled,
|
|
13
|
+
variant: n.selected ? "filled" : "outlined",
|
|
14
|
+
color: s ? void 0 : n.color ?? "default",
|
|
15
|
+
sx: {
|
|
16
|
+
...s && {
|
|
17
|
+
color: n.foregroundColor ?? "inherit",
|
|
18
|
+
backgroundColor: n.backgroundColor ?? "transparent",
|
|
19
|
+
borderColor: n.backgroundColor ?? void 0,
|
|
20
|
+
"& .MuiChip-deleteIcon": {
|
|
21
|
+
color: n.foregroundColor ? `${n.foregroundColor}99` : "inherit",
|
|
22
|
+
"&:hover": { color: n.foregroundColor ?? "inherit" }
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
cursor: i && !n.disabled && !o ? "pointer" : "default"
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { n as TagSelectionChip };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { TagSelectionChip as e } from "./TagSelectionChip.js";
|
|
2
|
+
import { useState as t } from "react";
|
|
3
|
+
import { Box as n, Chip as r, Popover as i, Stack as a, Typography as o } from "@mui/material";
|
|
4
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/tag-selection/TagSelectionSelectedTags.tsx
|
|
6
|
+
function u({ selectedTags: u, translation: d, onTagDelete: f, showSelectedTagsLabel: p, chipSize: m = "medium", disabled: h = !1, maxVisibleChips: g, popoverPlacement: _ = "bottom" }) {
|
|
7
|
+
let [v, y] = t(null), b = g === void 0 ? u : u.slice(0, g), x = g === void 0 ? [] : u.slice(g), S = !!v && x.length > 0, C = _ === "top" ? {
|
|
8
|
+
vertical: "top",
|
|
9
|
+
horizontal: "left"
|
|
10
|
+
} : {
|
|
11
|
+
vertical: "bottom",
|
|
12
|
+
horizontal: "left"
|
|
13
|
+
}, w = _ === "top" ? {
|
|
14
|
+
vertical: "bottom",
|
|
15
|
+
horizontal: "left"
|
|
16
|
+
} : {
|
|
17
|
+
vertical: "top",
|
|
18
|
+
horizontal: "left"
|
|
19
|
+
};
|
|
20
|
+
return /* @__PURE__ */ l(n, {
|
|
21
|
+
sx: { mb: 2 },
|
|
22
|
+
children: [p && /* @__PURE__ */ c(o, {
|
|
23
|
+
variant: "subtitle2",
|
|
24
|
+
gutterBottom: !0,
|
|
25
|
+
children: d.selectedTagsLabel
|
|
26
|
+
}), u.length === 0 ? /* @__PURE__ */ c(o, {
|
|
27
|
+
variant: "body2",
|
|
28
|
+
color: "text.secondary",
|
|
29
|
+
children: d.noSelectedTagsText
|
|
30
|
+
}) : /* @__PURE__ */ l(a, {
|
|
31
|
+
direction: "row",
|
|
32
|
+
sx: {
|
|
33
|
+
flexWrap: "wrap",
|
|
34
|
+
gap: 1
|
|
35
|
+
},
|
|
36
|
+
children: [b.map((t) => /* @__PURE__ */ c(e, {
|
|
37
|
+
tag: t,
|
|
38
|
+
onDelete: f,
|
|
39
|
+
chipSize: m,
|
|
40
|
+
disabled: h
|
|
41
|
+
}, t.id)), x.length > 0 && /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(r, {
|
|
42
|
+
size: m,
|
|
43
|
+
label: `+${x.length}`,
|
|
44
|
+
variant: "outlined",
|
|
45
|
+
clickable: !0,
|
|
46
|
+
onClick: (e) => y(e.currentTarget)
|
|
47
|
+
}), /* @__PURE__ */ c(i, {
|
|
48
|
+
open: S,
|
|
49
|
+
anchorEl: v,
|
|
50
|
+
onClose: () => y(null),
|
|
51
|
+
anchorOrigin: C,
|
|
52
|
+
transformOrigin: w,
|
|
53
|
+
children: /* @__PURE__ */ c(n, {
|
|
54
|
+
sx: {
|
|
55
|
+
p: 1,
|
|
56
|
+
display: "flex",
|
|
57
|
+
flexWrap: "wrap",
|
|
58
|
+
gap: .5,
|
|
59
|
+
maxWidth: 320
|
|
60
|
+
},
|
|
61
|
+
children: x.map((t) => /* @__PURE__ */ c(e, {
|
|
62
|
+
tag: t,
|
|
63
|
+
onDelete: h ? void 0 : f,
|
|
64
|
+
chipSize: m,
|
|
65
|
+
disabled: h
|
|
66
|
+
}, t.id))
|
|
67
|
+
})
|
|
68
|
+
})] })]
|
|
69
|
+
})]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
export { u as TagSelectionSelectedTags };
|