@pibit.ai/cure-design-system 0.5.11 → 0.5.12

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,485 +1,861 @@
1
- import { jsx as i, jsxs as m, Fragment as sn } from "react/jsx-runtime";
2
- import { forwardRef as ln, useCallback as A, useMemo as v, useRef as oe, useState as Ne, useLayoutEffect as an, Fragment as dn } from "react";
3
- import { functionalUpdate as Ye, useTable as cn } from "@tanstack/react-table";
4
- import { ArrowDown as un, ChevronSelectorVertical as mn, ChevronRight as $e } from "@untitledui/icons";
5
- import { Checkbox as Ue } from "../../primitives/checkbox/checkbox.js";
6
- import { ShimmerLine as fn } from "../../primitives/shimmer/shimmer.js";
7
- import { cn as d } from "../../utils/cn.js";
8
- import { selectionFromSingleCell as pn, getCellRangeVisualState as bn, cellRangeEdgeBoxShadow as hn } from "../table/cellRangeSelection.js";
9
- import { useCellRangeSelection as gn } from "./useCellRangeSelection.js";
10
- import { useRowReorderDrag as xn } from "./useRowReorderDrag.js";
11
- import { GridNavProvider as yn } from "../table/useGridKeyboardNavigation.js";
12
- import { ROW_DRAG_SOURCE_STYLE as wn, ROW_SOURCE_INDEX_ATTR as vn, ROW_REORDER_ATTR as Cn, FloatingRowPreview as Sn, DropIndicatorLine as In } from "../table/rowReorderDrag.js";
13
- import { buildTableComponentColumns as Nn } from "./buildTableColumns.js";
14
- import { HEADER_PADDING_CLASS as En, ROW_HEIGHT_CLASS as Ze, CELL_PADDING_CLASS as He } from "./rowMetrics.js";
15
- import { tableComponentFeatures as Tn } from "./tableFeatures.js";
16
- import { TableZoomControl as _n } from "../table/TableZoomControl.js";
17
- import { useFitTableToViewport as Ln } from "../table/useFitTableToViewport.js";
18
- import { useTableZoomState as Rn } from "../table/useTableZoomState.js";
19
- import { DEFAULT_TABLE_ZOOM_MIN as Wn, parsePxValue as Ee, DEFAULT_ZOOMABLE_COLUMN_MIN_WIDTH as qe, supportsCssZoom as Dn, computeFillBaseWidth as kn, computeEffectiveTableWidth as On, computeFlexColumnWidth as zn, getTableZoomFontSize as An, computeNeedsHorizontalScroll as Fn, DEFAULT_COLUMN_MAX_WIDTH as Pn } from "../table/tableZoomLayout.js";
20
- const Vn = 5, jn = Dn(), Mn = (r) => r === "center" ? "text-center" : r === "right" ? "text-right" : "text-left", Ge = (r) => r === "center" ? "justify-center" : r === "right" ? "justify-end" : "justify-start", ne = (r, l) => {
21
- const c = r.__sourceIndex;
22
- return typeof c == "number" ? c : Number.isFinite(l) ? l : null;
23
- }, Be = (r) => r instanceof HTMLElement && !!r.closest(
1
+ import { jsx as s, jsxs as x, Fragment as Bt } from "react/jsx-runtime";
2
+ import { forwardRef as jt, useCallback as f, useMemo as M, useRef as S, useState as K, useLayoutEffect as Pt, useSyncExternalStore as or, useEffect as ir, Fragment as sr, useImperativeHandle as lr } from "react";
3
+ import { createPortal as nt } from "react-dom";
4
+ import { functionalUpdate as Yt, useTable as ar } from "@tanstack/react-table";
5
+ import { ArrowDown as cr, ChevronSelectorVertical as dr, ChevronRight as Wt } from "@untitledui/icons";
6
+ import { Checkbox as Ot } from "../../primitives/checkbox/checkbox.js";
7
+ import { ShimmerLine as ur } from "../../primitives/shimmer/shimmer.js";
8
+ import { cn as w } from "../../utils/cn.js";
9
+ import { selectionFromSingleCell as mr, getCellRangeVisualState as pr, cellRangeEdgeBoxShadow as fr } from "../table/cellRangeSelection.js";
10
+ import { useCellRangeSelection as gr } from "./useCellRangeSelection.js";
11
+ import { useRowReorderDrag as hr } from "./useRowReorderDrag.js";
12
+ import { GridNavProvider as br } from "../table/useGridKeyboardNavigation.js";
13
+ import { ROW_DRAG_SOURCE_STYLE as wr, ROW_SOURCE_INDEX_ATTR as xr, ROW_REORDER_ATTR as yr, FloatingRowPreview as vr, DropIndicatorLine as Cr } from "../table/rowReorderDrag.js";
14
+ import { buildTableComponentColumns as Sr } from "./buildTableColumns.js";
15
+ import { resolveColumnDropTarget as Ir, getRenderedColumnPreviewValues as Er, previewCellValue as Lr, getColumnDragViewport as Rr, COLUMN_REORDER_PARENT_ATTR as Nr, COLUMN_REORDER_ID_ATTR as Tr, getColumnDragScrollDelta as Dr, COLUMN_DRAG_THRESHOLD_PX as Mt } from "./columnReorderDrag.js";
16
+ import { HEADER_PADDING_CLASS as _r, ROW_HEIGHT_CLASS as kt, CELL_PADDING_CLASS as At } from "./rowMetrics.js";
17
+ import { tableComponentFeatures as zr } from "./tableFeatures.js";
18
+ import { TableZoomControl as Pr } from "../table/TableZoomControl.js";
19
+ import { useFitTableToViewport as Wr } from "../table/useFitTableToViewport.js";
20
+ import { useTableZoomState as Or } from "../table/useTableZoomState.js";
21
+ import { DEFAULT_TABLE_ZOOM_MIN as Mr, parsePxValue as De, DEFAULT_ZOOMABLE_COLUMN_MIN_WIDTH as Qe, supportsCssZoom as kr, computeFillBaseWidth as Ar, computeEffectiveTableWidth as Fr, computeFlexColumnWidth as Vr, getTableZoomFontSize as $r, computeNeedsHorizontalScroll as Hr, DEFAULT_COLUMN_MAX_WIDTH as Xr } from "../table/tableZoomLayout.js";
22
+ const Ur = 5, Br = 120, jr = 800, Yr = ({ preview: o }) => nt(
23
+ /* @__PURE__ */ x(
24
+ "div",
25
+ {
26
+ "aria-hidden": !0,
27
+ "data-column-drag-preview": "",
28
+ className: "pointer-events-none fixed z-(--z-index-drag-overlay) overflow-hidden rounded-md bg-primary shadow-lg cursor-grabbing",
29
+ style: {
30
+ left: o.left + 12,
31
+ top: o.top + 12,
32
+ width: o.width,
33
+ height: o.height,
34
+ border: "1px solid var(--color-border-brand, var(--color-brand-500, #7f56d9))"
35
+ },
36
+ children: [
37
+ /* @__PURE__ */ s("div", { className: "flex h-9 items-center truncate bg-secondary_subtle px-3 text-xs font-medium text-secondary", children: o.label }),
38
+ o.values.map((l, u) => /* @__PURE__ */ s(
39
+ "div",
40
+ {
41
+ className: "flex h-9 items-center truncate border-t border-secondary px-3 text-xs text-secondary",
42
+ children: l
43
+ },
44
+ `${o.columnId}-${u}`
45
+ ))
46
+ ]
47
+ }
48
+ ),
49
+ document.body
50
+ ), Kr = ({
51
+ target: o
52
+ }) => nt(
53
+ /* @__PURE__ */ s(
54
+ "div",
55
+ {
56
+ "aria-hidden": !0,
57
+ className: "pointer-events-none fixed z-(--z-index-drag-indicator) w-0.5 bg-brand-600",
58
+ style: {
59
+ left: o.lineLeft - 1,
60
+ top: o.lineTop,
61
+ height: o.lineHeight
62
+ }
63
+ }
64
+ ),
65
+ document.body
66
+ ), Zr = jt(
67
+ function(l, u) {
68
+ const y = S(null), I = S(null);
69
+ return lr(
70
+ u,
71
+ () => ({
72
+ show: (g, E) => {
73
+ const h = I.current, A = y.current;
74
+ !h || !A || (h.style.display = "", h.style.left = `${g.lineLeft}px`, h.style.top = `${g.top}px`, h.style.height = `${g.height}px`, h.style.opacity = E ? "1" : "0.7", A.style.display = E ? "" : "none", A.style.left = `${g.columnLeft}px`, A.style.top = `${g.top}px`, A.style.height = `${g.height}px`);
75
+ },
76
+ hide: () => {
77
+ I.current && (I.current.style.display = "none"), y.current && (y.current.style.display = "none");
78
+ }
79
+ }),
80
+ []
81
+ ), nt(
82
+ /* @__PURE__ */ x(Bt, { children: [
83
+ /* @__PURE__ */ s(
84
+ "div",
85
+ {
86
+ ref: y,
87
+ "aria-hidden": !0,
88
+ className: "pointer-events-none fixed z-(--z-index-drag-indicator) w-px bg-border-secondary",
89
+ style: { display: "none" }
90
+ }
91
+ ),
92
+ /* @__PURE__ */ s(
93
+ "div",
94
+ {
95
+ ref: I,
96
+ "aria-hidden": !0,
97
+ "data-column-resize-guide": "",
98
+ className: "pointer-events-none fixed z-(--z-index-drag-indicator) w-px bg-brand-600",
99
+ style: { display: "none" }
100
+ }
101
+ )
102
+ ] }),
103
+ document.body
104
+ );
105
+ }
106
+ ), Gr = () => or(
107
+ () => () => {
108
+ },
109
+ () => !0,
110
+ () => !1
111
+ ), qr = kr(), Jr = (o) => o === "center" ? "text-center" : o === "right" ? "text-right" : "text-left", Ft = (o) => o === "center" ? "justify-center" : o === "right" ? "justify-end" : "justify-start", Te = (o, l) => {
112
+ const u = o.__sourceIndex;
113
+ return typeof u == "number" ? u : Number.isFinite(l) ? l : null;
114
+ }, Vt = (o) => o instanceof HTMLElement && !!o.closest(
24
115
  'button,a,input,textarea,select,[contenteditable]:not([contenteditable="false"]),[role="button"],[role="menuitem"]'
25
- ), z = (r, l, c) => {
26
- const [L, R] = Ne(l), f = r ?? L, C = oe(f), p = oe(c);
27
- C.current = f, p.current = c;
28
- const ie = A(
29
- (g) => {
30
- var x;
31
- const I = Ye(g, C.current);
32
- C.current = I, r === void 0 && R(I), (x = p.current) == null || x.call(p, I);
116
+ ), ne = (o, l, u) => {
117
+ const [y, I] = K(l), g = o ?? y, E = S(g), h = S(u);
118
+ E.current = g, h.current = u;
119
+ const A = f(
120
+ (_) => {
121
+ var z;
122
+ const V = Yt(_, E.current);
123
+ E.current = V, o === void 0 && I(V), (z = h.current) == null || z.call(h, V);
33
124
  },
34
- [r]
125
+ [o]
35
126
  );
36
- return [f, ie];
37
- }, Kn = (r, l) => {
38
- if (!r) return;
39
- const c = r.sticky ? {
127
+ return [g, A];
128
+ }, $t = (o, l) => {
129
+ if (!o) return;
130
+ const u = o.sticky ? {
40
131
  position: "sticky",
41
- [r.sticky]: r.stickyOffset ?? 0,
132
+ [o.sticky]: o.stickyOffset ?? 0,
42
133
  zIndex: l ? 30 : 20,
43
134
  backgroundColor: l ? "var(--color-bg-secondary-subtle)" : "var(--color-bg-primary)",
44
- boxShadow: l || !r.sticky ? void 0 : r.sticky === "right" ? "inset 2px 0 0 0 var(--color-border-tertiary)" : "inset -2px 0 0 0 var(--color-border-tertiary)"
135
+ boxShadow: l || !o.sticky ? void 0 : o.sticky === "right" ? "inset 2px 0 0 0 var(--color-border-tertiary)" : "inset -2px 0 0 0 var(--color-border-tertiary)"
45
136
  } : {};
46
137
  return {
47
- width: r.width,
48
- minWidth: r.minWidth ?? r.width ?? `${re}px`,
49
- maxWidth: r.maxWidth ?? Pn,
50
- ...c
138
+ width: o.width,
139
+ minWidth: o.minWidth ?? o.width ?? `${_e}px`,
140
+ maxWidth: o.maxWidth ?? Xr,
141
+ ...u
51
142
  };
52
- }, re = 120, Ie = (r) => !!(r.maxWidth && r.sticky === "right"), $n = (r, l = re) => Ee(r.minWidth) || l, Xe = (r, l, c, L) => {
53
- if (l === "multiple") return r;
54
- if (r === !0) return L ? { [L]: !0 } : {};
55
- const R = c && c !== !0 ? new Set(
56
- Object.keys(c).filter((p) => c[p])
57
- ) : /* @__PURE__ */ new Set(), f = Object.keys(r).filter((p) => r[p]), C = f.find((p) => !R.has(p)) ?? f[0];
58
- return C ? { [C]: !0 } : {};
143
+ }, _e = 120, Ht = (o) => {
144
+ if (typeof o == "number") return Number.isFinite(o) ? o : void 0;
145
+ if (typeof o != "string") return;
146
+ const l = o.trim().match(/^(\d+(?:\.\d+)?)px$/);
147
+ return l ? Number(l[1]) : void 0;
148
+ }, Qr = (o, l) => {
149
+ const u = Ht(o == null ? void 0 : o.minWidth) ?? l, y = Math.max(
150
+ u,
151
+ Ht(o == null ? void 0 : o.maxWidth) ?? jr
152
+ );
153
+ return { min: u, max: y };
154
+ }, et = (o, l, u) => {
155
+ const { min: y, max: I } = Qr(o, u);
156
+ return Math.round(Math.min(I, Math.max(y, l)));
157
+ }, Xt = (o, l) => {
158
+ if (!l) return;
159
+ const u = o[l];
160
+ return typeof u == "number" && Number.isFinite(u) ? u : void 0;
161
+ }, tt = (o) => !!(o.maxWidth && o.sticky === "right"), eo = (o, l = _e) => De(o.minWidth) || l, Ut = (o, l, u, y) => {
162
+ if (l === "multiple") return o;
163
+ if (o === !0) return y ? { [y]: !0 } : {};
164
+ const I = u && u !== !0 ? new Set(
165
+ Object.keys(u).filter((h) => u[h])
166
+ ) : /* @__PURE__ */ new Set(), g = Object.keys(o).filter((h) => o[h]), E = g.find((h) => !I.has(h)) ?? g[0];
167
+ return E ? { [E]: !0 } : {};
59
168
  };
60
- function Un({
61
- data: r,
169
+ function to({
170
+ data: o,
62
171
  columns: l,
63
- getRowId: c,
64
- ariaLabel: L,
65
- headerGroups: R,
66
- size: f = "xs",
67
- loading: C = !1,
68
- loadingRowCount: p = Vn,
69
- emptyState: ie = "No data found",
70
- showBorders: g = !1,
71
- removeRowBorders: I = !1,
72
- fillWidth: x = !1,
73
- zoom: Je,
74
- zoomDisabled: Qe = !1,
75
- className: Te,
76
- rootClassName: et,
77
- tableClassName: tt,
78
- headerClassName: nt,
79
- getRowClassName: se,
80
- onRowClick: le,
81
- onRowHover: $,
82
- toolbar: ot,
83
- renderToolbar: ae,
84
- pagination: _e,
85
- summaryRow: rt,
86
- rowGroups: F,
87
- renderGroupHeader: de,
88
- collapsedGroupIds: it,
89
- defaultCollapsedGroupIds: st = [],
90
- onCollapsedGroupIdsChange: lt,
91
- enableSorting: Le = !1,
92
- sorting: at,
93
- defaultSorting: dt = [],
94
- onSortingChange: ct,
95
- columnVisibility: ut,
96
- defaultColumnVisibility: mt = {},
97
- onColumnVisibilityChange: ft,
98
- columnOrder: pt,
99
- defaultColumnOrder: bt = [],
100
- onColumnOrderChange: ht,
101
- selectionMode: U = "none",
102
- rowSelection: gt,
103
- defaultRowSelection: xt = {},
104
- onRowSelectionChange: yt,
105
- expanded: wt,
106
- defaultExpanded: vt = {},
107
- onExpandedChange: Ct,
108
- expansionMode: ce = "multiple",
109
- getRowCanExpand: ue,
110
- renderExpandedContent: Z,
111
- onCellClick: me,
112
- onCellDoubleClick: fe,
113
- onCellActivate: W,
114
- cellSelection: H,
115
- onCellSelectionChange: P,
116
- onCopyCells: St,
117
- onPasteCells: It,
118
- onClearCells: Nt,
119
- onReorderRows: Re,
120
- enableRowReorder: Et,
121
- activateOnSingleClick: Tt
122
- }, q) {
123
- var Me;
124
- const { zoomConfig: N, zoomPercent: V, setZoomPercent: We } = Rn(Je), y = N !== null && jn, j = y ? V / 100 : 1, G = y ? An(V) : void 0, _t = (N == null ? void 0 : N.minZoom) ?? Wn, [Lt, Rt] = z(
125
- at,
126
- dt,
127
- ct
128
- ), [Wt, Dt] = z(
129
- ut,
130
- mt,
131
- ft
132
- ), [kt, Ot] = z(
133
- pt,
134
- bt,
135
- ht
136
- ), [zt, At] = z(
137
- gt,
138
- xt,
139
- yt
140
- ), [Ft, De] = z(
141
- wt,
142
- vt,
143
- Ct
144
- ), pe = r.length > 0 ? c(r[0], 0) : void 0, Pt = Xe(
145
- Ft,
146
- ce,
172
+ getRowId: u,
173
+ ariaLabel: y,
174
+ headerGroups: I,
175
+ size: g = "xs",
176
+ loading: E = !1,
177
+ loadingRowCount: h = Ur,
178
+ emptyState: A = "No data found",
179
+ showBorders: _ = !1,
180
+ removeRowBorders: V = !1,
181
+ fillWidth: z = !1,
182
+ zoom: Kt,
183
+ zoomDisabled: Zt = !1,
184
+ className: rt,
185
+ rootClassName: Gt,
186
+ tableClassName: qt,
187
+ headerClassName: Jt,
188
+ getRowClassName: ze,
189
+ onRowClick: Pe,
190
+ onRowHover: ue,
191
+ toolbar: Qt,
192
+ renderToolbar: We,
193
+ pagination: ot,
194
+ summaryRow: en,
195
+ rowGroups: re,
196
+ renderGroupHeader: Oe,
197
+ collapsedGroupIds: tn,
198
+ defaultCollapsedGroupIds: nn = [],
199
+ onCollapsedGroupIdsChange: rn,
200
+ enableSorting: it = !1,
201
+ sorting: on,
202
+ defaultSorting: sn = [],
203
+ onSortingChange: ln,
204
+ columnVisibility: an,
205
+ defaultColumnVisibility: cn = {},
206
+ onColumnVisibilityChange: dn,
207
+ columnOrder: un,
208
+ defaultColumnOrder: mn = [],
209
+ onColumnOrderChange: pn,
210
+ enableColumnReorder: fn = !1,
211
+ enableColumnResize: gn = !1,
212
+ columnWidths: oe = {},
213
+ onColumnWidthsChange: me,
214
+ selectionMode: pe = "none",
215
+ rowSelection: hn,
216
+ defaultRowSelection: bn = {},
217
+ onRowSelectionChange: wn,
218
+ expanded: xn,
219
+ defaultExpanded: yn = {},
220
+ onExpandedChange: vn,
221
+ expansionMode: Me = "multiple",
222
+ getRowCanExpand: ke,
223
+ renderExpandedContent: fe,
224
+ onCellClick: Ae,
225
+ onCellDoubleClick: Fe,
226
+ onCellActivate: Z,
227
+ cellSelection: ge,
228
+ onCellSelectionChange: ie,
229
+ onCopyCells: Cn,
230
+ onPasteCells: Sn,
231
+ onClearCells: In,
232
+ onReorderRows: st,
233
+ enableRowReorder: En,
234
+ activateOnSingleClick: Ln
235
+ }, he) {
236
+ var _t;
237
+ const { zoomConfig: $, zoomPercent: se, setZoomPercent: lt } = Or(Kt), R = $ !== null && qr, H = R ? se / 100 : 1, be = R ? $r(se) : void 0, Rn = ($ == null ? void 0 : $.minZoom) ?? Mr, le = R ? De(Qe) : Br, [Nn, Tn] = ne(
238
+ on,
239
+ sn,
240
+ ln
241
+ ), [Dn, _n] = ne(
242
+ an,
243
+ cn,
244
+ dn
245
+ ), [zn, Ve] = ne(
246
+ un,
247
+ mn,
248
+ pn
249
+ ), [Pn, Wn] = ne(
250
+ hn,
251
+ bn,
252
+ wn
253
+ ), [On, at] = ne(
254
+ xn,
255
+ yn,
256
+ vn
257
+ ), $e = o.length > 0 ? u(o[0], 0) : void 0, Mn = Ut(
258
+ On,
259
+ Me,
147
260
  void 0,
148
- pe
149
- ), Vt = A(
150
- (e) => {
151
- De(
152
- (t) => Xe(
153
- Ye(e, t),
154
- ce,
155
- t,
156
- pe
261
+ $e
262
+ ), kn = f(
263
+ (t) => {
264
+ at(
265
+ (e) => Ut(
266
+ Yt(t, e),
267
+ Me,
268
+ e,
269
+ $e
157
270
  )
158
271
  );
159
272
  },
160
- [ce, pe, De]
161
- ), [ke, Oe] = z(
162
- it,
163
- st,
164
- lt
165
- ), be = v(
166
- () => new Set(ke),
167
- [ke]
168
- ), jt = A(
169
- (e) => Oe(
170
- (t) => t.includes(e) ? t.filter((o) => o !== e) : [...t, e]
273
+ [Me, $e, at]
274
+ ), [ct, dt] = ne(
275
+ tn,
276
+ nn,
277
+ rn
278
+ ), He = M(
279
+ () => new Set(ct),
280
+ [ct]
281
+ ), An = f(
282
+ (t) => dt(
283
+ (e) => e.includes(t) ? e.filter((r) => r !== t) : [...e, t]
171
284
  ),
172
- [Oe]
173
- ), D = oe(null), [M, ze] = Ne(null), Mt = Ln({
174
- containerRef: D,
175
- zoomConfig: N,
176
- zoomPercent: V,
177
- setZoomPercent: We
285
+ [dt]
286
+ ), F = S(null), [ae, ut] = K(null), Fn = Wr({
287
+ containerRef: F,
288
+ zoomConfig: $,
289
+ zoomPercent: se,
290
+ setZoomPercent: lt
178
291
  });
179
- an(() => {
180
- if (!x) {
181
- ze(null);
292
+ Pt(() => {
293
+ if (!z) {
294
+ ut(null);
182
295
  return;
183
296
  }
184
- const e = D.current;
185
- if (!e || typeof ResizeObserver > "u") return;
186
- const t = () => {
187
- const n = e.clientWidth;
188
- n > 0 && ze(
189
- (s) => s === n ? s : n
297
+ const t = F.current;
298
+ if (!t || typeof ResizeObserver > "u") return;
299
+ const e = () => {
300
+ const n = t.clientWidth;
301
+ n > 0 && ut(
302
+ (i) => i === n ? i : n
190
303
  );
191
304
  };
192
- t();
193
- const o = new ResizeObserver(t);
194
- return o.observe(e), () => o.disconnect();
195
- }, [x, l.length, r.length, C]);
196
- const b = v(() => {
197
- if (!x) return null;
198
- const e = l.reduce(
199
- (n, s) => Ie(s) ? n + Ee(s.maxWidth) : n,
200
- 0
201
- ), t = l.filter((n) => !Ie(n));
202
- return { minTableWidth: t.reduce(
203
- (n, s) => n + $n(
204
- s,
205
- y ? Ee(qe) : re
305
+ e();
306
+ const r = new ResizeObserver(e);
307
+ return r.observe(t), () => r.disconnect();
308
+ }, [z, l.length, o.length, E]);
309
+ const N = M(() => {
310
+ if (!z) return null;
311
+ const t = (i) => {
312
+ const a = Xt(oe, i.id);
313
+ return a === void 0 ? void 0 : et(i, a, le);
314
+ }, e = l.reduce((i, a) => {
315
+ const d = t(a);
316
+ return d !== void 0 ? i + d : tt(a) ? i + De(a.maxWidth) : i;
317
+ }, 0), r = l.filter(
318
+ (i) => t(i) === void 0 && !tt(i)
319
+ );
320
+ return { minTableWidth: r.reduce(
321
+ (i, a) => i + eo(
322
+ a,
323
+ R ? De(Qe) : _e
206
324
  ),
207
325
  0
208
- ) + e, fixedTotal: e, flexibleCount: t.length };
209
- }, [x, l, y]), he = v(
210
- () => b ? kn(M, b.minTableWidth) : null,
211
- [M, b]
212
- ), ge = Fn(
213
- he,
214
- M,
215
- j
216
- ), B = v(
217
- () => On(he, M, j),
218
- [he, M, j]
219
- ), Ae = v(() => !b || b.flexibleCount === 0 ? null : zn(
220
- B,
221
- b.fixedTotal,
222
- b.flexibleCount
223
- ), [b, B]), X = (e, t) => {
224
- const o = Kn(e, t);
225
- return !x || !e ? o : Ie(e) ? {
226
- ...o,
227
- width: e.maxWidth,
228
- minWidth: e.maxWidth,
229
- maxWidth: e.maxWidth
230
- } : Ae == null ? o : {
231
- ...o,
232
- width: `${Ae}px`,
233
- minWidth: e.minWidth ?? (y ? qe : `${re}px`)
326
+ ) + e, fixedTotal: e, flexibleCount: r.length };
327
+ }, [z, l, oe, R, le]), Xe = M(
328
+ () => N ? Ar(ae, N.minTableWidth) : null,
329
+ [ae, N]
330
+ ), Ue = Hr(
331
+ Xe,
332
+ ae,
333
+ H
334
+ ), we = M(
335
+ () => Fr(Xe, ae, H),
336
+ [Xe, ae, H]
337
+ ), mt = M(() => !N || N.flexibleCount === 0 ? null : Vr(
338
+ we,
339
+ N.fixedTotal,
340
+ N.flexibleCount
341
+ ), [N, we]), xe = (t, e) => {
342
+ const r = Xt(oe, t == null ? void 0 : t.id);
343
+ if (r !== void 0) {
344
+ const i = `${et(t, r, le)}px`;
345
+ return { ...$t(t, e), width: i, minWidth: i, maxWidth: i };
346
+ }
347
+ const n = $t(t, e);
348
+ return !z || !t ? n : tt(t) ? {
349
+ ...n,
350
+ width: t.maxWidth,
351
+ minWidth: t.maxWidth,
352
+ maxWidth: t.maxWidth
353
+ } : mt == null ? n : {
354
+ ...n,
355
+ width: `${mt}px`,
356
+ minWidth: t.minWidth ?? (R ? Qe : `${_e}px`)
234
357
  };
235
- }, xe = v(
236
- () => new Map(l.map((e) => [e.id, e])),
358
+ }, ce = M(
359
+ () => new Map(l.map((t) => [t.id, t])),
237
360
  [l]
238
- ), Kt = v(
239
- () => Nn(l, R),
240
- [l, R]
241
- ), S = cn({
242
- features: Tn,
243
- data: r,
244
- columns: Kt,
245
- getRowId: c,
246
- enableSorting: Le,
361
+ ), Vn = M(
362
+ () => Sr(l, I),
363
+ [l, I]
364
+ ), C = ar({
365
+ features: zr,
366
+ data: o,
367
+ columns: Vn,
368
+ getRowId: u,
369
+ enableSorting: it,
247
370
  enableCellSpanning: !0,
248
- enableRowSelection: U !== "none",
249
- enableMultiRowSelection: U === "multiple",
250
- getRowCanExpand: ue && Z ? (e) => ue(e.original) : () => !1,
371
+ enableRowSelection: pe !== "none",
372
+ enableMultiRowSelection: pe === "multiple",
373
+ getRowCanExpand: ke && fe ? (t) => ke(t.original) : () => !1,
251
374
  state: {
252
- sorting: Lt,
253
- columnVisibility: Wt,
254
- columnOrder: kt,
255
- rowSelection: zt,
256
- expanded: Pt
375
+ sorting: Nn,
376
+ columnVisibility: Dn,
377
+ columnOrder: zn,
378
+ rowSelection: Pn,
379
+ expanded: Mn
380
+ },
381
+ onSortingChange: Tn,
382
+ onColumnVisibilityChange: _n,
383
+ onColumnOrderChange: Ve,
384
+ onRowSelectionChange: Wn,
385
+ onExpandedChange: kn
386
+ }), [Be, pt] = K(null), [ft, gt] = K(null), [ht, je] = K(null), X = S(null), de = S(null), B = S(0), Ye = fn && l.length > 1, ye = gn && !!me, T = S(null), j = S(null), bt = S(oe);
387
+ bt.current = oe;
388
+ const [wt, xt] = K(null), G = S(null), k = S(null), $n = Gr(), Y = C.getRowModel().rows, q = f(() => {
389
+ var t;
390
+ (t = de.current) == null || t.call(de), de.current = null, B.current && (cancelAnimationFrame(B.current), B.current = 0);
391
+ }, []), yt = f(() => {
392
+ X.current = null, pt(null), gt(null), je(null);
393
+ }, []), vt = f(
394
+ (t, e, r) => {
395
+ if (t === e) return;
396
+ const n = C.getAllLeafColumns().map((p) => p.id), i = n.indexOf(t), a = n.indexOf(e);
397
+ if (i < 0 || a < 0) return;
398
+ const d = n.filter(
399
+ (p) => p !== t
400
+ ), P = d.indexOf(e);
401
+ d.splice(
402
+ P + (r === "after" ? 1 : 0),
403
+ 0,
404
+ t
405
+ ), Ve(d);
406
+ },
407
+ [Ve, C]
408
+ ), ve = f(
409
+ (t, e, r) => {
410
+ const n = Ir(t, e, r);
411
+ r.dropTarget = n, gt(n);
412
+ },
413
+ []
414
+ ), Ce = f(
415
+ (t) => {
416
+ const e = X.current, r = e == null ? void 0 : e.dropTarget, n = e == null ? void 0 : e.columnId, i = e == null ? void 0 : e.started;
417
+ q(), yt(), t && i && r && n && vt(n, r.columnId, r.position);
418
+ },
419
+ [
420
+ yt,
421
+ q,
422
+ vt
423
+ ]
424
+ ), Ct = f(() => {
425
+ if (B.current) return;
426
+ const t = () => {
427
+ var n;
428
+ const e = X.current;
429
+ if (!(e != null && e.started)) {
430
+ B.current = 0;
431
+ return;
432
+ }
433
+ const r = (n = e.tableViewport) == null ? void 0 : n.scrollContainer;
434
+ if (r) {
435
+ const i = Dr(r, e.currentX);
436
+ i !== 0 && (r.scrollLeft += i, ve(e.currentX, e.currentY, e));
437
+ }
438
+ B.current = requestAnimationFrame(t);
439
+ };
440
+ B.current = requestAnimationFrame(t);
441
+ }, [ve]), St = f(
442
+ (t, e) => {
443
+ const r = Er(
444
+ F.current,
445
+ t,
446
+ e
447
+ );
448
+ return r.length > 0 ? r : C.getRowModel().rows.slice(0, e).map((n) => Lr(n.getValue(t)));
449
+ },
450
+ [C]
451
+ );
452
+ ir(
453
+ () => () => {
454
+ var t, e;
455
+ q(), (t = T.current) == null || t.call(T), T.current = null, (e = k.current) == null || e.call(k), k.current = null, j.current = null, X.current = null;
456
+ },
457
+ [q]
458
+ );
459
+ const J = f(
460
+ (t) => {
461
+ var a;
462
+ const e = t == null ? void 0 : t.getBoundingClientRect(), r = (a = F.current) == null ? void 0 : a.getBoundingClientRect();
463
+ if (!e || !r) return null;
464
+ const n = e.top, i = r.width > 0 ? Math.min(
465
+ Math.max(e.right, r.left),
466
+ r.right - 1
467
+ ) : e.right;
468
+ return {
469
+ columnLeft: e.left,
470
+ lineLeft: i,
471
+ top: n,
472
+ height: Math.max(0, r.bottom - n)
473
+ };
474
+ },
475
+ []
476
+ ), It = f(
477
+ (t) => J(t.closest("th")),
478
+ [J]
479
+ ), Et = f(() => {
480
+ const t = j.current, e = F.current;
481
+ if (!t || !e || e.scrollWidth <= e.clientWidth) return;
482
+ const r = t.getBoundingClientRect(), n = e.getBoundingClientRect(), i = r.right - n.right;
483
+ i > 0 && (e.scrollLeft += i);
484
+ }, []), Se = f(() => {
485
+ var e;
486
+ Et();
487
+ const t = J(j.current);
488
+ t && ((e = G.current) == null || e.show(t, !0));
489
+ }, [Et, J]), D = f(() => {
490
+ var t, e;
491
+ (t = k.current) == null || t.call(k), k.current = null, (e = G.current) == null || e.hide();
492
+ }, []), Lt = f(
493
+ (t) => {
494
+ var n;
495
+ if (j.current) return;
496
+ const e = It(t);
497
+ if (!e || ((n = G.current) == null || n.show(e, !1), k.current)) return;
498
+ const r = { capture: !0, passive: !0 };
499
+ window.addEventListener("scroll", D, r), window.addEventListener("wheel", D, r), window.addEventListener("touchmove", D, r), window.addEventListener("resize", D), k.current = () => {
500
+ window.removeEventListener("scroll", D, r), window.removeEventListener("wheel", D, r), window.removeEventListener("touchmove", D, r), window.removeEventListener("resize", D);
501
+ };
502
+ },
503
+ [It, D]
504
+ );
505
+ Pt(() => {
506
+ wt && Se();
507
+ });
508
+ const Hn = f(
509
+ (t, e) => {
510
+ var Ne, zt;
511
+ if (!ye || e.button !== 0 || !me)
512
+ return;
513
+ e.preventDefault(), e.stopPropagation(), (Ne = T.current) == null || Ne.call(T);
514
+ const r = e.currentTarget.closest("th");
515
+ if (!r) return;
516
+ const n = ce.get(t), i = r.getBoundingClientRect().width / H, a = e.clientX, d = e.pointerId, P = document.body.style.cursor, p = document.body.style.userSelect;
517
+ document.body.style.userSelect = "none";
518
+ const m = document.createElement("style");
519
+ m.textContent = "*, *::before, *::after { cursor: col-resize !important; }", document.head.appendChild(m), D(), j.current = r, xt(t);
520
+ const c = J(r);
521
+ c && ((zt = G.current) == null || zt.show(c, !0));
522
+ let b = null;
523
+ const W = () => {
524
+ var U, te;
525
+ (U = T.current) == null || U.call(T), T.current = null, j.current = null, xt(null), (te = G.current) == null || te.hide();
526
+ }, O = (U) => {
527
+ if (U.pointerId !== d) return;
528
+ U.preventDefault();
529
+ const te = et(
530
+ n,
531
+ i + (U.clientX - a) / H,
532
+ le
533
+ );
534
+ te !== b && (b = te, me({ ...bt.current, [t]: te }));
535
+ }, v = (U) => {
536
+ U.pointerId === d && W();
537
+ };
538
+ window.addEventListener("pointermove", O), window.addEventListener("pointerup", v), window.addEventListener("pointercancel", v), window.addEventListener("scroll", Se, !0), window.addEventListener("blur", W), T.current = () => {
539
+ window.removeEventListener("pointermove", O), window.removeEventListener("pointerup", v), window.removeEventListener("pointercancel", v), window.removeEventListener("scroll", Se, !0), window.removeEventListener("blur", W), m.remove(), document.body.style.cursor = P, document.body.style.userSelect = p;
540
+ };
257
541
  },
258
- onSortingChange: Rt,
259
- onColumnVisibilityChange: Dt,
260
- onColumnOrderChange: Ot,
261
- onRowSelectionChange: At,
262
- onExpandedChange: Vt
263
- }), Y = U !== "none", $t = !!(ue && Z), Ut = Y ? 1 : 0, Zt = S.getVisibleLeafColumns().length, J = Math.max(
264
- Zt + Ut,
542
+ [
543
+ ye,
544
+ ce,
545
+ D,
546
+ J,
547
+ me,
548
+ le,
549
+ Se,
550
+ H
551
+ ]
552
+ ), Xn = f(
553
+ (t, e, r) => {
554
+ if (Ye)
555
+ return {
556
+ [Tr]: t,
557
+ [Nr]: e,
558
+ onPointerDown: (n) => {
559
+ if (n.button !== 0 || n.target.closest(
560
+ "[data-column-reorder-ignore]"
561
+ ))
562
+ return;
563
+ q();
564
+ const i = n.currentTarget.getBoundingClientRect();
565
+ X.current = {
566
+ columnId: t,
567
+ parentId: e,
568
+ label: r,
569
+ bounds: i,
570
+ tableViewport: Rr(n.currentTarget),
571
+ pointerId: n.pointerId,
572
+ startX: n.clientX,
573
+ startY: n.clientY,
574
+ currentX: n.clientX,
575
+ currentY: n.clientY,
576
+ started: !1,
577
+ dropTarget: null
578
+ };
579
+ try {
580
+ n.currentTarget.setPointerCapture(n.pointerId);
581
+ } catch {
582
+ }
583
+ const a = (m) => {
584
+ var W;
585
+ const c = X.current;
586
+ if (!c || c.pointerId !== m.pointerId) return;
587
+ c.currentX = m.clientX, c.currentY = m.clientY;
588
+ const b = Math.abs(m.clientX - c.startX) > Mt || Math.abs(m.clientY - c.startY) > Mt;
589
+ if (!(!c.started && !b)) {
590
+ if (m.preventDefault(), c.started)
591
+ je(
592
+ (O) => O && {
593
+ ...O,
594
+ left: m.clientX,
595
+ top: m.clientY
596
+ }
597
+ );
598
+ else {
599
+ c.started = !0;
600
+ const O = ((W = c.tableViewport) == null ? void 0 : W.height) || c.bounds.height || 36, v = c.bounds.height || 36, Ne = Math.max(
601
+ 1,
602
+ Math.ceil(
603
+ (O - v) / v
604
+ )
605
+ );
606
+ pt(c.columnId), je({
607
+ columnId: c.columnId,
608
+ label: c.label,
609
+ values: St(c.columnId, Ne),
610
+ left: m.clientX,
611
+ top: m.clientY,
612
+ width: c.bounds.width,
613
+ height: O
614
+ }), Ct();
615
+ }
616
+ ve(m.clientX, m.clientY, c);
617
+ }
618
+ }, d = (m) => {
619
+ const c = X.current;
620
+ !c || c.pointerId !== m.pointerId || Ce(!0);
621
+ }, P = (m) => {
622
+ const c = X.current;
623
+ !c || c.pointerId !== m.pointerId || Ce(!1);
624
+ }, p = () => Ce(!1);
625
+ window.addEventListener("pointermove", a), window.addEventListener("pointerup", d), window.addEventListener("pointercancel", P), window.addEventListener("blur", p), de.current = () => {
626
+ window.removeEventListener("pointermove", a), window.removeEventListener("pointerup", d), window.removeEventListener("pointercancel", P), window.removeEventListener("blur", p);
627
+ };
628
+ }
629
+ };
630
+ },
631
+ [
632
+ ve,
633
+ Ye,
634
+ q,
635
+ Ce,
636
+ St,
637
+ Ct
638
+ ]
639
+ ), Ie = pe !== "none", Un = !!(ke && fe), Bn = Ie ? 1 : 0, jn = C.getVisibleLeafColumns().length, Ee = Math.max(
640
+ jn + Bn,
265
641
  1
266
- ), Ht = Math.max(S.getHeaderGroups().length, 1), T = S.getRowModel().rows, ye = y && N ? /* @__PURE__ */ i(
267
- _n,
642
+ ), Yn = Math.max(C.getHeaderGroups().length, 1), Ke = R && $ ? /* @__PURE__ */ s(
643
+ Pr,
268
644
  {
269
- value: V,
270
- minValue: _t,
271
- maxValue: N.maxZoom,
272
- step: N.step,
273
- onChange: We,
274
- onFitToViewport: Mt,
275
- isDisabled: Qe
645
+ value: se,
646
+ minValue: Rn,
647
+ maxValue: $.maxZoom,
648
+ step: $.step,
649
+ onChange: lt,
650
+ onFitToViewport: Fn,
651
+ isDisabled: Zt
276
652
  }
277
- ) : null, Fe = ae ? ae({ zoomControl: ye, zoomPercent: V }) : ot, Pe = !ae && ye ? /* @__PURE__ */ i("div", { className: "flex justify-end", children: ye }) : null, qt = !!(Fe || Pe || _e), Gt = v(() => {
278
- const e = y ? {
279
- zoom: j,
280
- "--table-zoom-font-size": G ? `${G}px` : void 0
653
+ ) : null, Rt = We ? We({ zoomControl: Ke, zoomPercent: se }) : Qt, Nt = !We && Ke ? /* @__PURE__ */ s("div", { className: "flex justify-end", children: Ke }) : null, Kn = !!(Rt || Nt || ot), Zn = M(() => {
654
+ const t = R ? {
655
+ zoom: H,
656
+ "--table-zoom-font-size": be ? `${be}px` : void 0
281
657
  } : void 0;
282
- return !x || !b ? y ? { ...e, width: "max-content", minWidth: "100%" } : void 0 : y ? {
283
- ...e,
658
+ return !z || !N ? R ? { ...t, width: "max-content", minWidth: "100%" } : void 0 : R ? {
659
+ ...t,
284
660
  tableLayout: "fixed",
285
- width: `${B ?? b.minTableWidth}px`
661
+ width: `${we ?? N.minTableWidth}px`
286
662
  } : {
287
663
  tableLayout: "fixed",
288
- width: ge ? `${b.minTableWidth}px` : "100%"
664
+ width: Ue ? `${N.minTableWidth}px` : "100%"
289
665
  };
290
666
  }, [
291
- B,
292
- x,
293
- b,
294
- ge,
295
- y,
296
- j,
297
- G
298
- ]), Bt = oe(
667
+ we,
668
+ z,
669
+ N,
670
+ Ue,
671
+ R,
672
+ H,
673
+ be
674
+ ]), Gn = S(
299
675
  null
300
- ), [k, Xt] = Ne(null), Yt = !!W, Jt = A(
301
- (e, t, o) => {
302
- if (Bt.current = { rowId: e, columnKey: t }, !P) return;
303
- const n = H;
304
- n != null && n.anchor.rowId === e && n.anchor.columnKey === t && n.focus.rowId === e && n.focus.columnKey === t || P(
305
- pn({
306
- rowId: e,
307
- columnKey: t,
308
- sourceIndex: o ?? null
676
+ ), [Q, qn] = K(null), Jn = !!Z, Qn = f(
677
+ (t, e, r) => {
678
+ if (Gn.current = { rowId: t, columnKey: e }, !ie) return;
679
+ const n = ge;
680
+ n != null && n.anchor.rowId === t && n.anchor.columnKey === e && n.focus.rowId === t && n.focus.columnKey === e || ie(
681
+ mr({
682
+ rowId: t,
683
+ columnKey: e,
684
+ sourceIndex: r ?? null
309
685
  })
310
686
  );
311
687
  },
312
- [P, H]
313
- ), Qt = A(
314
- (e) => {
315
- Xt((t) => t === e || t && e && t.rowId === e.rowId && t.columnKey === e.columnKey ? t : e);
688
+ [ie, ge]
689
+ ), er = f(
690
+ (t) => {
691
+ qn((e) => e === t || e && t && e.rowId === t.rowId && e.columnKey === t.columnKey ? e : t);
316
692
  },
317
693
  []
318
- ), Q = !!Re && Et !== !1, u = xn({
319
- enabled: Q,
320
- onReorderRows: Re,
321
- containerRef: D
322
- }), en = A(
323
- (e, t, o) => {
694
+ ), Le = !!st && En !== !1, L = hr({
695
+ enabled: Le,
696
+ onReorderRows: st,
697
+ containerRef: F
698
+ }), tr = f(
699
+ (t, e, r) => {
324
700
  var n;
325
701
  return {
326
- row: e.original,
327
- rowId: e.id,
328
- columnId: t,
329
- value: o,
330
- rowIndex: e.index,
331
- sourceIndex: ne(e.original, e.index),
332
- isRowDragging: ((n = u.session) == null ? void 0 : n.active) === !0 && u.session.rowId === e.id,
333
- startRowDrag: Q ? (s) => u.startDrag(
334
- s,
335
- e.id,
336
- ne(e.original, e.index) ?? e.index,
337
- e.original
702
+ row: t.original,
703
+ rowId: t.id,
704
+ columnId: e,
705
+ value: r,
706
+ rowIndex: t.index,
707
+ sourceIndex: Te(t.original, t.index),
708
+ isRowDragging: ((n = L.session) == null ? void 0 : n.active) === !0 && L.session.rowId === t.id,
709
+ startRowDrag: Le ? (i) => L.startDrag(
710
+ i,
711
+ t.id,
712
+ Te(t.original, t.index) ?? t.index,
713
+ t.original
338
714
  ) : void 0
339
715
  };
340
716
  },
341
717
  // eslint-disable-next-line react-hooks/exhaustive-deps
342
- [Q, u.startDrag, u.session]
343
- ), we = T.map((e) => e.id).join("\0"), ve = v(
344
- () => we ? we.split("\0") : [],
345
- [we]
346
- ), Ce = S.getVisibleLeafColumns().map((e) => e.id).join("\0"), Se = v(
347
- () => Ce ? Ce.split("\0") : [],
348
- [Ce]
349
- ), O = typeof P == "function", ee = gn({
350
- enabled: O,
351
- selection: H,
352
- onSelectionChange: P,
353
- onCopyCells: St,
354
- onPasteCells: It,
355
- onClearCells: Nt,
356
- onActivateCell: W ? (e) => {
357
- const t = T.find((o) => o.id === e.rowId);
358
- t && W({
359
- row: t.original,
360
- rowId: e.rowId,
361
- columnId: e.columnKey,
718
+ [Le, L.startDrag, L.session]
719
+ ), Ze = Y.map((t) => t.id).join("\0"), Ge = M(
720
+ () => Ze ? Ze.split("\0") : [],
721
+ [Ze]
722
+ ), qe = C.getVisibleLeafColumns().map((t) => t.id).join("\0"), Je = M(
723
+ () => qe ? qe.split("\0") : [],
724
+ [qe]
725
+ ), ee = typeof ie == "function", Re = gr({
726
+ enabled: ee,
727
+ selection: ge,
728
+ onSelectionChange: ie,
729
+ onCopyCells: Cn,
730
+ onPasteCells: Sn,
731
+ onClearCells: In,
732
+ onActivateCell: Z ? (t) => {
733
+ const e = Y.find((r) => r.id === t.rowId);
734
+ e && Z({
735
+ row: e.original,
736
+ rowId: t.rowId,
737
+ columnId: t.columnKey,
362
738
  value: void 0,
363
- rowIndex: t.index,
364
- sourceIndex: e.sourceIndex ?? ne(t.original, t.index)
739
+ rowIndex: e.index,
740
+ sourceIndex: t.sourceIndex ?? Te(e.original, e.index)
365
741
  });
366
742
  } : void 0,
367
- activateOnSingleClick: Tt,
368
- containerRef: D,
369
- rowIds: ve,
370
- columnKeys: Se
371
- }), tn = v(() => {
372
- if (!(F != null && F.length)) return T.map((n) => ({ kind: "row", row: n }));
373
- const e = new Map(T.map((n) => [n.id, n])), t = /* @__PURE__ */ new Set(), o = [];
374
- for (const n of F) {
375
- const s = n.rowIds.map((h) => e.get(h)).filter((h) => h !== void 0);
376
- s.length !== 0 && (o.push({
743
+ activateOnSingleClick: Ln,
744
+ containerRef: F,
745
+ rowIds: Ge,
746
+ columnKeys: Je
747
+ }), nr = M(() => {
748
+ if (!(re != null && re.length)) return Y.map((n) => ({ kind: "row", row: n }));
749
+ const t = new Map(Y.map((n) => [n.id, n])), e = /* @__PURE__ */ new Set(), r = [];
750
+ for (const n of re) {
751
+ const i = n.rowIds.map((a) => t.get(a)).filter((a) => a !== void 0);
752
+ i.length !== 0 && (r.push({
377
753
  kind: "group",
378
- group: { id: n.id, label: n.label, rowCount: s.length }
379
- }), s.forEach((h) => t.add(h.id)), !be.has(n.id) && s.forEach((h) => o.push({ kind: "row", row: h })));
754
+ group: { id: n.id, label: n.label, rowCount: i.length }
755
+ }), i.forEach((a) => e.add(a.id)), !He.has(n.id) && i.forEach((a) => r.push({ kind: "row", row: a })));
380
756
  }
381
- for (const n of T)
382
- t.has(n.id) || o.push({ kind: "row", row: n });
383
- return o;
384
- }, [F, T, be]), nn = (e) => {
385
- const t = be.has(e.id), o = () => jt(e.id);
386
- return /* @__PURE__ */ i("tr", { className: "bg-secondary_subtle", children: /* @__PURE__ */ i(
757
+ for (const n of Y)
758
+ e.has(n.id) || r.push({ kind: "row", row: n });
759
+ return r;
760
+ }, [re, Y, He]), rr = (t) => {
761
+ const e = He.has(t.id), r = () => An(t.id);
762
+ return /* @__PURE__ */ s("tr", { className: "bg-secondary_subtle", children: /* @__PURE__ */ s(
387
763
  "td",
388
764
  {
389
- colSpan: J,
390
- className: d(
391
- !de && "py-1.5",
392
- g && "border-r border-secondary last:border-r-0"
765
+ colSpan: Ee,
766
+ className: w(
767
+ !Oe && "py-1.5",
768
+ _ && "border-r border-secondary last:border-r-0"
393
769
  ),
394
- children: de ? de({
395
- id: e.id,
396
- label: e.label,
397
- rowCount: e.rowCount,
398
- isCollapsed: t,
399
- toggle: o
400
- }) : /* @__PURE__ */ m(
770
+ children: Oe ? Oe({
771
+ id: t.id,
772
+ label: t.label,
773
+ rowCount: t.rowCount,
774
+ isCollapsed: e,
775
+ toggle: r
776
+ }) : /* @__PURE__ */ x(
401
777
  "button",
402
778
  {
403
779
  type: "button",
404
780
  className: "flex w-full items-center gap-2 px-2 text-left text-xs font-medium text-secondary",
405
- onClick: o,
406
- "aria-expanded": !t,
781
+ onClick: r,
782
+ "aria-expanded": !e,
407
783
  children: [
408
- /* @__PURE__ */ i(
409
- $e,
784
+ /* @__PURE__ */ s(
785
+ Wt,
410
786
  {
411
- className: d(
787
+ className: w(
412
788
  "size-4 shrink-0 text-fg-quaternary transition-transform",
413
- !t && "rotate-90"
789
+ !e && "rotate-90"
414
790
  )
415
791
  }
416
792
  ),
417
- /* @__PURE__ */ i("span", { className: "truncate", children: e.label || "(Empty)" }),
418
- /* @__PURE__ */ m("span", { className: "text-tertiary", children: [
793
+ /* @__PURE__ */ s("span", { className: "truncate", children: t.label || "(Empty)" }),
794
+ /* @__PURE__ */ x("span", { className: "text-tertiary", children: [
419
795
  "(",
420
- e.rowCount,
796
+ t.rowCount,
421
797
  ")"
422
798
  ] })
423
799
  ]
424
800
  }
425
801
  )
426
802
  }
427
- ) }, `group-${e.id}`);
428
- }, Ve = /* @__PURE__ */ m(
803
+ ) }, `group-${t.id}`);
804
+ }, Tt = /* @__PURE__ */ x(
429
805
  "div",
430
806
  {
431
- ref: (e) => {
432
- D.current = e, typeof q == "function" ? q(e) : q && (q.current = e);
807
+ ref: (t) => {
808
+ F.current = t, typeof he == "function" ? he(t) : he && (he.current = t);
433
809
  },
434
- onPointerDownCapture: O ? ee.onPointerDownCapture : void 0,
435
- onKeyDownCapture: O ? ee.onKeyDownCapture : void 0,
436
- onClickCapture: O ? ee.onClickCapture : void 0,
437
- onDoubleClickCapture: O ? ee.onDoubleClickCapture : void 0,
438
- className: d(
810
+ onPointerDownCapture: ee ? Re.onPointerDownCapture : void 0,
811
+ onKeyDownCapture: ee ? Re.onKeyDownCapture : void 0,
812
+ onClickCapture: ee ? Re.onClickCapture : void 0,
813
+ onDoubleClickCapture: ee ? Re.onDoubleClickCapture : void 0,
814
+ className: w(
439
815
  "w-full rounded-lg bg-primary",
440
- y || !x || ge ? "overflow-x-auto" : "overflow-x-hidden",
441
- g && "rounded-xl border border-secondary",
442
- et
816
+ R || !z || Ue ? "overflow-x-auto" : "overflow-x-hidden",
817
+ _ && "rounded-xl border border-secondary",
818
+ Gt
443
819
  ),
444
820
  children: [
445
- /* @__PURE__ */ m(
821
+ /* @__PURE__ */ x(
446
822
  "table",
447
823
  {
448
- "aria-label": L,
449
- "data-table-zoom-typography": G !== void 0 ? "" : void 0,
450
- className: d(
824
+ "aria-label": y,
825
+ "data-table-zoom-typography": be !== void 0 ? "" : void 0,
826
+ className: w(
451
827
  "w-full border-separate border-spacing-0 overflow-x-hidden",
452
- tt
828
+ qt
453
829
  ),
454
- style: Gt,
830
+ style: Zn,
455
831
  children: [
456
- /* @__PURE__ */ i(
832
+ /* @__PURE__ */ s(
457
833
  "thead",
458
834
  {
459
- className: d(
835
+ className: w(
460
836
  "sticky top-0 z-30 rounded-t-lg bg-secondary_subtle [&>tr>th]:h-9 [&>tr>th:first-child]:rounded-tl-lg [&>tr>th:last-child]:rounded-tr-lg",
461
- g && "[&>tr>th]:border-b [&>tr>th]:border-secondary [&>tr>th:first-child]:rounded-bl-none [&>tr>th:last-child]:rounded-br-none",
462
- nt
837
+ _ && "[&>tr>th]:border-b [&>tr>th]:border-secondary [&>tr>th:first-child]:rounded-bl-none [&>tr>th:last-child]:rounded-br-none",
838
+ Jt
463
839
  ),
464
- children: S.getHeaderGroups().map((e, t) => /* @__PURE__ */ m("tr", { children: [
465
- Y && t === 0 ? /* @__PURE__ */ i(
840
+ children: C.getHeaderGroups().map((t, e) => /* @__PURE__ */ x("tr", { children: [
841
+ Ie && e === 0 ? /* @__PURE__ */ s(
466
842
  "th",
467
843
  {
468
- rowSpan: Ht,
469
- className: d(
844
+ rowSpan: Yn,
845
+ className: w(
470
846
  "relative w-10 min-w-10 p-0 align-middle",
471
- g && "border-r border-secondary"
847
+ _ && "border-r border-secondary"
472
848
  ),
473
- children: U === "multiple" ? /* @__PURE__ */ i(
849
+ children: pe === "multiple" ? /* @__PURE__ */ s(
474
850
  "div",
475
851
  {
476
852
  className: "flex items-center justify-center",
477
- onClick: (o) => o.stopPropagation(),
478
- children: /* @__PURE__ */ i(
479
- Ue,
853
+ onClick: (r) => r.stopPropagation(),
854
+ children: /* @__PURE__ */ s(
855
+ Ot,
480
856
  {
481
- checked: S.getIsAllRowsSelected() ? !0 : S.getIsSomeRowsSelected() ? "indeterminate" : !1,
482
- onCheckedChange: (o) => S.toggleAllRowsSelected(o === !0),
857
+ checked: C.getIsAllRowsSelected() ? !0 : C.getIsSomeRowsSelected() ? "indeterminate" : !1,
858
+ onCheckedChange: (r) => C.toggleAllRowsSelected(r === !0),
483
859
  "aria-label": "Select all rows",
484
860
  className: "items-center justify-center"
485
861
  }
@@ -488,105 +864,141 @@ function Un({
488
864
  ) : null
489
865
  }
490
866
  ) : null,
491
- e.headers.map((o) => {
492
- if (o.rowSpan === 0) return null;
493
- const n = xe.get(o.column.id), s = o.column.getIsSorted(), h = Le && !o.isPlaceholder && o.column.getCanSort(), a = n != null && n.renderHeader ? n.renderHeader({
867
+ t.headers.map((r) => {
868
+ var c;
869
+ if (r.rowSpan === 0) return null;
870
+ const n = ce.get(r.column.id), i = r.column.getIsSorted(), a = it && !r.isPlaceholder && r.column.getCanSort(), d = Ye && !r.isPlaceholder && r.subHeaders.length === 0, P = ye && !r.isPlaceholder && r.subHeaders.length === 0 && !(n != null && n.sticky) && !(n != null && n.width), p = n != null && n.renderHeader ? n.renderHeader({
494
871
  columnId: n.id,
495
872
  label: n.header
496
- }) : o.isPlaceholder ? null : S.FlexRender({ header: o });
497
- return /* @__PURE__ */ i(
873
+ }) : r.isPlaceholder ? null : C.FlexRender({ header: r }), m = a && !(n != null && n.renderHeader);
874
+ return /* @__PURE__ */ x(
498
875
  "th",
499
876
  {
500
- colSpan: o.colSpan,
501
- rowSpan: o.rowSpan,
502
- scope: o.colSpan > 1 ? "colgroup" : "col",
503
- "aria-sort": s === "asc" ? "ascending" : s === "desc" ? "descending" : void 0,
504
- style: X(n, !0),
505
- className: d(
877
+ colSpan: r.colSpan,
878
+ rowSpan: r.rowSpan,
879
+ scope: r.colSpan > 1 ? "colgroup" : "col",
880
+ "aria-sort": i === "asc" ? "ascending" : i === "desc" ? "descending" : void 0,
881
+ style: xe(n, !0),
882
+ ...d ? Xn(
883
+ r.column.id,
884
+ ((c = r.column.parent) == null ? void 0 : c.id) ?? "",
885
+ p
886
+ ) : void 0,
887
+ className: w(
506
888
  "relative overflow-hidden p-0 outline-hidden focus-within:z-1 focus-within:ring-2 focus-within:ring-focus-ring focus-within:ring-inset",
507
- En[f],
508
- g && "border-r border-secondary last:border-r-0",
889
+ _r[g],
890
+ _ && "border-r border-secondary last:border-r-0",
891
+ d && "cursor-grab touch-none select-none active:cursor-grabbing",
892
+ wt === r.column.id && "select-none",
893
+ Be === r.column.id && "opacity-40 blur-[1.5px]",
509
894
  n == null ? void 0 : n.headerClassName
510
895
  ),
511
- children: h ? /* @__PURE__ */ m(
512
- "button",
513
- {
514
- type: "button",
515
- className: d(
516
- "flex w-full items-center gap-1 overflow-hidden rounded outline-none",
517
- Ge(n == null ? void 0 : n.align)
518
- ),
519
- onClick: o.column.getToggleSortingHandler(),
520
- "aria-label": `Sort by ${String((n == null ? void 0 : n.header) ?? o.column.id)}`,
521
- children: [
522
- /* @__PURE__ */ i("span", { className: "overflow-hidden text-ellipsis whitespace-nowrap text-xs font-medium text-secondary", children: a }),
523
- s ? /* @__PURE__ */ i(
524
- un,
525
- {
526
- className: d(
527
- "size-3 shrink-0 stroke-[3px] text-fg-quaternary",
528
- s === "asc" && "rotate-180"
529
- )
530
- }
531
- ) : /* @__PURE__ */ i(
532
- mn,
533
- {
534
- size: 12,
535
- strokeWidth: 3,
536
- className: "shrink-0 text-fg-quaternary"
537
- }
538
- )
539
- ]
540
- }
541
- ) : /* @__PURE__ */ i(
542
- "div",
543
- {
544
- className: d(
545
- "flex items-center gap-1 overflow-hidden",
546
- Ge(n == null ? void 0 : n.align)
547
- ),
548
- children: /* @__PURE__ */ i("div", { className: "flex items-center overflow-hidden text-ellipsis whitespace-nowrap text-xs font-medium text-secondary", children: a })
549
- }
550
- )
896
+ children: [
897
+ m ? /* @__PURE__ */ x(
898
+ "button",
899
+ {
900
+ type: "button",
901
+ className: w(
902
+ "flex w-full items-center gap-1 overflow-hidden rounded outline-none",
903
+ Ft(n == null ? void 0 : n.align)
904
+ ),
905
+ onClick: r.column.getToggleSortingHandler(),
906
+ "aria-label": `Sort by ${String((n == null ? void 0 : n.header) ?? r.column.id)}`,
907
+ children: [
908
+ /* @__PURE__ */ s("span", { className: "overflow-hidden text-ellipsis whitespace-nowrap text-xs font-medium text-secondary", children: p }),
909
+ i ? /* @__PURE__ */ s(
910
+ cr,
911
+ {
912
+ className: w(
913
+ "size-3 shrink-0 stroke-[3px] text-fg-quaternary",
914
+ i === "asc" && "rotate-180"
915
+ )
916
+ }
917
+ ) : /* @__PURE__ */ s(
918
+ dr,
919
+ {
920
+ size: 12,
921
+ strokeWidth: 3,
922
+ className: "shrink-0 text-fg-quaternary"
923
+ }
924
+ )
925
+ ]
926
+ }
927
+ ) : /* @__PURE__ */ s(
928
+ "div",
929
+ {
930
+ className: w(
931
+ "flex items-center gap-1 overflow-hidden",
932
+ a && "cursor-pointer",
933
+ Ft(n == null ? void 0 : n.align)
934
+ ),
935
+ onClick: a ? r.column.getToggleSortingHandler() : void 0,
936
+ children: /* @__PURE__ */ s("div", { className: "flex items-center overflow-hidden text-ellipsis whitespace-nowrap text-xs font-medium text-secondary", children: p })
937
+ }
938
+ ),
939
+ P ? /* @__PURE__ */ s(
940
+ "div",
941
+ {
942
+ role: "separator",
943
+ "aria-orientation": "vertical",
944
+ "aria-label": `Resize ${String((n == null ? void 0 : n.header) ?? r.column.id)} column`,
945
+ "data-column-reorder-ignore": "",
946
+ className: w(
947
+ // The header cell clips its overflow, so a handle that hung past the
948
+ // right edge to straddle the shared border would be cut off there (and
949
+ // on the last column would stick out of the table). Keep the whole hit
950
+ // area inside the cell, hugging the edge it resizes.
951
+ "absolute inset-y-0 right-0 z-10 w-3 cursor-col-resize touch-none"
952
+ ),
953
+ onPointerDown: (b) => Hn(r.column.id, b),
954
+ onPointerEnter: (b) => Lt(b.currentTarget),
955
+ onPointerMove: (b) => Lt(b.currentTarget),
956
+ onPointerLeave: () => {
957
+ j.current || D();
958
+ }
959
+ }
960
+ ) : null
961
+ ]
551
962
  },
552
- o.id
963
+ r.id
553
964
  );
554
965
  })
555
- ] }, e.id))
966
+ ] }, t.id))
556
967
  }
557
968
  ),
558
- /* @__PURE__ */ m("tbody", { children: [
559
- C ? Array.from({ length: p }, (e, t) => /* @__PURE__ */ m(
969
+ /* @__PURE__ */ x("tbody", { children: [
970
+ E ? Array.from({ length: h }, (t, e) => /* @__PURE__ */ x(
560
971
  "tr",
561
972
  {
562
- className: Ze[f],
973
+ className: kt[g],
563
974
  "aria-hidden": "true",
564
975
  children: [
565
- Y ? /* @__PURE__ */ i(
976
+ Ie ? /* @__PURE__ */ s(
566
977
  "td",
567
978
  {
568
- className: d(
979
+ className: w(
569
980
  "w-10 min-w-10",
570
- g && "border-r border-secondary",
571
- !I && "border-b border-tertiary"
981
+ _ && "border-r border-secondary",
982
+ !V && "border-b border-tertiary"
572
983
  )
573
984
  }
574
985
  ) : null,
575
- S.getVisibleLeafColumns().map((o) => {
576
- const n = xe.get(o.id);
577
- return /* @__PURE__ */ i(
986
+ C.getVisibleLeafColumns().map((r) => {
987
+ const n = ce.get(r.id);
988
+ return /* @__PURE__ */ s(
578
989
  "td",
579
990
  {
580
- style: X(n, !1),
581
- className: d(
991
+ style: xe(n, !1),
992
+ className: w(
582
993
  "relative overflow-hidden text-secondary",
583
- He[f],
584
- g && "border-r border-secondary last:border-r-0",
585
- !I && "border-b border-tertiary",
994
+ At[g],
995
+ _ && "border-r border-secondary last:border-r-0",
996
+ !V && "border-b border-tertiary",
997
+ Be === r.id && "opacity-40 blur-[1.5px]",
586
998
  n == null ? void 0 : n.cellClassName
587
999
  ),
588
- children: /* @__PURE__ */ i(
589
- fn,
1000
+ children: /* @__PURE__ */ s(
1001
+ ur,
590
1002
  {
591
1003
  height: "14px",
592
1004
  width: "75%",
@@ -594,73 +1006,73 @@ function Un({
594
1006
  }
595
1007
  )
596
1008
  },
597
- o.id
1009
+ r.id
598
1010
  );
599
1011
  })
600
1012
  ]
601
1013
  },
602
- `loading-${t}`
603
- )) : T.length === 0 ? /* @__PURE__ */ i("tr", { children: /* @__PURE__ */ i(
1014
+ `loading-${e}`
1015
+ )) : Y.length === 0 ? /* @__PURE__ */ s("tr", { children: /* @__PURE__ */ s(
604
1016
  "td",
605
1017
  {
606
- colSpan: J,
1018
+ colSpan: Ee,
607
1019
  className: "border-b border-secondary px-3 py-3 text-left text-xs text-placeholder_subtle",
608
- children: ie
1020
+ children: A
609
1021
  }
610
- ) }) : tn.map((e) => {
611
- var h;
612
- if (e.kind === "group")
613
- return nn(e.group);
614
- const t = e.row, o = $t && t.getCanExpand(), n = o && t.getIsExpanded(), s = t.getVisibleCells();
615
- return /* @__PURE__ */ m(dn, { children: [
616
- /* @__PURE__ */ m(
1022
+ ) }) : nr.map((t) => {
1023
+ var a;
1024
+ if (t.kind === "group")
1025
+ return rr(t.group);
1026
+ const e = t.row, r = Un && e.getCanExpand(), n = r && e.getIsExpanded(), i = e.getVisibleCells();
1027
+ return /* @__PURE__ */ x(sr, { children: [
1028
+ /* @__PURE__ */ x(
617
1029
  "tr",
618
1030
  {
619
- ...Q ? {
620
- [Cn]: t.id,
621
- [vn]: String(
622
- ne(t.original, t.index) ?? t.index
1031
+ ...Le ? {
1032
+ [yr]: e.id,
1033
+ [xr]: String(
1034
+ Te(e.original, e.index) ?? e.index
623
1035
  )
624
1036
  } : {},
625
- style: (h = u.session) != null && h.active && u.session.rowId === t.id ? wn : void 0,
626
- className: d(
1037
+ style: (a = L.session) != null && a.active && L.session.rowId === e.id ? wr : void 0,
1038
+ className: w(
627
1039
  // `focus-visible`, not `focus-within`: the ring marks the row itself being keyboard-focused.
628
1040
  // `focus-within` also fires for anything inside it, so an open cell
629
1041
  // editor outlined the entire row.
630
1042
  "relative outline-focus-ring transition-colors hover:bg-secondary_subtle focus-visible:outline-2 focus-visible:-outline-offset-2",
631
- Ze[f],
632
- t.getIsSelected() && "bg-secondary",
633
- le && "cursor-pointer",
634
- se == null ? void 0 : se(t.original)
1043
+ kt[g],
1044
+ e.getIsSelected() && "bg-secondary",
1045
+ Pe && "cursor-pointer",
1046
+ ze == null ? void 0 : ze(e.original)
635
1047
  ),
636
- onClick: (a) => {
637
- !le || Be(a.target) || le(t.original);
1048
+ onClick: (d) => {
1049
+ !Pe || Vt(d.target) || Pe(e.original);
638
1050
  },
639
- onMouseEnter: $ ? () => $(t.original, !0) : void 0,
640
- onMouseLeave: $ ? () => $(t.original, !1) : void 0,
1051
+ onMouseEnter: ue ? () => ue(e.original, !0) : void 0,
1052
+ onMouseLeave: ue ? () => ue(e.original, !1) : void 0,
641
1053
  children: [
642
- Y ? /* @__PURE__ */ i(
1054
+ Ie ? /* @__PURE__ */ s(
643
1055
  "td",
644
1056
  {
645
- className: d(
1057
+ className: w(
646
1058
  "relative w-10 min-w-10 p-0 text-center",
647
- g && "border-r border-secondary",
1059
+ _ && "border-r border-secondary",
648
1060
  // Matches the data cells, so the row separator
649
1061
  // runs the full width of the table.
650
- !I && !n && "border-b border-tertiary"
1062
+ !V && !n && "border-b border-tertiary"
651
1063
  ),
652
- children: /* @__PURE__ */ i(
1064
+ children: /* @__PURE__ */ s(
653
1065
  "div",
654
1066
  {
655
1067
  className: "flex items-center justify-center",
656
- onClick: (a) => a.stopPropagation(),
657
- onKeyDown: (a) => a.stopPropagation(),
658
- children: /* @__PURE__ */ i(
659
- Ue,
1068
+ onClick: (d) => d.stopPropagation(),
1069
+ onKeyDown: (d) => d.stopPropagation(),
1070
+ children: /* @__PURE__ */ s(
1071
+ Ot,
660
1072
  {
661
- checked: t.getIsSelected(),
662
- onCheckedChange: (a) => t.toggleSelected(a === !0),
663
- "aria-label": `Select row ${t.id}`,
1073
+ checked: e.getIsSelected(),
1074
+ onCheckedChange: (d) => e.toggleSelected(d === !0),
1075
+ "aria-label": `Select row ${e.id}`,
664
1076
  className: "items-center justify-center"
665
1077
  }
666
1078
  )
@@ -668,39 +1080,39 @@ function Un({
668
1080
  )
669
1081
  }
670
1082
  ) : null,
671
- s.map((a, Ke) => {
672
- if (a.getIsCovered()) return null;
673
- const w = xe.get(a.column.id);
674
- if (!w) return null;
675
- const K = en(
676
- t,
677
- w.id,
678
- a.getValue()
679
- ), on = w.renderCell ? w.renderCell(K) : String(a.getValue() ?? ""), E = O ? bn(
680
- H,
681
- t.id,
682
- w.id,
683
- ve,
684
- Se
685
- ) : null, te = !!(E != null && E.inRange), rn = (k == null ? void 0 : k.rowId) === t.id && (k == null ? void 0 : k.columnKey) === w.id;
686
- return /* @__PURE__ */ i(
1083
+ i.map((d, P) => {
1084
+ if (d.getIsCovered()) return null;
1085
+ const p = ce.get(d.column.id);
1086
+ if (!p) return null;
1087
+ const m = tr(
1088
+ e,
1089
+ p.id,
1090
+ d.getValue()
1091
+ ), c = p.renderCell ? p.renderCell(m) : String(d.getValue() ?? ""), b = ee ? pr(
1092
+ ge,
1093
+ e.id,
1094
+ p.id,
1095
+ Ge,
1096
+ Je
1097
+ ) : null, W = !!(b != null && b.inRange), O = (Q == null ? void 0 : Q.rowId) === e.id && (Q == null ? void 0 : Q.columnKey) === p.id;
1098
+ return /* @__PURE__ */ s(
687
1099
  "td",
688
1100
  {
689
- colSpan: a.getColSpan(),
690
- rowSpan: a.getRowSpan(),
691
- style: te && E ? {
692
- ...X(w, !1),
693
- boxShadow: hn(
694
- E.edges
1101
+ colSpan: d.getColSpan(),
1102
+ rowSpan: d.getRowSpan(),
1103
+ style: W && b ? {
1104
+ ...xe(p, !1),
1105
+ boxShadow: fr(
1106
+ b.edges
695
1107
  )
696
- } : X(w, !1),
1108
+ } : xe(p, !1),
697
1109
  "data-table-component-cell": "",
698
1110
  "data-grid-cell": "",
699
- "data-grid-row-id": t.id,
700
- "data-grid-col-key": w.id,
701
- "data-grid-source-index": K.sourceIndex ?? void 0,
702
- tabIndex: W ? 0 : void 0,
703
- className: d(
1111
+ "data-grid-row-id": e.id,
1112
+ "data-grid-col-key": p.id,
1113
+ "data-grid-source-index": m.sourceIndex ?? void 0,
1114
+ tabIndex: Z ? 0 : void 0,
1115
+ className: w(
704
1116
  // `overflow-hidden`, never `overflow-x-hidden`: when `overflow-x` is not
705
1117
  // `visible` the browser computes `overflow-y` to `auto`, turning
706
1118
  // every cell into its own scroll container that swallows the
@@ -709,102 +1121,106 @@ function Un({
709
1121
  // The cell holding an open editor must not clip it: a wrapped
710
1122
  // multi-line value has to be visible, and the row only grows
711
1123
  // around content the cell is allowed to show.
712
- rn ? "z-1 overflow-visible" : "overflow-hidden",
713
- He[f],
714
- Mn(w.align),
715
- g && "border-r border-secondary last:border-r-0",
716
- !I && !n && !te && "border-b border-tertiary",
717
- te && "z-1 outline-hidden",
718
- te && !(E != null && E.isAnchor) && "bg-utility-brand-25",
719
- w.cellClassName
1124
+ O ? "z-1 overflow-visible" : "overflow-hidden",
1125
+ At[g],
1126
+ Jr(p.align),
1127
+ _ && "border-r border-secondary last:border-r-0",
1128
+ !V && !n && !W && "border-b border-tertiary",
1129
+ W && "z-1 outline-hidden",
1130
+ W && !(b != null && b.isAnchor) && "bg-utility-brand-25",
1131
+ p.cellClassName,
1132
+ Be === p.id && "opacity-40 blur-[1.5px]"
720
1133
  ),
721
- onClick: (_) => {
722
- me == null || me(K), Ke === 0 && o && Be(_.target) && _.stopPropagation();
1134
+ onClick: (v) => {
1135
+ Ae == null || Ae(m), P === 0 && r && Vt(v.target) && v.stopPropagation();
723
1136
  },
724
- onDoubleClick: () => fe == null ? void 0 : fe(K),
725
- onKeyDown: (_) => {
726
- _.key !== "Enter" || !W || (_.preventDefault(), W(K));
1137
+ onDoubleClick: () => Fe == null ? void 0 : Fe(m),
1138
+ onKeyDown: (v) => {
1139
+ v.key !== "Enter" || !Z || (v.preventDefault(), Z(m));
727
1140
  },
728
- children: /* @__PURE__ */ m("div", { className: "flex min-w-0 items-center gap-2", children: [
729
- Ke === 0 && o ? /* @__PURE__ */ i(
1141
+ children: /* @__PURE__ */ x("div", { className: "flex min-w-0 items-center gap-2", children: [
1142
+ P === 0 && r ? /* @__PURE__ */ s(
730
1143
  "button",
731
1144
  {
732
1145
  type: "button",
733
- className: d(
1146
+ className: w(
734
1147
  "-ml-1 flex shrink-0 cursor-pointer items-center justify-center rounded p-1 transition-transform duration-200 ease-in-out hover:bg-secondary_subtle",
735
1148
  n && "rotate-90"
736
1149
  ),
737
1150
  "aria-label": n ? "Collapse row" : "Expand row",
738
1151
  "aria-expanded": n,
739
- "aria-controls": `${t.id}-detail`,
740
- onClick: (_) => {
741
- _.stopPropagation(), t.toggleExpanded();
1152
+ "aria-controls": `${e.id}-detail`,
1153
+ onClick: (v) => {
1154
+ v.stopPropagation(), e.toggleExpanded();
742
1155
  },
743
- children: /* @__PURE__ */ i($e, { className: "size-4 text-fg-quaternary" })
1156
+ children: /* @__PURE__ */ s(Wt, { className: "size-4 text-fg-quaternary" })
744
1157
  }
745
1158
  ) : null,
746
- /* @__PURE__ */ i("div", { className: "min-w-0 flex-1", children: on })
1159
+ /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: c })
747
1160
  ] })
748
1161
  },
749
- a.id
1162
+ d.id
750
1163
  );
751
1164
  })
752
1165
  ]
753
1166
  }
754
1167
  ),
755
- n && Z ? /* @__PURE__ */ i(
1168
+ n && fe ? /* @__PURE__ */ s(
756
1169
  "tr",
757
1170
  {
758
- id: `${t.id}-detail`,
1171
+ id: `${e.id}-detail`,
759
1172
  className: "relative bg-secondary_subtle",
760
- children: /* @__PURE__ */ i("td", { colSpan: J, className: "p-0", children: Z({
761
- row: t.original,
762
- rowId: t.id,
763
- colSpan: J,
764
- collapse: () => t.toggleExpanded(!1)
1173
+ children: /* @__PURE__ */ s("td", { colSpan: Ee, className: "p-0", children: fe({
1174
+ row: e.original,
1175
+ rowId: e.id,
1176
+ colSpan: Ee,
1177
+ collapse: () => e.toggleExpanded(!1)
765
1178
  }) })
766
1179
  }
767
1180
  ) : null
768
- ] }, t.id);
1181
+ ] }, e.id);
769
1182
  }),
770
- !C && rt
1183
+ !E && en
771
1184
  ] })
772
1185
  ]
773
1186
  }
774
1187
  ),
775
- ((Me = u.session) == null ? void 0 : Me.active) && /* @__PURE__ */ m(sn, { children: [
776
- /* @__PURE__ */ i(Sn, { session: u.session }),
777
- u.session.dropLineY !== null && /* @__PURE__ */ i(
778
- In,
1188
+ ((_t = L.session) == null ? void 0 : _t.active) && /* @__PURE__ */ x(Bt, { children: [
1189
+ /* @__PURE__ */ s(vr, { session: L.session }),
1190
+ L.session.dropLineY !== null && /* @__PURE__ */ s(
1191
+ Cr,
779
1192
  {
780
- y: u.session.dropLineY,
781
- left: u.session.dropLineLeft,
782
- width: u.session.dropLineWidth
1193
+ y: L.session.dropLineY,
1194
+ left: L.session.dropLineLeft,
1195
+ width: L.session.dropLineWidth
783
1196
  }
784
1197
  )
785
- ] })
1198
+ ] }),
1199
+ ht && /* @__PURE__ */ s(Yr, { preview: ht }),
1200
+ ft && /* @__PURE__ */ s(Kr, { target: ft }),
1201
+ ye && $n && /* @__PURE__ */ s(Zr, { ref: G })
786
1202
  ]
787
1203
  }
788
- ), je = qt ? /* @__PURE__ */ m("div", { className: d("flex flex-col gap-3", Te), children: [
789
- Fe,
790
- Pe,
791
- Ve,
792
- _e
793
- ] }) : /* @__PURE__ */ i("div", { className: Te, children: Ve });
794
- return Yt ? /* @__PURE__ */ i(
795
- yn,
1204
+ ), Dt = Kn ? /* @__PURE__ */ x("div", { className: w("flex flex-col gap-3", rt), children: [
1205
+ Rt,
1206
+ Nt,
1207
+ Tt,
1208
+ ot
1209
+ ] }) : /* @__PURE__ */ s("div", { className: rt, children: Tt });
1210
+ return Jn ? /* @__PURE__ */ s(
1211
+ br,
796
1212
  {
797
- rowIds: ve,
798
- columnKeys: Se,
799
- containerRef: D,
800
- onSelectCell: Jt,
801
- onEditingCellChange: Qt,
802
- children: je
1213
+ rowIds: Ge,
1214
+ columnKeys: Je,
1215
+ containerRef: F,
1216
+ onSelectCell: Qn,
1217
+ onEditingCellChange: er,
1218
+ children: Dt
803
1219
  }
804
- ) : je;
1220
+ ) : Dt;
805
1221
  }
806
- const uo = ln(Un);
1222
+ const Io = jt(to);
807
1223
  export {
808
- uo as TableComponent,
809
- uo as default
1224
+ Io as TableComponent,
1225
+ Io as default
810
1226
  };