@acronis-platform/ui-react 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/alert/alert.js +55 -55
- package/dist/components/ui/alert/alert.js.map +1 -1
- package/dist/components/ui/checkbox/checkbox.js +1 -1
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/data-table/data-table-bulk-actions-bar.js +38 -0
- package/dist/components/ui/data-table/data-table-bulk-actions-bar.js.map +1 -0
- package/dist/components/ui/data-table/data-table-column-header.js +23 -20
- package/dist/components/ui/data-table/data-table-column-header.js.map +1 -1
- package/dist/components/ui/data-table/data-table-expand-trigger.js +23 -15
- package/dist/components/ui/data-table/data-table-expand-trigger.js.map +1 -1
- package/dist/components/ui/data-table/data-table-pagination.js +29 -28
- package/dist/components/ui/data-table/data-table-pagination.js.map +1 -1
- package/dist/components/ui/data-table/data-table-selection.js +7 -0
- package/dist/components/ui/data-table/data-table-selection.js.map +1 -0
- package/dist/components/ui/data-table/data-table-toolbar.js +21 -23
- package/dist/components/ui/data-table/data-table-toolbar.js.map +1 -1
- package/dist/components/ui/data-table/data-table-view-options.js +12 -10
- package/dist/components/ui/data-table/data-table-view-options.js.map +1 -1
- package/dist/components/ui/data-table/data-table.js +347 -183
- package/dist/components/ui/data-table/data-table.js.map +1 -1
- package/dist/components/ui/stepper/stepper.js +70 -0
- package/dist/components/ui/stepper/stepper.js.map +1 -0
- package/dist/components/ui/stepper-item/stepper-item.js +97 -0
- package/dist/components/ui/stepper-item/stepper-item.js.map +1 -0
- package/dist/components/ui/table/table-pagination.js +54 -47
- package/dist/components/ui/table/table-pagination.js.map +1 -1
- package/dist/components/ui/table/table-view-options.js +32 -19
- package/dist/components/ui/table/table-view-options.js.map +1 -1
- package/dist/components/ui/table/table.js +112 -63
- package/dist/components/ui/table/table.js.map +1 -1
- package/dist/components/ui/timeline/timeline.js +10 -10
- package/dist/components/ui/timeline/timeline.js.map +1 -1
- package/dist/components/ui/toast/toast.js +15 -15
- package/dist/components/ui/toast/toast.js.map +1 -1
- package/dist/index.js +386 -373
- package/dist/index.js.map +1 -1
- package/dist/react.js +386 -373
- package/dist/react.js.map +1 -1
- package/dist/src/components/ui/data-table/data-table-bulk-actions-bar.d.ts +26 -0
- package/dist/src/components/ui/data-table/data-table-column-header.d.ts +6 -1
- package/dist/src/components/ui/data-table/data-table-expand-trigger.d.ts +4 -0
- package/dist/src/components/ui/data-table/data-table-pagination.d.ts +15 -1
- package/dist/src/components/ui/data-table/data-table-selection.d.ts +11 -0
- package/dist/src/components/ui/data-table/data-table-view-options.d.ts +3 -2
- package/dist/src/components/ui/data-table/data-table.d.ts +88 -3
- package/dist/src/components/ui/data-table/data-table.docs.d.ts +61 -1
- package/dist/src/components/ui/data-table/index.d.ts +3 -1
- package/dist/src/components/ui/stepper/index.d.ts +1 -0
- package/dist/src/components/ui/stepper/stepper.d.ts +40 -0
- package/dist/src/components/ui/stepper-item/index.d.ts +1 -0
- package/dist/src/components/ui/stepper-item/stepper-item.d.ts +41 -0
- package/dist/src/components/ui/table/index.d.ts +1 -1
- package/dist/src/components/ui/table/table-pagination.d.ts +21 -0
- package/dist/src/components/ui/table/table-view-options.d.ts +9 -2
- package/dist/src/components/ui/table/table.d.ts +40 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/ui-react.css +1 -1
- package/package.json +3 -3
package/dist/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"react.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Table } from '@tanstack/react-table';
|
|
3
|
+
interface DataTableBulkActionsBarProps<TData> {
|
|
4
|
+
table: Table<TData>;
|
|
5
|
+
/**
|
|
6
|
+
* Bulk actions offered for the current selection — rendered leading, ahead
|
|
7
|
+
* of the trailing summary/Deselect control. Wrapped in a native `<fieldset
|
|
8
|
+
* disabled>` while nothing is selected, so every nested control (a `Button`
|
|
9
|
+
* renders a plain `<button>`) picks up the disabled state and styling for
|
|
10
|
+
* free — no per-action wiring needed. Each action reads the selection off
|
|
11
|
+
* the same `table` instance (`table.getSelectedRowModel().rows`).
|
|
12
|
+
*/
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
/** Builds the trailing selection summary from the selected-row count. */
|
|
15
|
+
selectedLabel?: (count: number) => string;
|
|
16
|
+
/** Label of the trailing control that clears the selection. */
|
|
17
|
+
clearLabel?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Trailing summary shown in place of the selection summary while nothing is
|
|
20
|
+
* selected — e.g. `"25 of 1250 items loaded"`. Omit to render nothing in
|
|
21
|
+
* that state.
|
|
22
|
+
*/
|
|
23
|
+
loadedLabel?: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
export declare function DataTableBulkActionsBar<TData>({ table, children, selectedLabel, clearLabel, loadedLabel, }: DataTableBulkActionsBarProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export {};
|
|
@@ -3,6 +3,11 @@ import * as React from 'react';
|
|
|
3
3
|
interface DataTableColumnHeaderProps<TData, TValue> extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
4
|
column: Column<TData, TValue>;
|
|
5
5
|
title: string;
|
|
6
|
+
/**
|
|
7
|
+
* Builds the accessible label of the sort toggle from the column title.
|
|
8
|
+
* Override to localize.
|
|
9
|
+
*/
|
|
10
|
+
sortLabel?: (title: string) => string;
|
|
6
11
|
}
|
|
7
|
-
export declare function DataTableColumnHeader<TData, TValue>({ column, title, className, ...props }: DataTableColumnHeaderProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function DataTableColumnHeader<TData, TValue>({ column, title, sortLabel, className, ...props }: DataTableColumnHeaderProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
8
13
|
export {};
|
|
@@ -3,6 +3,10 @@ import * as React from 'react';
|
|
|
3
3
|
interface DataTableExpandTriggerProps<TData> extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
4
4
|
/** The row this trigger toggles. */
|
|
5
5
|
row: Row<TData>;
|
|
6
|
+
/** Accessible name while the row is expanded. Override to localize. */
|
|
7
|
+
collapseLabel?: string;
|
|
8
|
+
/** Accessible name while the row is collapsed. Override to localize. */
|
|
9
|
+
expandLabel?: string;
|
|
6
10
|
}
|
|
7
11
|
export declare const DataTableExpandTrigger: <TData>(props: DataTableExpandTriggerProps<TData> & {
|
|
8
12
|
ref?: React.Ref<HTMLButtonElement>;
|
|
@@ -3,6 +3,20 @@ interface DataTablePaginationProps<TData> {
|
|
|
3
3
|
table: Table<TData>;
|
|
4
4
|
/** Page-size options offered in the rows-per-page select. */
|
|
5
5
|
pageSizeOptions?: number[];
|
|
6
|
+
/** Label of the rows-per-page select (also its accessible name). */
|
|
7
|
+
rowsPerPageLabel?: string;
|
|
8
|
+
/** Accessible name of the first-page control. */
|
|
9
|
+
firstPageLabel?: string;
|
|
10
|
+
/** Accessible name of the previous-page control. */
|
|
11
|
+
previousPageLabel?: string;
|
|
12
|
+
/** Accessible name of the next-page control. */
|
|
13
|
+
nextPageLabel?: string;
|
|
14
|
+
/** Accessible name of the last-page control. */
|
|
15
|
+
lastPageLabel?: string;
|
|
16
|
+
/** Builds the page indicator from the 1-based page number and page count. */
|
|
17
|
+
pageLabel?: (page: number, pageCount: number) => string;
|
|
18
|
+
/** Builds the leading selection summary from the selected and total counts. */
|
|
19
|
+
summaryLabel?: (selectedRows: number, totalRows: number) => string;
|
|
6
20
|
}
|
|
7
|
-
export declare function DataTablePagination<TData>({ table, pageSizeOptions, }: DataTablePaginationProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function DataTablePagination<TData>({ table, pageSizeOptions, rowsPerPageLabel, firstPageLabel, previousPageLabel, nextPageLabel, lastPageLabel, pageLabel, summaryLabel, }: DataTablePaginationProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
8
22
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Table } from '@tanstack/react-table';
|
|
2
|
+
/**
|
|
3
|
+
* Whether any row is currently selected — the single threshold that decides
|
|
4
|
+
* between per-row actions and bulk actions, per the design (Figma 5916-10470
|
|
5
|
+
* / 5916-10745 / 5916-11716 / 5916-11286 / 5916-11991): a single selected row
|
|
6
|
+
* already switches to the bulk scope (its own row actions hide, and
|
|
7
|
+
* `DataTableBulkActionsBar` enables), same as two or more. `TableActionsCell`
|
|
8
|
+
* takes this as its `bulkSelectionActive` prop, so the threshold doesn't have
|
|
9
|
+
* to be re-derived per consumer.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isBulkSelectionActive<TData>(table: Table<TData>): boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Table } from '@tanstack/react-table';
|
|
2
|
-
|
|
2
|
+
import { TableViewOptionsProps } from '../table';
|
|
3
|
+
interface DataTableViewOptionsProps<TData> extends Pick<TableViewOptionsProps, 'triggerLabel' | 'iconOnly' | 'triggerAriaLabel'> {
|
|
3
4
|
table: Table<TData>;
|
|
4
5
|
}
|
|
5
|
-
export declare function DataTableViewOptions<TData>({ table, }: DataTableViewOptionsProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function DataTableViewOptions<TData>({ table, ...triggerProps }: DataTableViewOptionsProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
import { Cell, Column, ColumnDef, ColumnSizingState, OnChangeFn, Row, RowData, SortingState, Table as TanstackTable, VisibilityState } from '@tanstack/react-table';
|
|
2
|
+
import { Cell, Column, ColumnDef, ColumnOrderState, ColumnSizingState, OnChangeFn, Row, RowData, RowSelectionState, SortingState, Table as TanstackTable, VisibilityState } from '@tanstack/react-table';
|
|
3
3
|
declare module '@tanstack/react-table' {
|
|
4
4
|
interface ColumnMeta<TData extends RowData, TValue> {
|
|
5
5
|
/** Pin the column to a table edge (sticky while the grid scrolls horizontally). */
|
|
@@ -25,6 +25,27 @@ export declare function getResizeKeyboardStep(key: string, currentSize: number,
|
|
|
25
25
|
min: number;
|
|
26
26
|
max: number;
|
|
27
27
|
}): number | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Moves `from` to `to`'s position in a `columnOrder` array (the drop semantics
|
|
30
|
+
* of the header drag gesture: the dragged column lands where the drop target
|
|
31
|
+
* sits, pushing it aside). Returns `order` unchanged when either id is absent,
|
|
32
|
+
* so a drop on a column that isn't part of the order (e.g. one added while the
|
|
33
|
+
* gesture was in flight) is a no-op rather than a reshuffle.
|
|
34
|
+
*/
|
|
35
|
+
export declare function reorderColumn(order: string[], from: string, to: string): string[];
|
|
36
|
+
/** One line of the header hover tooltip: a capability and the gesture for it. */
|
|
37
|
+
export interface DataTableHeaderHint {
|
|
38
|
+
/** The capability, rendered in bold (e.g. `Sort column`). */
|
|
39
|
+
label: string;
|
|
40
|
+
/** The gesture that triggers it (e.g. `Click`). */
|
|
41
|
+
action: string;
|
|
42
|
+
}
|
|
43
|
+
/** Copy of the header hover tooltip, one entry per column capability. */
|
|
44
|
+
export interface DataTableHeaderHints {
|
|
45
|
+
sort: DataTableHeaderHint;
|
|
46
|
+
reorder: DataTableHeaderHint;
|
|
47
|
+
resize: DataTableHeaderHint;
|
|
48
|
+
}
|
|
28
49
|
type DataTableDataSourceProps<TData, TValue> = {
|
|
29
50
|
columns: ColumnDef<TData, TValue>[];
|
|
30
51
|
data: TData[];
|
|
@@ -44,7 +65,9 @@ type DataTableDataSourceProps<TData, TValue> = {
|
|
|
44
65
|
* only used to build DataTable's own instance) and the following props
|
|
45
66
|
* no-ops (configure the equivalent directly on the external instance
|
|
46
67
|
* instead): `columnVisibility`, `onColumnVisibilityChange`,
|
|
47
|
-
* `onColumnSizingChange`, `enableColumnResizing`,
|
|
68
|
+
* `onColumnSizingChange`, `enableColumnResizing`,
|
|
69
|
+
* `enableColumnReordering`, `columnOrder`, `onColumnOrderChange`,
|
|
70
|
+
* `getRowCanExpand`,
|
|
48
71
|
* `manualSorting`, `sorting`, `onSortingChange`, `paginationMode`,
|
|
49
72
|
* `onLoadMore`, `loadMoreRootMargin`, `hasNextPage`, `isLoadingMore`.
|
|
50
73
|
* `meta.pin`-driven column pinning is also skipped — pin/unpin the
|
|
@@ -77,6 +100,20 @@ interface DataTableOwnProps<TData> {
|
|
|
77
100
|
enableColumnResizing?: boolean;
|
|
78
101
|
/** Passthrough for the `columnSizing` state so a consumer can persist widths. */
|
|
79
102
|
onColumnSizingChange?: OnChangeFn<ColumnSizingState>;
|
|
103
|
+
/**
|
|
104
|
+
* Opt in to column reordering by dragging a header cell onto another one
|
|
105
|
+
* (native HTML5 drag-and-drop driving TanStack's `columnOrder`). Pinned
|
|
106
|
+
* columns are excluded — they're anchored to a table edge by definition.
|
|
107
|
+
* Pointer-only, matching the design: there is no keyboard equivalent yet.
|
|
108
|
+
*/
|
|
109
|
+
enableColumnReordering?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Controlled column-order state — pass this (with `onColumnOrderChange`) to
|
|
112
|
+
* persist or share the order. Uncontrolled (internal state) when omitted.
|
|
113
|
+
*/
|
|
114
|
+
columnOrder?: ColumnOrderState;
|
|
115
|
+
/** Passthrough for the `columnOrder` state; pairs with `columnOrder`. */
|
|
116
|
+
onColumnOrderChange?: OnChangeFn<ColumnOrderState>;
|
|
80
117
|
/**
|
|
81
118
|
* Controlled column-visibility state — pass this (with
|
|
82
119
|
* `onColumnVisibilityChange`) to share one visibility state with an
|
|
@@ -86,6 +123,15 @@ interface DataTableOwnProps<TData> {
|
|
|
86
123
|
columnVisibility?: VisibilityState;
|
|
87
124
|
/** Passthrough for the `columnVisibility` state; pairs with `columnVisibility`. */
|
|
88
125
|
onColumnVisibilityChange?: OnChangeFn<VisibilityState>;
|
|
126
|
+
/**
|
|
127
|
+
* Controlled row-selection state — pass this (with `onRowSelectionChange`)
|
|
128
|
+
* to share one selection state with an external `useReactTable` instance
|
|
129
|
+
* (e.g. a composed toolbar/bulk-actions bar). Uncontrolled (internal state)
|
|
130
|
+
* when omitted.
|
|
131
|
+
*/
|
|
132
|
+
rowSelection?: RowSelectionState;
|
|
133
|
+
/** Passthrough for the `rowSelection` state; pairs with `rowSelection`. */
|
|
134
|
+
onRowSelectionChange?: OnChangeFn<RowSelectionState>;
|
|
89
135
|
/**
|
|
90
136
|
* Opt out of client-side sorting — pass already-sorted `data` and drive
|
|
91
137
|
* sorting via `sorting`/`onSortingChange` (e.g. mapped to a server query by
|
|
@@ -154,12 +200,51 @@ interface DataTableOwnProps<TData> {
|
|
|
154
200
|
loadMoreRootMargin?: string;
|
|
155
201
|
/** Whether more rows are available to load. `paginationMode="infinite"` only. */
|
|
156
202
|
hasNextPage?: boolean;
|
|
203
|
+
/**
|
|
204
|
+
* Accessible name of a column's resize handle. Override to localize.
|
|
205
|
+
* `enableColumnResizing` only.
|
|
206
|
+
*/
|
|
207
|
+
resizeColumnLabel?: string;
|
|
208
|
+
/**
|
|
209
|
+
* Text of the default empty-state row. Ignored when `renderEmptyState` is
|
|
210
|
+
* given. Override to localize.
|
|
211
|
+
*/
|
|
212
|
+
emptyLabel?: string;
|
|
157
213
|
/**
|
|
158
214
|
* Whether a load is in flight — suppresses further `onLoadMore` calls and
|
|
159
215
|
* renders a trailing loading row. `paginationMode="infinite"` only.
|
|
160
216
|
*/
|
|
161
217
|
isLoadingMore?: boolean;
|
|
218
|
+
/**
|
|
219
|
+
* Hide the trailing sticky action column — the column-visibility cog in the
|
|
220
|
+
* header and each row's overflow-actions ellipsis. Shown by default. A
|
|
221
|
+
* no-op when an external `table` is passed (build the column into that
|
|
222
|
+
* instance's own `columns` instead).
|
|
223
|
+
*/
|
|
224
|
+
hideActionColumn?: boolean;
|
|
225
|
+
/**
|
|
226
|
+
* Renders the content of a row's overflow-actions menu (e.g. `Edit`/
|
|
227
|
+
* `Delete` items), opened from the ellipsis trigger in the trailing action
|
|
228
|
+
* column. Omit to render that row without a trigger — the 48px column is
|
|
229
|
+
* still reserved. Suppressed (like the trigger itself) while a bulk
|
|
230
|
+
* selection is active, per `TableActionsCell`.
|
|
231
|
+
*/
|
|
232
|
+
renderRowActions?: (row: Row<TData>) => ReactNode;
|
|
233
|
+
/** Accessible name of a row's overflow-actions trigger. Override to localize. */
|
|
234
|
+
rowActionsLabel?: string;
|
|
235
|
+
/**
|
|
236
|
+
* Accessible name of the action column's column-visibility trigger.
|
|
237
|
+
* Override to localize.
|
|
238
|
+
*/
|
|
239
|
+
columnSettingsLabel?: string;
|
|
240
|
+
/**
|
|
241
|
+
* Copy of the tooltip shown while a header cell is hovered/focused — one
|
|
242
|
+
* line per capability that column actually has (sort/reorder/resize).
|
|
243
|
+
* Override (per capability) to localize; a column with no capability shows
|
|
244
|
+
* no tooltip at all.
|
|
245
|
+
*/
|
|
246
|
+
headerHints?: Partial<DataTableHeaderHints>;
|
|
162
247
|
}
|
|
163
248
|
export type DataTableProps<TData, TValue = unknown> = DataTableOwnProps<TData> & DataTableDataSourceProps<TData, TValue>;
|
|
164
|
-
export declare function DataTable<TData, TValue = unknown>({ columns, data, table: externalTable, getRowCanExpand, renderExpandedRow, striped, bordered, highlightCurrentRow, skeleton, skeletonRows, enableColumnResizing, onColumnSizingChange, columnVisibility: controlledColumnVisibility, onColumnVisibilityChange, manualSorting, sorting: controlledSorting, onSortingChange, renderRow, renderEmptyState, paginationMode, onLoadMore, loadMoreRootMargin, hasNextPage, isLoadingMore, }: DataTableProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
249
|
+
export declare function DataTable<TData, TValue = unknown>({ columns, data, table: externalTable, getRowCanExpand, renderExpandedRow, striped, bordered, highlightCurrentRow, skeleton, skeletonRows, enableColumnResizing, onColumnSizingChange, enableColumnReordering, columnOrder: controlledColumnOrder, onColumnOrderChange, columnVisibility: controlledColumnVisibility, onColumnVisibilityChange, rowSelection: controlledRowSelection, onRowSelectionChange, manualSorting, sorting: controlledSorting, onSortingChange, renderRow, renderEmptyState, paginationMode, onLoadMore, loadMoreRootMargin, hasNextPage, resizeColumnLabel, emptyLabel, isLoadingMore, hideActionColumn, renderRowActions, rowActionsLabel, columnSettingsLabel, headerHints, }: DataTableProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
165
250
|
export {};
|
|
@@ -14,7 +14,8 @@ export interface DataTableProps {
|
|
|
14
14
|
* instance as-is. Makes `columns`/`data` unnecessary and the following props
|
|
15
15
|
* no-ops (configure the equivalent on the external instance instead):
|
|
16
16
|
* `columnVisibility`, `onColumnVisibilityChange`, `onColumnSizingChange`,
|
|
17
|
-
* `enableColumnResizing`, `
|
|
17
|
+
* `enableColumnResizing`, `enableColumnReordering`, `columnOrder`,
|
|
18
|
+
* `onColumnOrderChange`, `getRowCanExpand`, `manualSorting`, `sorting`,
|
|
18
19
|
* `onSortingChange`, `paginationMode`, `onLoadMore`, `loadMoreRootMargin`,
|
|
19
20
|
* `hasNextPage`, `isLoadingMore`. `meta.pin`-driven column pinning is also
|
|
20
21
|
* skipped — pin/unpin the caller's own instance via TanStack's `column.pin()`.
|
|
@@ -39,8 +40,26 @@ export interface DataTableProps {
|
|
|
39
40
|
* trailing edge of each resizable header (TanStack's native `columnResizing`).
|
|
40
41
|
*/
|
|
41
42
|
enableColumnResizing?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Accessible name of a column's resize handle (default `'Resize column'`).
|
|
45
|
+
* `enableColumnResizing` only. Override to localize.
|
|
46
|
+
*/
|
|
47
|
+
resizeColumnLabel?: string;
|
|
42
48
|
/** Passthrough for the `columnSizing` state so a consumer can persist widths. */
|
|
43
49
|
onColumnSizingChange?: (updater: unknown) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Opt in to column reordering by dragging a header cell onto another one
|
|
52
|
+
* (native HTML5 drag-and-drop driving TanStack's `columnOrder`). Pinned
|
|
53
|
+
* columns are excluded. Pointer-only — there is no keyboard equivalent yet.
|
|
54
|
+
*/
|
|
55
|
+
enableColumnReordering?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Controlled column-order state — pass this (with `onColumnOrderChange`) to
|
|
58
|
+
* persist or share the order. Uncontrolled (internal state) when omitted.
|
|
59
|
+
*/
|
|
60
|
+
columnOrder?: string[];
|
|
61
|
+
/** Passthrough for the `columnOrder` state; pairs with `columnOrder`. */
|
|
62
|
+
onColumnOrderChange?: (updater: unknown) => void;
|
|
44
63
|
/**
|
|
45
64
|
* Controlled column-visibility state — pass this (with
|
|
46
65
|
* `onColumnVisibilityChange`) to share one visibility state with an external
|
|
@@ -49,6 +68,15 @@ export interface DataTableProps {
|
|
|
49
68
|
columnVisibility?: unknown;
|
|
50
69
|
/** Passthrough for the `columnVisibility` state; pairs with `columnVisibility`. */
|
|
51
70
|
onColumnVisibilityChange?: (updater: unknown) => void;
|
|
71
|
+
/**
|
|
72
|
+
* Controlled row-selection state — pass this (with `onRowSelectionChange`) to
|
|
73
|
+
* share one selection state with an external `useReactTable` instance (e.g. a
|
|
74
|
+
* composed toolbar/bulk-actions bar). Uncontrolled (internal state) when
|
|
75
|
+
* omitted.
|
|
76
|
+
*/
|
|
77
|
+
rowSelection?: unknown;
|
|
78
|
+
/** Passthrough for the `rowSelection` state; pairs with `rowSelection`. */
|
|
79
|
+
onRowSelectionChange?: (updater: unknown) => void;
|
|
52
80
|
/**
|
|
53
81
|
* Opt out of client-side sorting — pass already-sorted `data` and drive
|
|
54
82
|
* sorting via `sorting`/`onSortingChange` (e.g. mapped to a server query by
|
|
@@ -79,6 +107,11 @@ export interface DataTableProps {
|
|
|
79
107
|
renderEmptyState?: (context: {
|
|
80
108
|
hasFilters: boolean;
|
|
81
109
|
}) => ReactNode;
|
|
110
|
+
/**
|
|
111
|
+
* Text of the default empty-state row (default `'No results.'`). Ignored when
|
|
112
|
+
* `renderEmptyState` is given. Override to localize.
|
|
113
|
+
*/
|
|
114
|
+
emptyLabel?: string;
|
|
82
115
|
/**
|
|
83
116
|
* `'page'` (default) keeps today's client-paginated behavior. `'infinite'`
|
|
84
117
|
* omits the paginated row model — `data` is the full accumulated array the
|
|
@@ -103,4 +136,31 @@ export interface DataTableProps {
|
|
|
103
136
|
* renders a trailing loading row. `paginationMode="infinite"` only.
|
|
104
137
|
*/
|
|
105
138
|
isLoadingMore?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Hide the trailing sticky action column — the column-visibility cog in the
|
|
141
|
+
* header and each row's overflow-actions ellipsis. Shown by default. A
|
|
142
|
+
* no-op when `table` is passed.
|
|
143
|
+
*/
|
|
144
|
+
hideActionColumn?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Renders the content of a row's overflow-actions menu, opened from the
|
|
147
|
+
* ellipsis trigger in the trailing action column. Omit to render that row
|
|
148
|
+
* without a trigger — the 48px column is still reserved.
|
|
149
|
+
*/
|
|
150
|
+
renderRowActions?: (row: unknown) => ReactNode;
|
|
151
|
+
/** Accessible name of a row's overflow-actions trigger. */
|
|
152
|
+
rowActionsLabel?: string;
|
|
153
|
+
/** Accessible name of the action column's column-visibility trigger. */
|
|
154
|
+
columnSettingsLabel?: string;
|
|
155
|
+
/**
|
|
156
|
+
* Copy of the tooltip shown while a header cell is hovered/focused — one
|
|
157
|
+
* `{ label, action }` line per capability that column actually has. Merged
|
|
158
|
+
* over the defaults (`sort`: "Sort column"/"Click", `reorder`: "Reorder
|
|
159
|
+
* column"/"Drag", `resize`: "Resize column"/"Drag border"), so any subset can
|
|
160
|
+
* be overridden to localize; a column with no capability shows no tooltip.
|
|
161
|
+
*/
|
|
162
|
+
headerHints?: Partial<Record<'sort' | 'reorder' | 'resize', {
|
|
163
|
+
label: string;
|
|
164
|
+
action: string;
|
|
165
|
+
}>>;
|
|
106
166
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export { DataTable, type DataTableProps, getCellStyle, getPinnedStyle, getColumnWidth, } from './data-table';
|
|
1
|
+
export { DataTable, type DataTableHeaderHint, type DataTableHeaderHints, type DataTableProps, getCellStyle, getPinnedStyle, getColumnWidth, reorderColumn, } from './data-table';
|
|
2
|
+
export { DataTableBulkActionsBar } from './data-table-bulk-actions-bar';
|
|
3
|
+
export { isBulkSelectionActive } from './data-table-selection';
|
|
2
4
|
export { DataTableColumnHeader } from './data-table-column-header';
|
|
3
5
|
export { DataTableExpandTrigger } from './data-table-expand-trigger';
|
|
4
6
|
export { DataTablePagination } from './data-table-pagination';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Stepper, type StepperProps } from './stepper';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface StepperProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/**
|
|
4
|
+
* The `StepperItem` elements making up the sequence. Rendered in the wide
|
|
5
|
+
* (>= 1024px) layout only — the compact layout is a text summary and shows no
|
|
6
|
+
* items at all.
|
|
7
|
+
*/
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
/** 1-based index of the step the user is on, e.g. `3`. Compact layout only. */
|
|
10
|
+
currentStep: React.ReactNode;
|
|
11
|
+
/** How many steps there are in total, e.g. `5`. Compact layout only. */
|
|
12
|
+
totalSteps: React.ReactNode;
|
|
13
|
+
/** The current step's name. Compact layout only. */
|
|
14
|
+
current: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* The next step's name. Omit it — on the last step, say — and the whole
|
|
17
|
+
* "Next: …" line is left out rather than rendered empty. Compact layout only.
|
|
18
|
+
*/
|
|
19
|
+
next?: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* The word introducing the step counter. A prop, not an inlined literal, so
|
|
22
|
+
* the string can be translated (see `context/conventions.md` §"Localization —
|
|
23
|
+
* no hardcoded labels"): this component generates the text itself, unlike the
|
|
24
|
+
* step names, which the caller supplies.
|
|
25
|
+
*/
|
|
26
|
+
stepLabel?: string;
|
|
27
|
+
/** The word joining the current step number to the total. Translatable — see `stepLabel`. */
|
|
28
|
+
ofLabel?: string;
|
|
29
|
+
/** The label introducing the next step's name. Translatable — see `stepLabel`. */
|
|
30
|
+
nextLabel?: string;
|
|
31
|
+
/**
|
|
32
|
+
* The punctuation joining the step counter to the current step's name. A prop
|
|
33
|
+
* for the same reason as `stepLabel`: the component generates it, and not every
|
|
34
|
+
* locale writes it as `": "` (French, say, spaces before the colon; CJK uses a
|
|
35
|
+
* full-width one).
|
|
36
|
+
*/
|
|
37
|
+
separatorLabel?: string;
|
|
38
|
+
}
|
|
39
|
+
declare const Stepper: React.ForwardRefExoticComponent<StepperProps & React.RefAttributes<HTMLDivElement>>;
|
|
40
|
+
export { Stepper };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StepperItem, stepperItemVariants, type StepperItemProps, type StepperItemVariant, type StepperItemState, } from './stepper-item';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
declare const stepperItemVariants: (props?: ({
|
|
5
|
+
variant?: "current" | "completed" | "future" | null | undefined;
|
|
6
|
+
state?: "active" | "hover" | "idle" | null | undefined;
|
|
7
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
8
|
+
/** Kept in lockstep with the `cva` axes above. */
|
|
9
|
+
export type StepperItemVariant = NonNullable<VariantProps<typeof stepperItemVariants>['variant']>;
|
|
10
|
+
export type StepperItemState = NonNullable<VariantProps<typeof stepperItemVariants>['state']>;
|
|
11
|
+
export interface StepperItemProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
12
|
+
/**
|
|
13
|
+
* The step's structural role in the sequence. Drives the container background
|
|
14
|
+
* and the label color. Defaults to `current` for prop ergonomics — in a real
|
|
15
|
+
* sequence every step declares its own.
|
|
16
|
+
*/
|
|
17
|
+
variant?: StepperItemVariant;
|
|
18
|
+
/**
|
|
19
|
+
* Interaction state. Only produces a different look when `variant` is
|
|
20
|
+
* `completed` (`idle` has no background, `hover` and `active` paint one).
|
|
21
|
+
* Ignored for `current`, which always renders in its highlighted look, and for
|
|
22
|
+
* `future`, which always renders disabled and non-interactive.
|
|
23
|
+
*/
|
|
24
|
+
state?: StepperItemState;
|
|
25
|
+
/**
|
|
26
|
+
* The step's marker — required, and entirely the caller's to compose. Pass any
|
|
27
|
+
* `Avatar` composition (color scheme, initials / icon / image, size overrides);
|
|
28
|
+
* this component renders it verbatim and never styles it.
|
|
29
|
+
*/
|
|
30
|
+
avatar: React.ReactElement;
|
|
31
|
+
/** The step name. */
|
|
32
|
+
label?: React.ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* Replace the rendered `<div>` with another element or component (Base UI
|
|
35
|
+
* composition) — e.g. a `<button>`, since a completed step is usually a way
|
|
36
|
+
* back to an earlier step.
|
|
37
|
+
*/
|
|
38
|
+
render?: useRender.RenderProp;
|
|
39
|
+
}
|
|
40
|
+
declare const StepperItem: React.ForwardRefExoticComponent<StepperItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
41
|
+
export { StepperItem, stepperItemVariants };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, type TableRowProps, type TableHeadProps, type TableCellProps, } from './table';
|
|
1
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableSelectCell, TableActionsCell, TableSettingsCell, TableCaption, type TableRowProps, type TableHeadProps, type TableCellProps, type TableSelectCellProps, type TableActionsCellProps, } from './table';
|
|
2
2
|
export { TablePagination, type TablePaginationProps, } from './table-pagination';
|
|
3
3
|
export { TableViewOptions, type TableViewOptionsProps, type TableColumnVisibility, } from './table-view-options';
|
|
@@ -16,6 +16,27 @@ export interface TablePaginationProps extends Omit<React.HTMLAttributes<HTMLDivE
|
|
|
16
16
|
onPageIndexChange: (pageIndex: number) => void;
|
|
17
17
|
/** Invoked with the next page size. */
|
|
18
18
|
onPageSizeChange: (pageSize: number) => void;
|
|
19
|
+
/** Label of the rows-per-page select (also its accessible name). */
|
|
20
|
+
rowsPerPageLabel?: string;
|
|
21
|
+
/** Accessible name of the first-page control. */
|
|
22
|
+
firstPageLabel?: string;
|
|
23
|
+
/** Accessible name of the previous-page control. */
|
|
24
|
+
previousPageLabel?: string;
|
|
25
|
+
/** Accessible name of the next-page control. */
|
|
26
|
+
nextPageLabel?: string;
|
|
27
|
+
/** Accessible name of the last-page control. */
|
|
28
|
+
lastPageLabel?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Builds the page indicator. Receives the 1-based page number and the total
|
|
31
|
+
* page count; `pageCount === 0` means there are no pages.
|
|
32
|
+
*/
|
|
33
|
+
pageLabel?: (page: number, pageCount: number) => string;
|
|
34
|
+
/**
|
|
35
|
+
* Builds the leading row summary. Receives the selected-row count (or
|
|
36
|
+
* `undefined` when selection isn't tracked) and the total row count. Return
|
|
37
|
+
* `null` for no summary.
|
|
38
|
+
*/
|
|
39
|
+
summaryLabel?: (selectedRows: number | undefined, totalRows: number) => string | null;
|
|
19
40
|
}
|
|
20
41
|
declare const TablePagination: React.ForwardRefExoticComponent<TablePaginationProps & React.RefAttributes<HTMLDivElement>>;
|
|
21
42
|
export { TablePagination };
|
|
@@ -12,10 +12,17 @@ export interface TableViewOptionsProps {
|
|
|
12
12
|
columns: TableColumnVisibility[];
|
|
13
13
|
/** Invoked with the column id whose visibility was toggled. */
|
|
14
14
|
onToggle: (id: string) => void;
|
|
15
|
-
/** Trigger label. Defaults to `View`. */
|
|
15
|
+
/** Trigger label. Defaults to `View`. Ignored when `iconOnly`. */
|
|
16
16
|
triggerLabel?: React.ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Render the trigger as a cog-only icon button instead of a labelled
|
|
19
|
+
* `Button` — the shape that fits the 48px `TableSettingsCell` column.
|
|
20
|
+
*/
|
|
21
|
+
iconOnly?: boolean;
|
|
22
|
+
/** Accessible name of the `iconOnly` trigger. Override to localize. */
|
|
23
|
+
triggerAriaLabel?: string;
|
|
17
24
|
}
|
|
18
|
-
declare function TableViewOptions({ columns, onToggle, triggerLabel, }: TableViewOptionsProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
declare function TableViewOptions({ columns, onToggle, triggerLabel, iconOnly, triggerAriaLabel, }: TableViewOptionsProps): import("react/jsx-runtime").JSX.Element;
|
|
19
26
|
declare namespace TableViewOptions {
|
|
20
27
|
var displayName: string;
|
|
21
28
|
}
|
|
@@ -31,5 +31,44 @@ export interface TableCellProps extends React.TdHTMLAttributes<HTMLTableCellElem
|
|
|
31
31
|
wrap?: boolean;
|
|
32
32
|
}
|
|
33
33
|
declare const TableCell: React.ForwardRefExoticComponent<TableCellProps & React.RefAttributes<HTMLTableCellElement>>;
|
|
34
|
+
export interface TableSelectCellProps extends React.ThHTMLAttributes<HTMLTableCellElement> {
|
|
35
|
+
/**
|
|
36
|
+
* Render the select-all cell of the header row (`<th>`) instead of a row's
|
|
37
|
+
* selection cell (`<td>`).
|
|
38
|
+
*/
|
|
39
|
+
header?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The row-selection cell (design part `TableCheckbox`) — a fixed 32px column
|
|
43
|
+
* holding a label-less `Checkbox`. Only the leading padding is applied, matching
|
|
44
|
+
* the design (16px padding + a 16px box), so the checkbox sits flush against the
|
|
45
|
+
* first data cell.
|
|
46
|
+
*/
|
|
47
|
+
declare const TableSelectCell: React.ForwardRefExoticComponent<TableSelectCellProps & React.RefAttributes<HTMLTableCellElement>>;
|
|
48
|
+
export interface TableActionsCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {
|
|
49
|
+
/**
|
|
50
|
+
* Suppress this row's actions because a selection is in play — the cell
|
|
51
|
+
* still reserves its 48px column (so the grid doesn't reflow) but renders no
|
|
52
|
+
* children and no hover/press tint. Per the design, that means any row is
|
|
53
|
+
* selected, including exactly one. Pass `isBulkSelectionActive(table)` (from
|
|
54
|
+
* the data-table part) rather than re-deriving the threshold.
|
|
55
|
+
*/
|
|
56
|
+
bulkSelectionActive?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The trailing row-actions cell (design part `TableActions`) — a fixed 48px
|
|
60
|
+
* column, end-aligned, holding the consumer's overflow trigger (e.g. a
|
|
61
|
+
* `ButtonIcon` with `EllipsisIcon` opening a `DropdownMenu`). The cell itself
|
|
62
|
+
* carries the hover/press tint and the focus ring, per the design.
|
|
63
|
+
*/
|
|
64
|
+
declare const TableActionsCell: React.ForwardRefExoticComponent<TableActionsCellProps & React.RefAttributes<HTMLTableCellElement>>;
|
|
65
|
+
/**
|
|
66
|
+
* The trailing header cell holding the column-settings trigger (design part
|
|
67
|
+
* `TableSettings`) — a fixed 48px column, end-aligned, holding the consumer's
|
|
68
|
+
* gear trigger (e.g. a `ButtonIcon` with `CogIcon`). Visual states only; what
|
|
69
|
+
* the trigger opens (a column-visibility menu) is the consumer's choice —
|
|
70
|
+
* `TableViewOptions` is the ready-made one.
|
|
71
|
+
*/
|
|
72
|
+
declare const TableSettingsCell: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
34
73
|
declare const TableCaption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
|
|
35
|
-
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
|
74
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableSelectCell, TableActionsCell, TableSettingsCell, TableCaption, };
|
package/dist/src/index.d.ts
CHANGED
|
@@ -82,6 +82,8 @@ export * from './components/ui/sheet';
|
|
|
82
82
|
export * from './components/ui/skeleton';
|
|
83
83
|
export * from './components/ui/slider';
|
|
84
84
|
export * from './components/ui/stack';
|
|
85
|
+
export * from './components/ui/stepper';
|
|
86
|
+
export * from './components/ui/stepper-item';
|
|
85
87
|
export * from './components/ui/resizable';
|
|
86
88
|
export * from './components/ui/sidebar-primary';
|
|
87
89
|
export * from './components/ui/sidebar-secondary';
|