@acronis-platform/ui-react 1.0.0 → 2.0.0

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 (58) hide show
  1. package/dist/components/ui/alert/alert.js +55 -55
  2. package/dist/components/ui/alert/alert.js.map +1 -1
  3. package/dist/components/ui/checkbox/checkbox.js +1 -1
  4. package/dist/components/ui/checkbox/checkbox.js.map +1 -1
  5. package/dist/components/ui/data-table/data-table-bulk-actions-bar.js +38 -0
  6. package/dist/components/ui/data-table/data-table-bulk-actions-bar.js.map +1 -0
  7. package/dist/components/ui/data-table/data-table-column-header.js +23 -20
  8. package/dist/components/ui/data-table/data-table-column-header.js.map +1 -1
  9. package/dist/components/ui/data-table/data-table-expand-trigger.js +23 -15
  10. package/dist/components/ui/data-table/data-table-expand-trigger.js.map +1 -1
  11. package/dist/components/ui/data-table/data-table-pagination.js +29 -28
  12. package/dist/components/ui/data-table/data-table-pagination.js.map +1 -1
  13. package/dist/components/ui/data-table/data-table-selection.js +7 -0
  14. package/dist/components/ui/data-table/data-table-selection.js.map +1 -0
  15. package/dist/components/ui/data-table/data-table-toolbar.js +21 -23
  16. package/dist/components/ui/data-table/data-table-toolbar.js.map +1 -1
  17. package/dist/components/ui/data-table/data-table-view-options.js +12 -10
  18. package/dist/components/ui/data-table/data-table-view-options.js.map +1 -1
  19. package/dist/components/ui/data-table/data-table.js +347 -183
  20. package/dist/components/ui/data-table/data-table.js.map +1 -1
  21. package/dist/components/ui/stepper/stepper.js +70 -0
  22. package/dist/components/ui/stepper/stepper.js.map +1 -0
  23. package/dist/components/ui/stepper-item/stepper-item.js +97 -0
  24. package/dist/components/ui/stepper-item/stepper-item.js.map +1 -0
  25. package/dist/components/ui/table/table-pagination.js +54 -47
  26. package/dist/components/ui/table/table-pagination.js.map +1 -1
  27. package/dist/components/ui/table/table-view-options.js +32 -19
  28. package/dist/components/ui/table/table-view-options.js.map +1 -1
  29. package/dist/components/ui/table/table.js +112 -63
  30. package/dist/components/ui/table/table.js.map +1 -1
  31. package/dist/components/ui/timeline/timeline.js +10 -10
  32. package/dist/components/ui/timeline/timeline.js.map +1 -1
  33. package/dist/components/ui/toast/toast.js +15 -15
  34. package/dist/components/ui/toast/toast.js.map +1 -1
  35. package/dist/index.js +386 -373
  36. package/dist/index.js.map +1 -1
  37. package/dist/react.js +386 -373
  38. package/dist/react.js.map +1 -1
  39. package/dist/src/components/ui/data-table/data-table-bulk-actions-bar.d.ts +26 -0
  40. package/dist/src/components/ui/data-table/data-table-column-header.d.ts +6 -1
  41. package/dist/src/components/ui/data-table/data-table-expand-trigger.d.ts +4 -0
  42. package/dist/src/components/ui/data-table/data-table-pagination.d.ts +15 -1
  43. package/dist/src/components/ui/data-table/data-table-selection.d.ts +11 -0
  44. package/dist/src/components/ui/data-table/data-table-view-options.d.ts +3 -2
  45. package/dist/src/components/ui/data-table/data-table.d.ts +88 -3
  46. package/dist/src/components/ui/data-table/data-table.docs.d.ts +61 -1
  47. package/dist/src/components/ui/data-table/index.d.ts +3 -1
  48. package/dist/src/components/ui/stepper/index.d.ts +1 -0
  49. package/dist/src/components/ui/stepper/stepper.d.ts +40 -0
  50. package/dist/src/components/ui/stepper-item/index.d.ts +1 -0
  51. package/dist/src/components/ui/stepper-item/stepper-item.d.ts +41 -0
  52. package/dist/src/components/ui/table/index.d.ts +1 -1
  53. package/dist/src/components/ui/table/table-pagination.d.ts +21 -0
  54. package/dist/src/components/ui/table/table-view-options.d.ts +9 -2
  55. package/dist/src/components/ui/table/table.d.ts +40 -1
  56. package/dist/src/index.d.ts +2 -0
  57. package/dist/ui-react.css +1 -1
  58. package/package.json +3 -3
