@pibit.ai/cure-design-system 0.3.23 → 0.3.24

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.
Files changed (52) hide show
  1. package/dist/index.d.ts +2 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +157 -140
  4. package/dist/patterns/table/TableWrapper.d.ts.map +1 -1
  5. package/dist/patterns/table/TableWrapper.js +236 -233
  6. package/dist/patterns/table/index.d.ts +4 -1
  7. package/dist/patterns/table/index.d.ts.map +1 -1
  8. package/dist/patterns/table/integrateTableUndoRedo.d.ts +41 -0
  9. package/dist/patterns/table/integrateTableUndoRedo.d.ts.map +1 -0
  10. package/dist/patterns/table/integrateTableUndoRedo.js +63 -0
  11. package/dist/patterns/table/storyHelpers/useMockTableState.d.ts +3 -1
  12. package/dist/patterns/table/storyHelpers/useMockTableState.d.ts.map +1 -1
  13. package/dist/patterns/table/table.d.ts +2 -1
  14. package/dist/patterns/table/table.d.ts.map +1 -1
  15. package/dist/patterns/table/table.js +181 -155
  16. package/dist/patterns/table/tableUndoRedo.d.ts +38 -0
  17. package/dist/patterns/table/tableUndoRedo.d.ts.map +1 -0
  18. package/dist/patterns/table/tableUndoRedo.js +147 -0
  19. package/dist/patterns/table/toolbar/ColumnHeaderMenu.d.ts +4 -0
  20. package/dist/patterns/table/toolbar/ColumnHeaderMenu.d.ts.map +1 -1
  21. package/dist/patterns/table/toolbar/ColumnHeaderMenu.js +81 -77
  22. package/dist/patterns/table/toolbar/TableToolbar.d.ts +11 -2
  23. package/dist/patterns/table/toolbar/TableToolbar.d.ts.map +1 -1
  24. package/dist/patterns/table/toolbar/TableToolbar.js +163 -114
  25. package/dist/patterns/table/toolbar/index.d.ts +1 -1
  26. package/dist/patterns/table/toolbar/index.d.ts.map +1 -1
  27. package/dist/patterns/table/toolbar/useUndoRedoShortcuts.d.ts +9 -0
  28. package/dist/patterns/table/toolbar/useUndoRedoShortcuts.d.ts.map +1 -0
  29. package/dist/patterns/table/toolbar/useUndoRedoShortcuts.js +21 -0
  30. package/dist/patterns/table/types.d.ts +4 -1
  31. package/dist/patterns/table/types.d.ts.map +1 -1
  32. package/dist/patterns/table/useTableUndoRedo.d.ts +41 -0
  33. package/dist/patterns/table/useTableUndoRedo.d.ts.map +1 -0
  34. package/dist/patterns/table/useTableUndoRedo.js +168 -0
  35. package/dist/primitives/badge/badge.js +5 -5
  36. package/dist/primitives/input/input.d.ts +1 -1
  37. package/dist/primitives/input/input.d.ts.map +1 -1
  38. package/dist/primitives/input/input.js +63 -62
  39. package/dist/primitives/select/ExpandableSearchInput.d.ts +1 -1
  40. package/dist/primitives/select/ExpandableSearchInput.d.ts.map +1 -1
  41. package/dist/primitives/select/SearchInput.d.ts +2 -2
  42. package/dist/primitives/select/SearchInput.d.ts.map +1 -1
  43. package/dist/primitives/select/SearchInput.js +38 -37
  44. package/dist/primitives/select/combobox.d.ts.map +1 -1
  45. package/dist/primitives/select/combobox.js +48 -47
  46. package/dist/primitives/select/multi-select.d.ts.map +1 -1
  47. package/dist/primitives/select/multi-select.js +50 -49
  48. package/dist/styles/components.css +1 -1
  49. package/dist/utils/keyboard-shortcut.d.ts +4 -0
  50. package/dist/utils/keyboard-shortcut.d.ts.map +1 -0
  51. package/dist/utils/keyboard-shortcut.js +29 -0
  52. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
- import { jsx as i, jsxs as k } from "react/jsx-runtime";
2
- import { forwardRef as Bt, useState as J, useMemo as h, useCallback as V, useRef as Jt, useEffect as Vt, useLayoutEffect as Xt } from "react";
1
+ import { jsx as i, jsxs as S } from "react/jsx-runtime";
2
+ import { forwardRef as Bt, useState as J, useMemo as u, useCallback as V, useRef as Jt, useEffect as Vt, useLayoutEffect as Xt } from "react";
3
3
  import { ChevronRight as Yt } from "@untitledui/icons";
4
4
  import { cx as c } from "../../utils/cn.js";
5
- import { TableCard as Qt, Table as d } from "./table.js";
6
- import { TablePagination as Zt } from "./TablePagination.js";
7
- import { getEffectiveAlignment as ot, resolveColumnLabel as Ht, alignmentClass as Kt } from "./toolbar/tableToolbarHelpers.js";
5
+ import { TableCard as Ht, Table as d } from "./table.js";
6
+ import { TablePagination as Qt } from "./TablePagination.js";
7
+ import { getEffectiveAlignment as ot, resolveColumnLabel as Zt, alignmentClass as Kt } from "./toolbar/tableToolbarHelpers.js";
8
8
  import { findGridCell as er, isWithinCellEditor as tr, getGridNeighbor as rr, getGridTabNeighbor as nr, focusGridCell as ir, GridNavProvider as sr } from "./useGridKeyboardNavigation.js";
9
9
  import { BulkActionBar as ar } from "./toolbar/BulkActionBar.js";
10
10
  import { TableToolbar as lr } from "./toolbar/TableToolbar.js";
