@pibit.ai/cure-design-system 0.3.30 → 0.3.35

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.
@@ -57,8 +57,27 @@ export declare function getDragScrollDeltas(scrollContainer: HTMLElement, client
57
57
  dy: number;
58
58
  };
59
59
  export declare function resolveCellCoordFromElement(cell: HTMLElement): TableCellCoord | null;
60
+ /**
61
+ * First selectable data cell of the row a keystroke came from.
62
+ *
63
+ * Row chrome (selection checkbox, row actions, delete button) is marked `data-grid-no-range`, so a
64
+ * keystroke that starts there resolves to no cell at all. Anchoring on the row's first data cell
65
+ * keeps the leading column inside the range instead of starting one column in.
66
+ */
67
+ export declare function resolveRowAnchorCoordFromTarget(target: EventTarget | null, container: HTMLElement | null): TableCellCoord | null;
60
68
  /** Find the grid cell under the pointer (for drag updates while scrolling). */
61
69
  export declare function hitTestGridCell(container: HTMLElement, clientX: number, clientY: number): HTMLElement | null;
62
70
  export declare function canStartCellRangeFromTarget(target: EventTarget | null, container: HTMLElement | null): HTMLElement | null;
63
71
  export declare function selectionFromSingleCell(cell: TableCellCoord): TableCellSelection;
72
+ /**
73
+ * Selection after a keyboard move from `current` towards `neighbor` (`null` at a grid edge).
74
+ *
75
+ * `extend` is Shift+Arrow. Starting a range with nothing selected yet anchors on `current`, not on
76
+ * `neighbor` — anchoring on the neighbor would drop the column the user started from and shift the
77
+ * whole range one column across.
78
+ *
79
+ * Returns `selection` unchanged when the move is a no-op, and `null` when there is nothing to
80
+ * select (plain arrow at a grid edge).
81
+ */
82
+ export declare function nextKeyboardCellSelection(current: TableCellCoord, neighbor: TableCellCoord | null, selection: TableCellSelection | null | undefined, extend: boolean): TableCellSelection | null;
64
83
  //# sourceMappingURL=cellRangeSelection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cellRangeSelection.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/cellRangeSelection.ts"],"names":[],"mappings":"AAMA,sFAAsF;AACtF,eAAO,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M,GACd,WAAW,GAAG,IAAI,CAQpB;AAED,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,WAAW,GAAG,IAAI,EAC1B,SAAS,EAAE,WAAW,GAAG,IAAI,GAC5B,WAAW,GAAG,IAAI,CAcpB;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,cAAc,GAAG,kBAAkB,CAEhF;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,cAAc,GAAG,IAAI,EAC/B,SAAS,EAAE,kBAAkB,GAAG,IAAI,GAAG,SAAS,EAChD,MAAM,EAAE,OAAO,GACd,kBAAkB,GAAG,IAAI,CAM3B"}
@@ -1,42 +1,42 @@
1
- import { ROW_DRAG_THRESHOLD_PX as x, ROW_DRAG_SCROLL_EDGE_PX as p, ROW_DRAG_SCROLL_MAX_PX as I } from "./rowReorderDrag.js";
2
- const C = x;
1
+ import { ROW_REORDER_ATTR as p, ROW_DRAG_THRESHOLD_PX as b, ROW_DRAG_SCROLL_EDGE_PX as E, ROW_DRAG_SCROLL_MAX_PX as _ } from "./rowReorderDrag.js";
2
+ const y = b;
3
3
  function M(n, t) {
4
4
  return n.indexOf(t);
5
5
  }
