@ngrok/mantle 0.70.1 → 0.70.2

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.
Files changed (122) hide show
  1. package/dist/accordion.d.ts +1 -1
  2. package/dist/alert-dialog.d.ts +4 -4
  3. package/dist/alert.d.ts +3 -3
  4. package/dist/anchor.d.ts +1 -1
  5. package/dist/{as-child-CJ2vTesV.d.ts → as-child-DQHfEmYB.d.ts} +1 -1
  6. package/dist/badge.d.ts +2 -2
  7. package/dist/{button-DDK6nEac.d.ts → button-BMgAxAwM.d.ts} +3 -3
  8. package/dist/button.d.ts +3 -3
  9. package/dist/card.d.ts +1 -1
  10. package/dist/checkbox.d.ts +2 -2
  11. package/dist/checkbox.js +1 -1
  12. package/dist/code-block.d.ts +3 -3
  13. package/dist/code-block.js +1 -1
  14. package/dist/code-block.js.map +1 -1
  15. package/dist/code-block_highlight-utils.d.ts +1 -1
  16. package/dist/code-block_highlight-utils.js +1 -1
  17. package/dist/code.d.ts +1 -1
  18. package/dist/color.d.ts +1 -1
  19. package/dist/combobox.d.ts +2 -2
  20. package/dist/combobox.js +1 -1
  21. package/dist/command.d.ts +3 -3
  22. package/dist/command.js +1 -1
  23. package/dist/compose-refs-DZ3cPi47.js +2 -0
  24. package/dist/compose-refs-DZ3cPi47.js.map +1 -0
  25. package/dist/copy-to-clipboard-DjOD_Mwb.js +2 -0
  26. package/dist/copy-to-clipboard-DjOD_Mwb.js.map +1 -0
  27. package/dist/data-table.d.ts +245 -71
  28. package/dist/data-table.js +1 -1
  29. package/dist/data-table.js.map +1 -1
  30. package/dist/{deep-non-nullable-DwBZzk4x.d.ts → deep-non-nullable-VFm1T3JZ.d.ts} +1 -1
  31. package/dist/description-list.d.ts +1 -1
  32. package/dist/{dialog-MiS_Q-ge.js → dialog-BHzl9eye.js} +1 -1
  33. package/dist/{dialog-MiS_Q-ge.js.map → dialog-BHzl9eye.js.map} +1 -1
  34. package/dist/dialog.d.ts +2 -2
  35. package/dist/dialog.js +1 -1
  36. package/dist/{direction-ClCocWIf.js → direction-DsB-pD9V.js} +1 -1
  37. package/dist/{direction-ClCocWIf.js.map → direction-DsB-pD9V.js.map} +1 -1
  38. package/dist/{direction-Jk7BkzGo.d.ts → direction-DtBAQn7p.d.ts} +1 -1
  39. package/dist/{dropdown-menu-C9f9Y8Ov.d.ts → dropdown-menu-CzUNYIfA.d.ts} +2 -2
  40. package/dist/{dropdown-menu-Ff97BIJe.js → dropdown-menu-Ducs2SEn.js} +2 -2
  41. package/dist/{dropdown-menu-Ff97BIJe.js.map → dropdown-menu-Ducs2SEn.js.map} +1 -1
  42. package/dist/dropdown-menu.d.ts +1 -1
  43. package/dist/dropdown-menu.js +1 -1
  44. package/dist/empty.d.ts +2 -2
  45. package/dist/hooks.d.ts +5 -6
  46. package/dist/hooks.js +1 -1
  47. package/dist/{icon-C0YAAaLZ.d.ts → icon-DKMJm20j.d.ts} +2 -2
  48. package/dist/{icon-button-Cl30yTfu.d.ts → icon-button-BnK4K7YK.d.ts} +3 -3
  49. package/dist/icon.d.ts +3 -3
  50. package/dist/icons.d.ts +3 -3
  51. package/dist/icons.js +1 -1
  52. package/dist/{in-view-DsiWfQpY.d.ts → in-view-Da08Bx6l.d.ts} +15 -4
  53. package/dist/{in-view-BXzPPdcl.js → in-view-pia_SVdE.js} +1 -1
  54. package/dist/{in-view-BXzPPdcl.js.map → in-view-pia_SVdE.js.map} +1 -1
  55. package/dist/{index-ddHz7L9f.d.ts → index-DMAkXvFI.d.ts} +2 -2
  56. package/dist/{index-DU3SQJ46.d.ts → index-DOJUH34Z.d.ts} +4 -4
  57. package/dist/{index-B6SPk_xb.d.ts → index-DkMUaYsw.d.ts} +1 -1
  58. package/dist/{index-vOSpS5jv.d.ts → index-rtz7SwEq.d.ts} +1 -1
  59. package/dist/input.d.ts +2 -2
  60. package/dist/input.js +1 -1
  61. package/dist/{is-input-Bh1rQhX3.js → is-input-CUEWaxtA.js} +1 -1
  62. package/dist/{is-input-Bh1rQhX3.js.map → is-input-CUEWaxtA.js.map} +1 -1
  63. package/dist/{kbd-B0wWeV_0.js → kbd-CAVUiqBT.js} +1 -1
  64. package/dist/{kbd-B0wWeV_0.js.map → kbd-CAVUiqBT.js.map} +1 -1
  65. package/dist/kbd.js +1 -1
  66. package/dist/media-object.d.ts +1 -1
  67. package/dist/multi-select.d.ts +2 -2
  68. package/dist/multi-select.js +1 -1
  69. package/dist/pagination.d.ts +3 -3
  70. package/dist/pagination.js +1 -1
  71. package/dist/{primitive-DXo0gUqw.d.ts → primitive-tyw4V7Vf.d.ts} +1 -1
  72. package/dist/radio-group.d.ts +1 -1
  73. package/dist/radio-group.js +1 -1
  74. package/dist/{resolve-pre-rendered-props-BXv6e6fc.js → resolve-pre-rendered-props-C-kiaLHj.js} +1 -1
  75. package/dist/{resolve-pre-rendered-props-BXv6e6fc.js.map → resolve-pre-rendered-props-C-kiaLHj.js.map} +1 -1
  76. package/dist/{resolve-pre-rendered-props-kcQrtWPt.d.ts → resolve-pre-rendered-props-x-52gvQ1.d.ts} +2 -2
  77. package/dist/sandboxed-on-click.d.ts +1 -1
  78. package/dist/{select-DNJli9JO.d.ts → select-BjpP51vO.d.ts} +3 -3
  79. package/dist/{select-LJmfG--I.js → select-DOgdZO0Q.js} +2 -2
  80. package/dist/{select-LJmfG--I.js.map → select-DOgdZO0Q.js.map} +1 -1
  81. package/dist/select.d.ts +1 -1
  82. package/dist/select.js +1 -1
  83. package/dist/{separator-DyOGgFCs.js → separator-DSOIrnhj.js} +1 -1
  84. package/dist/{separator-DyOGgFCs.js.map → separator-DSOIrnhj.js.map} +1 -1
  85. package/dist/separator.d.ts +1 -1
  86. package/dist/separator.js +1 -1
  87. package/dist/sheet.d.ts +2 -2
  88. package/dist/{sort-C_Jbs1dH.js → sort-DzCsa6Qj.js} +2 -2
  89. package/dist/{sort-C_Jbs1dH.js.map → sort-DzCsa6Qj.js.map} +1 -1
  90. package/dist/split-button.d.ts +3 -3
  91. package/dist/split-button.js +1 -1
  92. package/dist/{svg-only-BnnbLx6R.d.ts → svg-only-BtBvFy-N.d.ts} +2 -2
  93. package/dist/{table-4q1UxE7L.d.ts → table--DsTqaWO.d.ts} +1 -1
  94. package/dist/{table-12T25gGa.js → table-Cl4nlRMR.js} +2 -2
  95. package/dist/{table-12T25gGa.js.map → table-Cl4nlRMR.js.map} +1 -1
  96. package/dist/table.d.ts +1 -1
  97. package/dist/table.js +1 -1
  98. package/dist/tabs.js +1 -1
  99. package/dist/text-area.d.ts +1 -1
  100. package/dist/text-area.js +1 -1
  101. package/dist/theme.d.ts +1 -1
  102. package/dist/{themes-DXb8Tk74.d.ts → themes-DIEYkvNl.d.ts} +1 -1
  103. package/dist/toast.d.ts +3 -3
  104. package/dist/{traffic-policy-file-ChsoQtXQ.js → traffic-policy-file-C6LHYrIU.js} +1 -1
  105. package/dist/{traffic-policy-file-ChsoQtXQ.js.map → traffic-policy-file-C6LHYrIU.js.map} +1 -1
  106. package/dist/{types-BeTbgoJd.d.ts → types-DG0WQLTL.d.ts} +1 -1
  107. package/dist/{types-DEYyl5LX.d.ts → types-DoV0R5Ja.d.ts} +1 -1
  108. package/dist/types.d.ts +5 -5
  109. package/dist/use-copy-to-clipboard-C7vsjJe-.js +2 -0
  110. package/dist/use-copy-to-clipboard-C7vsjJe-.js.map +1 -0
  111. package/dist/{use-prefers-reduced-motion-BcwST13S.js → use-prefers-reduced-motion-aXfsyo-k.js} +1 -1
  112. package/dist/{use-prefers-reduced-motion-BcwST13S.js.map → use-prefers-reduced-motion-aXfsyo-k.js.map} +1 -1
  113. package/dist/utils.d.ts +3 -3
  114. package/dist/utils.js +1 -1
  115. package/dist/utils.js.map +1 -1
  116. package/dist/{variant-props-DszdagRm.d.ts → variant-props-DUmSIQK8.d.ts} +2 -2
  117. package/dist/{with-style-props-Dlz3G1tS.d.ts → with-style-props-3iFrBR08.d.ts} +1 -1
  118. package/package.json +1 -1
  119. package/dist/compose-refs-DFIaEnQH.js +0 -2
  120. package/dist/compose-refs-DFIaEnQH.js.map +0 -1
  121. package/dist/use-copy-to-clipboard-Ds9MsSNU.js +0 -2
  122. package/dist/use-copy-to-clipboard-Ds9MsSNU.js.map +0 -1
