@pibit.ai/cure-design-system 0.3.33 → 0.3.37

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.
@@ -10,7 +10,8 @@ export { TOOLBAR_ICONS } from './toolbar-icons';
10
10
  export type { TableColumnSchema, TableColumnMenuSchema, TableColumnValueType } from './types';
11
11
  export { TableToolbar, pickCoreToolbarProps, registerToolbarExtensions, getToolbarExtensions, RowHeightDropdown, HideFieldsDropdown, AlignDropdown, GroupByDropdown, ShowSummaryDropdown, SummaryFooterRow, ColumnHeaderMenu, RowActionsMenu, BulkActionBar, applyHideAndReorder, getDefaultAlignmentForType, getEffectiveAlignment, alignmentClass, getAggregationsForType, computeAggregation, groupRows, resolveColumnLabel, resolveSummaryDisplayValueType, ROW_HEIGHT_CLASS, AGGREGATION_LABELS, } from './toolbar';
12
12
  export type { SearchToolConfig, SortToolConfig, FilterToolConfig, RowHeightToolConfig, HideFieldsToolConfig, AlignToolConfig, GroupByToolConfig, SummaryToolConfig, UndoRedoToolConfig, ToolbarExtensionComponents, LegacySortToolConfig, LegacyFilterToolConfig, RowHeightOption, SummaryFooterRowProps, ColumnMenuAction, ColumnMenuCapabilities, RowActionsConfig, CellAlignment, AggregationType, AggregationOption, RowGroup, } from './toolbar';
13
- export { GridNavProvider, useGridKeyboardNavigation, isWithinCellEditor, findGridCell, focusGridCell, getGridNeighbor, getGridTabNeighbor, type GridNavDirection, type GridNeighbor, type GridNavValue, } from './useGridKeyboardNavigation';
13
+ export { GridNavProvider, useGridKeyboardNavigation, isWithinCellEditor, findGridCell, focusGridCell, getGridNeighbor, getGridTabNeighbor, type FocusGridCellOptions, type GridNavDirection, type GridNeighbor, type GridNavValue, } from './useGridKeyboardNavigation';
14
+ export { CELL_SCROLL_PADDING_PX, computeCellScrollDelta, getAxisScrollParent, getScrollportRect, measureStickyInsets, scrollGridCellIntoView, type CellScrollDelta, type EdgeRect, type GridScrollDirection, type StickyInsets, } from './scrollCellIntoView';
14
15
  export { TableUndoRedoProvider, useTableUndoRedo, useTableUndoRedoScope, MAX_HISTORY, wrapColumnHeaderActionWithUndoRedo, wrapEditChromeWithUndoRedo, wrapRowActionsWithUndoRedo, wrapSummaryFooterWithUndoRedo, wrapToolbarWithUndoRedo, type TableUndoRedoRegistration, type TableUndoRedoScopeApi, type TableUndoRedoState, type TableUndoSnapshot, } from './useTableUndoRedo';
15
16
  export { useIntegrateTableUndoRedo, type IntegrateTableUndoRedoOptions, type IntegrateTableUndoRedoResult, } from './integrateTableUndoRedo';
16
17
  export { applyTableUndoSnapshot, captureTableUndoSnapshot, } from './tableUndoRedo';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,YAAY,EACV,4BAA4B,EAC5B,yBAAyB,EACzB,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,EAC3B,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,KAAK,qBAAqB,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC3G,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,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B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,yBAAyB,EACzB,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,GAClC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,EACrB,KAAK,+BAA+B,GACrC,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Keeps the active/focus cell fully visible while a range is being selected.
