@thebuoyant-tsdev/mui-ts-library 3.20.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 +7 -0
- package/README.md +7 -0
- 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 +1 -1
- package/package.json +1 -1
|
@@ -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
|
})] })]
|