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