@ngrok/mantle 0.70.1 → 0.71.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/accordion.d.ts +1 -1
- package/dist/alert-dialog.d.ts +341 -94
- package/dist/alert-dialog.js.map +1 -1
- package/dist/alert.d.ts +3 -3
- package/dist/alert.js.map +1 -1
- package/dist/anchor-2stEauOz.js.map +1 -1
- package/dist/anchor.d.ts +46 -5
- package/dist/{as-child-CJ2vTesV.d.ts → as-child-DQHfEmYB.d.ts} +1 -1
- package/dist/badge.d.ts +34 -5
- package/dist/badge.js.map +1 -1
- package/dist/{button-DDK6nEac.d.ts → button-Bq0x5Pv4.d.ts} +6 -6
- package/dist/button.d.ts +3 -3
- package/dist/card.d.ts +1 -1
- package/dist/checkbox.d.ts +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/code-block.d.ts +3 -3
- package/dist/code-block.js +1 -1
- package/dist/code-block.js.map +1 -1
- package/dist/code-block_highlight-utils.d.ts +1 -1
- package/dist/code-block_highlight-utils.js +1 -1
- package/dist/code.d.ts +23 -2
- package/dist/code.js.map +1 -1
- package/dist/color.d.ts +1 -1
- package/dist/combobox.d.ts +12 -2
- package/dist/combobox.js +1 -1
- package/dist/combobox.js.map +1 -1
- package/dist/command.d.ts +3 -3
- package/dist/command.js +1 -1
- package/dist/command.js.map +1 -1
- package/dist/compose-refs-DZ3cPi47.js +2 -0
- package/dist/compose-refs-DZ3cPi47.js.map +1 -0
- package/dist/copy-to-clipboard-DjOD_Mwb.js +2 -0
- package/dist/copy-to-clipboard-DjOD_Mwb.js.map +1 -0
- package/dist/data-table.d.ts +530 -75
- package/dist/data-table.js +1 -1
- package/dist/data-table.js.map +1 -1
- package/dist/{deep-non-nullable-DwBZzk4x.d.ts → deep-non-nullable-VFm1T3JZ.d.ts} +1 -1
- package/dist/description-list.d.ts +1 -1
- package/dist/{dialog-MiS_Q-ge.js → dialog-BHzl9eye.js} +1 -1
- package/dist/dialog-BHzl9eye.js.map +1 -0
- package/dist/dialog.d.ts +8 -3
- package/dist/dialog.js +1 -1
- package/dist/{direction-ClCocWIf.js → direction-DsB-pD9V.js} +1 -1
- package/dist/{direction-ClCocWIf.js.map → direction-DsB-pD9V.js.map} +1 -1
- package/dist/{direction-Jk7BkzGo.d.ts → direction-DtBAQn7p.d.ts} +1 -1
- package/dist/{dropdown-menu-C9f9Y8Ov.d.ts → dropdown-menu-CzUNYIfA.d.ts} +2 -2
- package/dist/{dropdown-menu-Ff97BIJe.js → dropdown-menu-Ducs2SEn.js} +2 -2
- package/dist/{dropdown-menu-Ff97BIJe.js.map → dropdown-menu-Ducs2SEn.js.map} +1 -1
- package/dist/dropdown-menu.d.ts +1 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +2 -2
- package/dist/flag.d.ts +33 -4
- package/dist/flag.js.map +1 -1
- package/dist/hooks.d.ts +301 -77
- package/dist/hooks.js +1 -1
- package/dist/hooks.js.map +1 -1
- package/dist/hover-card.d.ts +15 -10
- package/dist/hover-card.js.map +1 -1
- package/dist/{icon-C0YAAaLZ.d.ts → icon-DKMJm20j.d.ts} +2 -2
- package/dist/{icon-button-Cl30yTfu.d.ts → icon-button-BnK4K7YK.d.ts} +3 -3
- package/dist/icon.d.ts +3 -3
- package/dist/icons.d.ts +3 -3
- package/dist/icons.js +1 -1
- package/dist/icons.js.map +1 -1
- package/dist/{in-view-DsiWfQpY.d.ts → in-view-Da08Bx6l.d.ts} +15 -4
- package/dist/{in-view-BXzPPdcl.js → in-view-pia_SVdE.js} +1 -1
- package/dist/{in-view-BXzPPdcl.js.map → in-view-pia_SVdE.js.map} +1 -1
- package/dist/{index-ddHz7L9f.d.ts → index-C91lxoX9.d.ts} +56 -13
- package/dist/{index-DU3SQJ46.d.ts → index-DOJUH34Z.d.ts} +4 -4
- package/dist/{index-B6SPk_xb.d.ts → index-DkMUaYsw.d.ts} +1 -1
- package/dist/{index-vOSpS5jv.d.ts → index-rtz7SwEq.d.ts} +1 -1
- package/dist/input.d.ts +2 -2
- package/dist/input.js +1 -1
- package/dist/input.js.map +1 -1
- package/dist/{is-input-Bh1rQhX3.js → is-input-CUEWaxtA.js} +1 -1
- package/dist/{is-input-Bh1rQhX3.js.map → is-input-CUEWaxtA.js.map} +1 -1
- package/dist/{kbd-B0wWeV_0.js → kbd-CAVUiqBT.js} +1 -1
- package/dist/kbd-CAVUiqBT.js.map +1 -0
- package/dist/kbd.d.ts +37 -8
- package/dist/kbd.js +1 -1
- package/dist/label.d.ts +40 -9
- package/dist/label.js.map +1 -1
- package/dist/media-object.d.ts +27 -11
- package/dist/media-object.js.map +1 -1
- package/dist/multi-select.d.ts +187 -36
- package/dist/multi-select.js +1 -1
- package/dist/multi-select.js.map +1 -1
- package/dist/otp-input.d.ts +167 -0
- package/dist/otp-input.js +2 -0
- package/dist/otp-input.js.map +1 -0
- package/dist/pagination.d.ts +3 -3
- package/dist/pagination.js +1 -1
- package/dist/pagination.js.map +1 -1
- package/dist/popover.d.ts +7 -5
- package/dist/popover.js.map +1 -1
- package/dist/primitive-tXm_8n_t.js.map +1 -1
- package/dist/{primitive-DXo0gUqw.d.ts → primitive-tyw4V7Vf.d.ts} +1 -1
- package/dist/progress.js.map +1 -1
- package/dist/radio-group.d.ts +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/{resolve-pre-rendered-props-BXv6e6fc.js → resolve-pre-rendered-props-C-kiaLHj.js} +1 -1
- package/dist/{resolve-pre-rendered-props-BXv6e6fc.js.map → resolve-pre-rendered-props-C-kiaLHj.js.map} +1 -1
- package/dist/{resolve-pre-rendered-props-kcQrtWPt.d.ts → resolve-pre-rendered-props-CNUnH1fU.d.ts} +1 -1
- package/dist/sandboxed-on-click.d.ts +1 -1
- package/dist/{select-LJmfG--I.js → select-DOgdZO0Q.js} +2 -2
- package/dist/select-DOgdZO0Q.js.map +1 -0
- package/dist/{select-DNJli9JO.d.ts → select-DZutJxyr.d.ts} +11 -3
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/{separator-DyOGgFCs.js → separator-DSOIrnhj.js} +1 -1
- package/dist/{separator-DyOGgFCs.js.map → separator-DSOIrnhj.js.map} +1 -1
- package/dist/separator.d.ts +1 -1
- package/dist/separator.js +1 -1
- package/dist/sheet.d.ts +7 -3
- package/dist/sheet.js.map +1 -1
- package/dist/skeleton.d.ts +32 -5
- package/dist/skeleton.js.map +1 -1
- package/dist/{sort-C_Jbs1dH.js → sort-DzCsa6Qj.js} +2 -2
- package/dist/{sort-C_Jbs1dH.js.map → sort-DzCsa6Qj.js.map} +1 -1
- package/dist/split-button.d.ts +3 -3
- package/dist/split-button.js +1 -1
- package/dist/{svg-only-BnnbLx6R.d.ts → svg-only-BtBvFy-N.d.ts} +2 -2
- package/dist/{table-4q1UxE7L.d.ts → table-BsNJBKiq.d.ts} +7 -3
- package/dist/{table-12T25gGa.js → table-Cl4nlRMR.js} +2 -2
- package/dist/{table-12T25gGa.js.map → table-Cl4nlRMR.js.map} +1 -1
- package/dist/table.d.ts +1 -1
- package/dist/table.js +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text-area.d.ts +1 -1
- package/dist/text-area.js +1 -1
- package/dist/theme-provider-BFcnjeME.js.map +1 -1
- package/dist/theme.d.ts +2 -2
- package/dist/theme.js.map +1 -1
- package/dist/{themes-DXb8Tk74.d.ts → themes-DIEYkvNl.d.ts} +1 -1
- package/dist/toast.d.ts +3 -3
- package/dist/tooltip.d.ts +31 -14
- package/dist/tooltip.js.map +1 -1
- package/dist/{traffic-policy-file-ChsoQtXQ.js → traffic-policy-file-C6LHYrIU.js} +1 -1
- package/dist/{traffic-policy-file-ChsoQtXQ.js.map → traffic-policy-file-C6LHYrIU.js.map} +1 -1
- package/dist/{types-BeTbgoJd.d.ts → types-DG0WQLTL.d.ts} +1 -1
- package/dist/{types-DEYyl5LX.d.ts → types-DoV0R5Ja.d.ts} +1 -1
- package/dist/types.d.ts +5 -5
- package/dist/use-copy-to-clipboard-C7vsjJe-.js +2 -0
- package/dist/use-copy-to-clipboard-C7vsjJe-.js.map +1 -0
- package/dist/use-matches-media-query-CojcYxlA.js.map +1 -1
- package/dist/{use-prefers-reduced-motion-BcwST13S.js → use-prefers-reduced-motion-aXfsyo-k.js} +1 -1
- package/dist/use-prefers-reduced-motion-aXfsyo-k.js.map +1 -0
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/dist/{variant-props-DszdagRm.d.ts → variant-props-DUmSIQK8.d.ts} +2 -2
- package/dist/{with-style-props-Dlz3G1tS.d.ts → with-style-props-3iFrBR08.d.ts} +1 -1
- package/package.json +12 -7
- package/dist/compose-refs-DFIaEnQH.js +0 -2
- package/dist/compose-refs-DFIaEnQH.js.map +0 -1
- package/dist/dialog-MiS_Q-ge.js.map +0 -1
- package/dist/kbd-B0wWeV_0.js.map +0 -1
- package/dist/select-LJmfG--I.js.map +0 -1
- package/dist/use-copy-to-clipboard-Ds9MsSNU.js +0 -2
- package/dist/use-copy-to-clipboard-Ds9MsSNU.js.map +0 -1
- package/dist/use-prefers-reduced-motion-BcwST13S.js.map +0 -1
package/dist/data-table.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as Button } from "./button-
|
|
2
|
-
import { s as SortingMode } from "./direction-
|
|
3
|
-
import { t as Table$1 } from "./table-
|
|
1
|
+
import { t as Button } from "./button-Bq0x5Pv4.js";
|
|
2
|
+
import { s as SortingMode } from "./direction-DtBAQn7p.js";
|
|
3
|
+
import { t as Table$1 } from "./table-BsNJBKiq.js";
|
|
4
4
|
import * as _$react from "react";
|
|
5
5
|
import { ComponentProps, ReactNode } from "react";
|
|
6
6
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
@@ -16,19 +16,51 @@ type DataTableProps<TData> = ComponentProps<typeof Table$1.Root> & {
|
|
|
16
16
|
table: Table<TData>;
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
19
|
+
* The root container for a data table. Wraps all other `DataTable`
|
|
20
|
+
* sub-components and provides the table context to its descendants.
|
|
21
|
+
*
|
|
22
|
+
* REQUIRED: Construct a TanStack Table instance via `useReactTable` (from
|
|
23
|
+
* `@tanstack/react-table`, also re-exported from `@ngrok/mantle/data-table`)
|
|
24
|
+
* and pass it through the `table` prop. The instance owns columns, data, and
|
|
25
|
+
* any sorting / filtering / pagination state — the wrapper components read
|
|
26
|
+
* from it.
|
|
21
27
|
*
|
|
22
28
|
* @see https://mantle.ngrok.com/components/data-table#datatableroot
|
|
23
29
|
*
|
|
24
30
|
* @example
|
|
25
31
|
* ```tsx
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
+
* import {
|
|
33
|
+
* DataTable,
|
|
34
|
+
* createColumnHelper,
|
|
35
|
+
* getCoreRowModel,
|
|
36
|
+
* useReactTable,
|
|
37
|
+
* } from "@ngrok/mantle/data-table";
|
|
38
|
+
*
|
|
39
|
+
* type Row = { id: string; name: string };
|
|
40
|
+
* const columnHelper = createColumnHelper<Row>();
|
|
41
|
+
* const columns = [
|
|
42
|
+
* columnHelper.accessor("name", {
|
|
43
|
+
* id: "name",
|
|
44
|
+
* header: () => <DataTable.Header>Name</DataTable.Header>,
|
|
45
|
+
* cell: (props) => <DataTable.Cell>{props.getValue()}</DataTable.Cell>,
|
|
46
|
+
* }),
|
|
47
|
+
* ];
|
|
48
|
+
*
|
|
49
|
+
* function MyTable({ data }: { data: Row[] }) {
|
|
50
|
+
* const table = useReactTable({ data, columns, getCoreRowModel: getCoreRowModel() });
|
|
51
|
+
* const rows = table.getRowModel().rows;
|
|
52
|
+
*
|
|
53
|
+
* return (
|
|
54
|
+
* <DataTable.Root table={table}>
|
|
55
|
+
* <DataTable.Head />
|
|
56
|
+
* <DataTable.Body>
|
|
57
|
+
* {rows.length > 0
|
|
58
|
+
* ? rows.map((row) => <DataTable.Row key={row.id} row={row} />)
|
|
59
|
+
* : <DataTable.EmptyRow>No results.</DataTable.EmptyRow>}
|
|
60
|
+
* </DataTable.Body>
|
|
61
|
+
* </DataTable.Root>
|
|
62
|
+
* );
|
|
63
|
+
* }
|
|
32
64
|
* ```
|
|
33
65
|
*/
|
|
34
66
|
declare function Root<TData>({
|
|
@@ -68,25 +100,33 @@ type DataTableHeaderSortButtonProps<TData, TValue> = Omit<ComponentProps<typeof
|
|
|
68
100
|
sortingMode: SortingMode;
|
|
69
101
|
});
|
|
70
102
|
/**
|
|
71
|
-
* A sortable button toggle for a column header in a data table.
|
|
72
|
-
*
|
|
73
|
-
*
|
|
103
|
+
* A sortable button toggle for a column header in a data table. Renders a sort
|
|
104
|
+
* icon that reflects the current direction, handles ARIA announcements, and
|
|
105
|
+
* cycles through sort states on click.
|
|
106
|
+
*
|
|
107
|
+
* Each click cycles through:
|
|
108
|
+
* - For `"alphanumeric"` sorting: `unsorted → ascending → descending → unsorted`
|
|
109
|
+
* - For `"time"` sorting: `unsorted → newest-first → oldest-first → unsorted`
|
|
110
|
+
*
|
|
111
|
+
* For right-aligned numeric columns, pass `className="justify-end"` and
|
|
112
|
+
* `iconPlacement="start"` so the sort icon stays paired with the label.
|
|
74
113
|
*
|
|
75
114
|
* @see https://mantle.ngrok.com/components/data-table#datatableheadersortbutton
|
|
76
115
|
*
|
|
77
116
|
* @example
|
|
78
117
|
* ```tsx
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
118
|
+
* columnHelper.accessor("email", {
|
|
119
|
+
* id: "email",
|
|
120
|
+
* header: (props) => (
|
|
121
|
+
* <DataTable.Header>
|
|
122
|
+
* <DataTable.HeaderSortButton column={props.column} sortingMode="alphanumeric">
|
|
123
|
+
* Email
|
|
124
|
+
* </DataTable.HeaderSortButton>
|
|
125
|
+
* </DataTable.Header>
|
|
126
|
+
* ),
|
|
127
|
+
* cell: (props) => <DataTable.Cell>{props.getValue()}</DataTable.Cell>,
|
|
128
|
+
* });
|
|
85
129
|
* ```
|
|
86
|
-
*
|
|
87
|
-
* Each click cycles through:
|
|
88
|
-
* - For alphanumeric sorting: unsorted ➡️ ascending ➡️ descending ➡️ unsorted
|
|
89
|
-
* - For time sorting: unsorted ➡️ newest-to-oldest ➡️ oldest-to-newest ➡️ unsorted
|
|
90
130
|
*/
|
|
91
131
|
declare function HeaderSortButton<TData, TValue>({
|
|
92
132
|
children,
|
|
@@ -104,18 +144,25 @@ declare namespace HeaderSortButton {
|
|
|
104
144
|
}
|
|
105
145
|
type DataTableHeaderProps = ComponentProps<typeof Table$1.Header>;
|
|
106
146
|
/**
|
|
107
|
-
* A
|
|
108
|
-
*
|
|
147
|
+
* A `<th>` optimized for header actions. Wrap each column's header content in
|
|
148
|
+
* this; for sortable columns, nest a `DataTable.HeaderSortButton` inside.
|
|
149
|
+
* Non-sortable columns can render plain text.
|
|
109
150
|
*
|
|
110
151
|
* @see https://mantle.ngrok.com/components/data-table#datatableheader
|
|
111
152
|
*
|
|
112
153
|
* @example
|
|
113
154
|
* ```tsx
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
155
|
+
* columnHelper.accessor("name", {
|
|
156
|
+
* id: "name",
|
|
157
|
+
* header: (props) => (
|
|
158
|
+
* <DataTable.Header>
|
|
159
|
+
* <DataTable.HeaderSortButton column={props.column} sortingMode="alphanumeric">
|
|
160
|
+
* Name
|
|
161
|
+
* </DataTable.HeaderSortButton>
|
|
162
|
+
* </DataTable.Header>
|
|
163
|
+
* ),
|
|
164
|
+
* cell: (props) => <DataTable.Cell>{props.getValue()}</DataTable.Cell>,
|
|
165
|
+
* });
|
|
119
166
|
* ```
|
|
120
167
|
*/
|
|
121
168
|
declare function Header({
|
|
@@ -127,6 +174,28 @@ declare namespace Header {
|
|
|
127
174
|
var displayName: string;
|
|
128
175
|
}
|
|
129
176
|
type DataTableHeadProps = Omit<ComponentProps<typeof Table$1.Head>, "children">;
|
|
177
|
+
/**
|
|
178
|
+
* The `<thead>` container that renders column headers automatically from
|
|
179
|
+
* `table.getHeaderGroups()`. Does not accept children — headers come from each
|
|
180
|
+
* column's `header` definition on the TanStack Table column config.
|
|
181
|
+
*
|
|
182
|
+
* @see https://mantle.ngrok.com/components/data-table#datatablehead
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```tsx
|
|
186
|
+
* const table = useReactTable({ data, columns, getCoreRowModel: getCoreRowModel() });
|
|
187
|
+
* const rows = table.getRowModel().rows;
|
|
188
|
+
*
|
|
189
|
+
* <DataTable.Root table={table}>
|
|
190
|
+
* <DataTable.Head />
|
|
191
|
+
* <DataTable.Body>
|
|
192
|
+
* {rows.length > 0
|
|
193
|
+
* ? rows.map((row) => <DataTable.Row key={row.id} row={row} />)
|
|
194
|
+
* : <DataTable.EmptyRow>No results.</DataTable.EmptyRow>}
|
|
195
|
+
* </DataTable.Body>
|
|
196
|
+
* </DataTable.Root>
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
130
199
|
declare function Head<TData>(props: DataTableHeadProps): _$react_jsx_runtime0.JSX.Element;
|
|
131
200
|
declare namespace Head {
|
|
132
201
|
var displayName: string;
|
|
@@ -134,7 +203,32 @@ declare namespace Head {
|
|
|
134
203
|
type DataTableRowProps<TData> = Omit<ComponentProps<typeof Table$1.Row>, "children"> & {
|
|
135
204
|
row: Row<TData>;
|
|
136
205
|
};
|
|
206
|
+
/**
|
|
207
|
+
* A single data table body row rendered from a TanStack Table row instance.
|
|
208
|
+
* Does not accept children — cells come from each column's `cell` definition.
|
|
209
|
+
*
|
|
210
|
+
* When `onClick` is provided, the row automatically receives `cursor-pointer`.
|
|
211
|
+
* Pass a different `cursor-*` class via `className` (e.g. `cursor-default`,
|
|
212
|
+
* `cursor-wait`) to override. For keyboard and screen-reader access, also
|
|
213
|
+
* render a `<Link>` inside the primary cell — a `<tr>` is not focusable.
|
|
214
|
+
*
|
|
215
|
+
* @see https://mantle.ngrok.com/components/data-table#datatablerow
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```tsx
|
|
219
|
+
* const navigate = useNavigate();
|
|
220
|
+
*
|
|
221
|
+
* {rows.map((row) => (
|
|
222
|
+
* <DataTable.Row
|
|
223
|
+
* key={row.id}
|
|
224
|
+
* row={row}
|
|
225
|
+
* onClick={() => navigate(href("/payments/:id", { id: row.original.id }))}
|
|
226
|
+
* />
|
|
227
|
+
* ))}
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
137
230
|
declare function Row$1<TData>({
|
|
231
|
+
className,
|
|
138
232
|
row,
|
|
139
233
|
...props
|
|
140
234
|
}: DataTableRowProps<TData>): _$react_jsx_runtime0.JSX.Element;
|
|
@@ -142,6 +236,29 @@ declare namespace Row$1 {
|
|
|
142
236
|
var displayName: string;
|
|
143
237
|
}
|
|
144
238
|
type DataTableEmptyRowProps = ComponentProps<typeof Table$1.Row>;
|
|
239
|
+
/**
|
|
240
|
+
* An empty-state row that spans every column. Render this as the `else` branch
|
|
241
|
+
* when `rows.length === 0` to keep the table's frame intact instead of
|
|
242
|
+
* collapsing to an empty `<tbody>`. The cell `colSpan` is computed from the
|
|
243
|
+
* TanStack Table instance via context, so no manual column count is needed.
|
|
244
|
+
*
|
|
245
|
+
* @see https://mantle.ngrok.com/components/data-table#datatableemptyrow
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```tsx
|
|
249
|
+
* const table = useReactTable({ data, columns, getCoreRowModel: getCoreRowModel() });
|
|
250
|
+
* const rows = table.getRowModel().rows;
|
|
251
|
+
*
|
|
252
|
+
* <DataTable.Root table={table}>
|
|
253
|
+
* <DataTable.Head />
|
|
254
|
+
* <DataTable.Body>
|
|
255
|
+
* {rows.length > 0
|
|
256
|
+
* ? rows.map((row) => <DataTable.Row key={row.id} row={row} />)
|
|
257
|
+
* : <DataTable.EmptyRow>No results.</DataTable.EmptyRow>}
|
|
258
|
+
* </DataTable.Body>
|
|
259
|
+
* </DataTable.Root>
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
145
262
|
declare function EmptyRow<TData>({
|
|
146
263
|
children,
|
|
147
264
|
...props
|
|
@@ -150,6 +267,29 @@ declare namespace EmptyRow {
|
|
|
150
267
|
var displayName: string;
|
|
151
268
|
}
|
|
152
269
|
type DataTableActionCellProps = ComponentProps<typeof Table$1.Cell>;
|
|
270
|
+
/**
|
|
271
|
+
* A sticky-right `<td>` for per-row action buttons (typically an `IconButton`
|
|
272
|
+
* that opens a `DropdownMenu`). Pair with `DataTable.ActionHeader`.
|
|
273
|
+
*
|
|
274
|
+
* If the row has `onClick`, pass `onClick={(event) => event.stopPropagation()}`
|
|
275
|
+
* on this cell so clicks on action controls don't bubble and fire the row
|
|
276
|
+
* handler.
|
|
277
|
+
*
|
|
278
|
+
* @see https://mantle.ngrok.com/components/data-table#datatableactioncell
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* ```tsx
|
|
282
|
+
* columnHelper.display({
|
|
283
|
+
* id: "actions",
|
|
284
|
+
* header: () => <DataTable.ActionHeader />,
|
|
285
|
+
* cell: () => (
|
|
286
|
+
* <DataTable.ActionCell onClick={(event) => event.stopPropagation()}>
|
|
287
|
+
* <DropdownMenu.Root>...</DropdownMenu.Root>
|
|
288
|
+
* </DataTable.ActionCell>
|
|
289
|
+
* ),
|
|
290
|
+
* });
|
|
291
|
+
* ```
|
|
292
|
+
*/
|
|
153
293
|
declare function ActionCell({
|
|
154
294
|
children,
|
|
155
295
|
className,
|
|
@@ -184,8 +324,17 @@ declare namespace ActionHeader {
|
|
|
184
324
|
var displayName: string;
|
|
185
325
|
}
|
|
186
326
|
/**
|
|
187
|
-
*
|
|
188
|
-
*
|
|
327
|
+
* Use `DataTable` for INTERACTIVE tabular data — sorting, filtering, pagination,
|
|
328
|
+
* row selection, and server-side or client-side data. Built on TanStack Table;
|
|
329
|
+
* the consumer MUST construct a `useReactTable` instance from
|
|
330
|
+
* `@tanstack/react-table` and pass it to `DataTable.Root` via the `table` prop.
|
|
331
|
+
* Every TanStack utility (`createColumnHelper`, `getCoreRowModel`,
|
|
332
|
+
* `getSortedRowModel`, `getPaginationRowModel`, `getFilteredRowModel`,
|
|
333
|
+
* `useReactTable`, …) is re-exported from `@ngrok/mantle/data-table` so a single
|
|
334
|
+
* import covers both the wrapper components and the TanStack helpers.
|
|
335
|
+
*
|
|
336
|
+
* For STATIC, layout-driven tables (read-only data dumps, simple key/value
|
|
337
|
+
* displays, plain markup tables with no interactivity), use `Table` instead.
|
|
189
338
|
*
|
|
190
339
|
* @see https://mantle.ngrok.com/components/data-table
|
|
191
340
|
*
|
|
@@ -206,49 +355,304 @@ declare namespace ActionHeader {
|
|
|
206
355
|
* ```
|
|
207
356
|
*
|
|
208
357
|
* @example
|
|
358
|
+
* Minimal — read-only table with a single sortable column:
|
|
209
359
|
* ```tsx
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
360
|
+
* import {
|
|
361
|
+
* DataTable,
|
|
362
|
+
* createColumnHelper,
|
|
363
|
+
* getCoreRowModel,
|
|
364
|
+
* useReactTable,
|
|
365
|
+
* } from "@ngrok/mantle/data-table";
|
|
366
|
+
*
|
|
367
|
+
* type Row = { id: string; name: string };
|
|
368
|
+
*
|
|
369
|
+
* const columnHelper = createColumnHelper<Row>();
|
|
370
|
+
* const columns = [
|
|
371
|
+
* columnHelper.accessor("name", {
|
|
372
|
+
* id: "name",
|
|
373
|
+
* header: (props) => (
|
|
374
|
+
* <DataTable.Header>
|
|
375
|
+
* <DataTable.HeaderSortButton column={props.column} sortingMode="alphanumeric">
|
|
376
|
+
* Name
|
|
377
|
+
* </DataTable.HeaderSortButton>
|
|
378
|
+
* </DataTable.Header>
|
|
379
|
+
* ),
|
|
380
|
+
* cell: (props) => <DataTable.Cell>{props.getValue()}</DataTable.Cell>,
|
|
381
|
+
* }),
|
|
382
|
+
* ];
|
|
383
|
+
*
|
|
384
|
+
* function MyTable({ data }: { data: Row[] }) {
|
|
385
|
+
* const table = useReactTable({ data, columns, getCoreRowModel: getCoreRowModel() });
|
|
386
|
+
* const rows = table.getRowModel().rows;
|
|
387
|
+
*
|
|
388
|
+
* return (
|
|
389
|
+
* <DataTable.Root table={table}>
|
|
390
|
+
* <DataTable.Head />
|
|
391
|
+
* <DataTable.Body>
|
|
392
|
+
* {rows.length > 0
|
|
393
|
+
* ? rows.map((row) => <DataTable.Row key={row.id} row={row} />)
|
|
394
|
+
* : <DataTable.EmptyRow>No results.</DataTable.EmptyRow>}
|
|
395
|
+
* </DataTable.Body>
|
|
396
|
+
* </DataTable.Root>
|
|
397
|
+
* );
|
|
398
|
+
* }
|
|
399
|
+
* ```
|
|
400
|
+
*
|
|
401
|
+
* @example
|
|
402
|
+
* Sortable + filterable + paginated — with a global text filter and page controls:
|
|
403
|
+
* ```tsx
|
|
404
|
+
* import {
|
|
405
|
+
* DataTable,
|
|
406
|
+
* createColumnHelper,
|
|
407
|
+
* getCoreRowModel,
|
|
408
|
+
* getFilteredRowModel,
|
|
409
|
+
* getPaginationRowModel,
|
|
410
|
+
* getSortedRowModel,
|
|
411
|
+
* useReactTable,
|
|
412
|
+
* } from "@ngrok/mantle/data-table";
|
|
413
|
+
* import { Button } from "@ngrok/mantle/button";
|
|
414
|
+
* import { Input } from "@ngrok/mantle/input";
|
|
415
|
+
* import { useState } from "react";
|
|
416
|
+
*
|
|
417
|
+
* type Payment = { id: string; amount: number; status: "pending" | "succeeded" | "failed"; email: string };
|
|
418
|
+
*
|
|
419
|
+
* const columnHelper = createColumnHelper<Payment>();
|
|
420
|
+
* const columns = [
|
|
421
|
+
* columnHelper.accessor("status", {
|
|
422
|
+
* id: "status",
|
|
423
|
+
* header: (props) => (
|
|
424
|
+
* <DataTable.Header>
|
|
425
|
+
* <DataTable.HeaderSortButton column={props.column} sortingMode="alphanumeric">
|
|
426
|
+
* Status
|
|
427
|
+
* </DataTable.HeaderSortButton>
|
|
428
|
+
* </DataTable.Header>
|
|
429
|
+
* ),
|
|
430
|
+
* cell: (props) => <DataTable.Cell>{props.getValue()}</DataTable.Cell>,
|
|
431
|
+
* }),
|
|
432
|
+
* columnHelper.accessor("email", {
|
|
433
|
+
* id: "email",
|
|
434
|
+
* header: (props) => (
|
|
435
|
+
* <DataTable.Header>
|
|
436
|
+
* <DataTable.HeaderSortButton column={props.column} sortingMode="alphanumeric">
|
|
437
|
+
* Email
|
|
438
|
+
* </DataTable.HeaderSortButton>
|
|
439
|
+
* </DataTable.Header>
|
|
440
|
+
* ),
|
|
441
|
+
* cell: (props) => <DataTable.Cell>{props.getValue()}</DataTable.Cell>,
|
|
442
|
+
* }),
|
|
443
|
+
* columnHelper.accessor("amount", {
|
|
444
|
+
* id: "amount",
|
|
445
|
+
* header: (props) => (
|
|
446
|
+
* <DataTable.Header className="text-right">
|
|
447
|
+
* <DataTable.HeaderSortButton
|
|
448
|
+
* column={props.column}
|
|
449
|
+
* sortingMode="alphanumeric"
|
|
450
|
+
* className="justify-end"
|
|
451
|
+
* iconPlacement="start"
|
|
452
|
+
* >
|
|
453
|
+
* Amount
|
|
454
|
+
* </DataTable.HeaderSortButton>
|
|
455
|
+
* </DataTable.Header>
|
|
456
|
+
* ),
|
|
457
|
+
* cell: (props) => (
|
|
458
|
+
* <DataTable.Cell className="text-right tabular-nums">
|
|
459
|
+
* {new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(props.getValue())}
|
|
460
|
+
* </DataTable.Cell>
|
|
461
|
+
* ),
|
|
462
|
+
* }),
|
|
463
|
+
* ];
|
|
464
|
+
*
|
|
465
|
+
* function PaymentsTable({ data }: { data: Payment[] }) {
|
|
466
|
+
* const [globalFilter, setGlobalFilter] = useState("");
|
|
467
|
+
*
|
|
468
|
+
* const table = useReactTable({
|
|
469
|
+
* data,
|
|
470
|
+
* columns,
|
|
471
|
+
* state: { globalFilter },
|
|
472
|
+
* onGlobalFilterChange: setGlobalFilter,
|
|
473
|
+
* getCoreRowModel: getCoreRowModel(),
|
|
474
|
+
* getSortedRowModel: getSortedRowModel(),
|
|
475
|
+
* getFilteredRowModel: getFilteredRowModel(),
|
|
476
|
+
* getPaginationRowModel: getPaginationRowModel(),
|
|
477
|
+
* });
|
|
478
|
+
* const rows = table.getRowModel().rows;
|
|
479
|
+
*
|
|
480
|
+
* return (
|
|
481
|
+
* <div className="space-y-4">
|
|
482
|
+
* <Input
|
|
483
|
+
* placeholder="Filter payments…"
|
|
484
|
+
* value={globalFilter}
|
|
485
|
+
* onChange={(event) => setGlobalFilter(event.target.value)}
|
|
486
|
+
* />
|
|
487
|
+
* <DataTable.Root table={table}>
|
|
488
|
+
* <DataTable.Head />
|
|
489
|
+
* <DataTable.Body>
|
|
490
|
+
* {rows.length > 0
|
|
491
|
+
* ? rows.map((row) => <DataTable.Row key={row.id} row={row} />)
|
|
492
|
+
* : <DataTable.EmptyRow>No payments match.</DataTable.EmptyRow>}
|
|
493
|
+
* </DataTable.Body>
|
|
494
|
+
* </DataTable.Root>
|
|
495
|
+
* <div className="flex items-center justify-between gap-2">
|
|
496
|
+
* <span className="text-sm text-muted">
|
|
497
|
+
* Page {table.getState().pagination.pageIndex + 1} of {table.getPageCount()}
|
|
498
|
+
* </span>
|
|
499
|
+
* <div className="flex gap-2">
|
|
500
|
+
* <Button
|
|
501
|
+
* type="button"
|
|
502
|
+
* priority="neutral"
|
|
503
|
+
* onClick={() => table.previousPage()}
|
|
504
|
+
* disabled={!table.getCanPreviousPage()}
|
|
505
|
+
* >
|
|
506
|
+
* Previous
|
|
507
|
+
* </Button>
|
|
508
|
+
* <Button
|
|
509
|
+
* type="button"
|
|
510
|
+
* priority="neutral"
|
|
511
|
+
* onClick={() => table.nextPage()}
|
|
512
|
+
* disabled={!table.getCanNextPage()}
|
|
513
|
+
* >
|
|
514
|
+
* Next
|
|
515
|
+
* </Button>
|
|
516
|
+
* </div>
|
|
517
|
+
* </div>
|
|
518
|
+
* </div>
|
|
519
|
+
* );
|
|
520
|
+
* }
|
|
521
|
+
* ```
|
|
522
|
+
*
|
|
523
|
+
* @example
|
|
524
|
+
* Row action column — a sticky right-edge cell with a dropdown menu of actions.
|
|
525
|
+
* If the row also has `onClick`, stop propagation on the action cell so clicks
|
|
526
|
+
* don't bubble up and fire the row handler:
|
|
527
|
+
* ```tsx
|
|
528
|
+
* import { DataTable, createColumnHelper } from "@ngrok/mantle/data-table";
|
|
529
|
+
* import { DropdownMenu } from "@ngrok/mantle/dropdown-menu";
|
|
530
|
+
* import { IconButton } from "@ngrok/mantle/icon-button";
|
|
531
|
+
* import { DotsThreeVerticalIcon } from "@phosphor-icons/react/DotsThreeVertical";
|
|
532
|
+
*
|
|
533
|
+
* const columnHelper = createColumnHelper<Payment>();
|
|
534
|
+
*
|
|
535
|
+
* const columns = [
|
|
536
|
+
* // …other columns…
|
|
537
|
+
* columnHelper.display({
|
|
538
|
+
* id: "actions",
|
|
539
|
+
* header: () => <DataTable.ActionHeader />,
|
|
540
|
+
* cell: (props) => (
|
|
541
|
+
* <DataTable.ActionCell onClick={(event) => event.stopPropagation()}>
|
|
542
|
+
* <DropdownMenu.Root>
|
|
543
|
+
* <DropdownMenu.Trigger asChild>
|
|
544
|
+
* <IconButton type="button" label="Actions" icon={<DotsThreeVerticalIcon />} />
|
|
545
|
+
* </DropdownMenu.Trigger>
|
|
546
|
+
* <DropdownMenu.Content align="end">
|
|
547
|
+
* <DropdownMenu.Item onSelect={() => copy(props.row.original.id)}>
|
|
548
|
+
* Copy ID
|
|
549
|
+
* </DropdownMenu.Item>
|
|
550
|
+
* <DropdownMenu.Item onSelect={() => refund(props.row.original.id)}>
|
|
551
|
+
* Refund
|
|
552
|
+
* </DropdownMenu.Item>
|
|
553
|
+
* </DropdownMenu.Content>
|
|
554
|
+
* </DropdownMenu.Root>
|
|
555
|
+
* </DataTable.ActionCell>
|
|
556
|
+
* ),
|
|
557
|
+
* }),
|
|
558
|
+
* ];
|
|
559
|
+
* ```
|
|
560
|
+
*
|
|
561
|
+
* @example
|
|
562
|
+
* Clickable row navigating to a detail page — also render a `<Link>` inside the
|
|
563
|
+
* primary cell so the row is reachable by keyboard and screen readers (a `<tr>`
|
|
564
|
+
* is not focusable):
|
|
565
|
+
* ```tsx
|
|
566
|
+
* import { DataTable } from "@ngrok/mantle/data-table";
|
|
567
|
+
* import { Link, href, useNavigate } from "react-router";
|
|
568
|
+
*
|
|
569
|
+
* function PaymentsTable({ data }: { data: Payment[] }) {
|
|
570
|
+
* const navigate = useNavigate();
|
|
571
|
+
* const table = useReactTable({ data, columns, getCoreRowModel: getCoreRowModel() });
|
|
572
|
+
* const rows = table.getRowModel().rows;
|
|
573
|
+
*
|
|
574
|
+
* return (
|
|
575
|
+
* <DataTable.Root table={table}>
|
|
576
|
+
* <DataTable.Head />
|
|
577
|
+
* <DataTable.Body>
|
|
578
|
+
* {rows.map((row) => (
|
|
579
|
+
* <DataTable.Row
|
|
580
|
+
* key={row.id}
|
|
581
|
+
* row={row}
|
|
582
|
+
* onClick={() => navigate(href("/payments/:id", { id: row.original.id }))}
|
|
583
|
+
* />
|
|
584
|
+
* ))}
|
|
585
|
+
* </DataTable.Body>
|
|
586
|
+
* </DataTable.Root>
|
|
587
|
+
* );
|
|
588
|
+
* }
|
|
589
|
+
*
|
|
590
|
+
* // The primary column's cell renders a <Link> for keyboard / a11y reachability.
|
|
591
|
+
* columnHelper.accessor("email", {
|
|
592
|
+
* id: "email",
|
|
593
|
+
* header: (props) => <DataTable.Header>Email</DataTable.Header>,
|
|
594
|
+
* cell: (props) => (
|
|
595
|
+
* <DataTable.Cell>
|
|
596
|
+
* <Link to={href("/payments/:id", { id: props.row.original.id })}>
|
|
597
|
+
* {props.getValue()}
|
|
598
|
+
* </Link>
|
|
599
|
+
* </DataTable.Cell>
|
|
600
|
+
* ),
|
|
601
|
+
* });
|
|
216
602
|
* ```
|
|
217
603
|
*/
|
|
218
604
|
declare const DataTable: {
|
|
219
605
|
/**
|
|
220
|
-
* The root container of the data table component.
|
|
606
|
+
* The root container of the data table component. REQUIRED: pass a
|
|
607
|
+
* `useReactTable` instance (from `@tanstack/react-table`, also re-exported
|
|
608
|
+
* from `@ngrok/mantle/data-table`) via the `table` prop — every other
|
|
609
|
+
* `DataTable.*` part reads from it through context.
|
|
221
610
|
*
|
|
222
611
|
* @see https://mantle.ngrok.com/components/data-table#datatableroot
|
|
223
612
|
*
|
|
224
613
|
* @example
|
|
225
614
|
* ```tsx
|
|
615
|
+
* const table = useReactTable({ data, columns, getCoreRowModel: getCoreRowModel() });
|
|
616
|
+
* const rows = table.getRowModel().rows;
|
|
617
|
+
*
|
|
226
618
|
* <DataTable.Root table={table}>
|
|
227
619
|
* <DataTable.Head />
|
|
228
620
|
* <DataTable.Body>
|
|
229
|
-
*
|
|
621
|
+
* {rows.length > 0
|
|
622
|
+
* ? rows.map((row) => <DataTable.Row key={row.id} row={row} />)
|
|
623
|
+
* : <DataTable.EmptyRow>No results.</DataTable.EmptyRow>}
|
|
230
624
|
* </DataTable.Body>
|
|
231
625
|
* </DataTable.Root>
|
|
232
626
|
* ```
|
|
233
627
|
*/
|
|
234
628
|
readonly Root: typeof Root;
|
|
235
629
|
/**
|
|
236
|
-
* A sticky action cell positioned at the end of each row
|
|
630
|
+
* A sticky action cell positioned at the end of each row, typically holding
|
|
631
|
+
* an `IconButton` that opens a `DropdownMenu`. Pair with `DataTable.ActionHeader`.
|
|
632
|
+
*
|
|
633
|
+
* If the row has `onClick`, stop propagation on this cell so clicks on action
|
|
634
|
+
* controls don't bubble up and fire the row handler.
|
|
237
635
|
*
|
|
238
636
|
* @see https://mantle.ngrok.com/components/data-table#datatableactioncell
|
|
239
637
|
*
|
|
240
638
|
* @example
|
|
241
639
|
* ```tsx
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
* <
|
|
245
|
-
*
|
|
640
|
+
* columnHelper.display({
|
|
641
|
+
* id: "actions",
|
|
642
|
+
* header: () => <DataTable.ActionHeader />,
|
|
643
|
+
* cell: () => (
|
|
644
|
+
* <DataTable.ActionCell onClick={(event) => event.stopPropagation()}>
|
|
645
|
+
* <DropdownMenu.Root>...</DropdownMenu.Root>
|
|
646
|
+
* </DataTable.ActionCell>
|
|
647
|
+
* ),
|
|
648
|
+
* });
|
|
246
649
|
* ```
|
|
247
650
|
*/
|
|
248
651
|
readonly ActionCell: typeof ActionCell;
|
|
249
652
|
/**
|
|
250
653
|
* A sticky header cell that pairs with `DataTable.ActionCell`, keeping the
|
|
251
654
|
* action column aligned across the header and body when scrolling horizontally.
|
|
655
|
+
* Use as the `header` for a `columnHelper.display` action column.
|
|
252
656
|
*
|
|
253
657
|
* @see https://mantle.ngrok.com/components/data-table#datatableactionheader
|
|
254
658
|
*
|
|
@@ -257,100 +661,151 @@ declare const DataTable: {
|
|
|
257
661
|
* columnHelper.display({
|
|
258
662
|
* id: "actions",
|
|
259
663
|
* header: () => <DataTable.ActionHeader />,
|
|
260
|
-
* cell: () =>
|
|
261
|
-
* }
|
|
664
|
+
* cell: () => (
|
|
665
|
+
* <DataTable.ActionCell onClick={(event) => event.stopPropagation()}>
|
|
666
|
+
* <DropdownMenu.Root>...</DropdownMenu.Root>
|
|
667
|
+
* </DataTable.ActionCell>
|
|
668
|
+
* ),
|
|
669
|
+
* });
|
|
262
670
|
* ```
|
|
263
671
|
*/
|
|
264
672
|
readonly ActionHeader: typeof ActionHeader;
|
|
265
673
|
/**
|
|
266
|
-
* A
|
|
674
|
+
* A `<td>` for rendering an individual data cell. Re-exported from
|
|
675
|
+
* `Table.Cell`. Every cell rendered by a column's `cell` function should
|
|
676
|
+
* be wrapped in this — a raw `<td>` skips mantle typography and padding.
|
|
267
677
|
*
|
|
268
678
|
* @see https://mantle.ngrok.com/components/data-table#datatablecell
|
|
269
679
|
*
|
|
270
680
|
* @example
|
|
271
681
|
* ```tsx
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
* </DataTable.
|
|
682
|
+
* columnHelper.accessor("name", {
|
|
683
|
+
* id: "name",
|
|
684
|
+
* header: (props) => <DataTable.Header>Name</DataTable.Header>,
|
|
685
|
+
* cell: (props) => <DataTable.Cell>{props.getValue()}</DataTable.Cell>,
|
|
686
|
+
* });
|
|
275
687
|
* ```
|
|
276
688
|
*/
|
|
277
689
|
readonly Cell: _$react.ForwardRefExoticComponent<Omit<_$react.DetailedHTMLProps<_$react.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, "ref"> & _$react.RefAttributes<HTMLTableDataCellElement>>;
|
|
278
690
|
/**
|
|
279
|
-
* The
|
|
691
|
+
* The `<tbody>` container for rows of data. Typically wraps a map of
|
|
692
|
+
* `DataTable.Row`, with a `DataTable.EmptyRow` fallback when there is
|
|
693
|
+
* no data.
|
|
280
694
|
*
|
|
281
695
|
* @see https://mantle.ngrok.com/components/data-table#datatablebody
|
|
282
696
|
*
|
|
283
697
|
* @example
|
|
284
698
|
* ```tsx
|
|
285
699
|
* <DataTable.Body>
|
|
286
|
-
*
|
|
700
|
+
* {rows.length > 0
|
|
701
|
+
* ? rows.map((row) => <DataTable.Row key={row.id} row={row} />)
|
|
702
|
+
* : <DataTable.EmptyRow>No results.</DataTable.EmptyRow>}
|
|
287
703
|
* </DataTable.Body>
|
|
288
704
|
* ```
|
|
289
705
|
*/
|
|
290
706
|
readonly Body: _$react.ForwardRefExoticComponent<Omit<Omit<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & _$react.RefAttributes<HTMLTableSectionElement>, "ref"> & _$react.RefAttributes<HTMLTableSectionElement>>;
|
|
291
707
|
/**
|
|
292
|
-
* An empty
|
|
708
|
+
* An empty-state row that spans every column. Render this as the `else`
|
|
709
|
+
* branch when `rows.length === 0` to keep the table's frame intact instead
|
|
710
|
+
* of collapsing to an empty `<tbody>`.
|
|
293
711
|
*
|
|
294
712
|
* @see https://mantle.ngrok.com/components/data-table#datatableemptyrow
|
|
295
713
|
*
|
|
296
714
|
* @example
|
|
297
715
|
* ```tsx
|
|
298
|
-
* <DataTable.
|
|
299
|
-
*
|
|
300
|
-
*
|
|
716
|
+
* <DataTable.Body>
|
|
717
|
+
* {rows.length > 0
|
|
718
|
+
* ? rows.map((row) => <DataTable.Row key={row.id} row={row} />)
|
|
719
|
+
* : <DataTable.EmptyRow>No results.</DataTable.EmptyRow>}
|
|
720
|
+
* </DataTable.Body>
|
|
301
721
|
* ```
|
|
302
722
|
*/
|
|
303
723
|
readonly EmptyRow: typeof EmptyRow;
|
|
304
724
|
/**
|
|
305
|
-
* The
|
|
725
|
+
* The `<thead>` container that renders column headers automatically from
|
|
726
|
+
* `table.getHeaderGroups()`. Does not accept children — headers come from
|
|
727
|
+
* each column's `header` definition.
|
|
306
728
|
*
|
|
307
729
|
* @see https://mantle.ngrok.com/components/data-table#datatablehead
|
|
308
730
|
*
|
|
309
731
|
* @example
|
|
310
732
|
* ```tsx
|
|
311
|
-
* <DataTable.
|
|
733
|
+
* <DataTable.Root table={table}>
|
|
734
|
+
* <DataTable.Head />
|
|
735
|
+
* <DataTable.Body>...</DataTable.Body>
|
|
736
|
+
* </DataTable.Root>
|
|
312
737
|
* ```
|
|
313
738
|
*/
|
|
314
739
|
readonly Head: typeof Head;
|
|
315
740
|
/**
|
|
316
|
-
* A
|
|
741
|
+
* A `<th>` optimized for header actions. Wrap each column's header content
|
|
742
|
+
* in this; for sortable columns, nest a `DataTable.HeaderSortButton` inside.
|
|
317
743
|
*
|
|
318
744
|
* @see https://mantle.ngrok.com/components/data-table#datatableheader
|
|
319
745
|
*
|
|
320
746
|
* @example
|
|
321
747
|
* ```tsx
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
748
|
+
* columnHelper.accessor("name", {
|
|
749
|
+
* id: "name",
|
|
750
|
+
* header: (props) => (
|
|
751
|
+
* <DataTable.Header>
|
|
752
|
+
* <DataTable.HeaderSortButton column={props.column} sortingMode="alphanumeric">
|
|
753
|
+
* Name
|
|
754
|
+
* </DataTable.HeaderSortButton>
|
|
755
|
+
* </DataTable.Header>
|
|
756
|
+
* ),
|
|
757
|
+
* cell: (props) => <DataTable.Cell>{props.getValue()}</DataTable.Cell>,
|
|
758
|
+
* });
|
|
327
759
|
* ```
|
|
328
760
|
*/
|
|
329
761
|
readonly Header: typeof Header;
|
|
330
762
|
/**
|
|
331
|
-
* A sortable button toggle for column
|
|
763
|
+
* A sortable button toggle for a column header. Clicks cycle through
|
|
764
|
+
* sort directions: for `"alphanumeric"`, `unsorted → asc → desc → unsorted`;
|
|
765
|
+
* for `"time"`, `unsorted → desc (newest-first) → asc → unsorted`.
|
|
766
|
+
*
|
|
767
|
+
* Pass `className="justify-end"` and `iconPlacement="start"` for
|
|
768
|
+
* right-aligned numeric columns so the sort icon stays paired with the label.
|
|
332
769
|
*
|
|
333
770
|
* @see https://mantle.ngrok.com/components/data-table#datatableheadersortbutton
|
|
334
771
|
*
|
|
335
772
|
* @example
|
|
336
773
|
* ```tsx
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
*
|
|
774
|
+
* columnHelper.accessor("email", {
|
|
775
|
+
* id: "email",
|
|
776
|
+
* header: (props) => (
|
|
777
|
+
* <DataTable.Header>
|
|
778
|
+
* <DataTable.HeaderSortButton column={props.column} sortingMode="alphanumeric">
|
|
779
|
+
* Email
|
|
780
|
+
* </DataTable.HeaderSortButton>
|
|
781
|
+
* </DataTable.Header>
|
|
782
|
+
* ),
|
|
783
|
+
* cell: (props) => <DataTable.Cell>{props.getValue()}</DataTable.Cell>,
|
|
784
|
+
* });
|
|
343
785
|
* ```
|
|
344
786
|
*/
|
|
345
787
|
readonly HeaderSortButton: typeof HeaderSortButton;
|
|
346
788
|
/**
|
|
347
|
-
* A single data table row
|
|
789
|
+
* A single data table body row rendered from a TanStack Table row instance.
|
|
790
|
+
* Does not accept children — cells come from each column's `cell` definition.
|
|
791
|
+
*
|
|
792
|
+
* When `onClick` is provided, the row automatically receives `cursor-pointer`.
|
|
793
|
+
* Pass a different `cursor-*` class via `className` to override. For keyboard
|
|
794
|
+
* and screen-reader access, also render a `<Link>` inside the primary cell.
|
|
348
795
|
*
|
|
349
796
|
* @see https://mantle.ngrok.com/components/data-table#datatablerow
|
|
350
797
|
*
|
|
351
798
|
* @example
|
|
352
799
|
* ```tsx
|
|
353
|
-
*
|
|
800
|
+
* const navigate = useNavigate();
|
|
801
|
+
*
|
|
802
|
+
* {rows.map((row) => (
|
|
803
|
+
* <DataTable.Row
|
|
804
|
+
* key={row.id}
|
|
805
|
+
* row={row}
|
|
806
|
+
* onClick={() => navigate(href("/payments/:id", { id: row.original.id }))}
|
|
807
|
+
* />
|
|
808
|
+
* ))}
|
|
354
809
|
* ```
|
|
355
810
|
*/
|
|
356
811
|
readonly Row: typeof Row$1;
|