@pibit.ai/cure-design-system 0.6.41 → 0.6.42

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 +1 @@
1
- {"version":3,"file":"HierarchicalSelect.d.ts","sourceRoot":"","sources":["../../../src/primitives/hierarchical-select/HierarchicalSelect.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAgD,MAAM,SAAS,CAAC;AAuBrG,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,EAClC,IAAW,EACX,IAAI,EACJ,YAAY,EACZ,aAAa,EACb,eAAe,EACf,QAAQ,EACR,iBAA8C,EAC9C,SAAe,EACf,SAAS,EACT,aAAoB,EACpB,eAAe,GAClB,EAAE,uBAAuB,CAAC,CAAC,CAAC,2CAyO5B;yBArPe,kBAAkB"}
1
+ {"version":3,"file":"HierarchicalSelect.d.ts","sourceRoot":"","sources":["../../../src/primitives/hierarchical-select/HierarchicalSelect.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAgD,MAAM,SAAS,CAAC;AAuBrG,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,EAClC,IAAW,EACX,IAAI,EACJ,YAAY,EACZ,aAAa,EACb,eAAe,EACf,QAAQ,EACR,iBAA8C,EAC9C,SAAe,EACf,SAAS,EACT,aAAoB,EACpB,eAAe,GAClB,EAAE,uBAAuB,CAAC,CAAC,CAAC,2CA8O5B;yBA1Pe,kBAAkB"}
@@ -1,5 +1,5 @@
1
- import { jsxs as T, jsx as i } from "react/jsx-runtime";
2
- import { useState as R, useMemo as a, useEffect as $, useCallback as S } from "react";
1
+ import { jsxs as T, jsx as l } from "react/jsx-runtime";
2
+ import { useState as P, useMemo as a, useEffect as R, useCallback as S } from "react";
3
3
  import { HierarchicalItem as U } from "./components/HierarchicalItem.js";
4
4
  import { getAllParentIds as W, toggleSelection as X, getVisibleLeafIds as Y, getSelectAllState as Z, toggleSelectAll as z, getSelectionState as K } from "./utils/selection.js";
5
5
  import { searchTree as ee } from "./utils/search.js";
@@ -20,39 +20,39 @@ function le({
20
20
  transformData: E,
21
21
  reconstructData: v,
22
22
  onChange: I,
23
- searchPlaceholder: D = "Search objects or fields",
23
+ searchPlaceholder: $ = "Search objects or fields",
24
24
  maxHeight: N = 400,
25
- className: H,
26
- showSelectAll: P = !0,
25
+ className: D,
26
+ showSelectAll: H = !0,
27
27
  childCountLabel: Q
28
28
  }) {
29
- const [u, V] = R(""), [A, w] = R(() => /* @__PURE__ */ new Set()), t = a(() => E(h, m), [h, m, E]), f = a(() => W(t), [t]), q = a(() => Array.from(f).sort().join("\0"), [f]);
30
- $(() => {
29
+ const [u, V] = P(""), [C, w] = P(() => /* @__PURE__ */ new Set()), t = a(() => E(h, m), [h, m, E]), f = a(() => W(t), [t]), q = a(() => Array.from(f).sort().join("\0"), [f]);
30
+ R(() => {
31
31
  w(new Set(f));
32
32
  }, [q]);
33
- const l = a(() => ee(t, u), [t, u]), n = !!u.trim();
34
- $(() => {
35
- n && w((e) => {
33
+ const n = a(() => ee(t, u), [t, u]), i = !!u.trim();
34
+ R(() => {
35
+ i && w((e) => {
36
36
  const s = new Set(e);
37
- return l.visibleIds.forEach((r) => {
37
+ return n.visibleIds.forEach((r) => {
38
38
  let o = t.parentMap.get(r);
39
39
  for (; o; )
40
40
  s.add(o), o = t.parentMap.get(o) ?? null;
41
41
  }), s;
42
42
  });
43
- }, [n, l.visibleIds, t]);
43
+ }, [i, n.visibleIds, t]);
44
44
  const B = S(
45
45
  (e) => {
46
46
  const r = u.trim().length > 0 && e.trim().length === 0;
47
47
  V(e), r && w(new Set(f));
48
48
  },
49
49
  [u, f]
50
- ), p = a(() => n ? l.visibleIds : void 0, [n, l.visibleIds]), _ = S(
50
+ ), p = a(() => i ? n.visibleIds : void 0, [i, n.visibleIds]), _ = S(
51
51
  (e) => {
52
- const s = n ? l.visibleIds : void 0, r = X(e, t, s), o = v(r, h, m);
52
+ const s = i ? n.visibleIds : void 0, r = X(e, t, s), o = v(r, h, m);
53
53
  I(o);
54
54
  },
55
- [t, n, l.visibleIds, v, h, m, I]
55
+ [t, i, n.visibleIds, v, h, m, I]
56
56
  ), F = a(() => Y(t, p).length, [t, p]), j = a(() => Z(t, p), [t, p]), g = F === 0, M = S(() => {
57
57
  if (g) return;
58
58
  const e = z(t, p), s = v(e, h, m);
@@ -62,36 +62,36 @@ function le({
62
62
  const r = new Set(s);
63
63
  return r.has(e) ? r.delete(e) : r.add(e), r;
64
64
  });
65
- }, []), C = a(() => {
65
+ }, []), A = a(() => {
66
66
  const e = [], s = (r) => {
67
67
  (r === null ? t.rootIds : t.childrenMap.get(r) || []).forEach((c) => {
68
- if (n && !l.visibleIds.has(c))
68
+ if (i && !n.visibleIds.has(c))
69
69
  return;
70
70
  const x = t.items.get(c);
71
71
  x && (e.push({
72
72
  id: c,
73
73
  item: x,
74
- isMatched: l.matchedIds.has(c)
75
- }), x.hasChildren && A.has(c) && s(c));
74
+ isMatched: n.matchedIds.has(c)
75
+ }), x.hasChildren && C.has(c) && s(c));
76
76
  });
77
77
  };
78
78
  return s(null), e;
79
- }, [t, n, l.visibleIds, l.matchedIds, A]), J = S(
79
+ }, [t, i, n.visibleIds, n.matchedIds, C]), J = S(
80
80
  (e) => {
81
- if (!n) return null;
82
- const s = l.resultCounts.get(e);
81
+ if (!i) return null;
82
+ const s = n.resultCounts.get(e);
83
83
  return s === void 0 ? null : `${s} ${s === 1 ? "result" : "results"}`;
84
84
  },
85
- [n, l.resultCounts]
86
- ), k = t.items.size > 0, O = P && k && (!n || C.length > 0), L = n ? "Select all results" : "Select All";
87
- return /* @__PURE__ */ T("div", { className: b("flex flex-col border border-primary rounded-lg bg-primary overflow-hidden", H), children: [
88
- /* @__PURE__ */ i("div", { className: "border-b border-secondary p-2", children: /* @__PURE__ */ i(
85
+ [i, n.resultCounts]
86
+ ), k = t.items.size > 0, O = H && k && (!i || A.length > 0), L = i ? "Select all results" : "Select All";
87
+ return /* @__PURE__ */ T("div", { className: b("flex flex-col border border-primary rounded-lg bg-primary overflow-hidden", D), children: [
88
+ /* @__PURE__ */ l("div", { className: "border-b border-secondary p-2", children: /* @__PURE__ */ l(
89
89
  te,
90
90
  {
91
91
  size: d == "xs" ? "sm" : d,
92
92
  value: u,
93
93
  onChange: B,
94
- placeholder: D
94
+ placeholder: $
95
95
  }
96
96
  ) }),
97
97
  O && /* @__PURE__ */ T(
@@ -104,30 +104,36 @@ function le({
104
104
  onClick: M,
105
105
  "aria-disabled": g,
106
106
  children: [
107
- j === "indeterminate" ? /* @__PURE__ */ i(se, { name: "MinusSquare", className: "size-4 text-utility-brand-600" }) : /* @__PURE__ */ i(
108
- re,
107
+ j === "indeterminate" ? /* @__PURE__ */ l(se, { name: "MinusSquare", className: "size-4 text-utility-brand-600" }) : /* @__PURE__ */ l(
108
+ "span",
109
109
  {
110
- isSelected: j === "selected",
111
- isDisabled: g,
112
- onChange: M,
113
- "aria-label": L
110
+ onClick: (e) => e.stopPropagation(),
111
+ children: /* @__PURE__ */ l(
112
+ re,
113
+ {
114
+ isSelected: j === "selected",
115
+ isDisabled: g,
116
+ onChange: M,
117
+ "aria-label": L
118
+ }
119
+ )
114
120
  }
115
121
  ),
116
- /* @__PURE__ */ i("span", { className: b("font-medium text-primary", y[d]), children: L })
122
+ /* @__PURE__ */ l("span", { className: b("font-medium text-primary", y[d]), children: L })
117
123
  ]
118
124
  }
119
125
  ),
120
- /* @__PURE__ */ i(
126
+ /* @__PURE__ */ l(
121
127
  "div",
122
128
  {
123
129
  className: "overflow-y-auto",
124
130
  style: { maxHeight: typeof N == "number" ? `${N}px` : N },
125
131
  role: "listbox",
126
132
  "aria-multiselectable": "true",
127
- children: k ? C.length === 0 ? /* @__PURE__ */ i("div", { className: b("flex items-center justify-center py-8 text-tertiary", y[d]), children: "No results found" }) : C.map(({ id: e, item: s, isMatched: r }) => {
133
+ children: k ? A.length === 0 ? /* @__PURE__ */ l("div", { className: b("flex items-center justify-center py-8 text-tertiary", y[d]), children: "No results found" }) : A.map(({ id: e, item: s, isMatched: r }) => {
128
134
  const o = s.depth === 0 ? J(e) : null, c = K(e, t), x = s.disabled === !0;
129
- return /* @__PURE__ */ i("div", { children: /* @__PURE__ */ T("div", { className: "flex items-center", children: [
130
- /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
135
+ return /* @__PURE__ */ l("div", { children: /* @__PURE__ */ T("div", { className: "flex items-center", children: [
136
+ /* @__PURE__ */ l("div", { className: "flex-1", children: /* @__PURE__ */ l(
131
137
  U,
132
138
  {
133
139
  size: d,
@@ -137,15 +143,15 @@ function le({
137
143
  searchQuery: u,
138
144
  onToggle: _,
139
145
  isExpandable: s.hasChildren,
140
- isExpanded: A.has(e),
146
+ isExpanded: C.has(e),
141
147
  onExpandToggle: () => G(e),
142
148
  isDisabled: x,
143
149
  childCountLabel: Q
144
150
  }
145
151
  ) }),
146
- o && /* @__PURE__ */ i("span", { className: b("text-tertiary pr-3 whitespace-nowrap", y[d]), children: o })
152
+ o && /* @__PURE__ */ l("span", { className: b("text-tertiary pr-3 whitespace-nowrap", y[d]), children: o })
147
153
  ] }) }, e);
148
- }) : /* @__PURE__ */ i("div", { className: b("flex items-center justify-center py-8 text-tertiary", y[d]), children: "No items available" })
154
+ }) : /* @__PURE__ */ l("div", { className: b("flex items-center justify-center py-8 text-tertiary", y[d]), children: "No items available" })
149
155
  }
150
156
  )
151
157
  ] });
@@ -1 +1 @@
1
- {"version":3,"file":"HierarchicalItem.d.ts","sourceRoot":"","sources":["../../../../src/primitives/hierarchical-select/components/HierarchicalItem.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAkBtD,eAAO,MAAM,gBAAgB;oIAW1B,qBAAqB;;CA8EvB,CAAC"}
1
+ {"version":3,"file":"HierarchicalItem.d.ts","sourceRoot":"","sources":["../../../../src/primitives/hierarchical-select/components/HierarchicalItem.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAkBtD,eAAO,MAAM,gBAAgB;oIAW1B,qBAAqB;;CAmFvB,CAAC"}
@@ -1,95 +1,101 @@
1
- import { jsxs as l, jsx as r } from "react/jsx-runtime";
2
- import { useCallback as u } from "react";
1
+ import { jsxs as o, jsx as e } from "react/jsx-runtime";
2
+ import { useCallback as x } from "react";
3
3
  import { ChevronDown as g } from "@untitledui/icons";
4
4
  import { HighlightedText as w } from "./HighlightedText.js";
5
- import { cx as s } from "../../../utils/cn.js";
5
+ import { cx as l } from "../../../utils/cn.js";
6
6
  import { Icon as _ } from "../../icon/icon.js";
7
- import { Checkbox as I } from "../../checkbox/checkbox.js";
8
- import { ButtonUtility as L } from "../../button/button-utility.js";
9
- const k = 24, x = {
7
+ import { Checkbox as k } from "../../checkbox/checkbox.js";
8
+ import { ButtonUtility as I } from "../../button/button-utility.js";
9
+ const L = 24, C = {
10
10
  xs: "text-xs",
11
11
  sm: "text-sm",
12
12
  md: "text-md",
13
13
  lg: "text-lg"
14
14
  }, v = { singular: "subfield", plural: "subfields" }, H = ({
15
- size: i = "md",
15
+ size: n = "md",
16
16
  item: t,
17
- selectionState: n,
18
- searchQuery: c,
17
+ selectionState: c,
18
+ searchQuery: d,
19
19
  onToggle: m,
20
20
  isExpandable: y = !1,
21
- isExpanded: o = !1,
21
+ isExpanded: s = !1,
22
22
  onExpandToggle: a,
23
- isDisabled: e = !1,
24
- childCountLabel: d = v
23
+ isDisabled: r = !1,
24
+ childCountLabel: p = v
25
25
  }) => {
26
- const p = u(() => {
27
- e || m(t.id);
28
- }, [e, t.id, m]), C = u(
29
- (b) => {
30
- b.stopPropagation(), a == null || a();
26
+ const h = x(() => {
27
+ r || m(t.id);
28
+ }, [r, t.id, m]), N = x(
29
+ (i) => {
30
+ i.stopPropagation(), a == null || a();
31
31
  },
32
32
  [a]
33
- ), h = n === "selected", N = n === "indeterminate", f = t.depth === 0;
34
- return /* @__PURE__ */ l(
33
+ ), f = c === "selected", b = c === "indeterminate", u = t.depth === 0;
34
+ return /* @__PURE__ */ o(
35
35
  "div",
36
36
  {
37
- className: s(
37
+ className: l(
38
38
  "flex items-center justify-between gap-2 py-2.5 px-3 transition-colors",
39
- e ? "cursor-not-allowed opacity-50" : "cursor-pointer hover:bg-secondary_subtle/50",
40
- f && "bg-secondary_subtle/30"
39
+ r ? "cursor-not-allowed opacity-50" : "cursor-pointer hover:bg-secondary_subtle/50",
40
+ u && "bg-secondary_subtle/30"
41
41
  ),
42
- style: { paddingLeft: `${12 + t.depth * k}px` },
43
- onClick: p,
42
+ style: { paddingLeft: `${12 + t.depth * L}px` },
43
+ onClick: h,
44
44
  role: "option",
45
- "aria-selected": h,
46
- "aria-disabled": e,
45
+ "aria-selected": f,
46
+ "aria-disabled": r,
47
47
  children: [
48
- /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
49
- N && !e ? /* @__PURE__ */ r(_, { name: "MinusSquare", className: "size-4 shrink-0 text-utility-brand-600" }) : /* @__PURE__ */ r(
50
- I,
48
+ /* @__PURE__ */ o("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
49
+ b && !r ? /* @__PURE__ */ e(_, { name: "MinusSquare", className: "size-4 shrink-0 text-utility-brand-600" }) : /* @__PURE__ */ e(
50
+ "span",
51
51
  {
52
- isSelected: h,
53
- isDisabled: e,
54
- onChange: p,
55
- "aria-label": t.label
52
+ onClick: (i) => i.stopPropagation(),
53
+ children: /* @__PURE__ */ e(
54
+ k,
55
+ {
56
+ isSelected: f,
57
+ isDisabled: r,
58
+ onChange: h,
59
+ "aria-label": t.label
60
+ }
61
+ )
56
62
  }
57
63
  ),
58
- /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
59
- /* @__PURE__ */ r(
64
+ /* @__PURE__ */ o("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
65
+ /* @__PURE__ */ e(
60
66
  "span",
61
67
  {
62
- className: s(
68
+ className: l(
63
69
  "text-secondary truncate",
64
- f && "font-semibold text-primary",
65
- x[i]
70
+ u && "font-semibold text-primary",
71
+ C[n]
66
72
  ),
67
- children: c ? /* @__PURE__ */ r(w, { text: t.label, highlight: c }) : t.label
73
+ children: d ? /* @__PURE__ */ e(w, { text: t.label, highlight: d }) : t.label
68
74
  }
69
75
  ),
70
- t.hasChildren && t.childCount > 0 && /* @__PURE__ */ l("span", { className: s("text-tertiary whitespace-nowrap", x[i]), children: [
76
+ t.hasChildren && t.childCount > 0 && /* @__PURE__ */ o("span", { className: l("text-tertiary whitespace-nowrap", C[n]), children: [
71
77
  t.childCount,
72
78
  " ",
73
- t.childCount === 1 ? d.singular : d.plural
79
+ t.childCount === 1 ? p.singular : p.plural
74
80
  ] })
75
81
  ] })
76
82
  ] }),
77
- y ? /* @__PURE__ */ r(
78
- L,
83
+ y ? /* @__PURE__ */ e(
84
+ I,
79
85
  {
80
86
  size: "3xs",
81
87
  color: "tertiary",
82
- icon: /* @__PURE__ */ r(
88
+ icon: /* @__PURE__ */ e(
83
89
  g,
84
90
  {
85
91
  "data-icon": !0,
86
92
  size: 16,
87
- className: s("transition-transform duration-200", o && "rotate-180")
93
+ className: l("transition-transform duration-200", s && "rotate-180")
88
94
  }
89
95
  ),
90
- tooltip: o ? "Collapse" : "Expand",
91
- "aria-expanded": o,
92
- onClick: C
96
+ tooltip: s ? "Collapse" : "Expand",
97
+ "aria-expanded": s,
98
+ onClick: N
93
99
  }
94
100
  ) : null
95
101
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../../../src/primitives/hierarchical-select/utils/selection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAU/D;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,cAAc,CAkChH;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,cAAc,CA+F9G;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,cAAc,GAAG,GAAG,CAAC,MAAM,CAAC,CAQjE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAQ1F;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,cAAc,CAYhG;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,cAAc,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,cAAc,CAyC9F;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAS/D"}
1
+ {"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../../../src/primitives/hierarchical-select/utils/selection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAU/D;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,cAAc,CA+BhH;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,cAAc,CA+F9G;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,cAAc,GAAG,GAAG,CAAC,MAAM,CAAC,CAQjE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAQ1F;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,cAAc,CAYhG;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,cAAc,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,cAAc,CAyC9F;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAS/D"}
@@ -1,107 +1,107 @@
1
1
  function g(t, e) {
2
- var s;
3
- return ((s = t.items.get(e)) == null ? void 0 : s.disabled) === !0;
2
+ var n;
3
+ return ((n = t.items.get(e)) == null ? void 0 : n.disabled) === !0;
4
4
  }
5
5
  function C(t, e) {
6
- return e.filter((s) => !g(t, s));
6
+ return e.filter((n) => !g(t, n));
7
7
  }
8
- function S(t, e, s) {
8
+ function S(t, e, n) {
9
9
  var p;
10
- const c = e.childrenMap.get(t) || [];
11
- if (c.length === 0) {
12
- const n = e.items.get(t);
13
- return g(e, t), n != null && n.selected ? "selected" : "unselected";
10
+ const s = e.childrenMap.get(t) || [];
11
+ if (s.length === 0) {
12
+ const c = e.items.get(t);
13
+ return c != null && c.selected ? "selected" : "unselected";
14
14
  }
15
15
  if (g(e, t)) return "unselected";
16
- let l = C(e, c);
17
- if (s && (l = l.filter((n) => s.has(n))), l.length === 0)
16
+ let l = C(e, s);
17
+ if (n && (l = l.filter((c) => n.has(c))), l.length === 0)
18
18
  return (p = e.items.get(t)) != null && p.selected ? "selected" : "unselected";
19
- const d = l.map((n) => S(n, e, s)), u = d.every((n) => n === "selected"), h = d.every((n) => n === "unselected");
20
- return u ? "selected" : h ? "unselected" : "indeterminate";
19
+ const d = l.map((c) => S(c, e, n)), i = d.every((c) => c === "selected"), h = d.every((c) => c === "unselected");
20
+ return i ? "selected" : h ? "unselected" : "indeterminate";
21
21
  }
22
- function E(t, e, s) {
22
+ function E(t, e, n) {
23
23
  if (g(e, t))
24
24
  return e;
25
- const c = new Map(e.items), d = S(t, e, s) !== "selected", u = /* @__PURE__ */ new Set(), h = (o) => {
26
- const i = e.childrenMap.get(o) || [];
27
- i.length > 0 && u.add(o), i.forEach((a) => {
28
- if (!g(e, a) && (!s || s.has(a))) {
29
- const M = c.get(a), w = e.childrenMap.get(a) || [];
30
- M && (w.length === 0 ? c.set(a, { ...M, selected: d }) : u.add(a)), h(a);
25
+ const s = new Map(e.items), d = S(t, e, n) !== "selected", i = /* @__PURE__ */ new Set(), h = (o) => {
26
+ const u = e.childrenMap.get(o) || [];
27
+ u.length > 0 && i.add(o), u.forEach((a) => {
28
+ if (!g(e, a) && (!n || n.has(a))) {
29
+ const m = s.get(a), w = e.childrenMap.get(a) || [];
30
+ m && (w.length === 0 ? s.set(a, { ...m, selected: d }) : i.add(a)), h(a);
31
31
  }
32
32
  });
33
- }, p = c.get(t), n = e.childrenMap.get(t) || [];
34
- p && (n.length === 0 ? g(e, t) || c.set(t, { ...p, selected: d }) : u.add(t)), h(t);
35
- const r = Array.from(u).sort((o, i) => {
33
+ }, p = s.get(t), c = e.childrenMap.get(t) || [];
34
+ p && (c.length === 0 ? g(e, t) || s.set(t, { ...p, selected: d }) : i.add(t)), h(t);
35
+ const r = Array.from(i).sort((o, u) => {
36
36
  const a = e.depthMap.get(o) ?? 0;
37
- return (e.depthMap.get(i) ?? 0) - a;
37
+ return (e.depthMap.get(u) ?? 0) - a;
38
38
  });
39
39
  for (const o of r) {
40
- const i = c.get(o);
41
- if (i) {
42
- const a = S(o, { ...e, items: c });
43
- c.set(o, {
44
- ...i,
40
+ const u = s.get(o);
41
+ if (u) {
42
+ const a = S(o, { ...e, items: s });
43
+ s.set(o, {
44
+ ...u,
45
45
  selected: a !== "unselected"
46
46
  });
47
47
  }
48
48
  }
49
49
  let f = e.parentMap.get(t);
50
50
  for (; f; ) {
51
- const o = c.get(f);
51
+ const o = s.get(f);
52
52
  if (o) {
53
- const i = S(f, { ...e, items: c });
54
- c.set(f, {
53
+ const u = S(f, { ...e, items: s });
54
+ s.set(f, {
55
55
  ...o,
56
- selected: i !== "unselected"
56
+ selected: u !== "unselected"
57
57
  });
58
58
  }
59
59
  f = e.parentMap.get(f) ?? null;
60
60
  }
61
- return { ...e, items: c };
61
+ return { ...e, items: s };
62
62
  }
63
63
  function y(t) {
64
64
  const e = /* @__PURE__ */ new Set();
65
- return t.items.forEach((s, c) => {
66
- s.hasChildren && e.add(c);
65
+ return t.items.forEach((n, s) => {
66
+ n.hasChildren && e.add(s);
67
67
  }), e;
68
68
  }
69
- function m(t, e) {
70
- const s = [];
71
- return t.items.forEach((c, l) => {
72
- !c.hasChildren && !c.disabled && (!e || e.has(l)) && s.push(l);
73
- }), s;
69
+ function M(t, e) {
70
+ const n = [];
71
+ return t.items.forEach((s, l) => {
72
+ !s.hasChildren && !s.disabled && (!e || e.has(l)) && n.push(l);
73
+ }), n;
74
74
  }
75
75
  function A(t, e) {
76
76
  var l;
77
- const s = m(t, e);
78
- if (s.length === 0) return "unselected";
79
- let c = 0;
80
- for (const d of s)
81
- (l = t.items.get(d)) != null && l.selected && c++;
82
- return c === 0 ? "unselected" : c === s.length ? "selected" : "indeterminate";
77
+ const n = M(t, e);
78
+ if (n.length === 0) return "unselected";
79
+ let s = 0;
80
+ for (const d of n)
81
+ (l = t.items.get(d)) != null && l.selected && s++;
82
+ return s === 0 ? "unselected" : s === n.length ? "selected" : "indeterminate";
83
83
  }
84
84
  function B(t, e) {
85
- const c = A(t, e) !== "selected", l = new Map(t.items), d = m(t, e);
86
- for (const n of d) {
87
- const r = l.get(n);
88
- r && !r.disabled && l.set(n, { ...r, selected: c });
85
+ const s = A(t, e) !== "selected", l = new Map(t.items), d = M(t, e);
86
+ for (const c of d) {
87
+ const r = l.get(c);
88
+ r && !r.disabled && l.set(c, { ...r, selected: s });
89
89
  }
90
- const u = /* @__PURE__ */ new Set();
91
- for (const n of d) {
92
- let r = t.parentMap.get(n);
90
+ const i = /* @__PURE__ */ new Set();
91
+ for (const c of d) {
92
+ let r = t.parentMap.get(c);
93
93
  for (; r; )
94
- u.add(r), r = t.parentMap.get(r) ?? null;
94
+ i.add(r), r = t.parentMap.get(r) ?? null;
95
95
  }
96
- const h = Array.from(u).sort((n, r) => {
97
- const f = t.depthMap.get(n) ?? 0;
96
+ const h = Array.from(i).sort((c, r) => {
97
+ const f = t.depthMap.get(c) ?? 0;
98
98
  return (t.depthMap.get(r) ?? 0) - f;
99
99
  }), p = { ...t, items: l };
100
- for (const n of h) {
101
- const r = l.get(n);
100
+ for (const c of h) {
101
+ const r = l.get(c);
102
102
  if (r) {
103
- const f = S(n, p);
104
- l.set(n, {
103
+ const f = S(c, p);
104
+ l.set(c, {
105
105
  ...r,
106
106
  selected: f !== "unselected"
107
107
  });
@@ -111,8 +111,8 @@ function B(t, e) {
111
111
  }
112
112
  function P(t) {
113
113
  let e = 0;
114
- return t.items.forEach((s) => {
115
- !s.hasChildren && s.selected && e++;
114
+ return t.items.forEach((n) => {
115
+ !n.hasChildren && n.selected && e++;
116
116
  }), e;
117
117
  }
118
118
  export {
@@ -120,7 +120,7 @@ export {
120
120
  y as getAllParentIds,
121
121
  A as getSelectAllState,
122
122
  S as getSelectionState,
123
- m as getVisibleLeafIds,
123
+ M as getVisibleLeafIds,
124
124
  B as toggleSelectAll,
125
125
  E as toggleSelection
126
126
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pibit.ai/cure-design-system",
3
- "version": "0.6.41",
3
+ "version": "0.6.42",
4
4
  "description": "CURE Design System - React component library",
5
5
  "author": "Pibit",
6
6
  "license": "MIT",