@@ -30,10 +30,10 @@ function wr(t, a, l) {
30
30
  function xr(t, a) {
31
31
  return t ? t === "all" ? a.length : t.size : 0;
32
32
  }
33
- function br(t, a) {
33
+ function gr(t, a) {
34
34
  return a.length === 0 ? !1 : t === "all" ? !0 : a.every((l) => (t == null ? void 0 : t.has(l)) ?? !1);
35
35
  }
36
- function gr(t, a) {
36
+ function br(t, a) {
37
37
  return t === "all" ? a.length > 0 : a.some((l) => (t == null ? void 0 : t.has(l)) ?? !1);
38
38
  }
39
39
  function mr(t) {
@@ -49,64 +49,64 @@ function Nr(t) {
49
49
  function at(t, a, l) {
50
50
  return l ? ot(l, a ?? /* @__PURE__ */ new Map()) : (a == null ? void 0 : a.get(t)) ?? "left";
51
51
  }
52
- const Te = "300px", Pe = (t) => {
52
+ const Oe = "300px", Te = (t) => {
53
53
  if (!t) return 0;
54
54
  const a = t.match(/^(\d+(?:\.\d+)?)px$/);
55
55
  return a ? Number(a[1]) : 0;
56
- }, A = (t) => !!(t.maxWidth && t.sticky === "right"), kr = (t) => ({
57
- maxWidth: t.maxWidth ?? Te,
56
+ }, G = (t) => !!(t.maxWidth && t.sticky === "right"), kr = (t) => ({
57
+ maxWidth: t.maxWidth ?? Oe,
58
58
  minWidth: t.minWidth
59
- }), lt = (t) => A(t) && t.maxWidth ? {
59
+ }), lt = (t) => G(t) && t.maxWidth ? {
60
60
  minWidth: t.maxWidth,
61
61
  width: t.maxWidth,
62
62
  maxWidth: t.maxWidth
63
63
  } : {
64
64
  minWidth: t.minWidth,
65
- maxWidth: t.maxWidth ?? Te
65
+ maxWidth: t.maxWidth ?? Oe
66
66
  }, Mr = Bt(
67
67
  function({
68
68
  data: a,
69
69
  columns: l,
70
70
  renderRowCell: Le,
71
71
  onRowClick: Y,
72
- onRowHover: L,
72
+ onRowHover: O,
73
73
  arialabel: dt,
74
- size: Oe = "sm",
74
+ size: ze = "sm",
75
75
  allowDefaultRowClass: ct = !1,
76
76
  centeredHeaders: ft = [],
77
77
  rootClassName: ht,
78
- removeBorders: ze,
78
+ removeBorders: Ae,
79
79
  headerClassName: ut,
80
80
  isRowExpandable: Ge,
81
81
  renderExpandedContent: yt,
82
82
  loading: P = !1,
83
- loadingRowCount: Ae = yr,
83
+ loadingRowCount: $e = yr,
84
84
  renderHeaderCell: ce,
85
85
  tableClassName: pt,
86
86
  getRowClassName: fe,
87
87
  selectionMode: $ = "none",
88
- selectedKeys: C,
89
- onSelectionChange: p,
88
+ selectedKeys: k,
89
+ onSelectionChange: w,
90
90
  inlineSelection: he = !1,
91
- toolbar: w,
91
+ toolbar: h,
92
92
  showToolbar: wt,
93
- toolbarTitle: $e,
94
- toolbarTrailing: je,
95
- disableExtendedTools: Fe,
93
+ toolbarTitle: je,
94
+ toolbarTrailing: Fe,
95
+ disableExtendedTools: ue,
96
96
  pagination: x,
97
- showBorders: Q,
97
+ showBorders: H,
98
98
  emptyState: Me,
99
99
  editChrome: v,
100
100
  showEditActions: xt = !1,
101
- searchCollapsible: Ue,
102
- isEditable: bt,
103
- toolbarSlot: ue,
104
- rowHeightClass: De,
105
- groupedData: O,
106
- showSummaryFooter: gt,
107
- summaryFooterProps: ye,
108
- bulkActionBar: Z,
109
- renderBulkActionBar: H,
101
+ searchCollapsible: De,
102
+ isEditable: gt,
103
+ toolbarSlot: ye,
104
+ rowHeightClass: Ue,
105
+ groupedData: L,
106
+ showSummaryFooter: bt,
107
+ summaryFooterProps: pe,
108
+ bulkActionBar: Q,
109
+ renderBulkActionBar: Z,
110
110
  onBulkDuplicate: K,
111
111
  onBulkDelete: ee,
112
112
  bulkActionBusy: te,
@@ -119,23 +119,23 @@ const Te = "300px", Pe = (t) => {
119
119
  columnSchema: F,
120
120
  labelMeta: kt,
121
121
  renderColumnHeaderMenuExtraItems: Ct,
122
- fillWidth: y = !1,
123
- rowActions: pe,
124
- onCellActivate: we
122
+ fillWidth: p = !1,
123
+ rowActions: we,
124
+ onCellActivate: xe
125
125
  }, M) {
126
126
  const [ne, St] = J(
127
127
  () => /* @__PURE__ */ new Set()
128
128
  ), [vt, Wt] = J(
129
129
  null
130
- ), [g, xe] = J(null), [G, Rt] = J(null), ie = $ === "single" || $ === "multiple", be = !!pe, W = ie && !he, ge = Nr(O), It = h(() => j != null && j.length ? new Map(j.map((e) => [e.key, e])) : /* @__PURE__ */ new Map(), [j]), Be = h(() => F != null && F.length ? new Map(F.map((e) => [e.value, e])) : /* @__PURE__ */ new Map(), [F]), se = h(
130
+ ), [b, ge] = J(null), [A, Rt] = J(null), ie = $ === "single" || $ === "multiple", be = !!we, W = ie && !he, me = Nr(L), It = u(() => j != null && j.length ? new Map(j.map((e) => [e.key, e])) : /* @__PURE__ */ new Map(), [j]), Be = u(() => F != null && F.length ? new Map(F.map((e) => [e.value, e])) : /* @__PURE__ */ new Map(), [F]), se = u(
131
131
  () => l.map((e) => e.key),
132
132
  [l]
133
- ), Et = V((e) => {
133
+ ), _t = V((e) => {
134
134
  St((r) => {
135
135
  const n = new Set(r);
136
136
  return n.has(e) ? n.delete(e) : n.add(e), n;
137
137
  });
138
- }, []), ae = h(() => P ? Array.from({ length: Ae }, (e, r) => ({
138
+ }, []), ae = u(() => P ? Array.from({ length: $e }, (e, r) => ({
139
139
  id: `loading-${r}`
140
140
  })) : a.map((e) => {
141
141
  const r = e;
@@ -143,93 +143,97 @@ const Te = "300px", Pe = (t) => {
143
143
  return r;
144
144
  const n = X(r);
145
145
  return r.id != null && String(r.id) === n ? r : { ...r, id: n };
146
- }), [P, a, Ae]), b = h(() => P ? [] : ge && O ? O.flatMap(
146
+ }), [P, a, $e]), g = u(() => P ? [] : me && L ? L.flatMap(
147
147
  (e) => ne.has(e.key) ? [] : e.rows.map((r) => X(r))
148
- ) : ae.map((e) => X(e)), [P, ge, O, ne, ae]), me = h(
149
- () => st(C, b),
150
- [C, b]
151
- ), Ne = xr(C, b), ke = Ne > 0, Je = ke && !!(Z ?? H ?? K ?? ee), U = h(() => {
152
- if (!ke) return;
148
+ ) : ae.map((e) => X(e)), [P, me, L, ne, ae]), Ne = u(
149
+ () => st(k, g),
150
+ [k, g]
151
+ ), ke = xr(k, g), Ce = ke > 0, Je = Ce && !!(Q ?? Z ?? K ?? ee), D = u(() => {
152
+ if (!Ce) return;
153
153
  const e = a.filter(
154
- (r) => me.has(X(r))
154
+ (r) => Ne.has(X(r))
155
155
  );
156
156
  return {
157
- selectedKeys: me,
157
+ selectedKeys: Ne,
158
158
  selectedRows: e,
159
- clearSelection: () => p == null ? void 0 : p(/* @__PURE__ */ new Set()),
159
+ clearSelection: () => w == null ? void 0 : w(/* @__PURE__ */ new Set()),
160
160
  busy: te
161
161
  };
162
162
  }, [
163
- ke,
164
- me,
163
+ Ce,
164
+ Ne,
165
165
  a,
166
- p,
166
+ w,
167
167
  te
168
- ]), Ve = h(() => {
169
- if (ue != null) return ue;
168
+ ]), Ve = u(() => {
169
+ if (ye != null) return ye;
170
170
  if (Je) {
171
- if (Z != null) return Z;
172
- if (H && U)
173
- return H(U);
174
- if (U && (K || ee))
171
+ if (Q != null) return Q;
172
+ if (Z && D)
173
+ return Z(D);
174
+ if (D && (K || ee))
175
175
  return /* @__PURE__ */ i(
176
176
  ar,
177
177
  {
178
- count: Ne,
178
+ count: ke,
179
179
  onDuplicate: K,
180
180
  onDelete: ee,
181
- onClearSelection: U.clearSelection,
181
+ onClearSelection: D.clearSelection,
182
182
  busy: te
183
183
  }
184
184
  );
185
185
  }
186
- return w ? /* @__PURE__ */ i(
186
+ return h ? /* @__PURE__ */ i(
187
187
  lr,
188
188
  {
189
- sort: w.sort,
190
- filter: w.filter,
191
- search: w.search,
192
- rowHeight: w.rowHeight,
193
- hideFields: w.hideFields,
194
- align: w.align,
195
- groupBy: w.groupBy,
196
- summary: w.summary,
197
- sortContent: w.sortContent,
198
- filterContent: w.filterContent,
199
- fallbackTitle: $e,
200
- trailing: je,
201
- searchCollapsible: Ue,
202
- disableExtendedTools: Fe
189
+ sort: h.sort,
190
+ filter: h.filter,
191
+ search: h.search,
192
+ rowHeight: h.rowHeight,
193
+ hideFields: h.hideFields,
194
+ align: h.align,
195
+ groupBy: h.groupBy,
196
+ summary: h.summary,
197
+ sortContent: h.sortContent,
198
+ filterContent: h.filterContent,
199
+ fallbackTitle: je,
200
+ trailing: Fe,
201
+ searchCollapsible: De,
202
+ disableExtendedTools: ue,
203
+ undoRedo: h.undoRedo ? {
204
+ ...h.undoRedo,
205
+ isDisabled: h.undoRedo.isDisabled ?? ue
206
+ } : void 0
203
207
  }
204
208
  ) : null;
205
209
  }, [
206
- ue,
210
+ ye,
207
211
  Je,
212
+ Q,
208
213
  Z,
209
- H,
210
- U,
214
+ D,
211
215
  K,
212
216
  ee,
213
217
  te,
214
- Ne,
215
- w,
216
- $e,
218
+ ke,
219
+ h,
217
220
  je,
218
- Ue,
219
- Fe
220
- ]), Xe = Ve != null && wt !== !1, Ye = !!x && (x == null ? void 0 : x.showPagination) !== !1, _t = Xe || Ye, Qe = !P && a.length === 0 && Me != null, m = !!(xt && v), Ce = !!(v != null && v.showFooterRow), T = bt ?? (m || Ce || be), Pt = Qe && !(Ce && v), D = l.length + (W ? 1 : 0) + (m ? 1 : 0), Tt = !!(gt && ye), u = Q ? "border-r border-secondary last:border-r-0" : void 0, I = h(() => {
221
- if (!y) return null;
221
+ Fe,
222
+ De,
223
+ ue
224
+ ]), Xe = Ve != null && wt !== !1, Ye = !!x && (x == null ? void 0 : x.showPagination) !== !1, Et = Xe || Ye, He = !P && a.length === 0 && Me != null, m = !!(xt && v), Se = !!(v != null && v.showFooterRow), T = gt ?? (m || Se || be), Pt = He && !(Se && v), U = l.length + (W ? 1 : 0) + (m ? 1 : 0), Tt = !!(bt && pe), y = H ? "border-r border-secondary last:border-r-0" : void 0, I = u(() => {
225
+ if (!p) return null;
222
226
  const e = l.reduce(
223
- (s, f) => A(f) ? s + Pe(f.maxWidth) : s,
227
+ (s, f) => G(f) ? s + Te(f.maxWidth) : s,
224
228
  0
225
229
  );
226
230
  return { minTableWidth: l.filter(
227
- (s) => !A(s)
231
+ (s) => !G(s)
228
232
  ).reduce(
229
- (s, f) => s + Pe(f.minWidth),
233
+ (s, f) => s + Te(f.minWidth),
230
234
  0
231
235
  ) + e };
232
- }, [l, y]), Lt = h(() => {
236
+ }, [l, p]), Ot = u(() => {
233
237
  const e = /* @__PURE__ */ new Map();
234
238
  return re && l.forEach((r) => {
235
239
  e.set(
@@ -237,7 +241,7 @@ const Te = "300px", Pe = (t) => {
237
241
  (n) => re(r.key, n)
238
242
  );
239
243
  }), e;
240
- }, [l, re]), R = Jt(null), [q, Ze] = J(null), Se = V(
244
+ }, [l, re]), R = Jt(null), [q, Qe] = J(null), ve = V(
241
245
  (e, r, n) => {
242
246
  var f;
243
247
  let s = n ?? null;
@@ -246,20 +250,20 @@ const Te = "300px", Pe = (t) => {
246
250
  R.current,
247
251
  e,
248
252
  r
249
- )) == null ? void 0 : f.getAttribute("data-grid-source-index"), E = N != null && N !== "" ? Number(N) : NaN;
250
- s = Number.isNaN(E) ? null : E;
253
+ )) == null ? void 0 : f.getAttribute("data-grid-source-index"), _ = N != null && N !== "" ? Number(N) : NaN;
254
+ s = Number.isNaN(_) ? null : _;
251
255
  }
252
- xe({ rowId: e, columnKey: r, sourceIndex: s });
256
+ ge({ rowId: e, columnKey: r, sourceIndex: s });
253
257
  },
254
258
  []
255
- ), Ot = V(
259
+ ), Lt = V(
256
260
  (e) => {
257
261
  var le, oe, de;
258
262
  const r = e.key in it;
259
263
  if (e.key !== "Enter" && e.key !== "Tab" && e.key !== "Escape" && !r || tr(e.target)) return;
260
264
  if (e.key === "Escape") {
261
- if (!g) return;
262
- e.preventDefault(), e.stopPropagation(), xe(null), (le = R.current) != null && le.contains(document.activeElement) && document.activeElement.blur();
265
+ if (!b) return;
266
+ e.preventDefault(), e.stopPropagation(), ge(null), (le = R.current) != null && le.contains(document.activeElement) && document.activeElement.blur();
263
267
  return;
264
268
  }
265
269
  const n = (de = (oe = e.target).closest) == null ? void 0 : de.call(
@@ -267,84 +271,84 @@ const Te = "300px", Pe = (t) => {
267
271
  "[data-grid-cell]"
268
272
  ), s = n == null ? void 0 : n.getAttribute("data-grid-row-id"), f = n == null ? void 0 : n.getAttribute("data-grid-col-key"), N = n == null ? void 0 : n.getAttribute(
269
273
  "data-grid-source-index"
270
- ), E = N != null && N !== "" ? Number(N) : NaN, o = Number.isNaN(E) ? null : E, S = g ?? (s && f ? {
274
+ ), _ = N != null && N !== "" ? Number(N) : NaN, o = Number.isNaN(_) ? null : _, C = b ?? (s && f ? {
271
275
  rowId: s,
272
276
  columnKey: f,
273
277
  sourceIndex: o
274
278
  } : null);
275
- if (!S) return;
279
+ if (!C) return;
276
280
  if (e.key === "Enter") {
277
- if (!we) return;
278
- e.preventDefault(), e.stopPropagation(), we({
279
- rowId: S.rowId,
280
- columnKey: S.columnKey,
281
- sourceIndex: S.sourceIndex
281
+ if (!xe) return;
282
+ e.preventDefault(), e.stopPropagation(), xe({
283
+ rowId: C.rowId,
284
+ columnKey: C.columnKey,
285
+ sourceIndex: C.sourceIndex
282
286
  });
283
287
  return;
284
288
  }
285
- const _ = r ? rr(
289
+ const E = r ? rr(
286
290
  R.current,
287
- b,
291
+ g,
288
292
  se,
289
- S.rowId,
290
- S.columnKey,
293
+ C.rowId,
294
+ C.columnKey,
291
295
  it[e.key]
292
296
  ) : nr(
293
297
  R.current,
294
- b,
298
+ g,
295
299
  se,
296
- S.rowId,
297
- S.columnKey,
300
+ C.rowId,
301
+ C.columnKey,
298
302
  !e.shiftKey
299
303
  );
300
- if (!_) {
304
+ if (!E) {
301
305
  r && (e.preventDefault(), e.stopPropagation());
302
306
  return;
303
307
  }
304
- e.preventDefault(), e.stopPropagation(), Se(_.rowId, _.columnKey, _.sourceIndex), requestAnimationFrame(
308
+ e.preventDefault(), e.stopPropagation(), ve(E.rowId, E.columnKey, E.sourceIndex), requestAnimationFrame(
305
309
  () => ir(
306
310
  R.current,
307
- _.rowId,
308
- _.columnKey
311
+ E.rowId,
312
+ E.columnKey
309
313
  )
310
314
  );
311
315
  },
312
- [g, b, se, we, Se]
316
+ [b, g, se, xe, ve]
313
317
  );
314
318
  Vt(() => {
315
- if (!T || !g) return;
319
+ if (!T || !b) return;
316
320
  const e = (r) => {
317
321
  const n = R.current;
318
- n && !n.contains(r.target) && xe(null);
322
+ n && !n.contains(r.target) && ge(null);
319
323
  };
320
324
  return document.addEventListener("pointerdown", e, !0), () => document.removeEventListener("pointerdown", e, !0);
321
- }, [T, g]);
322
- const He = h(() => {
325
+ }, [T, b]);
326
+ const Ze = u(() => {
323
327
  let e = 0;
324
328
  return W && (e += 40), m && (e += 56), l.forEach((r) => {
325
- A(r) && (e += Pe(r.maxWidth));
329
+ G(r) && (e += Te(r.maxWidth));
326
330
  }), e;
327
- }, [l, m, W]), ve = h(
328
- () => l.filter((e) => !A(e)).length,
331
+ }, [l, m, W]), We = u(
332
+ () => l.filter((e) => !G(e)).length,
329
333
  [l]
330
- ), We = h(() => {
331
- if (!y || !I) return null;
334
+ ), Re = u(() => {
335
+ if (!p || !I) return null;
332
336
  const { minTableWidth: e } = I;
333
337
  return q ? Math.max(q, e) : e;
334
- }, [q, y, I]), Re = !!(y && I && q && q < I.minTableWidth), Ie = h(() => !We || ve === 0 ? null : Math.max(
338
+ }, [q, p, I]), Ie = !!(p && I && q && q < I.minTableWidth), _e = u(() => !Re || We === 0 ? null : Math.max(
335
339
  0,
336
- (We - He) / ve
337
- ), [We, He, ve]);
340
+ (Re - Ze) / We
341
+ ), [Re, Ze, We]);
338
342
  Xt(() => {
339
- if (!y) {
340
- Ze(null);
343
+ if (!p) {
344
+ Qe(null);
341
345
  return;
342
346
  }
343
347
  const e = R.current;
344
348
  if (!e) return;
345
349
  const r = () => {
346
350
  const s = e.clientWidth;
347
- s > 0 && Ze((f) => f === s ? f : s);
351
+ s > 0 && Qe((f) => f === s ? f : s);
348
352
  };
349
353
  r();
350
354
  const n = new ResizeObserver(r);
@@ -354,56 +358,56 @@ const Te = "300px", Pe = (t) => {
354
358
  }, [
355
359
  l.length,
356
360
  a.length,
357
- y,
361
+ p,
358
362
  P,
359
363
  m,
360
364
  W
361
365
  ]);
362
366
  const Ee = V(
363
- (e) => y ? A(e) && e.maxWidth ? lt(e) : Ie != null ? {
364
- width: `${Ie}px`,
367
+ (e) => p ? G(e) && e.maxWidth ? lt(e) : _e != null ? {
368
+ width: `${_e}px`,
365
369
  minWidth: e.minWidth,
366
- maxWidth: e.maxWidth ?? Te
370
+ maxWidth: e.maxWidth ?? Oe
367
371
  } : lt(e) : kr(e),
368
- [y, Ie]
369
- ), zt = h(() => {
370
- if (!(!y || !I))
371
- return Re ? {
372
+ [p, _e]
373
+ ), zt = u(() => {
374
+ if (!(!p || !I))
375
+ return Ie ? {
372
376
  width: `${I.minTableWidth}px`,
373
377
  tableLayout: "fixed"
374
378
  } : {
375
379
  width: "100%",
376
380
  tableLayout: "fixed"
377
381
  };
378
- }, [y, I, Re]), Gt = V(
382
+ }, [p, I, Ie]), At = V(
379
383
  (e) => {
380
384
  R.current = e, typeof M == "function" ? M(e) : M && (M.current = e);
381
385
  },
382
386
  [M]
383
- ), At = ie ? {
387
+ ), Gt = ie ? {
384
388
  selectionMode: $,
385
- selectedKeys: C === "all" ? "all" : C,
386
- onSelectionChange: mr(p)
389
+ selectedKeys: k === "all" ? "all" : k,
390
+ onSelectionChange: mr(w)
387
391
  } : {}, $t = (e) => {
388
392
  const r = e.__sourceIndex;
389
393
  return typeof r == "number" ? r : 0;
390
- }, _e = ie && br(C, b), jt = ie && gr(C, b), Ft = () => {
391
- if (p) {
392
- if (_e) {
393
- p(/* @__PURE__ */ new Set());
394
+ }, Pe = ie && gr(k, g), jt = ie && br(k, g), Ft = () => {
395
+ if (w) {
396
+ if (Pe) {
397
+ w(/* @__PURE__ */ new Set());
394
398
  return;
395
399
  }
396
- p("all");
400
+ w("all");
397
401
  }
398
402
  }, Mt = (e, r) => {
399
- if (!p) return;
403
+ if (!w) return;
400
404
  if ($ === "single") {
401
- p(r ? /* @__PURE__ */ new Set([e]) : /* @__PURE__ */ new Set());
405
+ w(r ? /* @__PURE__ */ new Set([e]) : /* @__PURE__ */ new Set());
402
406
  return;
403
407
  }
404
- const n = C === "all" ? new Set(b) : new Set(st(C, b));
405
- r ? n.add(e) : n.delete(e), p(n);
406
- }, Ut = (e) => {
408
+ const n = k === "all" ? new Set(g) : new Set(st(k, g));
409
+ r ? n.add(e) : n.delete(e), w(n);
410
+ }, Dt = (e) => {
407
411
  const r = ne.has(e.key);
408
412
  return qe ? /* @__PURE__ */ i(
409
413
  d.Row,
@@ -411,7 +415,7 @@ const Te = "300px", Pe = (t) => {
411
415
  id: `group-${e.key}`,
412
416
  highlightSelectedRow: !1,
413
417
  className: "bg-secondary_subtle hover:bg-secondary_subtle",
414
- children: /* @__PURE__ */ i(d.Cell, { colSpan: D, className: c(u), children: qe(e) })
418
+ children: /* @__PURE__ */ i(d.Cell, { colSpan: U, className: c(y), children: qe(e) })
415
419
  },
416
420
  `group-${e.key}`
417
421
  ) : /* @__PURE__ */ i(
@@ -423,14 +427,14 @@ const Te = "300px", Pe = (t) => {
423
427
  children: /* @__PURE__ */ i(
424
428
  d.Cell,
425
429
  {
426
- colSpan: D,
427
- className: c("py-1.5", u),
428
- children: /* @__PURE__ */ k(
430
+ colSpan: U,
431
+ className: c("py-1.5", y),
432
+ children: /* @__PURE__ */ S(
429
433
  "button",
430
434
  {
431
435
  type: "button",
432
436
  className: "flex w-full items-center gap-2 px-2 text-left text-xs font-medium text-secondary",
433
- onClick: () => Et(e.key),
437
+ onClick: () => _t(e.key),
434
438
  "aria-expanded": !r,
435
439
  children: [
436
440
  /* @__PURE__ */ i(
@@ -443,7 +447,7 @@ const Te = "300px", Pe = (t) => {
443
447
  }
444
448
  ),
445
449
  /* @__PURE__ */ i("span", { className: "truncate", children: e.label || "(Empty)" }),
446
- /* @__PURE__ */ k("span", { className: "text-tertiary", children: [
450
+ /* @__PURE__ */ S("span", { className: "text-tertiary", children: [
447
451
  "(",
448
452
  e.rows.length,
449
453
  ")"
@@ -457,34 +461,34 @@ const Te = "300px", Pe = (t) => {
457
461
  `group-${e.key}`
458
462
  );
459
463
  }, Ke = (e, r) => {
460
- const n = Ge ? Ge(e) : !1, s = X(e), f = $t(e), N = wr(C, s, b), E = vt === s;
461
- return /* @__PURE__ */ k(
464
+ const n = Ge ? Ge(e) : !1, s = X(e), f = $t(e), N = wr(k, s, g), _ = vt === s;
465
+ return /* @__PURE__ */ S(
462
466
  d.Row,
463
467
  {
464
468
  onAction: () => Y == null ? void 0 : Y(e),
465
- onMouseEnter: () => L == null ? void 0 : L(e, !0),
466
- onMouseLeave: () => L == null ? void 0 : L(e, !1),
469
+ onMouseEnter: () => O == null ? void 0 : O(e, !0),
470
+ onMouseLeave: () => O == null ? void 0 : O(e, !1),
467
471
  id: s,
468
472
  value: e,
469
473
  columns: l,
470
- expandedColSpan: D,
474
+ expandedColSpan: U,
471
475
  isExpandable: n,
472
476
  highlightSelectedRow: !he,
473
477
  renderExpandedContent: n ? yt : void 0,
474
478
  className: c(
475
479
  Y && "cursor-pointer",
476
480
  ct ? "prose" : "",
477
- ze && "[&>td]:after:hidden",
481
+ Ae && "[&>td]:after:hidden",
478
482
  be && "group/rowactions",
479
- E && "bg-utility-brand-25 hover:bg-utility-brand-25",
480
- De,
483
+ _ && "bg-utility-brand-25 hover:bg-utility-brand-25",
484
+ Ue,
481
485
  fe == null ? void 0 : fe(e)
482
486
  ),
483
487
  children: [
484
488
  W && /* @__PURE__ */ i(
485
489
  d.Cell,
486
490
  {
487
- className: c("relative w-10 text-center", u),
491
+ className: c("relative w-10 text-center", y),
488
492
  style: { minWidth: "40px", width: "40px" },
489
493
  children: /* @__PURE__ */ i(
490
494
  "div",
@@ -505,12 +509,12 @@ const Te = "300px", Pe = (t) => {
505
509
  )
506
510
  }
507
511
  ),
508
- l.map((o, S) => {
509
- const _ = Be.get(o.key), le = at(
512
+ l.map((o, C) => {
513
+ const E = Be.get(o.key), le = at(
510
514
  o.key,
511
515
  z,
512
- _
513
- ), oe = (G == null ? void 0 : G.rowId) === s && (G == null ? void 0 : G.columnKey) === o.key, de = T && !oe && (g == null ? void 0 : g.rowId) === s && (g == null ? void 0 : g.columnKey) === o.key;
516
+ E
517
+ ), oe = (A == null ? void 0 : A.rowId) === s && (A == null ? void 0 : A.columnKey) === o.key, de = T && !oe && (b == null ? void 0 : b.rowId) === s && (b == null ? void 0 : b.columnKey) === o.key;
514
518
  return /* @__PURE__ */ i(
515
519
  d.Cell,
516
520
  {
@@ -530,11 +534,11 @@ const Te = "300px", Pe = (t) => {
530
534
  de && "z-1 outline-hidden ring-2 ring-inset ring-brand after:opacity-0",
531
535
  o.cellClassName,
532
536
  Kt(le),
533
- u
537
+ y
534
538
  ),
535
539
  children: (() => {
536
- const rt = S === 0 && (n || be) ? /* @__PURE__ */ k("div", { className: "flex items-center", children: [
537
- pe && /* @__PURE__ */ i(
540
+ const rt = C === 0 && (n || be) ? /* @__PURE__ */ S("div", { className: "flex items-center", children: [
541
+ we && /* @__PURE__ */ i(
538
542
  "div",
539
543
  {
540
544
  className: "flex items-center justify-center",
@@ -543,12 +547,12 @@ const Te = "300px", Pe = (t) => {
543
547
  children: /* @__PURE__ */ i(
544
548
  fr,
545
549
  {
546
- config: pe,
550
+ config: we,
547
551
  sourceRowIndex: f,
548
552
  item: e,
549
553
  triggerClassName: c(
550
554
  "transition-opacity group-hover/rowactions:opacity-100 focus-visible:opacity-100",
551
- E ? "opacity-100" : "opacity-0"
555
+ _ ? "opacity-100" : "opacity-0"
552
556
  ),
553
557
  onOpenChange: (B) => Wt(B ? s : null)
554
558
  }
@@ -574,7 +578,7 @@ const Te = "300px", Pe = (t) => {
574
578
  m && v && /* @__PURE__ */ i(
575
579
  d.Cell,
576
580
  {
577
- className: c("relative w-14 text-center", u),
581
+ className: c("relative w-14 text-center", y),
578
582
  style: { minWidth: "56px", width: "56px" },
579
583
  children: /* @__PURE__ */ i(
580
584
  "button",
@@ -595,17 +599,17 @@ const Te = "300px", Pe = (t) => {
595
599
  },
596
600
  s
597
601
  );
598
- }, Dt = (e) => /* @__PURE__ */ k(
602
+ }, Ut = (e) => /* @__PURE__ */ S(
599
603
  d.Row,
600
604
  {
601
605
  id: String(e.id),
602
606
  isExpandable: !1,
603
- className: c(ze && "[&>td]:after:hidden", De),
607
+ className: c(Ae && "[&>td]:after:hidden", Ue),
604
608
  children: [
605
609
  W && /* @__PURE__ */ i(
606
610
  d.Cell,
607
611
  {
608
- className: c("relative w-10", u),
612
+ className: c("relative w-10", y),
609
613
  style: { minWidth: "40px", width: "40px" }
610
614
  }
611
615
  ),
@@ -618,7 +622,7 @@ const Te = "300px", Pe = (t) => {
618
622
  className: c(
619
623
  "overflow-x-hidden text-left",
620
624
  r.cellClassName,
621
- u
625
+ y
622
626
  ),
623
627
  children: /* @__PURE__ */ i(ur, { height: "14px", width: "75%", className: "rounded" })
624
628
  },
@@ -627,49 +631,49 @@ const Te = "300px", Pe = (t) => {
627
631
  m && /* @__PURE__ */ i(
628
632
  d.Cell,
629
633
  {
630
- className: c("w-14", u),
634
+ className: c("w-14", y),
631
635
  style: { minWidth: "56px", width: "56px" }
632
636
  }
633
637
  )
634
638
  ]
635
639
  },
636
640
  String(e.id)
637
- ), qt = () => P ? ae.map((e) => Dt(e)) : ge && O ? O.flatMap((e) => {
641
+ ), qt = () => P ? ae.map((e) => Ut(e)) : me && L ? L.flatMap((e) => {
638
642
  const r = ne.has(e.key);
639
643
  return [
640
- Ut(e),
644
+ Dt(e),
641
645
  ...r ? [] : e.rows.map((n) => Ke(n))
642
646
  ];
643
647
  }) : ae.map((e) => Ke(e)), et = /* @__PURE__ */ i(
644
- Qt.Root,
648
+ Ht.Root,
645
649
  {
646
- ref: Gt,
647
- onKeyDownCapture: T ? Ot : void 0,
650
+ ref: At,
651
+ onKeyDownCapture: T ? Lt : void 0,
648
652
  className: c(
649
653
  "w-full",
650
- !y || Re ? "overflow-x-auto" : "overflow-x-hidden",
651
- Q && "border border-secondary rounded-xl",
654
+ !p || Ie ? "overflow-x-auto" : "overflow-x-hidden",
655
+ H && "border border-secondary rounded-xl",
652
656
  "[&_tr:hover>td]:!bg-secondary_subtle",
653
657
  ht
654
658
  ),
655
- size: Oe,
656
- children: /* @__PURE__ */ k(
659
+ size: ze,
660
+ children: /* @__PURE__ */ S(
657
661
  d,
658
662
  {
659
663
  "aria-label": dt,
660
- size: Oe,
664
+ size: ze,
661
665
  isEditable: T,
662
666
  inlineSelection: he,
663
- className: c(y && "min-w-full", pt),
667
+ className: c(p && "min-w-full", pt),
664
668
  style: zt,
665
- ...At,
669
+ ...Gt,
666
670
  children: [
667
- /* @__PURE__ */ k(
671
+ /* @__PURE__ */ S(
668
672
  d.Header,
669
673
  {
670
674
  className: c(
671
675
  "sticky top-0",
672
- Q && "[&>tr>th:first-child]:rounded-bl-none [&>tr>th:last-child]:rounded-br-none z-1",
676
+ H && "[&>tr>th:first-child]:rounded-bl-none [&>tr>th:last-child]:rounded-br-none z-1",
673
677
  ut
674
678
  ),
675
679
  children: [
@@ -680,12 +684,12 @@ const Te = "300px", Pe = (t) => {
680
684
  allowsSorting: !1,
681
685
  isRowHeader: !1,
682
686
  style: { minWidth: "40px", width: "40px" },
683
- className: c(u),
687
+ className: c(y),
684
688
  headerCellClass: "justify-center",
685
- children: $ === "multiple" && p && /* @__PURE__ */ i("div", { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ i(
689
+ children: $ === "multiple" && w && /* @__PURE__ */ i("div", { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ i(
686
690
  nt,
687
691
  {
688
- checked: _e ? !0 : jt && !_e ? "indeterminate" : !1,
692
+ checked: Pe ? !0 : jt && !Pe ? "indeterminate" : !1,
689
693
  onCheckedChange: () => Ft(),
690
694
  "aria-label": "Select all rows",
691
695
  className: "items-center justify-center"
@@ -700,7 +704,7 @@ const Te = "300px", Pe = (t) => {
700
704
  z,
701
705
  s
702
706
  ), N = ft.includes(e.key) || f === "center" ? "justify-center" : f === "right" ? "justify-end" : "";
703
- return /* @__PURE__ */ k(
707
+ return /* @__PURE__ */ i(
704
708
  d.Head,
705
709
  {
706
710
  sticky: e.sticky,
@@ -714,26 +718,25 @@ const Te = "300px", Pe = (t) => {
714
718
  className: c(
715
719
  "overflow-hidden",
716
720
  e.headClassName,
717
- u
721
+ y
718
722
  ),
719
- children: [
720
- n && re && /* @__PURE__ */ i(
721
- or,
722
- {
723
- column: n,
724
- columnLabel: n.label ?? (s ? Ht(s, kt) : e.label),
725
- currentAlignment: s ? ot(
726
- s,
727
- z ?? /* @__PURE__ */ new Map()
728
- ) : (z == null ? void 0 : z.get(e.key)) ?? "left",
729
- capabilities: Nt,
730
- hideDisabled: l.length <= 1,
731
- onAction: Lt.get(e.key),
732
- renderExtraItems: Ct
733
- }
734
- ),
735
- (ce == null ? void 0 : ce(e.key)) ?? null
736
- ]
723
+ headerAction: n && re ? /* @__PURE__ */ i(
724
+ or,
725
+ {
726
+ column: n,
727
+ columnLabel: n.label ?? (s ? Zt(s, kt) : e.label),
728
+ currentAlignment: s ? ot(
729
+ s,
730
+ z ?? /* @__PURE__ */ new Map()
731
+ ) : (z == null ? void 0 : z.get(e.key)) ?? "left",
732
+ capabilities: Nt,
733
+ hideDisabled: l.length <= 1,
734
+ onAction: Ot.get(e.key),
735
+ renderExtraItems: Ct,
736
+ showOnHeaderHover: !0
737
+ }
738
+ ) : void 0,
739
+ children: (ce == null ? void 0 : ce(e.key)) ?? null
737
740
  },
738
741
  e.key
739
742
  );
@@ -745,15 +748,15 @@ const Te = "300px", Pe = (t) => {
745
748
  allowsSorting: !1,
746
749
  isRowHeader: !1,
747
750
  style: { minWidth: "56px", width: "56px" },
748
- className: c(u)
751
+ className: c(y)
749
752
  },
750
753
  "actions"
751
754
  )
752
755
  ]
753
756
  }
754
757
  ),
755
- /* @__PURE__ */ k(d.Body, { children: [
756
- !Qe && qt(),
758
+ /* @__PURE__ */ S(d.Body, { children: [
759
+ !He && qt(),
757
760
  Pt && /* @__PURE__ */ i(
758
761
  d.Row,
759
762
  {
@@ -762,10 +765,10 @@ const Te = "300px", Pe = (t) => {
762
765
  children: /* @__PURE__ */ i(
763
766
  d.Cell,
764
767
  {
765
- colSpan: D,
768
+ colSpan: U,
766
769
  className: c(
767
770
  "text-left text-placeholder_subtle border-b border-secondary py-3",
768
- u
771
+ y
769
772
  ),
770
773
  children: Me
771
774
  }
@@ -773,7 +776,7 @@ const Te = "300px", Pe = (t) => {
773
776
  },
774
777
  "empty-state"
775
778
  ),
776
- Ce && v && /* @__PURE__ */ k(
779
+ Se && v && /* @__PURE__ */ S(
777
780
  d.Row,
778
781
  {
779
782
  id: "add-row-footer",
@@ -782,8 +785,8 @@ const Te = "300px", Pe = (t) => {
782
785
  /* @__PURE__ */ i(
783
786
  d.Cell,
784
787
  {
785
- colSpan: D - (m ? 1 : 0),
786
- className: c(u),
788
+ colSpan: U - (m ? 1 : 0),
789
+ className: c(y),
787
790
  children: /* @__PURE__ */ i(
788
791
  dr,
789
792
  {
@@ -799,7 +802,7 @@ const Te = "300px", Pe = (t) => {
799
802
  m && /* @__PURE__ */ i(
800
803
  d.Cell,
801
804
  {
802
- className: c("w-14", u),
805
+ className: c("w-14", y),
803
806
  style: { minWidth: "56px", width: "56px" }
804
807
  }
805
808
  )
@@ -807,13 +810,13 @@ const Te = "300px", Pe = (t) => {
807
810
  },
808
811
  "add-row-footer"
809
812
  ),
810
- Tt && ye && /* @__PURE__ */ i(
813
+ Tt && pe && /* @__PURE__ */ i(
811
814
  cr,
812
815
  {
813
- ...ye,
816
+ ...pe,
814
817
  hasActionsColumn: m,
815
818
  hasSelectionColumn: W,
816
- showBorders: !!Q
819
+ showBorders: !!H
817
820
  }
818
821
  )
819
822
  ] })
@@ -824,19 +827,19 @@ const Te = "300px", Pe = (t) => {
824
827
  ), tt = T ? /* @__PURE__ */ i(
825
828
  sr,
826
829
  {
827
- rowIds: b,
830
+ rowIds: g,
828
831
  columnKeys: se,
829
832
  containerRef: R,
830
- onSelectCell: Se,
833
+ onSelectCell: ve,
831
834
  onEditingCellChange: Rt,
832
835
  children: et
833
836
  }
834
837
  ) : et;
835
- return _t ? /* @__PURE__ */ k("div", { className: "flex flex-col gap-3", children: [
838
+ return Et ? /* @__PURE__ */ S("div", { className: "flex flex-col gap-3", children: [
836
839
  Xe && Ve,
837
840
  tt,
838
841
  Ye && x && /* @__PURE__ */ i(
839
- Zt,
842
+ Qt,
840
843
  {
841
844
  currentPage: x.currentPage,
842
845
  pageSize: x.pageSize,