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

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