@optimum-intelligence/opti-ui 0.2.0 → 0.3.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/README.md +86 -3
- package/dist/components/card/Card.d.ts +1 -1
- package/dist/components/card/Card.js.map +1 -1
- package/dist/components/data-table/DataTable.d.ts +58 -96
- package/dist/components/data-table/DataTable.js +452 -418
- package/dist/components/data-table/DataTable.js.map +1 -1
- package/dist/components/data-table/DataTableContent.d.ts +35 -0
- package/dist/components/data-table/DataTableContent.js +550 -0
- package/dist/components/data-table/DataTableContent.js.map +1 -0
- package/dist/components/data-table/DataTableFilters.d.ts +15 -0
- package/dist/components/data-table/DataTableFilters.js +284 -0
- package/dist/components/data-table/DataTableFilters.js.map +1 -0
- package/dist/components/data-table/DataTableRow.d.ts +33 -0
- package/dist/components/data-table/DataTableRow.js +552 -0
- package/dist/components/data-table/DataTableRow.js.map +1 -0
- package/dist/components/data-table/context.d.ts +5 -0
- package/dist/components/data-table/context.js +14 -0
- package/dist/components/data-table/context.js.map +1 -0
- package/dist/components/data-table/layout.d.ts +60 -0
- package/dist/components/data-table/layout.js +272 -0
- package/dist/components/data-table/layout.js.map +1 -0
- package/dist/components/data-table/types.d.ts +319 -0
- package/dist/components/data-table/useDataTable.d.ts +9 -0
- package/dist/components/data-table/useDataTable.js +666 -0
- package/dist/components/data-table/useDataTable.js.map +1 -0
- package/dist/components/stat-card/StatCard.d.ts +1 -1
- package/dist/components/stat-card/StatCard.js.map +1 -1
- package/dist/icons/index.d.ts +8 -0
- package/dist/icons/index.js +9 -1
- package/dist/icons/index.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -2
- package/dist/opti-ui.css +494 -167
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -72,9 +72,40 @@ Dates are displayed the same way in every locale, on a 24-hour clock: `2026-03-0
|
|
|
72
72
|
(`formatDate`) and `2026. March 9. 14:30` where they are written out (`formatDateLong`); the locale only
|
|
73
73
|
translates month and weekday names.
|
|
74
74
|
|
|
75
|
-
`DataTable` handles search, sorting, pagination
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
`DataTable` handles search, filters, sorting, pagination, selection, row actions and inline editing for
|
|
76
|
+
rows held in memory. Columns declare what they take part in:
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
const columns: DataTableColumn<Driver>[] = [
|
|
80
|
+
{ id: 'badge', header: 'Badge', mono: true, searchMode: 'exact' },
|
|
81
|
+
{ id: 'name', header: 'Name', edit: 'text' },
|
|
82
|
+
{ id: 'depot', header: 'Depot', filter: 'select', edit: { type: 'select', options: depots } },
|
|
83
|
+
{ id: 'active', header: 'Active', filter: 'toggle', edit: 'checkbox', cell: (row) => <StatusBadge on={row.active} /> },
|
|
84
|
+
{ id: 'hired', header: 'Hired', filter: 'dateRange' },
|
|
85
|
+
{ id: 'notes', header: 'Notes', hidden: true }, // searched, not shown
|
|
86
|
+
];
|
|
87
|
+
|
|
88
|
+
<DataTable
|
|
89
|
+
data={drivers}
|
|
90
|
+
columns={columns}
|
|
91
|
+
locale="hu"
|
|
92
|
+
filters={[{ id: 'new', type: 'toggle', label: 'New this month', match: isNew }]}
|
|
93
|
+
rowActions={(row) => [{ label: 'Locate', icon: <MapPin />, onClick: () => locate(row) }]}
|
|
94
|
+
rowTone={(row) => (row.suspended ? 'danger' : undefined)}
|
|
95
|
+
onRowSave={(row) => api.saveDriver(row)}
|
|
96
|
+
onRowDelete={(row) => confirmDelete(row)}
|
|
97
|
+
/>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
A `select` filter collects its options from the rows unless you pass `options`; a `toggle` keeps truthy
|
|
101
|
+
values, or the rows passing its `match`; a `dateRange` includes both of its days. `onRowSave` adds the
|
|
102
|
+
edit action and receives the edited row: return a promise to keep the row open while it saves, and reject
|
|
103
|
+
it to leave the row open for another try.
|
|
104
|
+
|
|
105
|
+
Every piece of state (`search`, `filterValues`, `sort`, `page`, `pageSize`, `selection`) works
|
|
106
|
+
uncontrolled, or controlled with its `on…Change` callback. With `mode="server"` the table renders the page
|
|
107
|
+
it is given and reports those changes, so the API does the work; typing in the search box is debounced
|
|
108
|
+
by 300 ms (`searchDebounce`). Pass `total`, `loading` and `error` alongside:
|
|
78
109
|
|
|
79
110
|
```tsx
|
|
80
111
|
<DataTable
|
|
@@ -89,9 +120,61 @@ does the work; pass `total`, `loading` and `error` alongside:
|
|
|
89
120
|
onPageChange={setPage}
|
|
90
121
|
onSortChange={setSort}
|
|
91
122
|
onSearchChange={setSearch}
|
|
123
|
+
onFilterValuesChange={setFilters}
|
|
92
124
|
/>
|
|
93
125
|
```
|
|
94
126
|
|
|
127
|
+
The table measures its columns once, with the longest values of all rows, and then holds their widths:
|
|
128
|
+
paging, sorting, filtering and editing a row move nothing, and a short last page stays as tall as a full
|
|
129
|
+
one. The widths are measured again when the table is resized. A column's `width` is a starting point and
|
|
130
|
+
`minWidth` a floor; `truncate` cuts long text with an ellipsis instead of wrapping it. `layout="auto"`
|
|
131
|
+
hands the widths back to the browser.
|
|
132
|
+
|
|
133
|
+
For thousands of rows, `virtualized` renders only the ones in view inside `maxHeight` (default `32rem`)
|
|
134
|
+
and turns pagination off. Rows are then one line high and every column fits its longest value, so mark
|
|
135
|
+
long-text columns `truncate`. `onEndReached` loads more rows as the end is scrolled into view:
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
<DataTable data={shipments} columns={columns} virtualized maxHeight={480} />
|
|
139
|
+
|
|
140
|
+
<DataTable
|
|
141
|
+
mode="server"
|
|
142
|
+
data={rows}
|
|
143
|
+
total={total}
|
|
144
|
+
columns={columns}
|
|
145
|
+
loading={isFetchingNextPage}
|
|
146
|
+
paginated={false}
|
|
147
|
+
maxHeight={480}
|
|
148
|
+
onEndReached={fetchNextPage}
|
|
149
|
+
/>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Rows of another height take `virtualized={{ rowHeight: 56 }}`. A row scrolled far out of view is
|
|
153
|
+
unmounted, so focus inside it is lost; an edit in progress is kept and shows again when the row returns.
|
|
154
|
+
|
|
155
|
+
For another layout, `useDataTable` takes the same options and returns the state and the processed rows,
|
|
156
|
+
and the parts render it wherever you place them inside `DataTable.Root`:
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
const table = useDataTable({ data, columns });
|
|
160
|
+
|
|
161
|
+
<DataTable.Root table={table}>
|
|
162
|
+
<DataTable.Toolbar>
|
|
163
|
+
<DataTable.Search />
|
|
164
|
+
<DataTable.Filter id="depot" />
|
|
165
|
+
<DataTable.Actions>
|
|
166
|
+
<DataTable.Summary />
|
|
167
|
+
<Button onClick={() => exportCsv(table.rows.map(({ row }) => row))}>Export</Button>
|
|
168
|
+
</DataTable.Actions>
|
|
169
|
+
</DataTable.Toolbar>
|
|
170
|
+
<DataTable.Content density="compact" maxHeight={480} />
|
|
171
|
+
<DataTable.Pagination />
|
|
172
|
+
</DataTable.Root>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
`DataTable.Filters` renders every filter with a clear button, and `useDataTableContext()` gives your own
|
|
176
|
+
components the same table.
|
|
177
|
+
|
|
95
178
|
`FileUpload` collects `File` objects and leaves the upload to you; report its progress per file through
|
|
96
179
|
`fileState`. Components with built-in text (`DataTable`, `Pagination`, `DatePicker`, `DateRangePicker`,
|
|
97
180
|
`Calendar`, `FileUpload`, `Stepper`) take a `labels` prop for translation, and the date components take a
|
|
@@ -11,7 +11,7 @@ export interface CardProps extends useRender.ComponentProps<'div', CardState> {
|
|
|
11
11
|
variant?: CardVariant;
|
|
12
12
|
/** Inner spacing. Override with `--oui-card-padding`. */
|
|
13
13
|
padding?: CardPadding;
|
|
14
|
-
/** Adds hover
|
|
14
|
+
/** Adds hover and focus states — use with `render={<a href=… />}` or a click handler. */
|
|
15
15
|
interactive?: boolean;
|
|
16
16
|
}
|
|
17
17
|
export declare function Card({ variant, padding, interactive, render, ref, ...props }: CardProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","names":["useRender","mergeProps","createPrimitive","CardVariant","CardPadding","CardState","variant","padding","interactive","CardProps","ComponentProps","Card","t0","$","_c","t1","t2","t3","t4","t5","t6","t7","t8","t9","render","ref","props","undefined","t10","state","className","defaultTagName","CardHeader","CardTitle","CardDescription","CardActions","CardContent","CardFooter","_c"],"sources":["../../../src/components/card/Card.tsx"],"sourcesContent":["import { useRender } from '@base-ui/react/use-render';\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { createPrimitive } from '../../utils/primitive';\n\nexport type CardVariant = 'outlined' | 'elevated' | 'filled' | 'ghost';\nexport type CardPadding = 'none' | 'sm' | 'md' | 'lg';\n\nexport type CardState = {\n variant: CardVariant;\n padding: CardPadding;\n interactive: boolean;\n};\n\nexport interface CardProps extends useRender.ComponentProps<'div', CardState> {\n /** `outlined` (default) uses the card border, `elevated` a soft shadow. */\n variant?: CardVariant;\n /** Inner spacing. Override with `--oui-card-padding`. */\n padding?: CardPadding;\n /** Adds hover
|
|
1
|
+
{"version":3,"file":"Card.js","names":["useRender","mergeProps","createPrimitive","CardVariant","CardPadding","CardState","variant","padding","interactive","CardProps","ComponentProps","Card","t0","$","_c","t1","t2","t3","t4","t5","t6","t7","t8","t9","render","ref","props","undefined","t10","state","className","defaultTagName","CardHeader","CardTitle","CardDescription","CardActions","CardContent","CardFooter","_c"],"sources":["../../../src/components/card/Card.tsx"],"sourcesContent":["import { useRender } from '@base-ui/react/use-render';\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { createPrimitive } from '../../utils/primitive';\n\nexport type CardVariant = 'outlined' | 'elevated' | 'filled' | 'ghost';\nexport type CardPadding = 'none' | 'sm' | 'md' | 'lg';\n\nexport type CardState = {\n variant: CardVariant;\n padding: CardPadding;\n interactive: boolean;\n};\n\nexport interface CardProps extends useRender.ComponentProps<'div', CardState> {\n /** `outlined` (default) uses the card border, `elevated` a soft shadow. */\n variant?: CardVariant;\n /** Inner spacing. Override with `--oui-card-padding`. */\n padding?: CardPadding;\n /** Adds hover and focus states — use with `render={<a href=… />}` or a click handler. */\n interactive?: boolean;\n}\n\nexport function Card({ variant = 'outlined', padding = 'md', interactive = false, render, ref, ...props }: CardProps) {\n const state: CardState = { variant, padding, interactive };\n return useRender({\n defaultTagName: 'div',\n render,\n ref,\n state,\n props: mergeProps<'div'>({ className: 'oui-card' }, props),\n });\n}\n\nexport const CardHeader = createPrimitive('div', 'oui-card__header', 'CardHeader');\nexport const CardTitle = createPrimitive('h3', 'oui-card__title', 'CardTitle');\nexport const CardDescription = createPrimitive('p', 'oui-card__description', 'CardDescription');\n/** Right-aligned slot inside CardHeader for icon buttons or menus. */\nexport const CardActions = createPrimitive('div', 'oui-card__actions', 'CardActions');\nexport const CardContent = createPrimitive('div', 'oui-card__content', 'CardContent');\nexport const CardFooter = createPrimitive('div', 'oui-card__footer', 'CardFooter');\n"],"mappings":";;;;;;AAsBA,SAAOW,KAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAP,EAAA,OAAAD,IAAA;EAAc,MAAA,EAAAN,SAAAe,IAAAd,SAAAe,IAAAd,aAAAe,IAAAC,QAAAC,KAAA,GAAAC,UAAAd;EAAE,MAAAN,UAAAe,OAAAM,KAAAA,IAAA,aAAAN;EAAsB,MAAAd,UAAAe,OAAAK,KAAAA,IAAA,OAAAL;EAAgB,MAAAd,cAAAe,OAAAI,KAAAA,IAAA,QAAAJ;EAAmB,IAAAK;EAAA,IAAAf,EAAA,OAAAL,eAAAK,EAAA,OAAAN,WAAAM,EAAA,OAAAP,SAAA;GACrDsB,MAAA;IAAAtB;IAAAC;IAAAC;GAAgC;GAACK,EAAA,KAAAL;GAAAK,EAAA,KAAAN;GAAAM,EAAA,KAAAP;GAAAO,EAAA,MAAAe;EAAA,OAAAA,MAAAf,EAAA;EAA1D,MAAAgB,QAAyBD;EAClB5B,KAAAA;EACWe,KAAA;EAChBS,KAAAA;EACAC,KAAAA;EACAI,KAAAA;EACOV,KAAAlB,WAAkB,EAAA6B,WAAa,WAAW,GAAGJ,KAAK;EAACb,EAAA,KAAAD;EAAAC,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;EAAAL,EAAA,KAAAM;EAAAN,EAAA,KAAAO;CAAA,OAAA;EAAAL,KAAAF,EAAA;EAAAG,KAAAH,EAAA;EAAAI,KAAAJ,EAAA;EAAAK,KAAAL,EAAA;EAAAM,KAAAN,EAAA;EAAAO,KAAAP,EAAA;CAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,QAAAE,MAAAF,EAAA,QAAAG,MAAAH,EAAA,QAAAI,MAAAJ,EAAA,QAAAK,MAAAL,EAAA,QAAAM,IAAA;EAL3CE,KAAA;GAAAU,gBACChB;GAAKS,QACrBA;GAAMC,KACNA;GAAGI,OACHA;GAAKH,OACEP;EACT;EAACN,EAAA,MAAAE;EAAAF,EAAA,MAAAG;EAAAH,EAAA,MAAAI;EAAAJ,EAAA,MAAAK;EAAAL,EAAA,MAAAM;EAAAN,EAAA,MAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OANMb,GAAUqB,EAMhB;AAAC;AAGJ,IAAaW,aAAa9B,gBAAgB,OAAO,oBAAoB,YAAY;AACjF,IAAa+B,YAAY/B,gBAAgB,MAAM,mBAAmB,WAAW;AAC7E,IAAagC,kBAAkBhC,gBAAgB,KAAK,yBAAyB,iBAAiB;;AAE9F,IAAaiC,cAAcjC,gBAAgB,OAAO,qBAAqB,aAAa;AACpF,IAAakC,cAAclC,gBAAgB,OAAO,qBAAqB,aAAa;AACpF,IAAamC,aAAanC,gBAAgB,OAAO,oBAAoB,YAAY"}
|
|
@@ -1,111 +1,73 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { type
|
|
3
|
-
import { type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
/** Include this column in the built-in search. Same default as `sortable`. */
|
|
15
|
-
searchable?: boolean;
|
|
16
|
-
/** Custom ascending comparison. */
|
|
17
|
-
compare?: (a: T, b: T) => number;
|
|
18
|
-
align?: 'start' | 'center' | 'end';
|
|
19
|
-
/** Right-align with tabular figures. */
|
|
20
|
-
numeric?: boolean;
|
|
21
|
-
width?: number | string;
|
|
2
|
+
import { type PaginationProps } from '../pagination/Pagination';
|
|
3
|
+
import { type SearchInputProps } from '../search-input/SearchInput';
|
|
4
|
+
import { DataTableContent, type DataTableContentProps } from './DataTableContent';
|
|
5
|
+
import { DataTableFilter, DataTableFilters, type DataTableControlSize } from './DataTableFilters';
|
|
6
|
+
import type { DataTableInstance, UseDataTableOptions } from './types';
|
|
7
|
+
export { useDataTableContext } from './context';
|
|
8
|
+
export type { DataTableContentProps, DataTableVirtualOptions } from './DataTableContent';
|
|
9
|
+
export type { DataTableControlSize, DataTableFilterProps, DataTableFiltersProps } from './DataTableFilters';
|
|
10
|
+
export interface DataTableRootProps<T> extends React.HTMLAttributes<HTMLDivElement> {
|
|
11
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
12
|
+
/** The table from `useDataTable`. */
|
|
13
|
+
table: DataTableInstance<T>;
|
|
22
14
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
/** Provides a table to the parts inside it. */
|
|
16
|
+
declare function DataTableRoot<T>({ table, className, ref, ...props }: DataTableRootProps<T>): React.JSX.Element;
|
|
17
|
+
export interface DataTableSearchProps extends Omit<SearchInputProps, 'value' | 'defaultValue' | 'onValueChange' | 'className'> {
|
|
18
|
+
className?: string;
|
|
26
19
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
count: (count: number) => React.ReactNode;
|
|
33
|
-
selected: (count: number) => React.ReactNode;
|
|
34
|
-
emptyTitle: React.ReactNode;
|
|
35
|
-
emptyDescription: React.ReactNode;
|
|
36
|
-
noMatchTitle: React.ReactNode;
|
|
37
|
-
noMatchDescription: React.ReactNode;
|
|
38
|
-
loading: string;
|
|
39
|
-
errorTitle: React.ReactNode;
|
|
40
|
-
retry: string;
|
|
20
|
+
/** Search box of the table. Typing applies after the table's `searchDebounce`; clearing applies at once. */
|
|
21
|
+
declare function DataTableSearch({ className, ...props }: DataTableSearchProps): React.JSX.Element;
|
|
22
|
+
/** Row count, or the number of selected rows, with a spinner while loading. */
|
|
23
|
+
declare function DataTableSummary({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>): React.JSX.Element;
|
|
24
|
+
export interface DataTablePaginationProps extends Omit<PaginationProps, 'page' | 'pageSize' | 'total' | 'onPageChange' | 'onPageSizeChange'> {
|
|
41
25
|
}
|
|
26
|
+
/** Page navigation of the table. Renders nothing when there are no rows, or the table is not paginated. */
|
|
27
|
+
declare function DataTablePagination({ className, ...props }: DataTablePaginationProps): React.JSX.Element | null;
|
|
42
28
|
export interface DataTableToolbarContext<T> {
|
|
43
|
-
/** Rows after search and sorting, across all pages. In server mode: the current page. */
|
|
29
|
+
/** Rows after filters, search and sorting, across all pages. In server mode: the current page. */
|
|
44
30
|
rows: T[];
|
|
45
31
|
/** Ids of the selected rows. */
|
|
46
32
|
selection: string[];
|
|
33
|
+
/** The whole table: filter values, sort, setters. */
|
|
34
|
+
table: DataTableInstance<T>;
|
|
47
35
|
}
|
|
48
|
-
export interface DataTableProps<T> extends
|
|
49
|
-
/** All rows, or in server mode the rows of the current page. */
|
|
50
|
-
data: T[];
|
|
51
|
-
columns: DataTableColumn<T>[];
|
|
52
|
-
/**
|
|
53
|
-
* `server` renders `data` as it is: search, sorting and pagination are left to
|
|
54
|
-
* the API, driven by the `search` / `sort` / `page` / `pageSize` callbacks.
|
|
55
|
-
*/
|
|
56
|
-
mode?: 'client' | 'server';
|
|
57
|
-
/** Server mode: number of rows across all pages. */
|
|
58
|
-
total?: number;
|
|
59
|
-
/** Shows placeholder rows when there is no data yet, and dims the rows during a refetch. */
|
|
60
|
-
loading?: boolean;
|
|
61
|
-
/** Error message shown in place of the rows. */
|
|
62
|
-
error?: React.ReactNode;
|
|
63
|
-
/** Adds a retry button to the error message. */
|
|
64
|
-
onRetry?: () => void;
|
|
65
|
-
/** Stable id per row, needed for selection. Defaults to `row.id`, then the index. */
|
|
66
|
-
getRowId?: (row: T, index: number) => string;
|
|
67
|
-
/** Show the search box (default `true`). */
|
|
68
|
-
searchable?: boolean;
|
|
69
|
-
search?: string;
|
|
70
|
-
defaultSearch?: string;
|
|
71
|
-
onSearchChange?: (search: string) => void;
|
|
72
|
-
/** Replaces the built-in search, which matches every term against the searchable columns. */
|
|
73
|
-
filter?: (row: T, search: string) => boolean;
|
|
74
|
-
sort?: DataTableSort | null;
|
|
75
|
-
defaultSort?: DataTableSort | null;
|
|
76
|
-
onSortChange?: (sort: DataTableSort | null) => void;
|
|
77
|
-
/** Paginate rows (default `true`). */
|
|
78
|
-
paginated?: boolean;
|
|
79
|
-
page?: number;
|
|
80
|
-
onPageChange?: (page: number) => void;
|
|
81
|
-
pageSize?: number;
|
|
82
|
-
defaultPageSize?: number;
|
|
83
|
-
onPageSizeChange?: (pageSize: number) => void;
|
|
36
|
+
export interface DataTableProps<T> extends UseDataTableOptions<T>, DataTableContentProps {
|
|
84
37
|
pageSizeOptions?: number[];
|
|
85
|
-
/**
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
*/
|
|
89
|
-
selection?: string[];
|
|
90
|
-
onSelectionChange?: (selection: string[]) => void;
|
|
91
|
-
/** Makes rows clickable and keyboard-activatable (Enter). */
|
|
92
|
-
onRowClick?: (row: T) => void;
|
|
93
|
-
/** Accessible name of a row, used by row selection and clickable rows. */
|
|
94
|
-
rowLabel?: (row: T) => string;
|
|
95
|
-
/** Extra toolbar content (filters, export…). A function receives the processed rows. */
|
|
38
|
+
/** Size of the search box and the filters. */
|
|
39
|
+
controlSize?: DataTableControlSize;
|
|
40
|
+
/** Extra toolbar content (export, add…). A function receives the processed rows. */
|
|
96
41
|
toolbar?: React.ReactNode | ((context: DataTableToolbarContext<T>) => React.ReactNode);
|
|
97
|
-
/** Replaces the default empty state. */
|
|
98
|
-
empty?: React.ReactNode;
|
|
99
|
-
/** Override texts for localisation. */
|
|
100
|
-
labels?: Partial<DataTableLabels>;
|
|
101
42
|
className?: string;
|
|
102
|
-
tableProps?: Omit<TableProps, 'children'>;
|
|
103
43
|
}
|
|
44
|
+
declare function DataTableComponent<T>({ density, striped, stickyHeader, layout, maxHeight, virtualized, onEndReached, empty, tableProps, pageSizeOptions, controlSize, toolbar, className, ...options }: DataTableProps<T>): React.JSX.Element;
|
|
104
45
|
/**
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* and `
|
|
46
|
+
* `<DataTable data={…} columns={…} />` renders a complete table with search,
|
|
47
|
+
* filters, sorting, pagination, row selection, row actions and inline editing;
|
|
48
|
+
* columns declare what they take part in. Every piece of state works
|
|
49
|
+
* uncontrolled or controlled (`search` / `filterValues` / `sort` / `page` /
|
|
50
|
+
* `selection`), and with `mode="server"` the same state drives an API.
|
|
51
|
+
*
|
|
52
|
+
* For another layout, create the table with `useDataTable` and compose the
|
|
53
|
+
* parts: `DataTable.Root`, `DataTable.Toolbar`, `DataTable.Search`,
|
|
54
|
+
* `DataTable.Filters`, `DataTable.Filter`, `DataTable.Actions`,
|
|
55
|
+
* `DataTable.Summary`, `DataTable.Content`, `DataTable.Pagination`.
|
|
110
56
|
*/
|
|
111
|
-
export declare
|
|
57
|
+
export declare const DataTable: typeof DataTableComponent & {
|
|
58
|
+
Root: typeof DataTableRoot;
|
|
59
|
+
Toolbar: {
|
|
60
|
+
(props: import("../../utils/primitive").PrimitiveProps<"div">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
61
|
+
displayName: string;
|
|
62
|
+
};
|
|
63
|
+
Search: typeof DataTableSearch;
|
|
64
|
+
Filters: typeof DataTableFilters;
|
|
65
|
+
Filter: typeof DataTableFilter;
|
|
66
|
+
Actions: {
|
|
67
|
+
(props: import("../../utils/primitive").PrimitiveProps<"div">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
68
|
+
displayName: string;
|
|
69
|
+
};
|
|
70
|
+
Summary: typeof DataTableSummary;
|
|
71
|
+
Content: typeof DataTableContent;
|
|
72
|
+
Pagination: typeof DataTablePagination;
|
|
73
|
+
};
|