@@ -1,6 +1,6 @@
1
- import { t as Button } from "./button-DDK6nEac.js";
2
- import { s as SortingMode } from "./direction-Jk7BkzGo.js";
3
- import { t as Table$1 } from "./table-4q1UxE7L.js";
1
+ import { t as Button } from "./button-BMgAxAwM.js";
2
+ import { s as SortingMode } from "./direction-DtBAQn7p.js";
3
+ import { t as Table$1 } from "./table--DsTqaWO.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,25 @@ type DataTableProps<TData> = ComponentProps<typeof Table$1.Root> & {
16
16
  table: Table<TData>;
17
17
  };
18
18
  /**
19
- * A data table component that provides sorting and other data table functionality.
20
- * Built on top of TanStack Table for advanced table features.
19
+ * The root container for a data table. Wraps all other `DataTable`
20
+ * sub-components and provides the table context via the `table` instance
21
+ * returned from `useReactTable`. Built on top of TanStack Table.
21
22
  *
22
23
  * @see https://mantle.ngrok.com/components/data-table#datatableroot
23
24
  *
24
25
  * @example
25
26
  * ```tsx
26
- * <DataTable table={table}>
27
+ * const table = useReactTable({ data, columns, getCoreRowModel: getCoreRowModel() });
28
+ * const rows = table.getRowModel().rows;
29
+ *
30
+ * <DataTable.Root table={table}>
27
31
  * <DataTable.Head />
28
32
  * <DataTable.Body>
29
- * <DataTable.Rows />
33
+ * {rows.length > 0
34
+ * ? rows.map((row) => <DataTable.Row key={row.id} row={row} />)
35
+ * : <DataTable.EmptyRow>No results.</DataTable.EmptyRow>}
30
36
  * </DataTable.Body>
31
- * </DataTable>
37
+ * </DataTable.Root>
32
38
  * ```
33
39
  */
