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

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,601 @@
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, 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(() => {
520
+ const e = M ? { zoom: pe } : void 0;
521
+ return !P || !te ? M ? { ...e, width: "max-content", minWidth: "100%" } : void 0 : {
522
+ ...e,
523
+ // The zoom-independent base, so the painted width tracks the zoom and overflows by
524
+ // more as you zoom in — matching the widths `getColumnStyle` hands the columns.
525
+ width: `${Ge ?? te.minTableWidth}px`,
526
+ tableLayout: "fixed"
527
+ };
528
+ }, [
529
+ P,
530
+ te,
531
+ $t,
532
+ Ge,
533
+ M,
534
+ pe
535
+ ]), Mr = I(
473
536
  (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);
537
+ g.current = e, typeof ue == "function" ? ue(e) : ue && (ue.current = e);
478
538
  },
479
- [E, Z]
480
- ), Se = v(
481
- (e, t) => {
482
- const r = G.current;
539
+ [ue]
540
+ ), Ar = Ce && Ee ? {
541
+ selectionMode: ae,
542
+ selectedKeys: F === "all" ? "all" : F,
543
+ onSelectionChange: Vn(S)
544
+ } : {}, Ur = (e, r = 0) => {
545
+ const t = e.__sourceIndex;
546
+ return typeof t == "number" ? t : r;
547
+ }, Me = I(
548
+ (e) => {
549
+ const r = A.current;
483
550
  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,
551
+ const { fromSourceIndex: t, toSourceIndex: i, item: n, active: c } = r;
552
+ re(null), e && c && t !== i && (L != null && L.onReorderRows) && L.onReorderRows(t, i, n);
553
+ },
554
+ [L, re]
555
+ ), Ae = I(
556
+ (e, r) => {
557
+ const t = A.current;
558
+ if (!t) return;
559
+ Qe.current = { x: e, y: r };
560
+ const i = e - t.startX, n = r - t.startY, c = Math.hypot(i, n), l = t.active || c >= xn;
561
+ let h = {
562
+ ...t,
488
563
  currentX: e,
489
- currentY: t,
564
+ currentY: r,
490
565
  active: l
491
566
  };
492
567
  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
568
+ t.active || Tt(null);
569
+ const k = g.current;
570
+ if (k) {
571
+ const o = Rn(
572
+ k,
573
+ r,
574
+ t.fromSourceIndex,
575
+ t.rowId
501
576
  );
502
- s && (p = {
503
- ...p,
504
- toSourceIndex: s.toSourceIndex,
577
+ o && (h = {
578
+ ...h,
579
+ toSourceIndex: o.toSourceIndex,
505
580
  // Clip to scrollport so the line never draws over the header / outside the card.
506
- dropLineY: Zr(
507
- s.dropLineY,
508
- R
581
+ dropLineY: vn(
582
+ o.dropLineY,
583
+ k
509
584
  ),
510
- dropLineLeft: s.dropLineLeft,
511
- dropLineWidth: s.dropLineWidth
585
+ dropLineLeft: o.dropLineLeft,
586
+ dropLineWidth: o.dropLineWidth
512
587
  });
513
588
  }
514
589
  }
515
- Z(p);
590
+ re(h);
516
591
  },
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)}"]`
592
+ [re]
593
+ ), Yr = I(
594
+ (e, r, t, i) => {
595
+ var k, o;
596
+ if (!nt || e.button !== 0) return;
597
+ const n = (k = g.current) == null ? void 0 : k.querySelector(
598
+ `tr[${nr}="${CSS.escape(r)}"]`
524
599
  );
525
600
  if (!n) return;
526
601
  e.preventDefault();
@@ -528,255 +603,255 @@ const ht = "300px", ft = (i) => {
528
603
  e.currentTarget.setPointerCapture(e.pointerId);
529
604
  } catch {
530
605
  }
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,
606
+ const c = bn(n), l = kn(n), h = ((o = n.closest("table")) == null ? void 0 : o.getBoundingClientRect()) ?? n.getBoundingClientRect();
607
+ Qe.current = { x: e.clientX, y: e.clientY }, re({
608
+ rowId: r,
609
+ fromSourceIndex: t,
610
+ item: i,
536
611
  pointerId: e.pointerId,
537
612
  startX: e.clientX,
538
613
  startY: e.clientY,
539
614
  currentX: e.clientX,
540
615
  currentY: e.clientY,
541
616
  active: !1,
542
- preview: a,
543
- toSourceIndex: r,
617
+ preview: c,
618
+ toSourceIndex: t,
544
619
  dropLineY: null,
545
- dropLineLeft: p.left,
546
- dropLineWidth: p.width,
620
+ dropLineLeft: h.left,
621
+ dropLineWidth: h.width,
547
622
  rowClone: l
548
623
  });
549
624
  },
550
- [He, Z]
551
- ), Gt = f != null;
552
- q(() => {
553
- if (!Gt) return;
625
+ [nt, re]
626
+ ), Xt = p != null;
627
+ X(() => {
628
+ if (!Xt) return;
554
629
  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);
630
+ var c;
631
+ n.pointerId === ((c = A.current) == null ? void 0 : c.pointerId) && Ae(n.clientX, n.clientY);
560
632
  }, 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));
