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