34
40
  declare function Root<TData>({
@@ -68,25 +74,33 @@ type DataTableHeaderSortButtonProps<TData, TValue> = Omit<ComponentProps<typeof
68
74
  sortingMode: SortingMode;
69
75
  });
70
76
  /**
71
- * A sortable button toggle for a column header in a data table.
72
- * If the column is sortable, clicking the button will toggle the sorting
73
- * direction.
77
+ * A sortable button toggle for a column header in a data table. Renders a sort
78
+ * icon that reflects the current direction, handles ARIA announcements, and
79
+ * cycles through sort states on click.
80
+ *
81
+ * Each click cycles through:
82
+ * - For `"alphanumeric"` sorting: `unsorted → ascending → descending → unsorted`
83
+ * - For `"time"` sorting: `unsorted → newest-first → oldest-first → unsorted`
84
+ *
85
+ * For right-aligned numeric columns, pass `className="justify-end"` and
86
+ * `iconPlacement="start"` so the sort icon stays paired with the label.
74
87
  *
75
88
  * @see https://mantle.ngrok.com/components/data-table#datatableheadersortbutton
76
89
  *
77
90
  * @example
78
91
  * ```tsx
79
- * <DataTable.HeaderSortButton
80
- * column={column}
81
- * sortingMode="alphanumeric"
82
- * >
83
- * Column Title
84
- * </DataTable.HeaderSortButton>
92
+ * columnHelper.accessor("email", {
93
+ * id: "email",
94
+ * header: (props) => (
95
+ * <DataTable.Header>
96
+ * <DataTable.HeaderSortButton column={props.column} sortingMode="alphanumeric">
97
+ * Email
98
+ * </DataTable.HeaderSortButton>
99
+ * </DataTable.Header>
100
+ * ),
101
+ * cell: (props) => <DataTable.Cell>{props.getValue()}</DataTable.Cell>,
102
+ * });
85
103
  * ```
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
104
  */