3
+ *
4
+ * The browser's implicit scroll from `element.focus()` is not enough here: it targets the inner
5
+ * focus wrapper (so cell padding and the 2px range border stay clipped) and it ignores sticky
6
+ * overlays, parking the cell underneath the sticky header or a sticky first/last column.
7
+ */
8
+ export type GridScrollDirection = "up" | "down" | "left" | "right";
9
+ /** Gap kept between the cell and the visible edge so the range border is never flush/clipped. */
10
+ export declare const CELL_SCROLL_PADDING_PX = 4;
11
+ /** Widths/heights of the sticky overlays covering each edge of a scrollport. */
12
+ export type StickyInsets = {
13
+ top: number;
14
+ right: number;
15
+ bottom: number;
16
+ left: number;
17
+ };
18
+ export type EdgeRect = {
19
+ top: number;
20
+ right: number;
21
+ bottom: number;
22
+ left: number;
23
+ width: number;
24
+ height: number;
25
+ };
26
+ export type CellScrollDelta = {
27
+ dx: number;
28
+ dy: number;
29
+ };
30
+ export declare const NO_STICKY_INSETS: StickyInsets;
31
+ /** Nearest ancestor (self included) that actually scrolls on `axis`, else the page scroller. */
32
+ export declare const getAxisScrollParent: (start: HTMLElement | null, axis: "x" | "y") => HTMLElement | null;
33
+ /** Visible box of a scroller: the page scroller's box is the viewport, not its full content. */
34
+ export declare const getScrollportRect: (scroller: HTMLElement) => EdgeRect;
35
+ /**
36
+ * How far sticky chrome (header row, sticky columns) intrudes on each edge of `port`.
37
+ *
38
+ * A sticky element only counts while it is actually parked against that edge — once it has
39
+ * scrolled away with its scrollport it covers nothing, and the clamped arithmetic returns 0.
40
+ */
41
+ export declare const measureStickyInsets: (port: EdgeRect, cell: HTMLElement) => StickyInsets;
42
+ /** Scroll deltas that bring the whole cell inside `port` minus its sticky overlays. */
43
+ export declare const computeCellScrollDelta: (cell: EdgeRect, port: EdgeRect, insets?: StickyInsets, dir?: GridScrollDirection | null, padding?: number) => CellScrollDelta;
44
+ export declare const scrollGridCellIntoView: (cell: HTMLElement | null, options?: {
45
+ dir?: GridScrollDirection | null;
46
+ padding?: number;
47
+ }) => void;
48
+ //# sourceMappingURL=scrollCellIntoView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scrollCellIntoView.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/scrollCellIntoView.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,mBAAmB,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEnE,iGAAiG;AACjG,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,gFAAgF;AAChF,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzD,eAAO,MAAM,gBAAgB,EAAE,YAK9B,CAAC;AA6BF,gGAAgG;AAChG,eAAO,MAAM,mBAAmB,GAC9B,OAAO,WAAW,GAAG,IAAI,EACzB,MAAM,GAAG,GAAG,GAAG,KACd,WAAW,GAAG,IAchB,CAAC;AAEF,gGAAgG;AAChG,eAAO,MAAM,iBAAiB,GAAI,UAAU,WAAW,KAAG,QAOzD,CAAC;AAUF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAC9B,MAAM,QAAQ,EACd,MAAM,WAAW,KAChB,YA2CF,CAAC;AAgCF,uFAAuF;AACvF,eAAO,MAAM,sBAAsB,GACjC,MAAM,QAAQ,EACd,MAAM,QAAQ,EACd,SAAQ,YAA+B,EACvC,MAAK,mBAAmB,GAAG,IAAW,EACtC,UAAS,MAA+B,KACvC,eAiBD,CAAC;AAUH,eAAO,MAAM,sBAAsB,GACjC,MAAM,WAAW,GAAG,IAAI,EACxB,UAAS;IAAE,GAAG,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,KACnE,IAyCF,CAAC"}
@@ -0,0 +1,122 @@
1
+ const R = 4, L = {
2
+ top: 0,
3
+ right: 0,
4
+ bottom: 0,
5
+ left: 0
6
+ }, u = 1, S = /(auto|scroll|overlay)/, C = (t) => ({
7
+ top: t.top,
8
+ right: t.right,
9
+ bottom: t.bottom,
10
+ left: t.left,
11
+ width: t.width,
12
+ height: t.height
13
+ }), b = (t, n) => {
14
+ const o = getComputedStyle(t), e = n === "x" ? o.overflowX : o.overflowY;
15
+ return S.test(e) ? n === "x" ? t.scrollWidth > t.clientWidth + u : t.scrollHeight > t.clientHeight + u : !1;
16
+ }, p = (t) => t === document.scrollingElement || t === document.documentElement || t === document.body, g = (t, n) => {
17
+ let o = t;
18
+ for (; o; ) {
19
+ if (b(o, n)) return o;
20
+ o = o.parentElement;
21
+ }
22
+ const e = document.scrollingElement;
23
+ return e && (n === "x" ? e.scrollWidth > e.clientWidth + u : e.scrollHeight > e.clientHeight + u) ? e : null;
24
+ }, a = (t) => {
25
+ if (p(t)) {
26
+ const n = window.innerWidth, o = window.innerHeight;
27
+ return { top: 0, right: n, bottom: o, left: 0, width: n, height: o };
28
+ }
29
+ return C(t.getBoundingClientRect());
30
+ }, f = (t, n) => {
31
+ const o = getComputedStyle(t);
32
+ return o.position !== "sticky" ? !1 : n === "x" ? o.left !== "auto" || o.right !== "auto" : o.top !== "auto" || o.bottom !== "auto";
33
+ }, m = (t, n) => {
34
+ var l;
35
+ const o = { ...L }, e = n.closest("table"), s = e == null ? void 0 : e.querySelector(":scope > thead");
36
+ if (s && f(s, "y")) {
37
+ const i = s.getBoundingClientRect();
38
+ i.top <= t.top + u && (o.top = Math.max(0, Math.min(i.bottom - t.top, t.height)));
39
+ }
40
+ const r = e == null ? void 0 : e.querySelector(":scope > tfoot");
41
+ if (r && f(r, "y")) {
42
+ const i = r.getBoundingClientRect();
43
+ i.bottom >= t.bottom - u && (o.bottom = Math.max(
44
+ 0,
45
+ Math.min(t.bottom - i.top, t.height)
46
+ ));
47
+ }
48
+ const h = ((l = n.closest("tr")) == null ? void 0 : l.children) ?? [];
49
+ for (const i of Array.from(h)) {
50
+ if (!(i instanceof HTMLElement) || i === n || !f(i, "x")) continue;
51
+ const c = i.getBoundingClientRect();
52
+ c.left <= t.left + u ? o.left = Math.max(
53
+ o.left,
54
+ Math.min(c.right - t.left, t.width)
55
+ ) : c.right >= t.right - u && (o.right = Math.max(
56
+ o.right,
57
+ Math.min(t.right - c.left, t.width)
58
+ ));
59
+ }
60
+ return o;
61
+ }, d = (t, n, o, e, s, r) => {
62
+ const h = e - o;
63
+ if (h <= 0) return 0;
64
+ const l = t < o - u ? t - r - o : 0, i = n > e + u ? n + r - e : 0;
65
+ return n - t > h ? s === "start" ? l : s === "end" ? i : n <= o || t >= e ? l || i : 0 : l !== 0 ? l : i;
66
+ }, y = (t, n, o = L, e = null, s = 4) => ({
67
+ dx: d(
68
+ t.left,
69
+ t.right,
70
+ n.left + o.left,
71
+ n.right - o.right,
72
+ e === "left" ? "start" : e === "right" ? "end" : null,
73
+ s
74
+ ),
75
+ dy: d(
76
+ t.top,
77
+ t.bottom,
78
+ n.top + o.top,
79
+ n.bottom - o.bottom,
80
+ e === "up" ? "start" : e === "down" ? "end" : null,
81
+ s
82
+ )
83
+ }), x = (t) => {
84
+ var n;
85
+ return ((n = t.closest("table")) == null ? void 0 : n.parentElement) ?? t.parentElement;
86
+ }, _ = (t, n = {}) => {
87
+ if (!t || typeof document > "u") return;
88
+ const { dir: o = null, padding: e = 4 } = n, s = x(t);
89
+ if (!s) return;
90
+ const r = f(t, "x") ? null : g(s, "x"), h = f(t, "y") ? null : g(s, "y");
91
+ if (!r && !h) return;
92
+ const l = C(t.getBoundingClientRect());
93
+ if (r) {
94
+ const i = a(r), { dx: c } = y(
95
+ l,
96
+ i,
97
+ m(i, t),
98
+ o,
99
+ e
100
+ );
101
+ c !== 0 && (r.scrollLeft += c);
102
+ }
103
+ if (h) {
104
+ const i = a(h), { dy: c } = y(
105
+ l,
106
+ i,
107
+ m(i, t),
108
+ o,
109
+ e
110
+ );
111
+ c !== 0 && (h.scrollTop += c);
112
+ }
113
+ };
114
+ export {
115
+ R as CELL_SCROLL_PADDING_PX,
116
+ L as NO_STICKY_INSETS,
117
+ y as computeCellScrollDelta,
118
+ g as getAxisScrollParent,
119
+ a as getScrollportRect,
120
+ m as measureStickyInsets,
121
+ _ as scrollGridCellIntoView
122
+ };
@@ -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
  ] });
