@acronis-platform/ui-react 5.3.1 → 5.4.1

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.
@@ -2,7 +2,7 @@ import { TableViewOptions as e } from "../table/table-view-options.js";
2
2
  import { jsx as t } from "react/jsx-runtime";
3
3
  //#region src/components/ui/data-table/data-table-view-options.tsx
4
4
  function n({ table: n, ...r }) {
5
- let i = n.getAllColumns().filter((e) => e.accessorFn !== void 0 && e.getCanHide()).map((e) => ({
5
+ let i = n.getAllLeafColumns().filter((e) => e.accessorFn !== void 0 && e.getCanHide()).map((e) => ({
6
6
  id: e.id,
7
7
  label: e.columnDef.meta?.label ?? (typeof e.columnDef.header == "string" ? e.columnDef.header : e.id),
8
8
  hidden: !e.getIsVisible(),
@@ -1 +1 @@
1
- {"version":3,"file":"data-table-view-options.js","names":[],"sources":["../../../../src/components/ui/data-table/data-table-view-options.tsx"],"sourcesContent":["import type { Table } from '@tanstack/react-table';\n\nimport { TableViewOptions, type TableViewOptionsProps } from '../table';\n\ninterface DataTableViewOptionsProps<TData> extends Pick<\n TableViewOptionsProps,\n | 'triggerLabel'\n | 'iconOnly'\n | 'triggerAriaLabel'\n | 'searchPlaceholder'\n | 'showAllLabel'\n | 'noResultsLabel'\n> {\n table: Table<TData>;\n}\n\n// Thin TanStack adapter over the primitive-only `TableViewOptions`: maps\n// `table.getAllColumns()` onto the plain `{ id, label, hidden }[]` shape and\n// routes `onToggle` back through `column.toggleVisibility()`.\nexport function DataTableViewOptions<TData>({\n table,\n ...triggerProps\n}: DataTableViewOptionsProps<TData>) {\n const columns = table\n .getAllColumns()\n .filter(\n (column) =>\n typeof column.accessorFn !== 'undefined' && column.getCanHide()\n )\n .map((column) => ({\n id: column.id,\n label:\n column.columnDef.meta?.label ??\n (typeof column.columnDef.header === 'string'\n ? column.columnDef.header\n : column.id),\n hidden: !column.getIsVisible(),\n category: column.columnDef.meta?.category,\n }));\n\n return (\n <TableViewOptions\n columns={columns}\n onToggle={(id) => {\n const column = table.getColumn(id);\n column?.toggleVisibility(!column.getIsVisible());\n }}\n {...triggerProps}\n />\n );\n}\n"],"mappings":";;;AAmBA,SAAgB,EAA4B,EAC1C,UACA,GAAG,KACgC;CACnC,IAAM,IAAU,EACb,cAAc,CAAC,CACf,QACE,MACQ,EAAO,eAAe,UAAe,EAAO,WAAW,CAClE,CAAC,CACA,KAAK,OAAY;EAChB,IAAI,EAAO;EACX,OACE,EAAO,UAAU,MAAM,UACtB,OAAO,EAAO,UAAU,UAAW,WAChC,EAAO,UAAU,SACjB,EAAO;EACb,QAAQ,CAAC,EAAO,aAAa;EAC7B,UAAU,EAAO,UAAU,MAAM;CACnC,EAAE;CAEJ,OACE,kBAAC,GAAD;EACW;EACT,WAAW,MAAO;GAChB,IAAM,IAAS,EAAM,UAAU,CAAE;GACjC,GAAQ,iBAAiB,CAAC,EAAO,aAAa,CAAC;EACjD;EACA,GAAI;CACL,CAAA;AAEL"}
1
+ {"version":3,"file":"data-table-view-options.js","names":[],"sources":["../../../../src/components/ui/data-table/data-table-view-options.tsx"],"sourcesContent":["import type { Table } from '@tanstack/react-table';\n\nimport { TableViewOptions, type TableViewOptionsProps } from '../table';\n\ninterface DataTableViewOptionsProps<TData> extends Pick<\n TableViewOptionsProps,\n | 'triggerLabel'\n | 'iconOnly'\n | 'triggerAriaLabel'\n | 'searchPlaceholder'\n | 'showAllLabel'\n | 'noResultsLabel'\n> {\n table: Table<TData>;\n}\n\n// Thin TanStack adapter over the primitive-only `TableViewOptions`: maps\n// `table.getAllLeafColumns()` onto the plain `{ id, label, hidden }[]` shape and\n// routes `onToggle` back through `column.toggleVisibility()`.\n// Leaf (not `getAllColumns()`) because with grouped headers the top level is\n// group columns, which have no `accessorFn` and would all be filtered out.\nexport function DataTableViewOptions<TData>({\n table,\n ...triggerProps\n}: DataTableViewOptionsProps<TData>) {\n const columns = table\n .getAllLeafColumns()\n .filter(\n (column) =>\n typeof column.accessorFn !== 'undefined' && column.getCanHide()\n )\n .map((column) => ({\n id: column.id,\n label:\n column.columnDef.meta?.label ??\n (typeof column.columnDef.header === 'string'\n ? column.columnDef.header\n : column.id),\n hidden: !column.getIsVisible(),\n category: column.columnDef.meta?.category,\n }));\n\n return (\n <TableViewOptions\n columns={columns}\n onToggle={(id) => {\n const column = table.getColumn(id);\n column?.toggleVisibility(!column.getIsVisible());\n }}\n {...triggerProps}\n />\n );\n}\n"],"mappings":";;;AAqBA,SAAgB,EAA4B,EAC1C,UACA,GAAG,KACgC;CACnC,IAAM,IAAU,EACb,kBAAkB,CAAC,CACnB,QACE,MACQ,EAAO,eAAe,UAAe,EAAO,WAAW,CAClE,CAAC,CACA,KAAK,OAAY;EAChB,IAAI,EAAO;EACX,OACE,EAAO,UAAU,MAAM,UACtB,OAAO,EAAO,UAAU,UAAW,WAChC,EAAO,UAAU,SACjB,EAAO;EACb,QAAQ,CAAC,EAAO,aAAa;EAC7B,UAAU,EAAO,UAAU,MAAM;CACnC,EAAE;CAEJ,OACE,kBAAC,GAAD;EACW;EACT,WAAW,MAAO;GAChB,IAAM,IAAS,EAAM,UAAU,CAAE;GACjC,GAAQ,iBAAiB,CAAC,EAAO,aAAa,CAAC;EACjD;EACA,GAAI;CACL,CAAA;AAEL"}
@@ -2,17 +2,17 @@ import { cn as e } from "../../../lib/utils.js";
2
2
  import { useIntersectionObserver as t } from "../../../hooks/use-intersection-observer.js";
3
3
  import { ButtonIcon as n } from "../button-icon/button-icon.js";
4
4
  import { Tooltip as r, TooltipContent as i, TooltipProvider as a, TooltipTrigger as o } from "../tooltip/tooltip.js";
5
- import { getCoreRowModel as s, getExpandedRowModel as c, getFilteredRowModel as l, getPaginationRowModel as u, getSortedRowModel as ee } from "../../../node_modules/.pnpm/@tanstack_table-core@8.21.3/node_modules/@tanstack/table-core/build/lib/index.js";
6
- import { flexRender as d, useReactTable as te } 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";
7
- import { DropdownMenu as ne, DropdownMenuContent as re, DropdownMenuTrigger as ie } from "../dropdown-menu/dropdown-menu.js";
8
- import { Table as ae, TableActionsCell as oe, TableBody as se, TableCell as f, TableHead as ce, TableHeader as le, TableRow as p, TableSettingsCell as ue } from "../table/table.js";
9
- import { isBulkSelectionActive as de } from "./data-table-selection.js";
10
- import { DataTableViewOptions as fe } from "./data-table-view-options.js";
11
- import { Fragment as m, useEffect as h, useMemo as g, useRef as pe, useState as _ } from "react";
12
- import { jsx as v, jsxs as y } from "react/jsx-runtime";
13
- import { EllipsisIcon as me } from "@acronis-platform/icons-react/stroke-mono";
5
+ import { getCoreRowModel as s, getExpandedRowModel as c, getFilteredRowModel as l, getPaginationRowModel as u, getSortedRowModel as d } from "../../../node_modules/.pnpm/@tanstack_table-core@8.21.3/node_modules/@tanstack/table-core/build/lib/index.js";
6
+ import { flexRender as f, useReactTable as p } 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";
7
+ import { DropdownMenu as m, DropdownMenuContent as ee, DropdownMenuTrigger as te } from "../dropdown-menu/dropdown-menu.js";
8
+ import { Table as ne, TableActionsCell as re, TableBody as ie, TableCell as h, TableHead as ae, TableHeader as oe, TableRow as g, TableSettingsCell as se } from "../table/table.js";
9
+ import { isBulkSelectionActive as ce } from "./data-table-selection.js";
10
+ import { DataTableViewOptions as le } from "./data-table-view-options.js";
11
+ import { Fragment as _, useEffect as ue, useMemo as de, useRef as fe, useState as v } from "react";
12
+ import { jsx as y, jsxs as b } from "react/jsx-runtime";
13
+ import { EllipsisIcon as pe } from "@acronis-platform/icons-react/stroke-mono";
14
14
  //#region src/components/ui/data-table/data-table.tsx
15
- function b(e) {
15
+ function x(e) {
16
16
  let t = e.getIsPinned();
17
17
  if (t) return {
18
18
  position: "sticky",
@@ -22,37 +22,37 @@ function b(e) {
22
22
  boxShadow: t === "left" ? "4px 0 4px -4px var(--ui-table-global-row-border-color)" : "-4px 0 4px -4px var(--ui-table-global-row-border-color)"
23
23
  };
24
24
  }
25
- function x(e, t) {
25
+ function S(e, t) {
26
26
  if (e.id === "select") return 48;
27
27
  if (t || e.columnDef.size !== void 0) return e.getSize();
28
28
  }
29
- function S(e, t) {
30
- let n = b(e.column), r = x(e.column, t);
29
+ function C(e, t) {
30
+ let n = x(e.column), r = e.subHeaders.length === 0 ? S(e.column, t) : void 0;
31
31
  if (!(!n && r === void 0)) return {
32
32
  ...n,
33
33
  width: r
34
34
  };
35
35
  }
36
- function C(e, t) {
37
- let n = b(e.column), r = x(e.column, t);
36
+ function w(e, t) {
37
+ let n = x(e.column), r = S(e.column, t);
38
38
  if (!(!n && r === void 0)) return {
39
39
  ...n,
40
40
  width: r
41
41
  };
42
42
  }
43
- var w = 20, he = 2 ** 53 - 1;
44
- function ge(e, t, { shiftKey: n, min: r, max: i }) {
43
+ var T = 20, E = 2 ** 53 - 1;
44
+ function D(e, t, { shiftKey: n, min: r, max: i }) {
45
45
  let a = n ? 50 : 10;
46
46
  if (e === "ArrowLeft") return Math.min(i, Math.max(r, t - a));
47
47
  if (e === "ArrowRight") return Math.max(r, Math.min(i, t + a));
48
48
  }
49
- function T(e, t, n) {
49
+ function O(e, t, n) {
50
50
  let r = e.indexOf(t), i = e.indexOf(n);
51
51
  if (r === -1 || i === -1 || r === i) return e;
52
52
  let a = [...e];
53
53
  return a.splice(i, 0, a.splice(r, 1)[0]), a;
54
54
  }
55
- var _e = {
55
+ var me = {
56
56
  sort: {
57
57
  label: "Sort column",
58
58
  action: "Click"
@@ -66,21 +66,21 @@ var _e = {
66
66
  action: "Drag border"
67
67
  }
68
68
  };
69
- function E({ columns: b = [], data: x = [], table: E, getRowCanExpand: ve, renderExpandedRow: D, striped: O = !1, bordered: ye = !1, highlightCurrentRow: k = !1, skeleton: A = !1, skeletonRows: be = 5, enableColumnResizing: j = !1, onColumnSizingChange: xe, enableColumnReordering: Se = !1, columnOrder: M, onColumnOrderChange: Ce, columnVisibility: we, onColumnVisibilityChange: Te, rowSelection: N, onRowSelectionChange: Ee, manualSorting: P = !1, sorting: F, onSortingChange: De, renderRow: I, renderEmptyState: L, paginationMode: R = "page", onLoadMore: Oe, loadMoreRootMargin: ke, hasNextPage: z = !1, resizeColumnLabel: Ae = "Resize column", emptyLabel: je = "No results.", isLoadingMore: B = !1, hideActionColumn: Me = !1, renderRowActions: V, rowActionsLabel: Ne = "Row actions", columnSettingsLabel: Pe, columnSearchPlaceholder: Fe, showAllColumnsLabel: Ie, noColumnsFoundLabel: Le, headerHints: Re }) {
70
- let H = {
71
- ..._e,
72
- ...Re
73
- }, [ze, Be] = _([]), Ve = F ?? ze, [He, Ue] = _([]), [We, Ge] = _({}), Ke = we ?? We, [qe, Je] = _({}), Ye = N ?? qe, [Xe, Ze] = _({}), [Qe, $e] = _({}), [et, tt] = _([]), nt = M ?? et, [U, W] = _(), [rt, it] = _(), [at, G] = _(0), K = pe([]), ot = (e) => {
74
- $e(e), xe?.(e);
75
- }, st = (e) => {
76
- M === void 0 && tt(e), Ce?.(e);
77
- }, ct = (e) => {
78
- Ge(e), Te?.(e);
79
- }, lt = (e) => {
80
- F === void 0 && Be(e), De?.(e);
69
+ function k({ columns: x = [], data: S = [], table: k, getRowId: he, getRowCanExpand: ge, renderExpandedRow: _e, striped: ve = !1, bordered: ye = !1, highlightCurrentRow: A = !1, skeleton: j = !1, skeletonRows: be = 5, enableColumnResizing: xe = !1, onColumnSizingChange: Se, enableColumnReordering: Ce = !1, columnOrder: we, onColumnOrderChange: Te, columnVisibility: Ee, onColumnVisibilityChange: De, rowSelection: Oe, onRowSelectionChange: ke, manualSorting: M = !1, sorting: N, onSortingChange: Ae, renderRow: P, renderEmptyState: F, paginationMode: I = "page", onLoadMore: je, loadMoreRootMargin: Me, hasNextPage: L = !1, resizeColumnLabel: Ne = "Resize column", emptyLabel: Pe = "No results.", isLoadingMore: R = !1, hideActionColumn: Fe = !1, renderRowActions: z, rowActionsLabel: Ie = "Row actions", columnSettingsLabel: Le, columnSearchPlaceholder: Re, showAllColumnsLabel: ze, noColumnsFoundLabel: Be, headerHints: Ve }) {
70
+ let B = {
71
+ ...me,
72
+ ...Ve
73
+ }, [He, Ue] = v([]), We = N ?? He, [Ge, Ke] = v([]), [qe, Je] = v({}), Ye = Ee ?? qe, [Xe, Ze] = v({}), Qe = Oe ?? Xe, [$e, et] = v({}), [tt, nt] = v({}), [rt, it] = v([]), at = we ?? rt, [V, H] = v(), [ot, st] = v(), [ct, U] = v(0), W = fe([]), lt = (e) => {
74
+ nt(e), Se?.(e);
81
75
  }, ut = (e) => {
82
- N === void 0 && Je(e), Ee?.(e);
83
- }, q = !Me && !E, dt = g(() => q ? [{
76
+ we === void 0 && it(e), Te?.(e);
77
+ }, dt = (e) => {
78
+ Je(e), De?.(e);
79
+ }, ft = (e) => {
80
+ N === void 0 && Ue(e), Ae?.(e);
81
+ }, pt = (e) => {
82
+ Oe === void 0 && Ze(e), ke?.(e);
83
+ }, G = !Fe && !k, K = de(() => G ? [{
84
84
  id: "__actions",
85
85
  size: 48,
86
86
  enableSorting: !1,
@@ -88,135 +88,146 @@ function E({ columns: b = [], data: x = [], table: E, getRowCanExpand: ve, rende
88
88
  meta: { pin: "right" },
89
89
  header: () => null,
90
90
  cell: () => null
91
- }] : [], [q]), ft = g(() => [...b, ...dt], [b, dt]), [pt, mt] = _(), ht = te({
92
- data: x,
93
- columns: ft,
94
- enableColumnResizing: j,
91
+ }] : [], [G]), mt = de(() => [...x, ...K], [x, K]), [ht, gt] = v(), _t = p({
92
+ data: S,
93
+ columns: mt,
94
+ getRowId: he,
95
+ enableColumnResizing: xe,
95
96
  columnResizeMode: "onChange",
96
97
  getCoreRowModel: s(),
97
98
  getExpandedRowModel: c(),
98
- ...R === "page" ? { getPaginationRowModel: u() } : {},
99
- getRowCanExpand: ve,
100
- onExpandedChange: Ze,
101
- manualSorting: P,
102
- onSortingChange: lt,
103
- ...P ? {} : { getSortedRowModel: ee() },
104
- onColumnFiltersChange: Ue,
99
+ ...I === "page" ? { getPaginationRowModel: u() } : {},
100
+ getRowCanExpand: ge,
101
+ onExpandedChange: et,
102
+ manualSorting: M,
103
+ onSortingChange: ft,
104
+ ...M ? {} : { getSortedRowModel: d() },
105
+ onColumnFiltersChange: Ke,
105
106
  getFilteredRowModel: l(),
106
- onColumnVisibilityChange: ct,
107
- onRowSelectionChange: ut,
108
- onColumnSizingChange: ot,
109
- onColumnOrderChange: st,
110
- initialState: q ? { columnPinning: { right: ["__actions"] } } : void 0,
107
+ onColumnVisibilityChange: dt,
108
+ onRowSelectionChange: pt,
109
+ onColumnSizingChange: lt,
110
+ onColumnOrderChange: ut,
111
+ initialState: G ? { columnPinning: { right: ["__actions"] } } : void 0,
111
112
  state: {
112
- sorting: Ve,
113
- columnFilters: He,
114
- columnVisibility: Ke,
115
- rowSelection: Ye,
116
- expanded: Xe,
117
- columnSizing: Qe,
118
- columnOrder: nt
113
+ sorting: We,
114
+ columnFilters: Ge,
115
+ columnVisibility: Ye,
116
+ rowSelection: Qe,
117
+ expanded: $e,
118
+ columnSizing: tt,
119
+ columnOrder: at
119
120
  }
120
- }), J = E ?? ht, Y = !E && R === "infinite", X = j && !E, gt = Se && !E, Z = !!J.getState().columnSizingInfo.isResizingColumn;
121
- h(() => {
122
- if (Z) return document.documentElement.setAttribute("data-ui-column-resizing", ""), () => {
121
+ }), q = k ?? _t, J = !k && I === "infinite", Y = xe && !k, vt = Ce && !k, X = !!q.getState().columnSizingInfo.isResizingColumn;
122
+ ue(() => {
123
+ if (X) return document.documentElement.setAttribute("data-ui-column-resizing", ""), () => {
123
124
  document.documentElement.removeAttribute("data-ui-column-resizing");
124
125
  };
125
- }, [Z]);
126
- let _t = t({
127
- onIntersect: () => Oe?.(),
128
- disabled: !Y || !z || B,
129
- rootMargin: ke
130
- }), vt = (e, t) => {
126
+ }, [X]);
127
+ let yt = t({
128
+ onIntersect: () => je?.(),
129
+ disabled: !J || !L || R,
130
+ rootMargin: Me
131
+ }), bt = (e, t) => {
131
132
  if (e.ctrlKey || e.altKey || e.metaKey) return;
132
- let n = ge(e.key, t.column.getSize(), {
133
+ let n = D(e.key, t.column.getSize(), {
133
134
  shiftKey: e.shiftKey,
134
- min: t.column.columnDef.minSize ?? w,
135
- max: t.column.columnDef.maxSize ?? he
135
+ min: t.column.columnDef.minSize ?? T,
136
+ max: t.column.columnDef.maxSize ?? E
136
137
  });
137
- n !== void 0 && (e.preventDefault(), J.setColumnSizing((e) => ({
138
+ n !== void 0 && (e.preventDefault(), q.setColumnSizing((e) => ({
138
139
  ...e,
139
140
  [t.column.id]: n
140
141
  })));
141
- }, yt = (e, t) => {
142
- e.dataTransfer && (e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", t)), W(t);
143
- }, bt = (e) => {
144
- e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "move");
145
142
  }, xt = (e, t) => {
146
- if (e.preventDefault(), !U) return;
147
- let n = J.getState().columnOrder, r = n.length ? n : J.getAllLeafColumns().map((e) => e.id);
148
- J.setColumnOrder(T(r, U, t)), W(void 0);
143
+ e.dataTransfer && (e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", t)), H(t);
144
+ }, St = (e, t) => {
145
+ if (e.preventDefault(), !e.dataTransfer) return;
146
+ let n = V ? q.getColumn(V)?.parent?.id : void 0, r = q.getColumn(t)?.parent?.id;
147
+ e.dataTransfer.dropEffect = n === r ? "move" : "none";
148
+ }, Ct = (e, t) => {
149
+ if (e.preventDefault(), !V) return;
150
+ if (q.getColumn(V)?.parent?.id !== q.getColumn(t)?.parent?.id) {
151
+ H(void 0);
152
+ return;
153
+ }
154
+ let n = q.getState().columnOrder, r = n.length ? n : q.getAllLeafColumns().map((e) => e.id);
155
+ q.setColumnOrder(O(r, V, t)), H(void 0);
149
156
  };
150
- h(() => {
151
- E || J.getAllLeafColumns().forEach((e) => {
157
+ ue(() => {
158
+ k || q.getAllLeafColumns().forEach((e) => {
152
159
  e.pin(e.columnDef.meta?.pin ?? !1);
153
160
  });
154
161
  }, [
155
- J,
156
- ft,
157
- E
162
+ q,
163
+ mt,
164
+ k
158
165
  ]);
159
- let Q = J.getRowModel().rows, $ = de(J), St = Q.length ? Math.min(at, Q.length - 1) : 0, Ct = (e) => {
160
- G(e);
161
- }, wt = (e, t) => {
166
+ let Z = q.getRowModel().rows, Q = ce(q), wt = Z.length ? Math.min(ct, Z.length - 1) : 0, Tt = (e) => {
167
+ U(e);
168
+ }, Et = (e, t) => {
162
169
  if (e.target !== e.currentTarget || e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
163
- let n = e.key === "ArrowDown" ? Math.min(t + 1, Q.length - 1) : Math.max(t - 1, 0);
164
- n !== t && (e.preventDefault(), G(n), K.current[n]?.focus());
165
- }, Tt = ye ? "[&_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, Et = "bg-background";
166
- return /* @__PURE__ */ v("div", {
167
- className: e("rounded-md border border-[var(--ui-table-global-row-border-color)]", Tt),
168
- children: /* @__PURE__ */ y(ae, {
169
- style: X ? { width: J.getCenterTotalSize() } : void 0,
170
- children: [/* @__PURE__ */ v(a, { children: /* @__PURE__ */ v(le, { children: J.getHeaderGroups().map((t) => /* @__PURE__ */ v(p, {
170
+ let n = e.key === "ArrowDown" ? Math.min(t + 1, Z.length - 1) : Math.max(t - 1, 0);
171
+ n !== t && (e.preventDefault(), U(n), W.current[n]?.focus());
172
+ }, Dt = ye ? "[&_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, $ = "bg-background";
173
+ return /* @__PURE__ */ y("div", {
174
+ className: e("rounded-md border border-[var(--ui-table-global-row-border-color)]", Dt),
175
+ children: /* @__PURE__ */ b(ne, {
176
+ style: Y ? { width: q.getCenterTotalSize() } : void 0,
177
+ children: [/* @__PURE__ */ y(a, { children: /* @__PURE__ */ y(oe, { children: q.getHeaderGroups().map((t, n, a) => /* @__PURE__ */ y(g, {
171
178
  className: "hover:bg-transparent",
172
179
  children: t.headers.map((t) => {
173
- let n = t.column.getIsPinned(), a = X && t.column.getCanResize() && t.column.id !== "select", s = gt && !t.isPlaceholder && !n, c = !t.isPlaceholder && t.column.getCanSort(), l = [
174
- c && H.sort,
175
- s && H.reorder,
176
- a && H.resize
180
+ let s = t.column.getIsPinned(), c = t.subHeaders.length > 0, l = !c && Y && t.column.getCanResize() && t.column.id !== "select", u = !c && vt && !t.isPlaceholder && !s, d = !c && !t.isPlaceholder && t.column.getCanSort(), p = [
181
+ d && B.sort,
182
+ u && B.reorder,
183
+ l && B.resize
177
184
  ].filter((e) => !!e);
178
- if (t.column.id === "__actions") return /* @__PURE__ */ v(ue, {
179
- style: S(t, X),
180
- className: Et,
181
- children: /* @__PURE__ */ v(fe, {
182
- table: J,
185
+ if (t.column.id === "__actions") return n < a.length - 1 ? /* @__PURE__ */ y(se, {
186
+ style: C(t, Y),
187
+ className: $
188
+ }, t.id) : /* @__PURE__ */ y(se, {
189
+ style: C(t, Y),
190
+ className: $,
191
+ children: /* @__PURE__ */ y(le, {
192
+ table: q,
183
193
  iconOnly: !0,
184
- triggerAriaLabel: Pe,
185
- searchPlaceholder: Fe,
186
- showAllLabel: Ie,
187
- noResultsLabel: Le
194
+ triggerAriaLabel: Le,
195
+ searchPlaceholder: Re,
196
+ showAllLabel: ze,
197
+ noResultsLabel: Be
188
198
  })
189
199
  }, t.id);
190
- let u = /* @__PURE__ */ y(ce, {
200
+ let m = /* @__PURE__ */ b(ae, {
201
+ colSpan: t.colSpan,
191
202
  wrap: t.column.columnDef.meta?.wrap,
192
- style: S(t, X),
193
- draggable: s && !Z || void 0,
194
- onDragStart: s ? (e) => yt(e, t.column.id) : void 0,
195
- onDragOver: s ? bt : void 0,
196
- onDrop: s ? (e) => xt(e, t.column.id) : void 0,
197
- onDragEnd: s ? () => W(void 0) : void 0,
198
- className: e(a && "relative", c && !Z && "transition-colors hover:bg-[var(--ui-table-header-cell-color-hover)] active:bg-[var(--ui-table-header-cell-color-active)]", s && !Z && "cursor-grab select-none active:cursor-grabbing", s && U === t.column.id && "opacity-50", n && Et),
199
- children: [t.isPlaceholder ? null : d(t.column.columnDef.header, t.getContext()), a && /* @__PURE__ */ v("div", {
203
+ style: C(t, Y),
204
+ draggable: u && !X || void 0,
205
+ onDragStart: u ? (e) => xt(e, t.column.id) : void 0,
206
+ onDragOver: u ? (e) => St(e, t.column.id) : void 0,
207
+ onDrop: u ? (e) => Ct(e, t.column.id) : void 0,
208
+ onDragEnd: u ? () => H(void 0) : void 0,
209
+ className: e(l && "relative", d && !X && "transition-colors hover:bg-[var(--ui-table-header-cell-color-hover)] active:bg-[var(--ui-table-header-cell-color-active)]", u && !X && "cursor-grab select-none active:cursor-grabbing", u && V === t.column.id && "opacity-50", s && $),
210
+ children: [t.isPlaceholder ? null : f(t.column.columnDef.header, t.getContext()), l && /* @__PURE__ */ y("div", {
200
211
  role: "separator",
201
212
  "aria-orientation": "vertical",
202
- "aria-label": Ae,
213
+ "aria-label": Ne,
203
214
  "aria-valuenow": t.column.getSize(),
204
- "aria-valuemin": t.column.columnDef.minSize ?? w,
205
- "aria-valuemax": t.column.columnDef.maxSize ?? he,
215
+ "aria-valuemin": t.column.columnDef.minSize ?? T,
216
+ "aria-valuemax": t.column.columnDef.maxSize ?? E,
206
217
  tabIndex: 0,
207
218
  draggable: !1,
208
219
  onMouseDown: t.getResizeHandler(),
209
220
  onTouchStart: t.getResizeHandler(),
210
- onKeyDown: (e) => vt(e, t),
221
+ onKeyDown: (e) => bt(e, t),
211
222
  className: e("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-none focus-visible:ring-[3px] focus-visible:ring-inset focus-visible:ring-[var(--ui-focus-primary)]", t.column.getIsResizing() && "bg-[var(--ui-resizable-border-color-active)] opacity-100")
212
223
  })]
213
224
  });
214
- return l.length === 0 ? /* @__PURE__ */ v(m, { children: u }, t.id) : /* @__PURE__ */ y(r, {
215
- disabled: Z || U !== void 0,
216
- children: [/* @__PURE__ */ v(o, { render: u }), /* @__PURE__ */ v(i, {
225
+ return p.length === 0 ? /* @__PURE__ */ y(_, { children: m }, t.id) : /* @__PURE__ */ b(r, {
226
+ disabled: X || V !== void 0,
227
+ children: [/* @__PURE__ */ y(o, { render: m }), /* @__PURE__ */ y(i, {
217
228
  className: "flex flex-col gap-1",
218
- children: l.map((e) => /* @__PURE__ */ y("span", { children: [
219
- /* @__PURE__ */ y("span", {
229
+ children: p.map((e) => /* @__PURE__ */ b("span", { children: [
230
+ /* @__PURE__ */ b("span", {
220
231
  className: "font-semibold",
221
232
  children: [e.label, ":"]
222
233
  }),
@@ -226,80 +237,80 @@ function E({ columns: b = [], data: x = [], table: E, getRowCanExpand: ve, rende
226
237
  })]
227
238
  }, t.id);
228
239
  })
229
- }, t.id)) }) }), /* @__PURE__ */ y(se, { children: [
230
- A ? Array.from({ length: be }).map((e, t) => /* @__PURE__ */ v(p, {
240
+ }, t.id)) }) }), /* @__PURE__ */ b(ie, { children: [
241
+ j ? Array.from({ length: be }).map((e, t) => /* @__PURE__ */ y(g, {
231
242
  className: "hover:bg-transparent",
232
- children: J.getVisibleLeafColumns().map((e) => /* @__PURE__ */ v(f, { children: /* @__PURE__ */ v("div", { className: "h-4 w-full animate-pulse rounded bg-[var(--ui-background-surface-secondary)]" }) }, e.id))
233
- }, `skeleton-${t}`)) : Q?.length ? Q.map((t, r) => {
234
- if (I) return /* @__PURE__ */ v(m, { children: I(t, r) }, t.id);
235
- let i = t.getIsSelected(), a = k && rt === t.id, o = i || a ? "bg-[var(--ui-table-data-row-color-active)]" : O && r % 2 == 1 ? "bg-[var(--ui-background-surface-secondary)]" : "bg-background group-hover:bg-[var(--ui-table-data-row-color-hover)]", s = !$ && pt === t.id;
236
- return /* @__PURE__ */ y(m, { children: [/* @__PURE__ */ v(p, {
243
+ children: q.getVisibleLeafColumns().map((e) => /* @__PURE__ */ y(h, { children: /* @__PURE__ */ y("div", { className: "h-4 w-full animate-pulse rounded bg-[var(--ui-background-surface-secondary)]" }) }, e.id))
244
+ }, `skeleton-${t}`)) : Z?.length ? Z.map((t, r) => {
245
+ if (P) return /* @__PURE__ */ y(_, { children: P(t, r) }, t.id);
246
+ let i = t.getIsSelected(), a = A && ot === t.id, o = i || a ? "bg-[var(--ui-table-data-row-color-active)]" : ve && r % 2 == 1 ? "bg-[var(--ui-background-surface-secondary)]" : "bg-background group-hover:bg-[var(--ui-table-data-row-color-hover)]", s = !Q && ht === t.id;
247
+ return /* @__PURE__ */ b(_, { children: [/* @__PURE__ */ y(g, {
237
248
  ref: (e) => {
238
- K.current[r] = e;
249
+ W.current[r] = e;
239
250
  },
240
- tabIndex: r === St ? 0 : -1,
241
- onFocus: () => Ct(r),
242
- onKeyDown: (e) => wt(e, r),
251
+ tabIndex: r === wt ? 0 : -1,
252
+ onFocus: () => Tt(r),
253
+ onKeyDown: (e) => Et(e, r),
243
254
  selected: i,
244
- onClick: k ? () => it(t.id) : void 0,
245
- className: e("group", k && "cursor-pointer", O && r % 2 == 1 && !i && !a && "bg-[var(--ui-background-surface-secondary)]", a && !i && "bg-[var(--ui-table-data-row-color-active)]", s && "hover:bg-transparent"),
255
+ onClick: A ? () => st(t.id) : void 0,
256
+ className: e("group", A && "cursor-pointer", ve && r % 2 == 1 && !i && !a && "bg-[var(--ui-background-surface-secondary)]", a && !i && "bg-[var(--ui-table-data-row-color-active)]", s && "hover:bg-transparent"),
246
257
  children: t.getVisibleCells().map((r) => {
247
258
  let i = r.column.getIsPinned();
248
- return r.column.id === "__actions" ? /* @__PURE__ */ v(oe, {
249
- style: C(r, X),
259
+ return r.column.id === "__actions" ? /* @__PURE__ */ y(re, {
260
+ style: w(r, Y),
250
261
  className: o,
251
- bulkSelectionActive: $,
252
- onMouseEnter: $ ? void 0 : () => mt(t.id),
253
- onMouseLeave: $ ? void 0 : () => mt((e) => e === t.id ? void 0 : e),
254
- children: V && /* @__PURE__ */ y(ne, { children: [/* @__PURE__ */ v(ie, {
255
- render: /* @__PURE__ */ v(n, { "aria-label": Ne }),
256
- children: /* @__PURE__ */ v(me, {})
257
- }), /* @__PURE__ */ v(re, {
262
+ bulkSelectionActive: Q,
263
+ onMouseEnter: Q ? void 0 : () => gt(t.id),
264
+ onMouseLeave: Q ? void 0 : () => gt((e) => e === t.id ? void 0 : e),
265
+ children: z && /* @__PURE__ */ b(m, { children: [/* @__PURE__ */ y(te, {
266
+ render: /* @__PURE__ */ y(n, { "aria-label": Ie }),
267
+ children: /* @__PURE__ */ y(pe, {})
268
+ }), /* @__PURE__ */ y(ee, {
258
269
  align: "end",
259
- children: V(t)
270
+ children: z(t)
260
271
  })] })
261
- }, r.id) : /* @__PURE__ */ v(f, {
272
+ }, r.id) : /* @__PURE__ */ y(h, {
262
273
  wrap: r.column.columnDef.meta?.wrap,
263
- style: C(r, X),
274
+ style: w(r, Y),
264
275
  className: e(i && o),
265
- children: d(r.column.columnDef.cell, r.getContext())
276
+ children: f(r.column.columnDef.cell, r.getContext())
266
277
  }, r.id);
267
278
  })
268
- }), D && t.getIsExpanded() && /* @__PURE__ */ v(p, {
279
+ }), _e && t.getIsExpanded() && /* @__PURE__ */ y(g, {
269
280
  className: "hover:bg-transparent",
270
- children: /* @__PURE__ */ v(f, {
281
+ children: /* @__PURE__ */ y(h, {
271
282
  className: "h-auto py-3",
272
283
  colSpan: t.getVisibleCells().length,
273
- children: D(t)
284
+ children: _e(t)
274
285
  })
275
286
  })] }, t.id);
276
- }) : L ? /* @__PURE__ */ v(p, { children: /* @__PURE__ */ v(f, {
277
- colSpan: J.getVisibleLeafColumns().length,
287
+ }) : F ? /* @__PURE__ */ y(g, { children: /* @__PURE__ */ y(h, {
288
+ colSpan: q.getVisibleLeafColumns().length,
278
289
  className: "h-24 text-center",
279
- children: L({ hasFilters: J.getState().columnFilters.length > 0 })
280
- }) }) : /* @__PURE__ */ v(p, { children: /* @__PURE__ */ v(f, {
281
- colSpan: J.getVisibleLeafColumns().length,
290
+ children: F({ hasFilters: q.getState().columnFilters.length > 0 })
291
+ }) }) : /* @__PURE__ */ y(g, { children: /* @__PURE__ */ y(h, {
292
+ colSpan: q.getVisibleLeafColumns().length,
282
293
  className: "h-24 text-center text-[var(--ui-table-data-value-color-disabled)]",
283
- children: je
294
+ children: Pe
284
295
  }) }),
285
- Y && !A && Q.length > 0 && z && /* @__PURE__ */ v(p, {
286
- ref: _t,
296
+ J && !j && Z.length > 0 && L && /* @__PURE__ */ y(g, {
297
+ ref: yt,
287
298
  "aria-hidden": !0,
288
299
  className: "hover:bg-transparent",
289
- children: /* @__PURE__ */ v(f, {
290
- colSpan: J.getVisibleLeafColumns().length,
300
+ children: /* @__PURE__ */ y(h, {
301
+ colSpan: q.getVisibleLeafColumns().length,
291
302
  className: "h-1 p-0"
292
303
  })
293
304
  }),
294
- Y && !A && Q.length > 0 && B && /* @__PURE__ */ v(p, {
305
+ J && !j && Z.length > 0 && R && /* @__PURE__ */ y(g, {
295
306
  className: "hover:bg-transparent",
296
- children: /* @__PURE__ */ v(f, {
297
- colSpan: J.getVisibleLeafColumns().length,
298
- children: /* @__PURE__ */ v("div", {
307
+ children: /* @__PURE__ */ y(h, {
308
+ colSpan: q.getVisibleLeafColumns().length,
309
+ children: /* @__PURE__ */ y("div", {
299
310
  role: "status",
300
311
  "aria-live": "polite",
301
312
  className: "h-4 w-full animate-pulse rounded bg-[var(--ui-background-surface-secondary)]",
302
- children: /* @__PURE__ */ v("span", {
313
+ children: /* @__PURE__ */ y("span", {
303
314
  className: "sr-only",
304
315
  children: "Loading more rows…"
305
316
  })
@@ -311,6 +322,6 @@ function E({ columns: b = [], data: x = [], table: E, getRowCanExpand: ve, rende
311
322
  });
312
323
  }
313
324
  //#endregion
314
- export { E as DataTable, C as getCellStyle, x as getColumnWidth, b as getPinnedStyle, ge as getResizeKeyboardStep, T as reorderColumn };
325
+ export { k as DataTable, w as getCellStyle, S as getColumnWidth, x as getPinnedStyle, D as getResizeKeyboardStep, O as reorderColumn };
315
326
 
316
327
  //# sourceMappingURL=data-table.js.map