6
- function b(n, t, o) {
7
- const r = M(t, n.anchor.rowId), e = M(t, n.focus.rowId), c = M(o, n.anchor.columnKey), l = M(o, n.focus.columnKey);
8
- return r < 0 || e < 0 || c < 0 || l < 0 ? null : {
9
- rowMin: Math.min(r, e),
10
- rowMax: Math.max(r, e),
11
- colMin: Math.min(c, l),
12
- colMax: Math.max(c, l)
6
+ function x(n, t, o) {
7
+ const r = M(t, n.anchor.rowId), l = M(t, n.focus.rowId), i = M(o, n.anchor.columnKey), e = M(o, n.focus.columnKey);
8
+ return r < 0 || l < 0 || i < 0 || e < 0 ? null : {
9
+ rowMin: Math.min(r, l),
10
+ rowMax: Math.max(r, l),
11
+ colMin: Math.min(i, e),
12
+ colMax: Math.max(i, e)
13
13
  };
14
14
  }
15
15
  function w(n) {
16
16
  return n.anchor.rowId === n.focus.rowId && n.anchor.columnKey === n.focus.columnKey;
17
17
  }
18
- function S(n, t, o) {
19
- const r = b(n, t, o);
18
+ function A(n, t, o) {
19
+ const r = x(n, t, o);
20
20
  if (!r) return null;
21
- const { rowMin: e, rowMax: c, colMin: l, colMax: a } = r, s = t.slice(e, c + 1), u = o.slice(l, a + 1), f = s.map((i) => i === n.anchor.rowId ? n.anchor.sourceIndex : i === n.focus.rowId ? n.focus.sourceIndex : null), d = {
21
+ const { rowMin: l, rowMax: i, colMin: e, colMax: u } = r, s = t.slice(l, i + 1), a = o.slice(e, u + 1), f = s.map((c) => c === n.anchor.rowId ? n.anchor.sourceIndex : c === n.focus.rowId ? n.focus.sourceIndex : null), h = {
22
22
  rowId: s[0],
23
- columnKey: u[0],
23
+ columnKey: a[0],
24
24
  sourceIndex: f[0] ?? null
25
25
  }, m = {
26
26
  rowId: s[s.length - 1],
27
- columnKey: u[u.length - 1],
27
+ columnKey: a[a.length - 1],
28
28
  sourceIndex: f[f.length - 1] ?? null
29
29
  };
30
30
  return {
31
31
  rowIds: s,
32
- columnKeys: u,
32
+ columnKeys: a,
33
33
  sourceIndices: f,
34
- start: d,
34
+ start: h,
35
35
  end: m
36
36
  };
37
37
  }
38
- function y(n, t, o, r, e) {
39
- const c = {
38
+ function L(n, t, o, r, l) {
39
+ const i = {
40
40
  top: !1,
41
41
  bottom: !1,
42
42
  left: !1,
@@ -48,83 +48,90 @@ function y(n, t, o, r, e) {
48
48
  isAnchor: !1,
49
49
  isFocus: !1,
50
50
  isSingle: !1,
51
- edges: c
51
+ edges: i
52
52
  };
53
- const l = b(n, r, e), a = M(r, t), s = M(e, o);
54
- if (!l || a < 0 || s < 0)
53
+ const e = x(n, r, l), u = M(r, t), s = M(l, o);
54
+ if (!e || u < 0 || s < 0)
55
55
  return {
56
56
  inRange: !1,
57
57
  isAnchor: !1,
58
58
  isFocus: !1,
59
59
  isSingle: w(n),
60
- edges: c
60
+ edges: i
61
61
  };
62
- const u = a >= l.rowMin && a <= l.rowMax && s >= l.colMin && s <= l.colMax, f = n.anchor.rowId === t && n.anchor.columnKey === o, d = n.focus.rowId === t && n.focus.columnKey === o, m = w(n);
62
+ const a = u >= e.rowMin && u <= e.rowMax && s >= e.colMin && s <= e.colMax, f = n.anchor.rowId === t && n.anchor.columnKey === o, h = n.focus.rowId === t && n.focus.columnKey === o, m = w(n);
63
63
  return {
64
- inRange: u,
64
+ inRange: a,
65
65
  isAnchor: f,
66
- isFocus: d,
66
+ isFocus: h,
67
67
  isSingle: m,
68
- edges: u ? {
69
- top: a === l.rowMin,
70
- bottom: a === l.rowMax,
71
- left: s === l.colMin,
72
- right: s === l.colMax
73
- } : c
68
+ edges: a ? {
69
+ top: u === e.rowMin,
70
+ bottom: u === e.rowMax,
71
+ left: s === e.colMin,
72
+ right: s === e.colMax
73
+ } : i
74
74
  };
75
75
  }
76
- function E(n) {
76
+ function T(n) {
77
77
  const t = "var(--color-border-brand, var(--color-brand-500, #7f56d9))", o = [];
78
78
  return n.top && o.push(`inset 0 2px 0 0 ${t}`), n.bottom && o.push(`inset 0 -2px 0 0 ${t}`), n.left && o.push(`inset 2px 0 0 0 ${t}`), n.right && o.push(`inset -2px 0 0 0 ${t}`), o.length > 0 ? o.join(", ") : void 0;
79
79
  }
80
- function A(n, t, o, r = p, e = I) {
80
+ function H(n, t, o, r = E, l = _) {
81
81
  const {
82
- scrollTop: c,
83
- scrollLeft: l,
84
- scrollHeight: a,
82
+ scrollTop: i,
83
+ scrollLeft: e,
84
+ scrollHeight: u,
85
85
  scrollWidth: s,
86
- clientHeight: u,
86
+ clientHeight: a,
87
87
  clientWidth: f
88
- } = n, d = a - u, m = s - f, i = n.getBoundingClientRect();
89
- let g = 0;
90
- if (d > 0) {
91
- if (o < i.top + r) {
92
- const h = o < i.top ? 1 : (i.top + r - o) / r;
93
- g = -Math.ceil(e * Math.min(1, Math.max(0, h))), c <= 0 && (g = 0);
94
- } else if (o > i.bottom - r) {
95
- const h = o > i.bottom ? 1 : (o - (i.bottom - r)) / r;
96
- g = Math.ceil(e * Math.min(1, Math.max(0, h))), c >= d && (g = 0);
88
+ } = n, h = u - a, m = s - f, c = n.getBoundingClientRect();
89
+ let R = 0;
90
+ if (h > 0) {
91
+ if (o < c.top + r) {
92
+ const d = o < c.top ? 1 : (c.top + r - o) / r;
93
+ R = -Math.ceil(l * Math.min(1, Math.max(0, d))), i <= 0 && (R = 0);
94
+ } else if (o > c.bottom - r) {
95
+ const d = o > c.bottom ? 1 : (o - (c.bottom - r)) / r;
96
+ R = Math.ceil(l * Math.min(1, Math.max(0, d))), i >= h && (R = 0);
97
97
  }
98
98
  }
99
- let R = 0;
99
+ let g = 0;
100
100
  if (m > 0) {
101
- if (t < i.left + r) {
102
- const h = t < i.left ? 1 : (i.left + r - t) / r;
103
- R = -Math.ceil(e * Math.min(1, Math.max(0, h))), l <= 0 && (R = 0);
104
- } else if (t > i.right - r) {
105
- const h = t > i.right ? 1 : (t - (i.right - r)) / r;
106
- R = Math.ceil(e * Math.min(1, Math.max(0, h))), l >= m && (R = 0);
101
+ if (t < c.left + r) {
102
+ const d = t < c.left ? 1 : (c.left + r - t) / r;
103
+ g = -Math.ceil(l * Math.min(1, Math.max(0, d))), e <= 0 && (g = 0);
104
+ } else if (t > c.right - r) {
105
+ const d = t > c.right ? 1 : (t - (c.right - r)) / r;
106
+ g = Math.ceil(l * Math.min(1, Math.max(0, d))), e >= m && (g = 0);
107
107
  }
108
108
  }
109
- return { dx: R, dy: g };
109
+ return { dx: g, dy: R };
110
110
  }
111
- function L(n) {
111
+ function C(n) {
112
112
  const t = n.getAttribute("data-grid-row-id"), o = n.getAttribute("data-grid-col-key");
113
113
  if (!t || !o) return null;
114
- const r = n.getAttribute("data-grid-source-index"), e = r != null && r !== "" ? Number(r) : NaN;
114
+ const r = n.getAttribute("data-grid-source-index"), l = r != null && r !== "" ? Number(r) : NaN;
115
115
  return {
116
116
  rowId: t,
117
117
  columnKey: o,
118
- sourceIndex: Number.isNaN(e) ? null : e
118
+ sourceIndex: Number.isNaN(l) ? null : l
119
119
  };
120
120
  }
121
+ function O(n, t) {
122
+ if (!(n instanceof HTMLElement) || !t || !t.contains(n)) return null;
123
+ const o = n.closest(`[${p}]`);
124
+ if (!(o instanceof HTMLElement) || !t.contains(o)) return null;
125
+ const r = o.querySelector("[data-grid-cell]");
126
+ return !r || r.closest("[data-grid-no-range]") ? null : C(r);
127
+ }
121
128
  function D(n, t, o) {
122
129
  const r = document.elementFromPoint(t, o);
123
130
  if (!(r instanceof Element)) return null;
124
- const e = r.closest("[data-grid-cell]");
125
- return !(e instanceof HTMLElement) || !n.contains(e) || e.closest("[data-grid-no-range]") ? null : e;
131
+ const l = r.closest("[data-grid-cell]");
132
+ return !(l instanceof HTMLElement) || !n.contains(l) || l.closest("[data-grid-no-range]") ? null : l;
126
133
  }
127
- function H(n, t) {
134
+ function F(n, t) {
128
135
  if (!(n instanceof HTMLElement) || !t || !t.contains(n) || n.closest("[data-grid-no-range]") || n.closest(
129
136
  'input, textarea, select, [contenteditable]:not([contenteditable="false"]), [role="textbox"]'
130
137
  ))
@@ -132,19 +139,24 @@ function H(n, t) {
132
139
  const o = n.closest("[data-grid-cell]");
133
140
  return !(o instanceof HTMLElement) || !t.contains(o) ? null : o;
134
141
  }
135
- function O(n) {
142
+ function I(n) {
136
143
  return { anchor: n, focus: n };
137
144
  }
145
+ function N(n, t, o, r) {
146
+ return r ? o ? t ? { anchor: o.anchor, focus: t } : o : { anchor: n, focus: t ?? n } : t ? I(t) : null;
147
+ }
138
148
  export {
139
- C as CELL_RANGE_DRAG_THRESHOLD_PX,
140
- S as buildCellRangeRect,
141
- H as canStartCellRangeFromTarget,
142
- E as cellRangeEdgeBoxShadow,
143
- y as getCellRangeVisualState,
144
- A as getDragScrollDeltas,
145
- b as getSelectionIndexBounds,
149
+ y as CELL_RANGE_DRAG_THRESHOLD_PX,
150
+ A as buildCellRangeRect,
151
+ F as canStartCellRangeFromTarget,
152
+ T as cellRangeEdgeBoxShadow,
153
+ L as getCellRangeVisualState,
154
+ H as getDragScrollDeltas,
155
+ x as getSelectionIndexBounds,
146
156
  D as hitTestGridCell,
147
157
  w as isSingleCellSelection,
148
- L as resolveCellCoordFromElement,
149
- O as selectionFromSingleCell
158
+ N as nextKeyboardCellSelection,
159
+ C as resolveCellCoordFromElement,
160
+ O as resolveRowAnchorCoordFromTarget,
161
+ I as selectionFromSingleCell
150
162
  };
@@ -200,7 +200,7 @@ const $ = ({
200
200
  const S = o ? {
201
201
  position: "sticky",
202
202
  [o]: t,
203
- zIndex: 30
203
+ zIndex: 20
204
204
  } : {};
205
205
  return { ...typeof p.style == "function" ? p.style(m) : p.style || {}, ...S };
206
206
  },
@@ -334,7 +334,7 @@ const U = ({ className: s, children: i, sticky: n, stickyOffset: a = 0, ...o })
334
334
  const p = n ? {
335
335
  position: "sticky",
336
336
  [n]: a,
337
- zIndex: 20,
337
+ zIndex: 10,
338
338
  backgroundColor: "white",
339
339
  boxShadow: n === "right" ? "inset 2px 0 0px 0px var(--color-border-tertiary)" : "inset -2px 0 0px 0px var(--color-border-tertiary)"
340
340
  } : {};
@@ -1 +1 @@
1
- {"version":3,"file":"HideFieldsDropdown.d.ts","sourceRoot":"","sources":["../../../../src/patterns/table/toolbar/HideFieldsDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAU1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGlD,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,gBAAgB,EAAE,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACxD,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,cAAc,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAsDD,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CA8J1D,CAAC"}
1
+ {"version":3,"file":"HideFieldsDropdown.d.ts","sourceRoot":"","sources":["../../../../src/patterns/table/toolbar/HideFieldsDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAU1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGlD,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,gBAAgB,EAAE,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACxD,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,cAAc,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAmED,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAuL1D,CAAC"}
@@ -1,18 +1,24 @@
1
1
  import { jsxs as d, jsx as s } from "react/jsx-runtime";
2
- import { useState as g, useEffect as j, useMemo as x } from "react";
2
+ import { useState as g, useEffect as j, useMemo as u } from "react";
3
3
  import { EyeOff as q, Eye as K } from "@untitledui/icons";
4
4
  import _ from "../../../primitives/select/SearchInput.js";
5
5
  import { cx as I } from "../../../utils/cn.js";
6
6
  import { TOOLBAR_ICONS as $ } from "../toolbar-icons.js";
7
- import { resolveColumnLabel as F } from "./tableToolbarHelpers.js";
7
+ import { resolveColumnLabel as G } from "./tableToolbarHelpers.js";
8
8
  import { Dropdown as H } from "../../../primitives/dropdown/dropdown.js";
9
9
  import { Button as z } from "../../../primitives/button/button.js";
10
- import { useDragControls as G } from "../../../node_modules/framer-motion/dist/es/gestures/drag/use-drag-controls.js";
11
- import { Toggle as M } from "../../../primitives/toggle/toggle.js";
10
+ import { useDragControls as M } from "../../../node_modules/framer-motion/dist/es/gestures/drag/use-drag-controls.js";
11
+ import { Toggle as F } from "../../../primitives/toggle/toggle.js";
12
12
  import { ReorderGroup as J } from "../../../node_modules/framer-motion/dist/es/components/Reorder/Group.js";
13
13
  import { ReorderItem as Q } from "../../../node_modules/framer-motion/dist/es/components/Reorder/Item.js";
14
- const U = ({ columnKey: a, label: o, isHidden: p, isDisabled: i, onToggle: u }) => {
15
- const l = G();
14
+ const U = ({
15
+ columnKey: a,
16
+ label: o,
17
+ isHidden: p,
18
+ isDisabled: i,
19
+ onToggle: x
20
+ }) => {
21
+ const l = M();
16
22
  return /* @__PURE__ */ d(
17
23
  Q,
18
24
  {
@@ -31,12 +37,12 @@ const U = ({ columnKey: a, label: o, isHidden: p, isDisabled: i, onToggle: u })
31
37
  transition: { type: "spring", stiffness: 300, damping: 25 },
32
38
  children: [
33
39
  /* @__PURE__ */ s(
34
- M,
40
+ F,
35
41
  {
36
42
  "aria-label": `Toggle visibility of ${o}`,
37
43
  isSelected: !p,
38
44
  isDisabled: i,
39
- onChange: u,
45
+ onChange: x,
40
46
  size: "sm",
41
47
  slim: !0
42
48
  }
@@ -44,7 +50,10 @@ const U = ({ columnKey: a, label: o, isHidden: p, isDisabled: i, onToggle: u })
44
50
  /* @__PURE__ */ s(
45
51
  "span",
46
52
  {
47
- className: I("flex-1 truncate text-xs", p ? "text-tertiary" : "text-secondary"),
53
+ className: I(
54
+ "flex-1 truncate text-xs",
55
+ p ? "text-tertiary" : "text-secondary"
56
+ ),
48
57
  title: o,
49
58
  children: o
50
59
  }
@@ -56,7 +65,14 @@ const U = ({ columnKey: a, label: o, isHidden: p, isDisabled: i, onToggle: u })
56
65
  className: "shrink-0 cursor-grab text-fg-quaternary hover:text-fg-secondary touch-none select-none",
57
66
  "aria-label": `Drag ${o}`,
58
67
  title: "Drag to reorder",
59
- children: /* @__PURE__ */ s("img", { src: $.reorderDots, alt: "", className: "h-4 w-4 pointer-events-none" })
68
+ children: /* @__PURE__ */ s(
69
+ "img",
70
+ {
71
+ src: $.reorderDots,
72
+ alt: "",
73
+ className: "h-4 w-4 pointer-events-none"
74
+ }
75
+ )
60
76
  }
61
77
  )
62
78
  ]
@@ -67,38 +83,47 @@ const U = ({ columnKey: a, label: o, isHidden: p, isDisabled: i, onToggle: u })
67
83
  hiddenColumns: o,
68
84
  setHiddenColumns: p,
69
85
  columnOrder: i,
70
- setColumnOrder: u,
86
+ setColumnOrder: x,
71
87
  labelMeta: l,
72
88
  isDisabled: v
73
89
  }) => {
74
- const [y, D] = g(!1), [b, R] = g(""), [f, w] = g(() => new Set(o)), [N, m] = g(() => [...i]);
90
+ const [y, D] = g(!1), [b, R] = g(""), [m, w] = g(
91
+ () => new Set(o)
92
+ ), [N, f] = g(() => [
93
+ ...i
94
+ ]);
75
95
  j(() => {
76
- y && (w(new Set(o)), m([...i]), R(""));
96
+ y && (w(new Set(o)), f([...i]), R(""));
77
97
  }, [y, o, i]);
78
- const c = x(() => {
98
+ const c = u(() => {
79
99
  const e = /* @__PURE__ */ new Map();
80
- for (const r of a) e.set(r.value, F(r, l));
100
+ for (const r of a)
101
+ e.set(r.value, G(r, l));
81
102
  return e;
82
- }, [a, l]), n = x(() => {
103
+ }, [a, l]), n = u(() => {
83
104
  const e = /* @__PURE__ */ new Set(), r = [];
84
105
  for (const t of N)
85
106
  c.has(t) && !e.has(t) && (e.add(t), r.push(t));
86
107
  for (const t of a)
87
108
  e.has(t.value) || (e.add(t.value), r.push(t.value));
88
109
  return r;
89
- }, [N, a, c]), h = x(() => {
110
+ }, [N, a, c]), h = u(() => {
90
111
  const e = b.trim().toLowerCase();
91
- return e ? n.filter((r) => (c.get(r) ?? r).toLowerCase().includes(e)) : n;
112
+ return e ? n.filter(
113
+ (r) => (c.get(r) ?? r).toLowerCase().includes(e)
114
+ ) : n;
92
115
  }, [n, b, c]), T = (e) => {
93
116
  if (e.length === n.length) {
94
- m(e);
117
+ f(e);
95
118
  return;
96
119
  }
97
- const r = new Set(h), t = [...e], C = n.map((L) => r.has(L) ? t.shift() : L);
98
- m(C);
99
- }, A = x(
100
- () => n.filter((e) => !f.has(e)).length,
101
- [n, f]
120
+ const r = new Set(h), t = [...e], C = n.map(
121
+ (L) => r.has(L) ? t.shift() : L
122
+ );
123
+ f(C);
124
+ }, A = u(
125
+ () => n.filter((e) => !m.has(e)).length,
126
+ [n, m]
102
127
  ), P = (e) => {
103
128
  w((r) => {
104
129
  const t = new Set(r);
@@ -112,9 +137,9 @@ const U = ({ columnKey: a, label: o, isHidden: p, isDisabled: i, onToggle: u })
112
137
  return t;
113
138
  });
114
139
  }, B = () => {
115
- w(/* @__PURE__ */ new Set()), m(a.map((e) => e.value));
140
+ w(/* @__PURE__ */ new Set()), f(a.map((e) => e.value));
116
141
  }, E = () => {
117
- p(new Set(f)), u([...N]), D(!1);
142
+ p(new Set(m)), x([...N]), D(!1);
118
143
  }, O = o.size, S = O > 0;
119
144
  return /* @__PURE__ */ d(H.Root, { isOpen: y, onOpenChange: D, children: [
120
145
  /* @__PURE__ */ d(
@@ -128,7 +153,7 @@ const U = ({ columnKey: a, label: o, isHidden: p, isDisabled: i, onToggle: u })
128
153
  S && "ring-1 ring-brand-600 bg-brand-primary text-brand-600 hover:bg-brand-primary hover:text-brand-600"
129
154
  ),
130
155
  children: [
131
- "Hide Fields",
156
+ "Hide Columns",
132
157
  S && /* @__PURE__ */ s("span", { className: "text-xs font-semibold text-brand-600 ml-1", children: O })
133
158
  ]
134
159
  }
@@ -138,13 +163,13 @@ const U = ({ columnKey: a, label: o, isHidden: p, isDisabled: i, onToggle: u })
138
163
  _,
139
164
  {
140
165
  size: "sm",
141
- placeholder: "Search fields",
166
+ placeholder: "Search columns",
142
167
  value: b,
143
168
  onChange: (e) => R(e),
144
169
  className: "w-full ring-0 outline-hidden bg-secondary rounded-lg"
145
170
  }
146
171
  ),
147
- /* @__PURE__ */ s("div", { className: "max-h-[40vh] overflow-y-auto scrollbar-hide pr-0.5", children: h.length === 0 ? /* @__PURE__ */ s("p", { className: "px-2 py-3 text-xs text-tertiary", children: "No fields match." }) : /* @__PURE__ */ s(
172
+ /* @__PURE__ */ s("div", { className: "max-h-[40vh] overflow-y-auto scrollbar-hide pr-0.5", children: h.length === 0 ? /* @__PURE__ */ s("p", { className: "px-2 py-3 text-xs text-tertiary", children: "No columns match." }) : /* @__PURE__ */ s(
148
173
  J,
149
174
  {
150
175
  as: "div",
@@ -153,7 +178,7 @@ const U = ({ columnKey: a, label: o, isHidden: p, isDisabled: i, onToggle: u })
153
178
  onReorder: T,
154
179
  className: "flex flex-col gap-0.5",
155
180
  children: h.map((e) => {
156
- const r = f.has(e);
181
+ const r = m.has(e);
157
182
  return /* @__PURE__ */ s(
158
183
  U,
159
184
  {
@@ -169,8 +194,26 @@ const U = ({ columnKey: a, label: o, isHidden: p, isDisabled: i, onToggle: u })
169
194
  }
170
195
  ) }),
171
196
  /* @__PURE__ */ d("div", { className: "flex gap-2 pt-1 px-2 pb-2", children: [
172
- /* @__PURE__ */ s(z, { color: "secondary", size: "xs", onClick: B, className: "flex-1", children: "Reset" }),
173
- /* @__PURE__ */ s(z, { color: "primary", size: "xs", onClick: E, className: "flex-1", children: "Apply" })
197
+ /* @__PURE__ */ s(
198
+ z,
199
+ {
200
+ color: "secondary",
201
+ size: "xs",
202
+ onClick: B,
203
+ className: "flex-1",
204
+ children: "Reset"
205
+ }
206
+ ),
207
+ /* @__PURE__ */ s(
208
+ z,
209
+ {
210
+ color: "primary",
211
+ size: "xs",
212
+ onClick: E,
213
+ className: "flex-1",
214
+ children: "Apply"
215
+ }
216
+ )
174
217
  ] })
175
218
  ] }) })
176
219
  ] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pibit.ai/cure-design-system",
3
- "version": "0.3.30",
3
+ "version": "0.3.35",
4
4
  "description": "CURE Design System - React component library",
5
5
  "author": "Pibit",
6
6
  "license": "MIT",