@adapttable/unstyled 0.1.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/CHANGELOG.md +37 -0
- package/LICENSE +21 -0
- package/README.md +91 -0
- package/dist/index.cjs +2473 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +319 -0
- package/dist/index.d.ts +319 -0
- package/dist/index.js +2401 -0
- package/dist/index.js.map +1 -0
- package/package.json +80 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { BaseDataTableProps, TableSource, UseTableDataOptions, UrlStateAdapter, UseSavedViewsOptions, FilterDef, TableLabels, Direction } from '@adapttable/core';
|
|
4
|
+
export { ActionConfirm, ActiveFilterChip, BulkAction, CellProps, ColorScheme, ColumnDef, ColumnFilter, ConfirmHandler, ConfirmRequest, Direction, ExtraFilters, FILTER_TYPES, FilterDef, FilterOption, FilterType, FilterValue, InfiniteQueryLike, PageSelector, PaginatedResponse, PaginationMode, RowAction, SavedView, SortByOption, SortDirection, SortableValue, TableLabels, TableQuery, TableSource, UrlStateAdapter, UseBackendDataOptions, UseDataTableResult, UseFrontendDataOptions, UseSavedViewsOptions, UseSavedViewsResult, UseServerDataOptions, UseTableDataOptions, UseTableDataResult, UseTableUrlStateOptions, UseTableUrlStateResult, createHistoryAdapter, createMemoryAdapter, defaultConfirm, defaultLabels, deriveSortByOptions, filterLabel, filterStateKeys, getHistoryAdapter, useBackendData, useDataTable, useFrontendData, useSavedViews, useServerData, useTableData, useTableUrlState } from '@adapttable/core';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Per-part class-name hooks. Every node also carries a stable
|
|
8
|
+
* `data-adapttable-part` attribute and `data-*` state attributes so you
|
|
9
|
+
* can style with Tailwind, shadcn, or your own CSS.
|
|
10
|
+
*/
|
|
11
|
+
interface DataTableClassNames {
|
|
12
|
+
root?: string;
|
|
13
|
+
toolbar?: string;
|
|
14
|
+
search?: string;
|
|
15
|
+
/** The search field wrapper (holds the search input + leading icon). */
|
|
16
|
+
searchField?: string;
|
|
17
|
+
/** The leading magnifying-glass icon inside the search field. */
|
|
18
|
+
searchIcon?: string;
|
|
19
|
+
sortSelect?: string;
|
|
20
|
+
/** Rows-per-page `<select>` (toolbar in infinite mode, footer when paged). */
|
|
21
|
+
rowsPerPageSelect?: string;
|
|
22
|
+
filtersButton?: string;
|
|
23
|
+
/** The leading funnel icon inside the Filters button. */
|
|
24
|
+
filtersIcon?: string;
|
|
25
|
+
filtersCount?: string;
|
|
26
|
+
filtersAnchor?: string;
|
|
27
|
+
filtersBackdrop?: string;
|
|
28
|
+
filtersPopover?: string;
|
|
29
|
+
filtersPanel?: string;
|
|
30
|
+
filtersHeader?: string;
|
|
31
|
+
filtersTitle?: string;
|
|
32
|
+
filtersClose?: string;
|
|
33
|
+
filtersBody?: string;
|
|
34
|
+
filtersFooter?: string;
|
|
35
|
+
filtersClear?: string;
|
|
36
|
+
filtersDone?: string;
|
|
37
|
+
/** One auto-built filter field (the `<label>`/`<fieldset>` wrapper). */
|
|
38
|
+
filterField?: string;
|
|
39
|
+
/** The field's caption (the `<span>`/`<legend>` holding the label text). */
|
|
40
|
+
filterLabel?: string;
|
|
41
|
+
/** Text / date / number inputs inside an auto-built field. */
|
|
42
|
+
filterInput?: string;
|
|
43
|
+
/** The `<select>` of an auto-built `select` field. */
|
|
44
|
+
filterSelect?: string;
|
|
45
|
+
/** The operator `<select>` of an auto-built range field. */
|
|
46
|
+
filterOperator?: string;
|
|
47
|
+
/** The checkbox-list container of an auto-built `multiSelect` field. */
|
|
48
|
+
filterCheckboxGroup?: string;
|
|
49
|
+
/** One checkbox option (`<label>` + checkbox) in a `multiSelect` field. */
|
|
50
|
+
filterCheckbox?: string;
|
|
51
|
+
/** The placeholder shown while a field's async options load. */
|
|
52
|
+
filterOptionsLoading?: string;
|
|
53
|
+
chips?: string;
|
|
54
|
+
chip?: string;
|
|
55
|
+
chipRemove?: string;
|
|
56
|
+
columnMenu?: string;
|
|
57
|
+
columnMenuButton?: string;
|
|
58
|
+
columnMenuPanel?: string;
|
|
59
|
+
columnMenuHeader?: string;
|
|
60
|
+
columnMenuTitle?: string;
|
|
61
|
+
columnMenuItem?: string;
|
|
62
|
+
columnMenuGrip?: string;
|
|
63
|
+
columnMenuLabel?: string;
|
|
64
|
+
columnMenuVisibility?: string;
|
|
65
|
+
columnMenuPin?: string;
|
|
66
|
+
/** The separator above the trailing row-actions entry in the menu. */
|
|
67
|
+
columnMenuSeparator?: string;
|
|
68
|
+
columnMenuReset?: string;
|
|
69
|
+
/** The saved-views menu trigger button. */
|
|
70
|
+
viewsButton?: string;
|
|
71
|
+
/** The saved-views dropdown panel. */
|
|
72
|
+
viewsPanel?: string;
|
|
73
|
+
/** One saved view's apply button in the list. */
|
|
74
|
+
viewsItem?: string;
|
|
75
|
+
/** A saved view's delete button. */
|
|
76
|
+
viewsDelete?: string;
|
|
77
|
+
/** The view-name input in the save row. */
|
|
78
|
+
viewsInput?: string;
|
|
79
|
+
/** The save-view button in the save row. */
|
|
80
|
+
viewsSave?: string;
|
|
81
|
+
resizeHandle?: string;
|
|
82
|
+
bulkBar?: string;
|
|
83
|
+
bulkButton?: string;
|
|
84
|
+
/** The cross-page banner inside the bulk bar (full page selected). */
|
|
85
|
+
selectAllBanner?: string;
|
|
86
|
+
/** The banner's status text (page selected / all matching selected). */
|
|
87
|
+
selectAllText?: string;
|
|
88
|
+
/** The banner's action button (select all matching / clear all). */
|
|
89
|
+
selectAllButton?: string;
|
|
90
|
+
table?: string;
|
|
91
|
+
thead?: string;
|
|
92
|
+
headerRow?: string;
|
|
93
|
+
headerCell?: string;
|
|
94
|
+
/** The grouped-header `<tr>` rendered above the column headers. */
|
|
95
|
+
groupRow?: string;
|
|
96
|
+
/** One spanning `<th>` (or edge gap) inside the group row. */
|
|
97
|
+
groupCell?: string;
|
|
98
|
+
sortButton?: string;
|
|
99
|
+
/** The 1-based multi-sort position badge inside a sorted header. */
|
|
100
|
+
sortIndex?: string;
|
|
101
|
+
tbody?: string;
|
|
102
|
+
row?: string;
|
|
103
|
+
cell?: string;
|
|
104
|
+
/** The leading expand-chevron header cell (row expansion). */
|
|
105
|
+
expandHeader?: string;
|
|
106
|
+
/** The leading expand-chevron body cell on each row. */
|
|
107
|
+
expandCell?: string;
|
|
108
|
+
/** The expand/collapse chevron button (desktop rows and mobile cards). */
|
|
109
|
+
expandButton?: string;
|
|
110
|
+
/** The full-width detail `<tr>` rendered under an expanded row. */
|
|
111
|
+
detailRow?: string;
|
|
112
|
+
/** The single spanning `<td>` inside the detail row. */
|
|
113
|
+
detailCell?: string;
|
|
114
|
+
/** The detail section inside an expanded mobile card. */
|
|
115
|
+
cardDetail?: string;
|
|
116
|
+
actionsCell?: string;
|
|
117
|
+
actionButton?: string;
|
|
118
|
+
selectionCell?: string;
|
|
119
|
+
checkbox?: string;
|
|
120
|
+
loadMore?: string;
|
|
121
|
+
loadMoreButton?: string;
|
|
122
|
+
cards?: string;
|
|
123
|
+
card?: string;
|
|
124
|
+
cardRow?: string;
|
|
125
|
+
cardLabel?: string;
|
|
126
|
+
cardValue?: string;
|
|
127
|
+
/** The `<tfoot>` holding the summary row. */
|
|
128
|
+
summary?: string;
|
|
129
|
+
/** The summary `<tr>` inside the footer. */
|
|
130
|
+
summaryRow?: string;
|
|
131
|
+
/** One summary `<td>` (aligned under its column, or an edge pad). */
|
|
132
|
+
summaryCell?: string;
|
|
133
|
+
/** The trailing summary `<li>` in the mobile card list. */
|
|
134
|
+
summaryCard?: string;
|
|
135
|
+
footer?: string;
|
|
136
|
+
pageButton?: string;
|
|
137
|
+
empty?: string;
|
|
138
|
+
/** The clear-filters button inside the "no results" empty state. */
|
|
139
|
+
emptyClear?: string;
|
|
140
|
+
loading?: string;
|
|
141
|
+
/** The non-blocking background-refresh progress indicator. */
|
|
142
|
+
refreshIndicator?: string;
|
|
143
|
+
error?: string;
|
|
144
|
+
retryButton?: string;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Overridable sub-components — a cross-adapter alias for the top-level
|
|
148
|
+
* `emptyState` / `loadingState` props. When both are supplied the `slots`
|
|
149
|
+
* entry wins (`slots.empty ?? emptyState`, `slots.skeleton ?? loadingState`).
|
|
150
|
+
*/
|
|
151
|
+
interface DataTableSlots {
|
|
152
|
+
/** Replace the empty-state (alias for `emptyState`). */
|
|
153
|
+
empty?: ReactNode;
|
|
154
|
+
/** Replace the loading skeleton (alias for `loadingState`). */
|
|
155
|
+
skeleton?: ReactNode;
|
|
156
|
+
}
|
|
157
|
+
/** Props for the unstyled `<DataTable>`. */
|
|
158
|
+
interface DataTableProps<TRow> extends Omit<BaseDataTableProps<TRow>, "source"> {
|
|
159
|
+
/**
|
|
160
|
+
* Full-control tier: a prebuilt source (`useFrontendData`,
|
|
161
|
+
* `useBackendData`, …), used as-is. Omit it and pass `data` instead for
|
|
162
|
+
* the managed tiers.
|
|
163
|
+
*/
|
|
164
|
+
source?: TableSource<TRow>;
|
|
165
|
+
/**
|
|
166
|
+
* The rows. Alone: frontend tier — the table filters/sorts/pages them.
|
|
167
|
+
* With `onQueryChange`: server tier — the current page, as returned.
|
|
168
|
+
*/
|
|
169
|
+
data?: readonly TRow[];
|
|
170
|
+
/** Server tier: total row count across all pages (drives the pager). */
|
|
171
|
+
total?: number;
|
|
172
|
+
/** Server tier: request in flight. */
|
|
173
|
+
loading?: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Server tier: fired with the consolidated query (page, search, sort,
|
|
176
|
+
* filters) whenever it changes — including once on mount with the
|
|
177
|
+
* URL-restored values. The caller fetches and hands back `data` + `total`.
|
|
178
|
+
*/
|
|
179
|
+
onQueryChange?: UseTableDataOptions<TRow>["onQueryChange"];
|
|
180
|
+
/**
|
|
181
|
+
* URL-state adapter for the managed tiers (router integration, memory
|
|
182
|
+
* adapter for tests/SSR). Defaults to the browser History API.
|
|
183
|
+
*/
|
|
184
|
+
urlAdapter?: UrlStateAdapter;
|
|
185
|
+
/**
|
|
186
|
+
* Sync table state (search, sort, page, filters) to the URL. `false`
|
|
187
|
+
* keeps everything in memory — the table works identically, the address
|
|
188
|
+
* bar never changes, and any `urlAdapter` is ignored.
|
|
189
|
+
*
|
|
190
|
+
* @default true
|
|
191
|
+
*/
|
|
192
|
+
urlSync?: boolean;
|
|
193
|
+
/** Per-table URL namespace (e.g. `"left"` → `left.q`, `left.page`). */
|
|
194
|
+
urlKey?: string;
|
|
195
|
+
/**
|
|
196
|
+
* Mounts a saved-views menu in the toolbar (beside the Columns button).
|
|
197
|
+
* The table's own `urlAdapter` / `urlKey` fill in unless overridden here.
|
|
198
|
+
*/
|
|
199
|
+
savedViews?: UseSavedViewsOptions;
|
|
200
|
+
/** Per-part class name overrides. */
|
|
201
|
+
classNames?: DataTableClassNames;
|
|
202
|
+
/** Empty-state node override. */
|
|
203
|
+
emptyState?: ReactNode;
|
|
204
|
+
/** Loading-state node override (replaces the skeleton on first load). */
|
|
205
|
+
loadingState?: ReactNode;
|
|
206
|
+
/**
|
|
207
|
+
* Cross-adapter alias for `emptyState` / `loadingState`. Takes precedence
|
|
208
|
+
* over the top-level props when both are provided.
|
|
209
|
+
*/
|
|
210
|
+
slots?: DataTableSlots;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** Props for {@link AutoFilterForm}. */
|
|
214
|
+
interface AutoFilterFormProps<TRow> {
|
|
215
|
+
/** The resolved filter definitions, in render order. */
|
|
216
|
+
defs: readonly FilterDef<TRow>[];
|
|
217
|
+
/** The table source whose filter bag the controls read and write. */
|
|
218
|
+
source: TableSource<TRow>;
|
|
219
|
+
/** Per-part class name overrides (the `filter*` keys). */
|
|
220
|
+
classNames?: DataTableClassNames;
|
|
221
|
+
/**
|
|
222
|
+
* Label overrides for the range widgets (`operator`, `value`, `from`,
|
|
223
|
+
* `to`, and the `op*` operator names); English defaults merge in.
|
|
224
|
+
*/
|
|
225
|
+
labels?: TableLabels;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* The auto-built filter form for the declarative `filters` array: one
|
|
229
|
+
* semantic field per definition (`text` input, `select` with an "All"
|
|
230
|
+
* option, `multiSelect` checkbox list, operator-first `dateRange` /
|
|
231
|
+
* `numberRange` widgets), each carrying `data-adapttable-part` hooks and
|
|
232
|
+
* `classNames` overrides. Controls read `source.extra` and write through
|
|
233
|
+
* `source.setExtra` / `source.setExtras` — an empty value clears its key.
|
|
234
|
+
*
|
|
235
|
+
* @typeParam TRow - The row type.
|
|
236
|
+
*/
|
|
237
|
+
declare function AutoFilterForm<TRow>({ defs, source, classNames, labels, }: Readonly<AutoFilterFormProps<TRow>>): react.JSX.Element;
|
|
238
|
+
|
|
239
|
+
/** Props for {@link FilterPanel}. */
|
|
240
|
+
interface FilterPanelProps {
|
|
241
|
+
open: boolean;
|
|
242
|
+
onClose: () => void;
|
|
243
|
+
filters: ReactNode;
|
|
244
|
+
activeFilterCount: number;
|
|
245
|
+
onClearFilters?: () => void;
|
|
246
|
+
labels: Required<TableLabels>;
|
|
247
|
+
dir?: Direction;
|
|
248
|
+
classNames: DataTableClassNames;
|
|
249
|
+
}
|
|
250
|
+
/** Backdrop + side drawer for caller-provided filter widgets. */
|
|
251
|
+
declare function FilterPanel({ open, onClose, filters, activeFilterCount, onClearFilters, labels, dir, classNames, }: Readonly<FilterPanelProps>): react.ReactPortal | null;
|
|
252
|
+
|
|
253
|
+
/** Props for {@link FilterPopover}. */
|
|
254
|
+
interface FilterPopoverProps {
|
|
255
|
+
open: boolean;
|
|
256
|
+
onClose: () => void;
|
|
257
|
+
filters: ReactNode;
|
|
258
|
+
activeFilterCount: number;
|
|
259
|
+
onClearFilters?: () => void;
|
|
260
|
+
labels: Required<TableLabels>;
|
|
261
|
+
dir?: Direction;
|
|
262
|
+
classNames: DataTableClassNames;
|
|
263
|
+
/** The Filters trigger button — the popover anchors beneath it. */
|
|
264
|
+
children: ReactNode;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Anchored filter card (the default filter container). Opens beneath the
|
|
268
|
+
* Filters button with NO backdrop — the background stays visible and
|
|
269
|
+
* interactive; clicking outside the popover/anchor or pressing Escape closes
|
|
270
|
+
* it. This is the plain-DOM mirror of the Mantine reference; pair with
|
|
271
|
+
* `filtersMode="drawer"` for the slide-in panel (`FilterPanel`) instead.
|
|
272
|
+
*/
|
|
273
|
+
declare function FilterPopover({ open, onClose, filters, activeFilterCount, onClearFilters, labels, dir, classNames, children, }: Readonly<FilterPopoverProps>): react.JSX.Element;
|
|
274
|
+
|
|
275
|
+
interface IconProps {
|
|
276
|
+
size?: number;
|
|
277
|
+
className?: string;
|
|
278
|
+
}
|
|
279
|
+
/** Magnifying-glass search glyph (inline SVG, `currentColor`). */
|
|
280
|
+
declare const SearchIcon: (p: Readonly<IconProps>) => react.JSX.Element;
|
|
281
|
+
/** Funnel glyph for the Filters button (inline SVG, `currentColor`). */
|
|
282
|
+
declare const FiltersIcon: (p: Readonly<IconProps>) => react.JSX.Element;
|
|
283
|
+
|
|
284
|
+
/** The label strings the saved-views menu renders. */
|
|
285
|
+
type SavedViewsLabels = Pick<Required<TableLabels>, "savedViews" | "saveView" | "viewName" | "deleteView">;
|
|
286
|
+
interface SavedViewsMenuProps {
|
|
287
|
+
/** Wiring for core's `useSavedViews` — storage key, storage, adapter, urlKey. */
|
|
288
|
+
options: UseSavedViewsOptions;
|
|
289
|
+
labels: SavedViewsLabels;
|
|
290
|
+
classNames: DataTableClassNames;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Saved-views popover: a disclosure button + a panel listing the saved views
|
|
294
|
+
* (click applies one; each has a delete button) above a save row that
|
|
295
|
+
* captures the table's CURRENT state under a typed name. Built on core's
|
|
296
|
+
* `useSavedViews`; closes on outside-click or Escape. Ships no styles —
|
|
297
|
+
* target the `data-adapttable-part` hooks or the `views*` className slots.
|
|
298
|
+
*/
|
|
299
|
+
declare function SavedViewsMenu({ options, labels, classNames, }: Readonly<SavedViewsMenuProps>): react.JSX.Element;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Join class-name parts, dropping falsy values. Tiny `clsx`-style helper
|
|
303
|
+
* so the unstyled adapter has no runtime dependencies.
|
|
304
|
+
*
|
|
305
|
+
* @param parts - Class names or falsy values.
|
|
306
|
+
* @returns The space-joined class string.
|
|
307
|
+
*/
|
|
308
|
+
declare function cx(...parts: (string | false | null | undefined)[]): string;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Headless, unstyled AdaptTable for Tailwind / shadcn / custom CSS. Renders
|
|
312
|
+
* semantic HTML with `data-adapttable-part` hooks and `className` overrides;
|
|
313
|
+
* ships no styles of its own. Built on the `@adapttable/core` prop-getters.
|
|
314
|
+
*
|
|
315
|
+
* @typeParam TRow - The row type.
|
|
316
|
+
*/
|
|
317
|
+
declare function DataTable<TRow>(props: Readonly<DataTableProps<TRow>>): react.JSX.Element;
|
|
318
|
+
|
|
319
|
+
export { AutoFilterForm, type AutoFilterFormProps, DataTable, type DataTableClassNames, type DataTableProps, type DataTableSlots, FilterPanel, type FilterPanelProps, FilterPopover, type FilterPopoverProps, FiltersIcon, type SavedViewsLabels, SavedViewsMenu, type SavedViewsMenuProps, SearchIcon, cx };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { BaseDataTableProps, TableSource, UseTableDataOptions, UrlStateAdapter, UseSavedViewsOptions, FilterDef, TableLabels, Direction } from '@adapttable/core';
|
|
4
|
+
export { ActionConfirm, ActiveFilterChip, BulkAction, CellProps, ColorScheme, ColumnDef, ColumnFilter, ConfirmHandler, ConfirmRequest, Direction, ExtraFilters, FILTER_TYPES, FilterDef, FilterOption, FilterType, FilterValue, InfiniteQueryLike, PageSelector, PaginatedResponse, PaginationMode, RowAction, SavedView, SortByOption, SortDirection, SortableValue, TableLabels, TableQuery, TableSource, UrlStateAdapter, UseBackendDataOptions, UseDataTableResult, UseFrontendDataOptions, UseSavedViewsOptions, UseSavedViewsResult, UseServerDataOptions, UseTableDataOptions, UseTableDataResult, UseTableUrlStateOptions, UseTableUrlStateResult, createHistoryAdapter, createMemoryAdapter, defaultConfirm, defaultLabels, deriveSortByOptions, filterLabel, filterStateKeys, getHistoryAdapter, useBackendData, useDataTable, useFrontendData, useSavedViews, useServerData, useTableData, useTableUrlState } from '@adapttable/core';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Per-part class-name hooks. Every node also carries a stable
|
|
8
|
+
* `data-adapttable-part` attribute and `data-*` state attributes so you
|
|
9
|
+
* can style with Tailwind, shadcn, or your own CSS.
|
|
10
|
+
*/
|
|
11
|
+
interface DataTableClassNames {
|
|
12
|
+
root?: string;
|
|
13
|
+
toolbar?: string;
|
|
14
|
+
search?: string;
|
|
15
|
+
/** The search field wrapper (holds the search input + leading icon). */
|
|
16
|
+
searchField?: string;
|
|
17
|
+
/** The leading magnifying-glass icon inside the search field. */
|
|
18
|
+
searchIcon?: string;
|
|
19
|
+
sortSelect?: string;
|
|
20
|
+
/** Rows-per-page `<select>` (toolbar in infinite mode, footer when paged). */
|
|
21
|
+
rowsPerPageSelect?: string;
|
|
22
|
+
filtersButton?: string;
|
|
23
|
+
/** The leading funnel icon inside the Filters button. */
|
|
24
|
+
filtersIcon?: string;
|
|
25
|
+
filtersCount?: string;
|
|
26
|
+
filtersAnchor?: string;
|
|
27
|
+
filtersBackdrop?: string;
|
|
28
|
+
filtersPopover?: string;
|
|
29
|
+
filtersPanel?: string;
|
|
30
|
+
filtersHeader?: string;
|
|
31
|
+
filtersTitle?: string;
|
|
32
|
+
filtersClose?: string;
|
|
33
|
+
filtersBody?: string;
|
|
34
|
+
filtersFooter?: string;
|
|
35
|
+
filtersClear?: string;
|
|
36
|
+
filtersDone?: string;
|
|
37
|
+
/** One auto-built filter field (the `<label>`/`<fieldset>` wrapper). */
|
|
38
|
+
filterField?: string;
|
|
39
|
+
/** The field's caption (the `<span>`/`<legend>` holding the label text). */
|
|
40
|
+
filterLabel?: string;
|
|
41
|
+
/** Text / date / number inputs inside an auto-built field. */
|
|
42
|
+
filterInput?: string;
|
|
43
|
+
/** The `<select>` of an auto-built `select` field. */
|
|
44
|
+
filterSelect?: string;
|
|
45
|
+
/** The operator `<select>` of an auto-built range field. */
|
|
46
|
+
filterOperator?: string;
|
|
47
|
+
/** The checkbox-list container of an auto-built `multiSelect` field. */
|
|
48
|
+
filterCheckboxGroup?: string;
|
|
49
|
+
/** One checkbox option (`<label>` + checkbox) in a `multiSelect` field. */
|
|
50
|
+
filterCheckbox?: string;
|
|
51
|
+
/** The placeholder shown while a field's async options load. */
|
|
52
|
+
filterOptionsLoading?: string;
|
|
53
|
+
chips?: string;
|
|
54
|
+
chip?: string;
|
|
55
|
+
chipRemove?: string;
|
|
56
|
+
columnMenu?: string;
|
|
57
|
+
columnMenuButton?: string;
|
|
58
|
+
columnMenuPanel?: string;
|
|
59
|
+
columnMenuHeader?: string;
|
|
60
|
+
columnMenuTitle?: string;
|
|
61
|
+
columnMenuItem?: string;
|
|
62
|
+
columnMenuGrip?: string;
|
|
63
|
+
columnMenuLabel?: string;
|
|
64
|
+
columnMenuVisibility?: string;
|
|
65
|
+
columnMenuPin?: string;
|
|
66
|
+
/** The separator above the trailing row-actions entry in the menu. */
|
|
67
|
+
columnMenuSeparator?: string;
|
|
68
|
+
columnMenuReset?: string;
|
|
69
|
+
/** The saved-views menu trigger button. */
|
|
70
|
+
viewsButton?: string;
|
|
71
|
+
/** The saved-views dropdown panel. */
|
|
72
|
+
viewsPanel?: string;
|
|
73
|
+
/** One saved view's apply button in the list. */
|
|
74
|
+
viewsItem?: string;
|
|
75
|
+
/** A saved view's delete button. */
|
|
76
|
+
viewsDelete?: string;
|
|
77
|
+
/** The view-name input in the save row. */
|
|
78
|
+
viewsInput?: string;
|
|
79
|
+
/** The save-view button in the save row. */
|
|
80
|
+
viewsSave?: string;
|
|
81
|
+
resizeHandle?: string;
|
|
82
|
+
bulkBar?: string;
|
|
83
|
+
bulkButton?: string;
|
|
84
|
+
/** The cross-page banner inside the bulk bar (full page selected). */
|
|
85
|
+
selectAllBanner?: string;
|
|
86
|
+
/** The banner's status text (page selected / all matching selected). */
|
|
87
|
+
selectAllText?: string;
|
|
88
|
+
/** The banner's action button (select all matching / clear all). */
|
|
89
|
+
selectAllButton?: string;
|
|
90
|
+
table?: string;
|
|
91
|
+
thead?: string;
|
|
92
|
+
headerRow?: string;
|
|
93
|
+
headerCell?: string;
|
|
94
|
+
/** The grouped-header `<tr>` rendered above the column headers. */
|
|
95
|
+
groupRow?: string;
|
|
96
|
+
/** One spanning `<th>` (or edge gap) inside the group row. */
|
|
97
|
+
groupCell?: string;
|
|
98
|
+
sortButton?: string;
|
|
99
|
+
/** The 1-based multi-sort position badge inside a sorted header. */
|
|
100
|
+
sortIndex?: string;
|
|
101
|
+
tbody?: string;
|
|
102
|
+
row?: string;
|
|
103
|
+
cell?: string;
|
|
104
|
+
/** The leading expand-chevron header cell (row expansion). */
|
|
105
|
+
expandHeader?: string;
|
|
106
|
+
/** The leading expand-chevron body cell on each row. */
|
|
107
|
+
expandCell?: string;
|
|
108
|
+
/** The expand/collapse chevron button (desktop rows and mobile cards). */
|
|
109
|
+
expandButton?: string;
|
|
110
|
+
/** The full-width detail `<tr>` rendered under an expanded row. */
|
|
111
|
+
detailRow?: string;
|
|
112
|
+
/** The single spanning `<td>` inside the detail row. */
|
|
113
|
+
detailCell?: string;
|
|
114
|
+
/** The detail section inside an expanded mobile card. */
|
|
115
|
+
cardDetail?: string;
|
|
116
|
+
actionsCell?: string;
|
|
117
|
+
actionButton?: string;
|
|
118
|
+
selectionCell?: string;
|
|
119
|
+
checkbox?: string;
|
|
120
|
+
loadMore?: string;
|
|
121
|
+
loadMoreButton?: string;
|
|
122
|
+
cards?: string;
|
|
123
|
+
card?: string;
|
|
124
|
+
cardRow?: string;
|
|
125
|
+
cardLabel?: string;
|
|
126
|
+
cardValue?: string;
|
|
127
|
+
/** The `<tfoot>` holding the summary row. */
|
|
128
|
+
summary?: string;
|
|
129
|
+
/** The summary `<tr>` inside the footer. */
|
|
130
|
+
summaryRow?: string;
|
|
131
|
+
/** One summary `<td>` (aligned under its column, or an edge pad). */
|
|
132
|
+
summaryCell?: string;
|
|
133
|
+
/** The trailing summary `<li>` in the mobile card list. */
|
|
134
|
+
summaryCard?: string;
|
|
135
|
+
footer?: string;
|
|
136
|
+
pageButton?: string;
|
|
137
|
+
empty?: string;
|
|
138
|
+
/** The clear-filters button inside the "no results" empty state. */
|
|
139
|
+
emptyClear?: string;
|
|
140
|
+
loading?: string;
|
|
141
|
+
/** The non-blocking background-refresh progress indicator. */
|
|
142
|
+
refreshIndicator?: string;
|
|
143
|
+
error?: string;
|
|
144
|
+
retryButton?: string;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Overridable sub-components — a cross-adapter alias for the top-level
|
|
148
|
+
* `emptyState` / `loadingState` props. When both are supplied the `slots`
|
|
149
|
+
* entry wins (`slots.empty ?? emptyState`, `slots.skeleton ?? loadingState`).
|
|
150
|
+
*/
|
|
151
|
+
interface DataTableSlots {
|
|
152
|
+
/** Replace the empty-state (alias for `emptyState`). */
|
|
153
|
+
empty?: ReactNode;
|
|
154
|
+
/** Replace the loading skeleton (alias for `loadingState`). */
|
|
155
|
+
skeleton?: ReactNode;
|
|
156
|
+
}
|
|
157
|
+
/** Props for the unstyled `<DataTable>`. */
|
|
158
|
+
interface DataTableProps<TRow> extends Omit<BaseDataTableProps<TRow>, "source"> {
|
|
159
|
+
/**
|
|
160
|
+
* Full-control tier: a prebuilt source (`useFrontendData`,
|
|
161
|
+
* `useBackendData`, …), used as-is. Omit it and pass `data` instead for
|
|
162
|
+
* the managed tiers.
|
|
163
|
+
*/
|
|
164
|
+
source?: TableSource<TRow>;
|
|
165
|
+
/**
|
|
166
|
+
* The rows. Alone: frontend tier — the table filters/sorts/pages them.
|
|
167
|
+
* With `onQueryChange`: server tier — the current page, as returned.
|
|
168
|
+
*/
|
|
169
|
+
data?: readonly TRow[];
|
|
170
|
+
/** Server tier: total row count across all pages (drives the pager). */
|
|
171
|
+
total?: number;
|
|
172
|
+
/** Server tier: request in flight. */
|
|
173
|
+
loading?: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Server tier: fired with the consolidated query (page, search, sort,
|
|
176
|
+
* filters) whenever it changes — including once on mount with the
|
|
177
|
+
* URL-restored values. The caller fetches and hands back `data` + `total`.
|
|
178
|
+
*/
|
|
179
|
+
onQueryChange?: UseTableDataOptions<TRow>["onQueryChange"];
|
|
180
|
+
/**
|
|
181
|
+
* URL-state adapter for the managed tiers (router integration, memory
|
|
182
|
+
* adapter for tests/SSR). Defaults to the browser History API.
|
|
183
|
+
*/
|
|
184
|
+
urlAdapter?: UrlStateAdapter;
|
|
185
|
+
/**
|
|
186
|
+
* Sync table state (search, sort, page, filters) to the URL. `false`
|
|
187
|
+
* keeps everything in memory — the table works identically, the address
|
|
188
|
+
* bar never changes, and any `urlAdapter` is ignored.
|
|
189
|
+
*
|
|
190
|
+
* @default true
|
|
191
|
+
*/
|
|
192
|
+
urlSync?: boolean;
|
|
193
|
+
/** Per-table URL namespace (e.g. `"left"` → `left.q`, `left.page`). */
|
|
194
|
+
urlKey?: string;
|
|
195
|
+
/**
|
|
196
|
+
* Mounts a saved-views menu in the toolbar (beside the Columns button).
|
|
197
|
+
* The table's own `urlAdapter` / `urlKey` fill in unless overridden here.
|
|
198
|
+
*/
|
|
199
|
+
savedViews?: UseSavedViewsOptions;
|
|
200
|
+
/** Per-part class name overrides. */
|
|
201
|
+
classNames?: DataTableClassNames;
|
|
202
|
+
/** Empty-state node override. */
|
|
203
|
+
emptyState?: ReactNode;
|
|
204
|
+
/** Loading-state node override (replaces the skeleton on first load). */
|
|
205
|
+
loadingState?: ReactNode;
|
|
206
|
+
/**
|
|
207
|
+
* Cross-adapter alias for `emptyState` / `loadingState`. Takes precedence
|
|
208
|
+
* over the top-level props when both are provided.
|
|
209
|
+
*/
|
|
210
|
+
slots?: DataTableSlots;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** Props for {@link AutoFilterForm}. */
|
|
214
|
+
interface AutoFilterFormProps<TRow> {
|
|
215
|
+
/** The resolved filter definitions, in render order. */
|
|
216
|
+
defs: readonly FilterDef<TRow>[];
|
|
217
|
+
/** The table source whose filter bag the controls read and write. */
|
|
218
|
+
source: TableSource<TRow>;
|
|
219
|
+
/** Per-part class name overrides (the `filter*` keys). */
|
|
220
|
+
classNames?: DataTableClassNames;
|
|
221
|
+
/**
|
|
222
|
+
* Label overrides for the range widgets (`operator`, `value`, `from`,
|
|
223
|
+
* `to`, and the `op*` operator names); English defaults merge in.
|
|
224
|
+
*/
|
|
225
|
+
labels?: TableLabels;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* The auto-built filter form for the declarative `filters` array: one
|
|
229
|
+
* semantic field per definition (`text` input, `select` with an "All"
|
|
230
|
+
* option, `multiSelect` checkbox list, operator-first `dateRange` /
|
|
231
|
+
* `numberRange` widgets), each carrying `data-adapttable-part` hooks and
|
|
232
|
+
* `classNames` overrides. Controls read `source.extra` and write through
|
|
233
|
+
* `source.setExtra` / `source.setExtras` — an empty value clears its key.
|
|
234
|
+
*
|
|
235
|
+
* @typeParam TRow - The row type.
|
|
236
|
+
*/
|
|
237
|
+
declare function AutoFilterForm<TRow>({ defs, source, classNames, labels, }: Readonly<AutoFilterFormProps<TRow>>): react.JSX.Element;
|
|
238
|
+
|
|
239
|
+
/** Props for {@link FilterPanel}. */
|
|
240
|
+
interface FilterPanelProps {
|
|
241
|
+
open: boolean;
|
|
242
|
+
onClose: () => void;
|
|
243
|
+
filters: ReactNode;
|
|
244
|
+
activeFilterCount: number;
|
|
245
|
+
onClearFilters?: () => void;
|
|
246
|
+
labels: Required<TableLabels>;
|
|
247
|
+
dir?: Direction;
|
|
248
|
+
classNames: DataTableClassNames;
|
|
249
|
+
}
|
|
250
|
+
/** Backdrop + side drawer for caller-provided filter widgets. */
|
|
251
|
+
declare function FilterPanel({ open, onClose, filters, activeFilterCount, onClearFilters, labels, dir, classNames, }: Readonly<FilterPanelProps>): react.ReactPortal | null;
|
|
252
|
+
|
|
253
|
+
/** Props for {@link FilterPopover}. */
|
|
254
|
+
interface FilterPopoverProps {
|
|
255
|
+
open: boolean;
|
|
256
|
+
onClose: () => void;
|
|
257
|
+
filters: ReactNode;
|
|
258
|
+
activeFilterCount: number;
|
|
259
|
+
onClearFilters?: () => void;
|
|
260
|
+
labels: Required<TableLabels>;
|
|
261
|
+
dir?: Direction;
|
|
262
|
+
classNames: DataTableClassNames;
|
|
263
|
+
/** The Filters trigger button — the popover anchors beneath it. */
|
|
264
|
+
children: ReactNode;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Anchored filter card (the default filter container). Opens beneath the
|
|
268
|
+
* Filters button with NO backdrop — the background stays visible and
|
|
269
|
+
* interactive; clicking outside the popover/anchor or pressing Escape closes
|
|
270
|
+
* it. This is the plain-DOM mirror of the Mantine reference; pair with
|
|
271
|
+
* `filtersMode="drawer"` for the slide-in panel (`FilterPanel`) instead.
|
|
272
|
+
*/
|
|
273
|
+
declare function FilterPopover({ open, onClose, filters, activeFilterCount, onClearFilters, labels, dir, classNames, children, }: Readonly<FilterPopoverProps>): react.JSX.Element;
|
|
274
|
+
|
|
275
|
+
interface IconProps {
|
|
276
|
+
size?: number;
|
|
277
|
+
className?: string;
|
|
278
|
+
}
|
|
279
|
+
/** Magnifying-glass search glyph (inline SVG, `currentColor`). */
|
|
280
|
+
declare const SearchIcon: (p: Readonly<IconProps>) => react.JSX.Element;
|
|
281
|
+
/** Funnel glyph for the Filters button (inline SVG, `currentColor`). */
|
|
282
|
+
declare const FiltersIcon: (p: Readonly<IconProps>) => react.JSX.Element;
|
|
283
|
+
|
|
284
|
+
/** The label strings the saved-views menu renders. */
|
|
285
|
+
type SavedViewsLabels = Pick<Required<TableLabels>, "savedViews" | "saveView" | "viewName" | "deleteView">;
|
|
286
|
+
interface SavedViewsMenuProps {
|
|
287
|
+
/** Wiring for core's `useSavedViews` — storage key, storage, adapter, urlKey. */
|
|
288
|
+
options: UseSavedViewsOptions;
|
|
289
|
+
labels: SavedViewsLabels;
|
|
290
|
+
classNames: DataTableClassNames;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Saved-views popover: a disclosure button + a panel listing the saved views
|
|
294
|
+
* (click applies one; each has a delete button) above a save row that
|
|
295
|
+
* captures the table's CURRENT state under a typed name. Built on core's
|
|
296
|
+
* `useSavedViews`; closes on outside-click or Escape. Ships no styles —
|
|
297
|
+
* target the `data-adapttable-part` hooks or the `views*` className slots.
|
|
298
|
+
*/
|
|
299
|
+
declare function SavedViewsMenu({ options, labels, classNames, }: Readonly<SavedViewsMenuProps>): react.JSX.Element;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Join class-name parts, dropping falsy values. Tiny `clsx`-style helper
|
|
303
|
+
* so the unstyled adapter has no runtime dependencies.
|
|
304
|
+
*
|
|
305
|
+
* @param parts - Class names or falsy values.
|
|
306
|
+
* @returns The space-joined class string.
|
|
307
|
+
*/
|
|
308
|
+
declare function cx(...parts: (string | false | null | undefined)[]): string;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Headless, unstyled AdaptTable for Tailwind / shadcn / custom CSS. Renders
|
|
312
|
+
* semantic HTML with `data-adapttable-part` hooks and `className` overrides;
|
|
313
|
+
* ships no styles of its own. Built on the `@adapttable/core` prop-getters.
|
|
314
|
+
*
|
|
315
|
+
* @typeParam TRow - The row type.
|
|
316
|
+
*/
|
|
317
|
+
declare function DataTable<TRow>(props: Readonly<DataTableProps<TRow>>): react.JSX.Element;
|
|
318
|
+
|
|
319
|
+
export { AutoFilterForm, type AutoFilterFormProps, DataTable, type DataTableClassNames, type DataTableProps, type DataTableSlots, FilterPanel, type FilterPanelProps, FilterPopover, type FilterPopoverProps, FiltersIcon, type SavedViewsLabels, SavedViewsMenu, type SavedViewsMenuProps, SearchIcon, cx };
|