@@ -1,5 +1,9 @@
1
1
  import { ReactNode, RefObject } from 'react';
2
2
  export type GridNavDirection = "up" | "down" | "left" | "right";
3
+ /** Options for moving grid focus; `dir` lets the scroll align the edge being travelled toward. */
4
+ export type FocusGridCellOptions = {
5
+ dir?: GridNavDirection | null;
6
+ };
3
7
  export interface GridNeighbor {
4
8
  rowId: string;
5
9
  columnKey: string;
@@ -9,7 +13,7 @@ export interface GridNeighbor {
9
13
  export interface GridNavValue {
10
14
  getNeighbor: (rowId: string, columnKey: string, dir: GridNavDirection) => GridNeighbor | null;
11
15
  getTabNeighbor: (rowId: string, columnKey: string, forward: boolean) => GridNeighbor | null;
12
- focusCell: (rowId: string, columnKey: string) => boolean;
16
+ focusCell: (rowId: string, columnKey: string, options?: FocusGridCellOptions) => boolean;
13
17
  selectCell: (rowId: string, columnKey: string, sourceIndex?: number | null) => void;
14
18
  setEditingCell: (cell: {
15
19
  rowId: string;
@@ -21,8 +25,15 @@ export declare const isWithinCellEditor: (target: EventTarget | null) => boolean
21
25
  export declare const findGridCell: (container: HTMLElement | null, rowId: string, columnKey: string) => HTMLElement | null;
22
26
  export declare const getGridNeighbor: (container: HTMLElement | null, rowIds: readonly string[], columnKeys: readonly string[], rowId: string, columnKey: string, dir: GridNavDirection) => GridNeighbor | null;
23
27
  export declare const getGridTabNeighbor: (container: HTMLElement | null, rowIds: readonly string[], columnKeys: readonly string[], rowId: string, columnKey: string, forward: boolean) => GridNeighbor | null;
24
- export declare const focusGridCellElement: (cell: HTMLElement | null) => boolean;
25
- export declare const focusGridCell: (container: HTMLElement | null, rowId: string, columnKey: string) => boolean;
28
+ /**
29
+ * Focus a cell and bring it fully into view.
30
+ *
31
+ * The implicit scroll from `focus()` is suppressed: it targets the inner focus wrapper and ignores
32
+ * sticky chrome, so it leaves the cell's padding and range border clipped. `scrollGridCellIntoView`
33
+ * scrolls the `<td>` itself, accounting for the sticky header and sticky columns.
34
+ */
35
+ export declare const focusGridCellElement: (cell: HTMLElement | null, options?: FocusGridCellOptions) => boolean;
36
+ export declare const focusGridCell: (container: HTMLElement | null, rowId: string, columnKey: string, options?: FocusGridCellOptions) => boolean;
26
37
  export declare const GridNavProvider: ({ rowIds, columnKeys, containerRef, onSelectCell, onEditingCellChange, children, }: {
27
38
  rowIds: string[];
28
39
  columnKeys: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"useGridKeyboardNavigation.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/useGridKeyboardNavigation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmD,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAExG,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEhE,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,gBAAgB,KAAK,YAAY,GAAG,IAAI,CAAC;IAC9F,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,YAAY,GAAG,IAAI,CAAC;IAC5F,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IACzD,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC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,GAAG,IAAI,CAAC,CAAC;IAC5C,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACtF,mBAAmB,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,KAAK,IAAI,CAAC;IACjF,QAAQ,EAAE,SAAS,CAAC;CACrB,4CA+BA,CAAC;AAEF,eAAO,MAAM,yBAAyB,QAAO,YAAY,GAAG,IAAkC,CAAC"}
@@ -1,65 +1,66 @@
1
1
  import { jsx as C } from "react/jsx-runtime";
2
- import { useContext as h, useCallback as g, useMemo as p, createContext as G } from "react";
3
- const x = G(null), S = (e, t) => `[data-grid-cell][data-grid-row-id="${CSS.escape(e)}"][data-grid-col-key="${CSS.escape(t)}"]`, q = (e) => e instanceof HTMLElement ? !!(e.closest('[contenteditable]:not([contenteditable="false"])') || e.closest("input, textarea, select") || e.closest('[role="textbox"]')) : !1, b = (e, t, r) => (e == null ? void 0 : e.querySelector(S(t, r))) ?? null, N = (e, t, r, u, c) => {
4
- if (u < 0 || u >= t.length || c < 0 || c >= r.length) return null;
5
- const s = t[u], i = r[c], l = b(e, s, i);
6
- if (!l) return null;
7
- const n = l.getAttribute("data-grid-source-index"), o = n != null && n !== "" ? Number(n) : NaN;
2
+ import { useContext as p, useCallback as g, useMemo as h, createContext as G } from "react";
3
+ import { scrollGridCellIntoView as S } from "./scrollCellIntoView.js";
4
+ const x = G(null), v = (e, r) => `[data-grid-cell][data-grid-row-id="${CSS.escape(e)}"][data-grid-col-key="${CSS.escape(r)}"]`, M = (e) => e instanceof HTMLElement ? !!(e.closest('[contenteditable]:not([contenteditable="false"])') || e.closest("input, textarea, select") || e.closest('[role="textbox"]')) : !1, b = (e, r, t) => (e == null ? void 0 : e.querySelector(v(r, t))) ?? null, N = (e, r, t, l, c) => {
5
+ if (l < 0 || l >= r.length || c < 0 || c >= t.length) return null;
6
+ const s = r[l], u = t[c], i = b(e, s, u);
7
+ if (!i) return null;
8
+ const n = i.getAttribute("data-grid-source-index"), o = n != null && n !== "" ? Number(n) : NaN;
8
9
  return {
9
10
  rowId: s,
10
- columnKey: i,
11
+ columnKey: u,
11
12
  sourceIndex: Number.isNaN(o) ? null : o,
12
- element: l
13
+ element: i
13
14
  };
14
- }, v = (e, t, r, u, c, s) => {
15
- const i = t.indexOf(u), l = r.indexOf(c);
16
- if (i === -1 || l === -1) return null;
17
- let n = i, o = l;
18
- return s === "up" ? n -= 1 : s === "down" ? n += 1 : s === "left" ? o -= 1 : s === "right" && (o += 1), N(e, t, r, n, o);
19
- }, m = (e, t, r, u, c, s) => {
20
- const i = t.indexOf(u), l = r.indexOf(c);
21
- if (i === -1 || l === -1) return null;
22
- let n = i, o = l + (s ? 1 : -1);
23
- return o >= r.length ? (o = 0, n += 1) : o < 0 && (o = r.length - 1, n -= 1), N(e, t, r, n, o);
24
- }, I = (e) => (e == null ? void 0 : e.querySelector("[data-grid-focus]")) ?? e, O = (e) => {
25
- const t = I(e);
26
- return !t || typeof t.focus != "function" ? !1 : (t.focus(), !0);
27
- }, T = (e, t, r) => O(b(e, t, r)), M = ({
15
+ }, m = (e, r, t, l, c, s) => {
16
+ const u = r.indexOf(l), i = t.indexOf(c);
17
+ if (u === -1 || i === -1) return null;
18
+ let n = u, o = i;
19
+ return s === "up" ? n -= 1 : s === "down" ? n += 1 : s === "left" ? o -= 1 : s === "right" && (o += 1), N(e, r, t, n, o);
20
+ }, I = (e, r, t, l, c, s) => {
21
+ const u = r.indexOf(l), i = t.indexOf(c);
22
+ if (u === -1 || i === -1) return null;
23
+ let n = u, o = i + (s ? 1 : -1);
24
+ return o >= t.length ? (o = 0, n += 1) : o < 0 && (o = t.length - 1, n -= 1), N(e, r, t, n, o);
25
+ }, O = (e) => (e == null ? void 0 : e.querySelector("[data-grid-focus]")) ?? e, T = (e, r = {}) => {
26
+ const t = O(e);
27
+ return !t || typeof t.focus != "function" ? !1 : (t.focus({ preventScroll: !0 }), S(e, { dir: r.dir ?? null }), !0);
28
+ }, E = (e, r, t, l = {}) => T(b(e, r, t), l), P = ({
28
29
  rowIds: e,
29
- columnKeys: t,
30
- containerRef: r,
31
- onSelectCell: u,
30
+ columnKeys: r,
31
+ containerRef: t,
32
+ onSelectCell: l,
32
33
  onEditingCellChange: c,
33
34
  children: s
34
35
  }) => {
35
- const i = g(
36
- (d, f, a) => v(r.current, e, t, d, f, a),
37
- [r, e, t]
38
- ), l = g(
39
- (d, f, a) => m(r.current, e, t, d, f, a),
40
- [r, e, t]
36
+ const u = g(
37
+ (d, f, a) => m(t.current, e, r, d, f, a),
38
+ [t, e, r]
39
+ ), i = g(
40
+ (d, f, a) => I(t.current, e, r, d, f, a),
41
+ [t, e, r]
41
42
  ), n = g(
42
- (d, f) => T(r.current, d, f),
43
- [r]
44
- ), o = p(
43
+ (d, f, a) => E(t.current, d, f, a),
44
+ [t]
45
+ ), o = h(
45
46
  () => ({
46
- getNeighbor: i,
47
- getTabNeighbor: l,
47
+ getNeighbor: u,
48
+ getTabNeighbor: i,
48
49
  focusCell: n,
49
- selectCell: u,
50
+ selectCell: l,
50
51
  setEditingCell: c
51
52
  }),
52
- [i, l, n, u, c]
53
+ [u, i, n, l, c]
53
54
  );
54
55
  return /* @__PURE__ */ C(x.Provider, { value: o, children: s });
55
- }, P = () => h(x);
56
+ }, $ = () => p(x);
56
57
  export {
57
- M as GridNavProvider,
58
+ P as GridNavProvider,
58
59
  b as findGridCell,
59
- T as focusGridCell,
60
- O as focusGridCellElement,
61
- v as getGridNeighbor,
62
- m as getGridTabNeighbor,
63
- q as isWithinCellEditor,
64
- P as useGridKeyboardNavigation
60
+ E as focusGridCell,
61
+ T as focusGridCellElement,
62
+ m as getGridNeighbor,
63
+ I as getGridTabNeighbor,
64
+ M as isWithinCellEditor,
65
+ $ as useGridKeyboardNavigation
65
66
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pibit.ai/cure-design-system",
3
- "version": "0.3.33",
3
+ "version": "0.3.37",
4
4
  "description": "CURE Design System - React component library",
5
5
  "author": "Pibit",
6
6
  "license": "MIT",