@@ -1,266 +1,429 @@
1
- import { jsx as n, jsxs as y } from "react/jsx-runtime";
2
- import { useState as m, useEffect as ve, Fragment as K } from "react";
3
- import { useReactTable as Se, flexRender as k } from "../../../node_modules/.pnpm/@tanstack_react-table@8.21.3_react-dom@19.2.6_react@19.2.6__react@19.2.6/node_modules/@tanstack/react-table/build/lib/index.js";
4
- import { cn as h } from "../../../lib/utils.js";
5
- import { useIntersectionObserver as ye } from "../../../hooks/use-intersection-observer.js";
6
- import { Table as we, TableHeader as Re, TableRow as u, TableHead as xe, TableBody as ze, TableCell as g } from "../table/table.js";
7
- import { getFilteredRowModel as Ne, getSortedRowModel as Ce, getPaginationRowModel as De, getExpandedRowModel as Ie, getCoreRowModel as Me } from "../../../node_modules/.pnpm/@tanstack_table-core@8.21.3/node_modules/@tanstack/table-core/build/lib/index.js";
8
- function U(o) {
9
- const l = o.getIsPinned();
1
+ import { jsx as t, jsxs as v } from "react/jsx-runtime";
2
+ import { useState as g, useRef as so, useMemo as ne, useEffect as re, Fragment as L } from "react";
3
+ import { useReactTable as co, flexRender as ie } from "../../../node_modules/.pnpm/@tanstack_react-table@8.21.3_react-dom@19.2.6_react@19.2.6__react@19.2.6/node_modules/@tanstack/react-table/build/lib/index.js";
4
+ import { EllipsisIcon as uo } from "@acronis-platform/icons-react/stroke-mono";
5
+ import { cn as R } from "../../../lib/utils.js";
6
+ import { isBulkSelectionActive as mo } from "./data-table-selection.js";
7
+ import { DataTableViewOptions as go } from "./data-table-view-options.js";
8
+ import { useIntersectionObserver as fo } from "../../../hooks/use-intersection-observer.js";
9
+ import { Table as bo, TableHeader as po, TableRow as h, TableSettingsCell as vo, TableHead as ho, TableBody as So, TableCell as S, TableActionsCell as Do } from "../table/table.js";
10
+ import { TooltipProvider as yo, Tooltip as wo, TooltipTrigger as Ro, TooltipContent as Co } from "../tooltip/tooltip.js";
11
+ import { DropdownMenu as zo, DropdownMenuTrigger as xo, DropdownMenuContent as Io } from "../dropdown-menu/dropdown-menu.js";
12
+ import { ButtonIcon as No } from "../button-icon/button-icon.js";
13
+ import { getFilteredRowModel as Ao, getSortedRowModel as Mo, getPaginationRowModel as To, getExpandedRowModel as Eo, getCoreRowModel as _o } from "../../../node_modules/.pnpm/@tanstack_table-core@8.21.3/node_modules/@tanstack/table-core/build/lib/index.js";
14
+ function de(n) {
15
+ const l = n.getIsPinned();
10
16
  if (l)
11
17
  return {
12
18
  position: "sticky",
13
- left: l === "left" ? o.getStart("left") : void 0,
14
- right: l === "right" ? o.getAfter("right") : void 0,
19
+ left: l === "left" ? n.getStart("left") : void 0,
20
+ right: l === "right" ? n.getAfter("right") : void 0,
15
21
  zIndex: 1,
16
22
  // Derived from the same border token every other table divider uses (not a
17
23
  // hardcoded color), so the separator theme-adapts automatically.
18
24
  boxShadow: l === "left" ? "4px 0 4px -4px var(--ui-table-global-row-border-color)" : "-4px 0 4px -4px var(--ui-table-global-row-border-color)"
19
25
  };
20
26
  }
21
- function B(o, l) {
22
- if (l || o.columnDef.size !== void 0)
23
- return o.getSize();
27
+ function ue(n, l) {
28
+ if (l || n.columnDef.size !== void 0)
29
+ return n.getSize();
24
30
  }
25
- function Ee(o, l) {
26
- const i = U(o.column), s = B(o.column, l);
27
- if (!(!i && s === void 0))
28
- return { ...i, width: s };
31
+ function le(n, l) {
32
+ const a = de(n.column), c = ue(n.column, l);
33
+ if (!(!a && c === void 0))
34
+ return { ...a, width: c };
29
35
  }
30
- function _e(o, l) {
31
- const i = U(o.column), s = B(o.column, l);
32
- if (!(!i && s === void 0))
33
- return { ...i, width: s };
36
+ function ae(n, l) {
37
+ const a = de(n.column), c = ue(n.column, l);
38
+ if (!(!a && c === void 0))
39
+ return { ...a, width: c };
34
40
  }
35
- const L = 20, H = Number.MAX_SAFE_INTEGER;
36
- function Fe(o, l, { shiftKey: i, min: s, max: b }) {
37
- const p = i ? 50 : 10;
38
- if (o === "ArrowLeft")
39
- return Math.min(b, Math.max(s, l - p));
40
- if (o === "ArrowRight")
41
- return Math.max(s, Math.min(b, l + p));
41
+ const se = 20, ce = Number.MAX_SAFE_INTEGER;
42
+ function Fo(n, l, { shiftKey: a, min: c, max: f }) {
43
+ const b = a ? 50 : 10;
44
+ if (n === "ArrowLeft")
45
+ return Math.min(f, Math.max(c, l - b));
46
+ if (n === "ArrowRight")
47
+ return Math.max(c, Math.min(f, l + b));
42
48
  }
43
- function He({
44
- columns: o = [],
49
+ function ko(n, l, a) {
50
+ const c = n.indexOf(l), f = n.indexOf(a);
51
+ if (c === -1 || f === -1 || c === f) return n;
52
+ const b = [...n];
53
+ return b.splice(f, 0, b.splice(c, 1)[0]), b;
54
+ }
55
+ const Ho = {
56
+ sort: { label: "Sort column", action: "Click" },
57
+ reorder: { label: "Reorder column", action: "Drag" },
58
+ resize: { label: "Resize column", action: "Drag border" }
59
+ };
60
+ function qo({
61
+ columns: n = [],
45
62
  data: l = [],
46
- table: i,
47
- getRowCanExpand: s,
48
- renderExpandedRow: b,
49
- striped: p = !1,
50
- bordered: O = !1,
51
- highlightCurrentRow: w = !1,
52
- skeleton: R = !1,
53
- skeletonRows: j = 5,
54
- enableColumnResizing: I = !1,
55
- onColumnSizingChange: x,
56
- columnVisibility: X,
57
- onColumnVisibilityChange: z,
58
- manualSorting: M = !1,
59
- sorting: E,
60
- onSortingChange: N,
61
- renderRow: _,
62
- renderEmptyState: F,
63
- paginationMode: A = "page",
64
- onLoadMore: C,
65
- loadMoreRootMargin: Z,
66
- hasNextPage: T = !1,
67
- isLoadingMore: P = !1
63
+ table: a,
64
+ getRowCanExpand: c,
65
+ renderExpandedRow: f,
66
+ striped: b = !1,
67
+ bordered: me = !1,
68
+ highlightCurrentRow: N = !1,
69
+ skeleton: A = !1,
70
+ skeletonRows: ge = 5,
71
+ enableColumnResizing: K = !1,
72
+ onColumnSizingChange: M,
73
+ enableColumnReordering: fe = !1,
74
+ columnOrder: V,
75
+ onColumnOrderChange: T,
76
+ columnVisibility: be,
77
+ onColumnVisibilityChange: E,
78
+ rowSelection: B,
79
+ onRowSelectionChange: _,
80
+ manualSorting: U = !1,
81
+ sorting: j,
82
+ onSortingChange: F,
83
+ renderRow: X,
84
+ renderEmptyState: Z,
85
+ paginationMode: G = "page",
86
+ onLoadMore: k,
87
+ loadMoreRootMargin: pe,
88
+ hasNextPage: W = !1,
89
+ resizeColumnLabel: ve = "Resize column",
90
+ emptyLabel: he = "No results.",
91
+ isLoadingMore: $ = !1,
92
+ hideActionColumn: Se = !1,
93
+ renderRowActions: q,
94
+ rowActionsLabel: De = "Row actions",
95
+ columnSettingsLabel: ye,
96
+ headerHints: we
68
97
  }) {
69
- const [G, W] = m([]), $ = E ?? G, [q, J] = m([]), [Q, Y] = m({}), ee = X ?? Q, [te, ne] = m({}), [oe, le] = m({}), [ie, re] = m({}), [ae, se] = m(), ce = (e) => {
70
- re(e), x == null || x(e);
71
- }, de = (e) => {
72
- Y(e), z == null || z(e);
73
- }, ue = (e) => {
74
- E === void 0 && W(e), N == null || N(e);
75
- }, me = Se({
98
+ const H = {
99
+ ...Ho,
100
+ ...we
101
+ }, [Re, Ce] = g([]), ze = j ?? Re, [xe, Ie] = g([]), [Ne, Ae] = g({}), Me = be ?? Ne, [Te, Ee] = g({}), _e = B ?? Te, [Fe, ke] = g({}), [He, Oe] = g({}), [Pe, Le] = g([]), Ke = V ?? Pe, [C, O] = g(), [Ve, Be] = g(), [Ue, J] = g(0), Q = so([]), je = (e) => {
102
+ Oe(e), M == null || M(e);
103
+ }, Xe = (e) => {
104
+ V === void 0 && Le(e), T == null || T(e);
105
+ }, Ze = (e) => {
106
+ Ae(e), E == null || E(e);
107
+ }, Ge = (e) => {
108
+ j === void 0 && Ce(e), F == null || F(e);
109
+ }, We = (e) => {
110
+ B === void 0 && Ee(e), _ == null || _(e);
111
+ }, Y = !Se && !a, ee = ne(
112
+ () => Y ? [
113
+ {
114
+ id: "__actions",
115
+ size: 48,
116
+ enableSorting: !1,
117
+ enableHiding: !1,
118
+ meta: { pin: "right" },
119
+ header: () => null,
120
+ cell: () => null
121
+ }
122
+ ] : [],
123
+ [Y]
124
+ ), $e = ne(
125
+ () => [...n, ...ee],
126
+ [n, ee]
127
+ ), [qe, oe] = g(), Je = co({
76
128
  data: l,
77
- columns: o,
78
- enableColumnResizing: I,
129
+ columns: $e,
130
+ enableColumnResizing: K,
79
131
  columnResizeMode: "onChange",
80
- getCoreRowModel: Me(),
81
- getExpandedRowModel: Ie(),
82
- ...A === "page" ? { getPaginationRowModel: De() } : {},
83
- getRowCanExpand: s,
84
- onExpandedChange: le,
85
- manualSorting: M,
86
- onSortingChange: ue,
87
- ...M ? {} : { getSortedRowModel: Ce() },
88
- onColumnFiltersChange: J,
89
- getFilteredRowModel: Ne(),
90
- onColumnVisibilityChange: de,
91
- onRowSelectionChange: ne,
92
- onColumnSizingChange: ce,
132
+ getCoreRowModel: _o(),
133
+ getExpandedRowModel: Eo(),
134
+ ...G === "page" ? { getPaginationRowModel: To() } : {},
135
+ getRowCanExpand: c,
136
+ onExpandedChange: ke,
137
+ manualSorting: U,
138
+ onSortingChange: Ge,
139
+ ...U ? {} : { getSortedRowModel: Mo() },
140
+ onColumnFiltersChange: Ie,
141
+ getFilteredRowModel: Ao(),
142
+ onColumnVisibilityChange: Ze,
143
+ onRowSelectionChange: We,
144
+ onColumnSizingChange: je,
145
+ onColumnOrderChange: Xe,
93
146
  state: {
94
- sorting: $,
95
- columnFilters: q,
96
- columnVisibility: ee,
97
- rowSelection: te,
98
- expanded: oe,
99
- columnSizing: ie
147
+ sorting: ze,
148
+ columnFilters: xe,
149
+ columnVisibility: Me,
150
+ rowSelection: _e,
151
+ expanded: Fe,
152
+ columnSizing: He,
153
+ columnOrder: Ke
100
154
  }
101
- }), r = i ?? me, D = !i && A === "infinite", v = I && !i, ge = ye({
102
- onIntersect: () => C == null ? void 0 : C(),
103
- disabled: !D || !T || P,
104
- rootMargin: Z
105
- }), fe = (e, t) => {
155
+ }), i = a ?? Je, P = !a && G === "infinite", D = K && !a, Qe = fe && !a, y = !!i.getState().columnSizingInfo.isResizingColumn;
156
+ re(() => {
157
+ if (y)
158
+ return document.documentElement.setAttribute("data-ui-column-resizing", ""), () => {
159
+ document.documentElement.removeAttribute("data-ui-column-resizing");
160
+ };
161
+ }, [y]);
162
+ const Ye = fo({
163
+ onIntersect: () => k == null ? void 0 : k(),
164
+ disabled: !P || !W || $,
165
+ rootMargin: pe
166
+ }), eo = (e, o) => {
106
167
  if (e.ctrlKey || e.altKey || e.metaKey) return;
107
- const a = Fe(e.key, t.column.getSize(), {
168
+ const r = Fo(e.key, o.column.getSize(), {
108
169
  shiftKey: e.shiftKey,
109
- min: t.column.columnDef.minSize ?? L,
110
- max: t.column.columnDef.maxSize ?? H
170
+ min: o.column.columnDef.minSize ?? se,
171
+ max: o.column.columnDef.maxSize ?? ce
111
172
  });
112
- a !== void 0 && (e.preventDefault(), r.setColumnSizing((c) => ({ ...c, [t.column.id]: a })));
173
+ r !== void 0 && (e.preventDefault(), i.setColumnSizing((d) => ({ ...d, [o.column.id]: r })));
174
+ }, oo = (e, o) => {
175
+ e.dataTransfer && (e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", o)), O(o);
176
+ }, to = (e) => {
177
+ e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "move");
178
+ }, no = (e, o) => {
179
+ if (e.preventDefault(), !C) return;
180
+ const r = i.getState().columnOrder, d = r.length ? r : i.getAllLeafColumns().map((m) => m.id);
181
+ i.setColumnOrder(ko(d, C, o)), O(void 0);
113
182
  };
114
- ve(() => {
115
- i || r.getAllLeafColumns().forEach((e) => {
116
- var t;
117
- e.pin(((t = e.columnDef.meta) == null ? void 0 : t.pin) ?? !1);
183
+ re(() => {
184
+ a || i.getAllLeafColumns().forEach((e) => {
185
+ var o;
186
+ e.pin(((o = e.columnDef.meta) == null ? void 0 : o.pin) ?? !1);
118
187
  });
119
- }, [r, o, i]);
120
- const f = r.getRowModel().rows, be = O ? "[&_th:not(:last-child)]:border-e [&_td:not(:last-child)]:border-e [&_th]:border-[var(--ui-table-global-row-border-color)] [&_td]:border-[var(--ui-table-global-row-border-color)]" : void 0, pe = "bg-background";
121
- return /* @__PURE__ */ n(
188
+ }, [i, n, a]);
189
+ const p = i.getRowModel().rows, z = mo(i), ro = p.length ? Math.min(Ue, p.length - 1) : 0, io = (e) => {
190
+ J(e);
191
+ }, lo = (e, o) => {
192
+ var d;
193
+ if (e.target !== e.currentTarget || e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
194
+ const r = e.key === "ArrowDown" ? Math.min(o + 1, p.length - 1) : Math.max(o - 1, 0);
195
+ r !== o && (e.preventDefault(), J(r), (d = Q.current[r]) == null || d.focus());
196
+ }, ao = me ? "[&_th:not(:last-child)]:border-e [&_td:not(:last-child)]:border-e [&_th]:border-[var(--ui-table-global-row-border-color)] [&_td]:border-[var(--ui-table-global-row-border-color)]" : void 0, te = "bg-background";
197
+ return /* @__PURE__ */ t(
122
198
  "div",
123
199
  {
124
- className: h(
200
+ className: R(
125
201
  "rounded-md border border-[var(--ui-table-global-row-border-color)]",
126
- be
202
+ ao
127
203
  ),
128
- children: /* @__PURE__ */ y(
129
- we,
204
+ children: /* @__PURE__ */ v(
205
+ bo,
130
206
  {
131
- style: v ? { width: r.getCenterTotalSize() } : void 0,
207
+ style: D ? { width: i.getCenterTotalSize() } : void 0,
132
208
  children: [
133
- /* @__PURE__ */ n(Re, { children: r.getHeaderGroups().map((e) => /* @__PURE__ */ n(u, { children: e.headers.map((t) => {
134
- var S;
135
- const a = t.column.getIsPinned(), c = v && t.column.getCanResize();
136
- return /* @__PURE__ */ y(
137
- xe,
209
+ /* @__PURE__ */ t(yo, { children: /* @__PURE__ */ t(po, { children: i.getHeaderGroups().map((e) => /* @__PURE__ */ t(h, { className: "hover:bg-transparent", children: e.headers.map((o) => {
210
+ var w;
211
+ const r = o.column.getIsPinned(), d = D && o.column.getCanResize(), m = Qe && !o.isPlaceholder && !r, x = !o.isPlaceholder && o.column.getCanSort(), s = [
212
+ x && H.sort,
213
+ m && H.reorder,
214
+ d && H.resize
215
+ ].filter(
216
+ (u) => !!u
217
+ );
218
+ if (o.column.id === "__actions")
219
+ return /* @__PURE__ */ t(
220
+ vo,
221
+ {
222
+ style: le(o, D),
223
+ className: te,
224
+ children: /* @__PURE__ */ t(
225
+ go,
226
+ {
227
+ table: i,
228
+ iconOnly: !0,
229
+ triggerAriaLabel: ye
230
+ }
231
+ )
232
+ },
233
+ o.id
234
+ );
235
+ const I = /* @__PURE__ */ v(
236
+ ho,
138
237
  {
139
- wrap: (S = t.column.columnDef.meta) == null ? void 0 : S.wrap,
140
- style: Ee(t, v),
141
- className: h(
142
- c && "relative",
143
- a && pe
238
+ wrap: (w = o.column.columnDef.meta) == null ? void 0 : w.wrap,
239
+ style: le(o, D),
240
+ draggable: m && !y || void 0,
241
+ onDragStart: m ? (u) => oo(u, o.column.id) : void 0,
242
+ onDragOver: m ? to : void 0,
243
+ onDrop: m ? (u) => no(u, o.column.id) : void 0,
244
+ onDragEnd: m ? () => O(void 0) : void 0,
245
+ className: R(
246
+ d && "relative",
247
+ // Per the design, a sortable header tints the whole
248
+ // cell on hover/press, not just the inner sort button.
249
+ // Suppressed while any column is resizing, since the
250
+ // pointer drags across neighboring `<th>`s and would
251
+ // otherwise tint them via native `:hover`.
252
+ x && !y && "transition-colors hover:bg-[var(--ui-table-header-cell-color-hover)] active:bg-[var(--ui-table-header-cell-color-active)]",
253
+ m && !y && "cursor-(--ui-draggable-cursor) select-none active:cursor-(--ui-draggable-cursor-active)",
254
+ m && C === o.column.id && "opacity-50",
255
+ r && te
144
256
  ),
145
257
  children: [
146
- t.isPlaceholder ? null : k(
147
- t.column.columnDef.header,
148
- t.getContext()
258
+ o.isPlaceholder ? null : ie(
259
+ o.column.columnDef.header,
260
+ o.getContext()
149
261
  ),
150
- c && /* @__PURE__ */ n(
262
+ d && /* @__PURE__ */ t(
151
263
  "div",
152
264
  {
153
265
  role: "separator",
154
266
  "aria-orientation": "vertical",
155
- "aria-label": "Resize column",
156
- "aria-valuenow": t.column.getSize(),
157
- "aria-valuemin": t.column.columnDef.minSize ?? L,
158
- "aria-valuemax": t.column.columnDef.maxSize ?? H,
267
+ "aria-label": ve,
268
+ "aria-valuenow": o.column.getSize(),
269
+ "aria-valuemin": o.column.columnDef.minSize ?? se,
270
+ "aria-valuemax": o.column.columnDef.maxSize ?? ce,
159
271
  tabIndex: 0,
160
- onMouseDown: t.getResizeHandler(),
161
- onTouchStart: t.getResizeHandler(),
162
- onKeyDown: (d) => fe(d, t),
163
- className: h(
164
- "absolute end-0 top-0 h-full w-1 cursor-(--ui-resizable-cursor) touch-none select-none bg-[var(--ui-table-global-row-border-color)] opacity-0 transition-opacity hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-2 focus-visible:outline-(--ui-focus-primary)",
165
- t.column.getIsResizing() && "opacity-100"
272
+ draggable: !1,
273
+ onMouseDown: o.getResizeHandler(),
274
+ onTouchStart: o.getResizeHandler(),
275
+ onKeyDown: (u) => eo(u, o),
276
+ className: R(
277
+ "absolute end-0 top-0 h-full w-1 cursor-(--ui-resizable-cursor) touch-none select-none bg-[var(--ui-table-global-row-border-color)] opacity-0 transition-[opacity,background-color] hover:bg-[var(--ui-resizable-border-color-hover)] hover:opacity-100 focus-visible:bg-[var(--ui-resizable-border-color-hover)] focus-visible:opacity-100 focus-visible:outline-[3px] focus-visible:outline-(--ui-focus-primary)",
278
+ o.column.getIsResizing() && "bg-[var(--ui-resizable-border-color-active)] opacity-100"
166
279
  )
167
280
  }
168
281
  )
169
282
  ]
283
+ }
284
+ );
285
+ return s.length === 0 ? /* @__PURE__ */ t(L, { children: I }, o.id) : /* @__PURE__ */ v(
286
+ wo,
287
+ {
288
+ disabled: y || C !== void 0,
289
+ children: [
290
+ /* @__PURE__ */ t(Ro, { render: I }),
291
+ /* @__PURE__ */ t(Co, { className: "flex flex-col gap-1", children: s.map((u) => /* @__PURE__ */ v("span", { children: [
292
+ /* @__PURE__ */ v("span", { className: "font-semibold", children: [
293
+ u.label,
294
+ ":"
295
+ ] }),
296
+ " ",
297
+ u.action
298
+ ] }, u.label)) })
299
+ ]
170
300
  },
171
- t.id
301
+ o.id
172
302
  );
173
- }) }, e.id)) }),
174
- /* @__PURE__ */ y(ze, { children: [
175
- R ? Array.from({ length: j }).map((e, t) => /* @__PURE__ */ n(
176
- u,
303
+ }) }, e.id)) }) }),
304
+ /* @__PURE__ */ v(So, { children: [
305
+ A ? Array.from({ length: ge }).map((e, o) => /* @__PURE__ */ t(
306
+ h,
177
307
  {
178
308
  className: "hover:bg-transparent",
179
- children: r.getVisibleLeafColumns().map((a) => /* @__PURE__ */ n(g, { children: /* @__PURE__ */ n("div", { className: "h-4 w-full animate-pulse rounded bg-[var(--ui-background-surface-secondary)]" }) }, a.id))
309
+ children: i.getVisibleLeafColumns().map((r) => /* @__PURE__ */ t(S, { children: /* @__PURE__ */ t("div", { className: "h-4 w-full animate-pulse rounded bg-[var(--ui-background-surface-secondary)]" }) }, r.id))
180
310
  },
181
- `skeleton-${t}`
182
- )) : f != null && f.length ? f.map((e, t) => {
183
- if (_)
184
- return /* @__PURE__ */ n(K, { children: _(e, t) }, e.id);
185
- const a = e.getIsSelected(), c = w && ae === e.id, S = a || c ? "bg-[var(--ui-table-data-row-color-active)]" : p && t % 2 === 1 ? "bg-[var(--ui-background-surface-secondary)]" : "bg-background";
186
- return /* @__PURE__ */ y(K, { children: [
187
- /* @__PURE__ */ n(
188
- u,
311
+ `skeleton-${o}`
312
+ )) : p != null && p.length ? p.map((e, o) => {
313
+ if (X)
314
+ return /* @__PURE__ */ t(L, { children: X(e, o) }, e.id);
315
+ const r = e.getIsSelected(), d = N && Ve === e.id, m = r || d ? "bg-[var(--ui-table-data-row-color-active)]" : b && o % 2 === 1 ? "bg-[var(--ui-background-surface-secondary)]" : "bg-background group-hover:bg-[var(--ui-table-data-row-color-hover)]", x = !z && qe === e.id;
316
+ return /* @__PURE__ */ v(L, { children: [
317
+ /* @__PURE__ */ t(
318
+ h,
189
319
  {
190
- selected: a,
191
- onClick: w ? () => se(e.id) : void 0,
192
- className: h(
193
- w && "cursor-pointer",
194
- p && t % 2 === 1 && !a && !c && "bg-[var(--ui-background-surface-secondary)]",
195
- c && !a && "bg-[var(--ui-table-data-row-color-active)]"
320
+ ref: (s) => {
321
+ Q.current[o] = s;
322
+ },
323
+ tabIndex: o === ro ? 0 : -1,
324
+ onFocus: () => io(o),
325
+ onKeyDown: (s) => lo(s, o),
326
+ selected: r,
327
+ onClick: N ? () => Be(e.id) : void 0,
328
+ className: R(
329
+ "group",
330
+ N && "cursor-pointer",
331
+ b && o % 2 === 1 && !r && !d && "bg-[var(--ui-background-surface-secondary)]",
332
+ d && !r && "bg-[var(--ui-table-data-row-color-active)]",
333
+ // The action cell's own hover tint (its ellipsis/cog
334
+ // trigger) should be the only thing that reacts while
335
+ // it's hovered — not the rest of the row underneath it.
336
+ x && "hover:bg-transparent"
196
337
  ),
197
- children: e.getVisibleCells().map((d) => {
198
- var V;
199
- const he = d.column.getIsPinned();
200
- return /* @__PURE__ */ n(
201
- g,
338
+ children: e.getVisibleCells().map((s) => {
339
+ var w;
340
+ const I = s.column.getIsPinned();
341
+ return s.column.id === "__actions" ? /* @__PURE__ */ t(
342
+ Do,
343
+ {
344
+ style: ae(s, D),
345
+ className: m,
346
+ bulkSelectionActive: z,
347
+ onMouseEnter: z ? void 0 : () => oe(e.id),
348
+ onMouseLeave: z ? void 0 : () => oe(
349
+ (u) => u === e.id ? void 0 : u
350
+ ),
351
+ children: q && /* @__PURE__ */ v(zo, { children: [
352
+ /* @__PURE__ */ t(
353
+ xo,
354
+ {
355
+ render: /* @__PURE__ */ t(No, { "aria-label": De }),
356
+ children: /* @__PURE__ */ t(uo, {})
357
+ }
358
+ ),
359
+ /* @__PURE__ */ t(Io, { align: "end", children: q(e) })
360
+ ] })
361
+ },
362
+ s.id
363
+ ) : /* @__PURE__ */ t(
364
+ S,
202
365
  {
203
- wrap: (V = d.column.columnDef.meta) == null ? void 0 : V.wrap,
204
- style: _e(d, v),
205
- className: h(he && S),
206
- children: k(
207
- d.column.columnDef.cell,
208
- d.getContext()
366
+ wrap: (w = s.column.columnDef.meta) == null ? void 0 : w.wrap,
367
+ style: ae(s, D),
368
+ className: R(I && m),
369
+ children: ie(
370
+ s.column.columnDef.cell,
371
+ s.getContext()
209
372
  )
210
373
  },
211
- d.id
374
+ s.id
212
375
  );
213
376
  })
214
377
  }
215
378
  ),
216
- b && e.getIsExpanded() && /* @__PURE__ */ n(u, { className: "hover:bg-transparent", children: /* @__PURE__ */ n(
217
- g,
379
+ f && e.getIsExpanded() && /* @__PURE__ */ t(h, { className: "hover:bg-transparent", children: /* @__PURE__ */ t(
380
+ S,
218
381
  {
219
382
  className: "h-auto py-3",
220
383
  colSpan: e.getVisibleCells().length,
221
- children: b(e)
384
+ children: f(e)
222
385
  }
223
386
  ) })
224
387
  ] }, e.id);
225
- }) : F ? /* @__PURE__ */ n(u, { children: /* @__PURE__ */ n(
226
- g,
388
+ }) : Z ? /* @__PURE__ */ t(h, { children: /* @__PURE__ */ t(
389
+ S,
227
390
  {
228
- colSpan: r.getVisibleLeafColumns().length,
391
+ colSpan: i.getVisibleLeafColumns().length,
229
392
  className: "h-24 text-center",
230
- children: F({
231
- hasFilters: r.getState().columnFilters.length > 0
393
+ children: Z({
394
+ hasFilters: i.getState().columnFilters.length > 0
232
395
  })
233
396
  }
234
- ) }) : /* @__PURE__ */ n(u, { children: /* @__PURE__ */ n(
235
- g,
397
+ ) }) : /* @__PURE__ */ t(h, { children: /* @__PURE__ */ t(
398
+ S,
236
399
  {
237
- colSpan: r.getVisibleLeafColumns().length,
400
+ colSpan: i.getVisibleLeafColumns().length,
238
401
  className: "h-24 text-center text-[var(--ui-table-data-value-color-disabled)]",
239
- children: "No results."
402
+ children: he
240
403
  }
241
404
  ) }),
242
- D && !R && f.length > 0 && T && /* @__PURE__ */ n(
243
- u,
405
+ P && !A && p.length > 0 && W && /* @__PURE__ */ t(
406
+ h,
244
407
  {
245
- ref: ge,
408
+ ref: Ye,
246
409
  "aria-hidden": !0,
247
410
  className: "hover:bg-transparent",
248
- children: /* @__PURE__ */ n(
249
- g,
411
+ children: /* @__PURE__ */ t(
412
+ S,
250
413
  {
251
- colSpan: r.getVisibleLeafColumns().length,
414
+ colSpan: i.getVisibleLeafColumns().length,
252
415
  className: "h-1 p-0"
253
416
  }
254
417
  )
255
418
  }
256
419
  ),
257
- D && !R && f.length > 0 && P && /* @__PURE__ */ n(u, { className: "hover:bg-transparent", children: /* @__PURE__ */ n(g, { colSpan: r.getVisibleLeafColumns().length, children: /* @__PURE__ */ n(
420
+ P && !A && p.length > 0 && $ && /* @__PURE__ */ t(h, { className: "hover:bg-transparent", children: /* @__PURE__ */ t(S, { colSpan: i.getVisibleLeafColumns().length, children: /* @__PURE__ */ t(
258
421
  "div",
259
422
  {
260
423
  role: "status",
261
424
  "aria-live": "polite",
262
425
  className: "h-4 w-full animate-pulse rounded bg-[var(--ui-background-surface-secondary)]",
263
- children: /* @__PURE__ */ n("span", { className: "sr-only", children: "Loading more rows…" })
426
+ children: /* @__PURE__ */ t("span", { className: "sr-only", children: "Loading more rows…" })
264
427
  }
265
428
  ) }) })
266
429
  ] })
@@ -271,10 +434,11 @@ function He({
271
434
  );
272
435
  }
273
436
  export {
274
- He as DataTable,
275
- _e as getCellStyle,
276
- B as getColumnWidth,
277
- U as getPinnedStyle,
278
- Fe as getResizeKeyboardStep
437
+ qo as DataTable,
438
+ ae as getCellStyle,
439
+ ue as getColumnWidth,
440
+ de as getPinnedStyle,
441
+ Fo as getResizeKeyboardStep,
442
+ ko as reorderColumn
279
443
  };
280
444
  //# sourceMappingURL=data-table.js.map