@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/breadcrumb.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Breadcrumb component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/navigation/breadcrumb
|
|
5
|
+
*/
|
|
1
6
|
import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
|
|
2
|
-
import { t as WithDataSlot } from "./data-slot-
|
|
7
|
+
import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
|
|
3
8
|
import { ComponentProps, ReactNode } from "react";
|
|
4
9
|
/**
|
|
5
10
|
* The breadcrumb landmark. Renders a `<nav>` with a default
|
|
6
|
-
* `aria-label="Breadcrumb"` per the WAI-ARIA breadcrumb pattern
|
|
11
|
+
* `aria-label="Breadcrumb"` per the WAI-ARIA breadcrumb pattern. Pass your
|
|
7
12
|
* own `aria-label` to override it (e.g. for localization or when a page has
|
|
8
13
|
* multiple breadcrumb trails). Carries no visual styling. Its one layout class
|
|
9
14
|
* is `min-w-0`: inside a flex row such as `AppLayout.Header` the landmark must
|
|
@@ -33,7 +38,7 @@ import { ComponentProps, ReactNode } from "react";
|
|
|
33
38
|
*/
|
|
34
39
|
declare const Root: ({ asChild, children, className, "data-slot": dataSlot, ref, ...props }: ComponentProps<"nav"> & WithAsChild & WithDataSlot) => import("react").JSX.Element;
|
|
35
40
|
/**
|
|
36
|
-
* The ordered list of crumbs. Renders an `<ol>`
|
|
41
|
+
* The ordered list of crumbs. Renders an `<ol>` (an **ordered** list), because
|
|
37
42
|
* the order of the items is the hierarchy, from the root to the current page.
|
|
38
43
|
* Lays the crumbs out in one row of muted, small text.
|
|
39
44
|
*
|
|
@@ -43,10 +48,10 @@ declare const Root: ({ asChild, children, className, "data-slot": dataSlot, ref,
|
|
|
43
48
|
* out, and an edge with nothing beyond it stays flush.
|
|
44
49
|
*
|
|
45
50
|
* The trail keeps its end in view, because the end is the current page. It
|
|
46
|
-
* scrolls itself there whenever that end moves
|
|
47
|
-
* swaps the crumbs, and when the row around it resizes
|
|
48
|
-
* own scroll position alone
|
|
49
|
-
* focus. Tabbing to a crumb the trail has scrolled past is the browser's own
|
|
51
|
+
* scrolls itself there whenever that end moves: on mount, when a navigation
|
|
52
|
+
* swaps the crumbs, and when the row around it resizes. The rest of the time,
|
|
53
|
+
* it leaves the reader's own scroll position alone, including while a crumb
|
|
54
|
+
* holds focus. Tabbing to a crumb the trail has scrolled past is the browser's own
|
|
50
55
|
* job, and `scroll-padding` the width of the fade zone is what lands that crumb
|
|
51
56
|
* clear of the fade rather than under it.
|
|
52
57
|
*
|
|
@@ -78,8 +83,8 @@ declare const Root: ({ asChild, children, className, "data-slot": dataSlot, ref,
|
|
|
78
83
|
declare const List: ({ asChild, children, className, "data-slot": dataSlot, ref, ...props }: ComponentProps<"ol"> & WithAsChild & WithDataSlot) => import("react").JSX.Element;
|
|
79
84
|
/**
|
|
80
85
|
* A single crumb. Renders an `<li>` (`role="listitem"`) that lays out its
|
|
81
|
-
* content
|
|
82
|
-
*
|
|
86
|
+
* content (a `Breadcrumb.Link`, a `Breadcrumb.Label`, or a `Breadcrumb.Page`)
|
|
87
|
+
* inline.
|
|
83
88
|
*
|
|
84
89
|
* The crumb never shrinks (`shrink-0`). A squeezed crumb would break its own
|
|
85
90
|
* label across two lines, so a trail too wide for its container scrolls in
|
|
@@ -108,8 +113,8 @@ declare const List: ({ asChild, children, className, "data-slot": dataSlot, ref,
|
|
|
108
113
|
*/
|
|
109
114
|
declare const Item: ({ asChild, children, className, "data-slot": dataSlot, ref, ...props }: ComponentProps<"li"> & WithAsChild & WithDataSlot) => import("react").JSX.Element;
|
|
110
115
|
/**
|
|
111
|
-
* A link to an ancestor page in the hierarchy. Renders an `<a>` by default
|
|
112
|
-
*
|
|
116
|
+
* A link to an ancestor page in the hierarchy. Renders an `<a>` by default.
|
|
117
|
+
* The component is router-agnostic: use `asChild` to compose the styling
|
|
113
118
|
* onto your app router's link (e.g. react-router's `<Link>`) so client-side
|
|
114
119
|
* navigation kicks in.
|
|
115
120
|
*
|
|
@@ -143,7 +148,7 @@ declare const Item: ({ asChild, children, className, "data-slot": dataSlot, ref,
|
|
|
143
148
|
*/
|
|
144
149
|
declare const Link: ({ asChild, children, className, "data-slot": dataSlot, ref, ...props }: ComponentProps<"a"> & WithAsChild & WithDataSlot) => import("react").JSX.Element;
|
|
145
150
|
/**
|
|
146
|
-
* A crumb that is not a link
|
|
151
|
+
* A crumb that is not a link: a level with no page of its own, such as a
|
|
147
152
|
* section whose index URL only redirects (`Settings` in `Settings > General`).
|
|
148
153
|
* Renders a `<span>` with no `aria-current` and no link semantics, so the
|
|
149
154
|
* trail shows the level without offering it as a destination. Use
|
|
@@ -169,7 +174,7 @@ declare const Link: ({ asChild, children, className, "data-slot": dataSlot, ref,
|
|
|
169
174
|
*/
|
|
170
175
|
declare const Label: ({ asChild, children, className, "data-slot": dataSlot, ref, ...props }: ComponentProps<"span"> & WithAsChild & WithDataSlot) => import("react").JSX.Element;
|
|
171
176
|
/**
|
|
172
|
-
* The current page
|
|
177
|
+
* The current page (the last crumb in the trail). Renders a `<span>` (not a
|
|
173
178
|
* link; the user is already here) with `aria-current="page"`. The ARIA is the
|
|
174
179
|
* part's whole contract, so `aria-current` is always emitted and is not
|
|
175
180
|
* overridable via props.
|
|
@@ -199,8 +204,8 @@ declare const Page: ({ asChild, children, className, "data-slot": dataSlot, ref,
|
|
|
199
204
|
/**
|
|
200
205
|
* The props for `Breadcrumb.Separator`. When `asChild` is set, `children` is
|
|
201
206
|
* required: the child element is what gets rendered, so an `asChild` separator
|
|
202
|
-
* without children would clone the default caret icon into the list
|
|
203
|
-
* `<ol>` content. The union makes that misuse a compile error.
|
|
207
|
+
* without children would clone the default caret icon into the list, which is
|
|
208
|
+
* invalid `<ol>` content. The union makes that misuse a compile error.
|
|
204
209
|
*/
|
|
205
210
|
type BreadcrumbSeparatorProps = Omit<ComponentProps<"li">, "children"> & ({
|
|
206
211
|
asChild: true;
|
|
@@ -211,12 +216,12 @@ type BreadcrumbSeparatorProps = Omit<ComponentProps<"li">, "children"> & ({
|
|
|
211
216
|
});
|
|
212
217
|
/**
|
|
213
218
|
* A purely visual divider between crumbs, hidden from assistive technology.
|
|
214
|
-
* Renders an `<li>` with `role="presentation"` and `aria-hidden="true"
|
|
219
|
+
* Renders an `<li>` with `role="presentation"` and `aria-hidden="true"`: a
|
|
215
220
|
* listitem sibling of `Breadcrumb.Item` elements per the APG breadcrumb
|
|
216
221
|
* pattern, so it never counts as a crumb. Children default to a size-3.5
|
|
217
222
|
* caret icon (`<Icon svg={<CaretRightIcon />} className="size-3.5" />`); pass
|
|
218
223
|
* your own children (e.g. a slash) to replace it. With `asChild`, children
|
|
219
|
-
* are required
|
|
224
|
+
* are required: the child element is what renders.
|
|
220
225
|
*
|
|
221
226
|
* Like `Breadcrumb.Item`, the divider never shrinks (`shrink-0`), so a trail
|
|
222
227
|
* too wide for its container scrolls in `Breadcrumb.List` instead.
|
|
@@ -259,7 +264,7 @@ type BreadcrumbSkeletonProps = Omit<ComponentProps<"li">, "children"> & {
|
|
|
259
264
|
/**
|
|
260
265
|
* A placeholder crumb for a label that is still loading. Renders one `<li>`
|
|
261
266
|
* as a crumb-sized pulsing bar carrying a screen-reader-only `role="status"`
|
|
262
|
-
* announcement. The bar is `w-24` by default
|
|
267
|
+
* announcement. The bar is `w-24` by default. Pass a `w-*` utility for your
|
|
263
268
|
* best-guess width, so the row's shape holds when the real crumb replaces it.
|
|
264
269
|
* One skeleton usually stands in for a whole pending segment; compose several
|
|
265
270
|
* with `Breadcrumb.Separator` when the segment's shape matters.
|
|
@@ -281,12 +286,18 @@ type BreadcrumbSkeletonProps = Omit<ComponentProps<"li">, "children"> & {
|
|
|
281
286
|
*/
|
|
282
287
|
declare const BreadcrumbSkeleton: ({ className, "data-slot": dataSlot, label, ref, ...props }: BreadcrumbSkeletonProps & WithDataSlot) => import("react").JSX.Element;
|
|
283
288
|
/**
|
|
284
|
-
* Compound component for WAI-ARIA breadcrumb navigation
|
|
289
|
+
* Compound component for WAI-ARIA breadcrumb navigation: the path from a
|
|
285
290
|
* root to the current page as an ordered list of links inside a labeled
|
|
286
291
|
* `<nav>` landmark. Router-agnostic: compose `Breadcrumb.Link` onto your app
|
|
287
292
|
* router's link via `asChild`. A trail too wide for its row scrolls sideways
|
|
288
293
|
* with faded edges instead of wrapping, and starts at the current page.
|
|
289
294
|
*
|
|
295
|
+
* @useWhen Show where the current page sits in a hierarchy, as a trail of links from a root page.
|
|
296
|
+
*
|
|
297
|
+
* @siblings
|
|
298
|
+
* - `Tabs`: the user switches between peer views of one page.
|
|
299
|
+
* - `Sidebar`: the app needs persistent navigation to its top-level pages.
|
|
300
|
+
*
|
|
290
301
|
* @see https://mantle.ngrok.com/components/navigation/breadcrumb
|
|
291
302
|
*
|
|
292
303
|
* @example
|
|
@@ -327,7 +338,7 @@ declare const BreadcrumbSkeleton: ({ className, "data-slot": dataSlot, label, re
|
|
|
327
338
|
declare const Breadcrumb: {
|
|
328
339
|
/**
|
|
329
340
|
* The breadcrumb landmark. Renders a `<nav>` with a default
|
|
330
|
-
* `aria-label="Breadcrumb"
|
|
341
|
+
* `aria-label="Breadcrumb"`. Pass your own `aria-label` to override it.
|
|
331
342
|
* Carries no visual styling; `min-w-0` is what lets the landmark shrink
|
|
332
343
|
* inside a flex row so the trail scrolls.
|
|
333
344
|
*
|
|
@@ -354,7 +365,7 @@ declare const Breadcrumb: {
|
|
|
354
365
|
*/
|
|
355
366
|
readonly Root: typeof Root;
|
|
356
367
|
/**
|
|
357
|
-
* The ordered list of crumbs. Renders an `<ol
|
|
368
|
+
* The ordered list of crumbs. Renders an `<ol>`: the order of the items
|
|
358
369
|
* is the hierarchy, from the root to the current page. A trail wider than
|
|
359
370
|
* its container scrolls sideways with a faded edge instead of wrapping, and
|
|
360
371
|
* starts at the current page.
|
|
@@ -435,7 +446,7 @@ declare const Breadcrumb: {
|
|
|
435
446
|
*/
|
|
436
447
|
readonly Link: typeof Link;
|
|
437
448
|
/**
|
|
438
|
-
* A crumb that is not a link
|
|
449
|
+
* A crumb that is not a link: a level with no page of its own, such as a
|
|
439
450
|
* section whose index URL only redirects. Renders a `<span>` with no
|
|
440
451
|
* `aria-current` and no link semantics.
|
|
441
452
|
*
|
|
@@ -458,7 +469,7 @@ declare const Breadcrumb: {
|
|
|
458
469
|
*/
|
|
459
470
|
readonly Label: typeof Label;
|
|
460
471
|
/**
|
|
461
|
-
* The current page
|
|
472
|
+
* The current page (the last crumb). Renders a `<span>` (not a link) with
|
|
462
473
|
* `aria-current="page"`; the ARIA is the part's whole contract and is not
|
|
463
474
|
* overridable.
|
|
464
475
|
*
|
|
@@ -515,7 +526,7 @@ declare const Breadcrumb: {
|
|
|
515
526
|
/**
|
|
516
527
|
* A placeholder crumb for a label that is still loading: one `<li>` as a
|
|
517
528
|
* crumb-sized pulsing bar, plus a screen-reader-only `role="status"`
|
|
518
|
-
* announcement. `w-24` by default
|
|
529
|
+
* announcement. `w-24` by default. Pass a `w-*` utility for your
|
|
519
530
|
* best-guess width, so the row's shape holds when the real crumb arrives.
|
|
520
531
|
*
|
|
521
532
|
* @see https://mantle.ngrok.com/components/navigation/breadcrumb#breadcrumbskeleton
|
|
@@ -536,7 +547,7 @@ declare const Breadcrumb: {
|
|
|
536
547
|
readonly Skeleton: typeof BreadcrumbSkeleton;
|
|
537
548
|
};
|
|
538
549
|
/**
|
|
539
|
-
* One crumb a route contributes
|
|
550
|
+
* One crumb a route contributes: a discriminated union on `kind`. Create
|
|
540
551
|
* these with {@link routeBreadcrumb}; the factory stamps the discriminant, so
|
|
541
552
|
* no call site hand-writes one.
|
|
542
553
|
*
|
|
@@ -559,8 +570,8 @@ type Crumb = {
|
|
|
559
570
|
to?: string;
|
|
560
571
|
} | {
|
|
561
572
|
/**
|
|
562
|
-
* A prefix crumb: it names a level with no page of its own
|
|
563
|
-
* whose index URL only redirects
|
|
573
|
+
* A prefix crumb: it names a level with no page of its own (a section
|
|
574
|
+
* whose index URL only redirects), so the renderer draws it as a
|
|
564
575
|
* non-link `Breadcrumb.Label`.
|
|
565
576
|
*/
|
|
566
577
|
kind: "label";
|
|
@@ -585,7 +596,7 @@ type Crumb = {
|
|
|
585
596
|
/**
|
|
586
597
|
* Creates the crumb a route contributes: a link crumb, whose omitted `to`
|
|
587
598
|
* resolves to the contributing route's own `pathname`. Two members cover the
|
|
588
|
-
* crumbs that are not plain links
|
|
599
|
+
* crumbs that are not plain links: `routeBreadcrumb.label` for a section
|
|
589
600
|
* prefix that never links, and `routeBreadcrumb.content` for a trail segment
|
|
590
601
|
* that renders itself from fetched data.
|
|
591
602
|
*
|
|
@@ -600,7 +611,7 @@ type Crumb = {
|
|
|
600
611
|
* ```tsx
|
|
601
612
|
* routeBreadcrumb("Endpoints"); // links to the contributing route's pathname
|
|
602
613
|
* routeBreadcrumb("Endpoints", { to: "/endpoints" }); // links to an explicit path
|
|
603
|
-
* routeBreadcrumb.label("Settings"); // never links
|
|
614
|
+
* routeBreadcrumb.label("Settings"); // never links; renders as Breadcrumb.Label
|
|
604
615
|
* routeBreadcrumb.content(<AppTrail appId="app_123" />); // renders its own items from query data
|
|
605
616
|
* ```
|
|
606
617
|
*/
|
|
@@ -608,7 +619,7 @@ declare const routeBreadcrumb: ((label: ReactNode, options?: {
|
|
|
608
619
|
to?: string;
|
|
609
620
|
}) => Crumb) & {
|
|
610
621
|
/**
|
|
611
|
-
* Creates a prefix crumb
|
|
622
|
+
* Creates a prefix crumb: one that never links. The renderer draws it as
|
|
612
623
|
* a non-link `Breadcrumb.Label`.
|
|
613
624
|
*
|
|
614
625
|
* @example
|
|
@@ -618,7 +629,7 @@ declare const routeBreadcrumb: ((label: ReactNode, options?: {
|
|
|
618
629
|
*/
|
|
619
630
|
label: (label: ReactNode) => Crumb;
|
|
620
631
|
/**
|
|
621
|
-
* Creates a content crumb
|
|
632
|
+
* Creates a content crumb: a complete rendered trail segment, for labels
|
|
622
633
|
* and links that only exist in fetched data. The node decides link vs
|
|
623
634
|
* current page itself, because the trail builder cannot see inside it.
|
|
624
635
|
*
|
|
@@ -660,7 +671,7 @@ declare const routeBreadcrumb: ((label: ReactNode, options?: {
|
|
|
660
671
|
type RouteBreadcrumb<TMatch = unknown> = string | ((match: TMatch) => ReadonlyArray<Crumb>);
|
|
661
672
|
/**
|
|
662
673
|
* The `handle` shape a route exports to appear in the trail. Omitting `handle`
|
|
663
|
-
* entirely is the opt-out
|
|
674
|
+
* entirely is the opt-out, with no filter list to maintain.
|
|
664
675
|
*
|
|
665
676
|
* @see https://mantle.ngrok.com/components/navigation/breadcrumb#routebreadcrumb
|
|
666
677
|
*
|
|
@@ -690,12 +701,12 @@ type BreadcrumbMatch = {
|
|
|
690
701
|
id: string;
|
|
691
702
|
/** The URL portion this route matched. */
|
|
692
703
|
pathname: string;
|
|
693
|
-
/** The route module's `handle` export
|
|
704
|
+
/** The route module's `handle` export (`unknown` until narrowed). */
|
|
694
705
|
handle: unknown;
|
|
695
706
|
};
|
|
696
707
|
/**
|
|
697
|
-
* A crumb with its link and React key resolved
|
|
698
|
-
* consumes. Link crumbs carry a definite `to`; label crumbs carry none, which
|
|
708
|
+
* A crumb with its link and React key resolved (what a trail renderer
|
|
709
|
+
* consumes). Link crumbs carry a definite `to`; label crumbs carry none, which
|
|
699
710
|
* is what makes an unlinked link crumb unrepresentable.
|
|
700
711
|
*
|
|
701
712
|
* @see https://mantle.ngrok.com/components/navigation/breadcrumb#buildcrumbs
|
|
@@ -744,7 +755,7 @@ declare function hasBreadcrumb<TMatch extends BreadcrumbMatch>(match: TMatch): m
|
|
|
744
755
|
*
|
|
745
756
|
* Pure: no hooks, no browser APIs, no clock. It runs identically on the
|
|
746
757
|
* server and the client, which is the whole reason the trail needs no state
|
|
747
|
-
* and no effects
|
|
758
|
+
* and no effects. You can also assert the trail as a plain value.
|
|
748
759
|
* Router-agnostic: it reads only {@link BreadcrumbMatch}'s three fields, which
|
|
749
760
|
* react-router's `UIMatch` satisfies structurally.
|
|
750
761
|
*
|
package/dist/breadcrumb.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./use-isomorphic-layout-effect-
|
|
1
|
+
"use client";import{t as e}from"./use-isomorphic-layout-effect-CL6iq0Bj.js";import{t}from"./use-composed-refs-DPYmLDSe.js";import{t as n}from"./cx-CK7o_rVv.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{t as i}from"./icon-xb7d9M7X.js";import{t as a}from"./skeleton-DHfyjuQi.js";import{t as o}from"./slot-B7rwscwd.js";import{c as s}from"react/compiler-runtime";import{cloneElement as c,isValidElement as l,useEffect as u,useRef as d}from"react";import{jsx as f}from"react/jsx-runtime";import{CaretRightIcon as p}from"@phosphor-icons/react/CaretRight";const m=e=>{let t=s(18),i,a,c,l,u,d;t[0]===e?(i=t[1],a=t[2],c=t[3],l=t[4],u=t[5],d=t[6]):({asChild:i,children:a,className:c,"data-slot":l,ref:d,...u}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=c,t[4]=l,t[5]=u,t[6]=d);let p=i?o:`nav`,m;t[7]===l?m=t[8]:(m=r(l,`breadcrumb`),t[7]=l,t[8]=m);let h;t[9]===c?h=t[10]:(h=n(`min-w-0`,c),t[9]=c,t[10]=h);let g;return t[11]!==p||t[12]!==a||t[13]!==u||t[14]!==d||t[15]!==m||t[16]!==h?(g=/* @__PURE__ */ f(p,{ref:d,"data-slot":m,"aria-label":`Breadcrumb`,className:h,...u,children:a}),t[11]=p,t[12]=a,t[13]=u,t[14]=d,t[15]=m,t[16]=h,t[17]=g):g=t[17],g};function h(e,t){let n=e.scrollWidth-e.clientWidth;return n===t||e.contains(document.activeElement)?t:(e.scrollLeft=n,n)}const g={Root:m,List:i=>{let a=s(21),c,l,p,m,g,_;a[0]===i?(c=a[1],l=a[2],p=a[3],m=a[4],g=a[5],_=a[6]):({asChild:c,children:l,className:p,"data-slot":m,ref:_,...g}=i,a[0]=i,a[1]=c,a[2]=l,a[3]=p,a[4]=m,a[5]=g,a[6]=_);let v=c?o:`ol`,y=d(null),b=t(y,_),x=d(void 0),S;a[7]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>{let e=y.current;e!=null&&(x.current=h(e,x.current))},a[7]=S):S=a[7],e(S);let C,w;a[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{let e=y.current;if(e==null)return;let t=new ResizeObserver(()=>{x.current=h(e,x.current)});return t.observe(e),()=>{t.disconnect()}},w=[],a[8]=C,a[9]=w):(C=a[8],w=a[9]),u(C,w);let T;a[10]===m?T=a[11]:(T=r(m,`breadcrumb-list`),a[10]=m,a[11]=T);let E;a[12]===p?E=a[13]:(E=n(`text-muted flex items-center gap-1.5 text-sm`,`scroll-fade-x min-w-0 overflow-x-auto overscroll-x-none`,`-m-1 p-1`,`scroll-px-10`,p),a[12]=p,a[13]=E);let D;return a[14]!==v||a[15]!==l||a[16]!==b||a[17]!==g||a[18]!==T||a[19]!==E?(D=/* @__PURE__ */ f(v,{ref:b,"data-slot":T,className:E,...g,children:l}),a[14]=v,a[15]=l,a[16]=b,a[17]=g,a[18]=T,a[19]=E,a[20]=D):D=a[20],D},Item:e=>{let t=s(18),i,a,c,l,u,d;t[0]===e?(i=t[1],a=t[2],c=t[3],l=t[4],u=t[5],d=t[6]):({asChild:i,children:a,className:c,"data-slot":l,ref:d,...u}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=c,t[4]=l,t[5]=u,t[6]=d);let p=i?o:`li`,m;t[7]===l?m=t[8]:(m=r(l,`breadcrumb-item`),t[7]=l,t[8]=m);let h;t[9]===c?h=t[10]:(h=n(`inline-flex shrink-0 items-center gap-1.5`,c),t[9]=c,t[10]=h);let g;return t[11]!==p||t[12]!==a||t[13]!==u||t[14]!==d||t[15]!==m||t[16]!==h?(g=/* @__PURE__ */ f(p,{ref:d,"data-slot":m,className:h,...u,children:a}),t[11]=p,t[12]=a,t[13]=u,t[14]=d,t[15]=m,t[16]=h,t[17]=g):g=t[17],g},Link:e=>{let t=s(18),i,a,c,l,u,d;t[0]===e?(i=t[1],a=t[2],c=t[3],l=t[4],u=t[5],d=t[6]):({asChild:i,children:a,className:c,"data-slot":l,ref:d,...u}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=c,t[4]=l,t[5]=u,t[6]=d);let p=i?o:`a`,m;t[7]===l?m=t[8]:(m=r(l,`breadcrumb-link`),t[7]=l,t[8]=m);let h;t[9]===c?h=t[10]:(h=n(`hover:text-strong transition-colors`,c),t[9]=c,t[10]=h);let g;return t[11]!==p||t[12]!==a||t[13]!==u||t[14]!==d||t[15]!==m||t[16]!==h?(g=/* @__PURE__ */ f(p,{ref:d,"data-slot":m,className:h,...u,children:a}),t[11]=p,t[12]=a,t[13]=u,t[14]=d,t[15]=m,t[16]=h,t[17]=g):g=t[17],g},Label:e=>{let t=s(18),i,a,c,l,u,d;t[0]===e?(i=t[1],a=t[2],c=t[3],l=t[4],u=t[5],d=t[6]):({asChild:i,children:a,className:c,"data-slot":l,ref:d,...u}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=c,t[4]=l,t[5]=u,t[6]=d);let p=i?o:`span`,m;t[7]===l?m=t[8]:(m=r(l,`breadcrumb-label`),t[7]=l,t[8]=m);let h;t[9]===c?h=t[10]:(h=n(`text-muted`,c),t[9]=c,t[10]=h);let g;return t[11]!==p||t[12]!==a||t[13]!==u||t[14]!==d||t[15]!==m||t[16]!==h?(g=/* @__PURE__ */ f(p,{ref:d,"data-slot":m,className:h,...u,children:a}),t[11]=p,t[12]=a,t[13]=u,t[14]=d,t[15]=m,t[16]=h,t[17]=g):g=t[17],g},Page:e=>{let t=s(21),i,a,u,d,p,m;t[0]===e?(i=t[1],a=t[2],u=t[3],d=t[4],p=t[5],m=t[6]):({asChild:i,children:a,className:u,"data-slot":d,ref:m,...p}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=u,t[4]=d,t[5]=p,t[6]=m);let h=i?o:`span`,g;t[7]!==i||t[8]!==a?(g=i&&l(a)?c(a,{"aria-current":`page`}):a,t[7]=i,t[8]=a,t[9]=g):g=t[9];let _=g,v;t[10]===d?v=t[11]:(v=r(d,`breadcrumb-page`),t[10]=d,t[11]=v);let y;t[12]===u?y=t[13]:(y=n(`text-muted`,u),t[12]=u,t[13]=y);let b;return t[14]!==h||t[15]!==_||t[16]!==p||t[17]!==m||t[18]!==v||t[19]!==y?(b=/* @__PURE__ */ f(h,{ref:m,"data-slot":v,className:y,...p,"aria-current":`page`,children:_}),t[14]=h,t[15]=_,t[16]=p,t[17]=m,t[18]=v,t[19]=y,t[20]=b):b=t[20],b},Separator:e=>{let t=s(21),a,u,d,m,h,g;t[0]===e?(a=t[1],u=t[2],d=t[3],m=t[4],h=t[5],g=t[6]):({asChild:a,children:u,className:d,"data-slot":m,ref:g,...h}=e,t[0]=e,t[1]=a,t[2]=u,t[3]=d,t[4]=m,t[5]=h,t[6]=g);let _=a?o:`li`,v;t[7]!==a||t[8]!==u?(v=a&&l(u)?c(u,{role:`presentation`,"aria-hidden":`true`}):u??/* @__PURE__ */ f(i,{svg:/* @__PURE__ */ f(p,{}),className:`size-3.5`}),t[7]=a,t[8]=u,t[9]=v):v=t[9];let y=v,b;t[10]===m?b=t[11]:(b=r(m,`breadcrumb-separator`),t[10]=m,t[11]=b);let x;t[12]===d?x=t[13]:(x=n(`shrink-0`,d),t[12]=d,t[13]=x);let S;return t[14]!==_||t[15]!==y||t[16]!==h||t[17]!==g||t[18]!==b||t[19]!==x?(S=/* @__PURE__ */ f(_,{ref:g,"data-slot":b,className:x,...h,role:`presentation`,"aria-hidden":`true`,children:y}),t[14]=_,t[15]=y,t[16]=h,t[17]=g,t[18]=b,t[19]=x,t[20]=S):S=t[20],S},Skeleton:e=>{let t=s(18),i,o,c,l,u;t[0]===e?(i=t[1],o=t[2],c=t[3],l=t[4],u=t[5]):({className:i,"data-slot":o,label:u,ref:l,...c}=e,t[0]=e,t[1]=i,t[2]=o,t[3]=c,t[4]=l,t[5]=u);let d=u===void 0?`Loading breadcrumbs…`:u,p;t[6]===o?p=t[7]:(p=r(o,`breadcrumb-skeleton`),t[6]=o,t[7]=p);let m;t[8]===i?m=t[9]:(m=n(`w-24 shrink-0`,i),t[8]=i,t[9]=m);let h;t[10]===d?h=t[11]:(h=/* @__PURE__ */ f(`span`,{role:`status`,className:`sr-only`,children:d}),t[10]=d,t[11]=h);let g;return t[12]!==c||t[13]!==l||t[14]!==p||t[15]!==m||t[16]!==h?(g=/* @__PURE__ */ f(a,{asChild:!0,"aria-hidden":!1,children:/* @__PURE__ */ f(`li`,{ref:l,"data-slot":p,className:m,...c,children:h})}),t[12]=c,t[13]=l,t[14]=p,t[15]=m,t[16]=h,t[17]=g):g=t[17],g}},_=Object.assign((e,t={})=>({kind:`link`,label:e,...t}),{label:e=>({kind:`label`,label:e}),content:e=>({kind:`content`,content:e})});function v(e){let{handle:t}=e;if(typeof t!=`object`||!t||!(`breadcrumb`in t))return!1;let{breadcrumb:n}=t;return typeof n==`string`||typeof n==`function`}function y(e){return e.filter(v).flatMap(e=>{let{breadcrumb:t}=e.handle;return(typeof t==`string`?[_(t)]:t(e)).map((t,n)=>{let r=`${e.id}:${n}`;return t.kind===`content`?{kind:`content`,key:r,content:t.content}:t.kind===`label`?{kind:`label`,key:r,label:t.label}:{kind:`link`,key:r,label:t.label,to:t.to??e.pathname}})})}export{g as Breadcrumb,y as buildCrumbs,v as hasBreadcrumb,_ as routeBreadcrumb};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{t as e}from"./use-is-hydrated-BeLOGKwE.js";function t(t){let{children:n,fallback:r}=t,i=r===void 0?null:r;return e()?n():i}export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(){return typeof window<`u`&&typeof document<`u`}export{e as t};
|
package/dist/browser-only.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Browser Only component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/primitives/browser-only
|
|
5
|
+
*/
|
|
1
6
|
import { ReactNode } from "react";
|
|
2
7
|
type Props = {
|
|
3
8
|
/**
|
|
@@ -25,6 +30,9 @@ type Props = {
|
|
|
25
30
|
* the `fallback` is rendered.
|
|
26
31
|
* - On the client, after hydration, the `children` render function is called.
|
|
27
32
|
*
|
|
33
|
+
* @useWhen Render children in the browser only, after hydration, when they read browser state such
|
|
34
|
+
* as `window` or `localStorage`.
|
|
35
|
+
*
|
|
28
36
|
* @see https://mantle.ngrok.com/components/primitives/browser-only
|
|
29
37
|
*
|
|
30
38
|
* @example
|
package/dist/browser-only.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{t as e}from"./browser-only-CZfkNw5A.js";import{t}from"./browser-only-ymFoM3Ya.js";export{e as BrowserOnly,t as canUseDOM};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import "./button-Ddj6yr10.js";
|
|
2
|
+
import "./button-DnYv7IOT.js";
|
|
3
|
+
import { r as VariantProps } from "./index-KJ06KK6t.js";
|
|
1
4
|
import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
|
|
2
|
-
import { t as WithDataSlot } from "./data-slot-
|
|
3
|
-
import { r as VariantProps } from "./index-BhfgyurF.js";
|
|
4
|
-
import "./button-CPsKGDK0.js";
|
|
5
|
-
import "./button-Yxyu1XMd.js";
|
|
5
|
+
import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
|
|
6
6
|
import { ComponentProps } from "react";
|
|
7
7
|
declare const buttonGroupVariants: (props?: ({
|
|
8
8
|
appearance?: "ghost" | "outlined" | "panel" | null | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{t as e}from"./booleanish-BfvnW6vy.js";import{t}from"./cx-CK7o_rVv.js";import{t as n}from"./data-slot-EM6s2WEU.js";import{n as r,r as i}from"./button-DNLTJ32M.js";import{t as a}from"./slot-B7rwscwd.js";import{t as o}from"./button-BQZ6eoD3.js";import{c as s}from"react/compiler-runtime";import{Children as c,cloneElement as l,isValidElement as u}from"react";import d from"tiny-invariant";import{jsx as f}from"react/jsx-runtime";import{CircleNotchIcon as p}from"@phosphor-icons/react/CircleNotch";const m=m=>{let h=s(58),g,_,v,y,b,x,S,C,w,T,E,D,O,k,A;h[0]===m?(g=h[1],_=h[2],v=h[3],y=h[4],b=h[5],x=h[6],S=h[7],C=h[8],w=h[9],T=h[10],E=h[11],D=h[12],O=h[13],k=h[14],A=h[15]):({"aria-disabled":g,"data-slot":x,appearance:v,asChild:D,children:y,className:b,disabled:_,icon:w,intent:S,isLoading:O,label:C,ref:E,size:k,type:A,...T}=m,h[0]=m,h[1]=g,h[2]=_,h[3]=v,h[4]=y,h[5]=b,h[6]=x,h[7]=S,h[8]=C,h[9]=w,h[10]=T,h[11]=E,h[12]=D,h[13]=O,h[14]=k,h[15]=A);let j=D!==void 0&&D,M=O!==void 0&&O,N=k===void 0?`md`:k,P;h[16]!==g||h[17]!==_||h[18]!==M?(P=e(_??M)||e(g),h[16]=g,h[17]=_,h[18]=M,h[19]=P):P=h[19];let F=P,I;h[20]===x?I=h[21]:(I=n(x,`icon-button`),h[20]=x,h[21]=I);let L;h[22]!==v||h[23]!==b||h[24]!==S||h[25]!==M||h[26]!==N?(L=t(o({appearance:v,intent:S,isLoading:M,size:N}),b),h[22]=v,h[23]=b,h[24]=S,h[25]=M,h[26]=N,h[27]=L):L=h[27];let R=F?``:void 0,z=M?``:void 0,B;h[28]!==v||h[29]!==F||h[30]!==S||h[31]!==C||h[32]!==T||h[33]!==E||h[34]!==N||h[35]!==I||h[36]!==L||h[37]!==R||h[38]!==z?(B={"aria-disabled":F,"data-slot":I,className:L,"data-appearance":v,"data-disabled":R,"data-icon-button":!0,"data-intent":S,"data-loading":z,"data-size":N,ref:E,...T,"aria-label":C},h[28]=v,h[29]=F,h[30]=S,h[31]=C,h[32]=T,h[33]=E,h[34]=N,h[35]=I,h[36]=L,h[37]=R,h[38]=z,h[39]=B):B=h[39];let V=B,H=M?`loading`:`idle`,U;h[40]===Symbol.for(`react.memo_cache_sentinel`)?(U=/* @__PURE__ */ f(p,{className:`animate-spin`}),h[40]=U):U=h[40];let W;h[41]===w?W=h[42]:(W={idle:w,loading:U},h[41]=w,h[42]=W);let G;h[43]!==H||h[44]!==W?(G=/* @__PURE__ */ f(i,{active:H,icons:W}),h[43]=H,h[44]=W,h[45]=G):G=h[45];let K=G;if(j){d(u(y)&&c.only(y),"When using `asChild`, IconButton must be passed a single child as a JSX tag.");let e;h[46]!==y||h[47]!==F||h[48]!==K?(e=l(y,F?r:{},K),h[46]=y,h[47]=F,h[48]=K,h[49]=e):e=h[49];let t;return h[50]!==V||h[51]!==e?(t=/* @__PURE__ */ f(a,{...V,children:e}),h[50]=V,h[51]=e,h[52]=t):t=h[52],t}let q=A??`button`,J;return h[53]!==V||h[54]!==F||h[55]!==K||h[56]!==q?(J=/* @__PURE__ */ f(`button`,{...V,disabled:F,type:q,children:K}),h[53]=V,h[54]=F,h[55]=K,h[56]=q,h[57]=J):J=h[57],J};export{m as t};
|
|
@@ -0,0 +1 @@
|
|
|
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";import{cva as a}from"class-variance-authority";const o=a(`border-form inline-flex items-center rounded-md`,{variants:{appearance:{panel:`bg-form gap-0.5 border p-0.75 [--icon-button-border-radius:0.125rem] [&>.separator]:mx-px`,ghost:`gap-0.5`,outlined:``}}}),s=a=>{let s=r(20),c,l,u,d,f,p,m;s[0]===a?(c=s[1],l=s[2],u=s[3],d=s[4],f=s[5],p=s[6],m=s[7]):({"data-slot":f,appearance:c,asChild:l,className:d,children:u,ref:m,...p}=a,s[0]=a,s[1]=c,s[2]=l,s[3]=u,s[4]=d,s[5]=f,s[6]=p,s[7]=m);let h=l?n:`div`,g;s[8]===f?g=s[9]:(g=t(f,`button-group`),s[8]=f,s[9]=g);let _;s[10]!==c||s[11]!==d?(_=e(o({appearance:c}),d),s[10]=c,s[11]=d,s[12]=_):_=s[12];let v;return s[13]!==h||s[14]!==u||s[15]!==p||s[16]!==m||s[17]!==g||s[18]!==_?(v=/* @__PURE__ */ i(h,{"data-slot":g,className:_,ref:m,...p,children:u}),s[13]=h,s[14]=u,s[15]=p,s[16]=m,s[17]=g,s[18]=_,s[19]=v):v=s[19],v};export{s as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{t as e}from"./booleanish-BfvnW6vy.js";import{t}from"./clsx-DUGZgXfJ.js";import{t as n}from"./cx-CK7o_rVv.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{t as ee}from"./icon-xb7d9M7X.js";import{t as i}from"./slot-B7rwscwd.js";import{c as a}from"react/compiler-runtime";import{Children as o,cloneElement as s,isValidElement as c}from"react";import l from"tiny-invariant";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";import{cva as p}from"class-variance-authority";import{CircleNotchIcon as m}from"@phosphor-icons/react/CircleNotch";const h=e=>{let t=a(20),i,o,s,c,l;t[0]===e?(i=t[1],o=t[2],s=t[3],c=t[4],l=t[5]):({"data-slot":s,active:i,className:o,icons:c,...l}=e,t[0]=e,t[1]=i,t[2]=o,t[3]=s,t[4]=c,t[5]=l);let u;t[6]===s?u=t[7]:(u=r(s,`icon-swap`),t[6]=s,t[7]=u);let f;t[8]===o?f=t[9]:(f=n(`inline-grid shrink-0 place-items-center`,o),t[8]=o,t[9]=f);let p;t[10]===c?p=t[11]:(p=Object.entries(c),t[10]=c,t[11]=p);let m;t[12]!==i||t[13]!==p?(m=p.map(e=>{let[t,r]=e,a=t===i;return/* @__PURE__ */ d(`span`,{"data-slot":`icon-swap-item`,"data-state":a?`active`:`inactive`,"aria-hidden":!a||void 0,className:n(`col-start-1 row-start-1 grid place-items-center`,`motion-safe:transition-[opacity,scale,filter,visibility] motion-safe:duration-200 motion-safe:ease-out-strong`,`data-state-inactive:opacity-0 motion-safe:data-state-inactive:scale-50 motion-safe:data-state-inactive:blur-[2px] motion-safe:data-state-inactive:duration-150`,`data-state-inactive:invisible`,`data-state-inactive:*:paused`),children:/* @__PURE__ */ d(ee,{svg:r})},t)}),t[12]=i,t[13]=p,t[14]=m):m=t[14];let h;return t[15]!==l||t[16]!==u||t[17]!==f||t[18]!==m?(h=/* @__PURE__ */ d(`span`,{"data-slot":u,className:f,...l,children:m}),t[15]=l,t[16]=u,t[17]=f,t[18]=m,t[19]=h):h=t[19],h},te=p(``,{variants:{appearance:{filled:`bg-filled-accent text-white focus-visible:ring-focus-accent not-disabled:hover:bg-filled-accent-hover border border-transparent text-sm font-medium`,ghost:`text-accent-600 focus-visible:ring-focus-accent not-disabled:hover:bg-accent-500/10 not-disabled:hover:text-accent-700 border border-transparent text-sm font-medium`,outlined:`border-accent-600 bg-form text-accent-600 focus-visible:ring-focus-accent not-disabled:hover:border-accent-700 not-disabled:hover:bg-accent-500/10 not-disabled:hover:text-accent-700 border text-sm font-medium`,link:`text-accent-600 focus-visible:ring-focus-accent not-disabled:hover:underline group/button-link border-transparent`},isLoading:{false:``,true:`opacity-50`},intent:{accent:``,danger:``,neutral:``},size:{xs:``,sm:``,md:``,lg:``,xl:``}},defaultVariants:{isLoading:!1,size:`md`},compoundVariants:[{appearance:[`filled`,`ghost`,`outlined`],size:`xs`,class:`h-6 px-2`},{appearance:[`filled`,`ghost`,`outlined`],size:`sm`,class:`h-7 px-2.5`},{appearance:[`filled`,`ghost`,`outlined`],size:`md`,class:`h-9 px-3`},{appearance:[`filled`,`ghost`,`outlined`],size:`lg`,class:`h-10 px-3.5`},{appearance:[`filled`,`ghost`,`outlined`],size:`xl`,class:`h-12 px-4`},{appearance:`ghost`,intent:`danger`,class:`text-danger-600 focus-visible:ring-focus-danger not-disabled:hover:bg-danger-500/10 not-disabled:hover:text-danger-700 border-transparent`},{appearance:`outlined`,intent:`danger`,class:`border-danger-600 bg-form text-danger-600 focus-visible:ring-focus-danger not-disabled:hover:border-danger-700 not-disabled:hover:bg-danger-500/10 not-disabled:hover:text-danger-700`},{appearance:`filled`,intent:`danger`,class:`bg-filled-danger focus-visible:ring-focus-danger not-disabled:hover:bg-filled-danger-hover border-transparent`},{appearance:`link`,intent:`danger`,class:`text-danger-600 focus-visible:ring-focus-danger`},{appearance:`ghost`,intent:`neutral`,class:`text-strong focus-visible:ring-focus-accent not-disabled:hover:bg-neutral-500/10 not-disabled:hover:text-strong border-transparent`},{appearance:`outlined`,intent:`neutral`,class:`border-form bg-form text-strong focus-visible:border-accent-600 focus-visible:ring-focus-accent not-disabled:hover:border-neutral-400 not-disabled:hover:bg-form-hover not-disabled:hover:text-strong focus-visible:not-disabled:hover:border-accent-600 focus-visible:not-disabled:active:border-accent-600`},{appearance:`filled`,intent:`neutral`,class:`bg-filled-neutral not-disabled:hover:bg-filled-neutral-hover border-transparent focus-visible:border-transparent text-neutral-50`},{appearance:`link`,intent:`neutral`,class:`text-strong focus-visible:ring-focus-accent`}]}),ne={xs:`ps-1.5`,sm:`ps-2`,md:`ps-2.5`,lg:`ps-3`,xl:`ps-3.5`},re={xs:`pe-1.5`,sm:`pe-2`,md:`pe-2.5`,lg:`pe-3`,xl:`pe-3.5`},g=p=>{let g=a(68),_,v,y,b,x,S,C,w,T,E,D,O,k,A,j;g[0]===p?(_=g[1],v=g[2],y=g[3],b=g[4],x=g[5],S=g[6],C=g[7],w=g[8],T=g[9],E=g[10],D=g[11],O=g[12],k=g[13],A=g[14],j=g[15]):({"aria-disabled":_,"data-slot":C,appearance:y,asChild:b,children:x,className:S,disabled:v,icon:T,iconPlacement:O,intent:w,isLoading:k,ref:D,size:A,type:j,...E}=p,g[0]=p,g[1]=_,g[2]=v,g[3]=y,g[4]=b,g[5]=x,g[6]=S,g[7]=C,g[8]=w,g[9]=T,g[10]=E,g[11]=D,g[12]=O,g[13]=k,g[14]=A,g[15]=j);let M=O===void 0?`start`:O,N=k!==void 0&&k,P=A===void 0?`md`:A,F;g[16]!==_||g[17]!==v||g[18]!==N?(F=e(v??N)||e(_),g[16]=_,g[17]=v,g[18]=N,g[19]=F):F=g[19];let I=F,L;g[20]===Symbol.for(`react.memo_cache_sentinel`)?(L=/* @__PURE__ */ d(m,{className:`animate-spin`}),g[20]=L):L=g[20];let ae=L,R=M===`end`&&`order-last`,z;g[21]===R?z=g[22]:(z=t(R),g[21]=R,g[22]=z);let B=z,V;g[23]!==B||g[24]!==N||g[25]!==T?(V=T?/* @__PURE__ */ d(h,{active:N?`loading`:`idle`,icons:{idle:T,loading:ae},className:B}):N&&/* @__PURE__ */ d(ee,{svg:ae,className:B}),g[23]=B,g[24]=N,g[25]=T,g[26]=V):V=g[26];let H=V,U=H&&y!==`link`,W;g[27]===C?W=g[28]:(W=r(C,`button`),g[27]=C,g[28]=W);let G;g[29]!==y||g[30]!==S||g[31]!==U||g[32]!==M||g[33]!==w||g[34]!==N||g[35]!==P?(G=n(`inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md`,`focus:outline-hidden focus-visible:ring-4`,`disabled:cursor-default disabled:opacity-50`,`aria-disabled:cursor-default aria-disabled:opacity-50`,`not-disabled:active:scale-97 ease-out transition-transform duration-150`,te({appearance:y,intent:w,isLoading:N,size:P}),y!==`link`&&`font-sans`,U&&M===`start`&&ne[P],U&&M===`end`&&re[P],S),g[29]=y,g[30]=S,g[31]=U,g[32]=M,g[33]=w,g[34]=N,g[35]=P,g[36]=G):G=g[36];let K=I?``:void 0,q=N?``:void 0,J=y===`link`?void 0:P,Y;g[37]!==y||g[38]!==I||g[39]!==w||g[40]!==E||g[41]!==D||g[42]!==G||g[43]!==K||g[44]!==q||g[45]!==J||g[46]!==W?(Y={"aria-disabled":I,"data-slot":W,className:G,"data-appearance":y,"data-disabled":K,"data-intent":w,"data-loading":q,"data-size":J,ref:D,...E},g[37]=y,g[38]=I,g[39]=w,g[40]=E,g[41]=D,g[42]=G,g[43]=K,g[44]=q,g[45]=J,g[46]=W,g[47]=Y):Y=g[47];let X=Y;if(b){l(c(x)&&o.only(x),"When using `asChild`, Button must be passed a single child as a JSX tag.");let e;if(g[48]!==x||g[49]!==I||g[50]!==H){let t;g[52]===x.props.children?t=g[53]:(t=/* @__PURE__ */ d(`span`,{"data-slot":`button-label`,className:`contents`,children:x.props.children}),g[52]=x.props.children,g[53]=t);let n;g[54]!==H||g[55]!==t?(n=/* @__PURE__ */ f(u,{children:[H,t]}),g[54]=H,g[55]=t,g[56]=n):n=g[56],e=s(x,I?ie:{},n),g[48]=x,g[49]=I,g[50]=H,g[51]=e}else e=g[51];let t;return g[57]!==X||g[58]!==e?(t=/* @__PURE__ */ d(i,{...X,children:e}),g[57]=X,g[58]=e,g[59]=t):t=g[59],t}let Z=j??`button`,Q;g[60]===x?Q=g[61]:(Q=/* @__PURE__ */ d(`span`,{"data-slot":`button-label`,className:`contents`,children:x}),g[60]=x,g[61]=Q);let $;return g[62]!==X||g[63]!==I||g[64]!==H||g[65]!==Z||g[66]!==Q?($=/* @__PURE__ */ f(`button`,{...X,disabled:I,type:Z,children:[H,Q]}),g[62]=X,g[63]=I,g[64]=H,g[65]=Z,g[66]=Q,g[67]=$):$=g[67],$},ie={tabIndex:-1,onClickCapture:e=>{e.preventDefault(),e.stopPropagation()}};export{ie as n,h as r,g as t};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { r as VariantProps } from "./index-KJ06KK6t.js";
|
|
3
|
+
import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
|
|
4
4
|
import { ComponentProps, ReactNode } from "react";
|
|
5
5
|
/**
|
|
6
6
|
* The tone axis of the text-labelled button family (`Button` and
|
|
7
|
-
* `SplitButton`)
|
|
7
|
+
* `SplitButton`): the purpose a button's color communicates to the user.
|
|
8
8
|
*
|
|
9
|
-
* - `"neutral"
|
|
9
|
+
* - `"neutral"`: the workhorse tone: routine and secondary actions, and the
|
|
10
10
|
* default primary action (`appearance="filled" intent="neutral"`)
|
|
11
|
-
* - `"accent"
|
|
11
|
+
* - `"accent"`: deliberate brand emphasis, colored with the accent tokens
|
|
12
12
|
* (e.g. `bg-filled-accent`, `text-accent-600`); reach for it when an
|
|
13
13
|
* action should carry the brand color, not as the routine primary
|
|
14
|
-
* - `"danger"
|
|
14
|
+
* - `"danger"`: a destructive or irreversible action
|
|
15
15
|
*
|
|
16
16
|
* There is no default: `intent` is a required prop on the button family so
|
|
17
17
|
* every call site states the tone it means. `IconButton` takes the narrower
|
|
18
|
-
* `IconButtonIntent
|
|
18
|
+
* `IconButtonIntent`: an icon carries no text to name the action a tone
|
|
19
19
|
* colors, so it draws the neutral tone only.
|
|
20
20
|
*
|
|
21
21
|
* See `decisions/2026-07-13-button-size-and-intent-api.md`.
|
|
@@ -33,10 +33,10 @@ type ButtonIntent = "accent" | "danger" | "neutral";
|
|
|
33
33
|
* The visual style of a `Button`: how much visual weight the button carries,
|
|
34
34
|
* independent of its tone (`intent`).
|
|
35
35
|
*
|
|
36
|
-
* - `"filled"
|
|
37
|
-
* - `"outlined"
|
|
38
|
-
* - `"ghost"
|
|
39
|
-
* - `"link"
|
|
36
|
+
* - `"filled"`: solid fill; the heaviest weight on the page
|
|
37
|
+
* - `"outlined"`: bordered on the form background
|
|
38
|
+
* - `"ghost"`: no border or fill until hovered
|
|
39
|
+
* - `"link"`: renders like an inline link (inherits surrounding typography)
|
|
40
40
|
* while remaining a button that runs an action
|
|
41
41
|
*/
|
|
42
42
|
type ButtonAppearance = "filled" | "ghost" | "link" | "outlined";
|
|
@@ -52,8 +52,8 @@ type ButtonVariants = VariantProps<typeof buttonVariants>;
|
|
|
52
52
|
*/
|
|
53
53
|
type ButtonProps = ComponentProps<"button"> & Omit<ButtonVariants, "appearance" | "intent"> & WithAsChild & {
|
|
54
54
|
/**
|
|
55
|
-
* The visual style of the Button. Required
|
|
56
|
-
* every call site states the weight it means.
|
|
55
|
+
* The visual style of the Button. Required: there is no default, so
|
|
56
|
+
* every call site states the visual weight it means.
|
|
57
57
|
*
|
|
58
58
|
* @enum
|
|
59
59
|
* - `"filled"`: solid fill; the heaviest visual weight
|
|
@@ -63,12 +63,12 @@ type ButtonProps = ComponentProps<"button"> & Omit<ButtonVariants, "appearance"
|
|
|
63
63
|
*/
|
|
64
64
|
appearance: ButtonAppearance;
|
|
65
65
|
/**
|
|
66
|
-
* The tone of the Button
|
|
67
|
-
* user. Required
|
|
66
|
+
* The tone of the Button (the purpose its color communicates to the
|
|
67
|
+
* user). Required: there is no default, so every call site states the
|
|
68
68
|
* tone it means.
|
|
69
69
|
*
|
|
70
70
|
* @enum
|
|
71
|
-
* - `"neutral"`: the workhorse tone
|
|
71
|
+
* - `"neutral"`: the workhorse tone: routine and secondary actions, and the default primary action (`appearance="filled" intent="neutral"`)
|
|
72
72
|
* - `"accent"`: deliberate brand emphasis; reach for it when an action should carry the brand color, not as the routine primary
|
|
73
73
|
* - `"danger"`: a destructive or irreversible action
|
|
74
74
|
*/
|
|
@@ -84,7 +84,7 @@ type ButtonProps = ComponentProps<"button"> & Omit<ButtonVariants, "appearance"
|
|
|
84
84
|
* The icon gets `size-5`. A size class on the icon element wins, as in
|
|
85
85
|
* `icon={<GearIcon className="size-4" />}`.
|
|
86
86
|
*
|
|
87
|
-
* For an icon-only button, do not use `Button
|
|
87
|
+
* For an icon-only button, do not use `Button`. Use `IconButton`
|
|
88
88
|
* instead: it requires an accessible `label` and renders a square box
|
|
89
89
|
* on the same shared size scale.
|
|
90
90
|
*/
|
|
@@ -97,7 +97,7 @@ type ButtonProps = ComponentProps<"button"> & Omit<ButtonVariants, "appearance"
|
|
|
97
97
|
iconPlacement?: "start" | "end";
|
|
98
98
|
/**
|
|
99
99
|
* The behavior of the button when activated. Defaults to `"button"`, so the
|
|
100
|
-
* button does not accidentally submit a surrounding `<form
|
|
100
|
+
* button does not accidentally submit a surrounding `<form>`. Pass
|
|
101
101
|
* `type="submit"` to submit a form, or `type="reset"` to reset it.
|
|
102
102
|
*
|
|
103
103
|
* When `asChild` is used, `type` has no effect and is not forwarded to the
|
|
@@ -120,14 +120,14 @@ type ButtonProps = ComponentProps<"button"> & Omit<ButtonVariants, "appearance"
|
|
|
120
120
|
* other assistive technology. Once activated, it then runs an action, such
|
|
121
121
|
* as submitting a form or opening a dialog.
|
|
122
122
|
*
|
|
123
|
-
* `appearance` (visual weight) and `intent` (tone) are required
|
|
123
|
+
* `appearance` (visual weight) and `intent` (tone) are required: every call
|
|
124
124
|
* site states what it means; there are no implicit defaults.
|
|
125
125
|
*
|
|
126
|
-
* The primary action button should be `appearance="filled" intent="neutral"
|
|
126
|
+
* The primary action button should be `appearance="filled" intent="neutral"`,
|
|
127
127
|
* the system's default primary action. Reserve `intent="accent"` for
|
|
128
128
|
* deliberate brand emphasis.
|
|
129
129
|
*
|
|
130
|
-
* An icon-only button is not a `Button
|
|
130
|
+
* An icon-only button is not a `Button`. Use `IconButton` instead: an
|
|
131
131
|
* icon-only `Button` has no accessible name and keeps its text-box padding,
|
|
132
132
|
* while `IconButton` requires a screen-reader `label` and renders a square
|
|
133
133
|
* box on the same shared size scale.
|
|
@@ -138,11 +138,11 @@ type ButtonProps = ComponentProps<"button"> & Omit<ButtonVariants, "appearance"
|
|
|
138
138
|
*
|
|
139
139
|
* **Structure.** `children` render inside a `<span data-slot="button-label">`,
|
|
140
140
|
* beside the `icon` slot. The span carries `display: contents`, so it lays out
|
|
141
|
-
* nothing of its own
|
|
141
|
+
* nothing of its own: every child stays a flex item of the button, and the
|
|
142
142
|
* button's `gap` still falls between them. The span exists so a newly-appearing
|
|
143
143
|
* icon inserts before an element sibling: a browser translation engine reparents
|
|
144
|
-
* text nodes, and an insert aimed at one throws. To style the label as a box
|
|
145
|
-
* `truncate` to clamp a long one
|
|
144
|
+
* text nodes, and an insert aimed at one throws. To style the label as a box
|
|
145
|
+
* (`truncate` to clamp a long one), give the slot a display of its own first, with
|
|
146
146
|
* `[&>[data-slot=button-label]]:block`.
|
|
147
147
|
*
|
|
148
148
|
* **Disabled and loading.** A native `<button>` gets the `disabled` attribute.
|
|
@@ -168,10 +168,17 @@ type ButtonProps = ComponentProps<"button"> & Omit<ButtonVariants, "appearance"
|
|
|
168
168
|
* | `data-loading` | present when `isLoading` | Presence-only, never `"false"`. |
|
|
169
169
|
* | `data-disabled` | present when disabled | Presence-only, never `"false"`, since the `data-disabled:` variant matches the attribute's existence. Set when the button resolves disabled: `disabled`, `aria-disabled="true"`, or `isLoading` with no explicit `disabled`. `disabled={false}` keeps a loading button enabled and omits it. |
|
|
170
170
|
*
|
|
171
|
+
* @useWhen Run an action on a click: submit a form, save a change, or open a dialog.
|
|
172
|
+
*
|
|
173
|
+
* @siblings
|
|
174
|
+
* - `IconButton`: the button shows one icon and no text.
|
|
175
|
+
* - `SplitButton`: a default action sits beside a menu of related actions.
|
|
176
|
+
* - `Anchor`: the control goes to another address and runs no action.
|
|
177
|
+
*
|
|
171
178
|
* @see https://mantle.ngrok.com/components/actions/button
|
|
172
179
|
*
|
|
173
180
|
* @example
|
|
174
|
-
* The default primary action
|
|
181
|
+
* The default primary action (filled + neutral):
|
|
175
182
|
* ```tsx
|
|
176
183
|
* <Button appearance="filled" intent="neutral" onClick={handleClick}>
|
|
177
184
|
* Click me
|
|
@@ -179,7 +186,7 @@ type ButtonProps = ComponentProps<"button"> & Omit<ButtonVariants, "appearance"
|
|
|
179
186
|
* ```
|
|
180
187
|
*
|
|
181
188
|
* @example
|
|
182
|
-
* Submit a form
|
|
189
|
+
* Submit a form. Opt in with `type="submit"` (the default `"button"` does not submit):
|
|
183
190
|
* ```tsx
|
|
184
191
|
* <Button type="submit" appearance="filled" intent="neutral">
|
|
185
192
|
* Save
|
|
@@ -221,7 +228,7 @@ type ButtonProps = ComponentProps<"button"> & Omit<ButtonVariants, "appearance"
|
|
|
221
228
|
* ```
|
|
222
229
|
*
|
|
223
230
|
* @example
|
|
224
|
-
* Icon-only buttons are not `Button`s
|
|
231
|
+
* Icon-only buttons are not `Button`s. Use `IconButton` instead (an icon-only
|
|
225
232
|
* `Button` has no accessible name and keeps its text-box padding):
|
|
226
233
|
* ```tsx
|
|
227
234
|
* // ❌ <Button appearance="outlined" intent="neutral" icon={<CopyIcon />} onClick={copyPage} />
|