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

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