91
105
  declare function HeaderSortButton<TData, TValue>({
92
106
  children,
@@ -104,18 +118,25 @@ declare namespace HeaderSortButton {
104
118
  }
105
119
  type DataTableHeaderProps = ComponentProps<typeof Table$1.Header>;
106
120
  /**
107
- * A header for a data table.
108
- * This is typically used to wrap the `DataTable.HeaderSortButton` component.
121
+ * A `<th>` optimized for header actions. Wrap each column's header content in
122
+ * this; for sortable columns, nest a `DataTable.HeaderSortButton` inside.
123
+ * Non-sortable columns can render plain text.
109
124
  *
110
125
  * @see https://mantle.ngrok.com/components/data-table#datatableheader
111
126
  *
112
127
  * @example
113
128
  * ```tsx
114
- * <DataTable.Header>
115
- * <DataTable.HeaderSortButton column={column} sortingMode="alphanumeric">
116
- * Column Title
117
- * </DataTable.HeaderSortButton>
118
- * </DataTable.Header>
129
+ * columnHelper.accessor("name", {
130
+ * id: "name",
131
+ * header: (props) => (
132
+ * <DataTable.Header>
133
+ * <DataTable.HeaderSortButton column={props.column} sortingMode="alphanumeric">
134
+ * Name
135
+ * </DataTable.HeaderSortButton>
136
+ * </DataTable.Header>
137
+ * ),
138
+ * cell: (props) => <DataTable.Cell>{props.getValue()}</DataTable.Cell>,
139
+ * });
119
140
  * ```
120
141
  */
121
142
  declare function Header({
@@ -134,7 +155,32 @@ declare namespace Head {
134
155
  type DataTableRowProps<TData> = Omit<ComponentProps<typeof Table$1.Row>, "children"> & {
135
156
  row: Row<TData>;
136
157
  };
158
+ /**
159
+ * A single data table body row rendered from a TanStack Table row instance.
160
+ * Does not accept children — cells come from each column's `cell` definition.
161
+ *
162
+ * When `onClick` is provided, the row automatically receives `cursor-pointer`.
163
+ * Pass a different `cursor-*` class via `className` (e.g. `cursor-default`,
164
+ * `cursor-wait`) to override. For keyboard and screen-reader access, also
165
+ * render a `<Link>` inside the primary cell — a `<tr>` is not focusable.
166
+ *
167
+ * @see https://mantle.ngrok.com/components/data-table#datatablerow
168
+ *
169
+ * @example
170
+ * ```tsx
171
+ * const navigate = useNavigate();
172
+ *
173
+ * {rows.map((row) => (
174
+ * <DataTable.Row
175
+ * key={row.id}
176
+ * row={row}
177
+ * onClick={() => navigate(href("/payments/:id", { id: row.original.id }))}
178
+ * />
179
+ * ))}
180
+ * ```
181
+ */
137
182
  declare function Row$1<TData>({
183
+ className,
138
184
  row,
139
185
  ...props
140
186
  }: DataTableRowProps<TData>): _$react_jsx_runtime0.JSX.Element;
@@ -150,6 +196,29 @@ declare namespace EmptyRow {
150
196
  var displayName: string;
151
197
  }
152
198
  type DataTableActionCellProps = ComponentProps<typeof Table$1.Cell>;
199
+ /**
200
+ * A sticky-right `<td>` for per-row action buttons (typically an `IconButton`
201
+ * that opens a `DropdownMenu`). Pair with `DataTable.ActionHeader`.
202
+ *
203
+ * If the row has `onClick`, pass `onClick={(event) => event.stopPropagation()}`
204
+ * on this cell so clicks on action controls don't bubble and fire the row
205
+ * handler.
206
+ *
207
+ * @see https://mantle.ngrok.com/components/data-table#datatableactioncell
208
+ *
209
+ * @example
210
+ * ```tsx
211
+ * columnHelper.display({
212
+ * id: "actions",
213
+ * header: () => <DataTable.ActionHeader />,
214
+ * cell: () => (
215
+ * <DataTable.ActionCell onClick={(event) => event.stopPropagation()}>
216
+ * <DropdownMenu.Root>...</DropdownMenu.Root>
217
+ * </DataTable.ActionCell>
218
+ * ),
219
+ * });
220
+ * ```
221
+ */
153
222
  declare function ActionCell({
154
223
  children,
155
224
  className,
@@ -184,8 +253,14 @@ declare namespace ActionHeader {
184
253
  var displayName: string;
185
254
  }
186
255
  /**
187
- * A data table component that provides sorting and other data table functionality.
188
- * Built on top of TanStack Table for advanced table features.
256
+ * A data table for dynamic, application data sortable, filterable, paginatable,
257
+ * and selectable. Built on top of TanStack Table; every TanStack utility
258
+ * (`createColumnHelper`, `getCoreRowModel`, `getSortedRowModel`,
259
+ * `getPaginationRowModel`, `getFilteredRowModel`, `useReactTable`, …) is
260
+ * re-exported from `@ngrok/mantle/data-table`.
261
+ *
262
+ * Prefer the plain `Table` when content is static and none of those behaviors
263
+ * apply.
189
264
  *
190
265
  * @see https://mantle.ngrok.com/components/data-table
191
266
  *
@@ -207,12 +282,45 @@ declare namespace ActionHeader {
207
282
  *
208
283
  * @example
209
284
  * ```tsx
210
- * <DataTable table={table}>
211
- * <DataTable.Head />
212
- * <DataTable.Body>
213
- * <DataTable.Rows />
214
- * </DataTable.Body>
215
- * </DataTable>
285
+ * import {
286
+ * DataTable,
287
+ * createColumnHelper,
288
+ * getCoreRowModel,
289
+ * useReactTable,
290
+ * } from "@ngrok/mantle/data-table";
291
+ *
292
+ * type Row = { id: string; name: string };
293
+ *
294
+ * const columnHelper = createColumnHelper<Row>();
295
+ * const columns = [
296
+ * columnHelper.accessor("name", {
297
+ * id: "name",
298
+ * header: (props) => (
299
+ * <DataTable.Header>
300
+ * <DataTable.HeaderSortButton column={props.column} sortingMode="alphanumeric">
301
+ * Name
302
+ * </DataTable.HeaderSortButton>
303
+ * </DataTable.Header>
304
+ * ),
305
+ * cell: (props) => <DataTable.Cell>{props.getValue()}</DataTable.Cell>,
306
+ * }),
307
+ * ];
308
+ *
309
+ * function MyTable({ data }: { data: Row[] }) {
310
+ * const table = useReactTable({ data, columns, getCoreRowModel: getCoreRowModel() });
311
+ * const rows = table.getRowModel().rows;
312
+ *
313
+ * return (
314
+ * <DataTable.Root table={table}>
315
+ * <DataTable.Head />
316
+ * <DataTable.Body>
317
+ * {rows.length > 0
318
+ * ? rows.map((row) => <DataTable.Row key={row.id} row={row} />)
319
+ * : <DataTable.EmptyRow>No results.</DataTable.EmptyRow>}
320
+ * </DataTable.Body>
321
+ * </DataTable.Root>
322
+ * );
323
+ * }
216
324
  * ```
217
325
  */
218
326
  declare const DataTable: {
@@ -223,32 +331,47 @@ declare const DataTable: {
223
331
  *
224
332
  * @example
225
333
  * ```tsx
334
+ * const table = useReactTable({ data, columns, getCoreRowModel: getCoreRowModel() });
335
+ * const rows = table.getRowModel().rows;
336
+ *
226
337
  * <DataTable.Root table={table}>
227
338
  * <DataTable.Head />
228
339
  * <DataTable.Body>
229
- * <DataTable.Rows />
340
+ * {rows.length > 0
341
+ * ? rows.map((row) => <DataTable.Row key={row.id} row={row} />)
342
+ * : <DataTable.EmptyRow>No results.</DataTable.EmptyRow>}
230
343
  * </DataTable.Body>
231
344
  * </DataTable.Root>
232
345
  * ```
233
346
  */
234
347
  readonly Root: typeof Root;
235
348
  /**
236
- * A sticky action cell positioned at the end of each row for action buttons.
349
+ * A sticky action cell positioned at the end of each row, typically holding
350
+ * an `IconButton` that opens a `DropdownMenu`. Pair with `DataTable.ActionHeader`.
351
+ *
352
+ * If the row has `onClick`, stop propagation on this cell so clicks on action
353
+ * controls don't bubble up and fire the row handler.
237
354
  *
238
355
  * @see https://mantle.ngrok.com/components/data-table#datatableactioncell
239
356
  *
240
357
  * @example
241
358
  * ```tsx
242
- * <DataTable.ActionCell>
243
- * <Button size="sm">Edit</Button>
244
- * <Button size="sm">Delete</Button>
245
- * </DataTable.ActionCell>
359
+ * columnHelper.display({
360
+ * id: "actions",
361
+ * header: () => <DataTable.ActionHeader />,
362
+ * cell: () => (
363
+ * <DataTable.ActionCell onClick={(event) => event.stopPropagation()}>
364
+ * <DropdownMenu.Root>...</DropdownMenu.Root>
365
+ * </DataTable.ActionCell>
366
+ * ),
367
+ * });
246
368
  * ```
247
369
  */
248
370
  readonly ActionCell: typeof ActionCell;
249
371
  /**
250
372
  * A sticky header cell that pairs with `DataTable.ActionCell`, keeping the
251
373
  * action column aligned across the header and body when scrolling horizontally.
374
+ * Use as the `header` for a `columnHelper.display` action column.
252
375
  *
253
376
  * @see https://mantle.ngrok.com/components/data-table#datatableactionheader
254
377
  *
@@ -257,100 +380,151 @@ declare const DataTable: {
257
380
  * columnHelper.display({
258
381
  * id: "actions",
259
382
  * header: () => <DataTable.ActionHeader />,
260
- * cell: () => <DataTable.ActionCell>{...}</DataTable.ActionCell>,
261
- * })
383
+ * cell: () => (
384
+ * <DataTable.ActionCell onClick={(event) => event.stopPropagation()}>
385
+ * <DropdownMenu.Root>...</DropdownMenu.Root>
386
+ * </DataTable.ActionCell>
387
+ * ),
388
+ * });
262
389
  * ```
263
390
  */
264
391
  readonly ActionHeader: typeof ActionHeader;
265
392
  /**
266
- * A table cell component for rendering individual data cells.
393
+ * A `<td>` for rendering an individual data cell. Re-exported from
394
+ * `Table.Cell`. Every cell rendered by a column's `cell` function should
395
+ * be wrapped in this — a raw `<td>` skips mantle typography and padding.
267
396
  *
268
397
  * @see https://mantle.ngrok.com/components/data-table#datatablecell
269
398
  *
270
399
  * @example
271
400
  * ```tsx
272
- * <DataTable.Cell>
273
- * Cell content
274
- * </DataTable.Cell>
401
+ * columnHelper.accessor("name", {
402
+ * id: "name",
403
+ * header: (props) => <DataTable.Header>Name</DataTable.Header>,
404
+ * cell: (props) => <DataTable.Cell>{props.getValue()}</DataTable.Cell>,
405
+ * });
275
406
  * ```
276
407
  */
277
408
  readonly Cell: _$react.ForwardRefExoticComponent<Omit<_$react.DetailedHTMLProps<_$react.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, "ref"> & _$react.RefAttributes<HTMLTableDataCellElement>>;
278
409
  /**
279
- * The table body container for rows of data.
410
+ * The `<tbody>` container for rows of data. Typically wraps a map of
411
+ * `DataTable.Row`, with a `DataTable.EmptyRow` fallback when there is
412
+ * no data.
280
413
  *
281
414
  * @see https://mantle.ngrok.com/components/data-table#datatablebody
282
415
  *
283
416
  * @example
284
417
  * ```tsx
285
418
  * <DataTable.Body>
286
- * <DataTable.Rows />
419
+ * {rows.length > 0
420
+ * ? rows.map((row) => <DataTable.Row key={row.id} row={row} />)
421
+ * : <DataTable.EmptyRow>No results.</DataTable.EmptyRow>}
287
422
  * </DataTable.Body>
288
423
  * ```
289
424
  */
290
425
  readonly Body: _$react.ForwardRefExoticComponent<Omit<Omit<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & _$react.RefAttributes<HTMLTableSectionElement>, "ref"> & _$react.RefAttributes<HTMLTableSectionElement>>;
291
426
  /**
292
- * An empty state row that spans all columns when there's no data to display.
427
+ * An empty-state row that spans every column. Render this as the `else`
428
+ * branch when `rows.length === 0` to keep the table's frame intact instead
429
+ * of collapsing to an empty `<tbody>`.
293
430
  *
294
431
  * @see https://mantle.ngrok.com/components/data-table#datatableemptyrow
295
432
  *
296
433
  * @example
297
434
  * ```tsx
298
- * <DataTable.EmptyRow>
299
- * No data available
300
- * </DataTable.EmptyRow>
435
+ * <DataTable.Body>
436
+ * {rows.length > 0
437
+ * ? rows.map((row) => <DataTable.Row key={row.id} row={row} />)
438
+ * : <DataTable.EmptyRow>No results.</DataTable.EmptyRow>}
439
+ * </DataTable.Body>
301
440
  * ```
302
441
  */
303
442
  readonly EmptyRow: typeof EmptyRow;
304
443
  /**
305
- * The table header container that renders column headers automatically.
444
+ * The `<thead>` container that renders column headers automatically from
445
+ * `table.getHeaderGroups()`. Does not accept children — headers come from
446
+ * each column's `header` definition.
306
447
  *
307
448
  * @see https://mantle.ngrok.com/components/data-table#datatablehead
308
449
  *
309
450
  * @example
310
451
  * ```tsx
311
- * <DataTable.Head />
452
+ * <DataTable.Root table={table}>
453
+ * <DataTable.Head />
454
+ * <DataTable.Body>...</DataTable.Body>
455
+ * </DataTable.Root>
312
456
  * ```
313
457
  */
314
458
  readonly Head: typeof Head;
315
459
  /**
316
- * A header cell component optimized for data table header actions.
460
+ * A `<th>` optimized for header actions. Wrap each column's header content
461
+ * in this; for sortable columns, nest a `DataTable.HeaderSortButton` inside.
317
462
  *
318
463
  * @see https://mantle.ngrok.com/components/data-table#datatableheader
319
464
  *
320
465
  * @example
321
466
  * ```tsx
322
- * <DataTable.Header>
323
- * <DataTable.HeaderSortButton column={column} sortingMode="alphanumeric">
324
- * Column Title
325
- * </DataTable.HeaderSortButton>
326
- * </DataTable.Header>
467
+ * columnHelper.accessor("name", {
468
+ * id: "name",
469
+ * header: (props) => (
470
+ * <DataTable.Header>
471
+ * <DataTable.HeaderSortButton column={props.column} sortingMode="alphanumeric">
472
+ * Name
473
+ * </DataTable.HeaderSortButton>
474
+ * </DataTable.Header>
475
+ * ),
476
+ * cell: (props) => <DataTable.Cell>{props.getValue()}</DataTable.Cell>,
477
+ * });
327
478
  * ```
328
479
  */
329
480
  readonly Header: typeof Header;
330
481
  /**
331
- * A sortable button toggle for column headers with sorting functionality.
482
+ * A sortable button toggle for a column header. Clicks cycle through
483
+ * sort directions: for `"alphanumeric"`, `unsorted → asc → desc → unsorted`;
484
+ * for `"time"`, `unsorted → desc (newest-first) → asc → unsorted`.
485
+ *
486
+ * Pass `className="justify-end"` and `iconPlacement="start"` for
487
+ * right-aligned numeric columns so the sort icon stays paired with the label.
332
488
  *
333
489
  * @see https://mantle.ngrok.com/components/data-table#datatableheadersortbutton
334
490
  *
335
491
  * @example
336
492
  * ```tsx
337
- * <DataTable.HeaderSortButton
338
- * column={column}
339
- * sortingMode="alphanumeric"
340
- * >
341
- * Column Title
342
- * </DataTable.HeaderSortButton>
493
+ * columnHelper.accessor("email", {
494
+ * id: "email",
495
+ * header: (props) => (
496
+ * <DataTable.Header>
497
+ * <DataTable.HeaderSortButton column={props.column} sortingMode="alphanumeric">
498
+ * Email
499
+ * </DataTable.HeaderSortButton>
500
+ * </DataTable.Header>
501
+ * ),
502
+ * cell: (props) => <DataTable.Cell>{props.getValue()}</DataTable.Cell>,
503
+ * });
343
504
  * ```
344
505
  */
345
506
  readonly HeaderSortButton: typeof HeaderSortButton;
346
507
  /**
347
- * A single data table row component for rendering custom row layouts.
508
+ * A single data table body row rendered from a TanStack Table row instance.
509
+ * Does not accept children — cells come from each column's `cell` definition.
510
+ *
511
+ * When `onClick` is provided, the row automatically receives `cursor-pointer`.
512
+ * Pass a different `cursor-*` class via `className` to override. For keyboard
513
+ * and screen-reader access, also render a `<Link>` inside the primary cell.
348
514
  *
349
515
  * @see https://mantle.ngrok.com/components/data-table#datatablerow
350
516
  *
351
517
  * @example
352
518
  * ```tsx
353
- * <DataTable.Row row={row} />
519
+ * const navigate = useNavigate();
520
+ *
521
+ * {rows.map((row) => (
522
+ * <DataTable.Row
523
+ * key={row.id}
524
+ * row={row}
525
+ * onClick={() => navigate(href("/payments/:id", { id: row.original.id }))}
526
+ * />
527
+ * ))}
354
528
  * ```
355
529
  */
356
530
  readonly Row: typeof Row$1;
@@ -1,2 +1,2 @@
1
- import{t as e}from"./cx-D1HYnpvA.js";import{t}from"./button-GokecthL.js";import{i as n}from"./direction-ClCocWIf.js";import{t as r}from"./sort-C_Jbs1dH.js";import{t as i}from"./table-12T25gGa.js";import{Fragment as a,createContext as o,forwardRef as s,useContext as c,useMemo as l}from"react";import u from"tiny-invariant";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{flexRender as p}from"@tanstack/react-table";export*from"@tanstack/react-table";const m=[`unsorted`,`asc`,`desc`],h=[`unsorted`,`desc`,`asc`];function g(e,t){return _(t===`alphanumeric`?m:h,e)??`unsorted`}function _(e,t,n){if(e.length===0)return n;let r=e.findIndex(e=>e===t);if(r===-1)return n;let i=(r+1)%e.length;return e.at(i)??n}const v=o(null);function y(){let e=c(v);return u(e,`useDataTableContext should only be used within a DataTable child component`),e}function b({children:e,table:t,...n}){let r=l(()=>({table:t}),[t]);return d(v.Provider,{value:r,children:d(i.Root,{"data-slot":`data-table`,...n,children:d(i.Element,{children:e})})})}function x({children:r,className:i,column:a,disableSorting:o=!1,iconPlacement:s=`end`,sortingMode:c,sortIcon:l,onClick:u,...p}){let m=a.getIsSorted(),h=!o&&a.getCanSort(),g=h&&typeof m==`string`?m:`unsorted`,_=l?.(g)??d(j,{mode:c,direction:g});return f(t,{appearance:`ghost`,"data-slot":`data-table-header-sort-button`,className:e(`flex justify-start w-full h-full rounded-none not-disabled:active:scale-none text-muted`,i),"data-sort-direction":g,"data-table-header-action":!0,icon:_,iconPlacement:s,onClick:e=>{u?.(e),!e.defaultPrevented&&(!h||o||c===void 0||M(a,c))},priority:`neutral`,type:`button`,...p,children:[h&&g!==`unsorted`&&f(`span`,{className:`sr-only`,children:[`Column sorted in`,` `,c===`alphanumeric`?g===`asc`?`ascending`:`descending`:n(g),` `,`order`]}),r]})}function S({children:t,className:n,...r}){return d(i.Header,{"data-slot":`data-table-header`,className:e(`has-data-table-header-action:px-0`,n),...r,children:t})}const C=s((e,t)=>d(i.Body,{ref:t,"data-slot":`data-table-body`,...e}));C.displayName=`DataTableBody`;function w(e){let{table:t}=y();return d(i.Head,{"data-slot":`data-table-head`,...e,children:t.getHeaderGroups().map(e=>d(i.Row,{children:e.headers.map(e=>d(a,{children:e.isPlaceholder?d(i.Header,{},e.id):p(e.column.columnDef.header,e.getContext())},e.id))},e.id))})}function T({row:e,...t}){return d(i.Row,{"data-slot":`data-table-row`,...t,children:e.getVisibleCells().map(e=>d(a,{children:p(e.column.columnDef.cell,e.getContext())},e.id))})}function E({children:e,...t}){let{table:n}=y(),r=n.getAllColumns().length;return d(i.Row,{"data-slot":`data-table-empty-row`,...t,children:d(i.Cell,{colSpan:r,children:e})})}function D(){return d(`span`,{"aria-hidden":!0,className:e(`pointer-events-none absolute -inset-y-px -left-1.5 w-1.5`,`opacity-0 transition-opacity group-data-sticky-active/table:opacity-100`,`shadow-[1px_0_0_0_var(--border-color-card-muted)]`,`bg-linear-to-l to-transparent`,`from-[color-mix(in_oklab,var(--shadow-color)_var(--shadow-second-opacity),transparent)]`)})}function O({children:t,className:n,...r}){return f(i.Cell,{"data-mantle-table-sticky-right":!0,"data-slot":`data-table-action-cell`,className:e(`sticky z-10 right-0 text-end align-middle bg-inherit p-2`,n),...r,children:[d(D,{}),t]})}function k({children:t,className:n,...r}){let{table:a}=y(),o=a.getRowModel().rows.length>0;return f(i.Header,{...o?{"data-mantle-table-sticky-right":!0}:{},"data-slot":`data-table-action-header`,className:e(o&&`sticky z-10 right-0 bg-inherit`,n),...r,children:[o&&d(D,{}),t]})}b.displayName=`DataTable`,O.displayName=`DataTableActionCell`,k.displayName=`DataTableActionHeader`,C.displayName=`DataTableBody`,E.displayName=`DataTableEmptyRow`,w.displayName=`DataTableHead`,S.displayName=`DataTableHeader`,x.displayName=`DataTableHeaderSortButton`,T.displayName=`DataTableRow`;const A={Root:b,ActionCell:O,ActionHeader:k,Cell:i.Cell,Body:C,EmptyRow:E,Head:w,Header:S,HeaderSortButton:x,Row:T};function j({direction:e,mode:t,...n}){return e===`unsorted`||!t||!e?d(`svg`,{"aria-hidden":!0,...n}):d(r,{mode:t,direction:e,...n})}function M(e,t){if(!e.getCanSort())return;let n=e.getIsSorted();switch(g(typeof n==`string`?n:`unsorted`,t)){case`unsorted`:e.clearSorting();return;case`asc`:e.toggleSorting(!1);return;case`desc`:e.toggleSorting(!0);return;default:return}}export{A as DataTable};
1
+ import{t as e}from"./cx-D1HYnpvA.js";import{t}from"./button-GokecthL.js";import{i as n}from"./direction-DsB-pD9V.js";import{t as r}from"./sort-DzCsa6Qj.js";import{t as i}from"./table-Cl4nlRMR.js";import{Fragment as a,createContext as o,forwardRef as s,useContext as c,useMemo as l}from"react";import u from"tiny-invariant";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{flexRender as p}from"@tanstack/react-table";export*from"@tanstack/react-table";const m=[`unsorted`,`asc`,`desc`],h=[`unsorted`,`desc`,`asc`];function g(e,t){return _(t===`alphanumeric`?m:h,e)??`unsorted`}function _(e,t,n){if(e.length===0)return n;let r=e.findIndex(e=>e===t);if(r===-1)return n;let i=(r+1)%e.length;return e.at(i)??n}const v=o(null);function y(){let e=c(v);return u(e,`useDataTableContext should only be used within a DataTable child component`),e}function b({children:e,table:t,...n}){let r=l(()=>({table:t}),[t]);return d(v.Provider,{value:r,children:d(i.Root,{"data-slot":`data-table`,...n,children:d(i.Element,{children:e})})})}function x({children:r,className:i,column:a,disableSorting:o=!1,iconPlacement:s=`end`,sortingMode:c,sortIcon:l,onClick:u,...p}){let m=a.getIsSorted(),h=!o&&a.getCanSort(),g=h&&typeof m==`string`?m:`unsorted`,_=l?.(g)??d(j,{mode:c,direction:g});return f(t,{appearance:`ghost`,"data-slot":`data-table-header-sort-button`,className:e(`flex justify-start w-full h-full rounded-none not-disabled:active:scale-none text-muted`,i),"data-sort-direction":g,"data-table-header-action":!0,icon:_,iconPlacement:s,onClick:e=>{u?.(e),!e.defaultPrevented&&(!h||o||c===void 0||M(a,c))},priority:`neutral`,type:`button`,...p,children:[h&&g!==`unsorted`&&f(`span`,{className:`sr-only`,children:[`Column sorted in`,` `,c===`alphanumeric`?g===`asc`?`ascending`:`descending`:n(g),` `,`order`]}),r]})}function S({children:t,className:n,...r}){return d(i.Header,{"data-slot":`data-table-header`,className:e(`has-data-table-header-action:px-0`,n),...r,children:t})}const C=s((e,t)=>d(i.Body,{ref:t,"data-slot":`data-table-body`,...e}));C.displayName=`DataTableBody`;function w(e){let{table:t}=y();return d(i.Head,{"data-slot":`data-table-head`,...e,children:t.getHeaderGroups().map(e=>d(i.Row,{children:e.headers.map(e=>d(a,{children:e.isPlaceholder?d(i.Header,{},e.id):p(e.column.columnDef.header,e.getContext())},e.id))},e.id))})}function T({className:t,row:n,...r}){return d(i.Row,{"data-slot":`data-table-row`,className:e(r.onClick&&`cursor-pointer`,t),...r,children:n.getVisibleCells().map(e=>d(a,{children:p(e.column.columnDef.cell,e.getContext())},e.id))})}function E({children:e,...t}){let{table:n}=y(),r=n.getAllColumns().length;return d(i.Row,{"data-slot":`data-table-empty-row`,...t,children:d(i.Cell,{colSpan:r,children:e})})}function D(){return d(`span`,{"aria-hidden":!0,className:e(`pointer-events-none absolute -inset-y-px -left-1.5 w-1.5`,`opacity-0 transition-opacity group-data-sticky-active/table:opacity-100`,`shadow-[1px_0_0_0_var(--border-color-card-muted)]`,`bg-linear-to-l to-transparent`,`from-[color-mix(in_oklab,var(--shadow-color)_var(--shadow-second-opacity),transparent)]`)})}function O({children:t,className:n,...r}){return f(i.Cell,{"data-mantle-table-sticky-right":!0,"data-slot":`data-table-action-cell`,className:e(`sticky z-10 right-0 text-end align-middle bg-inherit p-2`,n),...r,children:[d(D,{}),t]})}function k({children:t,className:n,...r}){let{table:a}=y(),o=a.getRowModel().rows.length>0;return f(i.Header,{...o?{"data-mantle-table-sticky-right":!0}:{},"data-slot":`data-table-action-header`,className:e(o&&`sticky z-10 right-0 bg-inherit`,n),...r,children:[o&&d(D,{}),t]})}b.displayName=`DataTable`,O.displayName=`DataTableActionCell`,k.displayName=`DataTableActionHeader`,C.displayName=`DataTableBody`,E.displayName=`DataTableEmptyRow`,w.displayName=`DataTableHead`,S.displayName=`DataTableHeader`,x.displayName=`DataTableHeaderSortButton`,T.displayName=`DataTableRow`;const A={Root:b,ActionCell:O,ActionHeader:k,Cell:i.Cell,Body:C,EmptyRow:E,Head:w,Header:S,HeaderSortButton:x,Row:T};function j({direction:e,mode:t,...n}){return e===`unsorted`||!t||!e?d(`svg`,{"aria-hidden":!0,...n}):d(r,{mode:t,direction:e,...n})}function M(e,t){if(!e.getCanSort())return;let n=e.getIsSorted();switch(g(typeof n==`string`?n:`unsorted`,t)){case`unsorted`:e.clearSorting();return;case`asc`:e.toggleSorting(!1);return;case`desc`:e.toggleSorting(!0);return;default:return}}export{A as DataTable};
2
2
  //# sourceMappingURL=data-table.js.map