@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.
@@ -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", disabled: o = !1 }) {
5
- let s = !!(n.foregroundColor || n.backgroundColor);
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 && !o,
12
- disabled: o || n.disabled,
13
- variant: n.selected ? "filled" : "outlined",
14
- color: s ? void 0 : n.color ?? "default",
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
- ...s && {
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 && !o ? "pointer" : "default"
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", 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" ? {
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
- }, w = _ === "top" ? {
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: [b.map((t) => /* @__PURE__ */ c(e, {
36
+ children: [x.map((t) => /* @__PURE__ */ c(e, {
37
37
  tag: t,
38
38
  onDelete: f,
39
39
  chipSize: m,
40
- disabled: h
41
- }, t.id)), x.length > 0 && /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(r, {
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: `+${x.length}`,
44
+ label: `+${S.length}`,
44
45
  variant: "outlined",
45
46
  clickable: !0,
46
- onClick: (e) => y(e.currentTarget)
47
+ onClick: (e) => b(e.currentTarget)
47
48
  }), /* @__PURE__ */ c(i, {
48
- open: S,
49
- anchorEl: v,
50
- onClose: () => y(null),
51
- anchorOrigin: C,
52
- transformOrigin: w,
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: x.map((t) => /* @__PURE__ */ c(e, {
62
+ children: S.map((t) => /* @__PURE__ */ c(e, {
62
63
  tag: t,
63
- onDelete: h ? void 0 : f,
64
+ onDelete: g ? void 0 : f,
64
65
  chipSize: m,
65
- disabled: h
66
+ chipVariant: h,
67
+ disabled: g
66
68
  }, t.id))
67
69
  })
68
70
  })] })]