633
+ var c;
634
+ n.pointerId === ((c = A.current) == null ? void 0 : c.pointerId) && Me(!0);
635
+ }, t = (n) => {
636
+ var c;
637
+ n.pointerId === ((c = A.current) == null ? void 0 : c.pointerId) && Me(!1);
638
+ }, i = (n) => {
639
+ n.key === "Escape" && (n.preventDefault(), Me(!1));
565
640
  };
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);
641
+ return window.addEventListener("pointermove", e), window.addEventListener("pointerup", r), window.addEventListener("pointercancel", t), window.addEventListener("keydown", i), () => {
642
+ window.removeEventListener("pointermove", e), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", t), window.removeEventListener("keydown", i);
568
643
  };
569
- }, [Gt, _e, Se]), q(() => {
570
- if (!(f != null && f.active)) return;
571
- const e = document.body.style.userSelect, t = document.body.style.cursor;
644
+ }, [Xt, Me, Ae]), X(() => {
645
+ if (!(p != null && p.active)) return;
646
+ const e = document.body.style.userSelect, r = document.body.style.cursor;
572
647
  return document.body.style.userSelect = "none", document.body.style.cursor = "grabbing", () => {
573
- document.body.style.userSelect = e, document.body.style.cursor = t;
648
+ document.body.style.userSelect = e, document.body.style.cursor = r;
574
649
  };
575
- }, [f == null ? void 0 : f.active]), q(() => {
576
- if (!(f != null && f.active)) return;
650
+ }, [p == null ? void 0 : p.active]), X(() => {
651
+ if (!(p != null && p.active)) return;
577
652
  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);
653
+ const r = () => {
654
+ const t = A.current, i = g.current;
655
+ if (!(t != null && t.active) || !i) return;
656
+ const { x: n, y: c } = Qe.current, l = Nn(i, c);
657
+ l !== 0 && (i.scrollTop += l, Ae(n, c)), e = requestAnimationFrame(r);
583
658
  };
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
659
+ return e = requestAnimationFrame(r), () => cancelAnimationFrame(e);
660
+ }, [p == null ? void 0 : p.active, Ae]);
661
+ const Ue = I(
662
+ (e, r) => {
663
+ const t = q.current, i = g.current;
664
+ if (!t || !i) return;
665
+ et.current = { x: e, y: r };
666
+ const n = e - t.startX, c = r - t.startY, l = Math.hypot(n, c), h = t.active || l >= Pn;
667
+ if (h && !t.active && (t.active = !0, Ot(!0)), !h) return;
668
+ const k = Sn(i, e, r), o = k ? $e(k) : null;
669
+ o && (t.focus = o, B({
670
+ anchor: t.anchor,
671
+ focus: o
597
672
  }));
598
673
  },
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
674
+ [B]
675
+ ), pt = I((e) => {
676
+ const r = q.current;
677
+ q.current = null, Ot(!1), r && requestAnimationFrame(
678
+ () => rr(
679
+ g.current,
680
+ r.focus.rowId,
681
+ r.focus.columnKey
607
682
  )
608
683
  );
609
- }, []), Cr = v(
684
+ }, []), Br = I(
610
685
  (e) => {
611
- if (!h || !I || !Q || Oe(e.target)) return;
612
- const t = Ht(
686
+ if (!y || !W || !ee || Be(e.target)) return;
687
+ const r = ir(
613
688
  e.target,
614
- m.current
689
+ g.current
615
690
  );
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
691
+ if (!r) return;
692
+ const t = $e(r);
693
+ t && (e.preventDefault(), e.stopPropagation(), B(gt(t)), ee({
694
+ rowId: t.rowId,
695
+ columnKey: t.columnKey,
696
+ sourceIndex: t.sourceIndex
622
697
  }));
623
698
  },
624
- [h, M, I, Q]
625
- ), Tr = v(
699
+ [y, B, W, ee]
700
+ ), $r = I(
626
701
  (e) => {
627
- if (!h || !I || e.button !== 0 || G.current) return;
628
- const t = Ht(
702
+ if (!y || !W || e.button !== 0 || A.current) return;
703
+ const r = ir(
629
704
  e.target,
630
- m.current
705
+ g.current
631
706
  );
632
- if (!t) return;
633
- const r = Fe(t);
634
707
  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 = {
708
+ const t = $e(r);
709
+ if (!t) return;
710
+ const i = e.shiftKey && w != null, n = i ? w.anchor : t;
711
+ tt.current = null, et.current = { x: e.clientX, y: e.clientY }, q.current = {
637
712
  pointerId: e.pointerId,
638
713
  startX: e.clientX,
639
714
  startY: e.clientY,
640
715
  active: !1,
641
716
  anchor: n,
642
- origin: r,
643
- focus: r,
644
- extend: o
645
- }, M(o ? { anchor: n, focus: r } : lt(r));
717
+ origin: t,
718
+ focus: t,
719
+ extend: i
720
+ }, B(i ? { anchor: n, focus: t } : gt(t));
646
721
  },
647
- [h, y, M, I]
722
+ [y, w, B, W]
648
723
  );
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);
724
+ X(() => {
725
+ if (!y) return;
726
+ const e = (i) => {
727
+ const n = q.current;
728
+ !n || i.pointerId !== n.pointerId || (i.preventDefault(), Ue(i.clientX, i.clientY));
729
+ }, r = (i) => {
730
+ const n = q.current;
731
+ !n || i.pointerId !== n.pointerId || pt(!0);
732
+ }, t = (i) => {
733
+ const n = q.current;
734
+ !n || i.pointerId !== n.pointerId || pt(!1);
660
735
  };
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);
736
+ return window.addEventListener("pointermove", e), window.addEventListener("pointerup", r), window.addEventListener("pointercancel", t), () => {
737
+ window.removeEventListener("pointermove", e), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", t);
663
738
  };
664
- }, [h, at, Ce]), q(() => {
665
- if (!te) return;
739
+ }, [y, pt, Ue]), X(() => {
740
+ if (!ie) return;
666
741
  const e = document.body.style.userSelect;
667
742
  return document.body.style.userSelect = "none", () => {
668
743
  document.body.style.userSelect = e;
669
744
  };
670
- }, [te]), q(() => {
671
- if (!te) return;
745
+ }, [ie]), X(() => {
746
+ if (!ie) return;
672
747
  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);
748
+ const r = () => {
749
+ const t = q.current, i = g.current;
750
+ if (!(t != null && t.active) || !i) return;
751
+ const { x: n, y: c } = et.current, { dx: l, dy: h } = Tn(i, n, c);
752
+ (l !== 0 || h !== 0) && (l !== 0 && (i.scrollLeft += l), h !== 0 && (i.scrollTop += h), Ue(n, c)), e = requestAnimationFrame(r);
678
753
  };
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;
754
+ return e = requestAnimationFrame(r), () => cancelAnimationFrame(e);
755
+ }, [ie, Ue]), X(() => {
756
+ if (!y || !w) return;
757
+ const e = (t) => {
758
+ if (Be(t.target)) return;
759
+ const i = g.current;
760
+ if (!i) return;
686
761
  const n = document.activeElement;
687
- if (n && !o.contains(n) && r.target instanceof Node && !o.contains(r.target))
762
+ if (n && !i.contains(n) && t.target instanceof Node && !i.contains(t.target))
688
763
  return;
689
- const a = ut(
690
- y,
691
- x,
764
+ const c = xt(
765
+ w,
766
+ v,
692
767
  Y
693
768
  );
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;
769
+ !c || !He || (t.preventDefault(), He({ selection: w, rect: c, event: t }));
770
+ }, r = (t) => {
771
+ var h;
772
+ if (Be(t.target)) return;
773
+ const i = g.current;
774
+ if (!i) return;
700
775
  const n = document.activeElement;
701
- if (n && !o.contains(n) && r.target instanceof Node && !o.contains(r.target))
776
+ if (n && !i.contains(n) && t.target instanceof Node && !i.contains(t.target))
702
777
  return;
703
- const a = ut(
704
- y,
705
- x,
778
+ const c = xt(
779
+ w,
780
+ v,
706
781
  Y
707
782
  );
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 });
783
+ if (!c || !ze) return;
784
+ const l = ((h = t.clipboardData) == null ? void 0 : h.getData("text/plain")) ?? "";
785
+ t.preventDefault(), ze({ selection: w, rect: c, text: l, event: t });
711
786
  };
712
- return document.addEventListener("copy", e), document.addEventListener("paste", t), () => {
713
- document.removeEventListener("copy", e), document.removeEventListener("paste", t);
787
+ return document.addEventListener("copy", e), document.addEventListener("paste", r), () => {
788
+ document.removeEventListener("copy", e), document.removeEventListener("paste", r);
714
789
  };
715
790
  }, [
716
- x,
717
- h,
791
+ v,
718
792
  y,
793
+ w,
719
794
  Y,
720
- Xe,
721
- $e
795
+ He,
796
+ ze
722
797
  ]);
723
- const ct = Ne && Nn(T, x), Or = Ne && Dn(T, x), Fr = () => {
724
- if (P) {
725
- if (ct) {
726
- P(/* @__PURE__ */ new Set());
798
+ const ht = Ce && Hn(F, v), Xr = Ce && zn(F, v), jr = () => {
799
+ if (S) {
800
+ if (ht) {
801
+ S(/* @__PURE__ */ new Set());
727
802
  return;
728
803
  }
729
- P("all");
804
+ S("all");
730
805
  }
731
- }, Gr = (e, t) => {
732
- if (!P) return;
733
- if (oe === "single") {
734
- P(t ? /* @__PURE__ */ new Set([e]) : /* @__PURE__ */ new Set());
806
+ }, qr = (e, r) => {
807
+ if (!S) return;
808
+ if (ae === "single") {
809
+ S(r ? /* @__PURE__ */ new Set([e]) : /* @__PURE__ */ new Set());
735
810
  return;
736
811
  }
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,
812
+ const t = F === "all" ? new Set(v) : new Set(ar(F, v));
813
+ r ? t.add(e) : t.delete(e), S(t);
814
+ }, Kr = (e) => {
815
+ const r = Te.has(e.key);
816
+ return Pt ? /* @__PURE__ */ a(
817
+ m.Row,
743
818
  {
744
819
  id: `group-${e.key}`,
745
820
  highlightSelectedRow: !1,
746
821
  className: "bg-secondary_subtle hover:bg-secondary_subtle",
747
- children: /* @__PURE__ */ c(w.Cell, { colSpan: le, className: g(L), children: It(e) })
822
+ children: /* @__PURE__ */ a(m.Cell, { colSpan: me, className: x(D), children: Pt(e) })
748
823
  },
749
824
  `group-${e.key}`
750
- ) : /* @__PURE__ */ c(
751
- w.Row,
825
+ ) : /* @__PURE__ */ a(
826
+ m.Row,
752
827
  {
753
828
  id: `group-${e.key}`,
754
829
  highlightSelectedRow: !1,
755
830
  className: "bg-secondary_subtle hover:bg-secondary_subtle",
756
- children: /* @__PURE__ */ c(
757
- w.Cell,
831
+ children: /* @__PURE__ */ a(
832
+ m.Cell,
758
833
  {
759
- colSpan: le,
760
- className: g("py-1.5", L),
761
- children: /* @__PURE__ */ S(
834
+ colSpan: me,
835
+ className: x("py-1.5", D),
836
+ children: /* @__PURE__ */ E(
762
837
  "button",
763
838
  {
764
839
  type: "button",
765
840
  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,
841
+ onClick: () => Sr(e.key),
842
+ "aria-expanded": !r,
768
843
  children: [
769
- /* @__PURE__ */ c(
770
- Xr,
844
+ /* @__PURE__ */ a(
845
+ tn,
771
846
  {
772
- className: g(
847
+ className: x(
773
848
  "size-4 shrink-0 text-fg-quaternary transition-transform",
774
- !t && "rotate-90"
849
+ !r && "rotate-90"
775
850
  )
776
851
  }
777
852
  ),
778
- /* @__PURE__ */ c("span", { className: "truncate", children: e.label || "(Empty)" }),
779
- /* @__PURE__ */ S("span", { className: "text-tertiary", children: [
853
+ /* @__PURE__ */ a("span", { className: "truncate", children: e.label || "(Empty)" }),
854
+ /* @__PURE__ */ E("span", { className: "text-tertiary", children: [
780
855
  "(",
781
856
  e.rows.length,
782
857
  ")"
@@ -789,55 +864,55 @@ const ht = "300px", ft = (i) => {
789
864
  },
790
865
  `group-${e.key}`
791
866
  );
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,
867
+ }, jt = (e, r, t = 0) => {
868
+ 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;
869
+ return /* @__PURE__ */ E(
870
+ m.Row,
796
871
  {
797
872
  onAction: () => {
798
- var s;
799
- (s = G.current) != null && s.active || me == null || me(e);
873
+ var o;
874
+ (o = A.current) != null && o.active || ke == null || ke(e);
800
875
  },
801
- onMouseEnter: () => H == null ? void 0 : H(e, !0),
802
- onMouseLeave: () => H == null ? void 0 : H(e, !1),
876
+ onMouseEnter: () => V == null ? void 0 : V(e, !0),
877
+ onMouseLeave: () => V == null ? void 0 : V(e, !1),
803
878
  id: n,
804
879
  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)
880
+ columns: f,
881
+ expandedColSpan: me,
882
+ isExpandable: i,
883
+ highlightSelectedRow: Ee,
884
+ renderExpandedContent: i ? wr : void 0,
885
+ [nr]: n,
886
+ [Wn]: String(c),
887
+ className: x(
888
+ ke && "cursor-pointer",
889
+ fr ? "prose" : "",
890
+ kt && "[&>td]:after:hidden",
891
+ rt && "group/rowactions",
892
+ h && "bg-utility-brand-25 hover:bg-utility-brand-25",
893
+ U && l && "bg-secondary",
894
+ _t,
895
+ je == null ? void 0 : je(e)
821
896
  ),
822
- style: R ? sn : void 0,
897
+ style: k ? Ln : void 0,
823
898
  children: [
824
- z && /* @__PURE__ */ c(
825
- w.Cell,
899
+ U && /* @__PURE__ */ a(
900
+ m.Cell,
826
901
  {
827
902
  "data-grid-no-range": "",
828
- className: g("relative w-10 text-center", L),
903
+ className: x("relative w-10 text-center", D),
829
904
  style: { minWidth: "40px", width: "40px" },
830
- children: /* @__PURE__ */ c(
905
+ children: /* @__PURE__ */ a(
831
906
  "div",
832
907
  {
833
908
  className: "flex items-center justify-center",
834
- onClick: (s) => s.stopPropagation(),
835
- onKeyDown: (s) => s.stopPropagation(),
836
- children: /* @__PURE__ */ c(
837
- Vt,
909
+ onClick: (o) => o.stopPropagation(),
910
+ onKeyDown: (o) => o.stopPropagation(),
911
+ children: /* @__PURE__ */ a(
912
+ sr,
838
913
  {
839
914
  checked: l,
840
- onCheckedChange: (s) => Gr(n, s === !0),
915
+ onCheckedChange: (o) => qr(n, o === !0),
841
916
  "aria-label": `Select row ${n}`,
842
917
  className: "items-center justify-center"
843
918
  }
@@ -846,110 +921,110 @@ const ht = "300px", ft = (i) => {
846
921
  )
847
922
  }
848
923
  ),
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,
924
+ f.map((o, zt) => {
925
+ const yt = Ft.get(o.key), ge = cr(
926
+ o.key,
927
+ Q,
928
+ yt
929
+ ), xe = (ne == null ? void 0 : ne.rowId) === n && (ne == null ? void 0 : ne.columnKey) === o.key, Z = y ? Cn(
930
+ w,
856
931
  n,
857
- s.key,
858
- x,
932
+ o.key,
933
+ v,
859
934
  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,
935
+ ) : 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);
936
+ return /* @__PURE__ */ a(
937
+ m.Cell,
863
938
  {
864
- sticky: s.sticky,
865
- stickyOffset: s.stickyOffset,
939
+ sticky: o.sticky,
940
+ stickyOffset: o.stickyOffset,
866
941
  style: {
867
- ...B,
868
- ...he ? { boxShadow: he } : null
942
+ ...K,
943
+ ...Re ? { boxShadow: Re } : null
869
944
  },
870
945
  "data-grid-cell": "",
871
946
  "data-grid-row-id": n,
872
- "data-grid-col-key": s.key,
873
- "data-grid-source-index": a,
874
- className: g(
947
+ "data-grid-col-key": o.key,
948
+ "data-grid-source-index": c,
949
+ className: x(
875
950
  "relative overflow-x-hidden",
876
951
  // Uncontrolled single-cell highlight (legacy).
877
- Te && "z-1 outline-hidden ring-2 ring-inset ring-brand after:opacity-0",
952
+ Ye && "z-1 outline-hidden ring-2 ring-inset ring-brand after:opacity-0",
878
953
  // 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
954
+ se && "z-1 outline-hidden after:opacity-0",
955
+ se && Z && !Z.isAnchor && "bg-utility-brand-25",
956
+ o.cellClassName,
957
+ on(ge),
958
+ D
884
959
  ),
885
960
  children: (() => {
886
- const $t = Xt === 0 && (o || Ke) ? /* @__PURE__ */ S("div", { className: "flex items-center", children: [
887
- E && /* @__PURE__ */ c(
961
+ const Vt = zt === 0 && (i || rt) ? /* @__PURE__ */ E("div", { className: "flex items-center", children: [
962
+ L && /* @__PURE__ */ a(
888
963
  "div",
889
964
  {
890
965
  "data-grid-no-range": "",
891
966
  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,
967
+ onClick: ($) => $.stopPropagation(),
968
+ onContextMenu: ($) => $.stopPropagation(),
969
+ onKeyDown: ($) => $.stopPropagation(),
970
+ children: /* @__PURE__ */ a(
971
+ Un,
897
972
  {
898
- config: E,
899
- sourceRowIndex: a,
973
+ config: L,
974
+ sourceRowIndex: c,
900
975
  item: e,
901
- enableDrag: He,
902
- isDragging: R,
903
- onDragHandlePointerDown: (U) => Sr(
904
- U,
976
+ enableDrag: nt,
977
+ isDragging: k,
978
+ onDragHandlePointerDown: ($) => Yr(
979
+ $,
905
980
  n,
906
- a,
981
+ c,
907
982
  e
908
983
  ),
909
- triggerClassName: g(
984
+ triggerClassName: x(
910
985
  // Hover-reveal: hidden until row hover / focus / menu open / this row is the drag source.
911
986
  // Do not force all handles visible while another row is dragging.
912
987
  "transition-opacity group-hover/rowactions:opacity-100 focus-visible:opacity-100",
913
- p || R ? "opacity-100" : "opacity-0"
988
+ h || k ? "opacity-100" : "opacity-0"
914
989
  ),
915
- onOpenChange: (U) => Lt(U ? n : null)
990
+ onOpenChange: ($) => Tt($ ? n : null)
916
991
  }
917
992
  )
918
993
  }
919
994
  ),
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(
995
+ /* @__PURE__ */ a("div", { className: "flex-1 min-w-0", children: vt(o.key, e[o.key], e) })
996
+ ] }) : vt(o.key, e[o.key], e);
997
+ return W ? /* @__PURE__ */ a(
923
998
  "div",
924
999
  {
925
1000
  "data-grid-focus": !0,
926
1001
  tabIndex: -1,
927
1002
  className: "outline-hidden",
928
- children: $t
1003
+ children: Vt
929
1004
  }
930
- ) : $t;
1005
+ ) : Vt;
931
1006
  })()
932
1007
  },
933
- s.key
1008
+ o.key
934
1009
  );
935
1010
  }),
936
- C && F && /* @__PURE__ */ c(
937
- w.Cell,
1011
+ O && G && /* @__PURE__ */ a(
1012
+ m.Cell,
938
1013
  {
939
1014
  "data-grid-no-range": "",
940
- className: g("relative w-14 text-center", L),
1015
+ className: x("relative w-14 text-center", D),
941
1016
  style: { minWidth: "56px", width: "56px" },
942
- children: /* @__PURE__ */ c(
1017
+ children: /* @__PURE__ */ a(
943
1018
  "button",
944
1019
  {
945
1020
  type: "button",
946
1021
  title: "Delete row",
947
1022
  "aria-label": "Delete row",
948
1023
  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);
1024
+ onClick: (o) => {
1025
+ o.stopPropagation(), G.onDeleteRow(c);
951
1026
  },
952
- children: /* @__PURE__ */ c(bn, { name: "Trash02", className: "size-3" })
1027
+ children: /* @__PURE__ */ a(Yn, { name: "Trash02", className: "size-3" })
953
1028
  }
954
1029
  )
955
1030
  }
@@ -958,104 +1033,107 @@ const ht = "300px", ft = (i) => {
958
1033
  },
959
1034
  n
960
1035
  );
961
- }, Yr = (e) => /* @__PURE__ */ S(
962
- w.Row,
1036
+ }, Hr = (e) => /* @__PURE__ */ E(
1037
+ m.Row,
963
1038
  {
964
1039
  id: String(e.id),
965
1040
  isExpandable: !1,
966
- className: g(mt && "[&>td]:after:hidden", Et),
1041
+ className: x(kt && "[&>td]:after:hidden", _t),
967
1042
  children: [
968
- z && /* @__PURE__ */ c(
969
- w.Cell,
1043
+ U && /* @__PURE__ */ a(
1044
+ m.Cell,
970
1045
  {
971
- className: g("relative w-10", L),
1046
+ className: x("relative w-10", D),
972
1047
  style: { minWidth: "40px", width: "40px" }
973
1048
  }
974
1049
  ),
975
- u.map((t) => /* @__PURE__ */ c(
976
- w.Cell,
1050
+ f.map((r) => /* @__PURE__ */ a(
1051
+ m.Cell,
977
1052
  {
978
- sticky: t.sticky,
979
- stickyOffset: t.stickyOffset,
980
- style: st(t),
981
- className: g(
1053
+ sticky: r.sticky,
1054
+ stickyOffset: r.stickyOffset,
1055
+ style: ft(r),
1056
+ className: x(
982
1057
  "overflow-x-hidden text-left",
983
- t.cellClassName,
984
- L
1058
+ r.cellClassName,
1059
+ D
985
1060
  ),
986
- children: /* @__PURE__ */ c(vn, { height: "14px", width: "75%", className: "rounded" })
1061
+ children: /* @__PURE__ */ a(Bn, { height: "14px", width: "75%", className: "rounded" })
987
1062
  },
988
- t.key
1063
+ r.key
989
1064
  )),
990
- C && /* @__PURE__ */ c(
991
- w.Cell,
1065
+ O && /* @__PURE__ */ a(
1066
+ m.Cell,
992
1067
  {
993
- className: g("w-14", L),
1068
+ className: x("w-14", D),
994
1069
  style: { minWidth: "56px", width: "56px" }
995
1070
  }
996
1071
  )
997
1072
  ]
998
1073
  },
999
1074
  String(e.id)
1000
- ), Mr = () => X ? Pe.map((e) => Yr(e)) : De && V ? V.flatMap((e) => {
1001
- const t = Le.has(e.key);
1075
+ ), zr = () => j ? Fe.map((e) => Hr(e)) : Oe && J ? J.flatMap((e) => {
1076
+ const r = Te.has(e.key);
1002
1077
  return [
1003
- zr(e),
1004
- ...t ? [] : e.rows.map(
1005
- (r, o) => zt(r, void 0, o)
1078
+ Kr(e),
1079
+ ...r ? [] : e.rows.map(
1080
+ (t, i) => jt(t, void 0, i)
1006
1081
  )
1007
1082
  ];
1008
- }) : Pe.map(
1009
- (e, t) => zt(e, void 0, t)
1010
- ), Yt = /* @__PURE__ */ c(
1011
- $r.Root,
1083
+ }) : Fe.map(
1084
+ (e, r) => jt(e, void 0, r)
1085
+ ), qt = /* @__PURE__ */ a(
1086
+ rn.Root,
1012
1087
  {
1013
- ref: Pr,
1014
- onKeyDownCapture: I ? Nr : void 0,
1015
- onPointerDownCapture: h ? Tr : void 0,
1016
- onDoubleClickCapture: h ? Cr : void 0,
1017
- className: g(
1088
+ ref: Mr,
1089
+ onKeyDownCapture: W ? Zr : void 0,
1090
+ onPointerDownCapture: y ? $r : void 0,
1091
+ onDoubleClickCapture: y ? Br : void 0,
1092
+ className: x(
1018
1093
  "w-full",
1019
- !N || ot ? "overflow-x-auto" : "overflow-x-hidden",
1020
- xe && "border border-secondary rounded-xl",
1094
+ !P || $t ? "overflow-x-auto" : "overflow-x-hidden",
1095
+ Ie && "border border-secondary rounded-xl",
1021
1096
  "[&_tr:hover>td]:!bg-secondary_subtle",
1022
- ir
1097
+ hr
1023
1098
  ),
1024
- size: wt,
1025
- children: /* @__PURE__ */ S(
1026
- w,
1099
+ size: bt,
1100
+ children: /* @__PURE__ */ E(
1101
+ m,
1027
1102
  {
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,
1103
+ "aria-label": ur,
1104
+ size: bt,
1105
+ isEditable: W,
1106
+ inlineSelection: Ee,
1107
+ className: x(
1108
+ P && "min-w-full",
1109
+ mr
1110
+ ),
1111
+ style: Gr,
1112
+ ...Ar,
1035
1113
  children: [
1036
- /* @__PURE__ */ S(
1037
- w.Header,
1114
+ /* @__PURE__ */ E(
1115
+ m.Header,
1038
1116
  {
1039
- className: g(
1117
+ className: x(
1040
1118
  "sticky top-0 z-20",
1041
- xe && "[&>tr>th:first-child]:rounded-bl-none [&>tr>th:last-child]:rounded-br-none",
1042
- sr
1119
+ Ie && "[&>tr>th:first-child]:rounded-bl-none [&>tr>th:last-child]:rounded-br-none",
1120
+ yr
1043
1121
  ),
1044
1122
  children: [
1045
- z && /* @__PURE__ */ c(
1046
- w.Head,
1123
+ U && /* @__PURE__ */ a(
1124
+ m.Head,
1047
1125
  {
1048
1126
  label: "",
1049
1127
  allowsSorting: !1,
1050
1128
  isRowHeader: !1,
1051
1129
  style: { minWidth: "40px", width: "40px" },
1052
- className: g(L),
1130
+ className: x(D),
1053
1131
  headerCellClass: "justify-center",
1054
- children: oe === "multiple" && P && /* @__PURE__ */ c("div", { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ c(
1055
- Vt,
1132
+ children: ae === "multiple" && S && /* @__PURE__ */ a("div", { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ a(
1133
+ sr,
1056
1134
  {
1057
- checked: ct ? !0 : Or && !ct ? "indeterminate" : !1,
1058
- onCheckedChange: () => Fr(),
1135
+ checked: ht ? !0 : Xr && !ht ? "indeterminate" : !1,
1136
+ onCheckedChange: () => jr(),
1059
1137
  "aria-label": "Select all rows",
1060
1138
  className: "items-center justify-center"
1061
1139
  }
@@ -1063,111 +1141,111 @@ const ht = "300px", ft = (i) => {
1063
1141
  },
1064
1142
  "selection"
1065
1143
  ),
1066
- u.map((e, t) => {
1067
- const r = pr ? br.get(e.key) : void 0, o = Pt.get(e.key), n = Zt(
1144
+ f.map((e, r) => {
1145
+ const t = br ? Pr.get(e.key) : void 0, i = Ft.get(e.key), n = cr(
1068
1146
  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,
1147
+ Q,
1148
+ i
1149
+ ), c = pr.includes(e.key) || n === "center" ? "justify-center" : n === "right" ? "justify-end" : "";
1150
+ return /* @__PURE__ */ a(
1151
+ m.Head,
1074
1152
  {
1075
1153
  sticky: e.sticky,
1076
1154
  stickyOffset: e.stickyOffset,
1077
1155
  id: e.key,
1078
1156
  label: e.label,
1079
- isRowHeader: t === 0,
1157
+ isRowHeader: r === 0,
1080
1158
  allowsSorting: e.allowsSorting,
1081
- headerCellClass: `${e.headerCellClass} ${a}`,
1082
- style: st(e),
1083
- className: g(
1159
+ headerCellClass: `${e.headerCellClass} ${c}`,
1160
+ style: ft(e),
1161
+ className: x(
1084
1162
  "overflow-hidden",
1085
1163
  e.headClassName,
1086
- L
1164
+ D
1087
1165
  ),
1088
- headerAction: r && Ie ? /* @__PURE__ */ c(
1089
- mn,
1166
+ headerAction: t && Pe ? /* @__PURE__ */ a(
1167
+ Gn,
1090
1168
  {
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,
1169
+ column: t,
1170
+ columnLabel: t.label ?? (i ? sn(i, Er) : e.label),
1171
+ currentAlignment: i ? dr(
1172
+ i,
1173
+ Q ?? /* @__PURE__ */ new Map()
1174
+ ) : (Q == null ? void 0 : Q.get(e.key)) ?? "left",
1175
+ capabilities: kr,
1176
+ hideDisabled: f.length <= 1,
1177
+ onAction: Fr.get(e.key),
1178
+ renderExtraItems: Ir,
1101
1179
  showOnHeaderHover: !0
1102
1180
  }
1103
1181
  ) : void 0,
1104
- children: (Ge == null ? void 0 : Ge(e.key)) ?? null
1182
+ children: (Xe == null ? void 0 : Xe(e.key)) ?? null
1105
1183
  },
1106
1184
  e.key
1107
1185
  );
1108
1186
  }),
1109
- C && /* @__PURE__ */ c(
1110
- w.Head,
1187
+ O && /* @__PURE__ */ a(
1188
+ m.Head,
1111
1189
  {
1112
1190
  label: "",
1113
1191
  allowsSorting: !1,
1114
1192
  isRowHeader: !1,
1115
1193
  style: { minWidth: "56px", width: "56px" },
1116
- className: g(L)
1194
+ className: x(D)
1117
1195
  },
1118
1196
  "actions"
1119
1197
  )
1120
1198
  ]
1121
1199
  }
1122
1200
  ),
1123
- /* @__PURE__ */ S(w.Body, { children: [
1124
- !Tt && Mr(),
1125
- Er && /* @__PURE__ */ c(
1126
- w.Row,
1201
+ /* @__PURE__ */ E(m.Body, { children: [
1202
+ !Ut && zr(),
1203
+ Cr && /* @__PURE__ */ a(
1204
+ m.Row,
1127
1205
  {
1128
1206
  id: "empty-state",
1129
1207
  highlightSelectedRow: !1,
1130
- children: /* @__PURE__ */ c(
1131
- w.Cell,
1208
+ children: /* @__PURE__ */ a(
1209
+ m.Cell,
1132
1210
  {
1133
- colSpan: le,
1134
- className: g(
1211
+ colSpan: me,
1212
+ className: x(
1135
1213
  "text-left text-placeholder_subtle border-b border-secondary py-3",
1136
- L
1214
+ D
1137
1215
  ),
1138
- children: vt
1216
+ children: Wt
1139
1217
  }
1140
1218
  )
1141
1219
  },
1142
1220
  "empty-state"
1143
1221
  ),
1144
- Qe && F && /* @__PURE__ */ S(
1145
- w.Row,
1222
+ ot && G && /* @__PURE__ */ E(
1223
+ m.Row,
1146
1224
  {
1147
1225
  id: "add-row-footer",
1148
1226
  highlightSelectedRow: !1,
1149
1227
  children: [
1150
- /* @__PURE__ */ c(
1151
- w.Cell,
1228
+ /* @__PURE__ */ a(
1229
+ m.Cell,
1152
1230
  {
1153
- colSpan: le - (C ? 1 : 0),
1154
- className: g(L),
1155
- children: /* @__PURE__ */ c(
1156
- gn,
1231
+ colSpan: me - (O ? 1 : 0),
1232
+ className: x(D),
1233
+ children: /* @__PURE__ */ a(
1234
+ Mn,
1157
1235
  {
1158
1236
  color: "tertiary",
1159
1237
  className: "bg-secondary text-primary",
1160
1238
  size: "xs",
1161
- onClick: F.onAddRow,
1239
+ onClick: G.onAddRow,
1162
1240
  children: "+ Add Row"
1163
1241
  }
1164
1242
  )
1165
1243
  }
1166
1244
  ),
1167
- C && /* @__PURE__ */ c(
1168
- w.Cell,
1245
+ O && /* @__PURE__ */ a(
1246
+ m.Cell,
1169
1247
  {
1170
- className: g("w-14", L),
1248
+ className: x("w-14", D),
1171
1249
  style: { minWidth: "56px", width: "56px" }
1172
1250
  }
1173
1251
  )
@@ -1175,13 +1253,13 @@ const ht = "300px", ft = (i) => {
1175
1253
  },
1176
1254
  "add-row-footer"
1177
1255
  ),
1178
- Ir && Ue && /* @__PURE__ */ c(
1179
- xn,
1256
+ Or && Ke && /* @__PURE__ */ a(
1257
+ An,
1180
1258
  {
1181
- ...Ue,
1182
- hasActionsColumn: C,
1183
- hasSelectionColumn: z,
1184
- showBorders: !!xe
1259
+ ...Ke,
1260
+ hasActionsColumn: O,
1261
+ hasSelectionColumn: U,
1262
+ showBorders: !!Ie
1185
1263
  }
1186
1264
  )
1187
1265
  ] })
@@ -1189,49 +1267,49 @@ const ht = "300px", ft = (i) => {
1189
1267
  }
1190
1268
  )
1191
1269
  }
1192
- ), Mt = I ? /* @__PURE__ */ c(
1193
- Hr,
1270
+ ), Kt = W ? /* @__PURE__ */ a(
1271
+ mn,
1194
1272
  {
1195
- rowIds: x,
1273
+ rowIds: v,
1196
1274
  columnKeys: Y,
1197
- containerRef: m,
1198
- onSelectCell: Ze,
1199
- onEditingCellChange: Rr,
1200
- children: Yt
1275
+ containerRef: g,
1276
+ onSelectCell: at,
1277
+ onEditingCellChange: _r,
1278
+ children: qt
1201
1279
  }
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,
1280
+ ) : qt, Ht = p != null && p.active ? /* @__PURE__ */ E(wt, { children: [
1281
+ /* @__PURE__ */ a(En, { session: p }),
1282
+ p.dropLineY != null && /* @__PURE__ */ a(
1283
+ In,
1206
1284
  {
1207
- y: f.dropLineY,
1208
- left: f.dropLineLeft,
1209
- width: f.dropLineWidth
1285
+ y: p.dropLineY,
1286
+ left: p.dropLineLeft,
1287
+ width: p.dropLineWidth
1210
1288
  }
1211
1289
  )
1212
1290
  ] }) : 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,
1291
+ return Tr ? /* @__PURE__ */ E("div", { className: "flex flex-col gap-3", children: [
1292
+ Mt && Gt,
1293
+ Kt,
1294
+ At && T && /* @__PURE__ */ a(
1295
+ nn,
1218
1296
  {
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
1297
+ currentPage: T.currentPage,
1298
+ pageSize: T.pageSize,
1299
+ totalPages: T.totalPages,
1300
+ totalItems: T.totalItems,
1301
+ onPageChange: T.onPageChange,
1302
+ onPageSizeChange: T.onPageSizeChange,
1303
+ showPagination: T.showPagination
1226
1304
  }
1227
1305
  ),
1228
- Ut
1229
- ] }) : /* @__PURE__ */ S(jt, { children: [
1230
- Mt,
1231
- Ut
1306
+ Ht
1307
+ ] }) : /* @__PURE__ */ E(wt, { children: [
1308
+ Kt,
1309
+ Ht
1232
1310
  ] });
1233
1311
  }
1234
1312
  );
1235
1313
  export {
1236
- Zn as TableWrapper
1314
+ ki as TableWrapper
1237
1315
  };