@ngrok/mantle 0.70.0 → 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.
- package/dist/accordion.d.ts +2 -2
- package/dist/accordion.js +1 -1
- package/dist/accordion.js.map +1 -1
- package/dist/alert-dialog.d.ts +6 -6
- package/dist/alert-dialog.js +1 -1
- package/dist/alert-dialog.js.map +1 -1
- package/dist/alert.d.ts +3 -3
- package/dist/alert.js +1 -1
- package/dist/alert.js.map +1 -1
- package/dist/anchor-2stEauOz.js +2 -0
- package/dist/anchor-2stEauOz.js.map +1 -0
- package/dist/anchor.d.ts +1 -1
- package/dist/anchor.js +1 -1
- package/dist/{as-child-CJ2vTesV.d.ts → as-child-DQHfEmYB.d.ts} +1 -1
- package/dist/badge.d.ts +2 -2
- package/dist/badge.js +1 -1
- package/dist/badge.js.map +1 -1
- package/dist/{button-DDK6nEac.d.ts → button-BMgAxAwM.d.ts} +3 -3
- package/dist/{button-BKykcpgJ.js → button-GokecthL.js} +2 -2
- package/dist/{button-BKykcpgJ.js.map → button-GokecthL.js.map} +1 -1
- package/dist/button-POMJ-20y.js +2 -0
- package/dist/button-POMJ-20y.js.map +1 -0
- package/dist/button.d.ts +3 -3
- package/dist/button.js +1 -1
- package/dist/calendar.js +1 -1
- package/dist/calendar.js.map +1 -1
- package/dist/card.d.ts +1 -1
- package/dist/card.js +1 -1
- package/dist/card.js.map +1 -1
- package/dist/checkbox.d.ts +2 -2
- package/dist/checkbox.js +1 -1
- package/dist/checkbox.js.map +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 +2 -2
- package/dist/code.js +1 -1
- package/dist/code.js.map +1 -1
- package/dist/color.d.ts +1 -1
- package/dist/combobox.d.ts +2 -2
- package/dist/combobox.js +1 -1
- package/dist/combobox.js.map +1 -1
- package/dist/command.d.ts +4 -4
- 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 +246 -72
- 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/description-list.js +1 -1
- package/dist/description-list.js.map +1 -1
- package/dist/dialog-BHzl9eye.js +2 -0
- package/dist/dialog-BHzl9eye.js.map +1 -0
- package/dist/dialog.d.ts +4 -4
- 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-BwQDoun1.d.ts → dropdown-menu-CzUNYIfA.d.ts} +3 -3
- package/dist/dropdown-menu-Ducs2SEn.js +2 -0
- package/dist/dropdown-menu-Ducs2SEn.js.map +1 -0
- package/dist/dropdown-menu.d.ts +1 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +6 -4
- package/dist/empty.js +1 -1
- package/dist/empty.js.map +1 -1
- package/dist/flag.js +1 -1
- package/dist/flag.js.map +1 -1
- package/dist/hooks.d.ts +5 -6
- package/dist/hooks.js +1 -1
- package/dist/hover-card.d.ts +9 -1
- package/dist/hover-card.js +1 -1
- package/dist/hover-card.js.map +1 -1
- package/dist/{icon-C7Dje_lR.d.ts → icon-DKMJm20j.d.ts} +2 -2
- package/dist/icon-bWc5yC3-.js +2 -0
- package/dist/{icon-BMH0fD_b.js.map → icon-bWc5yC3-.js.map} +1 -1
- package/dist/{icon-button-Cl30yTfu.d.ts → icon-button-BnK4K7YK.d.ts} +3 -3
- package/dist/{icon-button-CxxVPiKp.js → icon-button-ZKN0sRIJ.js} +2 -2
- package/dist/{icon-button-CxxVPiKp.js.map → icon-button-ZKN0sRIJ.js.map} +1 -1
- package/dist/icon.d.ts +3 -3
- package/dist/icon.js +1 -1
- package/dist/icons.d.ts +3 -3
- package/dist/icons.js +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-A354MgUP.d.ts → index-DMAkXvFI.d.ts} +5 -5
- package/dist/{index-DFBA9X1i.d.ts → index-DOJUH34Z.d.ts} +4 -3
- 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-CAVUiqBT.js +2 -0
- package/dist/{kbd-GS-e4ICt.js.map → kbd-CAVUiqBT.js.map} +1 -1
- package/dist/kbd.js +1 -1
- package/dist/label.js +1 -1
- package/dist/label.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/media-object.d.ts +1 -1
- package/dist/media-object.js +1 -1
- package/dist/media-object.js.map +1 -1
- package/dist/multi-select.d.ts +2 -2
- package/dist/multi-select.js +1 -1
- 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 +12 -0
- package/dist/popover.js +1 -1
- package/dist/popover.js.map +1 -1
- package/dist/{primitive-pggbsddf.js → primitive-tXm_8n_t.js} +2 -2
- package/dist/{primitive-pggbsddf.js.map → primitive-tXm_8n_t.js.map} +1 -1
- package/dist/{primitive-DXo0gUqw.d.ts → primitive-tyw4V7Vf.d.ts} +1 -1
- package/dist/progress.js +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/radio-group.js.map +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-x-52gvQ1.d.ts} +2 -2
- package/dist/sandboxed-on-click.d.ts +1 -1
- package/dist/{select-DNJli9JO.d.ts → select-BjpP51vO.d.ts} +3 -3
- package/dist/select-DOgdZO0Q.js +2 -0
- package/dist/select-DOgdZO0Q.js.map +1 -0
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/separator-DSOIrnhj.js +2 -0
- package/dist/separator-DSOIrnhj.js.map +1 -0
- package/dist/separator.d.ts +1 -1
- package/dist/separator.js +1 -1
- package/dist/sheet.d.ts +2 -2
- package/dist/sheet.js +1 -1
- package/dist/sheet.js.map +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/skeleton.js.map +1 -1
- package/dist/skip-to-main-link.js +1 -1
- package/dist/skip-to-main-link.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-DnZldAY9.js → svg-only-7gYlsX8f.js} +2 -2
- package/dist/{svg-only-DnZldAY9.js.map → svg-only-7gYlsX8f.js.map} +1 -1
- package/dist/{svg-only-B-xzpaiu.d.ts → svg-only-BtBvFy-N.d.ts} +2 -2
- package/dist/switch.js +1 -1
- package/dist/switch.js.map +1 -1
- package/dist/{table-4q1UxE7L.d.ts → table--DsTqaWO.d.ts} +1 -1
- package/dist/table-Cl4nlRMR.js +2 -0
- package/dist/table-Cl4nlRMR.js.map +1 -0
- package/dist/table.d.ts +1 -1
- package/dist/table.js +1 -1
- package/dist/tabs.js +1 -1
- package/dist/tabs.js.map +1 -1
- package/dist/text-area.d.ts +1 -1
- package/dist/text-area.js +1 -1
- package/dist/text-area.js.map +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/{themes-DXb8Tk74.d.ts → themes-DIEYkvNl.d.ts} +1 -1
- package/dist/toast-CGnquSKO.js +2 -0
- package/dist/toast-CGnquSKO.js.map +1 -0
- package/dist/toast.d.ts +3 -3
- package/dist/toast.js +1 -1
- package/dist/tooltip.d.ts +9 -2
- 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-DoV0R5Ja.d.ts +30 -0
- 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-prefers-reduced-motion-BcwST13S.js → use-prefers-reduced-motion-aXfsyo-k.js} +1 -1
- package/dist/{use-prefers-reduced-motion-BcwST13S.js.map → use-prefers-reduced-motion-aXfsyo-k.js.map} +1 -1
- 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 +1 -1
- package/dist/anchor-BtIZueBA.js +0 -2
- package/dist/anchor-BtIZueBA.js.map +0 -1
- package/dist/button-DdrxOnUb.js +0 -2
- package/dist/button-DdrxOnUb.js.map +0 -1
- package/dist/compose-refs-DFIaEnQH.js +0 -2
- package/dist/compose-refs-DFIaEnQH.js.map +0 -1
- package/dist/dialog-Cw3E0Wr9.js +0 -2
- package/dist/dialog-Cw3E0Wr9.js.map +0 -1
- package/dist/dropdown-menu-Bfi9ODPB.js +0 -2
- package/dist/dropdown-menu-Bfi9ODPB.js.map +0 -1
- package/dist/icon-BMH0fD_b.js +0 -2
- package/dist/kbd-GS-e4ICt.js +0 -2
- package/dist/select-BPzMl3gm.js +0 -2
- package/dist/select-BPzMl3gm.js.map +0 -1
- package/dist/separator-Yk9hMn8E.js +0 -2
- package/dist/separator-Yk9hMn8E.js.map +0 -1
- package/dist/table-BMGcRJlk.js +0 -2
- package/dist/table-BMGcRJlk.js.map +0 -1
- package/dist/toast-BhAyUXKL.js +0 -2
- package/dist/toast-BhAyUXKL.js.map +0 -1
- package/dist/types-zKzi66a6.d.ts +0 -9
- package/dist/use-copy-to-clipboard-Ds9MsSNU.js +0 -2
- package/dist/use-copy-to-clipboard-Ds9MsSNU.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-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
|
-
*
|
|
20
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
73
|
-
*
|
|
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
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
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
|
|
108
|
-
*
|
|
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
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
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
|
|
188
|
-
* Built on top of TanStack Table
|
|
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
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
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
|
-
*
|
|
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
|
|
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
|
-
*
|
|
243
|
-
*
|
|
244
|
-
* <
|
|
245
|
-
*
|
|
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: () =>
|
|
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
|
|
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
|
-
*
|
|
273
|
-
*
|
|
274
|
-
* </DataTable.
|
|
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
|
|
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
|
-
*
|
|
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
|
-
readonly Body: _$react.ForwardRefExoticComponent<Omit<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & _$react.RefAttributes<HTMLTableSectionElement>>;
|
|
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
|
|
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.
|
|
299
|
-
*
|
|
300
|
-
*
|
|
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
|
|
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.
|
|
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
|
|
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
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
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
|
|
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
|
-
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
*
|
|
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
|
|
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
|
-
*
|
|
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;
|
package/dist/data-table.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./cx-D1HYnpvA.js";import{t}from"./button-
|
|
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
|