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