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

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,420 +1,492 @@
1
- import { jsx as c, jsxs as _, Fragment as Mt } from "react/jsx-runtime";
2
- import { forwardRef as Fr, useState as A, useRef as le, useCallback as v, useMemo as k, useEffect as B, useLayoutEffect as Gr } from "react";
3
- import { ChevronRight as zr } from "@untitledui/icons";
4
- import { cx as m } from "../../utils/cn.js";
5
- import { TableCard as Yr, Table as g } from "./table.js";
6
- import { TablePagination as Mr } from "./TablePagination.js";
7
- import { getEffectiveAlignment as Ht, resolveColumnLabel as Ur, alignmentClass as Xr } from "./toolbar/tableToolbarHelpers.js";
8
- import { findGridCell as $r, isWithinCellEditor as Te, getGridNeighbor as jr, getGridTabNeighbor as Br, focusGridCell as Ut, GridNavProvider as qr } from "./useGridKeyboardNavigation.js";
9
- import { ROW_DRAG_THRESHOLD_PX as Ar, computeDropTarget as Kr, clipDropLineToScrollport as Hr, ROW_REORDER_ATTR as Xt, measureRowPreview as Jr, cloneRowForPreview as Vr, FloatingRowPreview as Qr, DropIndicatorLine as Zr, getRowDragScrollDelta as en, ROW_DRAG_SOURCE_STYLE as tn, ROW_SOURCE_INDEX_ATTR as rn } from "./rowReorderDrag.js";
10
- import { selectionFromSingleCell as st, resolveCellCoordFromElement as Oe, resolveRowAnchorCoordFromTarget as nn, buildCellRangeRect as at, nextKeyboardCellSelection as on, CELL_RANGE_DRAG_THRESHOLD_PX as sn, hitTestGridCell as an, canStartCellRangeFromTarget as $t, getDragScrollDeltas as cn, getCellRangeVisualState as dn, cellRangeEdgeBoxShadow as ln } from "./cellRangeSelection.js";
11
- import { BulkActionBar as un } from "./toolbar/BulkActionBar.js";
12
- import { TableToolbar as fn } from "./toolbar/TableToolbar.js";
13
- import { Checkbox as jt } from "../../primitives/checkbox/checkbox.js";
14
- import { ColumnHeaderMenu as pn } from "./toolbar/ColumnHeaderMenu.js";
15
- import { Button as hn } from "../../primitives/button/button.js";
16
- import { SummaryFooterRow as yn } from "./toolbar/SummaryFooter.js";
17
- import { RowActionsMenu as wn } from "./toolbar/RowActionsMenu.js";
18
- import { Icon as gn } from "../../primitives/icon/icon.js";
19
- import { ShimmerLine as mn } from "../../primitives/shimmer/shimmer.js";
20
- const xn = 5, bn = "__all__", Bt = {
1
+ import { jsx as a, jsxs as E, Fragment as wt } from "react/jsx-runtime";
2
+ import { forwardRef as Vr, useMemo as b, useState as H, useRef as oe, useEffect as X, useCallback as I, useLayoutEffect as Jt } from "react";
3
+ import { Slider as Jr, SliderTrack as Qr, SliderThumb as en } from "react-aria-components";
4
+ import { ChevronRight as tn } from "@untitledui/icons";
5
+ import { cx as x } from "../../utils/cn.js";
6
+ import { TableCard as rn, Table as m } from "./table.js";
7
+ import { TablePagination as nn } from "./TablePagination.js";
8
+ import { getEffectiveAlignment as dr, resolveColumnLabel as sn, alignmentClass as on } from "./toolbar/tableToolbarHelpers.js";
9
+ import { normalizeZoomConfig as an, DEFAULT_TABLE_ZOOM as cn, parsePxValue as mt, DEFAULT_ZOOMABLE_COLUMN_MIN_WIDTH as Qt, supportsCssZoom as dn, DEFAULT_TABLE_ZOOM_MIN as ln, clamp as er, computeFillBaseWidth as un, computeEffectiveTableWidth as fn, computeFlexColumnWidth as pn, DEFAULT_COLUMN_MAX_WIDTH as lr, computeNeedsHorizontalScroll as hn } from "./tableZoomLayout.js";
10
+ import { findGridCell as tr, isWithinCellEditor as Be, getGridNeighbor as yn, getGridTabNeighbor as wn, focusGridCell as rr, GridNavProvider as mn } from "./useGridKeyboardNavigation.js";
11
+ import { scrollGridCellIntoView as gn } from "./scrollCellIntoView.js";
12
+ import { ROW_DRAG_THRESHOLD_PX as xn, computeDropTarget as Rn, clipDropLineToScrollport as vn, ROW_REORDER_ATTR as nr, measureRowPreview as bn, cloneRowForPreview as kn, FloatingRowPreview as En, DropIndicatorLine as In, getRowDragScrollDelta as Nn, ROW_DRAG_SOURCE_STYLE as Ln, ROW_SOURCE_INDEX_ATTR as Wn } from "./rowReorderDrag.js";
13
+ import { selectionFromSingleCell as gt, resolveCellCoordFromElement as $e, resolveRowAnchorCoordFromTarget as Dn, buildCellRangeRect as xt, nextKeyboardCellSelection as _n, CELL_RANGE_DRAG_THRESHOLD_PX as Pn, hitTestGridCell as Sn, canStartCellRangeFromTarget as ir, getDragScrollDeltas as Tn, getCellRangeVisualState as Cn, cellRangeEdgeBoxShadow as On } from "./cellRangeSelection.js";
14
+ import { BulkActionBar as Fn } from "./toolbar/BulkActionBar.js";
15
+ import { TableToolbar as Zn } from "./toolbar/TableToolbar.js";
16
+ import { Checkbox as sr } from "../../primitives/checkbox/checkbox.js";
17
+ import { ColumnHeaderMenu as Gn } from "./toolbar/ColumnHeaderMenu.js";
18
+ import { Button as Mn } from "../../primitives/button/button.js";
19
+ import { SummaryFooterRow as An } from "./toolbar/SummaryFooter.js";
20
+ import { RowActionsMenu as Un } from "./toolbar/RowActionsMenu.js";
21
+ import { Icon as Yn } from "../../primitives/icon/icon.js";
22
+ import { ShimmerLine as Bn } from "../../primitives/shimmer/shimmer.js";
23
+ const $n = dn(), Xn = 5, jn = "__all__", or = {
21
24
  ArrowUp: "up",
22
25
  ArrowDown: "down",
23
26
  ArrowLeft: "left",
24
27
  ArrowRight: "right"
25
- }, ue = (i) => i.__rowId ?? i.id ?? i.rule_id ?? String(i);
26
- function qt(i, d) {
27
- return i === "all" ? new Set(d) : i ?? /* @__PURE__ */ new Set();
28
+ }, ve = (s) => s.__rowId ?? s.id ?? s.rule_id ?? String(s);
29
+ function ar(s, u) {
30
+ return s === "all" ? new Set(u) : s ?? /* @__PURE__ */ new Set();
28
31
  }
29
- function Rn(i, d, u) {
30
- return i ? i === "all" ? u.includes(d) : i.has(d) : !1;
32
+ function qn(s, u, f) {
33
+ return s ? s === "all" ? f.includes(u) : s.has(u) : !1;
31
34
  }
32
- function vn(i, d) {
33
- return i ? i === "all" ? d.length : i.size : 0;
35
+ function Kn(s, u) {
36
+ return s ? s === "all" ? u.length : s.size : 0;
34
37
  }
35
- function kn(i, d) {
36
- return d.length === 0 ? !1 : i === "all" ? !0 : d.every((u) => (i == null ? void 0 : i.has(u)) ?? !1);
38
+ function Hn(s, u) {
39
+ return u.length === 0 ? !1 : s === "all" ? !0 : u.every((f) => (s == null ? void 0 : s.has(f)) ?? !1);
37
40
  }
38
- function En(i, d) {
39
- return i === "all" ? d.length > 0 : d.some((u) => (i == null ? void 0 : i.has(u)) ?? !1);
41
+ function zn(s, u) {
42
+ return s === "all" ? u.length > 0 : u.some((f) => (s == null ? void 0 : s.has(f)) ?? !1);
40
43
  }
41
- function In(i) {
42
- if (i)
43
- return (d) => {
44
- i(d === "all" ? "all" : new Set([...d].map(String)));
44
+ function Vn(s) {
45
+ if (s)
46
+ return (u) => {
47
+ s(u === "all" ? "all" : new Set([...u].map(String)));
45
48
  };
46
49
  }
47
- function Ln(i) {
48
- var d;
49
- return i != null && i.length ? i.length > 1 ? !0 : ((d = i[0]) == null ? void 0 : d.key) !== bn : !1;
50
+ function Jn(s) {
51
+ var u;
52
+ return s != null && s.length ? s.length > 1 ? !0 : ((u = s[0]) == null ? void 0 : u.key) !== jn : !1;
50
53
  }
51
- function At(i, d, u) {
52
- return u ? Ht(u, d ?? /* @__PURE__ */ new Map()) : (d == null ? void 0 : d.get(i)) ?? "left";
54
+ function cr(s, u, f) {
55
+ return f ? dr(f, u ?? /* @__PURE__ */ new Map()) : (u == null ? void 0 : u.get(s)) ?? "left";
53
56
  }
54
- const lt = "300px", ct = (i) => {
55
- if (!i) return 0;
56
- const d = i.match(/^(\d+(?:\.\d+)?)px$/);
57
- return d ? Number(d[1]) : 0;
58
- }, fe = (i) => !!i.width || !!(i.maxWidth && i.sticky === "right"), dt = (i) => i.width ?? (i.maxWidth && i.sticky === "right" ? i.maxWidth : void 0), Nn = (i) => ({
59
- width: i.width,
60
- maxWidth: i.maxWidth ?? lt,
61
- minWidth: i.minWidth ?? i.width
62
- }), Kt = (i) => {
63
- const d = dt(i);
64
- return d ? {
65
- minWidth: d,
66
- width: d,
67
- maxWidth: i.maxWidth ?? d
68
- } : {
69
- minWidth: i.minWidth,
70
- maxWidth: i.maxWidth ?? lt
71
- };
72
- }, Kn = Fr(
57
+ const be = (s) => !!s.width || !!(s.maxWidth && s.sticky === "right"), Rt = (s) => s.width ?? (s.maxWidth && s.sticky === "right" ? s.maxWidth : void 0), Qn = (s) => ({
58
+ width: s.width,
59
+ maxWidth: s.maxWidth ?? lr,
60
+ minWidth: s.minWidth ?? s.width
61
+ }), ki = Vr(
73
62
  function({
74
- data: d,
75
- columns: u,
76
- renderRowCell: ut,
77
- onRowClick: pe,
78
- onRowHover: K,
79
- arialabel: Jt,
80
- size: ft = "sm",
81
- allowDefaultRowClass: Vt = !1,
82
- centeredHeaders: Qt = [],
83
- rootClassName: Zt,
84
- removeBorders: pt,
85
- headerClassName: er,
86
- isRowExpandable: ht,
87
- renderExpandedContent: tr,
88
- loading: X = !1,
89
- loadingRowCount: yt = xn,
90
- renderHeaderCell: Fe,
91
- tableClassName: rr,
92
- getRowClassName: Ge,
93
- selectionMode: te = "none",
94
- selectedKeys: C,
95
- onSelectionChange: D,
96
- inlineSelection: he = !1,
97
- toolbar: R,
98
- showToolbar: nr,
99
- toolbarTitle: wt,
100
- toolbarTrailing: gt,
101
- disableExtendedTools: ze,
102
- pagination: P,
103
- showBorders: ye,
104
- emptyState: mt,
105
- editChrome: F,
106
- showEditActions: or = !1,
107
- searchCollapsible: xt,
108
- isEditable: ir,
109
- toolbarSlot: Ye,
110
- rowHeightClass: bt,
111
- groupedData: H,
112
- showSummaryFooter: sr,
113
- summaryFooterProps: Me,
114
- bulkActionBar: we,
115
- renderBulkActionBar: ge,
116
- onBulkDuplicate: me,
117
- onBulkDelete: xe,
118
- bulkActionBusy: be,
119
- columnAlignments: J,
120
- onColumnHeaderAction: Re,
121
- showColumnHeaderMenu: ar,
122
- columnMenuCapabilities: cr,
123
- renderGroupHeader: Rt,
124
- columnMenuSchema: re,
125
- columnSchema: ne,
126
- labelMeta: dr,
127
- renderColumnHeaderMenuExtraItems: lr,
128
- fillWidth: L = !1,
129
- rowActions: E,
130
- onCellActivate: V,
131
- cellSelection: y = null,
132
- onCellSelectionChange: N,
133
- onCopyCells: Ue,
134
- onPasteCells: Xe,
135
- onClearCells: $e
136
- }, oe) {
137
- const [ve, ur] = A(
63
+ data: u,
64
+ columns: f,
65
+ renderRowCell: vt,
66
+ onRowClick: ke,
67
+ onRowHover: V,
68
+ arialabel: ur,
69
+ size: bt = "sm",
70
+ allowDefaultRowClass: fr = !1,
71
+ centeredHeaders: pr = [],
72
+ rootClassName: hr,
73
+ removeBorders: kt,
74
+ headerClassName: yr,
75
+ isRowExpandable: Et,
76
+ renderExpandedContent: wr,
77
+ loading: j = !1,
78
+ loadingRowCount: It = Xn,
79
+ renderHeaderCell: Xe,
80
+ tableClassName: mr,
81
+ getRowClassName: je,
82
+ selectionMode: ae = "none",
83
+ selectedKeys: F,
84
+ onSelectionChange: S,
85
+ inlineSelection: Ee = !1,
86
+ toolbar: d,
87
+ showToolbar: gr,
88
+ toolbarTitle: Nt,
89
+ toolbarTrailing: Lt,
90
+ disableExtendedTools: ce,
91
+ pagination: T,
92
+ showBorders: Ie,
93
+ emptyState: Wt,
94
+ editChrome: G,
95
+ showEditActions: xr = !1,
96
+ searchCollapsible: Dt,
97
+ isEditable: Rr,
98
+ toolbarSlot: qe,
99
+ rowHeightClass: _t,
100
+ groupedData: J,
101
+ showSummaryFooter: vr,
102
+ summaryFooterProps: Ke,
103
+ bulkActionBar: Ne,
104
+ renderBulkActionBar: Le,
105
+ onBulkDuplicate: We,
106
+ onBulkDelete: De,
107
+ bulkActionBusy: _e,
108
+ columnAlignments: Q,
109
+ onColumnHeaderAction: Pe,
110
+ showColumnHeaderMenu: br,
111
+ columnMenuCapabilities: kr,
112
+ renderGroupHeader: Pt,
113
+ columnMenuSchema: de,
114
+ columnSchema: le,
115
+ labelMeta: Er,
116
+ renderColumnHeaderMenuExtraItems: Ir,
117
+ fillWidth: Nr = !1,
118
+ zoom: N,
119
+ rowActions: L,
120
+ onCellActivate: ee,
121
+ cellSelection: w = null,
122
+ onCellSelectionChange: _,
123
+ onCopyCells: He,
124
+ onPasteCells: ze,
125
+ onClearCells: Ve
126
+ }, ue) {
127
+ const R = b(
128
+ () => N ? an(N) : null,
129
+ [N == null ? void 0 : N.defaultZoom, N == null ? void 0 : N.minZoom, N == null ? void 0 : N.maxZoom, N == null ? void 0 : N.step]
130
+ ), [fe, Je] = H(
131
+ () => (R == null ? void 0 : R.defaultZoom) ?? cn
132
+ ), M = R !== null && $n, pe = fe / 100, P = Nr || M, g = oe(null), [he, St] = H(null), te = b(() => {
133
+ if (!P) return null;
134
+ const e = f.reduce(
135
+ (i, n) => be(n) ? i + mt(Rt(n)) : i,
136
+ 0
137
+ );
138
+ return { minTableWidth: f.filter(
139
+ (i) => !be(i)
140
+ ).reduce(
141
+ (i, n) => i + mt(
142
+ n.minWidth ?? (M ? Qt : void 0)
143
+ ),
144
+ 0
145
+ ) + e };
146
+ }, [f, P, M]), Se = (R == null ? void 0 : R.minZoom) ?? ln;
147
+ X(() => {
148
+ R && Je(
149
+ (e) => er(e, R.minZoom, R.maxZoom)
150
+ );
151
+ }, [R]);
152
+ const [Te, Lr] = H(
138
153
  () => /* @__PURE__ */ new Set()
139
- ), [fr, vt] = A(
154
+ ), [Wr, Tt] = H(
140
155
  null
141
- ), [f, pr] = A(null), G = le(null), je = le({ x: 0, y: 0 }), Q = v((e) => {
142
- G.current = e, pr(e);
143
- }, []), [q, kt] = A(null), [Z, hr] = A(null), h = typeof N == "function", $ = le(null), Be = le({ x: 0, y: 0 }), [ke, Et] = A(!1), Ee = te === "single" || te === "multiple", qe = !!E, z = Ee && !he, Ie = Ln(H), Ae = !!(E != null && E.onReorderRows) && (E == null ? void 0 : E.enableRowReorder) !== !1 && !Ie && !X, yr = k(() => re != null && re.length ? new Map(re.map((e) => [e.key, e])) : /* @__PURE__ */ new Map(), [re]), It = k(() => ne != null && ne.length ? new Map(ne.map((e) => [e.value, e])) : /* @__PURE__ */ new Map(), [ne]), Y = k(
144
- () => u.map((e) => e.key),
145
- [u]
146
- ), wr = v((e) => {
147
- ur((r) => {
156
+ ), [p, Dr] = H(null), A = oe(null), Qe = oe({ x: 0, y: 0 }), re = I((e) => {
157
+ A.current = e, Dr(e);
158
+ }, []), [z, Ct] = H(null), [ne, _r] = H(null), y = typeof _ == "function", q = oe(null), et = oe({ x: 0, y: 0 }), [ie, Ot] = H(!1), tt = oe(null), Ce = ae === "single" || ae === "multiple", rt = !!L, U = Ce && !Ee, Oe = Jn(J), nt = !!(L != null && L.onReorderRows) && (L == null ? void 0 : L.enableRowReorder) !== !1 && !Oe && !j, Pr = b(() => de != null && de.length ? new Map(de.map((e) => [e.key, e])) : /* @__PURE__ */ new Map(), [de]), Ft = b(() => le != null && le.length ? new Map(le.map((e) => [e.value, e])) : /* @__PURE__ */ new Map(), [le]), Y = b(
159
+ () => f.map((e) => e.key),
160
+ [f]
161
+ ), Sr = I((e) => {
162
+ Lr((r) => {
148
163
  const t = new Set(r);
149
164
  return t.has(e) ? t.delete(e) : t.add(e), t;
150
165
  });
151
- }, []), Le = k(() => X ? Array.from({ length: yt }, (e, r) => ({
166
+ }, []), Fe = b(() => j ? Array.from({ length: It }, (e, r) => ({
152
167
  id: `loading-${r}`
153
- })) : d.map((e) => {
168
+ })) : u.map((e) => {
154
169
  const r = e;
155
170
  if (r.__rowId != null)
156
171
  return r;
157
- const t = ue(r);
172
+ const t = ve(r);
158
173
  return r.id != null && String(r.id) === t ? r : { ...r, id: t };
159
- }), [X, d, yt]), b = k(() => X ? [] : Ie && H ? H.flatMap(
160
- (e) => ve.has(e.key) ? [] : e.rows.map((r) => ue(r))
161
- ) : Le.map((e) => ue(e)), [X, Ie, H, ve, Le]), ie = k(
162
- () => qt(C, b),
163
- [C, b]
164
- ), Ke = vn(C, b), He = Ke > 0, Lt = He && !!(we ?? ge ?? me ?? xe), se = k(() => {
165
- if (!He) return;
166
- const e = d.filter(
167
- (r) => ie.has(ue(r))
174
+ }), [j, u, It]), v = b(() => j ? [] : Oe && J ? J.flatMap(
175
+ (e) => Te.has(e.key) ? [] : e.rows.map((r) => ve(r))
176
+ ) : Fe.map((e) => ve(e)), [j, Oe, J, Te, Fe]), ye = b(
177
+ () => ar(F, v),
178
+ [F, v]
179
+ ), it = Kn(F, v), st = it > 0, Zt = st && !!(Ne ?? Le ?? We ?? De), we = b(() => {
180
+ if (!st) return;
181
+ const e = u.filter(
182
+ (r) => ye.has(ve(r))
168
183
  );
169
184
  return {
170
- selectedKeys: ie,
185
+ selectedKeys: ye,
171
186
  selectedRows: e,
172
- clearSelection: () => D == null ? void 0 : D(/* @__PURE__ */ new Set()),
173
- busy: be
187
+ clearSelection: () => S == null ? void 0 : S(/* @__PURE__ */ new Set()),
188
+ busy: _e
174
189
  };
175
190
  }, [
176
- He,
177
- ie,
178
- d,
179
- D,
180
- be
181
- ]), Nt = k(() => {
182
- if (Ye != null) return Ye;
183
- if (Lt) {
184
- if (we != null) return we;
185
- if (ge && se)
186
- return ge(se);
187
- if (se && (me || xe))
188
- return /* @__PURE__ */ c(
189
- un,
191
+ st,
192
+ ye,
193
+ u,
194
+ S,
195
+ _e
196
+ ]), Gt = b(() => {
197
+ if (qe != null) return qe;
198
+ if (Zt) {
199
+ if (Ne != null) return Ne;
200
+ if (Le && we)
201
+ return Le(we);
202
+ if (we && (We || De))
203
+ return /* @__PURE__ */ a(
204
+ Fn,
190
205
  {
191
- count: Ke,
192
- onDuplicate: me,
193
- onDelete: xe,
194
- onClearSelection: se.clearSelection,
195
- busy: be
206
+ count: it,
207
+ onDuplicate: We,
208
+ onDelete: De,
209
+ onClearSelection: we.clearSelection,
210
+ busy: _e
196
211
  }
197
212
  );
198
213
  }
199
- return R ? /* @__PURE__ */ c(
200
- fn,
214
+ const e = M && R ? /* @__PURE__ */ E("div", { className: "flex items-center gap-2", children: [
215
+ /* @__PURE__ */ a(
216
+ Jr,
217
+ {
218
+ "aria-label": "Table zoom",
219
+ className: "w-24 shrink-0",
220
+ minValue: Se,
221
+ maxValue: R.maxZoom,
222
+ step: R.step,
223
+ value: er(fe, Se, R.maxZoom),
224
+ onChange: (t) => Je(Array.isArray(t) ? t[0] : t),
225
+ isDisabled: ce || Se >= R.maxZoom,
226
+ children: /* @__PURE__ */ a(Qr, { className: "relative flex h-4 w-full items-center data-[disabled]:opacity-50", children: ({ state: t }) => /* @__PURE__ */ E(wt, { children: [
227
+ /* @__PURE__ */ a("div", { className: "absolute h-1 w-full rounded-full bg-tertiary" }),
228
+ /* @__PURE__ */ a(
229
+ "div",
230
+ {
231
+ className: "absolute h-1 rounded-full bg-brand-solid",
232
+ style: {
233
+ width: `${t.getThumbPercent(0) * 100}%`
234
+ }
235
+ }
236
+ ),
237
+ /* @__PURE__ */ a(en, { className: "top-1/2 size-3 rounded-full border-2 border-slider-handle-border bg-slider-handle-bg shadow-sm outline-none data-[focus-visible]:ring-2 data-[focus-visible]:ring-focus-ring" })
238
+ ] }) })
239
+ }
240
+ ),
241
+ /* @__PURE__ */ E(
242
+ "button",
243
+ {
244
+ type: "button",
245
+ "aria-label": `Reset table zoom to ${R.defaultZoom}%`,
246
+ title: "Reset zoom",
247
+ className: "w-9 shrink-0 text-right text-xs tabular-nums text-secondary enabled:hover:text-primary disabled:opacity-50",
248
+ disabled: fe === R.defaultZoom || ce,
249
+ onClick: () => Je(R.defaultZoom),
250
+ children: [
251
+ fe,
252
+ "%"
253
+ ]
254
+ }
255
+ )
256
+ ] }) : null, r = Lt;
257
+ return !d && !r && !e ? null : /* @__PURE__ */ a(
258
+ Zn,
201
259
  {
202
- sort: R.sort,
203
- filter: R.filter,
204
- search: R.search,
205
- rowHeight: R.rowHeight,
206
- hideFields: R.hideFields,
207
- align: R.align,
208
- groupBy: R.groupBy,
209
- summary: R.summary,
210
- sortContent: R.sortContent,
211
- filterContent: R.filterContent,
212
- fallbackTitle: wt,
213
- trailing: gt,
214
- searchCollapsible: xt,
215
- disableExtendedTools: ze,
216
- undoRedo: R.undoRedo ? {
217
- ...R.undoRedo,
218
- isDisabled: R.undoRedo.isDisabled ?? ze
260
+ sort: d == null ? void 0 : d.sort,
261
+ filter: d == null ? void 0 : d.filter,
262
+ search: d == null ? void 0 : d.search,
263
+ rowHeight: d == null ? void 0 : d.rowHeight,
264
+ hideFields: d == null ? void 0 : d.hideFields,
265
+ align: d == null ? void 0 : d.align,
266
+ groupBy: d == null ? void 0 : d.groupBy,
267
+ summary: d == null ? void 0 : d.summary,
268
+ sortContent: d == null ? void 0 : d.sortContent,
269
+ filterContent: d == null ? void 0 : d.filterContent,
270
+ fallbackTitle: Nt,
271
+ beforeSearch: e,
272
+ trailing: r,
273
+ searchCollapsible: Dt,
274
+ disableExtendedTools: ce,
275
+ undoRedo: d != null && d.undoRedo ? {
276
+ ...d.undoRedo,
277
+ isDisabled: d.undoRedo.isDisabled ?? ce
219
278
  } : void 0
220
279
  }
221
- ) : null;
280
+ );
222
281
  }, [
223
- Ye,
224
- Lt,
282
+ qe,
283
+ Zt,
284
+ Ne,
285
+ Le,
225
286
  we,
226
- ge,
227
- se,
228
- me,
229
- xe,
230
- be,
231
- Ke,
287
+ We,
288
+ De,
289
+ _e,
290
+ it,
291
+ d,
292
+ Nt,
293
+ Lt,
294
+ Dt,
295
+ ce,
232
296
  R,
233
- wt,
234
- gt,
235
- xt,
236
- ze
237
- ]), Dt = Nt != null && nr !== !1, Pt = !!P && (P == null ? void 0 : P.showPagination) !== !1, gr = Dt || Pt, Wt = !X && d.length === 0 && mt != null, S = !!(or && F), Je = !!(F != null && F.showFooterRow), W = ir ?? (S || Je || qe), mr = Wt && !(Je && F), ae = u.length + (z ? 1 : 0) + (S ? 1 : 0), xr = !!(sr && Me), I = ye ? "border-r border-secondary last:border-r-0" : void 0, j = k(() => {
238
- if (!L) return null;
239
- const e = u.reduce(
240
- (o, n) => fe(n) ? o + ct(dt(n)) : o,
241
- 0
242
- );
243
- return { minTableWidth: u.filter(
244
- (o) => !fe(o)
245
- ).reduce(
246
- (o, n) => o + ct(n.minWidth),
247
- 0
248
- ) + e };
249
- }, [u, L]), br = k(() => {
297
+ M,
298
+ fe,
299
+ Se
300
+ ]), Mt = Gt != null && gr !== !1, At = !!T && (T == null ? void 0 : T.showPagination) !== !1, Tr = Mt || At, Ut = !j && u.length === 0 && Wt != null, O = !!(xr && G), ot = !!(G != null && G.showFooterRow), W = Rr ?? (O || ot || rt), Cr = Ut && !(ot && G), me = f.length + (U ? 1 : 0) + (O ? 1 : 0), Or = !!(vr && Ke), D = Ie ? "border-r border-secondary last:border-r-0" : void 0, Fr = b(() => {
250
301
  const e = /* @__PURE__ */ new Map();
251
- return Re && u.forEach((r) => {
302
+ return Pe && f.forEach((r) => {
252
303
  e.set(
253
304
  r.key,
254
- (t) => Re(r.key, t)
305
+ (t) => Pe(r.key, t)
255
306
  );
256
307
  }), e;
257
- }, [u, Re]), x = le(null), [ce, _t] = A(null), Ve = v(
308
+ }, [f, Pe]), at = I(
258
309
  (e, r, t) => {
259
- var s;
260
- let o = t ?? null;
261
- if (o == null) {
262
- const l = (s = $r(
263
- x.current,
310
+ var c;
311
+ let i = t ?? null;
312
+ if (i == null) {
313
+ const l = (c = tr(
314
+ g.current,
264
315
  e,
265
316
  r
266
- )) == null ? void 0 : s.getAttribute("data-grid-source-index"), p = l != null && l !== "" ? Number(l) : NaN;
267
- o = Number.isNaN(p) ? null : p;
317
+ )) == null ? void 0 : c.getAttribute("data-grid-source-index"), h = l != null && l !== "" ? Number(l) : NaN;
318
+ i = Number.isNaN(h) ? null : h;
268
319
  }
269
320
  const n = {
270
321
  rowId: e,
271
322
  columnKey: r,
272
- sourceIndex: o
323
+ sourceIndex: i
273
324
  };
274
- if (h) {
275
- N == null || N(st(n));
325
+ if (y) {
326
+ _ == null || _(gt(n));
276
327
  return;
277
328
  }
278
- kt(n);
329
+ Ct(n);
279
330
  },
280
- [h, N]
281
- ), Ne = v(() => {
282
- if (h) {
283
- N == null || N(null);
331
+ [y, _]
332
+ ), Ze = I(() => {
333
+ if (y) {
334
+ _ == null || _(null);
284
335
  return;
285
336
  }
286
- kt(null);
287
- }, [h, N]), ee = h ? (y == null ? void 0 : y.focus) ?? null : q, M = v(
337
+ Ct(null);
338
+ }, [y, _]), C = y ? (w == null ? void 0 : w.focus) ?? null : z, B = I(
288
339
  (e) => {
289
- h && (N == null || N(e));
340
+ y && (_ == null || _(e));
290
341
  },
291
- [h, N]
292
- ), Rr = v(
342
+ [y, _]
343
+ ), Zr = I(
293
344
  (e) => {
294
- var de, T, Ce;
295
- const r = e.key in Bt;
296
- if (e.key !== "Enter" && e.key !== "Tab" && e.key !== "Escape" && e.key !== "Delete" && e.key !== "Backspace" && !r || Te(e.target)) return;
345
+ var Ye, se, Re;
346
+ const r = e.key in or;
347
+ if (e.key !== "Enter" && e.key !== "Tab" && e.key !== "Escape" && e.key !== "Delete" && e.key !== "Backspace" && !r || Be(e.target)) return;
297
348
  if (e.key === "Escape") {
298
- if (!ee && !y) return;
299
- e.preventDefault(), e.stopPropagation(), Ne(), (de = x.current) != null && de.contains(document.activeElement) && document.activeElement.blur();
349
+ if (!C && !w) return;
350
+ e.preventDefault(), e.stopPropagation(), Ze(), (Ye = g.current) != null && Ye.contains(document.activeElement) && document.activeElement.blur();
300
351
  return;
301
352
  }
302
- const t = (Ce = (T = e.target).closest) == null ? void 0 : Ce.call(
303
- T,
353
+ const t = (Re = (se = e.target).closest) == null ? void 0 : Re.call(
354
+ se,
304
355
  "[data-grid-cell]"
305
- ), o = t ? Oe(t) : null, n = h && r && e.shiftKey && !ee && !o ? nn(e.target, x.current) : null, s = n != null && ie.has(n.rowId), l = ee ?? o ?? (s ? n : null);
356
+ ), i = t ? $e(t) : null, n = y && r && e.shiftKey && !C && !i ? Dn(e.target, g.current) : null, c = n != null && ye.has(n.rowId), l = C ?? i ?? (c ? n : null);
306
357
  if (!l) return;
307
358
  if (e.key === "Delete" || e.key === "Backspace") {
308
- if (!h || !y || !$e) return;
309
- const O = at(
310
- y,
311
- b,
359
+ if (!y || !w || !Ve) return;
360
+ const K = xt(
361
+ w,
362
+ v,
312
363
  Y
313
364
  );
314
- if (!O) return;
315
- e.preventDefault(), e.stopPropagation(), $e({ selection: y, rect: O, event: e.nativeEvent });
365
+ if (!K) return;
366
+ e.preventDefault(), e.stopPropagation(), Ve({
367
+ selection: w,
368
+ rect: K,
369
+ event: e.nativeEvent
370
+ });
316
371
  return;
317
372
  }
318
373
  if (e.key === "Enter") {
319
- if (!V) return;
320
- e.preventDefault(), e.stopPropagation(), V({
374
+ if (!ee) return;
375
+ e.preventDefault(), e.stopPropagation(), ee({
321
376
  rowId: l.rowId,
322
377
  columnKey: l.columnKey,
323
378
  sourceIndex: l.sourceIndex
324
379
  });
325
380
  return;
326
381
  }
327
- const p = h && e.shiftKey && r, w = r ? jr(
328
- x.current,
329
- b,
382
+ const h = y && e.shiftKey && r, k = r ? or[e.key] : e.shiftKey ? "left" : "right", o = r ? yn(
383
+ g.current,
384
+ v,
330
385
  Y,
331
386
  l.rowId,
332
387
  l.columnKey,
333
- Bt[e.key]
334
- ) : Br(
335
- x.current,
336
- b,
388
+ k
389
+ ) : wn(
390
+ g.current,
391
+ v,
337
392
  Y,
338
393
  l.rowId,
339
394
  l.columnKey,
340
395
  !e.shiftKey
341
396
  );
342
- if (!w && !(p && !y)) {
397
+ if (!o && !(h && !w)) {
343
398
  r && (e.preventDefault(), e.stopPropagation());
344
399
  return;
345
400
  }
346
401
  e.preventDefault(), e.stopPropagation();
347
- const it = w ? {
348
- rowId: w.rowId,
349
- columnKey: w.columnKey,
350
- sourceIndex: w.sourceIndex
351
- } : null, _e = s ? null : it;
352
- if (h) {
353
- const O = on(
402
+ const yt = o ? {
403
+ rowId: o.rowId,
404
+ columnKey: o.columnKey,
405
+ sourceIndex: o.sourceIndex
406
+ } : null, ge = c ? null : yt, xe = ge ? k : null;
407
+ if (tt.current = xe, y) {
408
+ const K = _n(
354
409
  l,
355
- _e,
356
- y,
357
- p
410
+ ge,
411
+ w,
412
+ h
358
413
  );
359
- O && O !== y && M(O);
360
- } else w && Ve(w.rowId, w.columnKey, w.sourceIndex);
361
- const Se = _e ?? l;
414
+ K && K !== w && B(K);
415
+ } else o && at(o.rowId, o.columnKey, o.sourceIndex);
416
+ const Z = ge ?? l;
362
417
  requestAnimationFrame(
363
- () => Ut(
364
- x.current,
365
- Se.rowId,
366
- Se.columnKey
418
+ () => rr(
419
+ g.current,
420
+ Z.rowId,
421
+ Z.columnKey,
422
+ { dir: xe }
367
423
  )
368
424
  );
369
425
  },
370
426
  [
371
- ee,
372
- b,
373
- h,
427
+ C,
428
+ v,
374
429
  y,
375
- Ne,
430
+ w,
431
+ Ze,
376
432
  Y,
377
- M,
378
- ie,
379
- V,
380
- $e,
381
- Ve
433
+ B,
434
+ ye,
435
+ ee,
436
+ Ve,
437
+ at
382
438
  ]
383
439
  );
384
- B(() => {
385
- if (!W || !ee && !y) return;
440
+ X(() => {
441
+ if (!W || !C && !w) return;
386
442
  const e = (r) => {
387
- const t = x.current;
388
- t && !t.contains(r.target) && Ne();
443
+ const t = g.current;
444
+ t && !t.contains(r.target) && Ze();
389
445
  };
390
446
  return document.addEventListener("pointerdown", e, !0), () => document.removeEventListener("pointerdown", e, !0);
391
- }, [W, ee, y, Ne]);
392
- const St = k(() => {
447
+ }, [W, C, w, Ze]);
448
+ const ct = (C == null ? void 0 : C.rowId) ?? null, dt = (C == null ? void 0 : C.columnKey) ?? null;
449
+ Jt(() => {
450
+ if (!W || ie || !ct || !dt) return;
451
+ const e = tr(
452
+ g.current,
453
+ ct,
454
+ dt
455
+ );
456
+ e && gn(e, { dir: tt.current });
457
+ }, [W, ie, ct, dt]);
458
+ const Yt = b(() => {
393
459
  let e = 0;
394
- return z && (e += 40), S && (e += 56), u.forEach((r) => {
395
- fe(r) && (e += ct(dt(r)));
460
+ return U && (e += 40), O && (e += 56), f.forEach((r) => {
461
+ be(r) && (e += mt(Rt(r)));
396
462
  }), e;
397
- }, [u, S, z]), Qe = k(
398
- () => u.filter((e) => !fe(e)).length,
399
- [u]
400
- ), Ze = k(() => {
401
- if (!L || !j) return null;
402
- const { minTableWidth: e } = j;
403
- return ce ? Math.max(ce, e) : e;
404
- }, [ce, L, j]), et = !!(L && j && ce && ce < j.minTableWidth), tt = k(() => !Ze || Qe === 0 ? null : Math.max(
405
- 0,
406
- (Ze - St) / Qe
407
- ), [Ze, St, Qe]);
408
- Gr(() => {
409
- if (!L) {
410
- _t(null);
463
+ }, [f, O, U]), Bt = b(
464
+ () => f.filter((e) => !be(e)).length,
465
+ [f]
466
+ ), lt = b(
467
+ () => P && te ? un(he, te.minTableWidth) : null,
468
+ [he, P, te]
469
+ ), $t = P && hn(lt, he, pe), Ge = b(
470
+ () => fn(lt, he, pe),
471
+ [lt, he, pe]
472
+ ), ut = b(
473
+ () => pn(
474
+ Ge,
475
+ Yt,
476
+ Bt
477
+ ),
478
+ [Ge, Yt, Bt]
479
+ );
480
+ Jt(() => {
481
+ if (!P) {
482
+ St(null);
411
483
  return;
412
484
  }
413
- const e = x.current;
485
+ const e = g.current;
414
486
  if (!e) return;
415
487
  const r = () => {
416
- const o = e.clientWidth;
417
- o > 0 && _t((n) => n === o ? n : o);
488
+ const i = e.clientWidth;
489
+ i > 0 && St((n) => n === i ? n : i);
418
490
  };
419
491
  r();
420
492
  const t = new ResizeObserver(r);
@@ -422,93 +494,105 @@ const lt = "300px", ct = (i) => {
422
494
  t.disconnect();
423
495
  };
424
496
  }, [
497
+ f.length,
425
498
  u.length,
426
- d.length,
427
- L,
428
- X,
429
- S,
430
- z
499
+ P,
500
+ j,
501
+ O,
502
+ U
431
503
  ]);
432
- const rt = v(
433
- (e) => L ? fe(e) ? Kt(e) : tt != null ? {
434
- width: `${tt}px`,
435
- minWidth: e.minWidth,
436
- maxWidth: e.maxWidth ?? lt
437
- } : Kt(e) : Nn(e),
438
- [L, tt]
439
- ), vr = k(() => {
440
- if (!(!L || !j))
441
- return et ? {
442
- width: `${j.minTableWidth}px`,
443
- tableLayout: "fixed"
444
- } : {
445
- width: "100%",
446
- tableLayout: "fixed"
447
- };
448
- }, [L, j, et]), kr = v(
504
+ const ft = I(
449
505
  (e) => {
450
- x.current = e, typeof oe == "function" ? oe(e) : oe && (oe.current = e);
506
+ if (!P)
507
+ return Qn(e);
508
+ const r = e.minWidth ?? (M ? Qt : void 0), t = Rt(e), i = t, n = e.maxWidth ?? t ?? lr;
509
+ return be(e) && i ? {
510
+ minWidth: i,
511
+ width: i,
512
+ maxWidth: n ?? i
513
+ } : ut != null ? {
514
+ width: `${ut}px`,
515
+ minWidth: r
516
+ } : { minWidth: r, maxWidth: n };
451
517
  },
452
- [oe]
453
- ), Er = Ee && he ? {
454
- selectionMode: te,
455
- selectedKeys: C === "all" ? "all" : C,
456
- onSelectionChange: In(D)
457
- } : {}, Ir = (e, r = 0) => {
518
+ [P, ut, M]
519
+ ), Gr = b(() => !P || !te ? void 0 : {
520
+ ...M ? { zoom: pe } : void 0,
521
+ // The zoom-independent base, so the painted width tracks the zoom and overflows by
522
+ // more as you zoom in — matching the widths `getColumnStyle` hands the columns.
523
+ width: `${Ge ?? te.minTableWidth}px`,
524
+ tableLayout: "fixed"
525
+ }, [
526
+ P,
527
+ te,
528
+ $t,
529
+ Ge,
530
+ M,
531
+ pe
532
+ ]), Mr = I(
533
+ (e) => {
534
+ g.current = e, typeof ue == "function" ? ue(e) : ue && (ue.current = e);
535
+ },
536
+ [ue]
537
+ ), Ar = Ce && Ee ? {
538
+ selectionMode: ae,
539
+ selectedKeys: F === "all" ? "all" : F,
540
+ onSelectionChange: Vn(S)
541
+ } : {}, Ur = (e, r = 0) => {
458
542
  const t = e.__sourceIndex;
459
543
  return typeof t == "number" ? t : r;
460
- }, De = v(
544
+ }, Me = I(
461
545
  (e) => {
462
- const r = G.current;
546
+ const r = A.current;
463
547
  if (!r) return;
464
- const { fromSourceIndex: t, toSourceIndex: o, item: n, active: s } = r;
465
- Q(null), e && s && t !== o && (E != null && E.onReorderRows) && E.onReorderRows(t, o, n);
548
+ const { fromSourceIndex: t, toSourceIndex: i, item: n, active: c } = r;
549
+ re(null), e && c && t !== i && (L != null && L.onReorderRows) && L.onReorderRows(t, i, n);
466
550
  },
467
- [E, Q]
468
- ), Pe = v(
551
+ [L, re]
552
+ ), Ae = I(
469
553
  (e, r) => {
470
- const t = G.current;
554
+ const t = A.current;
471
555
  if (!t) return;
472
- je.current = { x: e, y: r };
473
- const o = e - t.startX, n = r - t.startY, s = Math.hypot(o, n), l = t.active || s >= Ar;
474
- let p = {
556
+ Qe.current = { x: e, y: r };
557
+ const i = e - t.startX, n = r - t.startY, c = Math.hypot(i, n), l = t.active || c >= xn;
558
+ let h = {
475
559
  ...t,
476
560
  currentX: e,
477
561
  currentY: r,
478
562
  active: l
479
563
  };
480
564
  if (l) {
481
- t.active || vt(null);
482
- const w = x.current;
483
- if (w) {
484
- const a = Kr(
485
- w,
565
+ t.active || Tt(null);
566
+ const k = g.current;
567
+ if (k) {
568
+ const o = Rn(
569
+ k,
486
570
  r,
487
571
  t.fromSourceIndex,
488
572
  t.rowId
489
573
  );
490
- a && (p = {
491
- ...p,
492
- toSourceIndex: a.toSourceIndex,
574
+ o && (h = {
575
+ ...h,
576
+ toSourceIndex: o.toSourceIndex,
493
577
  // Clip to scrollport so the line never draws over the header / outside the card.
494
- dropLineY: Hr(
495
- a.dropLineY,
496
- w
578
+ dropLineY: vn(
579
+ o.dropLineY,
580
+ k
497
581
  ),
498
- dropLineLeft: a.dropLineLeft,
499
- dropLineWidth: a.dropLineWidth
582
+ dropLineLeft: o.dropLineLeft,
583
+ dropLineWidth: o.dropLineWidth
500
584
  });
501
585
  }
502
586
  }
503
- Q(p);
587
+ re(h);
504
588
  },
505
- [Q]
506
- ), Lr = v(
507
- (e, r, t, o) => {
508
- var w, a;
509
- if (!Ae || e.button !== 0) return;
510
- const n = (w = x.current) == null ? void 0 : w.querySelector(
511
- `tr[${Xt}="${CSS.escape(r)}"]`
589
+ [re]
590
+ ), Yr = I(
591
+ (e, r, t, i) => {
592
+ var k, o;
593
+ if (!nt || e.button !== 0) return;
594
+ const n = (k = g.current) == null ? void 0 : k.querySelector(
595
+ `tr[${nr}="${CSS.escape(r)}"]`
512
596
  );
513
597
  if (!n) return;
514
598
  e.preventDefault();
@@ -516,112 +600,112 @@ const lt = "300px", ct = (i) => {
516
600
  e.currentTarget.setPointerCapture(e.pointerId);
517
601
  } catch {
518
602
  }
519
- const s = Jr(n), l = Vr(n), p = ((a = n.closest("table")) == null ? void 0 : a.getBoundingClientRect()) ?? n.getBoundingClientRect();
520
- je.current = { x: e.clientX, y: e.clientY }, Q({
603
+ const c = bn(n), l = kn(n), h = ((o = n.closest("table")) == null ? void 0 : o.getBoundingClientRect()) ?? n.getBoundingClientRect();
604
+ Qe.current = { x: e.clientX, y: e.clientY }, re({
521
605
  rowId: r,
522
606
  fromSourceIndex: t,
523
- item: o,
607
+ item: i,
524
608
  pointerId: e.pointerId,
525
609
  startX: e.clientX,
526
610
  startY: e.clientY,
527
611
  currentX: e.clientX,
528
612
  currentY: e.clientY,
529
613
  active: !1,
530
- preview: s,
614
+ preview: c,
531
615
  toSourceIndex: t,
532
616
  dropLineY: null,
533
- dropLineLeft: p.left,
534
- dropLineWidth: p.width,
617
+ dropLineLeft: h.left,
618
+ dropLineWidth: h.width,
535
619
  rowClone: l
536
620
  });
537
621
  },
538
- [Ae, Q]
539
- ), Ct = f != null;
540
- B(() => {
541
- if (!Ct) return;
622
+ [nt, re]
623
+ ), Xt = p != null;
624
+ X(() => {
625
+ if (!Xt) return;
542
626
  const e = (n) => {
543
- var s;
544
- n.pointerId === ((s = G.current) == null ? void 0 : s.pointerId) && Pe(n.clientX, n.clientY);
627
+ var c;
628
+ n.pointerId === ((c = A.current) == null ? void 0 : c.pointerId) && Ae(n.clientX, n.clientY);
545
629
  }, r = (n) => {
546
- var s;
547
- n.pointerId === ((s = G.current) == null ? void 0 : s.pointerId) && De(!0);
630
+ var c;
631
+ n.pointerId === ((c = A.current) == null ? void 0 : c.pointerId) && Me(!0);
548
632
  }, t = (n) => {
549
- var s;
550
- n.pointerId === ((s = G.current) == null ? void 0 : s.pointerId) && De(!1);
551
- }, o = (n) => {
552
- n.key === "Escape" && (n.preventDefault(), De(!1));
633
+ var c;
634
+ n.pointerId === ((c = A.current) == null ? void 0 : c.pointerId) && Me(!1);
635
+ }, i = (n) => {
636
+ n.key === "Escape" && (n.preventDefault(), Me(!1));
553
637
  };
554
- return window.addEventListener("pointermove", e), window.addEventListener("pointerup", r), window.addEventListener("pointercancel", t), window.addEventListener("keydown", o), () => {
555
- window.removeEventListener("pointermove", e), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", t), window.removeEventListener("keydown", o);
638
+ return window.addEventListener("pointermove", e), window.addEventListener("pointerup", r), window.addEventListener("pointercancel", t), window.addEventListener("keydown", i), () => {
639
+ window.removeEventListener("pointermove", e), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", t), window.removeEventListener("keydown", i);
556
640
  };
557
- }, [Ct, De, Pe]), B(() => {
558
- if (!(f != null && f.active)) return;
641
+ }, [Xt, Me, Ae]), X(() => {
642
+ if (!(p != null && p.active)) return;
559
643
  const e = document.body.style.userSelect, r = document.body.style.cursor;
560
644
  return document.body.style.userSelect = "none", document.body.style.cursor = "grabbing", () => {
561
645
  document.body.style.userSelect = e, document.body.style.cursor = r;
562
646
  };
563
- }, [f == null ? void 0 : f.active]), B(() => {
564
- if (!(f != null && f.active)) return;
647
+ }, [p == null ? void 0 : p.active]), X(() => {
648
+ if (!(p != null && p.active)) return;
565
649
  let e = 0;
566
650
  const r = () => {
567
- const t = G.current, o = x.current;
568
- if (!(t != null && t.active) || !o) return;
569
- const { x: n, y: s } = je.current, l = en(o, s);
570
- l !== 0 && (o.scrollTop += l, Pe(n, s)), e = requestAnimationFrame(r);
651
+ const t = A.current, i = g.current;
652
+ if (!(t != null && t.active) || !i) return;
653
+ const { x: n, y: c } = Qe.current, l = Nn(i, c);
654
+ l !== 0 && (i.scrollTop += l, Ae(n, c)), e = requestAnimationFrame(r);
571
655
  };
572
656
  return e = requestAnimationFrame(r), () => cancelAnimationFrame(e);
573
- }, [f == null ? void 0 : f.active, Pe]);
574
- const We = v(
657
+ }, [p == null ? void 0 : p.active, Ae]);
658
+ const Ue = I(
575
659
  (e, r) => {
576
- const t = $.current, o = x.current;
577
- if (!t || !o) return;
578
- Be.current = { x: e, y: r };
579
- const n = e - t.startX, s = r - t.startY, l = Math.hypot(n, s), p = t.active || l >= sn;
580
- if (p && !t.active && (t.active = !0, Et(!0)), !p) return;
581
- const w = an(o, e, r), a = w ? Oe(w) : null;
582
- a && (t.focus = a, M({
660
+ const t = q.current, i = g.current;
661
+ if (!t || !i) return;
662
+ et.current = { x: e, y: r };
663
+ const n = e - t.startX, c = r - t.startY, l = Math.hypot(n, c), h = t.active || l >= Pn;
664
+ if (h && !t.active && (t.active = !0, Ot(!0)), !h) return;
665
+ const k = Sn(i, e, r), o = k ? $e(k) : null;
666
+ o && (t.focus = o, B({
583
667
  anchor: t.anchor,
584
- focus: a
668
+ focus: o
585
669
  }));
586
670
  },
587
- [M]
588
- ), nt = v((e) => {
589
- const r = $.current;
590
- $.current = null, Et(!1), r && requestAnimationFrame(
591
- () => Ut(
592
- x.current,
671
+ [B]
672
+ ), pt = I((e) => {
673
+ const r = q.current;
674
+ q.current = null, Ot(!1), r && requestAnimationFrame(
675
+ () => rr(
676
+ g.current,
593
677
  r.focus.rowId,
594
678
  r.focus.columnKey
595
679
  )
596
680
  );
597
- }, []), Nr = v(
681
+ }, []), Br = I(
598
682
  (e) => {
599
- if (!h || !W || !V || Te(e.target)) return;
600
- const r = $t(
683
+ if (!y || !W || !ee || Be(e.target)) return;
684
+ const r = ir(
601
685
  e.target,
602
- x.current
686
+ g.current
603
687
  );
604
688
  if (!r) return;
605
- const t = Oe(r);
606
- t && (e.preventDefault(), e.stopPropagation(), M(st(t)), V({
689
+ const t = $e(r);
690
+ t && (e.preventDefault(), e.stopPropagation(), B(gt(t)), ee({
607
691
  rowId: t.rowId,
608
692
  columnKey: t.columnKey,
609
693
  sourceIndex: t.sourceIndex
610
694
  }));
611
695
  },
612
- [h, M, W, V]
613
- ), Dr = v(
696
+ [y, B, W, ee]
697
+ ), $r = I(
614
698
  (e) => {
615
- if (!h || !W || e.button !== 0 || G.current) return;
616
- const r = $t(
699
+ if (!y || !W || e.button !== 0 || A.current) return;
700
+ const r = ir(
617
701
  e.target,
618
- x.current
702
+ g.current
619
703
  );
620
704
  if (!r) return;
621
- const t = Oe(r);
705
+ const t = $e(r);
622
706
  if (!t) return;
623
- const o = e.shiftKey && y != null, n = o ? y.anchor : t;
624
- Be.current = { x: e.clientX, y: e.clientY }, $.current = {
707
+ const i = e.shiftKey && w != null, n = i ? w.anchor : t;
708
+ tt.current = null, et.current = { x: e.clientX, y: e.clientY }, q.current = {
625
709
  pointerId: e.pointerId,
626
710
  startX: e.clientX,
627
711
  startY: e.clientY,
@@ -629,142 +713,142 @@ const lt = "300px", ct = (i) => {
629
713
  anchor: n,
630
714
  origin: t,
631
715
  focus: t,
632
- extend: o
633
- }, M(o ? { anchor: n, focus: t } : st(t));
716
+ extend: i
717
+ }, B(i ? { anchor: n, focus: t } : gt(t));
634
718
  },
635
- [h, y, M, W]
719
+ [y, w, B, W]
636
720
  );
637
- B(() => {
638
- if (!h) return;
639
- const e = (o) => {
640
- const n = $.current;
641
- !n || o.pointerId !== n.pointerId || (o.preventDefault(), We(o.clientX, o.clientY));
642
- }, r = (o) => {
643
- const n = $.current;
644
- !n || o.pointerId !== n.pointerId || nt(!0);
645
- }, t = (o) => {
646
- const n = $.current;
647
- !n || o.pointerId !== n.pointerId || nt(!1);
721
+ X(() => {
722
+ if (!y) return;
723
+ const e = (i) => {
724
+ const n = q.current;
725
+ !n || i.pointerId !== n.pointerId || (i.preventDefault(), Ue(i.clientX, i.clientY));
726
+ }, r = (i) => {
727
+ const n = q.current;
728
+ !n || i.pointerId !== n.pointerId || pt(!0);
729
+ }, t = (i) => {
730
+ const n = q.current;
731
+ !n || i.pointerId !== n.pointerId || pt(!1);
648
732
  };
649
733
  return window.addEventListener("pointermove", e), window.addEventListener("pointerup", r), window.addEventListener("pointercancel", t), () => {
650
734
  window.removeEventListener("pointermove", e), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", t);
651
735
  };
652
- }, [h, nt, We]), B(() => {
653
- if (!ke) return;
736
+ }, [y, pt, Ue]), X(() => {
737
+ if (!ie) return;
654
738
  const e = document.body.style.userSelect;
655
739
  return document.body.style.userSelect = "none", () => {
656
740
  document.body.style.userSelect = e;
657
741
  };
658
- }, [ke]), B(() => {
659
- if (!ke) return;
742
+ }, [ie]), X(() => {
743
+ if (!ie) return;
660
744
  let e = 0;
661
745
  const r = () => {
662
- const t = $.current, o = x.current;
663
- if (!(t != null && t.active) || !o) return;
664
- const { x: n, y: s } = Be.current, { dx: l, dy: p } = cn(o, n, s);
665
- (l !== 0 || p !== 0) && (l !== 0 && (o.scrollLeft += l), p !== 0 && (o.scrollTop += p), We(n, s)), e = requestAnimationFrame(r);
746
+ const t = q.current, i = g.current;
747
+ if (!(t != null && t.active) || !i) return;
748
+ const { x: n, y: c } = et.current, { dx: l, dy: h } = Tn(i, n, c);
749
+ (l !== 0 || h !== 0) && (l !== 0 && (i.scrollLeft += l), h !== 0 && (i.scrollTop += h), Ue(n, c)), e = requestAnimationFrame(r);
666
750
  };
667
751
  return e = requestAnimationFrame(r), () => cancelAnimationFrame(e);
668
- }, [ke, We]), B(() => {
669
- if (!h || !y) return;
752
+ }, [ie, Ue]), X(() => {
753
+ if (!y || !w) return;
670
754
  const e = (t) => {
671
- if (Te(t.target)) return;
672
- const o = x.current;
673
- if (!o) return;
755
+ if (Be(t.target)) return;
756
+ const i = g.current;
757
+ if (!i) return;
674
758
  const n = document.activeElement;
675
- if (n && !o.contains(n) && t.target instanceof Node && !o.contains(t.target))
759
+ if (n && !i.contains(n) && t.target instanceof Node && !i.contains(t.target))
676
760
  return;
677
- const s = at(
678
- y,
679
- b,
761
+ const c = xt(
762
+ w,
763
+ v,
680
764
  Y
681
765
  );
682
- !s || !Ue || (t.preventDefault(), Ue({ selection: y, rect: s, event: t }));
766
+ !c || !He || (t.preventDefault(), He({ selection: w, rect: c, event: t }));
683
767
  }, r = (t) => {
684
- var p;
685
- if (Te(t.target)) return;
686
- const o = x.current;
687
- if (!o) return;
768
+ var h;
769
+ if (Be(t.target)) return;
770
+ const i = g.current;
771
+ if (!i) return;
688
772
  const n = document.activeElement;
689
- if (n && !o.contains(n) && t.target instanceof Node && !o.contains(t.target))
773
+ if (n && !i.contains(n) && t.target instanceof Node && !i.contains(t.target))
690
774
  return;
691
- const s = at(
692
- y,
693
- b,
775
+ const c = xt(
776
+ w,
777
+ v,
694
778
  Y
695
779
  );
696
- if (!s || !Xe) return;
697
- const l = ((p = t.clipboardData) == null ? void 0 : p.getData("text/plain")) ?? "";
698
- t.preventDefault(), Xe({ selection: y, rect: s, text: l, event: t });
780
+ if (!c || !ze) return;
781
+ const l = ((h = t.clipboardData) == null ? void 0 : h.getData("text/plain")) ?? "";
782
+ t.preventDefault(), ze({ selection: w, rect: c, text: l, event: t });
699
783
  };
700
784
  return document.addEventListener("copy", e), document.addEventListener("paste", r), () => {
701
785
  document.removeEventListener("copy", e), document.removeEventListener("paste", r);
702
786
  };
703
787
  }, [
704
- b,
705
- h,
788
+ v,
706
789
  y,
790
+ w,
707
791
  Y,
708
- Ue,
709
- Xe
792
+ He,
793
+ ze
710
794
  ]);
711
- const ot = Ee && kn(C, b), Pr = Ee && En(C, b), Wr = () => {
712
- if (D) {
713
- if (ot) {
714
- D(/* @__PURE__ */ new Set());
795
+ const ht = Ce && Hn(F, v), Xr = Ce && zn(F, v), jr = () => {
796
+ if (S) {
797
+ if (ht) {
798
+ S(/* @__PURE__ */ new Set());
715
799
  return;
716
800
  }
717
- D("all");
801
+ S("all");
718
802
  }
719
- }, _r = (e, r) => {
720
- if (!D) return;
721
- if (te === "single") {
722
- D(r ? /* @__PURE__ */ new Set([e]) : /* @__PURE__ */ new Set());
803
+ }, qr = (e, r) => {
804
+ if (!S) return;
805
+ if (ae === "single") {
806
+ S(r ? /* @__PURE__ */ new Set([e]) : /* @__PURE__ */ new Set());
723
807
  return;
724
808
  }
725
- const t = C === "all" ? new Set(b) : new Set(qt(C, b));
726
- r ? t.add(e) : t.delete(e), D(t);
727
- }, Sr = (e) => {
728
- const r = ve.has(e.key);
729
- return Rt ? /* @__PURE__ */ c(
730
- g.Row,
809
+ const t = F === "all" ? new Set(v) : new Set(ar(F, v));
810
+ r ? t.add(e) : t.delete(e), S(t);
811
+ }, Kr = (e) => {
812
+ const r = Te.has(e.key);
813
+ return Pt ? /* @__PURE__ */ a(
814
+ m.Row,
731
815
  {
732
816
  id: `group-${e.key}`,
733
817
  highlightSelectedRow: !1,
734
818
  className: "bg-secondary_subtle hover:bg-secondary_subtle",
735
- children: /* @__PURE__ */ c(g.Cell, { colSpan: ae, className: m(I), children: Rt(e) })
819
+ children: /* @__PURE__ */ a(m.Cell, { colSpan: me, className: x(D), children: Pt(e) })
736
820
  },
737
821
  `group-${e.key}`
738
- ) : /* @__PURE__ */ c(
739
- g.Row,
822
+ ) : /* @__PURE__ */ a(
823
+ m.Row,
740
824
  {
741
825
  id: `group-${e.key}`,
742
826
  highlightSelectedRow: !1,
743
827
  className: "bg-secondary_subtle hover:bg-secondary_subtle",
744
- children: /* @__PURE__ */ c(
745
- g.Cell,
828
+ children: /* @__PURE__ */ a(
829
+ m.Cell,
746
830
  {
747
- colSpan: ae,
748
- className: m("py-1.5", I),
749
- children: /* @__PURE__ */ _(
831
+ colSpan: me,
832
+ className: x("py-1.5", D),
833
+ children: /* @__PURE__ */ E(
750
834
  "button",
751
835
  {
752
836
  type: "button",
753
837
  className: "flex w-full items-center gap-2 px-2 text-left text-xs font-medium text-secondary",
754
- onClick: () => wr(e.key),
838
+ onClick: () => Sr(e.key),
755
839
  "aria-expanded": !r,
756
840
  children: [
757
- /* @__PURE__ */ c(
758
- zr,
841
+ /* @__PURE__ */ a(
842
+ tn,
759
843
  {
760
- className: m(
844
+ className: x(
761
845
  "size-4 shrink-0 text-fg-quaternary transition-transform",
762
846
  !r && "rotate-90"
763
847
  )
764
848
  }
765
849
  ),
766
- /* @__PURE__ */ c("span", { className: "truncate", children: e.label || "(Empty)" }),
767
- /* @__PURE__ */ _("span", { className: "text-tertiary", children: [
850
+ /* @__PURE__ */ a("span", { className: "truncate", children: e.label || "(Empty)" }),
851
+ /* @__PURE__ */ E("span", { className: "text-tertiary", children: [
768
852
  "(",
769
853
  e.rows.length,
770
854
  ")"
@@ -777,55 +861,55 @@ const lt = "300px", ct = (i) => {
777
861
  },
778
862
  `group-${e.key}`
779
863
  );
780
- }, Tt = (e, r, t = 0) => {
781
- const o = ht ? ht(e) : !1, n = ue(e), s = Ir(e, t), l = Rn(C, n, b), p = fr === n, w = (f == null ? void 0 : f.active) === !0 && f.rowId === n;
782
- return /* @__PURE__ */ _(
783
- g.Row,
864
+ }, jt = (e, r, t = 0) => {
865
+ const i = Et ? Et(e) : !1, n = ve(e), c = Ur(e, t), l = qn(F, n, v), h = Wr === n, k = (p == null ? void 0 : p.active) === !0 && p.rowId === n;
866
+ return /* @__PURE__ */ E(
867
+ m.Row,
784
868
  {
785
869
  onAction: () => {
786
- var a;
787
- (a = G.current) != null && a.active || pe == null || pe(e);
870
+ var o;
871
+ (o = A.current) != null && o.active || ke == null || ke(e);
788
872
  },
789
- onMouseEnter: () => K == null ? void 0 : K(e, !0),
790
- onMouseLeave: () => K == null ? void 0 : K(e, !1),
873
+ onMouseEnter: () => V == null ? void 0 : V(e, !0),
874
+ onMouseLeave: () => V == null ? void 0 : V(e, !1),
791
875
  id: n,
792
876
  value: e,
793
- columns: u,
794
- expandedColSpan: ae,
795
- isExpandable: o,
796
- highlightSelectedRow: he,
797
- renderExpandedContent: o ? tr : void 0,
798
- [Xt]: n,
799
- [rn]: String(s),
800
- className: m(
801
- pe && "cursor-pointer",
802
- Vt ? "prose" : "",
803
- pt && "[&>td]:after:hidden",
804
- qe && "group/rowactions",
805
- p && "bg-utility-brand-25 hover:bg-utility-brand-25",
806
- z && l && "bg-secondary",
807
- bt,
808
- Ge == null ? void 0 : Ge(e)
877
+ columns: f,
878
+ expandedColSpan: me,
879
+ isExpandable: i,
880
+ highlightSelectedRow: Ee,
881
+ renderExpandedContent: i ? wr : void 0,
882
+ [nr]: n,
883
+ [Wn]: String(c),
884
+ className: x(
885
+ ke && "cursor-pointer",
886
+ fr ? "prose" : "",
887
+ kt && "[&>td]:after:hidden",
888
+ rt && "group/rowactions",
889
+ h && "bg-utility-brand-25 hover:bg-utility-brand-25",
890
+ U && l && "bg-secondary",
891
+ _t,
892
+ je == null ? void 0 : je(e)
809
893
  ),
810
- style: w ? tn : void 0,
894
+ style: k ? Ln : void 0,
811
895
  children: [
812
- z && /* @__PURE__ */ c(
813
- g.Cell,
896
+ U && /* @__PURE__ */ a(
897
+ m.Cell,
814
898
  {
815
899
  "data-grid-no-range": "",
816
- className: m("relative w-10 text-center", I),
900
+ className: x("relative w-10 text-center", D),
817
901
  style: { minWidth: "40px", width: "40px" },
818
- children: /* @__PURE__ */ c(
902
+ children: /* @__PURE__ */ a(
819
903
  "div",
820
904
  {
821
905
  className: "flex items-center justify-center",
822
- onClick: (a) => a.stopPropagation(),
823
- onKeyDown: (a) => a.stopPropagation(),
824
- children: /* @__PURE__ */ c(
825
- jt,
906
+ onClick: (o) => o.stopPropagation(),
907
+ onKeyDown: (o) => o.stopPropagation(),
908
+ children: /* @__PURE__ */ a(
909
+ sr,
826
910
  {
827
911
  checked: l,
828
- onCheckedChange: (a) => _r(n, a === !0),
912
+ onCheckedChange: (o) => qr(n, o === !0),
829
913
  "aria-label": `Select row ${n}`,
830
914
  className: "items-center justify-center"
831
915
  }
@@ -834,110 +918,110 @@ const lt = "300px", ct = (i) => {
834
918
  )
835
919
  }
836
920
  ),
837
- u.map((a, it) => {
838
- const _e = It.get(a.key), Se = At(
839
- a.key,
840
- J,
841
- _e
842
- ), de = (Z == null ? void 0 : Z.rowId) === n && (Z == null ? void 0 : Z.columnKey) === a.key, T = h ? dn(
843
- y,
921
+ f.map((o, zt) => {
922
+ const yt = Ft.get(o.key), ge = cr(
923
+ o.key,
924
+ Q,
925
+ yt
926
+ ), xe = (ne == null ? void 0 : ne.rowId) === n && (ne == null ? void 0 : ne.columnKey) === o.key, Z = y ? Cn(
927
+ w,
844
928
  n,
845
- a.key,
846
- b,
929
+ o.key,
930
+ v,
847
931
  Y
848
- ) : null, Ce = !h && W && !de && (q == null ? void 0 : q.rowId) === n && (q == null ? void 0 : q.columnKey) === a.key, O = !!(T != null && T.inRange) && W && !de, zt = O && T ? ln(T.edges) : void 0, Or = rt(a);
849
- return /* @__PURE__ */ c(
850
- g.Cell,
932
+ ) : null, Ye = !y && W && !xe && (z == null ? void 0 : z.rowId) === n && (z == null ? void 0 : z.columnKey) === o.key, se = !!(Z != null && Z.inRange) && W && !xe, Re = se && Z ? On(Z.edges) : void 0, K = ft(o);
933
+ return /* @__PURE__ */ a(
934
+ m.Cell,
851
935
  {
852
- sticky: a.sticky,
853
- stickyOffset: a.stickyOffset,
936
+ sticky: o.sticky,
937
+ stickyOffset: o.stickyOffset,
854
938
  style: {
855
- ...Or,
856
- ...zt ? { boxShadow: zt } : null
939
+ ...K,
940
+ ...Re ? { boxShadow: Re } : null
857
941
  },
858
942
  "data-grid-cell": "",
859
943
  "data-grid-row-id": n,
860
- "data-grid-col-key": a.key,
861
- "data-grid-source-index": s,
862
- className: m(
944
+ "data-grid-col-key": o.key,
945
+ "data-grid-source-index": c,
946
+ className: x(
863
947
  "relative overflow-x-hidden",
864
948
  // Uncontrolled single-cell highlight (legacy).
865
- Ce && "z-1 outline-hidden ring-2 ring-inset ring-brand after:opacity-0",
949
+ Ye && "z-1 outline-hidden ring-2 ring-inset ring-brand after:opacity-0",
866
950
  // Controlled range: fill all selected cells except the anchor; perimeter via boxShadow.
867
- O && "z-1 outline-hidden after:opacity-0",
868
- O && T && !T.isAnchor && "bg-utility-brand-25",
869
- a.cellClassName,
870
- Xr(Se),
871
- I
951
+ se && "z-1 outline-hidden after:opacity-0",
952
+ se && Z && !Z.isAnchor && "bg-utility-brand-25",
953
+ o.cellClassName,
954
+ on(ge),
955
+ D
872
956
  ),
873
957
  children: (() => {
874
- const Yt = it === 0 && (o || qe) ? /* @__PURE__ */ _("div", { className: "flex items-center", children: [
875
- E && /* @__PURE__ */ c(
958
+ const Vt = zt === 0 && (i || rt) ? /* @__PURE__ */ E("div", { className: "flex items-center", children: [
959
+ L && /* @__PURE__ */ a(
876
960
  "div",
877
961
  {
878
962
  "data-grid-no-range": "",
879
963
  className: "flex items-center justify-center",
880
- onClick: (U) => U.stopPropagation(),
881
- onContextMenu: (U) => U.stopPropagation(),
882
- onKeyDown: (U) => U.stopPropagation(),
883
- children: /* @__PURE__ */ c(
884
- wn,
964
+ onClick: ($) => $.stopPropagation(),
965
+ onContextMenu: ($) => $.stopPropagation(),
966
+ onKeyDown: ($) => $.stopPropagation(),
967
+ children: /* @__PURE__ */ a(
968
+ Un,
885
969
  {
886
- config: E,
887
- sourceRowIndex: s,
970
+ config: L,
971
+ sourceRowIndex: c,
888
972
  item: e,
889
- enableDrag: Ae,
890
- isDragging: w,
891
- onDragHandlePointerDown: (U) => Lr(
892
- U,
973
+ enableDrag: nt,
974
+ isDragging: k,
975
+ onDragHandlePointerDown: ($) => Yr(
976
+ $,
893
977
  n,
894
- s,
978
+ c,
895
979
  e
896
980
  ),
897
- triggerClassName: m(
981
+ triggerClassName: x(
898
982
  // Hover-reveal: hidden until row hover / focus / menu open / this row is the drag source.
899
983
  // Do not force all handles visible while another row is dragging.
900
984
  "transition-opacity group-hover/rowactions:opacity-100 focus-visible:opacity-100",
901
- p || w ? "opacity-100" : "opacity-0"
985
+ h || k ? "opacity-100" : "opacity-0"
902
986
  ),
903
- onOpenChange: (U) => vt(U ? n : null)
987
+ onOpenChange: ($) => Tt($ ? n : null)
904
988
  }
905
989
  )
906
990
  }
907
991
  ),
908
- /* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: ut(a.key, e[a.key], e) })
909
- ] }) : ut(a.key, e[a.key], e);
910
- return W ? /* @__PURE__ */ c(
992
+ /* @__PURE__ */ a("div", { className: "flex-1 min-w-0", children: vt(o.key, e[o.key], e) })
993
+ ] }) : vt(o.key, e[o.key], e);
994
+ return W ? /* @__PURE__ */ a(
911
995
  "div",
912
996
  {
913
997
  "data-grid-focus": !0,
914
998
  tabIndex: -1,
915
999
  className: "outline-hidden",
916
- children: Yt
1000
+ children: Vt
917
1001
  }
918
- ) : Yt;
1002
+ ) : Vt;
919
1003
  })()
920
1004
  },
921
- a.key
1005
+ o.key
922
1006
  );
923
1007
  }),
924
- S && F && /* @__PURE__ */ c(
925
- g.Cell,
1008
+ O && G && /* @__PURE__ */ a(
1009
+ m.Cell,
926
1010
  {
927
1011
  "data-grid-no-range": "",
928
- className: m("relative w-14 text-center", I),
1012
+ className: x("relative w-14 text-center", D),
929
1013
  style: { minWidth: "56px", width: "56px" },
930
- children: /* @__PURE__ */ c(
1014
+ children: /* @__PURE__ */ a(
931
1015
  "button",
932
1016
  {
933
1017
  type: "button",
934
1018
  title: "Delete row",
935
1019
  "aria-label": "Delete row",
936
1020
  className: "inline-flex items-center justify-center rounded p-1 text-fg-quaternary hover:bg-secondary_subtle hover:text-fg-secondary",
937
- onClick: (a) => {
938
- a.stopPropagation(), F.onDeleteRow(s);
1021
+ onClick: (o) => {
1022
+ o.stopPropagation(), G.onDeleteRow(c);
939
1023
  },
940
- children: /* @__PURE__ */ c(gn, { name: "Trash02", className: "size-3" })
1024
+ children: /* @__PURE__ */ a(Yn, { name: "Trash02", className: "size-3" })
941
1025
  }
942
1026
  )
943
1027
  }
@@ -946,104 +1030,107 @@ const lt = "300px", ct = (i) => {
946
1030
  },
947
1031
  n
948
1032
  );
949
- }, Cr = (e) => /* @__PURE__ */ _(
950
- g.Row,
1033
+ }, Hr = (e) => /* @__PURE__ */ E(
1034
+ m.Row,
951
1035
  {
952
1036
  id: String(e.id),
953
1037
  isExpandable: !1,
954
- className: m(pt && "[&>td]:after:hidden", bt),
1038
+ className: x(kt && "[&>td]:after:hidden", _t),
955
1039
  children: [
956
- z && /* @__PURE__ */ c(
957
- g.Cell,
1040
+ U && /* @__PURE__ */ a(
1041
+ m.Cell,
958
1042
  {
959
- className: m("relative w-10", I),
1043
+ className: x("relative w-10", D),
960
1044
  style: { minWidth: "40px", width: "40px" }
961
1045
  }
962
1046
  ),
963
- u.map((r) => /* @__PURE__ */ c(
964
- g.Cell,
1047
+ f.map((r) => /* @__PURE__ */ a(
1048
+ m.Cell,
965
1049
  {
966
1050
  sticky: r.sticky,
967
1051
  stickyOffset: r.stickyOffset,
968
- style: rt(r),
969
- className: m(
1052
+ style: ft(r),
1053
+ className: x(
970
1054
  "overflow-x-hidden text-left",
971
1055
  r.cellClassName,
972
- I
1056
+ D
973
1057
  ),
974
- children: /* @__PURE__ */ c(mn, { height: "14px", width: "75%", className: "rounded" })
1058
+ children: /* @__PURE__ */ a(Bn, { height: "14px", width: "75%", className: "rounded" })
975
1059
  },
976
1060
  r.key
977
1061
  )),
978
- S && /* @__PURE__ */ c(
979
- g.Cell,
1062
+ O && /* @__PURE__ */ a(
1063
+ m.Cell,
980
1064
  {
981
- className: m("w-14", I),
1065
+ className: x("w-14", D),
982
1066
  style: { minWidth: "56px", width: "56px" }
983
1067
  }
984
1068
  )
985
1069
  ]
986
1070
  },
987
1071
  String(e.id)
988
- ), Tr = () => X ? Le.map((e) => Cr(e)) : Ie && H ? H.flatMap((e) => {
989
- const r = ve.has(e.key);
1072
+ ), zr = () => j ? Fe.map((e) => Hr(e)) : Oe && J ? J.flatMap((e) => {
1073
+ const r = Te.has(e.key);
990
1074
  return [
991
- Sr(e),
1075
+ Kr(e),
992
1076
  ...r ? [] : e.rows.map(
993
- (t, o) => Tt(t, void 0, o)
1077
+ (t, i) => jt(t, void 0, i)
994
1078
  )
995
1079
  ];
996
- }) : Le.map(
997
- (e, r) => Tt(e, void 0, r)
998
- ), Ot = /* @__PURE__ */ c(
999
- Yr.Root,
1080
+ }) : Fe.map(
1081
+ (e, r) => jt(e, void 0, r)
1082
+ ), qt = /* @__PURE__ */ a(
1083
+ rn.Root,
1000
1084
  {
1001
- ref: kr,
1002
- onKeyDownCapture: W ? Rr : void 0,
1003
- onPointerDownCapture: h ? Dr : void 0,
1004
- onDoubleClickCapture: h ? Nr : void 0,
1005
- className: m(
1085
+ ref: Mr,
1086
+ onKeyDownCapture: W ? Zr : void 0,
1087
+ onPointerDownCapture: y ? $r : void 0,
1088
+ onDoubleClickCapture: y ? Br : void 0,
1089
+ className: x(
1006
1090
  "w-full",
1007
- !L || et ? "overflow-x-auto" : "overflow-x-hidden",
1008
- ye && "border border-secondary rounded-xl",
1091
+ !P || $t ? "overflow-x-auto" : "overflow-x-hidden",
1092
+ Ie && "border border-secondary rounded-xl",
1009
1093
  "[&_tr:hover>td]:!bg-secondary_subtle",
1010
- Zt
1094
+ hr
1011
1095
  ),
1012
- size: ft,
1013
- children: /* @__PURE__ */ _(
1014
- g,
1096
+ size: bt,
1097
+ children: /* @__PURE__ */ E(
1098
+ m,
1015
1099
  {
1016
- "aria-label": Jt,
1017
- size: ft,
1100
+ "aria-label": ur,
1101
+ size: bt,
1018
1102
  isEditable: W,
1019
- inlineSelection: he,
1020
- className: m(L && "min-w-full", rr),
1021
- style: vr,
1022
- ...Er,
1103
+ inlineSelection: Ee,
1104
+ className: x(
1105
+ P && "min-w-full",
1106
+ mr
1107
+ ),
1108
+ style: Gr,
1109
+ ...Ar,
1023
1110
  children: [
1024
- /* @__PURE__ */ _(
1025
- g.Header,
1111
+ /* @__PURE__ */ E(
1112
+ m.Header,
1026
1113
  {
1027
- className: m(
1114
+ className: x(
1028
1115
  "sticky top-0 z-20",
1029
- ye && "[&>tr>th:first-child]:rounded-bl-none [&>tr>th:last-child]:rounded-br-none",
1030
- er
1116
+ Ie && "[&>tr>th:first-child]:rounded-bl-none [&>tr>th:last-child]:rounded-br-none",
1117
+ yr
1031
1118
  ),
1032
1119
  children: [
1033
- z && /* @__PURE__ */ c(
1034
- g.Head,
1120
+ U && /* @__PURE__ */ a(
1121
+ m.Head,
1035
1122
  {
1036
1123
  label: "",
1037
1124
  allowsSorting: !1,
1038
1125
  isRowHeader: !1,
1039
1126
  style: { minWidth: "40px", width: "40px" },
1040
- className: m(I),
1127
+ className: x(D),
1041
1128
  headerCellClass: "justify-center",
1042
- children: te === "multiple" && D && /* @__PURE__ */ c("div", { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ c(
1043
- jt,
1129
+ children: ae === "multiple" && S && /* @__PURE__ */ a("div", { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ a(
1130
+ sr,
1044
1131
  {
1045
- checked: ot ? !0 : Pr && !ot ? "indeterminate" : !1,
1046
- onCheckedChange: () => Wr(),
1132
+ checked: ht ? !0 : Xr && !ht ? "indeterminate" : !1,
1133
+ onCheckedChange: () => jr(),
1047
1134
  "aria-label": "Select all rows",
1048
1135
  className: "items-center justify-center"
1049
1136
  }
@@ -1051,14 +1138,14 @@ const lt = "300px", ct = (i) => {
1051
1138
  },
1052
1139
  "selection"
1053
1140
  ),
1054
- u.map((e, r) => {
1055
- const t = ar ? yr.get(e.key) : void 0, o = It.get(e.key), n = At(
1141
+ f.map((e, r) => {
1142
+ const t = br ? Pr.get(e.key) : void 0, i = Ft.get(e.key), n = cr(
1056
1143
  e.key,
1057
- J,
1058
- o
1059
- ), s = Qt.includes(e.key) || n === "center" ? "justify-center" : n === "right" ? "justify-end" : "";
1060
- return /* @__PURE__ */ c(
1061
- g.Head,
1144
+ Q,
1145
+ i
1146
+ ), c = pr.includes(e.key) || n === "center" ? "justify-center" : n === "right" ? "justify-end" : "";
1147
+ return /* @__PURE__ */ a(
1148
+ m.Head,
1062
1149
  {
1063
1150
  sticky: e.sticky,
1064
1151
  stickyOffset: e.stickyOffset,
@@ -1066,96 +1153,96 @@ const lt = "300px", ct = (i) => {
1066
1153
  label: e.label,
1067
1154
  isRowHeader: r === 0,
1068
1155
  allowsSorting: e.allowsSorting,
1069
- headerCellClass: `${e.headerCellClass} ${s}`,
1070
- style: rt(e),
1071
- className: m(
1156
+ headerCellClass: `${e.headerCellClass} ${c}`,
1157
+ style: ft(e),
1158
+ className: x(
1072
1159
  "overflow-hidden",
1073
1160
  e.headClassName,
1074
- I
1161
+ D
1075
1162
  ),
1076
- headerAction: t && Re ? /* @__PURE__ */ c(
1077
- pn,
1163
+ headerAction: t && Pe ? /* @__PURE__ */ a(
1164
+ Gn,
1078
1165
  {
1079
1166
  column: t,
1080
- columnLabel: t.label ?? (o ? Ur(o, dr) : e.label),
1081
- currentAlignment: o ? Ht(
1082
- o,
1083
- J ?? /* @__PURE__ */ new Map()
1084
- ) : (J == null ? void 0 : J.get(e.key)) ?? "left",
1085
- capabilities: cr,
1086
- hideDisabled: u.length <= 1,
1087
- onAction: br.get(e.key),
1088
- renderExtraItems: lr,
1167
+ columnLabel: t.label ?? (i ? sn(i, Er) : e.label),
1168
+ currentAlignment: i ? dr(
1169
+ i,
1170
+ Q ?? /* @__PURE__ */ new Map()
1171
+ ) : (Q == null ? void 0 : Q.get(e.key)) ?? "left",
1172
+ capabilities: kr,
1173
+ hideDisabled: f.length <= 1,
1174
+ onAction: Fr.get(e.key),
1175
+ renderExtraItems: Ir,
1089
1176
  showOnHeaderHover: !0
1090
1177
  }
1091
1178
  ) : void 0,
1092
- children: (Fe == null ? void 0 : Fe(e.key)) ?? null
1179
+ children: (Xe == null ? void 0 : Xe(e.key)) ?? null
1093
1180
  },
1094
1181
  e.key
1095
1182
  );
1096
1183
  }),
1097
- S && /* @__PURE__ */ c(
1098
- g.Head,
1184
+ O && /* @__PURE__ */ a(
1185
+ m.Head,
1099
1186
  {
1100
1187
  label: "",
1101
1188
  allowsSorting: !1,
1102
1189
  isRowHeader: !1,
1103
1190
  style: { minWidth: "56px", width: "56px" },
1104
- className: m(I)
1191
+ className: x(D)
1105
1192
  },
1106
1193
  "actions"
1107
1194
  )
1108
1195
  ]
1109
1196
  }
1110
1197
  ),
1111
- /* @__PURE__ */ _(g.Body, { children: [
1112
- !Wt && Tr(),
1113
- mr && /* @__PURE__ */ c(
1114
- g.Row,
1198
+ /* @__PURE__ */ E(m.Body, { children: [
1199
+ !Ut && zr(),
1200
+ Cr && /* @__PURE__ */ a(
1201
+ m.Row,
1115
1202
  {
1116
1203
  id: "empty-state",
1117
1204
  highlightSelectedRow: !1,
1118
- children: /* @__PURE__ */ c(
1119
- g.Cell,
1205
+ children: /* @__PURE__ */ a(
1206
+ m.Cell,
1120
1207
  {
1121
- colSpan: ae,
1122
- className: m(
1208
+ colSpan: me,
1209
+ className: x(
1123
1210
  "text-left text-placeholder_subtle border-b border-secondary py-3",
1124
- I
1211
+ D
1125
1212
  ),
1126
- children: mt
1213
+ children: Wt
1127
1214
  }
1128
1215
  )
1129
1216
  },
1130
1217
  "empty-state"
1131
1218
  ),
1132
- Je && F && /* @__PURE__ */ _(
1133
- g.Row,
1219
+ ot && G && /* @__PURE__ */ E(
1220
+ m.Row,
1134
1221
  {
1135
1222
  id: "add-row-footer",
1136
1223
  highlightSelectedRow: !1,
1137
1224
  children: [
1138
- /* @__PURE__ */ c(
1139
- g.Cell,
1225
+ /* @__PURE__ */ a(
1226
+ m.Cell,
1140
1227
  {
1141
- colSpan: ae - (S ? 1 : 0),
1142
- className: m(I),
1143
- children: /* @__PURE__ */ c(
1144
- hn,
1228
+ colSpan: me - (O ? 1 : 0),
1229
+ className: x(D),
1230
+ children: /* @__PURE__ */ a(
1231
+ Mn,
1145
1232
  {
1146
1233
  color: "tertiary",
1147
1234
  className: "bg-secondary text-primary",
1148
1235
  size: "xs",
1149
- onClick: F.onAddRow,
1236
+ onClick: G.onAddRow,
1150
1237
  children: "+ Add Row"
1151
1238
  }
1152
1239
  )
1153
1240
  }
1154
1241
  ),
1155
- S && /* @__PURE__ */ c(
1156
- g.Cell,
1242
+ O && /* @__PURE__ */ a(
1243
+ m.Cell,
1157
1244
  {
1158
- className: m("w-14", I),
1245
+ className: x("w-14", D),
1159
1246
  style: { minWidth: "56px", width: "56px" }
1160
1247
  }
1161
1248
  )
@@ -1163,13 +1250,13 @@ const lt = "300px", ct = (i) => {
1163
1250
  },
1164
1251
  "add-row-footer"
1165
1252
  ),
1166
- xr && Me && /* @__PURE__ */ c(
1167
- yn,
1253
+ Or && Ke && /* @__PURE__ */ a(
1254
+ An,
1168
1255
  {
1169
- ...Me,
1170
- hasActionsColumn: S,
1171
- hasSelectionColumn: z,
1172
- showBorders: !!ye
1256
+ ...Ke,
1257
+ hasActionsColumn: O,
1258
+ hasSelectionColumn: U,
1259
+ showBorders: !!Ie
1173
1260
  }
1174
1261
  )
1175
1262
  ] })
@@ -1177,49 +1264,49 @@ const lt = "300px", ct = (i) => {
1177
1264
  }
1178
1265
  )
1179
1266
  }
1180
- ), Ft = W ? /* @__PURE__ */ c(
1181
- qr,
1267
+ ), Kt = W ? /* @__PURE__ */ a(
1268
+ mn,
1182
1269
  {
1183
- rowIds: b,
1270
+ rowIds: v,
1184
1271
  columnKeys: Y,
1185
- containerRef: x,
1186
- onSelectCell: Ve,
1187
- onEditingCellChange: hr,
1188
- children: Ot
1272
+ containerRef: g,
1273
+ onSelectCell: at,
1274
+ onEditingCellChange: _r,
1275
+ children: qt
1189
1276
  }
1190
- ) : Ot, Gt = f != null && f.active ? /* @__PURE__ */ _(Mt, { children: [
1191
- /* @__PURE__ */ c(Qr, { session: f }),
1192
- f.dropLineY != null && /* @__PURE__ */ c(
1193
- Zr,
1277
+ ) : qt, Ht = p != null && p.active ? /* @__PURE__ */ E(wt, { children: [
1278
+ /* @__PURE__ */ a(En, { session: p }),
1279
+ p.dropLineY != null && /* @__PURE__ */ a(
1280
+ In,
1194
1281
  {
1195
- y: f.dropLineY,
1196
- left: f.dropLineLeft,
1197
- width: f.dropLineWidth
1282
+ y: p.dropLineY,
1283
+ left: p.dropLineLeft,
1284
+ width: p.dropLineWidth
1198
1285
  }
1199
1286
  )
1200
1287
  ] }) : null;
1201
- return gr ? /* @__PURE__ */ _("div", { className: "flex flex-col gap-3", children: [
1202
- Dt && Nt,
1203
- Ft,
1204
- Pt && P && /* @__PURE__ */ c(
1205
- Mr,
1288
+ return Tr ? /* @__PURE__ */ E("div", { className: "flex flex-col gap-3", children: [
1289
+ Mt && Gt,
1290
+ Kt,
1291
+ At && T && /* @__PURE__ */ a(
1292
+ nn,
1206
1293
  {
1207
- currentPage: P.currentPage,
1208
- pageSize: P.pageSize,
1209
- totalPages: P.totalPages,
1210
- totalItems: P.totalItems,
1211
- onPageChange: P.onPageChange,
1212
- onPageSizeChange: P.onPageSizeChange,
1213
- showPagination: P.showPagination
1294
+ currentPage: T.currentPage,
1295
+ pageSize: T.pageSize,
1296
+ totalPages: T.totalPages,
1297
+ totalItems: T.totalItems,
1298
+ onPageChange: T.onPageChange,
1299
+ onPageSizeChange: T.onPageSizeChange,
1300
+ showPagination: T.showPagination
1214
1301
  }
1215
1302
  ),
1216
- Gt
1217
- ] }) : /* @__PURE__ */ _(Mt, { children: [
1218
- Ft,
1219
- Gt
1303
+ Ht
1304
+ ] }) : /* @__PURE__ */ E(wt, { children: [
1305
+ Kt,
1306
+ Ht
1220
1307
  ] });
1221
1308
  }
1222
1309
  );
1223
1310
  export {
1224
- Kn as TableWrapper
1311
+ ki as TableWrapper
1225
1312
  };