@thebuoyant-tsdev/mui-ts-library 3.21.0 → 3.24.1
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 +17 -6
- package/README.md +17 -6
- package/dist/components/chord-chart/ChordChart.d.ts +1 -1
- package/dist/components/chord-chart/ChordChart.js +66 -65
- package/dist/components/chord-chart/ChordChart.types.d.ts +7 -0
- package/dist/components/circle-packing-chart/CirclePackingChart.d.ts +1 -1
- package/dist/components/circle-packing-chart/CirclePackingChart.js +128 -128
- package/dist/components/circle-packing-chart/CirclePackingChart.types.d.ts +7 -0
- package/dist/components/color-picker/ColorPicker.d.ts +1 -1
- package/dist/components/color-picker/ColorPicker.js +282 -266
- package/dist/components/color-picker/ColorPicker.types.d.ts +3 -1
- package/dist/components/color-picker/colorPickerClasses.d.ts +35 -0
- package/dist/components/color-picker/colorPickerClasses.js +15 -0
- package/dist/components/password-strength-meter/PasswordStrengthBar.d.ts +2 -1
- package/dist/components/password-strength-meter/PasswordStrengthBar.js +3 -1
- package/dist/components/password-strength-meter/PasswordStrengthMeter.js +258 -237
- package/dist/components/password-strength-meter/passwordStrengthMeterClasses.d.ts +40 -0
- package/dist/components/password-strength-meter/passwordStrengthMeterClasses.js +16 -0
- package/dist/components/radial-stacked-bar-chart/RadialStackedBarChart.d.ts +1 -1
- package/dist/components/radial-stacked-bar-chart/RadialStackedBarChart.js +85 -84
- package/dist/components/radial-stacked-bar-chart/RadialStackedBarChart.types.d.ts +8 -0
- package/dist/components/rich-text-editor/RichTextEditorToolbar.js +115 -111
- package/dist/components/sunburst-chart/SunburstChart.d.ts +1 -1
- package/dist/components/sunburst-chart/SunburstChart.js +41 -40
- package/dist/components/sunburst-chart/SunburstChart.types.d.ts +7 -0
- package/dist/components/tag-selection/TagSelection.js +82 -79
- package/dist/components/tag-selection/TagSelectionAutocomplete.js +102 -98
- package/dist/components/tag-selection/TagSelectionChip.js +24 -21
- package/dist/components/tag-selection/TagSelectionSelectedTags.js +44 -38
- package/dist/components/tag-selection/tagSelectionClasses.d.ts +34 -0
- package/dist/components/tag-selection/tagSelectionClasses.js +15 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +31 -27
- package/dist/utils/muiTsClasses.d.ts +7 -0
- package/dist/utils/muiTsClasses.js +9 -0
- package/package.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import p from "
|
|
1
|
+
import { tagSelectionClasses as e } from "./tagSelectionClasses.js";
|
|
2
|
+
import { useState as t } from "react";
|
|
3
|
+
import { Autocomplete as n, Box as r, Chip as i, IconButton as a, Stack as o, Switch as s, TextField as c, Tooltip as l, Typography as u } from "@mui/material";
|
|
4
|
+
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
5
|
+
import m from "@mui/icons-material/Check";
|
|
5
6
|
import ee from "@mui/icons-material/Close";
|
|
6
7
|
//#region src/components/tag-selection/TagSelectionAutocomplete.tsx
|
|
7
|
-
var
|
|
8
|
+
var h = [
|
|
8
9
|
"default",
|
|
9
10
|
"primary",
|
|
10
11
|
"secondary",
|
|
@@ -12,7 +13,7 @@ var te = [
|
|
|
12
13
|
"info",
|
|
13
14
|
"success",
|
|
14
15
|
"warning"
|
|
15
|
-
],
|
|
16
|
+
], g = [
|
|
16
17
|
"#f44336",
|
|
17
18
|
"#e91e63",
|
|
18
19
|
"#9c27b0",
|
|
@@ -34,26 +35,26 @@ var te = [
|
|
|
34
35
|
"#607d8b",
|
|
35
36
|
"#000000"
|
|
36
37
|
];
|
|
37
|
-
function
|
|
38
|
+
function _(e) {
|
|
38
39
|
return /^#[0-9A-Fa-f]{6}$/.test(e);
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
+
function v(e) {
|
|
41
42
|
let t = parseInt(e.slice(1, 3), 16), n = parseInt(e.slice(3, 5), 16), r = parseInt(e.slice(5, 7), 16);
|
|
42
43
|
return (.299 * t + .587 * n + .114 * r) / 255 > .5 ? "#000000" : "#ffffff";
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
+
function y(e, t) {
|
|
45
46
|
let n = t.trim();
|
|
46
47
|
if (!n) return e;
|
|
47
48
|
let r = e.toLowerCase().indexOf(n.toLowerCase());
|
|
48
|
-
return r === -1 ? e : /* @__PURE__ */
|
|
49
|
+
return r === -1 ? e : /* @__PURE__ */ p(d, { children: [
|
|
49
50
|
e.slice(0, r),
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ f("strong", { children: e.slice(r, r + n.length) }),
|
|
51
52
|
e.slice(r + n.length)
|
|
52
53
|
] });
|
|
53
54
|
}
|
|
54
|
-
function
|
|
55
|
-
return /* @__PURE__ */
|
|
56
|
-
onClick:
|
|
55
|
+
function b({ color: e, selected: t, onClick: n }) {
|
|
56
|
+
return /* @__PURE__ */ f(r, {
|
|
57
|
+
onClick: n,
|
|
57
58
|
sx: {
|
|
58
59
|
width: 24,
|
|
59
60
|
height: 24,
|
|
@@ -74,15 +75,15 @@ function v({ color: e, selected: t, onClick: r }) {
|
|
|
74
75
|
}
|
|
75
76
|
});
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
-
return /* @__PURE__ */
|
|
78
|
+
function x({ value: e, onChange: t, disabled: n = !1 }) {
|
|
79
|
+
return /* @__PURE__ */ f(c, {
|
|
79
80
|
size: "small",
|
|
80
81
|
fullWidth: !0,
|
|
81
82
|
value: e,
|
|
82
83
|
onChange: (e) => t(e.target.value),
|
|
83
84
|
placeholder: "#rrggbb",
|
|
84
|
-
disabled:
|
|
85
|
-
error: !
|
|
85
|
+
disabled: n,
|
|
86
|
+
error: !n && e.length > 1 && !_(e),
|
|
86
87
|
sx: {
|
|
87
88
|
"& .MuiInputBase-root": { height: 28 },
|
|
88
89
|
"& .MuiInputBase-input": {
|
|
@@ -92,22 +93,22 @@ function y({ value: e, onChange: t, disabled: r = !1 }) {
|
|
|
92
93
|
fontFamily: "monospace"
|
|
93
94
|
}
|
|
94
95
|
},
|
|
95
|
-
slotProps: { input: { startAdornment: /* @__PURE__ */
|
|
96
|
+
slotProps: { input: { startAdornment: /* @__PURE__ */ f(r, { sx: {
|
|
96
97
|
width: 12,
|
|
97
98
|
height: 12,
|
|
98
99
|
borderRadius: .25,
|
|
99
100
|
flexShrink: 0,
|
|
100
101
|
mr: .5,
|
|
101
|
-
backgroundColor:
|
|
102
|
+
backgroundColor: _(e) ? e : "action.disabledBackground",
|
|
102
103
|
border: "1px solid",
|
|
103
104
|
borderColor: "divider"
|
|
104
105
|
} }) } }
|
|
105
106
|
});
|
|
106
107
|
}
|
|
107
|
-
function
|
|
108
|
-
let [M, N] =
|
|
108
|
+
function S({ availableTags: S, searchValue: C, translation: w, onSearchChange: T, onTagSelect: te, onTagCreate: ne, inputSize: re = "medium", chipSize: E = "medium", chipVariant: ie = "filled", disabled: D = !1, loading: O = !1, isMaxReached: k = !1, allowCreate: ae = !1, listboxMaxHeight: A, serverSideFilter: j = !1 }) {
|
|
109
|
+
let [M, N] = t("default"), [P, F] = t(null), [I, L] = t(null), [R, z] = t(!0), [B, V] = t(!1), [H, U] = t(!1), [W, G] = t("#1976d2"), [K, q] = t("#ffffff"), J = D || k, Y = P !== null, oe = j ? S : S.filter((e) => e.label.toLowerCase().includes(C.trim().toLowerCase())), X = ae && C.trim() !== "" && oe.length === 0, se = H && !X, Z = Y ? R ? v(P) : I ?? "#000000" : void 0, Q = () => {
|
|
109
110
|
if (J) return;
|
|
110
|
-
let e =
|
|
111
|
+
let e = C.trim(), t = e.toLowerCase().replace(/\s+/g, "-");
|
|
111
112
|
ne?.(Y && P ? {
|
|
112
113
|
id: t,
|
|
113
114
|
label: e,
|
|
@@ -120,45 +121,46 @@ function b({ availableTags: b, searchValue: x, translation: S, onSearchChange: C
|
|
|
120
121
|
label: e,
|
|
121
122
|
selected: !0,
|
|
122
123
|
color: M
|
|
123
|
-
}), N("default"), F(null), L(null), z(!0), V(!1),
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
}, ce = (e) => {
|
|
127
|
-
F(e), G(e), N("default");
|
|
124
|
+
}), N("default"), F(null), L(null), z(!0), V(!1), T("");
|
|
125
|
+
}, ce = () => {
|
|
126
|
+
T(""), N("default"), F(null), L(null), z(!0), V(!1);
|
|
128
127
|
}, le = (e) => {
|
|
129
|
-
|
|
128
|
+
F(e), G(e), N("default");
|
|
130
129
|
}, ue = (e) => {
|
|
131
|
-
|
|
130
|
+
G(e), _(e) && (F(e), N("default"));
|
|
132
131
|
}, de = (e) => {
|
|
133
|
-
|
|
132
|
+
L(e), q(e);
|
|
134
133
|
}, fe = (e) => {
|
|
134
|
+
q(e), _(e) && L(e);
|
|
135
|
+
}, pe = (e) => {
|
|
135
136
|
if (z(e), e) L(null);
|
|
136
137
|
else if (P) {
|
|
137
|
-
let e =
|
|
138
|
+
let e = v(P);
|
|
138
139
|
L(e), q(e);
|
|
139
140
|
}
|
|
140
141
|
}, $ = (e) => e.preventDefault();
|
|
141
|
-
return /* @__PURE__ */
|
|
142
|
+
return /* @__PURE__ */ p(r, {
|
|
142
143
|
sx: { mb: 2 },
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
className: e.autocomplete,
|
|
145
|
+
children: [/* @__PURE__ */ f(n, {
|
|
146
|
+
options: S,
|
|
145
147
|
filterOptions: j ? (e) => e : void 0,
|
|
146
148
|
value: null,
|
|
147
|
-
open:
|
|
149
|
+
open: se,
|
|
148
150
|
onOpen: () => {
|
|
149
151
|
X || U(!0);
|
|
150
152
|
},
|
|
151
153
|
onClose: () => U(!1),
|
|
152
154
|
size: re,
|
|
153
155
|
disabled: J,
|
|
154
|
-
loading:
|
|
156
|
+
loading: O,
|
|
155
157
|
getOptionLabel: (e) => e.label,
|
|
156
|
-
inputValue:
|
|
158
|
+
inputValue: C,
|
|
157
159
|
onInputChange: (e, t, n) => {
|
|
158
|
-
n === "input" &&
|
|
160
|
+
n === "input" && T(t);
|
|
159
161
|
},
|
|
160
162
|
onChange: (e, t) => {
|
|
161
|
-
t &&
|
|
163
|
+
t && te(t);
|
|
162
164
|
},
|
|
163
165
|
slotProps: { listbox: { sx: {
|
|
164
166
|
display: "flex",
|
|
@@ -170,11 +172,11 @@ function b({ availableTags: b, searchValue: x, translation: S, onSearchChange: C
|
|
|
170
172
|
overflowY: "auto"
|
|
171
173
|
}
|
|
172
174
|
} } },
|
|
173
|
-
renderInput: (e) => /* @__PURE__ */
|
|
175
|
+
renderInput: (e) => /* @__PURE__ */ f(c, {
|
|
174
176
|
...e,
|
|
175
|
-
label:
|
|
176
|
-
placeholder:
|
|
177
|
-
helperText:
|
|
177
|
+
label: w.autoCompleteLabel,
|
|
178
|
+
placeholder: w.placeholder,
|
|
179
|
+
helperText: k && !D ? w.maxTagsReachedText : void 0,
|
|
178
180
|
onKeyDown: (e) => {
|
|
179
181
|
X && !J && e.key === "Enter" && (e.preventDefault(), Q());
|
|
180
182
|
},
|
|
@@ -182,52 +184,54 @@ function b({ availableTags: b, searchValue: x, translation: S, onSearchChange: C
|
|
|
182
184
|
...e.slotProps,
|
|
183
185
|
input: {
|
|
184
186
|
...e.slotProps?.input,
|
|
185
|
-
endAdornment: /* @__PURE__ */
|
|
187
|
+
endAdornment: /* @__PURE__ */ p(d, { children: [X && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(a, {
|
|
186
188
|
size: "small",
|
|
187
189
|
sx: { color: "success.main" },
|
|
188
190
|
onMouseDown: $,
|
|
189
191
|
onClick: Q,
|
|
190
192
|
disabled: J,
|
|
191
|
-
"aria-label":
|
|
192
|
-
children: /* @__PURE__ */
|
|
193
|
-
}), /* @__PURE__ */
|
|
193
|
+
"aria-label": w.confirmCreateLabel,
|
|
194
|
+
children: /* @__PURE__ */ f(m, { fontSize: "small" })
|
|
195
|
+
}), /* @__PURE__ */ f(a, {
|
|
194
196
|
size: "small",
|
|
195
197
|
onMouseDown: $,
|
|
196
|
-
onClick:
|
|
197
|
-
"aria-label":
|
|
198
|
-
children: /* @__PURE__ */
|
|
198
|
+
onClick: ce,
|
|
199
|
+
"aria-label": w.cancelCreateLabel,
|
|
200
|
+
children: /* @__PURE__ */ f(ee, { fontSize: "small" })
|
|
199
201
|
})] }), e.slotProps?.input?.endAdornment] })
|
|
200
202
|
}
|
|
201
203
|
}
|
|
202
204
|
}),
|
|
203
|
-
renderOption: ({ key:
|
|
204
|
-
let
|
|
205
|
-
return /* @__PURE__ */
|
|
206
|
-
...
|
|
205
|
+
renderOption: ({ key: t, ...n }, r) => {
|
|
206
|
+
let a = !!(r.foregroundColor || r.backgroundColor);
|
|
207
|
+
return /* @__PURE__ */ f("li", {
|
|
208
|
+
...n,
|
|
207
209
|
style: {
|
|
208
210
|
width: "auto",
|
|
209
211
|
padding: 0,
|
|
210
212
|
margin: 0
|
|
211
213
|
},
|
|
212
|
-
children: /* @__PURE__ */
|
|
213
|
-
size:
|
|
214
|
+
children: /* @__PURE__ */ f(i, {
|
|
215
|
+
size: E,
|
|
214
216
|
variant: ie,
|
|
215
|
-
label:
|
|
216
|
-
color:
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
217
|
+
label: y(r.label, C),
|
|
218
|
+
color: a ? void 0 : r.color ?? "default",
|
|
219
|
+
className: e.option,
|
|
220
|
+
sx: a ? {
|
|
221
|
+
color: r.foregroundColor ?? "inherit",
|
|
222
|
+
backgroundColor: r.backgroundColor ?? "transparent"
|
|
220
223
|
} : void 0
|
|
221
224
|
})
|
|
222
|
-
},
|
|
225
|
+
}, t);
|
|
223
226
|
},
|
|
224
227
|
isOptionEqualToValue: (e, t) => e.id === t.id,
|
|
225
|
-
noOptionsText:
|
|
226
|
-
loadingText:
|
|
227
|
-
}), X && /* @__PURE__ */
|
|
228
|
+
noOptionsText: w.noAvailableTagsText,
|
|
229
|
+
loadingText: w.loadingText
|
|
230
|
+
}), X && /* @__PURE__ */ p(r, {
|
|
228
231
|
sx: { position: "relative" },
|
|
229
232
|
onMouseDown: $,
|
|
230
|
-
|
|
233
|
+
className: e.createPanel,
|
|
234
|
+
children: [/* @__PURE__ */ p(o, {
|
|
231
235
|
direction: "row",
|
|
232
236
|
sx: {
|
|
233
237
|
mt: .5,
|
|
@@ -235,8 +239,8 @@ function b({ availableTags: b, searchValue: x, translation: S, onSearchChange: C
|
|
|
235
239
|
gap: .5,
|
|
236
240
|
alignItems: "center"
|
|
237
241
|
},
|
|
238
|
-
children: [
|
|
239
|
-
size:
|
|
242
|
+
children: [h.map((e) => /* @__PURE__ */ f(i, {
|
|
243
|
+
size: E,
|
|
240
244
|
color: e,
|
|
241
245
|
label: e,
|
|
242
246
|
variant: !Y && M === e ? "filled" : "outlined",
|
|
@@ -244,10 +248,10 @@ function b({ availableTags: b, searchValue: x, translation: S, onSearchChange: C
|
|
|
244
248
|
N(e), F(null), L(null), V(!1);
|
|
245
249
|
},
|
|
246
250
|
clickable: !0
|
|
247
|
-
}, e)), /* @__PURE__ */
|
|
248
|
-
title:
|
|
249
|
-
children: /* @__PURE__ */
|
|
250
|
-
size:
|
|
251
|
+
}, e)), /* @__PURE__ */ f(l, {
|
|
252
|
+
title: w.colorPickerLabel,
|
|
253
|
+
children: /* @__PURE__ */ f(i, {
|
|
254
|
+
size: E,
|
|
251
255
|
label: Y ? P : "···",
|
|
252
256
|
variant: "outlined",
|
|
253
257
|
onClick: () => {
|
|
@@ -274,7 +278,7 @@ function b({ availableTags: b, searchValue: x, translation: S, onSearchChange: C
|
|
|
274
278
|
clickable: !0
|
|
275
279
|
})
|
|
276
280
|
})]
|
|
277
|
-
}), B && /* @__PURE__ */
|
|
281
|
+
}), B && /* @__PURE__ */ f(r, {
|
|
278
282
|
sx: {
|
|
279
283
|
position: "absolute",
|
|
280
284
|
top: "calc(100% + 4px)",
|
|
@@ -288,13 +292,13 @@ function b({ availableTags: b, searchValue: x, translation: S, onSearchChange: C
|
|
|
288
292
|
p: 1.25,
|
|
289
293
|
width: "max-content"
|
|
290
294
|
},
|
|
291
|
-
children: /* @__PURE__ */
|
|
295
|
+
children: /* @__PURE__ */ p(r, {
|
|
292
296
|
sx: {
|
|
293
297
|
display: "grid",
|
|
294
298
|
gridTemplateColumns: "auto auto",
|
|
295
299
|
gap: 2
|
|
296
300
|
},
|
|
297
|
-
children: [/* @__PURE__ */
|
|
301
|
+
children: [/* @__PURE__ */ p(r, { children: [/* @__PURE__ */ f(u, {
|
|
298
302
|
variant: "caption",
|
|
299
303
|
sx: {
|
|
300
304
|
fontWeight: 700,
|
|
@@ -302,29 +306,29 @@ function b({ availableTags: b, searchValue: x, translation: S, onSearchChange: C
|
|
|
302
306
|
display: "block",
|
|
303
307
|
mb: .5
|
|
304
308
|
},
|
|
305
|
-
children:
|
|
306
|
-
}), /* @__PURE__ */
|
|
309
|
+
children: w.backgroundColorLabel
|
|
310
|
+
}), /* @__PURE__ */ p(r, {
|
|
307
311
|
sx: {
|
|
308
312
|
display: "grid",
|
|
309
313
|
gridTemplateColumns: "repeat(5, 24px)",
|
|
310
314
|
gap: .5
|
|
311
315
|
},
|
|
312
|
-
children: [
|
|
316
|
+
children: [g.map((e) => /* @__PURE__ */ f(b, {
|
|
313
317
|
color: e,
|
|
314
318
|
selected: P === e,
|
|
315
|
-
onClick: () =>
|
|
316
|
-
}, e)), /* @__PURE__ */
|
|
319
|
+
onClick: () => le(e)
|
|
320
|
+
}, e)), /* @__PURE__ */ f(r, {
|
|
317
321
|
sx: {
|
|
318
322
|
gridColumn: "span 5",
|
|
319
323
|
mt: .25
|
|
320
324
|
},
|
|
321
|
-
children: /* @__PURE__ */
|
|
325
|
+
children: /* @__PURE__ */ f(x, {
|
|
322
326
|
value: W,
|
|
323
|
-
onChange:
|
|
327
|
+
onChange: ue
|
|
324
328
|
})
|
|
325
329
|
})]
|
|
326
|
-
})] }), /* @__PURE__ */
|
|
327
|
-
/* @__PURE__ */
|
|
330
|
+
})] }), /* @__PURE__ */ p(r, { children: [
|
|
331
|
+
/* @__PURE__ */ f(u, {
|
|
328
332
|
variant: "caption",
|
|
329
333
|
sx: {
|
|
330
334
|
fontWeight: 700,
|
|
@@ -332,9 +336,9 @@ function b({ availableTags: b, searchValue: x, translation: S, onSearchChange: C
|
|
|
332
336
|
display: "block",
|
|
333
337
|
mb: .5
|
|
334
338
|
},
|
|
335
|
-
children:
|
|
339
|
+
children: w.textColorLabel
|
|
336
340
|
}),
|
|
337
|
-
/* @__PURE__ */
|
|
341
|
+
/* @__PURE__ */ p(r, {
|
|
338
342
|
sx: {
|
|
339
343
|
display: "grid",
|
|
340
344
|
gridTemplateColumns: "repeat(5, 24px)",
|
|
@@ -343,23 +347,23 @@ function b({ availableTags: b, searchValue: x, translation: S, onSearchChange: C
|
|
|
343
347
|
pointerEvents: R ? "none" : "auto",
|
|
344
348
|
transition: "opacity 0.15s"
|
|
345
349
|
},
|
|
346
|
-
children: [
|
|
350
|
+
children: [g.map((e) => /* @__PURE__ */ f(b, {
|
|
347
351
|
color: e,
|
|
348
352
|
selected: I === e,
|
|
349
|
-
onClick: () =>
|
|
350
|
-
}, e)), /* @__PURE__ */
|
|
353
|
+
onClick: () => de(e)
|
|
354
|
+
}, e)), /* @__PURE__ */ f(r, {
|
|
351
355
|
sx: {
|
|
352
356
|
gridColumn: "span 5",
|
|
353
357
|
mt: .25
|
|
354
358
|
},
|
|
355
|
-
children: /* @__PURE__ */
|
|
359
|
+
children: /* @__PURE__ */ f(x, {
|
|
356
360
|
value: R ? Z ?? "#000000" : K,
|
|
357
|
-
onChange:
|
|
361
|
+
onChange: fe,
|
|
358
362
|
disabled: R
|
|
359
363
|
})
|
|
360
364
|
})]
|
|
361
365
|
}),
|
|
362
|
-
/* @__PURE__ */
|
|
366
|
+
/* @__PURE__ */ p(o, {
|
|
363
367
|
direction: "row",
|
|
364
368
|
sx: {
|
|
365
369
|
width: "100%",
|
|
@@ -368,14 +372,14 @@ function b({ availableTags: b, searchValue: x, translation: S, onSearchChange: C
|
|
|
368
372
|
gap: .5,
|
|
369
373
|
mt: .25
|
|
370
374
|
},
|
|
371
|
-
children: [/* @__PURE__ */
|
|
375
|
+
children: [/* @__PURE__ */ f(u, {
|
|
372
376
|
variant: "caption",
|
|
373
377
|
color: "text.secondary",
|
|
374
|
-
children:
|
|
375
|
-
}), /* @__PURE__ */
|
|
378
|
+
children: w.autoTextColorLabel
|
|
379
|
+
}), /* @__PURE__ */ f(s, {
|
|
376
380
|
size: "small",
|
|
377
381
|
checked: R,
|
|
378
|
-
onChange: (e) =>
|
|
382
|
+
onChange: (e) => pe(e.target.checked)
|
|
379
383
|
})]
|
|
380
384
|
})
|
|
381
385
|
] })]
|
|
@@ -385,4 +389,4 @@ function b({ availableTags: b, searchValue: x, translation: S, onSearchChange: C
|
|
|
385
389
|
});
|
|
386
390
|
}
|
|
387
391
|
//#endregion
|
|
388
|
-
export {
|
|
392
|
+
export { S as TagSelectionAutocomplete };
|
|
@@ -1,30 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { muiTsStateClasses as e } from "../../utils/muiTsClasses.js";
|
|
2
|
+
import { tagSelectionClasses as t } from "./tagSelectionClasses.js";
|
|
3
|
+
import { Chip as n } from "@mui/material";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
3
5
|
//#region src/components/tag-selection/TagSelectionChip.tsx
|
|
4
|
-
function
|
|
5
|
-
let
|
|
6
|
-
return /* @__PURE__ */
|
|
7
|
-
size:
|
|
8
|
-
label:
|
|
9
|
-
onDelete:
|
|
10
|
-
onClick:
|
|
11
|
-
clickable: !!
|
|
12
|
-
disabled:
|
|
13
|
-
variant:
|
|
14
|
-
color:
|
|
6
|
+
function i({ tag: i, onDelete: a, onClick: o, chipSize: s = "medium", chipVariant: c = "filled", disabled: l = !1 }) {
|
|
7
|
+
let u = !!(i.foregroundColor || i.backgroundColor), d = l || i.disabled;
|
|
8
|
+
return /* @__PURE__ */ r(n, {
|
|
9
|
+
size: s,
|
|
10
|
+
label: i.label,
|
|
11
|
+
onDelete: a ? () => a(i) : void 0,
|
|
12
|
+
onClick: o ? () => o(i) : void 0,
|
|
13
|
+
clickable: !!o && !i.disabled && !l,
|
|
14
|
+
disabled: d,
|
|
15
|
+
variant: c,
|
|
16
|
+
color: u ? void 0 : i.color ?? "default",
|
|
17
|
+
className: [t.chip, d && e.disabled].filter(Boolean).join(" "),
|
|
15
18
|
sx: {
|
|
16
|
-
...
|
|
17
|
-
color:
|
|
18
|
-
backgroundColor:
|
|
19
|
-
borderColor:
|
|
19
|
+
...u && {
|
|
20
|
+
color: i.foregroundColor ?? "inherit",
|
|
21
|
+
backgroundColor: i.backgroundColor ?? "transparent",
|
|
22
|
+
borderColor: i.backgroundColor ?? void 0,
|
|
20
23
|
"& .MuiChip-deleteIcon": {
|
|
21
|
-
color:
|
|
22
|
-
"&:hover": { color:
|
|
24
|
+
color: i.foregroundColor ? `${i.foregroundColor}99` : "inherit",
|
|
25
|
+
"&:hover": { color: i.foregroundColor ?? "inherit" }
|
|
23
26
|
}
|
|
24
27
|
},
|
|
25
|
-
cursor:
|
|
28
|
+
cursor: o && !i.disabled && !d ? "pointer" : "default"
|
|
26
29
|
}
|
|
27
30
|
});
|
|
28
31
|
}
|
|
29
32
|
//#endregion
|
|
30
|
-
export {
|
|
33
|
+
export { i as TagSelectionChip };
|
|
@@ -1,57 +1,62 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { tagSelectionClasses as e } from "./tagSelectionClasses.js";
|
|
2
|
+
import { TagSelectionChip as t } from "./TagSelectionChip.js";
|
|
3
|
+
import { useState as n } from "react";
|
|
4
|
+
import { Box as r, Chip as i, Popover as a, Stack as o, Typography as s } from "@mui/material";
|
|
5
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
5
6
|
//#region src/components/tag-selection/TagSelectionSelectedTags.tsx
|
|
6
|
-
function
|
|
7
|
-
let [
|
|
7
|
+
function d({ selectedTags: d, translation: f, onTagDelete: p, showSelectedTagsLabel: m, chipSize: h = "medium", chipVariant: g = "filled", disabled: _ = !1, maxVisibleChips: v, popoverPlacement: y = "bottom" }) {
|
|
8
|
+
let [b, x] = n(null), S = v === void 0 ? d : d.slice(0, v), C = v === void 0 ? [] : d.slice(v), w = !!b && C.length > 0, T = y === "top" ? {
|
|
8
9
|
vertical: "top",
|
|
9
10
|
horizontal: "left"
|
|
10
11
|
} : {
|
|
11
12
|
vertical: "bottom",
|
|
12
13
|
horizontal: "left"
|
|
13
|
-
},
|
|
14
|
+
}, E = y === "top" ? {
|
|
14
15
|
vertical: "bottom",
|
|
15
16
|
horizontal: "left"
|
|
16
17
|
} : {
|
|
17
18
|
vertical: "top",
|
|
18
19
|
horizontal: "left"
|
|
19
20
|
};
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
+
return /* @__PURE__ */ u(r, {
|
|
21
22
|
sx: { mb: 2 },
|
|
22
|
-
|
|
23
|
+
className: e.selectedTags,
|
|
24
|
+
children: [m && /* @__PURE__ */ l(s, {
|
|
23
25
|
variant: "subtitle2",
|
|
24
26
|
gutterBottom: !0,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
className: e.selectedTagsLabel,
|
|
28
|
+
children: f.selectedTagsLabel
|
|
29
|
+
}), d.length === 0 ? /* @__PURE__ */ l(s, {
|
|
27
30
|
variant: "body2",
|
|
28
31
|
color: "text.secondary",
|
|
29
|
-
children:
|
|
30
|
-
}) : /* @__PURE__ */
|
|
32
|
+
children: f.noSelectedTagsText
|
|
33
|
+
}) : /* @__PURE__ */ u(o, {
|
|
31
34
|
direction: "row",
|
|
32
35
|
sx: {
|
|
33
36
|
flexWrap: "wrap",
|
|
34
37
|
gap: 1
|
|
35
38
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
className: e.chipsStack,
|
|
40
|
+
children: [S.map((e) => /* @__PURE__ */ l(t, {
|
|
41
|
+
tag: e,
|
|
42
|
+
onDelete: p,
|
|
43
|
+
chipSize: h,
|
|
44
|
+
chipVariant: g,
|
|
45
|
+
disabled: _
|
|
46
|
+
}, e.id)), C.length > 0 && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(i, {
|
|
47
|
+
size: h,
|
|
48
|
+
label: `+${C.length}`,
|
|
45
49
|
variant: "outlined",
|
|
46
50
|
clickable: !0,
|
|
47
|
-
onClick: (e) =>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
onClick: (e) => x(e.currentTarget),
|
|
52
|
+
className: e.overflowChip
|
|
53
|
+
}), /* @__PURE__ */ l(a, {
|
|
54
|
+
open: w,
|
|
55
|
+
anchorEl: b,
|
|
56
|
+
onClose: () => x(null),
|
|
57
|
+
anchorOrigin: T,
|
|
58
|
+
transformOrigin: E,
|
|
59
|
+
children: /* @__PURE__ */ l(r, {
|
|
55
60
|
sx: {
|
|
56
61
|
p: 1,
|
|
57
62
|
display: "flex",
|
|
@@ -59,17 +64,18 @@ function u({ selectedTags: u, translation: d, onTagDelete: f, showSelectedTagsLa
|
|
|
59
64
|
gap: .5,
|
|
60
65
|
maxWidth: 320
|
|
61
66
|
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
className: e.overflowPopover,
|
|
68
|
+
children: C.map((e) => /* @__PURE__ */ l(t, {
|
|
69
|
+
tag: e,
|
|
70
|
+
onDelete: _ ? void 0 : p,
|
|
71
|
+
chipSize: h,
|
|
72
|
+
chipVariant: g,
|
|
73
|
+
disabled: _
|
|
74
|
+
}, e.id))
|
|
69
75
|
})
|
|
70
76
|
})] })]
|
|
71
77
|
})]
|
|
72
78
|
});
|
|
73
79
|
}
|
|
74
80
|
//#endregion
|
|
75
|
-
export {
|
|
81
|
+
export { d as TagSelectionSelectedTags };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS class names for every named slot in the TagSelection component.
|
|
3
|
+
*
|
|
4
|
+
* Use these to style individual parts of the component without relying on
|
|
5
|
+
* MUI's internal class names, which can change between versions.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```css
|
|
9
|
+
* .MuiTsTagSelection-chip { border-radius: 4px; }
|
|
10
|
+
* .MuiTsTagSelection-chip.MuiTs-disabled { opacity: 0.5; }
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare const tagSelectionClasses: {
|
|
14
|
+
/** The outermost wrapper element of the TagSelection component. Also receives `MuiTs-disabled` when `disabled={true}`. */
|
|
15
|
+
readonly root: "MuiTsTagSelection-root";
|
|
16
|
+
/** The area that shows the selected-tags section (label + chips). */
|
|
17
|
+
readonly selectedTags: "MuiTsTagSelection-selectedTags";
|
|
18
|
+
/** The label text above the selected chips ("Selected tags"). */
|
|
19
|
+
readonly selectedTagsLabel: "MuiTsTagSelection-selectedTagsLabel";
|
|
20
|
+
/** The flex row that wraps all selected chips. */
|
|
21
|
+
readonly chipsStack: "MuiTsTagSelection-chipsStack";
|
|
22
|
+
/** Each selected tag chip. Also receives `MuiTs-disabled` when the chip is disabled. */
|
|
23
|
+
readonly chip: "MuiTsTagSelection-chip";
|
|
24
|
+
/** The overflow "+N" chip shown when `maxVisibleChips` is exceeded. */
|
|
25
|
+
readonly overflowChip: "MuiTsTagSelection-overflowChip";
|
|
26
|
+
/** The content box inside the overflow popover. */
|
|
27
|
+
readonly overflowPopover: "MuiTsTagSelection-overflowPopover";
|
|
28
|
+
/** The autocomplete section (search input + dropdown). */
|
|
29
|
+
readonly autocomplete: "MuiTsTagSelection-autocomplete";
|
|
30
|
+
/** Each option chip rendered inside the autocomplete dropdown list. */
|
|
31
|
+
readonly option: "MuiTsTagSelection-option";
|
|
32
|
+
/** The create-tag panel (color row + palette) shown when `allowCreate={true}` and search has no match. */
|
|
33
|
+
readonly createPanel: "MuiTsTagSelection-createPanel";
|
|
34
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/components/tag-selection/tagSelectionClasses.ts
|
|
2
|
+
var e = {
|
|
3
|
+
root: "MuiTsTagSelection-root",
|
|
4
|
+
selectedTags: "MuiTsTagSelection-selectedTags",
|
|
5
|
+
selectedTagsLabel: "MuiTsTagSelection-selectedTagsLabel",
|
|
6
|
+
chipsStack: "MuiTsTagSelection-chipsStack",
|
|
7
|
+
chip: "MuiTsTagSelection-chip",
|
|
8
|
+
overflowChip: "MuiTsTagSelection-overflowChip",
|
|
9
|
+
overflowPopover: "MuiTsTagSelection-overflowPopover",
|
|
10
|
+
autocomplete: "MuiTsTagSelection-autocomplete",
|
|
11
|
+
option: "MuiTsTagSelection-option",
|
|
12
|
+
createPanel: "MuiTsTagSelection-createPanel"
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { e as tagSelectionClasses };
|