@ngrok/mantle 0.93.7 → 0.94.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -2
- package/dist/accordion.d.ts +73 -21
- package/dist/accordion.js +1 -1
- package/dist/agent.json +1234 -84
- package/dist/alert-BkJHDx9X.js +1 -0
- package/dist/{alert-BcSBNR3S.d.ts → alert-D0zRRUHV.d.ts} +35 -25
- package/dist/alert-center.d.ts +67 -55
- package/dist/alert-center.js +1 -1
- package/dist/alert-dialog.d.ts +35 -10
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +6 -1
- package/dist/alert.js +1 -1
- package/dist/anchor-Dc6IgvXV.js +1 -0
- package/dist/anchor.d.ts +17 -5
- package/dist/anchor.js +1 -1
- package/dist/app-layout.d.ts +33 -18
- package/dist/app-layout.js +1 -1
- package/dist/area-chart.d.ts +153 -97
- package/dist/area-chart.js +1 -1
- package/dist/avatar.d.ts +36 -24
- package/dist/avatar.js +1 -1
- package/dist/badge.d.ts +19 -7
- package/dist/badge.js +1 -1
- package/dist/bar-chart.d.ts +155 -100
- package/dist/bar-chart.js +1 -1
- package/dist/breadcrumb.d.ts +47 -36
- package/dist/breadcrumb.js +1 -1
- package/dist/browser-only-CZfkNw5A.js +1 -0
- package/dist/browser-only-ymFoM3Ya.js +1 -0
- package/dist/browser-only.d.ts +8 -0
- package/dist/browser-only.js +1 -1
- package/dist/{button-BX-4lYUn.d.ts → button-5Pc7Mby_.d.ts} +4 -4
- package/dist/button-B9bChDgl.js +1 -0
- package/dist/button-D8jixIbH.js +1 -0
- package/dist/button-DNLTJ32M.js +1 -0
- package/dist/{button-CPsKGDK0.d.ts → button-Ddj6yr10.d.ts} +34 -27
- package/dist/{button-Yxyu1XMd.d.ts → button-DnYv7IOT.d.ts} +29 -22
- package/dist/button.d.ts +9 -3
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +8 -1
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +7 -2
- package/dist/card.js +1 -1
- package/dist/centered-layout.d.ts +34 -23
- package/dist/centered-layout.js +1 -1
- package/dist/chart-BLCqzt56.js +1 -0
- package/dist/chart-CChZiCrt.js +1 -0
- package/dist/chart-CUmSu9d7.js +1 -0
- package/dist/{chart-BpfbtOUN.d.ts → chart-Dl8gFo_D.d.ts} +117 -121
- package/dist/chart-DtgZBAas.js +2 -0
- package/dist/checkbox-Cu5cgZmk.js +1 -0
- package/dist/checkbox.d.ts +15 -2
- package/dist/checkbox.js +1 -1
- package/dist/choice-CCVG2hb9.js +1 -0
- package/dist/{choice-BLR0_MeB.d.ts → choice-CNiOSzqV.d.ts} +26 -20
- package/dist/choice.d.ts +6 -1
- package/dist/choice.js +1 -1
- package/dist/code-BPKNY1_w.js +1 -0
- package/dist/{code-block-BGdV4Yty.d.ts → code-block-BDw6MEwH.d.ts} +9 -9
- package/dist/{code-block-W3kWPxCJ.js → code-block-CKzsAMzj.js} +3 -3
- package/dist/code-block.d.ts +28 -19
- package/dist/code-block.js +1 -1
- package/dist/code-block_highlight-utils.d.ts +6 -1
- package/dist/code-block_highlight-utils.js +1 -1
- package/dist/code.d.ts +16 -3
- package/dist/code.js +1 -1
- package/dist/color-CHZbU1Ww.js +1 -0
- package/dist/color.js +1 -1
- package/dist/combobox.d.ts +42 -28
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +59 -47
- package/dist/command.js +1 -1
- package/dist/compose-refs-BdRUneoc.js +1 -0
- package/dist/{copy-to-clipboard-DInu78k_.js → copy-to-clipboard-Dd83caRw.js} +1 -1
- package/dist/cx.d.ts +4 -4
- package/dist/cx.js +1 -1
- package/dist/{data-slot-B-LqAcBB.d.ts → data-slot-BW8KQ9Xo.d.ts} +2 -2
- package/dist/data-table.d.ts +83 -52
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +13 -2
- package/dist/description-list.js +1 -1
- package/dist/{dialog-2fRO4ca4.d.ts → dialog-CIEuwNys.d.ts} +32 -8
- package/dist/dialog-CbEEA0fl.d.ts +32 -0
- package/dist/dialog-DmzoDfY3.js +1 -0
- package/dist/dialog.d.ts +7 -2
- package/dist/dialog.js +1 -1
- package/dist/{dropdown-menu-CpjRwMWe.d.ts → dropdown-menu-CeY498yk.d.ts} +41 -33
- package/dist/dropdown-menu-uheL0prz.js +1 -0
- package/dist/dropdown-menu.d.ts +6 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +7 -2
- package/dist/empty.js +1 -1
- package/dist/field-Bpvn4tQp.js +1 -0
- package/dist/{field-V_gnkcmN.d.ts → field-BshcNVe_.d.ts} +1 -1
- package/dist/field-Cai_4c1l.js +1 -0
- package/dist/field.d.ts +53 -42
- package/dist/field.js +1 -1
- package/dist/flag.d.ts +11 -3
- package/dist/flag.js +1 -1
- package/dist/hooks.d.ts +35 -10
- package/dist/hooks.js +1 -1
- package/dist/hover-card.d.ts +25 -14
- package/dist/hover-card.js +1 -1
- package/dist/{icon-CgNqu-fl.d.ts → icon--purqHRo.d.ts} +1 -1
- package/dist/{icon-ByLVhdYq.d.ts → icon-DuIYoyft.d.ts} +8 -2
- package/dist/{icon-DXDyhy2N.d.ts → icon-QCm1ui29.d.ts} +2 -2
- package/dist/icon-xb7d9M7X.js +1 -0
- package/dist/icon.d.ts +8 -3
- package/dist/icon.js +1 -1
- package/dist/icons-DEDCLZ8B.js +1 -0
- package/dist/icons-DXadFwpo.js +1 -0
- package/dist/icons-DcesO4Ng.js +1 -0
- package/dist/icons.d.ts +13 -1
- package/dist/icons.js +1 -1
- package/dist/{in-view-B3nMAzfE.d.ts → in-view-C_daNafg.d.ts} +4 -23
- package/dist/{index-BhfgyurF.d.ts → index-KJ06KK6t.d.ts} +3 -3
- package/dist/input-BjCDSOPA.js +1 -0
- package/dist/{input-Dx5owTCc.d.ts → input-DC4nW0Sr.d.ts} +12 -2
- package/dist/input-fW8QSZEO.js +1 -0
- package/dist/input.d.ts +37 -5
- package/dist/input.js +1 -1
- package/dist/kbd-P1nQshWo.js +1 -0
- package/dist/kbd.d.ts +17 -5
- package/dist/kbd.js +1 -1
- package/dist/label-DO1RlMKl.js +1 -0
- package/dist/{label-Dn5CPJUj.d.ts → label-epgtywRz.d.ts} +14 -8
- package/dist/label.d.ts +6 -1
- package/dist/label.js +1 -1
- package/dist/layer-container-DL4yclOu.js +1 -0
- package/dist/layer-container.d.ts +2 -2
- package/dist/layer-container.js +1 -1
- package/dist/line-chart.d.ts +147 -90
- package/dist/line-chart.js +1 -1
- package/dist/list-cQZPSjfz.js +1 -0
- package/dist/list.d.ts +34 -16
- package/dist/list.js +1 -1
- package/dist/live-region-Dhapu8a5.js +1 -0
- package/dist/live-region.d.ts +15 -2
- package/dist/live-region.js +1 -1
- package/dist/llms.txt +82 -79
- package/dist/main-CHyWYDak.js +1 -0
- package/dist/main.d.ts +13 -1
- package/dist/main.js +1 -1
- package/dist/mantle.css +133 -88
- package/dist/media-object.d.ts +16 -4
- package/dist/media-object.js +1 -1
- package/dist/migrations/0014-chart-named-colors.yml +1389 -0
- package/dist/migrations/0015-segmented-control.yml +788 -0
- package/dist/multi-select.d.ts +42 -29
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +20 -8
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +93 -4
- package/dist/pagination.js +1 -1
- package/dist/{popover-BfB2I9G0.d.ts → popover-Bei0jyfH.d.ts} +87 -12
- package/dist/popover-DhgunktK.js +1 -0
- package/dist/popover-T2EyaqGK.d.ts +1 -0
- package/dist/popover.d.ts +7 -2
- package/dist/popover.js +1 -1
- package/dist/primitive-D8CzV_Ft.js +1 -0
- package/dist/progress.d.ts +28 -11
- package/dist/progress.js +1 -1
- package/dist/qr-code.d.ts +11 -3
- package/dist/qr-code.js +1 -1
- package/dist/query-filter.d.ts +6 -6
- package/dist/query.d.ts +9 -4
- package/dist/query.js +1 -1
- package/dist/radio-group-BJQ6EOqh.d.ts +27 -0
- package/dist/radio-group-BliblUqe.js +1 -0
- package/dist/radio-group-ggEkCi0V.js +1 -0
- package/dist/radio-group.d.ts +21 -100
- package/dist/radio-group.js +1 -1
- package/dist/sandbar.d.ts +43 -30
- package/dist/sandbar.js +1 -1
- package/dist/sandboxed-on-click-D4PL5_GR.js +1 -0
- package/dist/sandboxed-on-click.d.ts +8 -0
- package/dist/sandboxed-on-click.js +1 -1
- package/dist/scatter-plot.d.ts +137 -76
- package/dist/scatter-plot.js +1 -1
- package/dist/segmented-control.d.ts +136 -0
- package/dist/segmented-control.js +1 -0
- package/dist/select-1xuUx_os.js +1 -0
- package/dist/{select-BkhBxtOT.d.ts → select-BpaXHxJm.d.ts} +33 -25
- package/dist/select.d.ts +6 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +29 -18
- package/dist/selectable-list.js +1 -1
- package/dist/{separator-D9AWEkcJ.d.ts → separator-Ck4sPrdN.d.ts} +4 -2
- package/dist/separator-DnvhwY2J.js +1 -0
- package/dist/separator.d.ts +6 -1
- package/dist/separator.js +1 -1
- package/dist/{shake-DL6WhMXM.js → shake-CAUpKBHe.js} +1 -1
- package/dist/sheet-DHy_vlme.js +1 -0
- package/dist/sheet.d.ts +36 -7
- package/dist/sheet.js +1 -1
- package/dist/sidebar.d.ts +53 -37
- package/dist/sidebar.js +1 -1
- package/dist/skeleton-DHfyjuQi.js +1 -0
- package/dist/skeleton.d.ts +15 -4
- package/dist/skeleton.js +1 -1
- package/dist/skip-to-main-link.d.ts +12 -1
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slider.d.ts +11 -1
- package/dist/slider.js +1 -1
- package/dist/slot-B7rwscwd.js +1 -0
- package/dist/{slot-C0OCJjdJ.d.ts → slot-BEMQMbk3.d.ts} +6 -4
- package/dist/slot.d.ts +6 -1
- package/dist/slot.js +1 -1
- package/dist/source-all.css +5 -1
- package/dist/split-button.d.ts +20 -9
- package/dist/split-button.js +1 -1
- package/dist/strata.d.ts +35 -22
- package/dist/strata.js +1 -1
- package/dist/{suggestions-NkqYTT49.d.ts → suggestions-BJeGvwDa.d.ts} +7 -7
- package/dist/switch.d.ts +14 -2
- package/dist/switch.js +1 -1
- package/dist/table-BnLdXUai.js +1 -0
- package/dist/{table-vT6Okwfa.d.ts → table-Ii9hHUWN.d.ts} +84 -5
- package/dist/table.d.ts +6 -1
- package/dist/table.js +1 -1
- package/dist/tabs.d.ts +24 -12
- package/dist/tabs.js +1 -1
- package/dist/text-area.d.ts +12 -2
- package/dist/text-area.js +1 -1
- package/dist/theme-BNdZl352.js +1 -0
- package/dist/theme-switcher.d.ts +18 -4
- package/dist/theme-switcher.js +1 -1
- package/dist/theme.d.ts +25 -11
- package/dist/theme.js +1 -1
- package/dist/toast.d.ts +15 -2
- package/dist/toast.js +1 -1
- package/dist/tokens.dark.json +3261 -0
- package/dist/tokens.json +4933 -0
- package/dist/tokens.resolver.json +37 -0
- package/dist/{tooltip-NcLIeBy5.d.ts → tooltip-CstGDKwy.d.ts} +18 -11
- package/dist/tooltip-DQO40Mrq.js +1 -0
- package/dist/tooltip.d.ts +6 -1
- package/dist/tooltip.js +1 -1
- package/dist/truncated-text.d.ts +28 -14
- package/dist/truncated-text.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/use-breakpoint-B4Kh0xE6.js +1 -0
- package/dist/use-callback-ref-DiOXFQzM.js +1 -0
- package/dist/use-composed-refs-DPYmLDSe.js +1 -0
- package/dist/use-copy-to-clipboard-hBL6_65i.js +1 -0
- package/dist/use-inert-siblings-C4RHXrZc.js +1 -0
- package/dist/use-is-apple-platform-Bq6_KbVX.js +1 -0
- package/dist/use-is-hydrated-BeLOGKwE.js +1 -0
- package/dist/use-is-hydrated-after-paint-CrHt3OHw.js +1 -0
- package/dist/use-isomorphic-layout-effect-CL6iq0Bj.js +1 -0
- package/dist/use-matches-media-query-FfvtNKQe.js +1 -0
- package/dist/use-prefers-reduced-motion-Ck6dnOM9.js +1 -0
- package/dist/use-swipe-to-dismiss-BYdlca8r.js +1 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/visually-hidden.d.ts +14 -1
- package/dist/visually-hidden.js +1 -1
- package/dist/well.d.ts +7 -2
- package/dist/well.js +1 -1
- package/package.json +21 -7
- package/src/components/chart/d3-license.md +25 -0
- package/dist/alert-P9lwn25X.js +0 -1
- package/dist/anchor-CgcbWEUs.js +0 -1
- package/dist/browser-only-BTSrYWLj.js +0 -1
- package/dist/button-69InNC_m.js +0 -1
- package/dist/button-B8k98Pby.js +0 -1
- package/dist/button-Dge0D5bl.js +0 -1
- package/dist/chart-BpWfQAwf.js +0 -2
- package/dist/checkbox-DmSQXs26.js +0 -1
- package/dist/choice-2Lrv8_nl.js +0 -1
- package/dist/code-DUJzSl4K.js +0 -1
- package/dist/compose-refs-sFdxsL7k.js +0 -1
- package/dist/dialog-7TUgiSzX.js +0 -1
- package/dist/dialog-Dp0QGWwo.d.ts +0 -28
- package/dist/dropdown-menu-BHBzCDSZ.js +0 -1
- package/dist/field-Bihblt8U.js +0 -1
- package/dist/field-CPvjazWN.js +0 -1
- package/dist/icon-kK0c-POG.js +0 -1
- package/dist/icons-CDLz5lpI.js +0 -1
- package/dist/icons-CSwTVV2m.js +0 -1
- package/dist/icons-DP3lQw5O.js +0 -1
- package/dist/input-CpQ6jlpI.js +0 -1
- package/dist/kbd-CLHsJ99p.js +0 -1
- package/dist/label-nHqqYS7e.js +0 -1
- package/dist/layer-container-kEQiE4zV.js +0 -1
- package/dist/list-RFRIQxU2.js +0 -1
- package/dist/live-region-DQ1QLv3L.js +0 -1
- package/dist/main-CC1L9IsH.js +0 -1
- package/dist/popover-C96V8SXi.d.ts +0 -1
- package/dist/popover-DxOqLKxy.js +0 -1
- package/dist/primitive-Dz9Al-us.js +0 -1
- package/dist/radio-group-HDVxTNPi.js +0 -1
- package/dist/sandboxed-on-click-C7pPu-2M.js +0 -1
- package/dist/select-CAAYk4Yj.js +0 -1
- package/dist/separator-DfzxVutO.js +0 -1
- package/dist/sheet-CSJc_sB4.js +0 -1
- package/dist/skeleton-DBpI-ko5.js +0 -1
- package/dist/slot-DdYN1L1C.js +0 -1
- package/dist/table-CFHiDBW8.js +0 -1
- package/dist/theme-C-glc5Q-.js +0 -1
- package/dist/tooltip-b6oiTaWq.js +0 -1
- package/dist/use-breakpoint--mo7kr9d.js +0 -1
- package/dist/use-callback-ref-BvVyI5K1.js +0 -1
- package/dist/use-copy-to-clipboard-Dy_0Qzb7.js +0 -1
- package/dist/use-is-apple-platform-D4nifHMx.js +0 -1
- package/dist/use-is-hydrated-after-paint-r9Cl2mGp.js +0 -1
- package/dist/use-isomorphic-layout-effect-CLSmHzo4.js +0 -1
- package/dist/use-matches-media-query-m860lols.js +0 -1
- package/dist/use-prefers-reduced-motion-CU6mWmOe.js +0 -1
- package/dist/use-swipe-to-dismiss-DceYk1Id.js +0 -1
package/dist/data-table.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Data Table component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/data-display/data-table
|
|
5
|
+
*/
|
|
6
|
+
import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
|
|
4
7
|
import { s as SortingMode } from "./direction-CpRzTtZh.js";
|
|
5
|
-
import { t as
|
|
8
|
+
import { i as ButtonIntent, n as ButtonAppearance, t as Button } from "./button-Ddj6yr10.js";
|
|
9
|
+
import { i as IconButtonIntent, r as IconButtonAppearance, t as IconButton } from "./button-DnYv7IOT.js";
|
|
10
|
+
import { t as Table$1 } from "./table-Ii9hHUWN.js";
|
|
6
11
|
import { ComponentProps, ReactNode } from "react";
|
|
7
|
-
import { CellData, Column, Column_RowSorting, Row, RowData, Row_RowExpanding, StockFeatures, Table, TableFeatures } from "@tanstack/react-table";
|
|
12
|
+
import { CellData, Column, Column_RowSorting, Row as Row$1, RowData, Row_RowExpanding, StockFeatures, Table, TableFeatures } from "@tanstack/react-table";
|
|
8
13
|
export * from "@tanstack/react-table";
|
|
9
14
|
declare const sortDirections: readonly ["asc", "desc", "unsorted"];
|
|
10
15
|
type SortDirection = (typeof sortDirections)[number];
|
|
@@ -57,7 +62,7 @@ type ExpandableTableFeatures = Pick<StockFeatures, "rowExpandingFeature">;
|
|
|
57
62
|
/** A column from a table that registers `rowSortingFeature`. */
|
|
58
63
|
type SortableColumn<TFeatures extends SortableTableFeatures, TData extends RowData, TValue extends CellData> = Column<TFeatures, TData, TValue> & Column_RowSorting<TFeatures, TData>;
|
|
59
64
|
/** A row from a table that registers `rowExpandingFeature`. */
|
|
60
|
-
type ExpandableRow<TFeatures extends ExpandableTableFeatures, TData extends RowData> = Row<TFeatures, TData> & Row_RowExpanding;
|
|
65
|
+
type ExpandableRow<TFeatures extends ExpandableTableFeatures, TData extends RowData> = Row$1<TFeatures, TData> & Row_RowExpanding;
|
|
61
66
|
type DataTableProps<TFeatures extends TableFeatures, TData extends RowData> = ComponentProps<typeof Table$1.Root> & {
|
|
62
67
|
/**
|
|
63
68
|
* The TanStack Table instance from `useTable`. Every other `DataTable` part
|
|
@@ -72,7 +77,7 @@ type DataTableProps<TFeatures extends TableFeatures, TData extends RowData> = Co
|
|
|
72
77
|
* REQUIRED: Construct a TanStack Table instance via `useTable` (from
|
|
73
78
|
* `@tanstack/react-table`, also re-exported from `@ngrok/mantle/data-table`)
|
|
74
79
|
* and pass it through the `table` prop. The instance owns columns, data, and
|
|
75
|
-
* any sorting / filtering / pagination state
|
|
80
|
+
* any sorting / filtering / pagination state. The wrapper components read
|
|
76
81
|
* from it.
|
|
77
82
|
*
|
|
78
83
|
* @see https://mantle.ngrok.com/components/data-display/data-table#datatableroot
|
|
@@ -122,13 +127,13 @@ type DataTableHeaderSortButtonProps<TFeatures extends SortableTableFeatures, TDa
|
|
|
122
127
|
*/
|
|
123
128
|
column: SortableColumn<TFeatures, TData, TValue>;
|
|
124
129
|
/**
|
|
125
|
-
* The visual style of the sort button. Optional
|
|
130
|
+
* The visual style of the sort button. Optional: the header sort button's
|
|
126
131
|
* design is a ghost button, so the wrapper defaults it.
|
|
127
132
|
* @default "ghost"
|
|
128
133
|
*/
|
|
129
134
|
appearance?: ButtonAppearance;
|
|
130
135
|
/**
|
|
131
|
-
* The tone of the sort button. Optional
|
|
136
|
+
* The tone of the sort button. Optional: the header sort button's design
|
|
132
137
|
* is neutral-toned, so the wrapper defaults it.
|
|
133
138
|
* @default "neutral"
|
|
134
139
|
*/
|
|
@@ -318,8 +323,8 @@ declare const Body: ({ "data-slot": dataSlot, ...props }: ComponentProps<typeof
|
|
|
318
323
|
type DataTableHeadProps = Omit<ComponentProps<typeof Table$1.Head>, "children"> & WithDataSlot;
|
|
319
324
|
/**
|
|
320
325
|
* The `<thead>` container that renders column headers automatically from
|
|
321
|
-
* `table.getHeaderGroups()`. Does not accept children
|
|
322
|
-
* column's `header` definition on the TanStack Table column config.
|
|
326
|
+
* `table.getHeaderGroups()`. Does not accept children: the headers come from
|
|
327
|
+
* each column's `header` definition on the TanStack Table column config.
|
|
323
328
|
*
|
|
324
329
|
* @see https://mantle.ngrok.com/components/data-display/data-table#datatablehead
|
|
325
330
|
*
|
|
@@ -341,11 +346,11 @@ type DataTableHeadProps = Omit<ComponentProps<typeof Table$1.Head>, "children">
|
|
|
341
346
|
declare function Head({ "data-slot": dataSlot, ...props }: DataTableHeadProps): import("react").JSX.Element;
|
|
342
347
|
type DataTableRowProps<TFeatures extends TableFeatures, TData extends RowData> = Omit<ComponentProps<typeof Table$1.Row>, "children"> & {
|
|
343
348
|
/** The TanStack Table row instance to render. */
|
|
344
|
-
row: Row<TFeatures, TData>;
|
|
349
|
+
row: Row$1<TFeatures, TData>;
|
|
345
350
|
/**
|
|
346
351
|
* Renders an inline detail panel beneath the row. Called only while the row is
|
|
347
|
-
* expanded (`row.getIsExpanded()`), so the panel
|
|
348
|
-
* does
|
|
352
|
+
* expanded (`row.getIsExpanded()`), so the panel (and any expensive work it
|
|
353
|
+
* does) stays lazy. Mantle wraps the returned content in a sibling
|
|
349
354
|
* `DataTable.ExpandedRow` spanning every visible column, so return the
|
|
350
355
|
* panel content (not a `<tr>`). Requires the table to register
|
|
351
356
|
* `rowExpandingFeature`, plus `getRowCanExpand` for detail panels; pair it
|
|
@@ -354,11 +359,11 @@ type DataTableRowProps<TFeatures extends TableFeatures, TData extends RowData> =
|
|
|
354
359
|
* full control over the detail row (custom `colSpan`,
|
|
355
360
|
* multiple panels), omit this and render `DataTable.ExpandedRow` yourself.
|
|
356
361
|
*/
|
|
357
|
-
renderExpanded?: (row: Row<TFeatures, TData>) => ReactNode;
|
|
362
|
+
renderExpanded?: (row: Row$1<TFeatures, TData>) => ReactNode;
|
|
358
363
|
} & WithDataSlot;
|
|
359
364
|
/**
|
|
360
365
|
* A single data table body row rendered from a TanStack Table row instance.
|
|
361
|
-
* Does not accept children
|
|
366
|
+
* Does not accept children: cells come from each column's `cell` definition.
|
|
362
367
|
*
|
|
363
368
|
* When `onClick` is set, the row receives `cursor-pointer` and `data-clickable`.
|
|
364
369
|
* Pass a different `cursor-*` class via `className` (e.g. `cursor-default`,
|
|
@@ -418,7 +423,7 @@ type DataTableRowProps<TFeatures extends TableFeatures, TData extends RowData> =
|
|
|
418
423
|
* ```
|
|
419
424
|
*
|
|
420
425
|
* @example
|
|
421
|
-
* Expandable row with an inline JSON detail panel (lazy
|
|
426
|
+
* Expandable row with an inline JSON detail panel (lazy: built only when open):
|
|
422
427
|
* ```tsx
|
|
423
428
|
* import { CodeBlock, jsonCodeBlockValue } from "@ngrok/mantle/code-block";
|
|
424
429
|
*
|
|
@@ -438,7 +443,7 @@ type DataTableRowProps<TFeatures extends TableFeatures, TData extends RowData> =
|
|
|
438
443
|
* ))}
|
|
439
444
|
* ```
|
|
440
445
|
*/
|
|
441
|
-
declare function Row
|
|
446
|
+
declare function Row<TFeatures extends TableFeatures, TData extends RowData>({ "data-slot": dataSlot, className, onClick, renderExpanded, row, ...props }: DataTableRowProps<TFeatures, TData>): import("react").JSX.Element;
|
|
442
447
|
type DataTableEmptyRowProps = ComponentProps<typeof Table$1.Row> & WithDataSlot;
|
|
443
448
|
/**
|
|
444
449
|
* An empty-state row that spans every column. Render this as the `else` branch
|
|
@@ -464,7 +469,7 @@ type DataTableEmptyRowProps = ComponentProps<typeof Table$1.Row> & WithDataSlot;
|
|
|
464
469
|
* const rows = table.getRowModel().rows;
|
|
465
470
|
* const isFiltered = (table.state.globalFilter ?? "") !== "";
|
|
466
471
|
*
|
|
467
|
-
* // EmptyRow already spans every column and Empty.Root centers itself
|
|
472
|
+
* // EmptyRow already spans every column and Empty.Root centers itself. Drop a
|
|
468
473
|
* // single Empty.Root in as the child; don't hand-roll a <td> or any centering.
|
|
469
474
|
* <DataTable.Body>
|
|
470
475
|
* {rows.length > 0 ? (
|
|
@@ -627,12 +632,12 @@ declare function ControlCell({ "data-slot": dataSlot, children, className, onCli
|
|
|
627
632
|
* Compute the stable DOM `id` for a row's expanded detail row. Shared by
|
|
628
633
|
* `DataTable.RowExpandButton` (as its `aria-controls` target) and
|
|
629
634
|
* `DataTable.ExpandedRow` (as its `id`) so the accessibility association is
|
|
630
|
-
* _derived_ from the row
|
|
635
|
+
* _derived_ from the row (never synchronized state) and stays correct whether
|
|
631
636
|
* or not the detail panel is currently rendered.
|
|
632
637
|
*
|
|
633
638
|
* REQUIRED: configure the table with a stable `getRowId` so `row.id` (and thus
|
|
634
639
|
* this id) is stable across sorting/filtering/pagination. Any `row.id` value is
|
|
635
|
-
* safe
|
|
640
|
+
* safe: it is URL-encoded into a valid, whitespace-free HTML id token (and thus
|
|
636
641
|
* a valid `aria-controls` IDREF), so display names with spaces, URLs, and emails
|
|
637
642
|
* all work; `getRowId` controls the value.
|
|
638
643
|
*
|
|
@@ -641,13 +646,13 @@ declare function ControlCell({ "data-slot": dataSlot, children, className, onCli
|
|
|
641
646
|
* <DataTable.RowExpandButton row={row} label={row.original.name} />
|
|
642
647
|
* // ...renders aria-controls={expandedRowId(row)} while expanded, and
|
|
643
648
|
* <DataTable.ExpandedRow row={row}>...</DataTable.ExpandedRow>
|
|
644
|
-
* // ...renders id={expandedRowId(row)}
|
|
649
|
+
* // ...renders id={expandedRowId(row)}, the same value, so they stay associated.
|
|
645
650
|
* ```
|
|
646
651
|
*/
|
|
647
|
-
declare function expandedRowId<TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>): string;
|
|
652
|
+
declare function expandedRowId<TFeatures extends TableFeatures, TData extends RowData>(row: Row$1<TFeatures, TData>): string;
|
|
648
653
|
type DataTableExpandHeaderProps = Omit<ComponentProps<typeof Table$1.Header>, "children"> & {
|
|
649
654
|
/**
|
|
650
|
-
* Optional header content
|
|
655
|
+
* Optional header content, e.g. an "expand all" toggle wired to
|
|
651
656
|
* `table.getToggleAllRowsExpandedHandler()`. Defaults to a screen-reader-only
|
|
652
657
|
* label so the column is announced while staying visually empty.
|
|
653
658
|
*/
|
|
@@ -677,13 +682,13 @@ type DataTableExpandHeaderProps = Omit<ComponentProps<typeof Table$1.Header>, "c
|
|
|
677
682
|
declare function ExpandHeader({ "data-slot": dataSlot, children, className, ...props }: DataTableExpandHeaderProps): import("react").JSX.Element;
|
|
678
683
|
type DataTableRowExpandButtonProps<TFeatures extends ExpandableTableFeatures, TData extends RowData> = Omit<ComponentProps<typeof IconButton>, "appearance" | "aria-controls" | "aria-expanded" | "icon" | "intent" | "label"> & {
|
|
679
684
|
/**
|
|
680
|
-
* The visual style of the expand toggle. Optional
|
|
685
|
+
* The visual style of the expand toggle. Optional: the row expand button's
|
|
681
686
|
* design is a ghost button, so the wrapper defaults it.
|
|
682
687
|
* @default "ghost"
|
|
683
688
|
*/
|
|
684
689
|
appearance?: IconButtonAppearance;
|
|
685
690
|
/**
|
|
686
|
-
* The tone of the expand toggle. Optional
|
|
691
|
+
* The tone of the expand toggle. Optional: the row expand button's design
|
|
687
692
|
* is neutral-toned, so the wrapper defaults it, and it is the only tone
|
|
688
693
|
* `IconButton` draws.
|
|
689
694
|
* @default "neutral"
|
|
@@ -757,7 +762,7 @@ type DataTableRowExpandButtonProps<TFeatures extends ExpandableTableFeatures, TD
|
|
|
757
762
|
declare function RowExpandButton<TFeatures extends ExpandableTableFeatures, TData extends RowData>({ "data-slot": dataSlot, appearance, className, collapseIcon, expandIcon, intent, label, onClick, row, size, ...props }: DataTableRowExpandButtonProps<TFeatures, TData>): import("react").JSX.Element;
|
|
758
763
|
type DataTableExpandedRowProps<TFeatures extends TableFeatures, TData extends RowData> = Omit<ComponentProps<typeof Table$1.Row>, "children"> & {
|
|
759
764
|
/** The row whose detail panel this displays. */
|
|
760
|
-
row: Row<TFeatures, TData>;
|
|
765
|
+
row: Row$1<TFeatures, TData>;
|
|
761
766
|
/**
|
|
762
767
|
* Override the cell's `colSpan`. Defaults to the row's visible-cell count so
|
|
763
768
|
* the panel spans every visible column (visibility- and pinning-aware).
|
|
@@ -769,10 +774,10 @@ type DataTableExpandedRowProps<TFeatures extends TableFeatures, TData extends Ro
|
|
|
769
774
|
/**
|
|
770
775
|
* The sibling `<tr>` that renders a row's expanded detail panel. For the common
|
|
771
776
|
* case, prefer `DataTable.Row`'s `renderExpanded` prop, which renders this for
|
|
772
|
-
* you. Reach for `ExpandedRow` directly when you need full control
|
|
777
|
+
* you. Reach for `ExpandedRow` directly when you need full control: a custom
|
|
773
778
|
* `colSpan`, multiple panels, or bespoke markup. Render it directly after the
|
|
774
|
-
* parent `DataTable.Row
|
|
775
|
-
* between `<tbody>` and `<tr>` is invalid HTML)
|
|
779
|
+
* parent `DataTable.Row`, wrapped in a `Fragment` and never a DOM element (a node
|
|
780
|
+
* between `<tbody>` and `<tr>` is invalid HTML). Render it only when
|
|
776
781
|
* `row.getIsExpanded()` is true.
|
|
777
782
|
*
|
|
778
783
|
* The single cell spans every visible column (override with `colSpan`), carries
|
|
@@ -788,8 +793,8 @@ type DataTableExpandedRowProps<TFeatures extends TableFeatures, TData extends Ro
|
|
|
788
793
|
*
|
|
789
794
|
* @example
|
|
790
795
|
* Render the row's underlying object as JSON (a common detail-panel use case).
|
|
791
|
-
* `jsonCodeBlockValue` highlights the JSON entirely on the client
|
|
792
|
-
* runtime, no build-time plugin, no server roundtrip
|
|
796
|
+
* `jsonCodeBlockValue` highlights the JSON entirely on the client (no Shiki
|
|
797
|
+
* runtime, no build-time plugin, no server roundtrip), so it works for runtime
|
|
793
798
|
* data and matches server/build-time highlighting:
|
|
794
799
|
* ```tsx
|
|
795
800
|
* import { CodeBlock, jsonCodeBlockValue } from "@ngrok/mantle/code-block";
|
|
@@ -814,7 +819,7 @@ type DataTableExpandedRowProps<TFeatures extends TableFeatures, TData extends Ro
|
|
|
814
819
|
*/
|
|
815
820
|
declare function ExpandedRow<TFeatures extends TableFeatures, TData extends RowData>({ "data-slot": dataSlot, children, className, colSpan, row, ...props }: DataTableExpandedRowProps<TFeatures, TData>): import("react").JSX.Element;
|
|
816
821
|
/**
|
|
817
|
-
* Use `DataTable` for INTERACTIVE tabular data
|
|
822
|
+
* Use `DataTable` for INTERACTIVE tabular data: sorting, filtering, pagination,
|
|
818
823
|
* row selection, and server-side or client-side data. Built on TanStack Table;
|
|
819
824
|
* the consumer MUST construct a `useTable` instance from
|
|
820
825
|
* `@tanstack/react-table` and pass it to `DataTable.Root` via the `table` prop.
|
|
@@ -826,6 +831,24 @@ declare function ExpandedRow<TFeatures extends TableFeatures, TData extends RowD
|
|
|
826
831
|
* For STATIC, layout-driven tables (read-only data dumps, simple key/value
|
|
827
832
|
* displays, plain markup tables with no interactivity), use `Table` instead.
|
|
828
833
|
*
|
|
834
|
+
* **Large lists.** Each rendered row costs mount and layout time, so a table
|
|
835
|
+
* that renders every row of a large list blocks input while it mounts:
|
|
836
|
+
* - Paginate a list that can grow past 100 rows, and show 100 rows or fewer on
|
|
837
|
+
* a page. Register `rowPaginationFeature` and compose `CursorPagination` with
|
|
838
|
+
* `PaginationRange` under the table, as the paginated example below shows.
|
|
839
|
+
* - Search and filter the whole list, not the current page. The count line
|
|
840
|
+
* reads `getRowCount()`, which counts every row the filter keeps.
|
|
841
|
+
* - Keep `autoResetPageIndex` at its default, so a new filter, sort, or data
|
|
842
|
+
* set returns the table to its first page.
|
|
843
|
+
* - Paginate before you virtualize. A page of 100 rows mounts fast, and the
|
|
844
|
+
* browser's find in page still sees every row on it.
|
|
845
|
+
*
|
|
846
|
+
* @useWhen Show rows of application data that the user sorts, filters, pages through, or selects.
|
|
847
|
+
*
|
|
848
|
+
* @siblings
|
|
849
|
+
* - `Table`: the data is static, with no sorting, filtering, pagination, or selection.
|
|
850
|
+
* - `DescriptionList`: one record shows as label and value pairs.
|
|
851
|
+
*
|
|
829
852
|
* @see https://mantle.ngrok.com/components/data-display/data-table
|
|
830
853
|
*
|
|
831
854
|
* @example
|
|
@@ -849,7 +872,7 @@ declare function ExpandedRow<TFeatures extends TableFeatures, TData extends RowD
|
|
|
849
872
|
* ```
|
|
850
873
|
*
|
|
851
874
|
* @example
|
|
852
|
-
*
|
|
875
|
+
* A minimal, read-only table with a single sortable column:
|
|
853
876
|
* ```tsx
|
|
854
877
|
* import {
|
|
855
878
|
* DataTable,
|
|
@@ -910,7 +933,7 @@ declare function ExpandedRow<TFeatures extends TableFeatures, TData extends RowD
|
|
|
910
933
|
* ```
|
|
911
934
|
*
|
|
912
935
|
* @example
|
|
913
|
-
* Sortable, filterable, paginated, with both empty states
|
|
936
|
+
* Sortable, filterable, paginated, with both empty states: a global text
|
|
914
937
|
* filter, the no-data vs. no-results-for-filter empty states (an `Empty`
|
|
915
938
|
* dropped into `DataTable.EmptyRow`), and `CursorPagination` with a page-size
|
|
916
939
|
* dropdown:
|
|
@@ -932,7 +955,7 @@ declare function ExpandedRow<TFeatures extends TableFeatures, TData extends RowD
|
|
|
932
955
|
* useTable,
|
|
933
956
|
* } from "@ngrok/mantle/data-table";
|
|
934
957
|
* import { Button } from "@ngrok/mantle/button";
|
|
935
|
-
* import { CursorPagination } from "@ngrok/mantle/pagination";
|
|
958
|
+
* import { CursorPagination, PaginationRange } from "@ngrok/mantle/pagination";
|
|
936
959
|
* import { Empty } from "@ngrok/mantle/empty";
|
|
937
960
|
* import { Input } from "@ngrok/mantle/input";
|
|
938
961
|
* import { MagnifyingGlassIcon } from "@phosphor-icons/react/MagnifyingGlass";
|
|
@@ -1034,7 +1057,7 @@ declare function ExpandedRow<TFeatures extends TableFeatures, TData extends RowD
|
|
|
1034
1057
|
* {rows.length > 0 ? (
|
|
1035
1058
|
* rows.map((row) => <DataTable.Row key={row.id} row={row} />)
|
|
1036
1059
|
* ) : isFiltered ? (
|
|
1037
|
-
* // No results for the active filter
|
|
1060
|
+
* // No results for the active filter: give the user a way out.
|
|
1038
1061
|
* <DataTable.EmptyRow>
|
|
1039
1062
|
* <Empty.Root>
|
|
1040
1063
|
* <Empty.Icon svg={<MagnifyingGlassIcon />} />
|
|
@@ -1055,7 +1078,7 @@ declare function ExpandedRow<TFeatures extends TableFeatures, TData extends RowD
|
|
|
1055
1078
|
* </Empty.Root>
|
|
1056
1079
|
* </DataTable.EmptyRow>
|
|
1057
1080
|
* ) : (
|
|
1058
|
-
* // No data yet
|
|
1081
|
+
* // No data yet: informational, optionally a primary "create" action.
|
|
1059
1082
|
* <DataTable.EmptyRow>
|
|
1060
1083
|
* <Empty.Root>
|
|
1061
1084
|
* <Empty.Icon svg={<TrayIcon />} />
|
|
@@ -1069,20 +1092,28 @@ declare function ExpandedRow<TFeatures extends TableFeatures, TData extends RowD
|
|
|
1069
1092
|
* </DataTable.Body>
|
|
1070
1093
|
* </DataTable.Root>
|
|
1071
1094
|
* <CursorPagination.Root
|
|
1072
|
-
* className="flex justify-
|
|
1095
|
+
* className="flex flex-wrap justify-between"
|
|
1073
1096
|
* pageSize={table.state.pagination.pageSize}
|
|
1074
1097
|
* onChangePageSize={(size) => {
|
|
1075
1098
|
* table.setPageSize(size);
|
|
1076
1099
|
* table.setPageIndex(0); // reset to the first page when the size changes
|
|
1077
1100
|
* }}
|
|
1078
1101
|
* >
|
|
1079
|
-
* <
|
|
1080
|
-
*
|
|
1081
|
-
*
|
|
1082
|
-
*
|
|
1083
|
-
*
|
|
1084
|
-
* onNextPage={() => table.nextPage()}
|
|
1102
|
+
* <PaginationRange
|
|
1103
|
+
* offset={table.state.pagination.pageIndex * table.state.pagination.pageSize}
|
|
1104
|
+
* pageSize={table.state.pagination.pageSize}
|
|
1105
|
+
* total={table.getRowCount()}
|
|
1106
|
+
* noun={{ singular: "payment", plural: "payments" }}
|
|
1085
1107
|
* />
|
|
1108
|
+
* <div className="flex items-center gap-2">
|
|
1109
|
+
* <CursorPagination.PageSizeSelect />
|
|
1110
|
+
* <CursorPagination.Buttons
|
|
1111
|
+
* hasPreviousPage={table.getCanPreviousPage()}
|
|
1112
|
+
* hasNextPage={table.getCanNextPage()}
|
|
1113
|
+
* onPreviousPage={() => table.previousPage()}
|
|
1114
|
+
* onNextPage={() => table.nextPage()}
|
|
1115
|
+
* />
|
|
1116
|
+
* </div>
|
|
1086
1117
|
* </CursorPagination.Root>
|
|
1087
1118
|
* </div>
|
|
1088
1119
|
* );
|
|
@@ -1090,7 +1121,7 @@ declare function ExpandedRow<TFeatures extends TableFeatures, TData extends RowD
|
|
|
1090
1121
|
* ```
|
|
1091
1122
|
*
|
|
1092
1123
|
* @example
|
|
1093
|
-
* Row action column
|
|
1124
|
+
* Row action column: a sticky right-edge cell with a dropdown menu of actions.
|
|
1094
1125
|
* The cell stops its own clicks, so the menu opens without a clickable row
|
|
1095
1126
|
* navigating:
|
|
1096
1127
|
* ```tsx
|
|
@@ -1177,7 +1208,7 @@ declare const DataTable: {
|
|
|
1177
1208
|
/**
|
|
1178
1209
|
* The root container of the data table component. REQUIRED: pass a
|
|
1179
1210
|
* `useTable` instance (from `@tanstack/react-table`, also re-exported
|
|
1180
|
-
* from `@ngrok/mantle/data-table`) via the `table` prop
|
|
1211
|
+
* from `@ngrok/mantle/data-table`) via the `table` prop. Every other
|
|
1181
1212
|
* `DataTable.*` part reads from it through context.
|
|
1182
1213
|
*
|
|
1183
1214
|
* @see https://mantle.ngrok.com/components/data-display/data-table#datatableroot
|
|
@@ -1321,7 +1352,7 @@ declare const DataTable: {
|
|
|
1321
1352
|
* branch when `rows.length === 0` to keep the table's frame intact instead
|
|
1322
1353
|
* of collapsing to an empty `<tbody>`.
|
|
1323
1354
|
*
|
|
1324
|
-
* Drop an `Empty` in as the child for a real empty state
|
|
1355
|
+
* Drop an `Empty` in as the child for a real empty state: `EmptyRow` spans
|
|
1325
1356
|
* every column and `Empty.Root` centers itself, so no `<td>` or centering
|
|
1326
1357
|
* markup is needed.
|
|
1327
1358
|
*
|
|
@@ -1345,7 +1376,7 @@ declare const DataTable: {
|
|
|
1345
1376
|
readonly EmptyRow: typeof EmptyRow;
|
|
1346
1377
|
/**
|
|
1347
1378
|
* The `<thead>` container that renders column headers automatically from
|
|
1348
|
-
* `table.getHeaderGroups()`. Does not accept children
|
|
1379
|
+
* `table.getHeaderGroups()`. Does not accept children: the headers come from
|
|
1349
1380
|
* each column's `header` definition.
|
|
1350
1381
|
*
|
|
1351
1382
|
* @see https://mantle.ngrok.com/components/data-display/data-table#datatablehead
|
|
@@ -1449,7 +1480,7 @@ declare const DataTable: {
|
|
|
1449
1480
|
readonly HeaderSortButton: typeof HeaderSortButton;
|
|
1450
1481
|
/**
|
|
1451
1482
|
* A single data table body row rendered from a TanStack Table row instance.
|
|
1452
|
-
* Does not accept children
|
|
1483
|
+
* Does not accept children: cells come from each column's `cell` definition.
|
|
1453
1484
|
*
|
|
1454
1485
|
* When `onClick` is set, the row receives `cursor-pointer` and `data-clickable`.
|
|
1455
1486
|
* It runs the handler only for a plain primary click: a modified click, a
|
|
@@ -1458,7 +1489,7 @@ declare const DataTable: {
|
|
|
1458
1489
|
* cursor. A `<tr>` is not focusable, so also render a `<Link>` inside the
|
|
1459
1490
|
* primary cell as the keyboard and screen-reader path.
|
|
1460
1491
|
*
|
|
1461
|
-
* Pass `renderExpanded` to give the row an inline detail panel
|
|
1492
|
+
* Pass `renderExpanded` to give the row an inline detail panel: the row then
|
|
1462
1493
|
* renders a sibling `DataTable.ExpandedRow` (only while expanded) holding the
|
|
1463
1494
|
* returned content. Pair with `DataTable.RowExpandButton`.
|
|
1464
1495
|
*
|
|
@@ -1484,7 +1515,7 @@ declare const DataTable: {
|
|
|
1484
1515
|
* ))}
|
|
1485
1516
|
* ```
|
|
1486
1517
|
*/
|
|
1487
|
-
readonly Row: typeof Row
|
|
1518
|
+
readonly Row: typeof Row;
|
|
1488
1519
|
/**
|
|
1489
1520
|
* A narrow `<th>` for the leading expand-toggle column, mirroring
|
|
1490
1521
|
* `DataTable.ActionHeader`. Renders a screen-reader-only label by default so
|
package/dist/data-table.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./button-Dge0D5bl.js";import{t as r}from"./button-B8k98Pby.js";import{t as i}from"./use-prefers-reduced-motion-CU6mWmOe.js";import{t as a}from"./icons-CDLz5lpI.js";import{n as o}from"./sandboxed-on-click-C7pPu-2M.js";import{t as s}from"./table-CFHiDBW8.js";import{c}from"react/compiler-runtime";import{Fragment as l,createContext as u,useContext as d,useEffect as f,useRef as p,useState as m}from"react";import h from"tiny-invariant";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import{Subscribe as y,callMemoOrStaticFn as b,flexRender as x}from"@tanstack/react-table";import{MinusIcon as S}from"@phosphor-icons/react/Minus";import{PlusIcon as C}from"@phosphor-icons/react/Plus";import{column_getIsSorted as w,row_getIsExpanded as T,row_getVisibleCells as E,table_getVisibleLeafColumns as D}from"@tanstack/react-table/static-functions";export*from"@tanstack/react-table";const O=[`unsorted`,`asc`,`desc`],k=[`unsorted`,`desc`,`asc`];function A(e,t){return j(t===`alphanumeric`?O:k,e)??`unsorted`}function j(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}function M(e){if(typeof e==`object`&&e&&`width`in e)return e.width===`fit`?`fit`:void 0}const N=u(null);function P(){return d(N)?.table.options}function F(){let e=d(N);return h(e,`useDataTableContext should only be used within a DataTable child component`),e}const I=u(null),L=/* @__PURE__ */ new Set;function R(e){return[...e.querySelectorAll(`:scope > tr`)]}function ee(e){let[,t=`0px`]=getComputedStyle(e).translate.split(` `);return e.offsetTop+(Number.parseFloat(t)||0)}function te(e,t,n){let r=/* @__PURE__ */ new Map,i=0,a=0;for(let o of R(e)){o.hasAttribute(`data-closing`)?a+=o.offsetHeight:(i+=a,a=0);let e=-i,s=t.get(o),c=s==null||Math.abs(s-o.offsetTop-e)<.5?e:s-o.offsetTop;r.set(o,o.offsetTop+e);let l=n.get(o);if(c!==e||(l?.to??0)!==e){if(n.delete(o),c!==e||e!==0){let t=o.animate([{translate:`0 ${c}px`},{translate:`0 ${e}px`}],{duration:c===e?0:200,easing:`cubic-bezier(0.23, 1, 0.32, 1)`,fill:e===0?`none`:`forwards`});n.set(o,{animation:t,to:e})}l?.animation.cancel()}}return r}function ne(){let e=c(14),[t,n]=m(L),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=/* @__PURE__ */ new Map,e[0]=r):r=e[0];let a=p(r),o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=/* @__PURE__ */ new Map,e[1]=o):o=e[1];let s=p(o),l;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=/* @__PURE__ */ new WeakMap,e[2]=l):l=e[2];let u=p(l),d,h;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{let e=a.current,t=s.current;return()=>{for(let{timer:t}of e.values())clearTimeout(t);for(let{observer:e}of t.values())e.disconnect()}},h=[],e[3]=d,e[4]=h):(d=e[3],h=e[4]),f(d,h);let g;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{n(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},e[5]=g):g=e[5];let _=g,v;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{let t=s.current.get(e);if(t!=null&&t.before==null){for(let t of a.current.values())if(t.body===e)return;t.observer.disconnect(),s.current.delete(e)}},e[6]=v):v=e[6];let y=v,b;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=(e,t)=>{let n=s.current.get(e),r=t.filter(t=>t.type===`childList`?t.target===e:t.target.parentNode===e);if(n==null||r.length===0)return;let i=n.awaiting==null?null:a.current.get(n.awaiting);for(let e of r){let{target:t}=e;i!=null&&e.type===`attributes`&&t instanceof Element&&t.hasAttribute(`data-closing`)&&i.rows.add(t)}i!=null&&i.rows.size>0&&(n.awaiting=null);for(let[t,n]of a.current)n.body===e&&n.rows.size>0&&![...n.rows].some(ie)&&(clearTimeout(n.timer),a.current.delete(t),_(t));let o=n.before??n.rest;n.before=null,n.rest=te(e,o,u.current),y(e)},e[7]=b):b=e[7];let x=b,S;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{let t=s.current.get(e);if(t==null){let n=new MutationObserver(t=>x(e,t));n.observe(e,{attributeFilter:[`data-closing`],childList:!0,subtree:!0}),t={observer:n,before:null,rest:/* @__PURE__ */ new Map,awaiting:null},s.current.set(e,t)}if(t.before==null){let n=new Map(R(e).map(re));t.before=n;let r=t;requestAnimationFrame(()=>{r.before===n&&(r.before=null,y(e))})}return t},e[8]=S):S=e[8];let C=S,w;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(w=(e,t)=>{e!=null&&!i()&&C(e),t()},e[9]=w):w=e[9];let T=w,E;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{let t=a.current.get(e);t!=null&&(clearTimeout(t.timer),a.current.delete(e),C(t.body)),_(e)},e[10]=E):E=e[10];let D=E,O;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(O=(e,t,r)=>{t==null||i()?r():(D(e),C(t).awaiting=e,a.current.set(e,{body:t,rows:/* @__PURE__ */ new Set,timer:setTimeout(()=>{a.current.delete(e),C(t),_(e),r()},200)}),n(t=>new Set(t).add(e)))},e[11]=O):O=e[11];let k=O,A;return e[12]===t?A=e[13]:(A={closingRowIds:t,startExpand:T,startCollapse:k,cancelCollapse:D},e[12]=t,e[13]=A),A}function re(e){return[e,ee(e)]}function ie(e){return e.isConnected}function ae(e){let n=c(21),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({"data-slot":i,children:r,table:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let l;n[5]===o?l=n[6]:(l={table:o},n[5]=o,n[6]=l);let u=l,d=ne(),f;n[7]===i?f=n[8]:(f=t(i,`data-table`),n[7]=i,n[8]=f);let p;n[9]===r?p=n[10]:(p=/* @__PURE__ */ _(s.Element,{children:r}),n[9]=r,n[10]=p);let m;n[11]!==a||n[12]!==f||n[13]!==p?(m=/* @__PURE__ */ _(s.Root,{"data-slot":f,...a,children:p}),n[11]=a,n[12]=f,n[13]=p,n[14]=m):m=n[14];let h;n[15]!==d||n[16]!==m?(h=/* @__PURE__ */ _(I.Provider,{value:d,children:m}),n[15]=d,n[16]=m,n[17]=h):h=n[17];let g;return n[18]!==u||n[19]!==h?(g=/* @__PURE__ */ _(N.Provider,{value:u,children:h}),n[18]=u,n[19]=h,n[20]=g):g=n[20],g}function oe(r){let i=c(33),a,o,s,l,u,d,f,p,m,h,g,v;i[0]===r?(a=i[1],o=i[2],s=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],v=i[12]):({"data-slot":l,appearance:m,children:a,className:o,column:s,disableSorting:h,iconPlacement:g,intent:v,sortingMode:p,sortIcon:d,onClick:u,...f}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=l,i[5]=u,i[6]=d,i[7]=f,i[8]=p,i[9]=m,i[10]=h,i[11]=g,i[12]=v);let b=m===void 0?`ghost`:m,x=h!==void 0&&h,S=g===void 0?`end`:g,C=v===void 0?`neutral`:v,w;i[13]!==b||i[14]!==a||i[15]!==o||i[16]!==s||i[17]!==l||i[18]!==x||i[19]!==S||i[20]!==C||i[21]!==u||i[22]!==d||i[23]!==f||i[24]!==p?(w=()=>{let r=s.getIsSorted(),i=!x&&s.getCanSort(),c=i&&typeof r==`string`?r:`unsorted`;if(!i)return/* @__PURE__ */ _(`span`,{"data-slot":t(l,`data-table-header-sort-button`),"data-sort-direction":`unsorted`,className:e(`flex w-full items-center justify-start`,b===`ghost`&&C===`neutral`&&`text-muted`,o),...f,children:a});let m=d?.(c)??/* @__PURE__ */ _(ye,{mode:p,direction:c});return/* @__PURE__ */ _(n,{appearance:b,"data-slot":t(l,`data-table-header-sort-button`),className:e(`flex justify-start w-full h-full rounded-none not-disabled:active:scale-none`,b===`ghost`&&C===`neutral`&&`text-muted`,o),"data-sort-direction":c,"data-table-header-action":!0,icon:m,iconPlacement:S,onClick:e=>{u?.(e),!e.defaultPrevented&&p!==void 0&&be(s,p)},intent:C,type:`button`,...f,children:a})},i[13]=b,i[14]=a,i[15]=o,i[16]=s,i[17]=l,i[18]=x,i[19]=S,i[20]=C,i[21]=u,i[22]=d,i[23]=f,i[24]=p,i[25]=w):w=i[25];let T=w,E=P(),D;i[26]!==s||i[27]!==E?(D=()=>({sorted:s.getIsSorted(),options:E}),i[26]=s,i[27]=E,i[28]=D):D=i[28];let O;return i[29]!==s.table.store||i[30]!==T||i[31]!==D?(O=/* @__PURE__ */ _(y,{source:s.table.store,selector:D,children:T}),i[29]=s.table.store,i[30]=T,i[31]=D,i[32]=O):O=i[32],O}const z=`w-px whitespace-nowrap`;function B(e){if(e==null)return;let t=b(e,`getIsSorted`,w);if(t===`asc`)return`ascending`;if(t===`desc`)return`descending`}function V(n){let r=c(21),i,a,o,l,u;r[0]===n?(i=r[1],a=r[2],o=r[3],l=r[4],u=r[5]):({"data-slot":l,children:i,className:a,column:o,...u}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=l,r[5]=u);let d;r[6]!==i||r[7]!==a||r[8]!==o||r[9]!==l||r[10]!==u?(d=()=>{let n=M(o?.columnDef.meta);return/* @__PURE__ */ _(s.Header,{"aria-sort":B(o),"data-column-width":n,"data-slot":t(l,`data-table-header`),className:e(`has-data-table-header-action:px-0`,n===`fit`&&z,a),...u,children:i})},r[6]=i,r[7]=a,r[8]=o,r[9]=l,r[10]=u,r[11]=d):d=r[11];let f=d,p=P();if(o==null){let e;return r[12]===f?e=r[13]:(e=f(),r[12]=f,r[13]=e),e}let m;r[14]!==o||r[15]!==p?(m=()=>({ariaSort:B(o),options:p}),r[14]=o,r[15]=p,r[16]=m):m=r[16];let h;return r[17]!==o.table.store||r[18]!==f||r[19]!==m?(h=/* @__PURE__ */ _(y,{source:o.table.store,selector:m,children:f}),r[17]=o.table.store,r[18]=f,r[19]=m,r[20]=h):h=r[20],h}function H(n){let r=c(17),i,a,o,l;r[0]===n?(i=r[1],a=r[2],o=r[3],l=r[4]):({"data-slot":o,className:i,column:a,...l}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=l);let u=a?.columnDef.meta,d;r[5]===u?d=r[6]:(d=M(u),r[5]=u,r[6]=d);let f=d,p;r[7]===o?p=r[8]:(p=t(o,`data-table-cell`),r[7]=o,r[8]=p);let m=f===`fit`&&z,h;r[9]!==i||r[10]!==m?(h=e(m,i),r[9]=i,r[10]=m,r[11]=h):h=r[11];let g;return r[12]!==l||r[13]!==p||r[14]!==h||r[15]!==f?(g=/* @__PURE__ */ _(s.Cell,{"data-column-width":f,"data-slot":p,className:h,...l}),r[12]=l,r[13]=p,r[14]=h,r[15]=f,r[16]=g):g=r[16],g}const U=e=>{let n=c(8),r,i;n[0]===e?(r=n[1],i=n[2]):({"data-slot":r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=t(r,`data-table-body`),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==a?(o=/* @__PURE__ */ _(s.Body,{"data-slot":a,...i}),n[5]=i,n[6]=a,n[7]=o):o=n[7],o};function W(e){let n=c(11),r,i;n[0]===e?(r=n[1],i=n[2]):({"data-slot":r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let{table:a}=F(),o;n[3]===r?o=n[4]:(o=t(r,`data-table-head`),n[3]=r,n[4]=o);let l;n[5]===a?l=n[6]:(l=a.getHeaderGroups().map(G),n[5]=a,n[6]=l);let u;return n[7]!==i||n[8]!==o||n[9]!==l?(u=/* @__PURE__ */ _(s.Head,{"data-slot":o,...i,children:l}),n[7]=i,n[8]=o,n[9]=l,n[10]=u):u=n[10],u}function G(e){return/* @__PURE__ */ _(s.Row,{children:e.headers.map(K)},e.id)}function K(e){return/* @__PURE__ */ _(l,{children:e.isPlaceholder?/* @__PURE__ */ _(s.Header,{}):x(e.column.columnDef.header,e.getContext())},e.id)}const q=e(`starting:-translate-y-1 starting:opacity-0`,`motion-safe:transition-[opacity,translate] motion-safe:duration-200 motion-safe:ease-out-strong`,`data-closing:pointer-events-none data-closing:opacity-0 motion-safe:data-closing:duration-150`);function J(e,t){return t.size===0||e.depth===0?!1:e.getParentRows().some(e=>t.has(e.id))}const Y=u(!1);function se(e){if(e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return!1;let t=e.currentTarget.ownerDocument.getSelection();return t==null||t.isCollapsed?!0:!e.currentTarget.contains(t.anchorNode)}function ce(n){let r=c(21),i,a,o,l,u,f;r[0]===n?(i=r[1],a=r[2],o=r[3],l=r[4],u=r[5],f=r[6]):({"data-slot":a,className:i,onClick:o,renderExpanded:u,row:f,...l}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=l,r[5]=u,r[6]=f);let p=d(I)?.closingRowIds??L,m;r[7]!==i||r[8]!==p||r[9]!==a||r[10]!==o||r[11]!==l||r[12]!==u||r[13]!==f?(m=()=>{let n=J(f,p),r=b(f,`getIsExpanded`,T),c=b(f,`getVisibleCells`,E),d=/* @__PURE__ */ _(s.Row,{"data-slot":t(a,`data-table-row`),"data-expanded":r||void 0,"data-closing":n||void 0,inert:n||void 0,"data-clickable":o==null?void 0:``,className:e(f.depth>0&&q,o!=null&&`cursor-pointer`,i),onClick:o&&(e=>{se(e)&&o(e)}),...l,children:/* @__PURE__ */ _(Y.Provider,{value:u!=null,children:c.map(le)})});return u==null?d:/* @__PURE__ */ v(g,{children:[d,r&&/* @__PURE__ */ _($,{row:f,children:u(f)})]})},r[7]=i,r[8]=p,r[9]=a,r[10]=o,r[11]=l,r[12]=u,r[13]=f,r[14]=m):m=r[14];let h=m,x=P(),S;r[15]===x?S=r[16]:(S=e=>({state:e,options:x}),r[15]=x,r[16]=S);let C;return r[17]!==h||r[18]!==f.table.store||r[19]!==S?(C=/* @__PURE__ */ _(y,{source:f.table.store,selector:S,children:h}),r[17]=h,r[18]=f.table.store,r[19]=S,r[20]=C):C=r[20],C}function le(e){return/* @__PURE__ */ _(l,{children:x(e.column.columnDef.cell,e.getContext())},e.id)}function ue(e){let n=c(15),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({"data-slot":i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let{table:o}=F(),l;n[4]===o?l=n[5]:(l=b(o,`getVisibleLeafColumns`,D),n[4]=o,n[5]=l);let u=l.length,d;n[6]===i?d=n[7]:(d=t(i,`data-table-empty-row`),n[6]=i,n[7]=d);let f;n[8]!==r||n[9]!==u?(f=/* @__PURE__ */ _(s.Cell,{colSpan:u,children:r}),n[8]=r,n[9]=u,n[10]=f):f=n[10];let p;return n[11]!==a||n[12]!==d||n[13]!==f?(p=/* @__PURE__ */ _(s.Row,{"data-slot":d,...a,children:f}),n[11]=a,n[12]=d,n[13]=f,n[14]=p):p=n[14],p}function X(){let t=c(1),n;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=/* @__PURE__ */ _(`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)]`)}),t[0]=n):n=t[0],n}function de(n){let r=c(21),i,a,l,u,d;r[0]===n?(i=r[1],a=r[2],l=r[3],u=r[4],d=r[5]):({"data-slot":l,children:i,className:a,onClick:u,...d}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=l,r[4]=u,r[5]=d);let f;r[6]===u?f=r[7]:(f=o({allowClickEventDefault:!0,onClick:u}),r[6]=u,r[7]=f);let{onClick:p}=f,m;r[8]===l?m=r[9]:(m=t(l,`data-table-action-cell`),r[8]=l,r[9]=m);let h;r[10]===a?h=r[11]:(h=e(`sticky z-10 right-0 text-end align-middle bg-inherit p-2`,a),r[10]=a,r[11]=h);let g;r[12]===Symbol.for(`react.memo_cache_sentinel`)?(g=/* @__PURE__ */ _(X,{}),r[12]=g):g=r[12];let y;r[13]===i?y=r[14]:(y=/* @__PURE__ */ _(`span`,{"data-slot":`data-table-action-cell-label`,className:`contents`,children:i}),r[13]=i,r[14]=y);let b;return r[15]!==d||r[16]!==p||r[17]!==m||r[18]!==h||r[19]!==y?(b=/* @__PURE__ */ v(s.Cell,{"data-mantle-table-sticky-right":!0,"data-slot":m,className:h,onClick:p,...d,children:[g,y]}),r[15]=d,r[16]=p,r[17]=m,r[18]=h,r[19]=y,r[20]=b):b=r[20],b}function fe(n){let r=c(27),i,a,o,l;r[0]===n?(i=r[1],a=r[2],o=r[3],l=r[4]):({"data-slot":o,children:i,className:a,...l}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=l);let{table:u}=F(),d;r[5]===u?d=r[6]:(d=u.getRowModel(),r[5]=u,r[6]=d);let f=d.rows.length>0,p;r[7]===f?p=r[8]:(p=f?{"data-mantle-table-sticky-right":!0}:{},r[7]=f,r[8]=p);let m;r[9]===o?m=r[10]:(m=t(o,`data-table-action-header`),r[9]=o,r[10]=m);let h=f&&`sticky z-10 right-0 bg-inherit`,g;r[11]!==a||r[12]!==h?(g=e(h,a),r[11]=a,r[12]=h,r[13]=g):g=r[13];let y;r[14]===i?y=r[15]:(y=i??/* @__PURE__ */ _(`span`,{className:`sr-only`,children:`Actions`}),r[14]=i,r[15]=y);let b;r[16]===y?b=r[17]:(b=/* @__PURE__ */ _(`span`,{"data-slot":`data-table-action-header-label`,className:`contents`,children:y}),r[16]=y,r[17]=b);let x;r[18]===f?x=r[19]:(x=f&&/* @__PURE__ */ _(X,{}),r[18]=f,r[19]=x);let S;return r[20]!==l||r[21]!==p||r[22]!==m||r[23]!==g||r[24]!==b||r[25]!==x?(S=/* @__PURE__ */ v(s.Header,{...p,"data-slot":m,className:g,...l,children:[b,x]}),r[20]=l,r[21]=p,r[22]=m,r[23]=g,r[24]=b,r[25]=x,r[26]=S):S=r[26],S}function pe(e){return e!=null&&`nodeType`in e}function me(n){let r=c(20),i,a,o,l,u;r[0]===n?(i=r[1],a=r[2],o=r[3],l=r[4],u=r[5]):({"data-slot":o,children:i,className:a,onClick:l,...u}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=l,r[5]=u);let d=p(!1),f;r[6]===o?f=r[7]:(f=t(o,`data-table-control-cell`),r[6]=o,r[7]=f);let m;r[8]===a?m=r[9]:(m=e(`w-9 px-0 align-top has-[button:enabled,input:enabled]:cursor-pointer`,a),r[8]=a,r[9]=m);let h;r[10]===l?h=r[11]:(h=e=>{if(d.current){e.stopPropagation();return}l?.(e);let t=e.currentTarget.querySelector(`button:not(:disabled), input:not(:disabled)`);t!=null&&(e.stopPropagation(),!e.defaultPrevented&&pe(e.target)&&!t.contains(e.target)&&(t.focus({preventScroll:!0}),d.current=!0,t.click(),d.current=!1))},r[10]=l,r[11]=h);let g;r[12]===i?g=r[13]:(g=/* @__PURE__ */ _(`span`,{"data-slot":`data-table-control-cell-label`,className:`flex h-lh items-center justify-center`,children:i}),r[12]=i,r[13]=g);let v;return r[14]!==u||r[15]!==f||r[16]!==m||r[17]!==h||r[18]!==g?(v=/* @__PURE__ */ _(s.Cell,{"data-slot":f,className:m,onClick:h,...u,children:g}),r[14]=u,r[15]=f,r[16]=m,r[17]=h,r[18]=g,r[19]=v):v=r[19],v}function Z(e){return`data-table-expanded-row-${encodeURIComponent(e.id)}`}function Q(n){let r=c(16),i,a,o,l;r[0]===n?(i=r[1],a=r[2],o=r[3],l=r[4]):({"data-slot":o,children:i,className:a,...l}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=l);let u;r[5]===o?u=r[6]:(u=t(o,`data-table-expand-header`),r[5]=o,r[6]=u);let d;r[7]===a?d=r[8]:(d=e(`w-9 px-0 text-center`,a),r[7]=a,r[8]=d);let f;r[9]===i?f=r[10]:(f=i??/* @__PURE__ */ _(`span`,{className:`sr-only`,children:`Row details`}),r[9]=i,r[10]=f);let p;return r[11]!==l||r[12]!==u||r[13]!==d||r[14]!==f?(p=/* @__PURE__ */ _(s.Header,{"data-slot":u,className:d,...l,children:f}),r[11]=l,r[12]=u,r[13]=d,r[14]=f,r[15]=p):p=r[15],p}const he=/* @__PURE__ */ _(C,{weight:`bold`,className:`size-3.5`}),ge=/* @__PURE__ */ _(S,{weight:`bold`,className:`size-3.5`});function _e(n){let i=c(21),a,o,s,l,u,f,p,m,h,g,v;i[0]===n?(a=i[1],o=i[2],s=i[3],l=i[4],u=i[5],f=i[6],p=i[7],m=i[8],h=i[9],g=i[10],v=i[11]):({"data-slot":o,appearance:p,className:a,collapseIcon:m,expandIcon:h,intent:g,label:s,onClick:l,row:f,size:v,...u}=n,i[0]=n,i[1]=a,i[2]=o,i[3]=s,i[4]=l,i[5]=u,i[6]=f,i[7]=p,i[8]=m,i[9]=h,i[10]=g,i[11]=v);let b=p===void 0?`ghost`:p,x=m===void 0?ge:m,S=h===void 0?he:h,C=g===void 0?`neutral`:g,w=v===void 0?`sm`:v,T=()=>{if(!f.getCanExpand())return null;let n=f.getIsExpanded()&&!k,i=f.getToggleExpandedHandler(),c=f.subRows.length>0,d=D||!c;return/* @__PURE__ */ _(r,{type:`button`,"data-slot":t(o,`data-table-row-expand-button`),appearance:b,intent:C,size:w,className:e(`rounded`,a),"aria-expanded":n,"aria-controls":n&&d?Z(f):void 0,icon:n?x:S,label:c?`${n?`Collapse`:`Expand`} ${s}`:`${n?`Hide`:`Show`} details for ${s}`,onClick:e=>{if(e.stopPropagation(),l?.(e),e.defaultPrevented)return;let t=e.currentTarget.closest(`tbody`);O==null?i():k?O.cancelCollapse(f.id):n?O.startCollapse(f.id,t,()=>f.toggleExpanded(!1)):O.startExpand(t,i)},...u})},E=P(),D=d(Y),O=d(I),k=O?.closingRowIds.has(f.id)??!1,A;i[12]!==D||i[13]!==k||i[14]!==E||i[15]!==f?(A=()=>({isExpanded:f.getIsExpanded(),hasDetailPanel:D,isClosing:k,options:E}),i[12]=D,i[13]=k,i[14]=E,i[15]=f,i[16]=A):A=i[16];let j;return i[17]!==T||i[18]!==f.table.store||i[19]!==A?(j=/* @__PURE__ */ _(y,{source:f.table.store,selector:A,children:T}),i[17]=T,i[18]=f.table.store,i[19]=A,i[20]=j):j=i[20],j}function $(n){let r=c(29),i,a,o,l,u,f;r[0]===n?(i=r[1],a=r[2],o=r[3],l=r[4],u=r[5],f=r[6]):({"data-slot":l,children:i,className:a,colSpan:o,row:f,...u}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=l,r[5]=u,r[6]=f);let p;r[7]===f?p=r[8]:(p=()=>b(f,`getVisibleCells`,E).length,r[7]=f,r[8]=p);let m=p,h=d(I)?.closingRowIds??L,g;r[9]!==h||r[10]!==f?(g=h.has(f.id)||J(f,h),r[9]=h,r[10]=f,r[11]=g):g=r[11];let v=g,x;r[12]!==i||r[13]!==a||r[14]!==l||r[15]!==v||r[16]!==u||r[17]!==f?(x=n=>{let{numberOfColumns:r}=n;return/* @__PURE__ */ _(s.Row,{"data-slot":t(l,`data-table-expanded-row`),"data-expanded-content":!0,"data-closing":v||void 0,inert:v||void 0,className:e(`[&>td]:border-t-0`,q,a),...u,children:/* @__PURE__ */ _(s.Cell,{id:Z(f),colSpan:r,className:`bg-card font-sans text-body`,children:i})})},r[12]=i,r[13]=a,r[14]=l,r[15]=v,r[16]=u,r[17]=f,r[18]=x):x=r[18];let S=x,C=P();if(o!=null){let e;return r[19]!==o||r[20]!==S?(e=S({numberOfColumns:o}),r[19]=o,r[20]=S,r[21]=e):e=r[21],e}let w;r[22]!==m||r[23]!==C?(w=()=>({numberOfColumns:m(),options:C}),r[22]=m,r[23]=C,r[24]=w):w=r[24];let T;return r[25]!==S||r[26]!==f.table.store||r[27]!==w?(T=/* @__PURE__ */ _(y,{source:f.table.store,selector:w,children:S}),r[25]=S,r[26]=f.table.store,r[27]=w,r[28]=T):T=r[28],T}const ve={Root:ae,ActionCell:de,ActionHeader:fe,Cell:H,Body:U,EmptyRow:ue,Head:W,Header:V,HeaderSortButton:oe,Row:ce,ExpandHeader:Q,ControlCell:me,RowExpandButton:_e,ExpandedRow:$};function ye(e){let t=c(10),n,r,i;if(t[0]===e?(n=t[1],r=t[2],i=t[3]):({direction:n,mode:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i),n===`unsorted`||!r||!n){let e;return t[4]===i?e=t[5]:(e=/* @__PURE__ */ _(`svg`,{"aria-hidden":!0,...i}),t[4]=i,t[5]=e),e}let o;return t[6]!==n||t[7]!==r||t[8]!==i?(o=/* @__PURE__ */ _(a,{mode:r,direction:n,...i}),t[6]=n,t[7]=r,t[8]=i,t[9]=o):o=t[9],o}function be(e,t){if(!e.getCanSort())return;let n=e.getIsSorted();switch(A(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{ve as DataTable,Z as expandedRowId};
|
|
1
|
+
"use client";import{t as e}from"./use-prefers-reduced-motion-Ck6dnOM9.js";import{t}from"./cx-CK7o_rVv.js";import{t as n}from"./data-slot-EM6s2WEU.js";import{t as r}from"./button-DNLTJ32M.js";import{t as i}from"./button-B9bChDgl.js";import{t as a}from"./icons-DEDCLZ8B.js";import{n as o}from"./sandboxed-on-click-D4PL5_GR.js";import{t as s}from"./table-BnLdXUai.js";import{c}from"react/compiler-runtime";import{Fragment as l,createContext as u,useContext as d,useEffect as f,useRef as p,useState as m}from"react";import h from"tiny-invariant";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import{Subscribe as y,callMemoOrStaticFn as b,flexRender as x}from"@tanstack/react-table";import{MinusIcon as S}from"@phosphor-icons/react/Minus";import{PlusIcon as C}from"@phosphor-icons/react/Plus";import{column_getIsSorted as w,row_getIsExpanded as T,row_getVisibleCells as E,table_getVisibleLeafColumns as D}from"@tanstack/react-table/static-functions";export*from"@tanstack/react-table";const O=[`unsorted`,`asc`,`desc`],k=[`unsorted`,`desc`,`asc`];function A(e,t){return j(t===`alphanumeric`?O:k,e)??`unsorted`}function j(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}function M(e){if(typeof e==`object`&&e&&`width`in e)return e.width===`fit`?`fit`:void 0}const N=u(null);function P(){return d(N)?.table.options}function F(){let e=d(N);return h(e,`DataTable parts must be rendered inside DataTable.Root.`),e}const I=u(null),L=/* @__PURE__ */ new Set;function R(e){return[...e.querySelectorAll(`:scope > tr`)]}function ee(e){let[,t=`0px`]=getComputedStyle(e).translate.split(` `);return e.offsetTop+(Number.parseFloat(t)||0)}function te(e,t,n){let r=/* @__PURE__ */ new Map,i=0,a=0;for(let o of R(e)){o.hasAttribute(`data-closing`)?a+=o.offsetHeight:(i+=a,a=0);let e=-i,s=t.get(o),c=s==null||Math.abs(s-o.offsetTop-e)<.5?e:s-o.offsetTop;r.set(o,o.offsetTop+e);let l=n.get(o);if(c!==e||(l?.to??0)!==e){if(n.delete(o),c!==e||e!==0){let t=o.animate([{translate:`0 ${c}px`},{translate:`0 ${e}px`}],{duration:c===e?0:200,easing:`cubic-bezier(0.23, 1, 0.32, 1)`,fill:e===0?`none`:`forwards`});n.set(o,{animation:t,to:e})}l?.animation.cancel()}}return r}function ne(){let t=c(14),[n,r]=m(L),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=/* @__PURE__ */ new Map,t[0]=i):i=t[0];let a=p(i),o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=/* @__PURE__ */ new Map,t[1]=o):o=t[1];let s=p(o),l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=/* @__PURE__ */ new WeakMap,t[2]=l):l=t[2];let u=p(l),d,h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{let e=a.current,t=s.current;return()=>{for(let{timer:t}of e.values())clearTimeout(t);for(let{observer:e}of t.values())e.disconnect()}},h=[],t[3]=d,t[4]=h):(d=t[3],h=t[4]),f(d,h);let g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{r(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},t[5]=g):g=t[5];let _=g,v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{let t=s.current.get(e);if(t!=null&&t.before==null){for(let t of a.current.values())if(t.body===e)return;t.observer.disconnect(),s.current.delete(e)}},t[6]=v):v=t[6];let y=v,b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=(e,t)=>{let n=s.current.get(e),r=t.filter(t=>t.type===`childList`?t.target===e:t.target.parentNode===e);if(n==null||r.length===0)return;let i=n.awaiting==null?null:a.current.get(n.awaiting);for(let e of r){let{target:t}=e;i!=null&&e.type===`attributes`&&t instanceof Element&&t.hasAttribute(`data-closing`)&&i.rows.add(t)}i!=null&&i.rows.size>0&&(n.awaiting=null);for(let[t,n]of a.current)n.body===e&&n.rows.size>0&&![...n.rows].some(ie)&&(clearTimeout(n.timer),a.current.delete(t),_(t));let o=n.before??n.rest;n.before=null,n.rest=te(e,o,u.current),y(e)},t[7]=b):b=t[7];let x=b,S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{let t=s.current.get(e);if(t==null){let n=new MutationObserver(t=>x(e,t));n.observe(e,{attributeFilter:[`data-closing`],childList:!0,subtree:!0}),t={observer:n,before:null,rest:/* @__PURE__ */ new Map,awaiting:null},s.current.set(e,t)}if(t.before==null){let n=new Map(R(e).map(re));t.before=n;let r=t;requestAnimationFrame(()=>{r.before===n&&(r.before=null,y(e))})}return t},t[8]=S):S=t[8];let C=S,w;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(w=(t,n)=>{t!=null&&!e()&&C(t),n()},t[9]=w):w=t[9];let T=w,E;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{let t=a.current.get(e);t!=null&&(clearTimeout(t.timer),a.current.delete(e),C(t.body)),_(e)},t[10]=E):E=t[10];let D=E,O;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(O=(t,n,i)=>{n==null||e()?i():(D(t),C(n).awaiting=t,a.current.set(t,{body:n,rows:/* @__PURE__ */ new Set,timer:setTimeout(()=>{a.current.delete(t),C(n),_(t),i()},200)}),r(e=>new Set(e).add(t)))},t[11]=O):O=t[11];let k=O,A;return t[12]===n?A=t[13]:(A={closingRowIds:n,startExpand:T,startCollapse:k,cancelCollapse:D},t[12]=n,t[13]=A),A}function re(e){return[e,ee(e)]}function ie(e){return e.isConnected}function ae(e){let t=c(21),r,i,a,o;t[0]===e?(r=t[1],i=t[2],a=t[3],o=t[4]):({"data-slot":i,children:r,table:o,...a}=e,t[0]=e,t[1]=r,t[2]=i,t[3]=a,t[4]=o);let l;t[5]===o?l=t[6]:(l={table:o},t[5]=o,t[6]=l);let u=l,d=ne(),f;t[7]===i?f=t[8]:(f=n(i,`data-table`),t[7]=i,t[8]=f);let p;t[9]===r?p=t[10]:(p=/* @__PURE__ */ _(s.Element,{children:r}),t[9]=r,t[10]=p);let m;t[11]!==a||t[12]!==f||t[13]!==p?(m=/* @__PURE__ */ _(s.Root,{"data-slot":f,...a,children:p}),t[11]=a,t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;t[15]!==d||t[16]!==m?(h=/* @__PURE__ */ _(I.Provider,{value:d,children:m}),t[15]=d,t[16]=m,t[17]=h):h=t[17];let g;return t[18]!==u||t[19]!==h?(g=/* @__PURE__ */ _(N.Provider,{value:u,children:h}),t[18]=u,t[19]=h,t[20]=g):g=t[20],g}function oe(e){let i=c(33),a,o,s,l,u,d,f,p,m,h,g,v;i[0]===e?(a=i[1],o=i[2],s=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],v=i[12]):({"data-slot":l,appearance:m,children:a,className:o,column:s,disableSorting:h,iconPlacement:g,intent:v,sortingMode:p,sortIcon:d,onClick:u,...f}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=l,i[5]=u,i[6]=d,i[7]=f,i[8]=p,i[9]=m,i[10]=h,i[11]=g,i[12]=v);let b=m===void 0?`ghost`:m,x=h!==void 0&&h,S=g===void 0?`end`:g,C=v===void 0?`neutral`:v,w;i[13]!==b||i[14]!==a||i[15]!==o||i[16]!==s||i[17]!==l||i[18]!==x||i[19]!==S||i[20]!==C||i[21]!==u||i[22]!==d||i[23]!==f||i[24]!==p?(w=()=>{let e=s.getIsSorted(),i=!x&&s.getCanSort(),c=i&&typeof e==`string`?e:`unsorted`;if(!i)return/* @__PURE__ */ _(`span`,{"data-slot":n(l,`data-table-header-sort-button`),"data-sort-direction":`unsorted`,className:t(`flex w-full items-center justify-start`,b===`ghost`&&C===`neutral`&&`text-muted`,o),...f,children:a});let m=d?.(c)??/* @__PURE__ */ _(ye,{mode:p,direction:c});return/* @__PURE__ */ _(r,{appearance:b,"data-slot":n(l,`data-table-header-sort-button`),className:t(`flex justify-start w-full h-full rounded-none not-disabled:active:scale-none`,b===`ghost`&&C===`neutral`&&`text-muted`,o),"data-sort-direction":c,"data-table-header-action":!0,icon:m,iconPlacement:S,onClick:e=>{u?.(e),e.defaultPrevented||p!==void 0&&be(s,p)},intent:C,type:`button`,...f,children:a})},i[13]=b,i[14]=a,i[15]=o,i[16]=s,i[17]=l,i[18]=x,i[19]=S,i[20]=C,i[21]=u,i[22]=d,i[23]=f,i[24]=p,i[25]=w):w=i[25];let T=w,E=P(),D;i[26]!==s||i[27]!==E?(D=()=>({sorted:s.getIsSorted(),options:E}),i[26]=s,i[27]=E,i[28]=D):D=i[28];let O;return i[29]!==s.table.store||i[30]!==T||i[31]!==D?(O=/* @__PURE__ */ _(y,{source:s.table.store,selector:D,children:T}),i[29]=s.table.store,i[30]=T,i[31]=D,i[32]=O):O=i[32],O}const z=`w-px whitespace-nowrap`;function B(e){if(e==null)return;let t=b(e,`getIsSorted`,w);if(t===`asc`)return`ascending`;if(t===`desc`)return`descending`}function V(e){let r=c(21),i,a,o,l,u;r[0]===e?(i=r[1],a=r[2],o=r[3],l=r[4],u=r[5]):({"data-slot":l,children:i,className:a,column:o,...u}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=l,r[5]=u);let d;r[6]!==i||r[7]!==a||r[8]!==o||r[9]!==l||r[10]!==u?(d=()=>{let e=M(o?.columnDef.meta);return/* @__PURE__ */ _(s.Header,{"aria-sort":B(o),"data-column-width":e,"data-slot":n(l,`data-table-header`),className:t(`has-data-table-header-action:px-0`,e===`fit`&&z,a),...u,children:i})},r[6]=i,r[7]=a,r[8]=o,r[9]=l,r[10]=u,r[11]=d):d=r[11];let f=d,p=P();if(o==null){let e;return r[12]===f?e=r[13]:(e=f(),r[12]=f,r[13]=e),e}let m;r[14]!==o||r[15]!==p?(m=()=>({ariaSort:B(o),options:p}),r[14]=o,r[15]=p,r[16]=m):m=r[16];let h;return r[17]!==o.table.store||r[18]!==f||r[19]!==m?(h=/* @__PURE__ */ _(y,{source:o.table.store,selector:m,children:f}),r[17]=o.table.store,r[18]=f,r[19]=m,r[20]=h):h=r[20],h}function H(e){let r=c(17),i,a,o,l;r[0]===e?(i=r[1],a=r[2],o=r[3],l=r[4]):({"data-slot":o,className:i,column:a,...l}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=l);let u=a?.columnDef.meta,d;r[5]===u?d=r[6]:(d=M(u),r[5]=u,r[6]=d);let f=d,p;r[7]===o?p=r[8]:(p=n(o,`data-table-cell`),r[7]=o,r[8]=p);let m=f===`fit`&&z,h;r[9]!==i||r[10]!==m?(h=t(m,i),r[9]=i,r[10]=m,r[11]=h):h=r[11];let g;return r[12]!==l||r[13]!==p||r[14]!==h||r[15]!==f?(g=/* @__PURE__ */ _(s.Cell,{"data-column-width":f,"data-slot":p,className:h,...l}),r[12]=l,r[13]=p,r[14]=h,r[15]=f,r[16]=g):g=r[16],g}const U=e=>{let t=c(8),r,i;t[0]===e?(r=t[1],i=t[2]):({"data-slot":r,...i}=e,t[0]=e,t[1]=r,t[2]=i);let a;t[3]===r?a=t[4]:(a=n(r,`data-table-body`),t[3]=r,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=/* @__PURE__ */ _(s.Body,{"data-slot":a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o};function W(e){let t=c(11),r,i;t[0]===e?(r=t[1],i=t[2]):({"data-slot":r,...i}=e,t[0]=e,t[1]=r,t[2]=i);let{table:a}=F(),o;t[3]===r?o=t[4]:(o=n(r,`data-table-head`),t[3]=r,t[4]=o);let l;t[5]===a?l=t[6]:(l=a.getHeaderGroups().map(G),t[5]=a,t[6]=l);let u;return t[7]!==i||t[8]!==o||t[9]!==l?(u=/* @__PURE__ */ _(s.Head,{"data-slot":o,...i,children:l}),t[7]=i,t[8]=o,t[9]=l,t[10]=u):u=t[10],u}function G(e){return/* @__PURE__ */ _(s.Row,{children:e.headers.map(K)},e.id)}function K(e){return/* @__PURE__ */ _(l,{children:e.isPlaceholder?/* @__PURE__ */ _(s.Header,{}):x(e.column.columnDef.header,e.getContext())},e.id)}const q=t(`starting:-translate-y-1 starting:opacity-0`,`motion-safe:transition-[opacity,translate] motion-safe:duration-200 motion-safe:ease-out-strong`,`data-closing:pointer-events-none data-closing:opacity-0 motion-safe:data-closing:duration-150`);function J(e,t){return t.size===0||e.depth===0?!1:e.getParentRows().some(e=>t.has(e.id))}const Y=u(!1);function se(e){if(e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return!1;let t=e.currentTarget.ownerDocument.getSelection();return t==null||t.isCollapsed?!0:!e.currentTarget.contains(t.anchorNode)}function ce(e){let r=c(21),i,a,o,l,u,f;r[0]===e?(i=r[1],a=r[2],o=r[3],l=r[4],u=r[5],f=r[6]):({"data-slot":a,className:i,onClick:o,renderExpanded:u,row:f,...l}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=l,r[5]=u,r[6]=f);let p=d(I)?.closingRowIds??L,m;r[7]!==i||r[8]!==p||r[9]!==a||r[10]!==o||r[11]!==l||r[12]!==u||r[13]!==f?(m=()=>{let e=J(f,p),r=b(f,`getIsExpanded`,T),c=b(f,`getVisibleCells`,E),d=/* @__PURE__ */ _(s.Row,{"data-slot":n(a,`data-table-row`),"data-expanded":r||void 0,"data-closing":e||void 0,inert:e||void 0,"data-clickable":o==null?void 0:``,className:t(f.depth>0&&q,o!=null&&`cursor-pointer`,i),onClick:o&&(e=>{se(e)&&o(e)}),...l,children:/* @__PURE__ */ _(Y.Provider,{value:u!=null,children:c.map(le)})});return u==null?d:/* @__PURE__ */ v(g,{children:[d,r&&/* @__PURE__ */ _($,{row:f,children:u(f)})]})},r[7]=i,r[8]=p,r[9]=a,r[10]=o,r[11]=l,r[12]=u,r[13]=f,r[14]=m):m=r[14];let h=m,x=P(),S;r[15]===x?S=r[16]:(S=e=>({state:e,options:x}),r[15]=x,r[16]=S);let C;return r[17]!==h||r[18]!==f.table.store||r[19]!==S?(C=/* @__PURE__ */ _(y,{source:f.table.store,selector:S,children:h}),r[17]=h,r[18]=f.table.store,r[19]=S,r[20]=C):C=r[20],C}function le(e){return/* @__PURE__ */ _(l,{children:x(e.column.columnDef.cell,e.getContext())},e.id)}function ue(e){let t=c(15),r,i,a;t[0]===e?(r=t[1],i=t[2],a=t[3]):({"data-slot":i,children:r,...a}=e,t[0]=e,t[1]=r,t[2]=i,t[3]=a);let{table:o}=F(),l;t[4]===o?l=t[5]:(l=b(o,`getVisibleLeafColumns`,D),t[4]=o,t[5]=l);let u=l.length,d;t[6]===i?d=t[7]:(d=n(i,`data-table-empty-row`),t[6]=i,t[7]=d);let f;t[8]!==r||t[9]!==u?(f=/* @__PURE__ */ _(s.Cell,{colSpan:u,children:r}),t[8]=r,t[9]=u,t[10]=f):f=t[10];let p;return t[11]!==a||t[12]!==d||t[13]!==f?(p=/* @__PURE__ */ _(s.Row,{"data-slot":d,...a,children:f}),t[11]=a,t[12]=d,t[13]=f,t[14]=p):p=t[14],p}function X(){let e=c(1),n;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=/* @__PURE__ */ _(`span`,{"aria-hidden":!0,className:t(`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)]`)}),e[0]=n):n=e[0],n}function de(e){let r=c(21),i,a,l,u,d;r[0]===e?(i=r[1],a=r[2],l=r[3],u=r[4],d=r[5]):({"data-slot":l,children:i,className:a,onClick:u,...d}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=l,r[4]=u,r[5]=d);let f;r[6]===u?f=r[7]:(f=o({allowClickEventDefault:!0,onClick:u}),r[6]=u,r[7]=f);let{onClick:p}=f,m;r[8]===l?m=r[9]:(m=n(l,`data-table-action-cell`),r[8]=l,r[9]=m);let h;r[10]===a?h=r[11]:(h=t(`sticky z-10 right-0 text-end align-middle bg-inherit p-2`,a),r[10]=a,r[11]=h);let g;r[12]===Symbol.for(`react.memo_cache_sentinel`)?(g=/* @__PURE__ */ _(X,{}),r[12]=g):g=r[12];let y;r[13]===i?y=r[14]:(y=/* @__PURE__ */ _(`span`,{"data-slot":`data-table-action-cell-label`,className:`contents`,children:i}),r[13]=i,r[14]=y);let b;return r[15]!==d||r[16]!==p||r[17]!==m||r[18]!==h||r[19]!==y?(b=/* @__PURE__ */ v(s.Cell,{"data-mantle-table-sticky-right":!0,"data-slot":m,className:h,onClick:p,...d,children:[g,y]}),r[15]=d,r[16]=p,r[17]=m,r[18]=h,r[19]=y,r[20]=b):b=r[20],b}function fe(e){let r=c(27),i,a,o,l;r[0]===e?(i=r[1],a=r[2],o=r[3],l=r[4]):({"data-slot":o,children:i,className:a,...l}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=l);let{table:u}=F(),d;r[5]===u?d=r[6]:(d=u.getRowModel(),r[5]=u,r[6]=d);let f=d.rows.length>0,p;r[7]===f?p=r[8]:(p=f?{"data-mantle-table-sticky-right":!0}:{},r[7]=f,r[8]=p);let m;r[9]===o?m=r[10]:(m=n(o,`data-table-action-header`),r[9]=o,r[10]=m);let h=f&&`sticky z-10 right-0 bg-inherit`,g;r[11]!==a||r[12]!==h?(g=t(h,a),r[11]=a,r[12]=h,r[13]=g):g=r[13];let y;r[14]===i?y=r[15]:(y=i??/* @__PURE__ */ _(`span`,{className:`sr-only`,children:`Actions`}),r[14]=i,r[15]=y);let b;r[16]===y?b=r[17]:(b=/* @__PURE__ */ _(`span`,{"data-slot":`data-table-action-header-label`,className:`contents`,children:y}),r[16]=y,r[17]=b);let x;r[18]===f?x=r[19]:(x=f&&/* @__PURE__ */ _(X,{}),r[18]=f,r[19]=x);let S;return r[20]!==l||r[21]!==p||r[22]!==m||r[23]!==g||r[24]!==b||r[25]!==x?(S=/* @__PURE__ */ v(s.Header,{...p,"data-slot":m,className:g,...l,children:[b,x]}),r[20]=l,r[21]=p,r[22]=m,r[23]=g,r[24]=b,r[25]=x,r[26]=S):S=r[26],S}function pe(e){return e!=null&&`nodeType`in e}function me(e){let r=c(20),i,a,o,l,u;r[0]===e?(i=r[1],a=r[2],o=r[3],l=r[4],u=r[5]):({"data-slot":o,children:i,className:a,onClick:l,...u}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=l,r[5]=u);let d=p(!1),f;r[6]===o?f=r[7]:(f=n(o,`data-table-control-cell`),r[6]=o,r[7]=f);let m;r[8]===a?m=r[9]:(m=t(`w-9 px-0 align-top has-[button:enabled,input:enabled]:cursor-pointer`,a),r[8]=a,r[9]=m);let h;r[10]===l?h=r[11]:(h=e=>{if(d.current){e.stopPropagation();return}l?.(e);let t=e.currentTarget.querySelector(`button:not(:disabled), input:not(:disabled)`);t!=null&&(e.stopPropagation(),!e.defaultPrevented&&pe(e.target)&&!t.contains(e.target)&&(t.focus({preventScroll:!0}),d.current=!0,t.click(),d.current=!1))},r[10]=l,r[11]=h);let g;r[12]===i?g=r[13]:(g=/* @__PURE__ */ _(`span`,{"data-slot":`data-table-control-cell-label`,className:`flex h-lh items-center justify-center`,children:i}),r[12]=i,r[13]=g);let v;return r[14]!==u||r[15]!==f||r[16]!==m||r[17]!==h||r[18]!==g?(v=/* @__PURE__ */ _(s.Cell,{"data-slot":f,className:m,onClick:h,...u,children:g}),r[14]=u,r[15]=f,r[16]=m,r[17]=h,r[18]=g,r[19]=v):v=r[19],v}function Z(e){return`data-table-expanded-row-${encodeURIComponent(e.id)}`}function Q(e){let r=c(16),i,a,o,l;r[0]===e?(i=r[1],a=r[2],o=r[3],l=r[4]):({"data-slot":o,children:i,className:a,...l}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=l);let u;r[5]===o?u=r[6]:(u=n(o,`data-table-expand-header`),r[5]=o,r[6]=u);let d;r[7]===a?d=r[8]:(d=t(`w-9 px-0 text-center`,a),r[7]=a,r[8]=d);let f;r[9]===i?f=r[10]:(f=i??/* @__PURE__ */ _(`span`,{className:`sr-only`,children:`Row details`}),r[9]=i,r[10]=f);let p;return r[11]!==l||r[12]!==u||r[13]!==d||r[14]!==f?(p=/* @__PURE__ */ _(s.Header,{"data-slot":u,className:d,...l,children:f}),r[11]=l,r[12]=u,r[13]=d,r[14]=f,r[15]=p):p=r[15],p}const he=/* @__PURE__ */ _(C,{weight:`bold`,className:`size-3.5`}),ge=/* @__PURE__ */ _(S,{weight:`bold`,className:`size-3.5`});function _e(e){let r=c(21),a,o,s,l,u,f,p,m,h,g,v;r[0]===e?(a=r[1],o=r[2],s=r[3],l=r[4],u=r[5],f=r[6],p=r[7],m=r[8],h=r[9],g=r[10],v=r[11]):({"data-slot":o,appearance:p,className:a,collapseIcon:m,expandIcon:h,intent:g,label:s,onClick:l,row:f,size:v,...u}=e,r[0]=e,r[1]=a,r[2]=o,r[3]=s,r[4]=l,r[5]=u,r[6]=f,r[7]=p,r[8]=m,r[9]=h,r[10]=g,r[11]=v);let b=p===void 0?`ghost`:p,x=m===void 0?ge:m,S=h===void 0?he:h,C=g===void 0?`neutral`:g,w=v===void 0?`sm`:v,T=()=>{if(!f.getCanExpand())return null;let e=f.getIsExpanded()&&!k,r=f.getToggleExpandedHandler(),c=f.subRows.length>0,d=D||!c;return/* @__PURE__ */ _(i,{type:`button`,"data-slot":n(o,`data-table-row-expand-button`),appearance:b,intent:C,size:w,className:t(`rounded`,a),"aria-expanded":e,"aria-controls":e&&d?Z(f):void 0,icon:e?x:S,label:c?`${e?`Collapse`:`Expand`} ${s}`:`${e?`Hide`:`Show`} details for ${s}`,onClick:t=>{if(t.stopPropagation(),l?.(t),t.defaultPrevented)return;let n=t.currentTarget.closest(`tbody`);O==null?r():k?O.cancelCollapse(f.id):e?O.startCollapse(f.id,n,()=>f.toggleExpanded(!1)):O.startExpand(n,r)},...u})},E=P(),D=d(Y),O=d(I),k=O?.closingRowIds.has(f.id)??!1,A;r[12]!==D||r[13]!==k||r[14]!==E||r[15]!==f?(A=()=>({isExpanded:f.getIsExpanded(),hasDetailPanel:D,isClosing:k,options:E}),r[12]=D,r[13]=k,r[14]=E,r[15]=f,r[16]=A):A=r[16];let j;return r[17]!==T||r[18]!==f.table.store||r[19]!==A?(j=/* @__PURE__ */ _(y,{source:f.table.store,selector:A,children:T}),r[17]=T,r[18]=f.table.store,r[19]=A,r[20]=j):j=r[20],j}function $(e){let r=c(29),i,a,o,l,u,f;r[0]===e?(i=r[1],a=r[2],o=r[3],l=r[4],u=r[5],f=r[6]):({"data-slot":l,children:i,className:a,colSpan:o,row:f,...u}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=l,r[5]=u,r[6]=f);let p;r[7]===f?p=r[8]:(p=()=>b(f,`getVisibleCells`,E).length,r[7]=f,r[8]=p);let m=p,h=d(I)?.closingRowIds??L,g;r[9]!==h||r[10]!==f?(g=h.has(f.id)||J(f,h),r[9]=h,r[10]=f,r[11]=g):g=r[11];let v=g,x;r[12]!==i||r[13]!==a||r[14]!==l||r[15]!==v||r[16]!==u||r[17]!==f?(x=e=>{let{numberOfColumns:r}=e;return/* @__PURE__ */ _(s.Row,{"data-slot":n(l,`data-table-expanded-row`),"data-expanded-content":!0,"data-closing":v||void 0,inert:v||void 0,className:t(`[&>td]:border-t-0`,q,a),...u,children:/* @__PURE__ */ _(s.Cell,{id:Z(f),colSpan:r,className:`bg-card font-sans text-body`,children:i})})},r[12]=i,r[13]=a,r[14]=l,r[15]=v,r[16]=u,r[17]=f,r[18]=x):x=r[18];let S=x,C=P();if(o!=null){let e;return r[19]!==o||r[20]!==S?(e=S({numberOfColumns:o}),r[19]=o,r[20]=S,r[21]=e):e=r[21],e}let w;r[22]!==m||r[23]!==C?(w=()=>({numberOfColumns:m(),options:C}),r[22]=m,r[23]=C,r[24]=w):w=r[24];let T;return r[25]!==S||r[26]!==f.table.store||r[27]!==w?(T=/* @__PURE__ */ _(y,{source:f.table.store,selector:w,children:S}),r[25]=S,r[26]=f.table.store,r[27]=w,r[28]=T):T=r[28],T}const ve={Root:ae,ActionCell:de,ActionHeader:fe,Cell:H,Body:U,EmptyRow:ue,Head:W,Header:V,HeaderSortButton:oe,Row:ce,ExpandHeader:Q,ControlCell:me,RowExpandButton:_e,ExpandedRow:$};function ye(e){let t=c(10),n,r,i;if(t[0]===e?(n=t[1],r=t[2],i=t[3]):({direction:n,mode:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i),n===`unsorted`||!r||!n){let e;return t[4]===i?e=t[5]:(e=/* @__PURE__ */ _(`svg`,{"aria-hidden":!0,...i}),t[4]=i,t[5]=e),e}let o;return t[6]!==n||t[7]!==r||t[8]!==i?(o=/* @__PURE__ */ _(a,{mode:r,direction:n,...i}),t[6]=n,t[7]=r,t[8]=i,t[9]=o):o=t[9],o}function be(e,t){if(!e.getCanSort())return;let n=e.getIsSorted();switch(A(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{ve as DataTable,Z as expandedRowId};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Description List component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/data-display/description-list
|
|
5
|
+
*/
|
|
1
6
|
import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
|
|
2
|
-
import
|
|
3
|
-
import "./
|
|
7
|
+
import "./index-KJ06KK6t.js";
|
|
8
|
+
import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
|
|
4
9
|
import { ComponentProps } from "react";
|
|
5
10
|
/**
|
|
6
11
|
* Props for `DescriptionList.Root`.
|
|
@@ -116,6 +121,12 @@ declare const Value: ({ "data-slot": dataSlot, asChild, className, children, ref
|
|
|
116
121
|
* Compose with `DescriptionList.Item`, `DescriptionList.Label`, and
|
|
117
122
|
* `DescriptionList.Value` as direct children.
|
|
118
123
|
*
|
|
124
|
+
* @useWhen Show the label and value pairs of one resource, such as the metadata on a detail page.
|
|
125
|
+
*
|
|
126
|
+
* @siblings
|
|
127
|
+
* - `Table`: several records share the same columns.
|
|
128
|
+
* - `Strata`: the pairs are headed sections of controls, not read-only data.
|
|
129
|
+
*
|
|
119
130
|
* @see https://mantle.ngrok.com/components/data-display/description-list
|
|
120
131
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dl
|
|
121
132
|
*
|
package/dist/description-list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./slot-
|
|
1
|
+
"use client";import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./slot-B7rwscwd.js";import{c as r}from"react/compiler-runtime";import{jsx as i}from"react/jsx-runtime";const a={Root:a=>{let o=r(18),s,c,l,u,d,f;o[0]===a?(s=o[1],c=o[2],l=o[3],u=o[4],d=o[5],f=o[6]):({asChild:f,className:c,children:s,"data-slot":l,ref:u,...d}=a,o[0]=a,o[1]=s,o[2]=c,o[3]=l,o[4]=u,o[5]=d,o[6]=f);let p=f!==void 0&&f?n:`dl`,m;o[7]===l?m=o[8]:(m=t(l,`description-list`),o[7]=l,o[8]=m);let h;o[9]===c?h=o[10]:(h=e(`relative scrollbar overflow-x-auto overscroll-x-none rounded-lg border border-card grid grid-cols-[auto_minmax(0,1fr)] gap-x-4 [&>*:nth-child(odd)]:bg-neutral-500/5 p-1`,c),o[9]=c,o[10]=h);let g;return o[11]!==p||o[12]!==s||o[13]!==u||o[14]!==d||o[15]!==m||o[16]!==h?(g=/* @__PURE__ */ i(p,{ref:u,"data-slot":m,className:h,...d,children:s}),o[11]=p,o[12]=s,o[13]=u,o[14]=d,o[15]=m,o[16]=h,o[17]=g):g=o[17],g},Item:a=>{let o=r(18),s,c,l,u,d,f;o[0]===a?(s=o[1],c=o[2],l=o[3],u=o[4],d=o[5],f=o[6]):({"data-slot":l,asChild:f,className:c,children:s,ref:u,...d}=a,o[0]=a,o[1]=s,o[2]=c,o[3]=l,o[4]=u,o[5]=d,o[6]=f);let p=f!==void 0&&f?n:`div`,m;o[7]===l?m=o[8]:(m=t(l,`description-list-item`),o[7]=l,o[8]=m);let h;o[9]===c?h=o[10]:(h=e(`rounded-sm col-span-full grid grid-cols-subgrid items-center`,c),o[9]=c,o[10]=h);let g;return o[11]!==p||o[12]!==s||o[13]!==u||o[14]!==d||o[15]!==m||o[16]!==h?(g=/* @__PURE__ */ i(p,{ref:u,"data-slot":m,className:h,...d,children:s}),o[11]=p,o[12]=s,o[13]=u,o[14]=d,o[15]=m,o[16]=h,o[17]=g):g=o[17],g},Label:a=>{let o=r(18),s,c,l,u,d,f;o[0]===a?(s=o[1],c=o[2],l=o[3],u=o[4],d=o[5],f=o[6]):({"data-slot":l,asChild:f,className:c,children:s,ref:u,...d}=a,o[0]=a,o[1]=s,o[2]=c,o[3]=l,o[4]=u,o[5]=d,o[6]=f);let p=f!==void 0&&f?n:`dt`,m;o[7]===l?m=o[8]:(m=t(l,`description-list-label`),o[7]=l,o[8]=m);let h;o[9]===c?h=o[10]:(h=e(`text-muted text-sm font-sans font-medium min-w-36 p-2`,c),o[9]=c,o[10]=h);let g;return o[11]!==p||o[12]!==s||o[13]!==u||o[14]!==d||o[15]!==m||o[16]!==h?(g=/* @__PURE__ */ i(p,{ref:u,"data-slot":m,className:h,...d,children:s}),o[11]=p,o[12]=s,o[13]=u,o[14]=d,o[15]=m,o[16]=h,o[17]=g):g=o[17],g},Value:a=>{let o=r(18),s,c,l,u,d,f;o[0]===a?(s=o[1],c=o[2],l=o[3],u=o[4],d=o[5],f=o[6]):({"data-slot":l,asChild:f,className:c,children:s,ref:u,...d}=a,o[0]=a,o[1]=s,o[2]=c,o[3]=l,o[4]=u,o[5]=d,o[6]=f);let p=f!==void 0&&f?n:`dd`,m;o[7]===l?m=o[8]:(m=t(l,`description-list-value`),o[7]=l,o[8]=m);let h;o[9]===c?h=o[10]:(h=e(`text-body font-mono text-mono py-2 px-3`,c),o[9]=c,o[10]=h);let g;return o[11]!==p||o[12]!==s||o[13]!==u||o[14]!==d||o[15]!==m||o[16]!==h?(g=/* @__PURE__ */ i(p,{ref:u,"data-slot":m,className:h,...d,children:s}),o[11]=p,o[12]=s,o[13]=u,o[14]=d,o[15]=m,o[16]=h,o[17]=g):g=o[17],g}};export{a as DescriptionList};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as WithDataSlot } from "./data-slot-
|
|
2
|
-
import { i as IconButtonIntent, n as IconButtonProps, r as IconButtonAppearance } from "./button-
|
|
3
|
-
import { a as Portal, c as Trigger$1, i as Overlay$1, n as Content$1, r as Description$1, s as Title$1, t as Close$1 } from "./dialog-
|
|
1
|
+
import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
|
|
2
|
+
import { i as IconButtonIntent, n as IconButtonProps, r as IconButtonAppearance } from "./button-DnYv7IOT.js";
|
|
3
|
+
import { a as Portal, c as Trigger$1, i as Overlay$1, n as Content$1, o as Root, r as Description$1, s as Title$1, t as Close$1 } from "./dialog-CbEEA0fl.js";
|
|
4
4
|
import { ComponentProps } from "react";
|
|
5
5
|
/**
|
|
6
6
|
* A button that opens the dialog.
|
|
@@ -69,7 +69,7 @@ declare const Close: ({ "data-slot": dataSlot, ...props }: ComponentProps<typeof
|
|
|
69
69
|
* The backdrop overlay for the dialog. Sits between the page and the dialog
|
|
70
70
|
* content and applies a blur and dim effect.
|
|
71
71
|
*
|
|
72
|
-
* Most consumers should not need to use this directly
|
|
72
|
+
* Most consumers should not need to use this directly. `Dialog.Content`
|
|
73
73
|
* renders an overlay automatically. Use this only when composing a custom
|
|
74
74
|
* `Dialog.Portal` tree.
|
|
75
75
|
*
|
|
@@ -134,7 +134,7 @@ type ContentProps = ComponentProps<typeof Content$1> & ({
|
|
|
134
134
|
appearance: "full-page" | "full-bleed";
|
|
135
135
|
/**
|
|
136
136
|
* Never set here. A `"full-page"` or `"full-bleed"` dialog fills its box,
|
|
137
|
-
* so it has no width to cap
|
|
137
|
+
* so it has no width to cap. Pass `appearance="centered"` to cap it.
|
|
138
138
|
*/
|
|
139
139
|
preferredWidth?: never;
|
|
140
140
|
}) & WithDataSlot;
|
|
@@ -166,6 +166,14 @@ type ContentProps = ComponentProps<typeof Content$1> & ({
|
|
|
166
166
|
* focus and hides outside content from assistive technology. Put a control that
|
|
167
167
|
* every user must reach inside the content.
|
|
168
168
|
*
|
|
169
|
+
* A script can show its own popup in a frame on `<body>`, above the dialog,
|
|
170
|
+
* such as the 3-D Secure challenge of a payment script. While that frame is
|
|
171
|
+
* on top at the center of the viewport, the dialog yields to the popup:
|
|
172
|
+
*
|
|
173
|
+
* - Focus that a script moves into the popup stays there.
|
|
174
|
+
* - Escape moves focus into the popup and does not close the dialog.
|
|
175
|
+
* - A click in the popup is not an outside click.
|
|
176
|
+
*
|
|
169
177
|
* @see https://mantle.ngrok.com/components/overlays/dialog#dialogcontent
|
|
170
178
|
*
|
|
171
179
|
* @example
|
|
@@ -257,7 +265,7 @@ declare const Content: ({ "data-slot": dataSlot, appearance, children, className
|
|
|
257
265
|
declare const Header: ({ "data-slot": dataSlot, className, children, ...props }: ComponentProps<"div"> & WithDataSlot) => import("react").JSX.Element;
|
|
258
266
|
type CloseIconButtonProps = Partial<Omit<IconButtonProps, "appearance" | "icon" | "intent">> & {
|
|
259
267
|
/**
|
|
260
|
-
* The visual style of the close icon button. Optional here
|
|
268
|
+
* The visual style of the close icon button. Optional here:
|
|
261
269
|
* `Dialog.CloseIconButton` defaults to `"ghost"` so the close affordance
|
|
262
270
|
* stays visually quiet in the dialog header.
|
|
263
271
|
*
|
|
@@ -265,7 +273,7 @@ type CloseIconButtonProps = Partial<Omit<IconButtonProps, "appearance" | "icon"
|
|
|
265
273
|
*/
|
|
266
274
|
appearance?: IconButtonAppearance;
|
|
267
275
|
/**
|
|
268
|
-
* The tone of the close icon button. Optional here
|
|
276
|
+
* The tone of the close icon button. Optional here:
|
|
269
277
|
* `Dialog.CloseIconButton` defaults to `"neutral"`, the workhorse tone for
|
|
270
278
|
* routine actions like dismissing a dialog, and the only tone `IconButton`
|
|
271
279
|
* draws.
|
|
@@ -445,6 +453,14 @@ declare const Description: ({ "data-slot": dataSlot, className, ref, ...props }:
|
|
|
445
453
|
* content. When multiple overlays are open, the most recently mounted overlay
|
|
446
454
|
* renders on top.
|
|
447
455
|
*
|
|
456
|
+
* @useWhen Gather input or confirm a choice that is not destructive, in a modal window that blocks
|
|
457
|
+
* the page.
|
|
458
|
+
*
|
|
459
|
+
* @siblings
|
|
460
|
+
* - `AlertDialog`: the user must confirm a destructive or irreversible action, such as a delete.
|
|
461
|
+
* - `Sheet`: the content slides in from the edge of the screen, such as a filter panel or a detail view.
|
|
462
|
+
* - `Popover`: the content is small and opens next to its trigger, with no modal backdrop.
|
|
463
|
+
*
|
|
448
464
|
* @see https://mantle.ngrok.com/components/overlays/dialog
|
|
449
465
|
*
|
|
450
466
|
* @example
|
|
@@ -525,7 +541,7 @@ declare const Dialog: {
|
|
|
525
541
|
* </Dialog.Root>
|
|
526
542
|
* ```
|
|
527
543
|
*/
|
|
528
|
-
readonly Root:
|
|
544
|
+
readonly Root: typeof Root;
|
|
529
545
|
/**
|
|
530
546
|
* Contains the main content of the dialog.
|
|
531
547
|
*
|
|
@@ -647,6 +663,14 @@ declare const Dialog: {
|
|
|
647
663
|
* focus and hides outside content from assistive technology. Put a control that
|
|
648
664
|
* every user must reach inside the content.
|
|
649
665
|
*
|
|
666
|
+
* A script can show its own popup in a frame on `<body>`, above the dialog,
|
|
667
|
+
* such as the 3-D Secure challenge of a payment script. While that frame is
|
|
668
|
+
* on top at the center of the viewport, the dialog yields to the popup:
|
|
669
|
+
*
|
|
670
|
+
* - Focus that a script moves into the popup stays there.
|
|
671
|
+
* - Escape moves focus into the popup and does not close the dialog.
|
|
672
|
+
* - A click in the popup is not an outside click.
|
|
673
|
+
*
|
|
650
674
|
* @see https://mantle.ngrok.com/components/overlays/dialog#dialogcontent
|
|
651
675
|
*
|
|
652
676
|
* @example
|