@uipath/apollo-wind 2.7.0 → 2.8.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.
@@ -37,23 +37,59 @@ const external_dropdown_menu_cjs_namespaceObject = require("./dropdown-menu.cjs"
37
37
  const external_editable_cell_cjs_namespaceObject = require("./editable-cell.cjs");
38
38
  const external_input_cjs_namespaceObject = require("./input.cjs");
39
39
  const external_table_cjs_namespaceObject = require("./table.cjs");
40
+ const index_cjs_namespaceObject = require("../../lib/index.cjs");
40
41
  const react_table_namespaceObject = require("@tanstack/react-table");
41
- function DataTable({ columns, data, searchKey, searchPlaceholder = 'Search...', showColumnToggle = true, showPagination = true, pageSize = 10, editable = false, onCellUpdate, resizable = false, compact = false, columnToggleText = 'Columns', rowSelection: controlledRowSelection, onRowSelectionChange: controlledOnRowSelectionChange, toolbarContent }) {
42
- const [sorting, setSorting] = external_react_namespaceObject.useState([]);
42
+ function DataTable({ columns, data, searchKey, searchPlaceholder = 'Search...', showColumnToggle = true, showPagination = true, pageSize = 10, editable = false, onCellUpdate, resizable = false, compact = false, columnToggleText = 'Columns', rowSelection: controlledRowSelection, onRowSelectionChange: controlledOnRowSelectionChange, sorting: controlledSorting, onSortingChange: controlledOnSortingChange, initialSorting, columnSizing: controlledColumnSizing, onColumnSizingChange: controlledOnColumnSizingChange, columnVisibility: controlledColumnVisibility, onColumnVisibilityChange: controlledOnColumnVisibilityChange, globalFilterFn, allowWrap = false, toolbarContent, maxBodyHeight }) {
43
+ const useBlockLayout = void 0 !== maxBodyHeight;
44
+ const blockRowClasses = '[&>tr]:table [&>tr]:w-full [&>tr]:table-fixed';
45
+ const [internalSorting, setInternalSorting] = external_react_namespaceObject.useState(initialSorting ?? []);
43
46
  const [columnFilters, setColumnFilters] = external_react_namespaceObject.useState([]);
44
- const [columnVisibility, setColumnVisibility] = external_react_namespaceObject.useState({});
47
+ const [internalColumnVisibility, setInternalColumnVisibility] = external_react_namespaceObject.useState({});
48
+ const [internalColumnSizing, setInternalColumnSizing] = external_react_namespaceObject.useState({});
45
49
  const [internalRowSelection, setInternalRowSelection] = external_react_namespaceObject.useState({});
46
- const isControlled = void 0 !== controlledRowSelection;
47
- const rowSelection = isControlled ? controlledRowSelection : internalRowSelection;
50
+ const [globalFilter, setGlobalFilter] = external_react_namespaceObject.useState('');
51
+ const isRowSelectionControlled = void 0 !== controlledRowSelection;
52
+ const rowSelection = isRowSelectionControlled ? controlledRowSelection : internalRowSelection;
53
+ const rowSelectionRef = external_react_namespaceObject.useRef(rowSelection);
54
+ rowSelectionRef.current = rowSelection;
48
55
  const setRowSelection = external_react_namespaceObject.useCallback((updater)=>{
49
- const next = 'function' == typeof updater ? updater(rowSelection) : updater;
50
- if (!isControlled) setInternalRowSelection(next);
56
+ const next = 'function' == typeof updater ? updater(rowSelectionRef.current) : updater;
57
+ if (!isRowSelectionControlled) setInternalRowSelection(next);
51
58
  controlledOnRowSelectionChange?.(next);
52
59
  }, [
53
- isControlled,
54
- rowSelection,
60
+ isRowSelectionControlled,
55
61
  controlledOnRowSelectionChange
56
62
  ]);
63
+ const isSortingControlled = void 0 !== controlledSorting;
64
+ const sorting = isSortingControlled ? controlledSorting : internalSorting;
65
+ const onSortingChange = external_react_namespaceObject.useCallback((updater)=>{
66
+ if (!isSortingControlled) setInternalSorting((prev)=>'function' == typeof updater ? updater(prev) : updater);
67
+ controlledOnSortingChange?.(updater);
68
+ }, [
69
+ isSortingControlled,
70
+ controlledOnSortingChange
71
+ ]);
72
+ const isColumnSizingControlled = void 0 !== controlledColumnSizing;
73
+ const columnSizing = isColumnSizingControlled ? controlledColumnSizing : internalColumnSizing;
74
+ const onColumnSizingChange = external_react_namespaceObject.useCallback((updater)=>{
75
+ if (!isColumnSizingControlled) setInternalColumnSizing((prev)=>'function' == typeof updater ? updater(prev) : updater);
76
+ controlledOnColumnSizingChange?.(updater);
77
+ }, [
78
+ isColumnSizingControlled,
79
+ controlledOnColumnSizingChange
80
+ ]);
81
+ const isColumnVisibilityControlled = void 0 !== controlledColumnVisibility;
82
+ const columnVisibility = isColumnVisibilityControlled ? controlledColumnVisibility : internalColumnVisibility;
83
+ const onColumnVisibilityChange = external_react_namespaceObject.useCallback((updater)=>{
84
+ if (!isColumnVisibilityControlled) setInternalColumnVisibility((prev)=>'function' == typeof updater ? updater(prev) : updater);
85
+ controlledOnColumnVisibilityChange?.(updater);
86
+ }, [
87
+ isColumnVisibilityControlled,
88
+ controlledOnColumnVisibilityChange
89
+ ]);
90
+ const tanstackGlobalFilterFn = external_react_namespaceObject.useMemo(()=>globalFilterFn ? (row, _columnId, filterValue)=>globalFilterFn(row.original, filterValue) : void 0, [
91
+ globalFilterFn
92
+ ]);
57
93
  const processedColumns = external_react_namespaceObject.useMemo(()=>{
58
94
  if (!editable || !onCellUpdate) return columns;
59
95
  return columns.map((col)=>{
@@ -77,21 +113,26 @@ function DataTable({ columns, data, searchKey, searchPlaceholder = 'Search...',
77
113
  const table = (0, react_table_namespaceObject.useReactTable)({
78
114
  data,
79
115
  columns: processedColumns,
80
- onSortingChange: setSorting,
116
+ onSortingChange,
81
117
  onColumnFiltersChange: setColumnFilters,
82
118
  getCoreRowModel: (0, react_table_namespaceObject.getCoreRowModel)(),
83
119
  getPaginationRowModel: (0, react_table_namespaceObject.getPaginationRowModel)(),
84
120
  getSortedRowModel: (0, react_table_namespaceObject.getSortedRowModel)(),
85
121
  getFilteredRowModel: (0, react_table_namespaceObject.getFilteredRowModel)(),
86
- onColumnVisibilityChange: setColumnVisibility,
122
+ onColumnVisibilityChange,
123
+ onColumnSizingChange,
87
124
  onRowSelectionChange: setRowSelection,
125
+ onGlobalFilterChange: setGlobalFilter,
126
+ globalFilterFn: tanstackGlobalFilterFn,
88
127
  enableColumnResizing: resizable,
89
128
  columnResizeMode: 'onChange',
90
129
  state: {
91
130
  sorting,
92
131
  columnFilters,
93
132
  columnVisibility,
94
- rowSelection
133
+ columnSizing,
134
+ rowSelection,
135
+ globalFilter
95
136
  },
96
137
  initialState: {
97
138
  pagination: {
@@ -105,7 +146,12 @@ function DataTable({ columns, data, searchKey, searchPlaceholder = 'Search...',
105
146
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
106
147
  className: "flex items-center gap-4 py-4",
107
148
  children: [
108
- searchKey && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_input_cjs_namespaceObject.Input, {
149
+ globalFilterFn ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_input_cjs_namespaceObject.Input, {
150
+ placeholder: searchPlaceholder,
151
+ value: globalFilter,
152
+ onChange: (event)=>setGlobalFilter(event.target.value),
153
+ className: "max-w-sm"
154
+ }) : searchKey && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_input_cjs_namespaceObject.Input, {
109
155
  placeholder: searchPlaceholder,
110
156
  value: table.getColumn(searchKey)?.getFilterValue() ?? '',
111
157
  onChange: (event)=>table.getColumn(searchKey)?.setFilterValue(event.target.value),
@@ -142,19 +188,21 @@ function DataTable({ columns, data, searchKey, searchPlaceholder = 'Search...',
142
188
  ]
143
189
  }),
144
190
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
145
- className: "rounded-md border overflow-auto",
191
+ className: (0, index_cjs_namespaceObject.cn)('rounded-md border', useBlockLayout ? 'overflow-x-auto' : 'overflow-auto'),
146
192
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_table_cjs_namespaceObject.Table, {
193
+ className: useBlockLayout ? 'block' : void 0,
147
194
  style: resizable ? {
148
195
  width: table.getTotalSize(),
149
196
  tableLayout: 'fixed'
150
197
  } : void 0,
151
198
  children: [
152
199
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_table_cjs_namespaceObject.TableHeader, {
200
+ className: (0, index_cjs_namespaceObject.cn)('sticky top-0 z-10 bg-background', useBlockLayout && `block ${blockRowClasses}`),
153
201
  children: table.getHeaderGroups().map((headerGroup)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_table_cjs_namespaceObject.TableRow, {
154
202
  children: headerGroup.headers.map((header)=>{
155
203
  const { column } = header;
156
204
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_table_cjs_namespaceObject.TableHead, {
157
- className: compact ? 'relative h-8 px-2 py-0' : 'relative py-0',
205
+ className: (0, index_cjs_namespaceObject.cn)(compact ? 'relative h-8 px-2 py-0' : 'relative py-0', resizable && 'overflow-visible'),
158
206
  style: {
159
207
  width: resizable ? header.getSize() : 150 !== column.getSize() ? column.getSize() : void 0,
160
208
  minWidth: column.columnDef.minSize,
@@ -173,7 +221,7 @@ function DataTable({ columns, data, searchKey, searchPlaceholder = 'Search...',
173
221
  onTouchStart: header.getResizeHandler(),
174
222
  className: "absolute -right-1 top-0 z-10 h-full w-2 cursor-col-resize select-none touch-none group",
175
223
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
176
- className: `h-full w-px mx-auto ${header.column.getIsResizing() ? 'bg-primary' : 'group-hover:bg-primary/50'}`
224
+ className: (0, index_cjs_namespaceObject.cn)('h-full mx-auto transition-all duration-150', header.column.getIsResizing() ? 'w-0.5 bg-primary' : 'w-px group-hover:w-0.5 group-hover:bg-primary')
177
225
  })
178
226
  })
179
227
  ]
@@ -182,12 +230,23 @@ function DataTable({ columns, data, searchKey, searchPlaceholder = 'Search...',
182
230
  }, headerGroup.id))
183
231
  }),
184
232
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_table_cjs_namespaceObject.TableBody, {
233
+ className: useBlockLayout ? (0, index_cjs_namespaceObject.cn)('block overflow-y-auto', blockRowClasses) : void 0,
234
+ style: useBlockLayout ? {
235
+ maxHeight: maxBodyHeight
236
+ } : void 0,
237
+ tabIndex: useBlockLayout ? 0 : void 0,
185
238
  children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_table_cjs_namespaceObject.TableRow, {
186
239
  "data-state": row.getIsSelected() && 'selected',
187
240
  children: row.getVisibleCells().map((cell)=>{
188
241
  const { column } = cell;
189
242
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_table_cjs_namespaceObject.TableCell, {
190
- className: compact ? 'h-8 truncate px-2 py-0' : 'h-12 truncate px-4 py-0',
243
+ className: (0, index_cjs_namespaceObject.cn)(allowWrap ? compact ? 'min-h-8 px-2 py-1' : 'min-h-12 px-4 py-2' : compact ? 'h-8 truncate px-2 py-0' : 'h-12 truncate px-4 py-0'),
244
+ onMouseEnter: (e)=>{
245
+ if (allowWrap) return;
246
+ const el = e.currentTarget;
247
+ const value = cell.getValue();
248
+ el.title = el.scrollWidth > el.clientWidth && ('string' == typeof value || 'number' == typeof value) ? String(value) : '';
249
+ },
191
250
  style: {
192
251
  width: resizable ? cell.column.getSize() : 150 !== column.getSize() ? column.getSize() : void 0,
193
252
  minWidth: column.columnDef.minSize,
@@ -263,10 +322,15 @@ function DataTableColumnHeader({ column, title, children }) {
263
322
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_button_cjs_namespaceObject.Button, {
264
323
  variant: "ghost",
265
324
  size: "sm",
266
- className: "-ml-3 h-8 data-[state=open]:bg-accent",
325
+ className: "-ml-3 h-8 max-w-full data-[state=open]:bg-accent",
267
326
  onClick: handleClick,
327
+ onMouseEnter: (e)=>{
328
+ const span = e.currentTarget.querySelector('span');
329
+ e.currentTarget.title = span && span.scrollWidth > span.clientWidth ? title : '';
330
+ },
268
331
  children: [
269
332
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
333
+ className: "truncate min-w-0",
270
334
  children: title
271
335
  }),
272
336
  children,
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { Column, ColumnDef, RowSelectionState } from '@tanstack/react-table';
2
+ import { Column, ColumnDef, ColumnSizingState, OnChangeFn, RowSelectionState, SortingState, VisibilityState } from '@tanstack/react-table';
3
3
  export interface DataTableProps<TData, TValue> {
4
4
  columns: ColumnDef<TData, TValue>[];
5
5
  data: TData[];
@@ -15,9 +15,37 @@ export interface DataTableProps<TData, TValue> {
15
15
  columnToggleText?: string;
16
16
  rowSelection?: RowSelectionState;
17
17
  onRowSelectionChange?: (selection: RowSelectionState) => void;
18
+ /** Controlled sort state. When provided, the table runs in controlled mode for sorting. */
19
+ sorting?: SortingState;
20
+ onSortingChange?: OnChangeFn<SortingState>;
21
+ /** Initial sort applied when `sorting` is uncontrolled. */
22
+ initialSorting?: SortingState;
23
+ /** Controlled column-sizing state. Pairs with `resizable`. */
24
+ columnSizing?: ColumnSizingState;
25
+ onColumnSizingChange?: OnChangeFn<ColumnSizingState>;
26
+ /** Controlled column-visibility state. */
27
+ columnVisibility?: VisibilityState;
28
+ onColumnVisibilityChange?: OnChangeFn<VisibilityState>;
29
+ /**
30
+ * When set, the search input filters whole rows via this predicate.
31
+ * Takes precedence over `searchKey`.
32
+ */
33
+ globalFilterFn?: (row: TData, query: string) => boolean;
34
+ /**
35
+ * When true, body cells render multi-line content (drops the default `truncate` class).
36
+ * Useful for tables that show JSON, long text, or preformatted content.
37
+ * Default: false (single-line + ellipsis).
38
+ */
39
+ allowWrap?: boolean;
18
40
  toolbarContent?: React.ReactNode;
41
+ /**
42
+ * When set, the table body scrolls independently with this max height (any CSS length).
43
+ * The header stays above the scroll region and the vertical scrollbar is confined to the
44
+ * body, leaving the header row clear of scrollbar tracks.
45
+ */
46
+ maxBodyHeight?: string;
19
47
  }
20
- export declare function DataTable<TData, TValue>({ columns, data, searchKey, searchPlaceholder, showColumnToggle, showPagination, pageSize, editable, onCellUpdate, resizable, compact, columnToggleText, rowSelection: controlledRowSelection, onRowSelectionChange: controlledOnRowSelectionChange, toolbarContent, }: DataTableProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
48
+ export declare function DataTable<TData, TValue>({ columns, data, searchKey, searchPlaceholder, showColumnToggle, showPagination, pageSize, editable, onCellUpdate, resizable, compact, columnToggleText, rowSelection: controlledRowSelection, onRowSelectionChange: controlledOnRowSelectionChange, sorting: controlledSorting, onSortingChange: controlledOnSortingChange, initialSorting, columnSizing: controlledColumnSizing, onColumnSizingChange: controlledOnColumnSizingChange, columnVisibility: controlledColumnVisibility, onColumnVisibilityChange: controlledOnColumnVisibilityChange, globalFilterFn, allowWrap, toolbarContent, maxBodyHeight, }: DataTableProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
21
49
  export declare function DataTableColumnHeader<TData, TValue>({ column, title, children, }: {
22
50
  column: Column<TData, TValue>;
23
51
  title: string;
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useCallback, useMemo, useState } from "react";
2
+ import { useCallback, useMemo, useRef, useState } from "react";
3
3
  import { ArrowDown, ArrowUp, ArrowUpDown, ChevronDown } from "lucide-react";
4
4
  import { Button } from "./button.js";
5
5
  import { Checkbox } from "./checkbox.js";
@@ -7,23 +7,59 @@ import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMe
7
7
  import { EditableCell } from "./editable-cell.js";
8
8
  import { Input } from "./input.js";
9
9
  import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "./table.js";
10
+ import { cn } from "../../lib/index.js";
10
11
  import { flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
11
- function DataTable({ columns, data, searchKey, searchPlaceholder = 'Search...', showColumnToggle = true, showPagination = true, pageSize = 10, editable = false, onCellUpdate, resizable = false, compact = false, columnToggleText = 'Columns', rowSelection: controlledRowSelection, onRowSelectionChange: controlledOnRowSelectionChange, toolbarContent }) {
12
- const [sorting, setSorting] = useState([]);
12
+ function DataTable({ columns, data, searchKey, searchPlaceholder = 'Search...', showColumnToggle = true, showPagination = true, pageSize = 10, editable = false, onCellUpdate, resizable = false, compact = false, columnToggleText = 'Columns', rowSelection: controlledRowSelection, onRowSelectionChange: controlledOnRowSelectionChange, sorting: controlledSorting, onSortingChange: controlledOnSortingChange, initialSorting, columnSizing: controlledColumnSizing, onColumnSizingChange: controlledOnColumnSizingChange, columnVisibility: controlledColumnVisibility, onColumnVisibilityChange: controlledOnColumnVisibilityChange, globalFilterFn, allowWrap = false, toolbarContent, maxBodyHeight }) {
13
+ const useBlockLayout = void 0 !== maxBodyHeight;
14
+ const blockRowClasses = '[&>tr]:table [&>tr]:w-full [&>tr]:table-fixed';
15
+ const [internalSorting, setInternalSorting] = useState(initialSorting ?? []);
13
16
  const [columnFilters, setColumnFilters] = useState([]);
14
- const [columnVisibility, setColumnVisibility] = useState({});
17
+ const [internalColumnVisibility, setInternalColumnVisibility] = useState({});
18
+ const [internalColumnSizing, setInternalColumnSizing] = useState({});
15
19
  const [internalRowSelection, setInternalRowSelection] = useState({});
16
- const isControlled = void 0 !== controlledRowSelection;
17
- const rowSelection = isControlled ? controlledRowSelection : internalRowSelection;
20
+ const [globalFilter, setGlobalFilter] = useState('');
21
+ const isRowSelectionControlled = void 0 !== controlledRowSelection;
22
+ const rowSelection = isRowSelectionControlled ? controlledRowSelection : internalRowSelection;
23
+ const rowSelectionRef = useRef(rowSelection);
24
+ rowSelectionRef.current = rowSelection;
18
25
  const setRowSelection = useCallback((updater)=>{
19
- const next = 'function' == typeof updater ? updater(rowSelection) : updater;
20
- if (!isControlled) setInternalRowSelection(next);
26
+ const next = 'function' == typeof updater ? updater(rowSelectionRef.current) : updater;
27
+ if (!isRowSelectionControlled) setInternalRowSelection(next);
21
28
  controlledOnRowSelectionChange?.(next);
22
29
  }, [
23
- isControlled,
24
- rowSelection,
30
+ isRowSelectionControlled,
25
31
  controlledOnRowSelectionChange
26
32
  ]);
33
+ const isSortingControlled = void 0 !== controlledSorting;
34
+ const sorting = isSortingControlled ? controlledSorting : internalSorting;
35
+ const onSortingChange = useCallback((updater)=>{
36
+ if (!isSortingControlled) setInternalSorting((prev)=>'function' == typeof updater ? updater(prev) : updater);
37
+ controlledOnSortingChange?.(updater);
38
+ }, [
39
+ isSortingControlled,
40
+ controlledOnSortingChange
41
+ ]);
42
+ const isColumnSizingControlled = void 0 !== controlledColumnSizing;
43
+ const columnSizing = isColumnSizingControlled ? controlledColumnSizing : internalColumnSizing;
44
+ const onColumnSizingChange = useCallback((updater)=>{
45
+ if (!isColumnSizingControlled) setInternalColumnSizing((prev)=>'function' == typeof updater ? updater(prev) : updater);
46
+ controlledOnColumnSizingChange?.(updater);
47
+ }, [
48
+ isColumnSizingControlled,
49
+ controlledOnColumnSizingChange
50
+ ]);
51
+ const isColumnVisibilityControlled = void 0 !== controlledColumnVisibility;
52
+ const columnVisibility = isColumnVisibilityControlled ? controlledColumnVisibility : internalColumnVisibility;
53
+ const onColumnVisibilityChange = useCallback((updater)=>{
54
+ if (!isColumnVisibilityControlled) setInternalColumnVisibility((prev)=>'function' == typeof updater ? updater(prev) : updater);
55
+ controlledOnColumnVisibilityChange?.(updater);
56
+ }, [
57
+ isColumnVisibilityControlled,
58
+ controlledOnColumnVisibilityChange
59
+ ]);
60
+ const tanstackGlobalFilterFn = useMemo(()=>globalFilterFn ? (row, _columnId, filterValue)=>globalFilterFn(row.original, filterValue) : void 0, [
61
+ globalFilterFn
62
+ ]);
27
63
  const processedColumns = useMemo(()=>{
28
64
  if (!editable || !onCellUpdate) return columns;
29
65
  return columns.map((col)=>{
@@ -47,21 +83,26 @@ function DataTable({ columns, data, searchKey, searchPlaceholder = 'Search...',
47
83
  const table = useReactTable({
48
84
  data,
49
85
  columns: processedColumns,
50
- onSortingChange: setSorting,
86
+ onSortingChange,
51
87
  onColumnFiltersChange: setColumnFilters,
52
88
  getCoreRowModel: getCoreRowModel(),
53
89
  getPaginationRowModel: getPaginationRowModel(),
54
90
  getSortedRowModel: getSortedRowModel(),
55
91
  getFilteredRowModel: getFilteredRowModel(),
56
- onColumnVisibilityChange: setColumnVisibility,
92
+ onColumnVisibilityChange,
93
+ onColumnSizingChange,
57
94
  onRowSelectionChange: setRowSelection,
95
+ onGlobalFilterChange: setGlobalFilter,
96
+ globalFilterFn: tanstackGlobalFilterFn,
58
97
  enableColumnResizing: resizable,
59
98
  columnResizeMode: 'onChange',
60
99
  state: {
61
100
  sorting,
62
101
  columnFilters,
63
102
  columnVisibility,
64
- rowSelection
103
+ columnSizing,
104
+ rowSelection,
105
+ globalFilter
65
106
  },
66
107
  initialState: {
67
108
  pagination: {
@@ -75,7 +116,12 @@ function DataTable({ columns, data, searchKey, searchPlaceholder = 'Search...',
75
116
  /*#__PURE__*/ jsxs("div", {
76
117
  className: "flex items-center gap-4 py-4",
77
118
  children: [
78
- searchKey && /*#__PURE__*/ jsx(Input, {
119
+ globalFilterFn ? /*#__PURE__*/ jsx(Input, {
120
+ placeholder: searchPlaceholder,
121
+ value: globalFilter,
122
+ onChange: (event)=>setGlobalFilter(event.target.value),
123
+ className: "max-w-sm"
124
+ }) : searchKey && /*#__PURE__*/ jsx(Input, {
79
125
  placeholder: searchPlaceholder,
80
126
  value: table.getColumn(searchKey)?.getFilterValue() ?? '',
81
127
  onChange: (event)=>table.getColumn(searchKey)?.setFilterValue(event.target.value),
@@ -112,19 +158,21 @@ function DataTable({ columns, data, searchKey, searchPlaceholder = 'Search...',
112
158
  ]
113
159
  }),
114
160
  /*#__PURE__*/ jsx("div", {
115
- className: "rounded-md border overflow-auto",
161
+ className: cn('rounded-md border', useBlockLayout ? 'overflow-x-auto' : 'overflow-auto'),
116
162
  children: /*#__PURE__*/ jsxs(Table, {
163
+ className: useBlockLayout ? 'block' : void 0,
117
164
  style: resizable ? {
118
165
  width: table.getTotalSize(),
119
166
  tableLayout: 'fixed'
120
167
  } : void 0,
121
168
  children: [
122
169
  /*#__PURE__*/ jsx(TableHeader, {
170
+ className: cn('sticky top-0 z-10 bg-background', useBlockLayout && `block ${blockRowClasses}`),
123
171
  children: table.getHeaderGroups().map((headerGroup)=>/*#__PURE__*/ jsx(TableRow, {
124
172
  children: headerGroup.headers.map((header)=>{
125
173
  const { column } = header;
126
174
  return /*#__PURE__*/ jsxs(TableHead, {
127
- className: compact ? 'relative h-8 px-2 py-0' : 'relative py-0',
175
+ className: cn(compact ? 'relative h-8 px-2 py-0' : 'relative py-0', resizable && 'overflow-visible'),
128
176
  style: {
129
177
  width: resizable ? header.getSize() : 150 !== column.getSize() ? column.getSize() : void 0,
130
178
  minWidth: column.columnDef.minSize,
@@ -143,7 +191,7 @@ function DataTable({ columns, data, searchKey, searchPlaceholder = 'Search...',
143
191
  onTouchStart: header.getResizeHandler(),
144
192
  className: "absolute -right-1 top-0 z-10 h-full w-2 cursor-col-resize select-none touch-none group",
145
193
  children: /*#__PURE__*/ jsx("div", {
146
- className: `h-full w-px mx-auto ${header.column.getIsResizing() ? 'bg-primary' : 'group-hover:bg-primary/50'}`
194
+ className: cn('h-full mx-auto transition-all duration-150', header.column.getIsResizing() ? 'w-0.5 bg-primary' : 'w-px group-hover:w-0.5 group-hover:bg-primary')
147
195
  })
148
196
  })
149
197
  ]
@@ -152,12 +200,23 @@ function DataTable({ columns, data, searchKey, searchPlaceholder = 'Search...',
152
200
  }, headerGroup.id))
153
201
  }),
154
202
  /*#__PURE__*/ jsx(TableBody, {
203
+ className: useBlockLayout ? cn('block overflow-y-auto', blockRowClasses) : void 0,
204
+ style: useBlockLayout ? {
205
+ maxHeight: maxBodyHeight
206
+ } : void 0,
207
+ tabIndex: useBlockLayout ? 0 : void 0,
155
208
  children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row)=>/*#__PURE__*/ jsx(TableRow, {
156
209
  "data-state": row.getIsSelected() && 'selected',
157
210
  children: row.getVisibleCells().map((cell)=>{
158
211
  const { column } = cell;
159
212
  return /*#__PURE__*/ jsx(TableCell, {
160
- className: compact ? 'h-8 truncate px-2 py-0' : 'h-12 truncate px-4 py-0',
213
+ className: cn(allowWrap ? compact ? 'min-h-8 px-2 py-1' : 'min-h-12 px-4 py-2' : compact ? 'h-8 truncate px-2 py-0' : 'h-12 truncate px-4 py-0'),
214
+ onMouseEnter: (e)=>{
215
+ if (allowWrap) return;
216
+ const el = e.currentTarget;
217
+ const value = cell.getValue();
218
+ el.title = el.scrollWidth > el.clientWidth && ('string' == typeof value || 'number' == typeof value) ? String(value) : '';
219
+ },
161
220
  style: {
162
221
  width: resizable ? cell.column.getSize() : 150 !== column.getSize() ? column.getSize() : void 0,
163
222
  minWidth: column.columnDef.minSize,
@@ -233,10 +292,15 @@ function DataTableColumnHeader({ column, title, children }) {
233
292
  return /*#__PURE__*/ jsxs(Button, {
234
293
  variant: "ghost",
235
294
  size: "sm",
236
- className: "-ml-3 h-8 data-[state=open]:bg-accent",
295
+ className: "-ml-3 h-8 max-w-full data-[state=open]:bg-accent",
237
296
  onClick: handleClick,
297
+ onMouseEnter: (e)=>{
298
+ const span = e.currentTarget.querySelector('span');
299
+ e.currentTarget.title = span && span.scrollWidth > span.clientWidth ? title : '';
300
+ },
238
301
  children: [
239
302
  /*#__PURE__*/ jsx("span", {
303
+ className: "truncate min-w-0",
240
304
  children: title
241
305
  }),
242
306
  children,
@@ -15,7 +15,7 @@ var __webpack_modules__ = {
15
15
  "./avatar" (module) {
16
16
  module.exports = require("./avatar.cjs");
17
17
  },
18
- "@/components/ui/badge" (module) {
18
+ "./badge" (module) {
19
19
  module.exports = require("./badge.cjs");
20
20
  },
21
21
  "./breadcrumb" (module) {
@@ -33,7 +33,7 @@ var __webpack_modules__ = {
33
33
  "@/components/ui/card" (module) {
34
34
  module.exports = require("./card.cjs");
35
35
  },
36
- "@/components/ui/checkbox" (module) {
36
+ "./checkbox" (module) {
37
37
  module.exports = require("./checkbox.cjs");
38
38
  },
39
39
  "./collapsible" (module) {
@@ -60,7 +60,7 @@ var __webpack_modules__ = {
60
60
  "@/components/ui/dialog" (module) {
61
61
  module.exports = require("./dialog.cjs");
62
62
  },
63
- "@/components/ui/dropdown-menu" (module) {
63
+ "./dropdown-menu" (module) {
64
64
  module.exports = require("./dropdown-menu.cjs");
65
65
  },
66
66
  "@/components/ui/editable-cell" (module) {
@@ -138,7 +138,7 @@ var __webpack_modules__ = {
138
138
  "./switch" (module) {
139
139
  module.exports = require("./switch.cjs");
140
140
  },
141
- "@/components/ui/table" (module) {
141
+ "./table" (module) {
142
142
  module.exports = require("./table.cjs");
143
143
  },
144
144
  "./tabs" (module) {
@@ -150,7 +150,7 @@ var __webpack_modules__ = {
150
150
  "./toggle-group" (module) {
151
151
  module.exports = require("./toggle-group.cjs");
152
152
  },
153
- "@/components/ui/toggle" (module) {
153
+ "./toggle" (module) {
154
154
  module.exports = require("./toggle.cjs");
155
155
  },
156
156
  "./tooltip" (module) {
@@ -241,7 +241,7 @@ var __webpack_exports__ = {};
241
241
  "default"
242
242
  ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_avatar__rspack_import_4[__rspack_import_key];
243
243
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
244
- var _badge__rspack_import_5 = __webpack_require__("@/components/ui/badge");
244
+ var _badge__rspack_import_5 = __webpack_require__("./badge");
245
245
  var __rspack_reexport = {};
246
246
  for(const __rspack_import_key in _badge__rspack_import_5)if ([
247
247
  "TreeView",
@@ -283,7 +283,7 @@ var __webpack_exports__ = {};
283
283
  "default"
284
284
  ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_card__rspack_import_10[__rspack_import_key];
285
285
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
286
- var _checkbox__rspack_import_11 = __webpack_require__("@/components/ui/checkbox");
286
+ var _checkbox__rspack_import_11 = __webpack_require__("./checkbox");
287
287
  var __rspack_reexport = {};
288
288
  for(const __rspack_import_key in _checkbox__rspack_import_11)if ([
289
289
  "TreeView",
@@ -346,7 +346,7 @@ var __webpack_exports__ = {};
346
346
  "default"
347
347
  ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_dialog__rspack_import_19[__rspack_import_key];
348
348
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
349
- var _dropdown_menu__rspack_import_20 = __webpack_require__("@/components/ui/dropdown-menu");
349
+ var _dropdown_menu__rspack_import_20 = __webpack_require__("./dropdown-menu");
350
350
  var __rspack_reexport = {};
351
351
  for(const __rspack_import_key in _dropdown_menu__rspack_import_20)if ([
352
352
  "TreeView",
@@ -528,7 +528,7 @@ var __webpack_exports__ = {};
528
528
  "default"
529
529
  ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_switch__rspack_import_45[__rspack_import_key];
530
530
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
531
- var _table__rspack_import_46 = __webpack_require__("@/components/ui/table");
531
+ var _table__rspack_import_46 = __webpack_require__("./table");
532
532
  var __rspack_reexport = {};
533
533
  for(const __rspack_import_key in _table__rspack_import_46)if ([
534
534
  "TreeView",
@@ -549,7 +549,7 @@ var __webpack_exports__ = {};
549
549
  "default"
550
550
  ].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_textarea__rspack_import_48[__rspack_import_key];
551
551
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
552
- var _toggle__rspack_import_49 = __webpack_require__("@/components/ui/toggle");
552
+ var _toggle__rspack_import_49 = __webpack_require__("./toggle");
553
553
  var __rspack_reexport = {};
554
554
  for(const __rspack_import_key in _toggle__rspack_import_49)if ([
555
555
  "TreeView",
@@ -65,13 +65,13 @@ const TableFooter = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ c
65
65
  TableFooter.displayName = 'TableFooter';
66
66
  const TableRow = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("tr", {
67
67
  ref: ref,
68
- className: (0, index_cjs_namespaceObject.cn)('border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted', className),
68
+ className: (0, index_cjs_namespaceObject.cn)('border-b transition-colors bg-background hover:bg-muted/50 data-[state=selected]:bg-muted', className),
69
69
  ...props
70
70
  }));
71
71
  TableRow.displayName = 'TableRow';
72
72
  const TableHead = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("th", {
73
73
  ref: ref,
74
- className: (0, index_cjs_namespaceObject.cn)('h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0', className),
74
+ className: (0, index_cjs_namespaceObject.cn)('h-12 px-4 text-left align-middle font-medium text-muted-foreground overflow-hidden bg-background [&:has([role=checkbox])]:pr-0', className),
75
75
  ...props
76
76
  }));
77
77
  TableHead.displayName = 'TableHead';
@@ -30,13 +30,13 @@ const TableFooter = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#
30
30
  TableFooter.displayName = 'TableFooter';
31
31
  const TableRow = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx("tr", {
32
32
  ref: ref,
33
- className: cn('border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted', className),
33
+ className: cn('border-b transition-colors bg-background hover:bg-muted/50 data-[state=selected]:bg-muted', className),
34
34
  ...props
35
35
  }));
36
36
  TableRow.displayName = 'TableRow';
37
37
  const TableHead = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx("th", {
38
38
  ref: ref,
39
- className: cn('h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0', className),
39
+ className: cn('h-12 px-4 text-left align-middle font-medium text-muted-foreground overflow-hidden bg-background [&:has([role=checkbox])]:pr-0', className),
40
40
  ...props
41
41
  }));
42
42
  TableHead.displayName = 'TableHead';
package/dist/styles.css CHANGED
@@ -1146,9 +1146,15 @@
1146
1146
  .min-h-5 {
1147
1147
  min-height: calc(var(--spacing) * 5);
1148
1148
  }
1149
+ .min-h-8 {
1150
+ min-height: calc(var(--spacing) * 8);
1151
+ }
1149
1152
  .min-h-10 {
1150
1153
  min-height: calc(var(--spacing) * 10);
1151
1154
  }
1155
+ .min-h-12 {
1156
+ min-height: calc(var(--spacing) * 12);
1157
+ }
1152
1158
  .min-h-\[32px\] {
1153
1159
  min-height: 32px;
1154
1160
  }
@@ -1170,6 +1176,9 @@
1170
1176
  .w-0 {
1171
1177
  width: calc(var(--spacing) * 0);
1172
1178
  }
1179
+ .w-0\.5 {
1180
+ width: calc(var(--spacing) * 0.5);
1181
+ }
1173
1182
  .w-1 {
1174
1183
  width: calc(var(--spacing) * 1);
1175
1184
  }
@@ -1897,6 +1906,9 @@
1897
1906
  .overflow-hidden {
1898
1907
  overflow: hidden;
1899
1908
  }
1909
+ .overflow-visible {
1910
+ overflow: visible;
1911
+ }
1900
1912
  .overflow-x-auto {
1901
1913
  overflow-x: auto;
1902
1914
  }
@@ -4131,6 +4143,13 @@
4131
4143
  background-color: var(--foreground-accent);
4132
4144
  }
4133
4145
  }
4146
+ .group-hover\:w-0\.5 {
4147
+ &:is(:where(.group):hover *) {
4148
+ @media (hover: hover) {
4149
+ width: calc(var(--spacing) * 0.5);
4150
+ }
4151
+ }
4152
+ }
4134
4153
  .group-hover\:scale-\[1\.2\] {
4135
4154
  &:is(:where(.group):hover *) {
4136
4155
  @media (hover: hover) {
@@ -4167,13 +4186,10 @@
4167
4186
  }
4168
4187
  }
4169
4188
  }
4170
- .group-hover\:bg-primary\/50 {
4189
+ .group-hover\:bg-primary {
4171
4190
  &:is(:where(.group):hover *) {
4172
4191
  @media (hover: hover) {
4173
4192
  background-color: var(--primary);
4174
- @supports (color: color-mix(in lab, red, red)) {
4175
- background-color: color-mix(in oklab, var(--primary) 50%, transparent);
4176
- }
4177
4193
  }
4178
4194
  }
4179
4195
  }
@@ -6091,6 +6107,11 @@
6091
6107
  height: calc(var(--spacing) * 4);
6092
6108
  }
6093
6109
  }
6110
+ .\[\&_table\]\:\!w-full {
6111
+ & table {
6112
+ width: 100% !important;
6113
+ }
6114
+ }
6094
6115
  .\[\&_tr\]\:border-b {
6095
6116
  & tr {
6096
6117
  border-bottom-style: var(--tw-border-style);
@@ -6321,6 +6342,21 @@
6321
6342
  padding-left: calc(var(--spacing) * 7);
6322
6343
  }
6323
6344
  }
6345
+ .\[\&\>tr\]\:table {
6346
+ &>tr {
6347
+ display: table;
6348
+ }
6349
+ }
6350
+ .\[\&\>tr\]\:w-full {
6351
+ &>tr {
6352
+ width: 100%;
6353
+ }
6354
+ }
6355
+ .\[\&\>tr\]\:table-fixed {
6356
+ &>tr {
6357
+ table-layout: fixed;
6358
+ }
6359
+ }
6324
6360
  .\[\&\>tr\]\:last\:border-b-0 {
6325
6361
  &>tr {
6326
6362
  &:last-child {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/apollo-wind",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "description": "UiPath wind design system - A Tailwind CSS based React component library",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",