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

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