@acronis-platform/ui-react 5.3.0 → 5.4.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.
@@ -5,7 +5,7 @@ import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
5
5
  function a({ table: a, children: o, selectedLabel: s = (e) => `${e} item${e === 1 ? "" : "s"} selected:`, clearLabel: c = "Deselect", loadedLabel: l }) {
6
6
  let u = a.getSelectedRowModel().rows.length, d = t(a);
7
7
  return /* @__PURE__ */ i("div", {
8
- className: "flex items-center gap-4",
8
+ className: "flex items-center gap-4 px-[var(--ui-table-global-cell-padding-x)]",
9
9
  children: [/* @__PURE__ */ r("fieldset", {
10
10
  disabled: !d,
11
11
  className: "m-0 flex min-w-0 items-center gap-4 border-0 p-0",
@@ -1 +1 @@
1
- {"version":3,"file":"data-table-bulk-actions-bar.js","names":[],"sources":["../../../../src/components/ui/data-table/data-table-bulk-actions-bar.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { Table } from '@tanstack/react-table';\n\nimport { Button } from '../button';\nimport { isBulkSelectionActive } from './data-table-selection';\n\ninterface DataTableBulkActionsBarProps<TData> {\n table: Table<TData>;\n /**\n * Bulk actions offered for the current selection — rendered leading, ahead\n * of the trailing summary/Deselect control. Wrapped in a native `<fieldset\n * disabled>` while nothing is selected, so every nested control (a `Button`\n * renders a plain `<button>`) picks up the disabled state and styling for\n * free — no per-action wiring needed. Each action reads the selection off\n * the same `table` instance (`table.getSelectedRowModel().rows`).\n */\n children?: ReactNode;\n /** Builds the trailing selection summary from the selected-row count. */\n selectedLabel?: (count: number) => string;\n /** Label of the trailing control that clears the selection. */\n clearLabel?: string;\n /**\n * Trailing summary shown in place of the selection summary while nothing is\n * selected — e.g. `\"25 of 1250 items loaded\"`. Omit to render nothing in\n * that state.\n */\n loadedLabel?: ReactNode;\n}\n\n// Thin TanStack adapter: reads the selected-row count off\n// `table.getSelectedRowModel()` and routes Deselect back through\n// `table.resetRowSelection()`. It owns no state of its own.\n//\n// Always mounted (unlike a bar that appears/disappears with selection) — it\n// just toggles between two states (Figma 5916-11286 disabled / 5916-11991\n// enabled), on the same `isBulkSelectionActive` threshold that hides the\n// per-row actions column: with nothing selected, the leading actions are\n// disabled and the trailing side shows `loadedLabel`; once at least one row\n// is selected — including exactly one — the actions enable and the trailing\n// side switches to the selection summary + Deselect.\nexport function DataTableBulkActionsBar<TData>({\n table,\n children,\n selectedLabel = (count) => `${count} item${count === 1 ? '' : 's'} selected:`,\n clearLabel = 'Deselect',\n loadedLabel,\n}: DataTableBulkActionsBarProps<TData>) {\n const selectedCount = table.getSelectedRowModel().rows.length;\n const hasSelection = isBulkSelectionActive(table);\n\n return (\n <div className=\"flex items-center gap-4\">\n <fieldset\n disabled={!hasSelection}\n className=\"m-0 flex min-w-0 items-center gap-4 border-0 p-0\"\n >\n {children}\n </fieldset>\n <div className=\"ms-auto flex items-center gap-2\">\n {hasSelection ? (\n <>\n <span className=\"text-sm\">{selectedLabel(selectedCount)}</span>\n <Button\n variant=\"ghost\"\n className=\"h-8\"\n onClick={() => table.resetRowSelection()}\n >\n {clearLabel}\n </Button>\n </>\n ) : (\n loadedLabel !== undefined && (\n <span className=\"text-sm text-muted-foreground\">{loadedLabel}</span>\n )\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;AAwCA,SAAgB,EAA+B,EAC7C,UACA,aACA,oBAAiB,MAAU,GAAG,EAAM,OAAO,MAAU,IAAI,KAAK,IAAI,aAClE,gBAAa,YACb,kBACsC;CACtC,IAAM,IAAgB,EAAM,oBAAoB,CAAC,CAAC,KAAK,QACjD,IAAe,EAAsB,CAAK;CAEhD,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAAC,YAAD;GACE,UAAU,CAAC;GACX,WAAU;GAET;EACO,CAAA,GACV,kBAAC,OAAD;GAAK,WAAU;GACZ,UAAA,IACC,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,QAAD;IAAM,WAAU;IAAW,UAAA,EAAc,CAAa;GAAQ,CAAA,GAC9D,kBAAC,GAAD;IACE,SAAQ;IACR,WAAU;IACV,eAAe,EAAM,kBAAkB;IAEtC,UAAA;GACK,CAAA,CACR,EAAA,CAAA,IAEF,MAAgB,KAAA,KACd,kBAAC,QAAD;IAAM,WAAU;IAAiC,UAAA;GAAkB,CAAA;EAGpE,CAAA,CACF;;AAET"}
1
+ {"version":3,"file":"data-table-bulk-actions-bar.js","names":[],"sources":["../../../../src/components/ui/data-table/data-table-bulk-actions-bar.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { Table } from '@tanstack/react-table';\n\nimport { Button } from '../button';\nimport { isBulkSelectionActive } from './data-table-selection';\n\ninterface DataTableBulkActionsBarProps<TData> {\n table: Table<TData>;\n /**\n * Bulk actions offered for the current selection — rendered leading, ahead\n * of the trailing summary/Deselect control. Wrapped in a native `<fieldset\n * disabled>` while nothing is selected, so every nested control (a `Button`\n * renders a plain `<button>`) picks up the disabled state and styling for\n * free — no per-action wiring needed. Each action reads the selection off\n * the same `table` instance (`table.getSelectedRowModel().rows`).\n */\n children?: ReactNode;\n /** Builds the trailing selection summary from the selected-row count. */\n selectedLabel?: (count: number) => string;\n /** Label of the trailing control that clears the selection. */\n clearLabel?: string;\n /**\n * Trailing summary shown in place of the selection summary while nothing is\n * selected — e.g. `\"25 of 1250 items loaded\"`. Omit to render nothing in\n * that state.\n */\n loadedLabel?: ReactNode;\n}\n\n// Thin TanStack adapter: reads the selected-row count off\n// `table.getSelectedRowModel()` and routes Deselect back through\n// `table.resetRowSelection()`. It owns no state of its own.\n//\n// Always mounted (unlike a bar that appears/disappears with selection) — it\n// just toggles between two states (Figma 5916-11286 disabled / 5916-11991\n// enabled), on the same `isBulkSelectionActive` threshold that hides the\n// per-row actions column: with nothing selected, the leading actions are\n// disabled and the trailing side shows `loadedLabel`; once at least one row\n// is selected — including exactly one — the actions enable and the trailing\n// side switches to the selection summary + Deselect.\nexport function DataTableBulkActionsBar<TData>({\n table,\n children,\n selectedLabel = (count) => `${count} item${count === 1 ? '' : 's'} selected:`,\n clearLabel = 'Deselect',\n loadedLabel,\n}: DataTableBulkActionsBarProps<TData>) {\n const selectedCount = table.getSelectedRowModel().rows.length;\n const hasSelection = isBulkSelectionActive(table);\n\n return (\n <div className=\"flex items-center gap-4 px-[var(--ui-table-global-cell-padding-x)]\">\n <fieldset\n disabled={!hasSelection}\n className=\"m-0 flex min-w-0 items-center gap-4 border-0 p-0\"\n >\n {children}\n </fieldset>\n <div className=\"ms-auto flex items-center gap-2\">\n {hasSelection ? (\n <>\n <span className=\"text-sm\">{selectedLabel(selectedCount)}</span>\n <Button\n variant=\"ghost\"\n className=\"h-8\"\n onClick={() => table.resetRowSelection()}\n >\n {clearLabel}\n </Button>\n </>\n ) : (\n loadedLabel !== undefined && (\n <span className=\"text-sm text-muted-foreground\">{loadedLabel}</span>\n )\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;AAwCA,SAAgB,EAA+B,EAC7C,UACA,aACA,oBAAiB,MAAU,GAAG,EAAM,OAAO,MAAU,IAAI,KAAK,IAAI,aAClE,gBAAa,YACb,kBACsC;CACtC,IAAM,IAAgB,EAAM,oBAAoB,CAAC,CAAC,KAAK,QACjD,IAAe,EAAsB,CAAK;CAEhD,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAAC,YAAD;GACE,UAAU,CAAC;GACX,WAAU;GAET;EACO,CAAA,GACV,kBAAC,OAAD;GAAK,WAAU;GACZ,UAAA,IACC,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,QAAD;IAAM,WAAU;IAAW,UAAA,EAAc,CAAa;GAAQ,CAAA,GAC9D,kBAAC,GAAD;IACE,SAAQ;IACR,WAAU;IACV,eAAe,EAAM,kBAAkB;IAEtC,UAAA;GACK,CAAA,CACR,EAAA,CAAA,IAEF,MAAgB,KAAA,KACd,kBAAC,QAAD;IAAM,WAAU;IAAiC,UAAA;GAAkB,CAAA;EAGpE,CAAA,CACF;;AAET"}
@@ -4,8 +4,9 @@ import { jsx as t } from "react/jsx-runtime";
4
4
  function n({ table: n, ...r }) {
5
5
  let i = n.getAllColumns().filter((e) => e.accessorFn !== void 0 && e.getCanHide()).map((e) => ({
6
6
  id: e.id,
7
- label: e.id,
8
- hidden: !e.getIsVisible()
7
+ label: e.columnDef.meta?.label ?? (typeof e.columnDef.header == "string" ? e.columnDef.header : e.id),
8
+ hidden: !e.getIsVisible(),
9
+ category: e.columnDef.meta?.category
9
10
  }));
10
11
  return /* @__PURE__ */ t(e, {
11
12
  columns: i,
@@ -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>\n extends Pick<\n TableViewOptionsProps,\n 'triggerLabel' | 'iconOnly' | 'triggerAriaLabel'\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: column.id,\n hidden: !column.getIsVisible(),\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":";;;AAeA,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,OAAO,EAAO;EACd,QAAQ,CAAC,EAAO,aAAa;CAC/B,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.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"}
@@ -8,11 +8,11 @@ import { DropdownMenu as ne, DropdownMenuContent as re, DropdownMenuTrigger as i
8
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
9
  import { isBulkSelectionActive as de } from "./data-table-selection.js";
10
10
  import { DataTableViewOptions as fe } from "./data-table-view-options.js";
11
- import { Fragment as m, useEffect as pe, useMemo as me, useRef as he, useState as h } from "react";
12
- import { jsx as g, jsxs as _ } from "react/jsx-runtime";
13
- import { EllipsisIcon as ge } from "@acronis-platform/icons-react/stroke-mono";
11
+ import { Fragment as m, useEffect as pe, useMemo as h, useRef as me, useState as g } from "react";
12
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
13
+ import { EllipsisIcon as he } from "@acronis-platform/icons-react/stroke-mono";
14
14
  //#region src/components/ui/data-table/data-table.tsx
15
- function v(e) {
15
+ function y(e) {
16
16
  let t = e.getIsPinned();
17
17
  if (t) return {
18
18
  position: "sticky",
@@ -22,19 +22,19 @@ function v(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 y(e, t) {
25
+ function b(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 b(e, t) {
30
- let n = v(e.column), r = y(e.column, t);
29
+ function ge(e, t) {
30
+ let n = y(e.column), r = b(e.column, t);
31
31
  if (!(!n && r === void 0)) return {
32
32
  ...n,
33
33
  width: r
34
34
  };
35
35
  }
36
36
  function x(e, t) {
37
- let n = v(e.column), r = y(e.column, t);
37
+ let n = y(e.column), r = b(e.column, t);
38
38
  if (!(!n && r === void 0)) return {
39
39
  ...n,
40
40
  width: r
@@ -66,21 +66,21 @@ var _e = {
66
66
  action: "Drag border"
67
67
  }
68
68
  };
69
- function E({ columns: v = [], data: y = [], 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, headerHints: Fe }) {
70
- let H = {
69
+ function E({ columns: y = [], data: b = [], table: E, getRowId: ve, getRowCanExpand: ye, renderExpandedRow: D, striped: be = !1, bordered: xe = !1, highlightCurrentRow: O = !1, skeleton: k = !1, skeletonRows: Se = 5, enableColumnResizing: Ce = !1, onColumnSizingChange: we, enableColumnReordering: Te = !1, columnOrder: Ee, onColumnOrderChange: De, columnVisibility: Oe, onColumnVisibilityChange: ke, rowSelection: A, onRowSelectionChange: Ae, manualSorting: j = !1, sorting: M, onSortingChange: je, renderRow: N, renderEmptyState: P, paginationMode: F = "page", onLoadMore: Me, loadMoreRootMargin: Ne, hasNextPage: I = !1, resizeColumnLabel: Pe = "Resize column", emptyLabel: Fe = "No results.", isLoadingMore: L = !1, hideActionColumn: Ie = !1, renderRowActions: R, rowActionsLabel: Le = "Row actions", columnSettingsLabel: Re, columnSearchPlaceholder: ze, showAllColumnsLabel: Be, noColumnsFoundLabel: Ve, headerHints: He }) {
70
+ let z = {
71
71
  ..._e,
72
- ...Fe
73
- }, [Ie, Le] = h([]), Re = F ?? Ie, [ze, Be] = h([]), [Ve, He] = h({}), Ue = we ?? Ve, [We, Ge] = h({}), Ke = N ?? We, [qe, Je] = h({}), [Ye, Xe] = h({}), [Ze, Qe] = h([]), $e = M ?? Ze, [U, W] = h(), [et, tt] = h(), [nt, G] = h(0), K = he([]), rt = (e) => {
74
- Xe(e), xe?.(e);
75
- }, it = (e) => {
76
- M === void 0 && Qe(e), Ce?.(e);
77
- }, at = (e) => {
78
- He(e), Te?.(e);
79
- }, ot = (e) => {
80
- F === void 0 && Le(e), De?.(e);
81
- }, st = (e) => {
82
- N === void 0 && Ge(e), Ee?.(e);
83
- }, ct = !Me && !E, lt = me(() => ct ? [{
72
+ ...He
73
+ }, [Ue, We] = g([]), Ge = M ?? Ue, [Ke, qe] = g([]), [Je, Ye] = g({}), Xe = Oe ?? Je, [Ze, Qe] = g({}), $e = A ?? Ze, [et, tt] = g({}), [nt, rt] = g({}), [it, at] = g([]), ot = Ee ?? it, [B, V] = g(), [st, ct] = g(), [lt, H] = g(0), U = me([]), ut = (e) => {
74
+ rt(e), we?.(e);
75
+ }, dt = (e) => {
76
+ Ee === void 0 && at(e), De?.(e);
77
+ }, ft = (e) => {
78
+ Ye(e), ke?.(e);
79
+ }, pt = (e) => {
80
+ M === void 0 && We(e), je?.(e);
81
+ }, mt = (e) => {
82
+ A === void 0 && Qe(e), Ae?.(e);
83
+ }, W = !Ie && !E, G = h(() => W ? [{
84
84
  id: "__actions",
85
85
  size: 48,
86
86
  enableSorting: !1,
@@ -88,114 +88,119 @@ function E({ columns: v = [], data: y = [], table: E, getRowCanExpand: ve, rende
88
88
  meta: { pin: "right" },
89
89
  header: () => null,
90
90
  cell: () => null
91
- }] : [], [ct]), ut = me(() => [...v, ...lt], [v, lt]), [dt, ft] = h(), pt = te({
92
- data: y,
93
- columns: ut,
94
- enableColumnResizing: j,
91
+ }] : [], [W]), K = h(() => [...y, ...G], [y, G]), [ht, q] = g(), gt = te({
92
+ data: b,
93
+ columns: K,
94
+ getRowId: ve,
95
+ enableColumnResizing: Ce,
95
96
  columnResizeMode: "onChange",
96
97
  getCoreRowModel: s(),
97
98
  getExpandedRowModel: c(),
98
- ...R === "page" ? { getPaginationRowModel: u() } : {},
99
- getRowCanExpand: ve,
100
- onExpandedChange: Je,
101
- manualSorting: P,
102
- onSortingChange: ot,
103
- ...P ? {} : { getSortedRowModel: ee() },
104
- onColumnFiltersChange: Be,
99
+ ...F === "page" ? { getPaginationRowModel: u() } : {},
100
+ getRowCanExpand: ye,
101
+ onExpandedChange: tt,
102
+ manualSorting: j,
103
+ onSortingChange: pt,
104
+ ...j ? {} : { getSortedRowModel: ee() },
105
+ onColumnFiltersChange: qe,
105
106
  getFilteredRowModel: l(),
106
- onColumnVisibilityChange: at,
107
- onRowSelectionChange: st,
108
- onColumnSizingChange: rt,
109
- onColumnOrderChange: it,
107
+ onColumnVisibilityChange: ft,
108
+ onRowSelectionChange: mt,
109
+ onColumnSizingChange: ut,
110
+ onColumnOrderChange: dt,
111
+ initialState: W ? { columnPinning: { right: ["__actions"] } } : void 0,
110
112
  state: {
111
- sorting: Re,
112
- columnFilters: ze,
113
- columnVisibility: Ue,
114
- rowSelection: Ke,
115
- expanded: qe,
116
- columnSizing: Ye,
117
- columnOrder: $e
113
+ sorting: Ge,
114
+ columnFilters: Ke,
115
+ columnVisibility: Xe,
116
+ rowSelection: $e,
117
+ expanded: et,
118
+ columnSizing: nt,
119
+ columnOrder: ot
118
120
  }
119
- }), q = E ?? pt, J = !E && R === "infinite", Y = j && !E, mt = Se && !E, X = !!q.getState().columnSizingInfo.isResizingColumn;
121
+ }), J = E ?? gt, Y = !E && F === "infinite", X = Ce && !E, _t = Te && !E, Z = !!J.getState().columnSizingInfo.isResizingColumn;
120
122
  pe(() => {
121
- if (X) return document.documentElement.setAttribute("data-ui-column-resizing", ""), () => {
123
+ if (Z) return document.documentElement.setAttribute("data-ui-column-resizing", ""), () => {
122
124
  document.documentElement.removeAttribute("data-ui-column-resizing");
123
125
  };
124
- }, [X]);
125
- let ht = t({
126
- onIntersect: () => Oe?.(),
127
- disabled: !J || !z || B,
128
- rootMargin: ke
129
- }), gt = (e, t) => {
126
+ }, [Z]);
127
+ let vt = t({
128
+ onIntersect: () => Me?.(),
129
+ disabled: !Y || !I || L,
130
+ rootMargin: Ne
131
+ }), yt = (e, t) => {
130
132
  if (e.ctrlKey || e.altKey || e.metaKey) return;
131
133
  let n = w(e.key, t.column.getSize(), {
132
134
  shiftKey: e.shiftKey,
133
135
  min: t.column.columnDef.minSize ?? S,
134
136
  max: t.column.columnDef.maxSize ?? C
135
137
  });
136
- n !== void 0 && (e.preventDefault(), q.setColumnSizing((e) => ({
138
+ n !== void 0 && (e.preventDefault(), J.setColumnSizing((e) => ({
137
139
  ...e,
138
140
  [t.column.id]: n
139
141
  })));
140
- }, _t = (e, t) => {
141
- e.dataTransfer && (e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", t)), W(t);
142
- }, vt = (e) => {
142
+ }, bt = (e, t) => {
143
+ e.dataTransfer && (e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", t)), V(t);
144
+ }, xt = (e) => {
143
145
  e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "move");
144
- }, yt = (e, t) => {
145
- if (e.preventDefault(), !U) return;
146
- let n = q.getState().columnOrder, r = n.length ? n : q.getAllLeafColumns().map((e) => e.id);
147
- q.setColumnOrder(T(r, U, t)), W(void 0);
146
+ }, St = (e, t) => {
147
+ if (e.preventDefault(), !B) return;
148
+ let n = J.getState().columnOrder, r = n.length ? n : J.getAllLeafColumns().map((e) => e.id);
149
+ J.setColumnOrder(T(r, B, t)), V(void 0);
148
150
  };
149
151
  pe(() => {
150
- E || q.getAllLeafColumns().forEach((e) => {
152
+ E || J.getAllLeafColumns().forEach((e) => {
151
153
  e.pin(e.columnDef.meta?.pin ?? !1);
152
154
  });
153
155
  }, [
154
- q,
155
- v,
156
+ J,
157
+ K,
156
158
  E
157
159
  ]);
158
- let Z = q.getRowModel().rows, Q = de(q), bt = Z.length ? Math.min(nt, Z.length - 1) : 0, xt = (e) => {
159
- G(e);
160
- }, St = (e, t) => {
160
+ let Q = J.getRowModel().rows, $ = de(J), Ct = Q.length ? Math.min(lt, Q.length - 1) : 0, wt = (e) => {
161
+ H(e);
162
+ }, Tt = (e, t) => {
161
163
  if (e.target !== e.currentTarget || e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
162
- let n = e.key === "ArrowDown" ? Math.min(t + 1, Z.length - 1) : Math.max(t - 1, 0);
163
- n !== t && (e.preventDefault(), G(n), K.current[n]?.focus());
164
- }, Ct = 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";
165
- return /* @__PURE__ */ g("div", {
166
- className: e("rounded-md border border-[var(--ui-table-global-row-border-color)]", Ct),
167
- children: /* @__PURE__ */ _(ae, {
168
- style: Y ? { width: q.getCenterTotalSize() } : void 0,
169
- children: [/* @__PURE__ */ g(a, { children: /* @__PURE__ */ g(le, { children: q.getHeaderGroups().map((t) => /* @__PURE__ */ g(p, {
164
+ let n = e.key === "ArrowDown" ? Math.min(t + 1, Q.length - 1) : Math.max(t - 1, 0);
165
+ n !== t && (e.preventDefault(), H(n), U.current[n]?.focus());
166
+ }, Et = xe ? "[&_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, Dt = "bg-background";
167
+ return /* @__PURE__ */ _("div", {
168
+ className: e("rounded-md border border-[var(--ui-table-global-row-border-color)]", Et),
169
+ children: /* @__PURE__ */ v(ae, {
170
+ style: X ? { width: J.getCenterTotalSize() } : void 0,
171
+ children: [/* @__PURE__ */ _(a, { children: /* @__PURE__ */ _(le, { children: J.getHeaderGroups().map((t) => /* @__PURE__ */ _(p, {
170
172
  className: "hover:bg-transparent",
171
173
  children: t.headers.map((t) => {
172
- let n = t.column.getIsPinned(), a = Y && t.column.getCanResize() && t.column.id !== "select", s = mt && !t.isPlaceholder && !n, c = !t.isPlaceholder && t.column.getCanSort(), l = [
173
- c && H.sort,
174
- s && H.reorder,
175
- a && H.resize
174
+ let n = t.column.getIsPinned(), a = X && t.column.getCanResize() && t.column.id !== "select", s = _t && !t.isPlaceholder && !n, c = !t.isPlaceholder && t.column.getCanSort(), l = [
175
+ c && z.sort,
176
+ s && z.reorder,
177
+ a && z.resize
176
178
  ].filter((e) => !!e);
177
- if (t.column.id === "__actions") return /* @__PURE__ */ g(ue, {
178
- style: b(t, Y),
179
- className: $,
180
- children: /* @__PURE__ */ g(fe, {
181
- table: q,
179
+ if (t.column.id === "__actions") return /* @__PURE__ */ _(ue, {
180
+ style: ge(t, X),
181
+ className: Dt,
182
+ children: /* @__PURE__ */ _(fe, {
183
+ table: J,
182
184
  iconOnly: !0,
183
- triggerAriaLabel: Pe
185
+ triggerAriaLabel: Re,
186
+ searchPlaceholder: ze,
187
+ showAllLabel: Be,
188
+ noResultsLabel: Ve
184
189
  })
185
190
  }, t.id);
186
- let u = /* @__PURE__ */ _(ce, {
191
+ let u = /* @__PURE__ */ v(ce, {
187
192
  wrap: t.column.columnDef.meta?.wrap,
188
- style: b(t, Y),
189
- draggable: s && !X || void 0,
190
- onDragStart: s ? (e) => _t(e, t.column.id) : void 0,
191
- onDragOver: s ? vt : void 0,
192
- onDrop: s ? (e) => yt(e, t.column.id) : void 0,
193
- onDragEnd: s ? () => W(void 0) : void 0,
194
- className: e(a && "relative", c && !X && "transition-colors hover:bg-[var(--ui-table-header-cell-color-hover)] active:bg-[var(--ui-table-header-cell-color-active)]", s && !X && "cursor-grab select-none active:cursor-grabbing", s && U === t.column.id && "opacity-50", n && $),
195
- children: [t.isPlaceholder ? null : d(t.column.columnDef.header, t.getContext()), a && /* @__PURE__ */ g("div", {
193
+ style: ge(t, X),
194
+ draggable: s && !Z || void 0,
195
+ onDragStart: s ? (e) => bt(e, t.column.id) : void 0,
196
+ onDragOver: s ? xt : void 0,
197
+ onDrop: s ? (e) => St(e, t.column.id) : void 0,
198
+ onDragEnd: s ? () => V(void 0) : void 0,
199
+ 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 && B === t.column.id && "opacity-50", n && Dt),
200
+ children: [t.isPlaceholder ? null : d(t.column.columnDef.header, t.getContext()), a && /* @__PURE__ */ _("div", {
196
201
  role: "separator",
197
202
  "aria-orientation": "vertical",
198
- "aria-label": Ae,
203
+ "aria-label": Pe,
199
204
  "aria-valuenow": t.column.getSize(),
200
205
  "aria-valuemin": t.column.columnDef.minSize ?? S,
201
206
  "aria-valuemax": t.column.columnDef.maxSize ?? C,
@@ -203,16 +208,16 @@ function E({ columns: v = [], data: y = [], table: E, getRowCanExpand: ve, rende
203
208
  draggable: !1,
204
209
  onMouseDown: t.getResizeHandler(),
205
210
  onTouchStart: t.getResizeHandler(),
206
- onKeyDown: (e) => gt(e, t),
207
- 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-[3px] focus-visible:outline-(--ui-focus-primary)", t.column.getIsResizing() && "bg-[var(--ui-resizable-border-color-active)] opacity-100")
211
+ onKeyDown: (e) => yt(e, t),
212
+ 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")
208
213
  })]
209
214
  });
210
- return l.length === 0 ? /* @__PURE__ */ g(m, { children: u }, t.id) : /* @__PURE__ */ _(r, {
211
- disabled: X || U !== void 0,
212
- children: [/* @__PURE__ */ g(o, { render: u }), /* @__PURE__ */ g(i, {
215
+ return l.length === 0 ? /* @__PURE__ */ _(m, { children: u }, t.id) : /* @__PURE__ */ v(r, {
216
+ disabled: Z || B !== void 0,
217
+ children: [/* @__PURE__ */ _(o, { render: u }), /* @__PURE__ */ _(i, {
213
218
  className: "flex flex-col gap-1",
214
- children: l.map((e) => /* @__PURE__ */ _("span", { children: [
215
- /* @__PURE__ */ _("span", {
219
+ children: l.map((e) => /* @__PURE__ */ v("span", { children: [
220
+ /* @__PURE__ */ v("span", {
216
221
  className: "font-semibold",
217
222
  children: [e.label, ":"]
218
223
  }),
@@ -222,80 +227,80 @@ function E({ columns: v = [], data: y = [], table: E, getRowCanExpand: ve, rende
222
227
  })]
223
228
  }, t.id);
224
229
  })
225
- }, t.id)) }) }), /* @__PURE__ */ _(se, { children: [
226
- A ? Array.from({ length: be }).map((e, t) => /* @__PURE__ */ g(p, {
230
+ }, t.id)) }) }), /* @__PURE__ */ v(se, { children: [
231
+ k ? Array.from({ length: Se }).map((e, t) => /* @__PURE__ */ _(p, {
227
232
  className: "hover:bg-transparent",
228
- children: q.getVisibleLeafColumns().map((e) => /* @__PURE__ */ g(f, { children: /* @__PURE__ */ g("div", { className: "h-4 w-full animate-pulse rounded bg-[var(--ui-background-surface-secondary)]" }) }, e.id))
229
- }, `skeleton-${t}`)) : Z?.length ? Z.map((t, r) => {
230
- if (I) return /* @__PURE__ */ g(m, { children: I(t, r) }, t.id);
231
- let i = t.getIsSelected(), a = k && et === 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 = !Q && dt === t.id;
232
- return /* @__PURE__ */ _(m, { children: [/* @__PURE__ */ g(p, {
233
+ children: J.getVisibleLeafColumns().map((e) => /* @__PURE__ */ _(f, { children: /* @__PURE__ */ _("div", { className: "h-4 w-full animate-pulse rounded bg-[var(--ui-background-surface-secondary)]" }) }, e.id))
234
+ }, `skeleton-${t}`)) : Q?.length ? Q.map((t, r) => {
235
+ if (N) return /* @__PURE__ */ _(m, { children: N(t, r) }, t.id);
236
+ let i = t.getIsSelected(), a = O && st === t.id, o = i || a ? "bg-[var(--ui-table-data-row-color-active)]" : be && r % 2 == 1 ? "bg-[var(--ui-background-surface-secondary)]" : "bg-background group-hover:bg-[var(--ui-table-data-row-color-hover)]", s = !$ && ht === t.id;
237
+ return /* @__PURE__ */ v(m, { children: [/* @__PURE__ */ _(p, {
233
238
  ref: (e) => {
234
- K.current[r] = e;
239
+ U.current[r] = e;
235
240
  },
236
- tabIndex: r === bt ? 0 : -1,
237
- onFocus: () => xt(r),
238
- onKeyDown: (e) => St(e, r),
241
+ tabIndex: r === Ct ? 0 : -1,
242
+ onFocus: () => wt(r),
243
+ onKeyDown: (e) => Tt(e, r),
239
244
  selected: i,
240
- onClick: k ? () => tt(t.id) : void 0,
241
- 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"),
245
+ onClick: O ? () => ct(t.id) : void 0,
246
+ className: e("group", O && "cursor-pointer", be && 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"),
242
247
  children: t.getVisibleCells().map((r) => {
243
248
  let i = r.column.getIsPinned();
244
- return r.column.id === "__actions" ? /* @__PURE__ */ g(oe, {
245
- style: x(r, Y),
249
+ return r.column.id === "__actions" ? /* @__PURE__ */ _(oe, {
250
+ style: x(r, X),
246
251
  className: o,
247
- bulkSelectionActive: Q,
248
- onMouseEnter: Q ? void 0 : () => ft(t.id),
249
- onMouseLeave: Q ? void 0 : () => ft((e) => e === t.id ? void 0 : e),
250
- children: V && /* @__PURE__ */ _(ne, { children: [/* @__PURE__ */ g(ie, {
251
- render: /* @__PURE__ */ g(n, { "aria-label": Ne }),
252
- children: /* @__PURE__ */ g(ge, {})
253
- }), /* @__PURE__ */ g(re, {
252
+ bulkSelectionActive: $,
253
+ onMouseEnter: $ ? void 0 : () => q(t.id),
254
+ onMouseLeave: $ ? void 0 : () => q((e) => e === t.id ? void 0 : e),
255
+ children: R && /* @__PURE__ */ v(ne, { children: [/* @__PURE__ */ _(ie, {
256
+ render: /* @__PURE__ */ _(n, { "aria-label": Le }),
257
+ children: /* @__PURE__ */ _(he, {})
258
+ }), /* @__PURE__ */ _(re, {
254
259
  align: "end",
255
- children: V(t)
260
+ children: R(t)
256
261
  })] })
257
- }, r.id) : /* @__PURE__ */ g(f, {
262
+ }, r.id) : /* @__PURE__ */ _(f, {
258
263
  wrap: r.column.columnDef.meta?.wrap,
259
- style: x(r, Y),
264
+ style: x(r, X),
260
265
  className: e(i && o),
261
266
  children: d(r.column.columnDef.cell, r.getContext())
262
267
  }, r.id);
263
268
  })
264
- }), D && t.getIsExpanded() && /* @__PURE__ */ g(p, {
269
+ }), D && t.getIsExpanded() && /* @__PURE__ */ _(p, {
265
270
  className: "hover:bg-transparent",
266
- children: /* @__PURE__ */ g(f, {
271
+ children: /* @__PURE__ */ _(f, {
267
272
  className: "h-auto py-3",
268
273
  colSpan: t.getVisibleCells().length,
269
274
  children: D(t)
270
275
  })
271
276
  })] }, t.id);
272
- }) : L ? /* @__PURE__ */ g(p, { children: /* @__PURE__ */ g(f, {
273
- colSpan: q.getVisibleLeafColumns().length,
277
+ }) : P ? /* @__PURE__ */ _(p, { children: /* @__PURE__ */ _(f, {
278
+ colSpan: J.getVisibleLeafColumns().length,
274
279
  className: "h-24 text-center",
275
- children: L({ hasFilters: q.getState().columnFilters.length > 0 })
276
- }) }) : /* @__PURE__ */ g(p, { children: /* @__PURE__ */ g(f, {
277
- colSpan: q.getVisibleLeafColumns().length,
280
+ children: P({ hasFilters: J.getState().columnFilters.length > 0 })
281
+ }) }) : /* @__PURE__ */ _(p, { children: /* @__PURE__ */ _(f, {
282
+ colSpan: J.getVisibleLeafColumns().length,
278
283
  className: "h-24 text-center text-[var(--ui-table-data-value-color-disabled)]",
279
- children: je
284
+ children: Fe
280
285
  }) }),
281
- J && !A && Z.length > 0 && z && /* @__PURE__ */ g(p, {
282
- ref: ht,
286
+ Y && !k && Q.length > 0 && I && /* @__PURE__ */ _(p, {
287
+ ref: vt,
283
288
  "aria-hidden": !0,
284
289
  className: "hover:bg-transparent",
285
- children: /* @__PURE__ */ g(f, {
286
- colSpan: q.getVisibleLeafColumns().length,
290
+ children: /* @__PURE__ */ _(f, {
291
+ colSpan: J.getVisibleLeafColumns().length,
287
292
  className: "h-1 p-0"
288
293
  })
289
294
  }),
290
- J && !A && Z.length > 0 && B && /* @__PURE__ */ g(p, {
295
+ Y && !k && Q.length > 0 && L && /* @__PURE__ */ _(p, {
291
296
  className: "hover:bg-transparent",
292
- children: /* @__PURE__ */ g(f, {
293
- colSpan: q.getVisibleLeafColumns().length,
294
- children: /* @__PURE__ */ g("div", {
297
+ children: /* @__PURE__ */ _(f, {
298
+ colSpan: J.getVisibleLeafColumns().length,
299
+ children: /* @__PURE__ */ _("div", {
295
300
  role: "status",
296
301
  "aria-live": "polite",
297
302
  className: "h-4 w-full animate-pulse rounded bg-[var(--ui-background-surface-secondary)]",
298
- children: /* @__PURE__ */ g("span", {
303
+ children: /* @__PURE__ */ _("span", {
299
304
  className: "sr-only",
300
305
  children: "Loading more rows…"
301
306
  })
@@ -307,6 +312,6 @@ function E({ columns: v = [], data: y = [], table: E, getRowCanExpand: ve, rende
307
312
  });
308
313
  }
309
314
  //#endregion
310
- export { E as DataTable, x as getCellStyle, y as getColumnWidth, v as getPinnedStyle, w as getResizeKeyboardStep, T as reorderColumn };
315
+ export { E as DataTable, x as getCellStyle, b as getColumnWidth, y as getPinnedStyle, w as getResizeKeyboardStep, T as reorderColumn };
311
316
 
312
317
  //# sourceMappingURL=data-table.js.map