@ngrok/mantle 0.94.0 → 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 +61 -21
- package/dist/accordion.js +1 -1
- package/dist/agent.json +61 -56
- package/dist/alert-BkJHDx9X.js +1 -0
- package/dist/{alert-HffaioZM.d.ts → alert-D0zRRUHV.d.ts} +6 -6
- package/dist/alert-center.d.ts +53 -53
- package/dist/alert-center.js +1 -1
- package/dist/alert-dialog.d.ts +22 -10
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +1 -1
- package/dist/alert.js +1 -1
- package/dist/anchor-Dc6IgvXV.js +1 -0
- package/dist/anchor.d.ts +5 -5
- package/dist/anchor.js +1 -1
- package/dist/app-layout.d.ts +18 -18
- package/dist/app-layout.js +1 -1
- package/dist/area-chart.d.ts +13 -13
- package/dist/area-chart.js +1 -1
- package/dist/avatar.d.ts +24 -24
- package/dist/avatar.js +1 -1
- package/dist/badge.d.ts +7 -7
- package/dist/badge.js +1 -1
- package/dist/bar-chart.d.ts +12 -12
- package/dist/bar-chart.js +1 -1
- package/dist/breadcrumb.d.ts +36 -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.js +1 -1
- package/dist/{button-K0pKc3GN.d.ts → button-5Pc7Mby_.d.ts} +3 -3
- package/dist/button-B9bChDgl.js +1 -0
- package/dist/button-D8jixIbH.js +1 -0
- package/dist/button-DNLTJ32M.js +1 -0
- package/dist/{button-Cgf2IcEC.d.ts → button-Ddj6yr10.d.ts} +26 -26
- package/dist/{button-BGwOPjGV.d.ts → button-DnYv7IOT.d.ts} +22 -21
- package/dist/button.d.ts +3 -3
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +1 -1
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +1 -1
- package/dist/card.js +1 -1
- package/dist/centered-layout.d.ts +23 -23
- package/dist/centered-layout.js +1 -1
- package/dist/{chart-CE5Uaqz9.js → chart-BLCqzt56.js} +1 -1
- package/dist/{chart-DCTGGlWL.js → chart-CChZiCrt.js} +1 -1
- package/dist/{chart-BO9EwQ60.js → chart-CUmSu9d7.js} +1 -1
- package/dist/{chart-jitNqimS.d.ts → chart-Dl8gFo_D.d.ts} +22 -22
- package/dist/chart-DtgZBAas.js +2 -0
- package/dist/checkbox-Cu5cgZmk.js +1 -0
- package/dist/checkbox.d.ts +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/choice-CCVG2hb9.js +1 -0
- package/dist/{choice-BwfmbepO.d.ts → choice-CNiOSzqV.d.ts} +20 -20
- package/dist/choice.d.ts +1 -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 +15 -17
- package/dist/code-block.js +1 -1
- package/dist/code-block_highlight-utils.d.ts +1 -1
- package/dist/code-block_highlight-utils.js +1 -1
- package/dist/code.d.ts +3 -3
- package/dist/code.js +1 -1
- package/dist/combobox.d.ts +15 -15
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +47 -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/{data-slot-B-LqAcBB.d.ts → data-slot-BW8KQ9Xo.d.ts} +2 -2
- package/dist/data-table.d.ts +36 -36
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +1 -1
- package/dist/description-list.js +1 -1
- package/dist/{dialog-DD5H3EH1.d.ts → dialog-CIEuwNys.d.ts} +24 -8
- package/dist/{dialog-B9JAGy_x.d.ts → dialog-CbEEA0fl.d.ts} +7 -3
- package/dist/dialog-DmzoDfY3.js +1 -0
- package/dist/dialog.d.ts +2 -2
- package/dist/dialog.js +1 -1
- package/dist/{dropdown-menu-DmDxYPde.d.ts → dropdown-menu-CeY498yk.d.ts} +10 -10
- package/dist/dropdown-menu-uheL0prz.js +1 -0
- package/dist/dropdown-menu.d.ts +1 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +2 -2
- package/dist/empty.js +1 -1
- package/dist/field-Bpvn4tQp.js +1 -0
- package/dist/field-Cai_4c1l.js +1 -0
- package/dist/field.d.ts +41 -41
- package/dist/field.js +1 -1
- package/dist/flag.d.ts +3 -3
- package/dist/flag.js +1 -1
- package/dist/hooks.d.ts +30 -10
- package/dist/hooks.js +1 -1
- package/dist/hover-card.d.ts +3 -3
- package/dist/hover-card.js +1 -1
- package/dist/{icon-CgNqu-fl.d.ts → icon--purqHRo.d.ts} +1 -1
- package/dist/{icon-NYvyyRMG.d.ts → icon-DuIYoyft.d.ts} +2 -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 +3 -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 +2 -2
- package/dist/icons.js +1 -1
- package/dist/{in-view-B3nMAzfE.d.ts → in-view-C_daNafg.d.ts} +4 -23
- package/dist/{input-q8o5uMhW.d.ts → input-DC4nW0Sr.d.ts} +1 -1
- package/dist/input-fW8QSZEO.js +1 -0
- package/dist/input.d.ts +4 -4
- package/dist/input.js +1 -1
- package/dist/kbd-P1nQshWo.js +1 -0
- package/dist/kbd.d.ts +5 -5
- package/dist/kbd.js +1 -1
- package/dist/label-DO1RlMKl.js +1 -0
- package/dist/{label-r2sJcSQ4.d.ts → label-epgtywRz.d.ts} +8 -8
- package/dist/label.d.ts +1 -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 +12 -12
- package/dist/line-chart.js +1 -1
- package/dist/list-cQZPSjfz.js +1 -0
- package/dist/list.d.ts +17 -17
- package/dist/list.js +1 -1
- package/dist/live-region-Dhapu8a5.js +1 -0
- package/dist/live-region.d.ts +1 -1
- package/dist/live-region.js +1 -1
- package/dist/llms.txt +23 -22
- package/dist/main-CHyWYDak.js +1 -0
- package/dist/main.d.ts +1 -1
- package/dist/main.js +1 -1
- package/dist/mantle.css +25 -25
- package/dist/media-object.d.ts +4 -4
- package/dist/media-object.js +1 -1
- package/dist/multi-select.d.ts +28 -28
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +3 -3
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +4 -4
- package/dist/pagination.js +1 -1
- package/dist/{popover-lwkwWcRW.d.ts → popover-Bei0jyfH.d.ts} +73 -7
- package/dist/popover-DhgunktK.js +1 -0
- package/dist/popover-T2EyaqGK.d.ts +1 -0
- package/dist/popover.d.ts +2 -2
- package/dist/popover.js +1 -1
- package/dist/primitive-D8CzV_Ft.js +1 -0
- package/dist/progress.d.ts +1 -1
- package/dist/progress.js +1 -1
- package/dist/qr-code.d.ts +3 -3
- package/dist/qr-code.js +1 -1
- package/dist/query-filter.d.ts +6 -6
- package/dist/query.d.ts +8 -3
- package/dist/query.js +1 -1
- package/dist/{radio-group-sLz5AA9I.d.ts → radio-group-BJQ6EOqh.d.ts} +1 -1
- package/dist/radio-group-BliblUqe.js +1 -0
- package/dist/radio-group-ggEkCi0V.js +1 -0
- package/dist/radio-group.d.ts +2 -2
- package/dist/radio-group.js +1 -1
- package/dist/sandbar.d.ts +30 -30
- package/dist/sandbar.js +1 -1
- package/dist/sandboxed-on-click-D4PL5_GR.js +1 -0
- package/dist/sandboxed-on-click.js +1 -1
- package/dist/scatter-plot.d.ts +13 -14
- package/dist/scatter-plot.js +1 -1
- package/dist/segmented-control.d.ts +1 -1
- package/dist/segmented-control.js +1 -1
- package/dist/select-1xuUx_os.js +1 -0
- package/dist/{select-BqmpVJJT.d.ts → select-BpaXHxJm.d.ts} +6 -6
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +18 -18
- package/dist/selectable-list.js +1 -1
- package/dist/{separator-QfH0ot5K.d.ts → separator-Ck4sPrdN.d.ts} +1 -1
- package/dist/separator-DnvhwY2J.js +1 -0
- package/dist/separator.d.ts +1 -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 +23 -7
- package/dist/sheet.js +1 -1
- package/dist/sidebar.d.ts +37 -37
- package/dist/sidebar.js +1 -1
- package/dist/skeleton-DHfyjuQi.js +1 -0
- package/dist/skeleton.d.ts +4 -4
- package/dist/skeleton.js +1 -1
- package/dist/skip-to-main-link.d.ts +1 -1
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slider.d.ts +1 -1
- package/dist/slider.js +1 -1
- package/dist/slot-B7rwscwd.js +1 -0
- package/dist/{slot-D12N_fZJ.d.ts → slot-BEMQMbk3.d.ts} +4 -4
- package/dist/slot.d.ts +1 -1
- package/dist/slot.js +1 -1
- package/dist/source-all.css +5 -1
- package/dist/split-button.d.ts +9 -9
- package/dist/split-button.js +1 -1
- package/dist/strata.d.ts +22 -22
- package/dist/strata.js +1 -1
- package/dist/{suggestions-NkqYTT49.d.ts → suggestions-BJeGvwDa.d.ts} +7 -7
- package/dist/switch.d.ts +1 -1
- package/dist/switch.js +1 -1
- package/dist/table-BnLdXUai.js +1 -0
- package/dist/{table-rWiVWEgB.d.ts → table-Ii9hHUWN.d.ts} +5 -5
- package/dist/table.d.ts +1 -1
- package/dist/table.js +1 -1
- package/dist/tabs.d.ts +2 -2
- package/dist/tabs.js +1 -1
- package/dist/text-area.d.ts +1 -1
- package/dist/text-area.js +1 -1
- package/dist/theme-BNdZl352.js +1 -0
- package/dist/theme-switcher.d.ts +4 -4
- package/dist/theme-switcher.js +1 -1
- package/dist/theme.d.ts +14 -12
- package/dist/theme.js +1 -1
- package/dist/toast.d.ts +2 -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-CpK3XTor.d.ts → tooltip-CstGDKwy.d.ts} +4 -4
- package/dist/tooltip-DQO40Mrq.js +1 -0
- package/dist/tooltip.d.ts +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/truncated-text.d.ts +1 -1
- package/dist/truncated-text.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 +1 -1
- package/dist/visually-hidden.js +1 -1
- package/dist/well.d.ts +1 -1
- package/dist/well.js +1 -1
- package/package.json +16 -2
- package/dist/alert-CH99Rw-R.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-BWGUuWnu.js +0 -1
- package/dist/button-Cu9e3SM7.js +0 -1
- package/dist/chart-DudCw24t.js +0 -2
- package/dist/checkbox-CS504fKk.js +0 -1
- package/dist/choice-uyYccm0A.js +0 -1
- package/dist/code-DUJzSl4K.js +0 -1
- package/dist/compose-refs-sFdxsL7k.js +0 -1
- package/dist/dialog-CsugEt2A.js +0 -1
- package/dist/dropdown-menu-DHdgaw4P.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-4JA-SGfv.js +0 -1
- package/dist/icons-CDLz5lpI.js +0 -1
- package/dist/icons-CSwTVV2m.js +0 -1
- package/dist/input-DHovzBjS.js +0 -1
- package/dist/kbd-CLHsJ99p.js +0 -1
- package/dist/label-DmDwzPD8.js +0 -1
- package/dist/layer-container-kEQiE4zV.js +0 -1
- package/dist/list-CO_yLdln.js +0 -1
- package/dist/live-region-DQ1QLv3L.js +0 -1
- package/dist/main-CC1L9IsH.js +0 -1
- package/dist/popover-BhTFutCz.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/radio-group-jj2abc0t.js +0 -1
- package/dist/sandboxed-on-click-C7pPu-2M.js +0 -1
- package/dist/select-C6Su0dU0.js +0 -1
- package/dist/separator-DfzxVutO.js +0 -1
- package/dist/sheet-Bd2LIhzF.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-DdZgLvKH.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-inert-siblings-CNmNuS2h.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-i__cTF2v.js +0 -1
package/dist/alert-center.d.ts
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @see https://mantle.ngrok.com/components/feedback/alert-center
|
|
5
5
|
*/
|
|
6
|
-
import { t as WithDataSlot } from "./data-slot-
|
|
7
|
-
import { t as Alert } from "./alert-
|
|
6
|
+
import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
|
|
7
|
+
import { t as Alert } from "./alert-D0zRRUHV.js";
|
|
8
8
|
import { ComponentProps, ReactNode } from "react";
|
|
9
9
|
/**
|
|
10
|
-
* The tone an alert's color communicates
|
|
10
|
+
* The tone an alert's color communicates, identical to `Alert`'s intent axis,
|
|
11
11
|
* so an item's `intent` flows straight through to the `Alert` chrome that
|
|
12
12
|
* renders it. Also the severity ranking key: `danger` › `warning` ›
|
|
13
13
|
* `important` › `info` › `success` decides which item the bar shows.
|
|
@@ -21,7 +21,7 @@ import { ComponentProps, ReactNode } from "react";
|
|
|
21
21
|
*/
|
|
22
22
|
type AlertCenterIntent = "danger" | "important" | "info" | "success" | "warning";
|
|
23
23
|
/**
|
|
24
|
-
* Props for {@link AlertCenter.Root}
|
|
24
|
+
* Props for {@link AlertCenter.Root}: the expansion's open state. The alerts
|
|
25
25
|
* themselves are authored as `AlertCenter.Item` children.
|
|
26
26
|
*
|
|
27
27
|
* @see https://mantle.ngrok.com/components/feedback/alert-center#alertcenterroot
|
|
@@ -48,7 +48,7 @@ type AlertCenterRootProps = {
|
|
|
48
48
|
onOpenChange?: (open: boolean) => void;
|
|
49
49
|
/**
|
|
50
50
|
* The `AlertCenter.Bar`, `AlertCenter.Content`, and every `AlertCenter.Item`.
|
|
51
|
-
* Items may be authored anywhere under the root
|
|
51
|
+
* Items may be authored anywhere under the root. Their children stay in this
|
|
52
52
|
* tree and are projected into the bar or an expansion row by rank.
|
|
53
53
|
*/
|
|
54
54
|
children?: ReactNode;
|
|
@@ -61,7 +61,7 @@ type AlertCenterRootProps = {
|
|
|
61
61
|
* notice, so all top-of-viewport messaging shares one layout slot.
|
|
62
62
|
*
|
|
63
63
|
* Items register client-side (from layout effects), so server-rendered HTML
|
|
64
|
-
* contains no bar; it enters with its height animation after hydration
|
|
64
|
+
* contains no bar; it enters with its height animation after hydration, the
|
|
65
65
|
* same entrance every arriving alert gets by design.
|
|
66
66
|
*
|
|
67
67
|
* **Data attributes:**
|
|
@@ -82,7 +82,7 @@ type AlertCenterRootProps = {
|
|
|
82
82
|
* <Alert.Icon />
|
|
83
83
|
* <Alert.Content>
|
|
84
84
|
* <Alert.Title>
|
|
85
|
-
* Payment failed
|
|
85
|
+
* Payment failed: <a href="/billing">update your card</a>
|
|
86
86
|
* </Alert.Title>
|
|
87
87
|
* </Alert.Content>
|
|
88
88
|
* </AlertCenter.Item>
|
|
@@ -93,7 +93,7 @@ type AlertCenterRootProps = {
|
|
|
93
93
|
declare const Root: ({ children, defaultOpen, onOpenChange, open }: AlertCenterRootProps) => import("react").JSX.Element;
|
|
94
94
|
/**
|
|
95
95
|
* Props for {@link AlertCenter.Item}: the coordination facts the center needs
|
|
96
|
-
* to rank, announce, and label an alert
|
|
96
|
+
* to rank, announce, and label an alert. Everything presentational is the
|
|
97
97
|
* authored `children`.
|
|
98
98
|
*
|
|
99
99
|
* @see https://mantle.ngrok.com/components/feedback/alert-center#alertcenteritem
|
|
@@ -119,7 +119,7 @@ type AlertCenterItemProps = {
|
|
|
119
119
|
* their state as the host moves between the bar and a row), pins the
|
|
120
120
|
* item's arrival order (a returning id resumes its original position), and
|
|
121
121
|
* is stamped on the chrome as `data-alert-id` for styling. Must be unique
|
|
122
|
-
* among the items mounted under one `AlertCenter.Root
|
|
122
|
+
* among the items mounted under one `AlertCenter.Root`. A second mounted
|
|
123
123
|
* item claiming the same id throws, since both would project into that
|
|
124
124
|
* id's single host.
|
|
125
125
|
*/
|
|
@@ -143,7 +143,7 @@ type AlertCenterItemProps = {
|
|
|
143
143
|
/**
|
|
144
144
|
* The banner content: compose `Alert.Icon`, `Alert.Content`, `Alert.Title`,
|
|
145
145
|
* `Alert.Description`, and `AlertCenter.DismissIconButton`. Do NOT include
|
|
146
|
-
* `Alert.Root
|
|
146
|
+
* `Alert.Root`: the center renders the chrome (with this item's `intent`)
|
|
147
147
|
* at whichever placement the item ranks into.
|
|
148
148
|
*/
|
|
149
149
|
children: ReactNode;
|
|
@@ -153,18 +153,18 @@ type AlertCenterItemProps = {
|
|
|
153
153
|
* with the center and renders its children through a portal into a stable
|
|
154
154
|
* per-id host element that `AlertCenter.Bar` / `AlertCenter.Content`
|
|
155
155
|
* physically adopt into their chrome. Mount it to show the alert, unmount it
|
|
156
|
-
* to remove it
|
|
156
|
+
* to remove it. Dismissal is your state flipping the condition off.
|
|
157
157
|
*
|
|
158
158
|
* Because the children stay in YOUR React tree (only their DOM lands in the
|
|
159
159
|
* chrome), context providers and error boundaries around the item work, and
|
|
160
160
|
* router-aware links resolve at the authoring location. The host element is
|
|
161
|
-
* stable and moved
|
|
161
|
+
* stable and moved (not remounted) between the bar and a row, so authored
|
|
162
162
|
* content keeps its state (and, in engines with `Element.moveBefore`, even
|
|
163
163
|
* focus) across re-ranks. While an item ranks nowhere visible (e.g. the
|
|
164
|
-
* expansion is not composed), its children stay mounted on a detached host
|
|
165
|
-
*
|
|
164
|
+
* expansion is not composed), its children stay mounted on a detached host:
|
|
165
|
+
* React renders them, and they add nothing to the document.
|
|
166
166
|
*
|
|
167
|
-
* Server rendering emits no alert DOM
|
|
167
|
+
* Server rendering emits no alert DOM. The bar enters after hydration with
|
|
168
168
|
* its height animation, the same entrance every arriving alert gets.
|
|
169
169
|
*
|
|
170
170
|
* **Structure.** `children` render inside a
|
|
@@ -181,7 +181,7 @@ type AlertCenterItemProps = {
|
|
|
181
181
|
* | --- | --- | --- |
|
|
182
182
|
* | `data-slot` | `alert-center-item-host` | On the stable per-id host element the item's children portal into. |
|
|
183
183
|
* | `data-slot` | `alert-center-item-label` | On the layout-transparent element inside the host that wraps the item's children. |
|
|
184
|
-
* | `data-alert-host` | the item's `id` | On that same host
|
|
184
|
+
* | `data-alert-host` | the item's `id` | On that same host: which alert's projected children it holds. |
|
|
185
185
|
*
|
|
186
186
|
* @see https://mantle.ngrok.com/components/feedback/alert-center#alertcenteritem
|
|
187
187
|
*
|
|
@@ -214,11 +214,11 @@ type AlertCenterDismissIconButtonProps = ComponentProps<typeof Alert.DismissIcon
|
|
|
214
214
|
};
|
|
215
215
|
/**
|
|
216
216
|
* The dismiss affordance for the item it's composed inside. A thin wrapper over
|
|
217
|
-
* `Alert.DismissIconButton` whose label defaults to `Dismiss ${title}
|
|
218
|
-
* from the enclosing banner's RENDERED `Alert.Title` text and
|
|
219
|
-
* commit so the accessible name stays in lockstep with the
|
|
220
|
-
* `label` to override, e.g. when the title is long). Compose
|
|
221
|
-
* out
|
|
217
|
+
* `Alert.DismissIconButton` whose label defaults to `Dismiss ${title}`. That
|
|
218
|
+
* label derives from the enclosing banner's RENDERED `Alert.Title` text and is
|
|
219
|
+
* re-read on every commit, so the accessible name stays in lockstep with the
|
|
220
|
+
* visible copy (pass `label` to override, e.g. when the title is long). Compose
|
|
221
|
+
* it (or leave it out) per alert; its presence IS the alert's dismissability.
|
|
222
222
|
*
|
|
223
223
|
* Where the control sits in each placement is the chrome's business, not this
|
|
224
224
|
* wrapper's: `Alert.Root` keeps it rightmost and seats the bar's expand
|
|
@@ -230,7 +230,7 @@ type AlertCenterDismissIconButtonProps = ComponentProps<typeof Alert.DismissIcon
|
|
|
230
230
|
* | Data Attribute | Value | Description |
|
|
231
231
|
* | --- | --- | --- |
|
|
232
232
|
* | `data-slot` | `alert-center-dismiss-icon-button alert-dismiss-icon-button icon-button` | On the rendered button, joined ahead of `Alert.DismissIconButton`'s own slot and `IconButton`'s. |
|
|
233
|
-
* | `data-alert-dismiss` | present | Read, not stamped
|
|
233
|
+
* | `data-alert-dismiss` | present | Read, not stamped. `Alert` emits it, and `AlertCenter`'s bar CSS positions the control with it. |
|
|
234
234
|
*
|
|
235
235
|
* @see https://mantle.ngrok.com/components/feedback/alert-center#alertcenterdismissiconbutton
|
|
236
236
|
*
|
|
@@ -251,13 +251,13 @@ type AlertCenterDismissIconButtonProps = ComponentProps<typeof Alert.DismissIcon
|
|
|
251
251
|
*/
|
|
252
252
|
declare const DismissIconButton: ({ "data-slot": dataSlot, label, ref, ...props }: AlertCenterDismissIconButtonProps) => import("react").JSX.Element;
|
|
253
253
|
type AlertCenterBarProps = Omit<ComponentProps<typeof Alert.Root>, "appearance" | "intent" | "children"> & WithDataSlot & {
|
|
254
|
-
/** The bar renders the top-ranked item's authored children
|
|
254
|
+
/** Not accepted. The bar renders the top-ranked item's authored children. */
|
|
255
255
|
children?: never;
|
|
256
256
|
};
|
|
257
257
|
/**
|
|
258
258
|
* The always-visible, full-width strip. It renders the single highest-severity
|
|
259
|
-
* item's authored children INLINE
|
|
260
|
-
* call-to-action
|
|
259
|
+
* item's authored children INLINE (icon, title, description, and its
|
|
260
|
+
* call-to-action), so the top CTA is one glance (and zero extra clicks) away,
|
|
261
261
|
* then appends a count-and-caret control that expands the additional alerts
|
|
262
262
|
* below the bar. Collapses to nothing when there are no alerts (like
|
|
263
263
|
* `AppLayout.Notice`), so it can stay mounted and render unconditionally.
|
|
@@ -266,12 +266,12 @@ type AlertCenterBarProps = Omit<ComponentProps<typeof Alert.Root>, "appearance"
|
|
|
266
266
|
* content: single-line for a title alone, two lines once an `Alert.Description`
|
|
267
267
|
* is composed (matching how the same alert renders as an expansion row). Its
|
|
268
268
|
* chrome carries `data-placement="bar"` and `data-alert-id` as styling hooks for
|
|
269
|
-
* placement-aware authored content
|
|
269
|
+
* placement-aware authored content: `in-data-[placement=bar]:hidden` keeps a
|
|
270
270
|
* given element out of the bar and shows it only in the expansion.
|
|
271
271
|
*
|
|
272
|
-
* The bar itself claims NO ARIA landmark (deliberately, like `AppLayout.Notice`)
|
|
273
|
-
*
|
|
274
|
-
*
|
|
272
|
+
* The bar itself claims NO ARIA landmark (deliberately, like `AppLayout.Notice`).
|
|
273
|
+
* The persistent visually-hidden `role="status"` region that `AlertCenter.Root`
|
|
274
|
+
* mounts announces arrivals and re-ranks.
|
|
275
275
|
*
|
|
276
276
|
* **Data attributes:**
|
|
277
277
|
*
|
|
@@ -281,10 +281,10 @@ type AlertCenterBarProps = Omit<ComponentProps<typeof Alert.Root>, "appearance"
|
|
|
281
281
|
* | `data-slot` | `alert-center-bar alert` | On the banner chrome the top item's children render inside, joined ahead of `Alert.Root`'s own slot. |
|
|
282
282
|
* | `data-slot` | `alert-center-bar-mount` | On the layout-transparent element the top item's host is adopted into. |
|
|
283
283
|
* | `data-state` | `"open"` \| `"closed"` | On the wrapper; drives the enter/exit transition, and stays `closed` while the exit plays. |
|
|
284
|
-
* | `data-placement` | `"bar"` | On the chrome
|
|
284
|
+
* | `data-placement` | `"bar"` | On the chrome: where the top item's children are currently rendering. |
|
|
285
285
|
* | `data-alert-id` | the top item's `id` | On the chrome; per-alert styling and testing hook. |
|
|
286
|
-
* | `data-alert-dismiss` | present on the dismiss control | Read, not stamped
|
|
287
|
-
* | `data-alert-expand` | present on the expand control | Read, not stamped
|
|
286
|
+
* | `data-alert-dismiss` | present on the dismiss control | Read, not stamped. `Alert` emits it; the bar's CSS centers and offsets the control with it. |
|
|
287
|
+
* | `data-alert-expand` | present on the expand control | Read, not stamped. `Alert` emits it; the bar's CSS centers the control with it. |
|
|
288
288
|
*
|
|
289
289
|
* @see https://mantle.ngrok.com/components/feedback/alert-center#alertcenterbar
|
|
290
290
|
*
|
|
@@ -297,7 +297,7 @@ type AlertCenterBarProps = Omit<ComponentProps<typeof Alert.Root>, "appearance"
|
|
|
297
297
|
* <Alert.Icon />
|
|
298
298
|
* <Alert.Content>
|
|
299
299
|
* <Alert.Title>
|
|
300
|
-
* Payment failed
|
|
300
|
+
* Payment failed: we couldn't charge your card.{" "}
|
|
301
301
|
* <a href="/billing">Update payment method</a>
|
|
302
302
|
* </Alert.Title>
|
|
303
303
|
* <Alert.Description>
|
|
@@ -322,7 +322,7 @@ type AlertCenterBarProps = Omit<ComponentProps<typeof Alert.Root>, "appearance"
|
|
|
322
322
|
*/
|
|
323
323
|
declare const Bar: ({ className, "data-slot": dataSlot, ref, ...props }: AlertCenterBarProps) => import("react").JSX.Element | null;
|
|
324
324
|
type AlertCenterContentProps = Omit<ComponentProps<"div">, "children" | "id"> & WithDataSlot & {
|
|
325
|
-
/**
|
|
325
|
+
/** Not accepted. The rows are the registered items' authored children. */
|
|
326
326
|
children?: never;
|
|
327
327
|
};
|
|
328
328
|
/**
|
|
@@ -334,7 +334,7 @@ type AlertCenterContentProps = Omit<ComponentProps<"div">, "children" | "id"> &
|
|
|
334
334
|
* `data-alert-id`.
|
|
335
335
|
*
|
|
336
336
|
* `aria-label` (default `"More alerts"`) and `aria-labelledby` name the row
|
|
337
|
-
* list itself
|
|
337
|
+
* list itself. The outer wrapper is `role="generic"`, where ARIA prohibits
|
|
338
338
|
* accessible names, so a name passed here would otherwise be dropped.
|
|
339
339
|
*
|
|
340
340
|
* **Data attributes:**
|
|
@@ -344,9 +344,9 @@ type AlertCenterContentProps = Omit<ComponentProps<"div">, "children" | "id"> &
|
|
|
344
344
|
* | `data-slot` | `alert-center-content` | On the expansion wrapper that owns the collapse animation. |
|
|
345
345
|
* | `data-slot` | `alert-center-item alert` | On each row's banner chrome, joined ahead of `Alert.Root`'s own slot. |
|
|
346
346
|
* | `data-state` | `"open"` \| `"closed"` | On the wrapper; drives the collapse transition. |
|
|
347
|
-
* | `data-placement` | `"list"` | On each row's chrome
|
|
347
|
+
* | `data-placement` | `"list"` | On each row's chrome: where that item's children are currently rendering. |
|
|
348
348
|
* | `data-alert-id` | the row item's `id` | On each row's chrome; per-alert styling and testing hook. |
|
|
349
|
-
* | `data-alert-mount` | the row item's `id` | On the row's layout-transparent mount point
|
|
349
|
+
* | `data-alert-mount` | the row item's `id` | On the row's layout-transparent mount point: the element that item's host is adopted into. |
|
|
350
350
|
*
|
|
351
351
|
* @see https://mantle.ngrok.com/components/feedback/alert-center#alertcentercontent
|
|
352
352
|
*
|
|
@@ -359,7 +359,7 @@ type AlertCenterContentProps = Omit<ComponentProps<"div">, "children" | "id"> &
|
|
|
359
359
|
* <Alert.Icon />
|
|
360
360
|
* <Alert.Content>
|
|
361
361
|
* <Alert.Title>
|
|
362
|
-
* Payment failed
|
|
362
|
+
* Payment failed: <a href="/billing">update your card</a>
|
|
363
363
|
* </Alert.Title>
|
|
364
364
|
* </Alert.Content>
|
|
365
365
|
* </AlertCenter.Item>
|
|
@@ -378,7 +378,7 @@ type AlertCenterContentProps = Omit<ComponentProps<"div">, "children" | "id"> &
|
|
|
378
378
|
declare const Content: ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, className, "data-slot": dataSlot, ref, ...props }: AlertCenterContentProps) => import("react").JSX.Element | null;
|
|
379
379
|
/**
|
|
380
380
|
* A single, top-level entry point for one-to-many account alerts and their
|
|
381
|
-
* upgrade CTAs
|
|
381
|
+
* upgrade CTAs: the aggregation layer that replaces a stack of independent
|
|
382
382
|
* window banners. Alerts are AUTHORED as `AlertCenter.Item` JSX (mount to
|
|
383
383
|
* show, unmount to dismiss); each item registers its coordination facts, and
|
|
384
384
|
* the center derives the count, the top alert, and the severity ranking from
|
|
@@ -397,7 +397,7 @@ declare const Content: ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabell
|
|
|
397
397
|
* children stay in the author's React tree (context providers and error
|
|
398
398
|
* boundaries around an item work; router links resolve where the item is
|
|
399
399
|
* written) while their DOM renders through a stable per-id host that the bar
|
|
400
|
-
* and rows physically adopt
|
|
400
|
+
* and rows physically adopt, so content keeps its state across re-ranks.
|
|
401
401
|
*
|
|
402
402
|
* Siblings: `Alert` (`@ngrok/mantle/alert`) is a single inline banner you place
|
|
403
403
|
* and control yourself; `Toast` (`@ngrok/mantle/toast`) is for transient,
|
|
@@ -439,7 +439,7 @@ declare const Content: ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabell
|
|
|
439
439
|
* <Alert.Icon />
|
|
440
440
|
* <Alert.Content>
|
|
441
441
|
* <Alert.Title>
|
|
442
|
-
* Payment failed
|
|
442
|
+
* Payment failed: we couldn't charge your card.{" "}
|
|
443
443
|
* <a href="/billing">Update payment method</a>
|
|
444
444
|
* </Alert.Title>
|
|
445
445
|
* <Alert.Description>
|
|
@@ -487,7 +487,7 @@ declare const AlertCenter: {
|
|
|
487
487
|
* <Alert.Icon />
|
|
488
488
|
* <Alert.Content>
|
|
489
489
|
* <Alert.Title>
|
|
490
|
-
* Payment failed
|
|
490
|
+
* Payment failed: we couldn't charge your card.{" "}
|
|
491
491
|
* <a href="/billing">Update payment method</a>
|
|
492
492
|
* </Alert.Title>
|
|
493
493
|
* <Alert.Description>
|
|
@@ -525,10 +525,10 @@ declare const AlertCenter: {
|
|
|
525
525
|
* | `data-slot` | `alert-center-bar alert` | On the banner chrome the top item's children render inside, joined ahead of `Alert.Root`'s own slot. |
|
|
526
526
|
* | `data-slot` | `alert-center-bar-mount` | On the layout-transparent element the top item's host is adopted into. |
|
|
527
527
|
* | `data-state` | `"open"` \| `"closed"` | On the wrapper; drives the enter/exit transition, and stays `closed` while the exit plays. |
|
|
528
|
-
* | `data-placement` | `"bar"` | On the chrome
|
|
528
|
+
* | `data-placement` | `"bar"` | On the chrome: where the top item's children are currently rendering. |
|
|
529
529
|
* | `data-alert-id` | the top item's `id` | On the chrome; per-alert styling and testing hook. |
|
|
530
|
-
* | `data-alert-dismiss` | present on the dismiss control | Read, not stamped
|
|
531
|
-
* | `data-alert-expand` | present on the expand control | Read, not stamped
|
|
530
|
+
* | `data-alert-dismiss` | present on the dismiss control | Read, not stamped. `Alert` emits it; the bar's CSS centers and offsets the control with it. |
|
|
531
|
+
* | `data-alert-expand` | present on the expand control | Read, not stamped. `Alert` emits it; the bar's CSS centers the control with it. |
|
|
532
532
|
*
|
|
533
533
|
* @see https://mantle.ngrok.com/components/feedback/alert-center#alertcenterbar
|
|
534
534
|
*
|
|
@@ -541,7 +541,7 @@ declare const AlertCenter: {
|
|
|
541
541
|
* <Alert.Icon />
|
|
542
542
|
* <Alert.Content>
|
|
543
543
|
* <Alert.Title>
|
|
544
|
-
* Payment failed
|
|
544
|
+
* Payment failed: we couldn't charge your card.{" "}
|
|
545
545
|
* <a href="/billing">Update payment method</a>
|
|
546
546
|
* </Alert.Title>
|
|
547
547
|
* <Alert.Description>
|
|
@@ -577,9 +577,9 @@ declare const AlertCenter: {
|
|
|
577
577
|
* | `data-slot` | `alert-center-content` | On the expansion wrapper that owns the collapse animation. |
|
|
578
578
|
* | `data-slot` | `alert-center-item alert` | On each row's banner chrome, joined ahead of `Alert.Root`'s own slot. |
|
|
579
579
|
* | `data-state` | `"open"` \| `"closed"` | On the wrapper; drives the collapse transition. |
|
|
580
|
-
* | `data-placement` | `"list"` | On each row's chrome
|
|
580
|
+
* | `data-placement` | `"list"` | On each row's chrome: where that item's children are currently rendering. |
|
|
581
581
|
* | `data-alert-id` | the row item's `id` | On each row's chrome; per-alert styling and testing hook. |
|
|
582
|
-
* | `data-alert-mount` | the row item's `id` | On the row's layout-transparent mount point
|
|
582
|
+
* | `data-alert-mount` | the row item's `id` | On the row's layout-transparent mount point: the element that item's host is adopted into. |
|
|
583
583
|
*
|
|
584
584
|
* @see https://mantle.ngrok.com/components/feedback/alert-center#alertcentercontent
|
|
585
585
|
*
|
|
@@ -592,7 +592,7 @@ declare const AlertCenter: {
|
|
|
592
592
|
* <Alert.Icon />
|
|
593
593
|
* <Alert.Content>
|
|
594
594
|
* <Alert.Title>
|
|
595
|
-
* Payment failed
|
|
595
|
+
* Payment failed: <a href="/billing">update your card</a>
|
|
596
596
|
* </Alert.Title>
|
|
597
597
|
* </Alert.Content>
|
|
598
598
|
* </AlertCenter.Item>
|
|
@@ -612,7 +612,7 @@ declare const AlertCenter: {
|
|
|
612
612
|
/**
|
|
613
613
|
* One authored alert: registers its `{id, intent}` facts and renders its
|
|
614
614
|
* children through a portal into a stable per-id host that the bar or an
|
|
615
|
-
* expansion row adopts by rank
|
|
615
|
+
* expansion row adopts by rank. Children stay in the author's React tree
|
|
616
616
|
* and keep their state across re-ranks. Mount to show; unmount to dismiss.
|
|
617
617
|
*
|
|
618
618
|
* `children` render inside a `<div data-slot="alert-center-item-label">`, so
|
|
@@ -624,7 +624,7 @@ declare const AlertCenter: {
|
|
|
624
624
|
* | --- | --- | --- |
|
|
625
625
|
* | `data-slot` | `alert-center-item-host` | On the stable per-id host element the item's children portal into. |
|
|
626
626
|
* | `data-slot` | `alert-center-item-label` | On the layout-transparent element inside the host that wraps the item's children. |
|
|
627
|
-
* | `data-alert-host` | the item's `id` | On that same host
|
|
627
|
+
* | `data-alert-host` | the item's `id` | On that same host: which alert's projected children it holds. |
|
|
628
628
|
*
|
|
629
629
|
* @see https://mantle.ngrok.com/components/feedback/alert-center#alertcenteritem
|
|
630
630
|
*
|
|
@@ -637,7 +637,7 @@ declare const AlertCenter: {
|
|
|
637
637
|
* <Alert.Icon />
|
|
638
638
|
* <Alert.Content>
|
|
639
639
|
* <Alert.Title>
|
|
640
|
-
* Payment failed
|
|
640
|
+
* Payment failed: <a href="/billing">update your card</a>
|
|
641
641
|
* </Alert.Title>
|
|
642
642
|
* </Alert.Content>
|
|
643
643
|
* </AlertCenter.Item>
|
|
@@ -655,7 +655,7 @@ declare const AlertCenter: {
|
|
|
655
655
|
* | Data Attribute | Value | Description |
|
|
656
656
|
* | --- | --- | --- |
|
|
657
657
|
* | `data-slot` | `alert-center-dismiss-icon-button alert-dismiss-icon-button icon-button` | On the rendered button, joined ahead of `Alert.DismissIconButton`'s own slot and `IconButton`'s. |
|
|
658
|
-
* | `data-alert-dismiss` | present | Read, not stamped
|
|
658
|
+
* | `data-alert-dismiss` | present | Read, not stamped. `Alert` emits it, and `AlertCenter`'s bar CSS positions the control with it. |
|
|
659
659
|
*
|
|
660
660
|
* @see https://mantle.ngrok.com/components/feedback/alert-center#alertcenterdismissiconbutton
|
|
661
661
|
*
|
package/dist/alert-center.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./use-isomorphic-layout-effect-CLSmHzo4.js";import{n as t}from"./compose-refs-sFdxsL7k.js";import{t as n}from"./cx-CK7o_rVv.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{n as i,t as a}from"./alert-CH99Rw-R.js";import{c as o}from"react/compiler-runtime";import{createContext as s,useContext as c,useEffect as l,useId as u,useReducer as d,useRef as f,useState as p,useSyncExternalStore as m}from"react";import h from"tiny-invariant";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{createPortal as v}from"react-dom";const y={danger:5,warning:4,important:3,info:2,success:1};function b(e,t){if(t.parentElement===e)return!1;if(typeof e.moveBefore==`function`&&t.isConnected&&e.isConnected)try{return e.moveBefore(t,null),!0}catch{}return e.appendChild(t),!0}function x(e){return e.replace(/\s+/g,` `).trim()}function S(e){let t=e.querySelector(`[data-slot~="alert-title"]`);if(t==null)return``;let n=t.cloneNode(!0);if(!(n instanceof Element))return x(t.textContent??``);for(let e of n.querySelectorAll(`button`))e.remove();let r=x(n.textContent??``);for(let e of n.querySelectorAll(`a`))e.remove();let i=x(n.textContent??``);return i===``?r:i}function C(e){return e.toSorted((e,t)=>y[t.intent]-y[e.intent]||w(e.order,t.order)||e.sequence-t.sequence)}function w(e,t){return e===t?0:e==null?1:t==null||e<t?-1:1}function T(e,t){if(t===0)return``;if(e===``)return`${t} alert${t===1?``:`s`}`;let n=t-1;return n===0?e:`${e}, and ${n} more alert${n===1?``:`s`}`}const E=[];var D=class{#e=/* @__PURE__ */ new Set;#t=/* @__PURE__ */ new Map;#n=/* @__PURE__ */ new Map;#r=/* @__PURE__ */ new Map;#i=0;#a=E;#o=``;#s=!1;getHost(e){let t=this.#r.get(e);if(t!=null)return t;let n=document.createElement(`div`);return n.style.display=`contents`,n.setAttribute(`data-slot`,`alert-center-item-host`),n.setAttribute(`data-alert-host`,e),this.#r.set(e,n),n}#c=null;captureHostSnapshot(e){if(e!==this.#a[0]?.id)return;let t=this.#r.get(e);t!=null&&t.firstElementChild?.hasChildNodes()===!0&&(this.#c={id:e,content:t.cloneNode(!0)})}getHostSnapshot=e=>this.#c?.id===e?this.#c.content:null;subscribe=e=>(this.#e.add(e),()=>{this.#e.delete(e)});getSnapshot=()=>this.#a;hasAlert=e=>this.#t.has(e);getTopLabel=()=>this.#o;setTopLabel(e){this.#o!==e&&(this.#o=e,this.#p())}#l=null;requestFocusRestore(e){this.#l=e}flushFocusRestore(){let e=this.#l;e!=null&&e.isConnected&&(this.#l=null,document.activeElement!==e&&e.focus({preventScroll:!0}))}#u=null;#d=0;getPlacementVersion=()=>this.#d;notifyPlacementChange(){this.#d++,this.#p()}setBarElement(e){this.#u=e}getBarElement=()=>this.#u;getContentMounted=()=>this.#s;setContentMounted(e){this.#s!==e&&(this.#s=e,this.#p())}register(e){h(!this.#t.has(e.id),`AlertCenter.Item id "${e.id}" is already registered by another mounted item — ids must be unique under one <AlertCenter.Root>. Render one item per id, or give each alert its own id.`);let t=this.#n.get(e.id)??this.#i++;this.#n.set(e.id,t);let n={...e,sequence:t};return this.#t.set(e.id,n),this.#f(),()=>{this.#t.get(e.id)===n&&(this.#t.delete(e.id),this.#f())}}#f(){this.#a=C([...this.#t.values()]),this.#p()}#p(){for(let e of this.#e)e()}};const O=s(null),k=s(null);function A(e){let t=c(O);return h(t,`${e} must be rendered inside <AlertCenter.Root>.`),t}function ee(e){let t=c(k);return h(t,`${e} must be rendered inside <AlertCenter.Root>.`),t}const te=e=>m(e.subscribe,e.getSnapshot,e.getSnapshot),j=s(!1);function M(e){let t=o(5),{store:n}=e,r=te(n),i=m(n.subscribe,n.getTopLabel,n.getTopLabel),a;t[0]!==r.length||t[1]!==i?(a=T(i,r.length),t[0]=r.length,t[1]=i,t[2]=a):a=t[2];let s;return t[3]===a?s=t[4]:(s=/* @__PURE__ */ g(`div`,{"data-slot":`alert-center-announcer`,className:`sr-only`,role:`status`,"aria-live":`polite`,children:a}),t[3]=a,t[4]=s),s}const N=e=>{let t=o(18),{children:n,defaultOpen:r,onOpenChange:i,open:a}=e,[s]=p(U),c=u(),[l,d]=p(r??!1),f=a??l,m;t[0]!==i||t[1]!==a?(m=e=>{a??d(e),i?.(e)},t[0]=i,t[1]=a,t[2]=m):m=t[2];let h=m,v;t[3]!==c||t[4]!==s?(v={store:s,contentId:c},t[3]=c,t[4]=s,t[5]=v):v=t[5];let y=v,b;t[6]!==f||t[7]!==h?(b={isExpanded:f,setExpanded:h},t[6]=f,t[7]=h,t[8]=b):b=t[8];let x=b,S;t[9]!==n||t[10]!==x?(S=/* @__PURE__ */ g(k.Provider,{value:x,children:n}),t[9]=n,t[10]=x,t[11]=S):S=t[11];let C;t[12]===s?C=t[13]:(C=/* @__PURE__ */ g(M,{store:s}),t[12]=s,t[13]=C);let w;return t[14]!==y||t[15]!==S||t[16]!==C?(w=/* @__PURE__ */ _(O.Provider,{value:y,children:[S,C]}),t[14]=y,t[15]=S,t[16]=C,t[17]=w):w=t[17],w},P=t=>{let n=o(22),{children:r,className:a,id:s,intent:l,order:u}=t,{store:d}=A(`AlertCenter.Item`),f=c(j);h(!f,`AlertCenter.Item cannot be rendered inside another item's children.`);let[m,_]=p(null),y,b;n[0]!==s||n[1]!==d?(y=()=>{_(d.getHost(s))},b=[d,s],n[0]=s,n[1]=d,n[2]=y,n[3]=b):(y=n[2],b=n[3]),e(y,b);let x,S;n[4]!==a||n[5]!==s||n[6]!==l||n[7]!==u||n[8]!==d?(x=()=>d.register({id:s,intent:l,className:a,order:u}),S=[d,s,l,a,u],n[4]=a,n[5]=s,n[6]=l,n[7]=u,n[8]=d,n[9]=x,n[10]=S):(x=n[9],S=n[10]),e(x,S);let C;if(n[11]!==s||n[12]!==d?(C=()=>{d.captureHostSnapshot(s)},n[11]=s,n[12]=d,n[13]=C):C=n[13],e(C),m==null)return null;let w;n[14]===r?w=n[15]:(w=/* @__PURE__ */ g(j.Provider,{value:!0,children:/* @__PURE__ */ g(`div`,{className:`contents`,"data-slot":`alert-center-item-label`,children:r})}),n[14]=r,n[15]=w);let T;n[16]!==l||n[17]!==w?(T=/* @__PURE__ */ g(i,{intent:l,redirectDismissFocus:!1,children:w}),n[16]=l,n[17]=w,n[18]=T):T=n[18];let E;return n[19]!==m||n[20]!==T?(E=v(T,m),n[19]=m,n[20]=T,n[21]=E):E=n[21],E},F=n=>{let i=o(14),s,l,u,d;i[0]===n?(s=i[1],l=i[2],u=i[3],d=i[4]):({"data-slot":s,label:l,ref:d,...u}=n,i[0]=n,i[1]=s,i[2]=l,i[3]=u,i[4]=d);let _=c(j);h(_,`AlertCenter.DismissIconButton must be composed inside an <AlertCenter.Item>'s children.`);let{store:v}=A(`AlertCenter.DismissIconButton`);m(v.subscribe,v.getPlacementVersion,v.getPlacementVersion);let y=f(null),b=t(y,d),[x,C]=p(null),w;i[5]===l?w=i[6]:(w=()=>{if(l!=null)return;let e=y.current?.closest(`[data-alert-id]`),t=e==null?``:S(e);C(t===``?null:`Dismiss ${t}`)},i[5]=l,i[6]=w),e(w);let T=l??x??void 0,E;i[7]===s?E=i[8]:(E=r(s,`alert-center-dismiss-icon-button`),i[7]=s,i[8]=E);let D;return i[9]!==b||i[10]!==u||i[11]!==T||i[12]!==E?(D=/* @__PURE__ */ g(a.DismissIconButton,{ref:b,label:T,...u,"data-slot":E}),i[9]=b,i[10]=u,i[11]=T,i[12]=E,i[13]=D):D=i[13],D};function I(e,t){switch(t){case`show`:return`open`;case`hide`:return e===`closed`?`closed`:`closing`;case`exited`:return e===`closing`?`closed`:e}}function L(t){let n=o(10),{present:r}=t,[i,a]=d(I,r?`open`:`closed`),s,c;n[0]===r?(s=n[1],c=n[2]):(s=()=>{a(r?`show`:`hide`)},c=[r],n[0]=r,n[1]=s,n[2]=c),e(s,c);let u,f;n[3]===i?(u=n[4],f=n[5]):(u=()=>{if(i!==`closing`)return;let e=window.setTimeout(()=>a(`exited`),200);return()=>window.clearTimeout(e)},f=[i],n[3]=i,n[4]=u,n[5]=f),l(u,f);let p;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e.target===e.currentTarget&&e.propertyName===`height`&&a(`exited`)},n[6]=p):p=n[6];let m=p,h=i!==`closed`,g=i===`open`?`open`:`closed`,_;return n[7]!==h||n[8]!==g?(_={isMounted:h,dataState:g,onExitTransitionEnd:m},n[7]=h,n[8]=g,n[9]=_):_=n[9],_}function R(t){let n=o(5),{containerRef:r,isAttached:i}=t,a=f(null),s,c;n[0]!==r||n[1]!==i?(s=()=>{let e=r.current;if(!i||e==null)return;let t=e=>{e.target instanceof Element&&(a.current=e.target)},n=t=>{t.relatedTarget instanceof Node&&!e.contains(t.relatedTarget)&&(a.current=null)};return e.addEventListener(`focusin`,t),e.addEventListener(`focusout`,n),()=>{e.removeEventListener(`focusin`,t),e.removeEventListener(`focusout`,n)}},c=[r,i],n[0]=r,n[1]=i,n[2]=s,n[3]=c):(s=n[2],c=n[3]),e(s,c);let l;return n[4]===Symbol.for(`react.memo_cache_sentinel`)?(l={lastFocusedWithinRef:a},n[4]=l):l=n[4],l}function z(){let e=document.querySelector(`main, [role="main"]`);e!=null&&(e.hasAttribute(`tabindex`)||(e.tabIndex=-1),e.focus({preventScroll:!0}))}function B(t){let n=o(10),{isMounted:r,store:i,topId:a}=t,s=f(null),c;n[0]===r?c=n[1]:(c={containerRef:s,isAttached:r},n[0]=r,n[1]=c);let{lastFocusedWithinRef:l}=R(c),u=f(a),d;n[2]!==l||n[3]!==i||n[4]!==a?(d=()=>{let e=u.current;if(u.current=a,e==null||a===e)return;let t=l.current;if(i.hasAlert(e)){t instanceof HTMLElement&&document.activeElement!==t&&i.requestFocusRestore(t);return}if(t==null||t.isConnected)return;l.current=null;let n=s.current;a==null?z():n!=null&&(n.querySelector(`[data-alert-dismiss], [data-alert-expand]`)??n).focus()},n[2]=l,n[3]=i,n[4]=a,n[5]=d):d=n[5];let p;n[6]!==i||n[7]!==a?(p=[i,a],n[6]=i,n[7]=a,n[8]=p):p=n[8],e(d,p);let m;return n[9]===Symbol.for(`react.memo_cache_sentinel`)?(m={wrapperRef:s},n[9]=m):m=n[9],m}const V=`gap-2 py-2 pr-2 **:data-[slot~=alert-icon]:shrink-0`,H={Root:N,Bar:t=>{let i=o(62),s,c,l,u;i[0]===t?(s=i[1],c=i[2],l=i[3],u=i[4]):({className:s,"data-slot":c,ref:u,...l}=t,i[0]=t,i[1]=s,i[2]=c,i[3]=l,i[4]=u);let{store:d,contentId:h}=A(`AlertCenter.Bar`),{isExpanded:v,setExpanded:y}=ee(`AlertCenter.Bar`),x=te(d),C=m(d.subscribe,d.getContentMounted,d.getContentMounted),w=x[0]??null,T=w!=null,E;i[5]===T?E=i[6]:(E={present:T},i[5]=T,i[6]=E);let{isMounted:D,dataState:O,onExitTransitionEnd:k}=L(E),[j,M]=p(w);w!=null&&w!==j&&M(w);let N=w??j,P=f(null),F;i[7]!==N||i[8]!==d||i[9]!==w?(F=()=>{let e=P.current;if(e==null)return;if(w!=null){let t=d.getHost(w.id);t.parentElement!==e&&e.childNodes.length>0&&e.replaceChildren(),b(e,t)&&d.notifyPlacementChange(),d.flushFocusRestore();return}let t=N==null?null:d.getHostSnapshot(N.id);t!=null&&t.parentNode!==e&&e.replaceChildren(t)},i[7]=N,i[8]=d,i[9]=w,i[10]=F):F=i[10],e(F);let I=w?.id,R;i[11]!==D||i[12]!==d||i[13]!==I?(R={isMounted:D,store:d,topId:I},i[11]=D,i[12]=d,i[13]=I,i[14]=R):R=i[14];let{wrapperRef:z}=B(R),H;i[15]!==T||i[16]!==d||i[17]!==z?(H=()=>{let e=z.current;d.setTopLabel(T&&e!=null?S(e):``)},i[15]=T,i[16]=d,i[17]=z,i[18]=H):H=i[18],e(H);let U;i[19]!==T||i[20]!==d||i[21]!==z?(U=()=>{let e=z.current;if(e==null)return;let t=new MutationObserver(()=>{d.setTopLabel(T?S(e):``)});return t.observe(e,{subtree:!0,childList:!0,characterData:!0}),()=>{t.disconnect()}},i[19]=T,i[20]=d,i[21]=z,i[22]=U):U=i[22];let W;i[23]!==D||i[24]!==T||i[25]!==d?(W=[d,T,D],i[23]=D,i[24]=T,i[25]=d,i[26]=W):W=i[26],e(U,W);let G,K;i[27]===d?(G=i[28],K=i[29]):(G=()=>()=>{d.setTopLabel(``)},K=[d],i[27]=d,i[28]=G,i[29]=K),e(G,K);let q;i[30]!==d||i[31]!==z?(q=()=>{d.setBarElement(z.current)},i[30]=d,i[31]=z,i[32]=q):q=i[32],e(q);let J,Y;if(i[33]===d?(J=i[34],Y=i[35]):(J=()=>()=>{d.setBarElement(null)},Y=[d],i[33]=d,i[34]=J,i[35]=Y),e(J,Y),!D||N==null)return null;let ne=T?x.length-1:0,re=!T,ie=N.intent,X;i[36]!==N.className||i[37]!==s?(X=n(V,`not-has-data-[slot=alert-description]:[&_[data-alert-dismiss],&_[data-alert-expand]]:top-1/2 not-has-data-[slot=alert-description]:[&_[data-alert-dismiss],&_[data-alert-expand]]:-translate-y-1/2`,s,N.className),i[36]=N.className,i[37]=s,i[38]=X):X=i[38];let Z;i[39]===c?Z=i[40]:(Z=r(c,`alert-center-bar`),i[39]=c,i[40]=Z);let ae;i[41]===Symbol.for(`react.memo_cache_sentinel`)?(ae=/* @__PURE__ */ g(`div`,{ref:P,className:`contents`,"data-slot":`alert-center-bar-mount`}),i[41]=ae):ae=i[41];let Q;i[42]!==h||i[43]!==C||i[44]!==v||i[45]!==ne||i[46]!==y?(Q=ne>0&&C&&/* @__PURE__ */ g(a.ExpandButton,{count:ne,expanded:v,"aria-controls":h,onClick:()=>y(!v)}),i[42]=h,i[43]=C,i[44]=v,i[45]=ne,i[46]=y,i[47]=Q):Q=i[47];let $;i[48]!==N.id||i[49]!==N.intent||i[50]!==l||i[51]!==u||i[52]!==X||i[53]!==Z||i[54]!==Q?($=/* @__PURE__ */ _(a.Root,{ref:u,appearance:`banner`,intent:ie,className:X,...l,"data-slot":Z,"data-placement":`bar`,"data-alert-id":N.id,children:[ae,Q]}),i[48]=N.id,i[49]=N.intent,i[50]=l,i[51]=u,i[52]=X,i[53]=Z,i[54]=Q,i[55]=$):$=i[55];let oe;return i[56]!==O||i[57]!==k||i[58]!==re||i[59]!==$||i[60]!==z?(oe=/* @__PURE__ */ g(`div`,{ref:z,"data-slot":`alert-center-bar-wrapper`,tabIndex:-1,inert:re,className:`shrink-0 overflow-hidden transition-[height,opacity] duration-200 ease-out [interpolate-size:allow-keywords] starting:h-0 starting:opacity-0 data-state-closed:h-0 data-state-closed:opacity-0 data-state-closed:duration-150 motion-reduce:transition-none`,"data-state":O,onTransitionEnd:k,children:$}),i[56]=O,i[57]=k,i[58]=re,i[59]=$,i[60]=z,i[61]=oe):oe=i[61],oe},Content:i=>{let a=o(38),s,c,l,u,d,p;a[0]===i?(s=a[1],c=a[2],l=a[3],u=a[4],d=a[5],p=a[6]):({"aria-label":p,"aria-labelledby":s,className:c,"data-slot":l,ref:d,...u}=i,a[0]=i,a[1]=s,a[2]=c,a[3]=l,a[4]=u,a[5]=d,a[6]=p);let m=p===void 0?`More alerts`:p,{store:h,contentId:_}=A(`AlertCenter.Content`),{isExpanded:v,setExpanded:y}=ee(`AlertCenter.Content`),x=te(h).slice(1),S=x.length>0,C,w;a[7]===h?(C=a[8],w=a[9]):(C=()=>(h.setContentMounted(!0),()=>{h.setContentMounted(!1)}),w=[h],a[7]=h,a[8]=C,a[9]=w),e(C,w);let T=f(S),E,D;a[10]!==S||a[11]!==v||a[12]!==y?(E=()=>{let e=T.current&&!S;T.current=S,e&&v&&y(!1)},D=[S,v,y],a[10]=S,a[11]=v,a[12]=y,a[13]=E,a[14]=D):(E=a[13],D=a[14]),e(E,D);let O=f(null),k=t(O,d),j;a[15]===S?j=a[16]:(j={containerRef:O,isAttached:S},a[15]=S,a[16]=j);let{lastFocusedWithinRef:M}=R(j),N=x.map(W).join(` `),P;a[17]===h?P=a[18]:(P=()=>{let e=O.current;if(e==null)return;let t=!1;for(let n of e.querySelectorAll(`[data-alert-mount]`)){let e=n.getAttribute(`data-alert-mount`);e!=null&&b(n,h.getHost(e))&&(t=!0)}t&&h.notifyPlacementChange(),h.flushFocusRestore()},a[17]=h,a[18]=P),e(P,[h,N]);let F;if(a[19]!==M||a[20]!==h?(F=()=>{let e=M.current;if(e==null)return;if(e.isConnected){let t=O.current;e instanceof HTMLElement&&document.activeElement!==e&&(t==null||!t.contains(e))&&(M.current=null,e.focus({preventScroll:!0}));return}M.current=null;let t=O.current?.querySelector(`[data-alert-dismiss]`);if(t!=null){t.focus();return}let n=h.getBarElement()?.querySelector(`[data-alert-dismiss], [data-alert-expand]`);n==null?z():n.focus()},a[19]=M,a[20]=h,a[21]=F):F=a[21],e(F,[h,N]),x.length===0)return null;let I;a[22]===l?I=a[23]:(I=r(l,`alert-center-content`),a[22]=l,a[23]=I);let L=v?`open`:`closed`,B;a[24]===c?B=a[25]:(B=n(`h-0 overflow-hidden invisible [content-visibility:hidden] transition-[height,visibility,content-visibility] transition-discrete duration-200 ease-out [interpolate-size:allow-keywords] data-state-open:h-auto data-state-open:visible data-state-open:[content-visibility:visible] motion-reduce:transition-none`,c),a[24]=c,a[25]=B);let V=s==null?m:void 0,H=x.map(G),U;a[26]!==s||a[27]!==V||a[28]!==H?(U=/* @__PURE__ */ g(`ul`,{"aria-label":V,"aria-labelledby":s,className:`flex w-full flex-col`,children:H}),a[26]=s,a[27]=V,a[28]=H,a[29]=U):U=a[29];let K;return a[30]!==k||a[31]!==_||a[32]!==u||a[33]!==L||a[34]!==B||a[35]!==U||a[36]!==I?(K=/* @__PURE__ */ g(`div`,{...u,ref:k,"data-slot":I,id:_,"data-state":L,className:B,children:U}),a[30]=k,a[31]=_,a[32]=u,a[33]=L,a[34]=B,a[35]=U,a[36]=I,a[37]=K):K=a[37],K},Item:P,DismissIconButton:F};function U(){return new D}function W(e){return e.id}function G(e){return/* @__PURE__ */ g(`li`,{children:/* @__PURE__ */ g(a.Root,{appearance:`banner`,intent:e.intent,className:n(V,e.className),"data-slot":`alert-center-item`,"data-placement":`list`,"data-alert-id":e.id,children:/* @__PURE__ */ g(`div`,{className:`contents`,"data-alert-mount":e.id})})},e.id)}export{H as AlertCenter};
|
|
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{n as i,t as a}from"./alert-BkJHDx9X.js";import{c as o}from"react/compiler-runtime";import{createContext as s,useContext as c,useEffect as l,useId as u,useReducer as d,useRef as f,useState as p,useSyncExternalStore as m}from"react";import h from"tiny-invariant";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{createPortal as v}from"react-dom";const y={danger:5,warning:4,important:3,info:2,success:1};function b(e,t){if(t.parentElement===e)return!1;if(typeof e.moveBefore==`function`&&t.isConnected&&e.isConnected)try{return e.moveBefore(t,null),!0}catch{}return e.appendChild(t),!0}function x(e){return e.replace(/\s+/g,` `).trim()}function S(e){let t=e.querySelector(`[data-slot~="alert-title"]`);if(t==null)return``;let n=t.cloneNode(!0);if(!(n instanceof Element))return x(t.textContent??``);for(let e of n.querySelectorAll(`button`))e.remove();let r=x(n.textContent??``);for(let e of n.querySelectorAll(`a`))e.remove();let i=x(n.textContent??``);return i===``?r:i}function C(e){return e.toSorted((e,t)=>y[t.intent]-y[e.intent]||w(e.order,t.order)||e.sequence-t.sequence)}function w(e,t){return e===t?0:e==null?1:t==null||e<t?-1:1}function T(e,t){if(t===0)return``;if(e===``)return`${t} alert${t===1?``:`s`}`;let n=t-1;return n===0?e:`${e}, and ${n} more alert${n===1?``:`s`}`}const E=[];var D=class{#e=/* @__PURE__ */ new Set;#t=/* @__PURE__ */ new Map;#n=/* @__PURE__ */ new Map;#r=/* @__PURE__ */ new Map;#i=0;#a=E;#o=``;#s=!1;getHost(e){let t=this.#r.get(e);if(t!=null)return t;let n=document.createElement(`div`);return n.style.display=`contents`,n.setAttribute(`data-slot`,`alert-center-item-host`),n.setAttribute(`data-alert-host`,e),this.#r.set(e,n),n}#c=null;captureHostSnapshot(e){if(e!==this.#a[0]?.id)return;let t=this.#r.get(e);t!=null&&t.firstElementChild?.hasChildNodes()===!0&&(this.#c={id:e,content:t.cloneNode(!0)})}getHostSnapshot=e=>this.#c?.id===e?this.#c.content:null;subscribe=e=>(this.#e.add(e),()=>{this.#e.delete(e)});getSnapshot=()=>this.#a;hasAlert=e=>this.#t.has(e);getTopLabel=()=>this.#o;setTopLabel(e){this.#o!==e&&(this.#o=e,this.#p())}#l=null;requestFocusRestore(e){this.#l=e}flushFocusRestore(){let e=this.#l;e!=null&&e.isConnected&&(this.#l=null,document.activeElement!==e&&e.focus({preventScroll:!0}))}#u=null;#d=0;getPlacementVersion=()=>this.#d;notifyPlacementChange(){this.#d++,this.#p()}setBarElement(e){this.#u=e}getBarElement=()=>this.#u;getContentMounted=()=>this.#s;setContentMounted(e){this.#s!==e&&(this.#s=e,this.#p())}register(e){h(!this.#t.has(e.id),`AlertCenter.Item id "${e.id}" is already registered by another mounted item. Ids must be unique under one <AlertCenter.Root>. Render one item per id, or give each alert its own id.`);let t=this.#n.get(e.id)??this.#i++;this.#n.set(e.id,t);let n={...e,sequence:t};return this.#t.set(e.id,n),this.#f(),()=>{this.#t.get(e.id)===n&&(this.#t.delete(e.id),this.#f())}}#f(){this.#a=C([...this.#t.values()]),this.#p()}#p(){for(let e of this.#e)e()}};const O=s(null),k=s(null);function A(e){let t=c(O);return h(t,`${e} must be rendered inside <AlertCenter.Root>.`),t}function ee(e){let t=c(k);return h(t,`${e} must be rendered inside <AlertCenter.Root>.`),t}const te=e=>m(e.subscribe,e.getSnapshot,e.getSnapshot),j=s(!1);function M(e){let t=o(5),{store:n}=e,r=te(n),i=m(n.subscribe,n.getTopLabel,n.getTopLabel),a;t[0]!==r.length||t[1]!==i?(a=T(i,r.length),t[0]=r.length,t[1]=i,t[2]=a):a=t[2];let s;return t[3]===a?s=t[4]:(s=/* @__PURE__ */ g(`div`,{"data-slot":`alert-center-announcer`,className:`sr-only`,role:`status`,"aria-live":`polite`,children:a}),t[3]=a,t[4]=s),s}const N=e=>{let t=o(18),{children:n,defaultOpen:r,onOpenChange:i,open:a}=e,[s]=p(U),c=u(),[l,d]=p(r??!1),f=a??l,m;t[0]!==i||t[1]!==a?(m=e=>{a??d(e),i?.(e)},t[0]=i,t[1]=a,t[2]=m):m=t[2];let h=m,v;t[3]!==c||t[4]!==s?(v={store:s,contentId:c},t[3]=c,t[4]=s,t[5]=v):v=t[5];let y=v,b;t[6]!==f||t[7]!==h?(b={isExpanded:f,setExpanded:h},t[6]=f,t[7]=h,t[8]=b):b=t[8];let x=b,S;t[9]!==n||t[10]!==x?(S=/* @__PURE__ */ g(k.Provider,{value:x,children:n}),t[9]=n,t[10]=x,t[11]=S):S=t[11];let C;t[12]===s?C=t[13]:(C=/* @__PURE__ */ g(M,{store:s}),t[12]=s,t[13]=C);let w;return t[14]!==y||t[15]!==S||t[16]!==C?(w=/* @__PURE__ */ _(O.Provider,{value:y,children:[S,C]}),t[14]=y,t[15]=S,t[16]=C,t[17]=w):w=t[17],w},P=t=>{let n=o(22),{children:r,className:a,id:s,intent:l,order:u}=t,{store:d}=A(`AlertCenter.Item`),f=c(j);h(!f,`AlertCenter.Item cannot be rendered inside another item's children.`);let[m,_]=p(null),y,b;n[0]!==s||n[1]!==d?(y=()=>{_(d.getHost(s))},b=[d,s],n[0]=s,n[1]=d,n[2]=y,n[3]=b):(y=n[2],b=n[3]),e(y,b);let x,S;n[4]!==a||n[5]!==s||n[6]!==l||n[7]!==u||n[8]!==d?(x=()=>d.register({id:s,intent:l,className:a,order:u}),S=[d,s,l,a,u],n[4]=a,n[5]=s,n[6]=l,n[7]=u,n[8]=d,n[9]=x,n[10]=S):(x=n[9],S=n[10]),e(x,S);let C;if(n[11]!==s||n[12]!==d?(C=()=>{d.captureHostSnapshot(s)},n[11]=s,n[12]=d,n[13]=C):C=n[13],e(C),m==null)return null;let w;n[14]===r?w=n[15]:(w=/* @__PURE__ */ g(j.Provider,{value:!0,children:/* @__PURE__ */ g(`div`,{className:`contents`,"data-slot":`alert-center-item-label`,children:r})}),n[14]=r,n[15]=w);let T;n[16]!==l||n[17]!==w?(T=/* @__PURE__ */ g(i,{intent:l,redirectDismissFocus:!1,children:w}),n[16]=l,n[17]=w,n[18]=T):T=n[18];let E;return n[19]!==m||n[20]!==T?(E=v(T,m),n[19]=m,n[20]=T,n[21]=E):E=n[21],E},F=n=>{let i=o(14),s,l,u,d;i[0]===n?(s=i[1],l=i[2],u=i[3],d=i[4]):({"data-slot":s,label:l,ref:d,...u}=n,i[0]=n,i[1]=s,i[2]=l,i[3]=u,i[4]=d);let _=c(j);h(_,`AlertCenter.DismissIconButton must be composed inside an <AlertCenter.Item>'s children.`);let{store:v}=A(`AlertCenter.DismissIconButton`);m(v.subscribe,v.getPlacementVersion,v.getPlacementVersion);let y=f(null),b=t(y,d),[x,C]=p(null),w;i[5]===l?w=i[6]:(w=()=>{if(l!=null)return;let e=y.current?.closest(`[data-alert-id]`),t=e==null?``:S(e);C(t===``?null:`Dismiss ${t}`)},i[5]=l,i[6]=w),e(w);let T=l??x??void 0,E;i[7]===s?E=i[8]:(E=r(s,`alert-center-dismiss-icon-button`),i[7]=s,i[8]=E);let D;return i[9]!==b||i[10]!==u||i[11]!==T||i[12]!==E?(D=/* @__PURE__ */ g(a.DismissIconButton,{ref:b,label:T,...u,"data-slot":E}),i[9]=b,i[10]=u,i[11]=T,i[12]=E,i[13]=D):D=i[13],D};function I(e,t){switch(t){case`show`:return`open`;case`hide`:return e===`closed`?`closed`:`closing`;case`exited`:return e===`closing`?`closed`:e}}function L(t){let n=o(10),{present:r}=t,[i,a]=d(I,r?`open`:`closed`),s,c;n[0]===r?(s=n[1],c=n[2]):(s=()=>{a(r?`show`:`hide`)},c=[r],n[0]=r,n[1]=s,n[2]=c),e(s,c);let u,f;n[3]===i?(u=n[4],f=n[5]):(u=()=>{if(i!==`closing`)return;let e=window.setTimeout(()=>a(`exited`),200);return()=>window.clearTimeout(e)},f=[i],n[3]=i,n[4]=u,n[5]=f),l(u,f);let p;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e.target===e.currentTarget&&e.propertyName===`height`&&a(`exited`)},n[6]=p):p=n[6];let m=p,h=i!==`closed`,g=i===`open`?`open`:`closed`,_;return n[7]!==h||n[8]!==g?(_={isMounted:h,dataState:g,onExitTransitionEnd:m},n[7]=h,n[8]=g,n[9]=_):_=n[9],_}function R(t){let n=o(5),{containerRef:r,isAttached:i}=t,a=f(null),s,c;n[0]!==r||n[1]!==i?(s=()=>{let e=r.current;if(!i||e==null)return;let t=e=>{e.target instanceof Element&&(a.current=e.target)},n=t=>{t.relatedTarget instanceof Node&&!e.contains(t.relatedTarget)&&(a.current=null)};return e.addEventListener(`focusin`,t),e.addEventListener(`focusout`,n),()=>{e.removeEventListener(`focusin`,t),e.removeEventListener(`focusout`,n)}},c=[r,i],n[0]=r,n[1]=i,n[2]=s,n[3]=c):(s=n[2],c=n[3]),e(s,c);let l;return n[4]===Symbol.for(`react.memo_cache_sentinel`)?(l={lastFocusedWithinRef:a},n[4]=l):l=n[4],l}function z(){let e=document.querySelector(`main, [role="main"]`);e!=null&&(e.hasAttribute(`tabindex`)||(e.tabIndex=-1),e.focus({preventScroll:!0}))}function B(t){let n=o(10),{isMounted:r,store:i,topId:a}=t,s=f(null),c;n[0]===r?c=n[1]:(c={containerRef:s,isAttached:r},n[0]=r,n[1]=c);let{lastFocusedWithinRef:l}=R(c),u=f(a),d;n[2]!==l||n[3]!==i||n[4]!==a?(d=()=>{let e=u.current;if(u.current=a,e==null||a===e)return;let t=l.current;if(i.hasAlert(e)){t instanceof HTMLElement&&document.activeElement!==t&&i.requestFocusRestore(t);return}if(t==null||t.isConnected)return;l.current=null;let n=s.current;a==null?z():n!=null&&(n.querySelector(`[data-alert-dismiss], [data-alert-expand]`)??n).focus()},n[2]=l,n[3]=i,n[4]=a,n[5]=d):d=n[5];let p;n[6]!==i||n[7]!==a?(p=[i,a],n[6]=i,n[7]=a,n[8]=p):p=n[8],e(d,p);let m;return n[9]===Symbol.for(`react.memo_cache_sentinel`)?(m={wrapperRef:s},n[9]=m):m=n[9],m}const V=`gap-2 py-2 pr-2 **:data-[slot~=alert-icon]:shrink-0`,H={Root:N,Bar:t=>{let i=o(62),s,c,l,u;i[0]===t?(s=i[1],c=i[2],l=i[3],u=i[4]):({className:s,"data-slot":c,ref:u,...l}=t,i[0]=t,i[1]=s,i[2]=c,i[3]=l,i[4]=u);let{store:d,contentId:h}=A(`AlertCenter.Bar`),{isExpanded:v,setExpanded:y}=ee(`AlertCenter.Bar`),x=te(d),C=m(d.subscribe,d.getContentMounted,d.getContentMounted),w=x[0]??null,T=w!=null,E;i[5]===T?E=i[6]:(E={present:T},i[5]=T,i[6]=E);let{isMounted:D,dataState:O,onExitTransitionEnd:k}=L(E),[j,M]=p(w);w!=null&&w!==j&&M(w);let N=w??j,P=f(null),F;i[7]!==N||i[8]!==d||i[9]!==w?(F=()=>{let e=P.current;if(e==null)return;if(w!=null){let t=d.getHost(w.id);t.parentElement!==e&&e.childNodes.length>0&&e.replaceChildren(),b(e,t)&&d.notifyPlacementChange(),d.flushFocusRestore();return}let t=N==null?null:d.getHostSnapshot(N.id);t!=null&&t.parentNode!==e&&e.replaceChildren(t)},i[7]=N,i[8]=d,i[9]=w,i[10]=F):F=i[10],e(F);let I=w?.id,R;i[11]!==D||i[12]!==d||i[13]!==I?(R={isMounted:D,store:d,topId:I},i[11]=D,i[12]=d,i[13]=I,i[14]=R):R=i[14];let{wrapperRef:z}=B(R),H;i[15]!==T||i[16]!==d||i[17]!==z?(H=()=>{let e=z.current;d.setTopLabel(T&&e!=null?S(e):``)},i[15]=T,i[16]=d,i[17]=z,i[18]=H):H=i[18],e(H);let U;i[19]!==T||i[20]!==d||i[21]!==z?(U=()=>{let e=z.current;if(e==null)return;let t=new MutationObserver(()=>{d.setTopLabel(T?S(e):``)});return t.observe(e,{subtree:!0,childList:!0,characterData:!0}),()=>{t.disconnect()}},i[19]=T,i[20]=d,i[21]=z,i[22]=U):U=i[22];let W;i[23]!==D||i[24]!==T||i[25]!==d?(W=[d,T,D],i[23]=D,i[24]=T,i[25]=d,i[26]=W):W=i[26],e(U,W);let G,K;i[27]===d?(G=i[28],K=i[29]):(G=()=>()=>{d.setTopLabel(``)},K=[d],i[27]=d,i[28]=G,i[29]=K),e(G,K);let q;i[30]!==d||i[31]!==z?(q=()=>{d.setBarElement(z.current)},i[30]=d,i[31]=z,i[32]=q):q=i[32],e(q);let J,Y;if(i[33]===d?(J=i[34],Y=i[35]):(J=()=>()=>{d.setBarElement(null)},Y=[d],i[33]=d,i[34]=J,i[35]=Y),e(J,Y),!D||N==null)return null;let ne=T?x.length-1:0,re=!T,ie=N.intent,X;i[36]!==N.className||i[37]!==s?(X=n(V,`not-has-data-[slot=alert-description]:[&_[data-alert-dismiss],&_[data-alert-expand]]:top-1/2 not-has-data-[slot=alert-description]:[&_[data-alert-dismiss],&_[data-alert-expand]]:-translate-y-1/2`,s,N.className),i[36]=N.className,i[37]=s,i[38]=X):X=i[38];let Z;i[39]===c?Z=i[40]:(Z=r(c,`alert-center-bar`),i[39]=c,i[40]=Z);let ae;i[41]===Symbol.for(`react.memo_cache_sentinel`)?(ae=/* @__PURE__ */ g(`div`,{ref:P,className:`contents`,"data-slot":`alert-center-bar-mount`}),i[41]=ae):ae=i[41];let Q;i[42]!==h||i[43]!==C||i[44]!==v||i[45]!==ne||i[46]!==y?(Q=ne>0&&C&&/* @__PURE__ */ g(a.ExpandButton,{count:ne,expanded:v,"aria-controls":h,onClick:()=>y(!v)}),i[42]=h,i[43]=C,i[44]=v,i[45]=ne,i[46]=y,i[47]=Q):Q=i[47];let $;i[48]!==N.id||i[49]!==N.intent||i[50]!==l||i[51]!==u||i[52]!==X||i[53]!==Z||i[54]!==Q?($=/* @__PURE__ */ _(a.Root,{ref:u,appearance:`banner`,intent:ie,className:X,...l,"data-slot":Z,"data-placement":`bar`,"data-alert-id":N.id,children:[ae,Q]}),i[48]=N.id,i[49]=N.intent,i[50]=l,i[51]=u,i[52]=X,i[53]=Z,i[54]=Q,i[55]=$):$=i[55];let oe;return i[56]!==O||i[57]!==k||i[58]!==re||i[59]!==$||i[60]!==z?(oe=/* @__PURE__ */ g(`div`,{ref:z,"data-slot":`alert-center-bar-wrapper`,tabIndex:-1,inert:re,className:`shrink-0 overflow-hidden transition-[height,opacity] duration-200 ease-out [interpolate-size:allow-keywords] starting:h-0 starting:opacity-0 data-state-closed:h-0 data-state-closed:opacity-0 data-state-closed:duration-150 motion-reduce:transition-none`,"data-state":O,onTransitionEnd:k,children:$}),i[56]=O,i[57]=k,i[58]=re,i[59]=$,i[60]=z,i[61]=oe):oe=i[61],oe},Content:i=>{let a=o(38),s,c,l,u,d,p;a[0]===i?(s=a[1],c=a[2],l=a[3],u=a[4],d=a[5],p=a[6]):({"aria-label":p,"aria-labelledby":s,className:c,"data-slot":l,ref:d,...u}=i,a[0]=i,a[1]=s,a[2]=c,a[3]=l,a[4]=u,a[5]=d,a[6]=p);let m=p===void 0?`More alerts`:p,{store:h,contentId:_}=A(`AlertCenter.Content`),{isExpanded:v,setExpanded:y}=ee(`AlertCenter.Content`),x=te(h).slice(1),S=x.length>0,C,w;a[7]===h?(C=a[8],w=a[9]):(C=()=>(h.setContentMounted(!0),()=>{h.setContentMounted(!1)}),w=[h],a[7]=h,a[8]=C,a[9]=w),e(C,w);let T=f(S),E,D;a[10]!==S||a[11]!==v||a[12]!==y?(E=()=>{let e=T.current&&!S;T.current=S,e&&v&&y(!1)},D=[S,v,y],a[10]=S,a[11]=v,a[12]=y,a[13]=E,a[14]=D):(E=a[13],D=a[14]),e(E,D);let O=f(null),k=t(O,d),j;a[15]===S?j=a[16]:(j={containerRef:O,isAttached:S},a[15]=S,a[16]=j);let{lastFocusedWithinRef:M}=R(j),N=x.map(W).join(` `),P;a[17]===h?P=a[18]:(P=()=>{let e=O.current;if(e==null)return;let t=!1;for(let n of e.querySelectorAll(`[data-alert-mount]`)){let e=n.getAttribute(`data-alert-mount`);e!=null&&b(n,h.getHost(e))&&(t=!0)}t&&h.notifyPlacementChange(),h.flushFocusRestore()},a[17]=h,a[18]=P),e(P,[h,N]);let F;if(a[19]!==M||a[20]!==h?(F=()=>{let e=M.current;if(e==null)return;if(e.isConnected){let t=O.current;e instanceof HTMLElement&&document.activeElement!==e&&(t==null||!t.contains(e))&&(M.current=null,e.focus({preventScroll:!0}));return}M.current=null;let t=O.current?.querySelector(`[data-alert-dismiss]`);if(t!=null){t.focus();return}let n=h.getBarElement()?.querySelector(`[data-alert-dismiss], [data-alert-expand]`);n==null?z():n.focus()},a[19]=M,a[20]=h,a[21]=F):F=a[21],e(F,[h,N]),x.length===0)return null;let I;a[22]===l?I=a[23]:(I=r(l,`alert-center-content`),a[22]=l,a[23]=I);let L=v?`open`:`closed`,B;a[24]===c?B=a[25]:(B=n(`h-0 overflow-hidden invisible [content-visibility:hidden] transition-[height,visibility,content-visibility] transition-discrete duration-200 ease-out [interpolate-size:allow-keywords] data-state-open:h-auto data-state-open:visible data-state-open:[content-visibility:visible] motion-reduce:transition-none`,c),a[24]=c,a[25]=B);let V=s==null?m:void 0,H=x.map(G),U;a[26]!==s||a[27]!==V||a[28]!==H?(U=/* @__PURE__ */ g(`ul`,{"aria-label":V,"aria-labelledby":s,className:`flex w-full flex-col`,children:H}),a[26]=s,a[27]=V,a[28]=H,a[29]=U):U=a[29];let K;return a[30]!==k||a[31]!==_||a[32]!==u||a[33]!==L||a[34]!==B||a[35]!==U||a[36]!==I?(K=/* @__PURE__ */ g(`div`,{...u,ref:k,"data-slot":I,id:_,"data-state":L,className:B,children:U}),a[30]=k,a[31]=_,a[32]=u,a[33]=L,a[34]=B,a[35]=U,a[36]=I,a[37]=K):K=a[37],K},Item:P,DismissIconButton:F};function U(){return new D}function W(e){return e.id}function G(e){return/* @__PURE__ */ g(`li`,{children:/* @__PURE__ */ g(a.Root,{appearance:`banner`,intent:e.intent,className:n(V,e.className),"data-slot":`alert-center-item`,"data-placement":`list`,"data-alert-id":e.id,children:/* @__PURE__ */ g(`div`,{className:`contents`,"data-alert-mount":e.id})})},e.id)}export{H as AlertCenter};
|
package/dist/alert-dialog.d.ts
CHANGED
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
* @see https://mantle.ngrok.com/components/overlays/alert-dialog
|
|
5
5
|
*/
|
|
6
6
|
import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
|
|
7
|
-
import { t as WithDataSlot } from "./data-slot-
|
|
8
|
-
import { i as ButtonIntent, n as ButtonAppearance, r as ButtonProps } from "./button-
|
|
9
|
-
import { c as Trigger$1, n as Content$1, o as Root$1, r as Description$1, s as Title$1, t as Close$1 } from "./dialog-
|
|
10
|
-
import { t as SvgAttributes } from "./icon
|
|
7
|
+
import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
|
|
8
|
+
import { i as ButtonIntent, n as ButtonAppearance, r as ButtonProps } from "./button-Ddj6yr10.js";
|
|
9
|
+
import { c as Trigger$1, n as Content$1, o as Root$1, r as Description$1, s as Title$1, t as Close$1 } from "./dialog-CbEEA0fl.js";
|
|
10
|
+
import { t as SvgAttributes } from "./icon--purqHRo.js";
|
|
11
11
|
import { ComponentProps, ReactNode } from "react";
|
|
12
12
|
declare const intents: readonly ["info", "danger"];
|
|
13
13
|
type AlertDialogIntent = (typeof intents)[number];
|
|
14
14
|
type AlertDialogProps = ComponentProps<typeof Root$1> & {
|
|
15
15
|
/**
|
|
16
|
-
* The intent of the AlertDialog
|
|
16
|
+
* The intent of the AlertDialog: the tone its color communicates to the
|
|
17
17
|
* user, affecting the color and styling of descendants like
|
|
18
18
|
* `AlertDialog.Icon` and `AlertDialog.Action`.
|
|
19
19
|
*/
|
|
@@ -133,6 +133,12 @@ type AlertDialogContentProps = ComponentProps<typeof Content$1> & {
|
|
|
133
133
|
* focus and hides outside content from assistive technology. Put a control that
|
|
134
134
|
* every user must reach inside the content.
|
|
135
135
|
*
|
|
136
|
+
* A script can show its own popup in a frame on `<body>`, above the alert
|
|
137
|
+
* dialog, such as the 3-D Secure challenge of a payment script. While that
|
|
138
|
+
* frame is on top at the center of the viewport, the alert dialog yields to
|
|
139
|
+
* the popup. Focus that a script moves into the popup stays there. Escape
|
|
140
|
+
* moves focus into the popup and does not close the alert dialog.
|
|
141
|
+
*
|
|
136
142
|
* @see https://mantle.ngrok.com/components/overlays/alert-dialog#alertdialogcontent
|
|
137
143
|
*
|
|
138
144
|
* @example
|
|
@@ -356,7 +362,7 @@ declare const Title: ({ "data-slot": dataSlot, className, ref, ...props }: Compo
|
|
|
356
362
|
declare const Description: ({ "data-slot": dataSlot, className, ref, ...props }: ComponentProps<typeof Description$1> & WithDataSlot) => import("react").JSX.Element;
|
|
357
363
|
type AlertDialogActionProps = Omit<ButtonProps, "appearance" | "intent"> & {
|
|
358
364
|
/**
|
|
359
|
-
* The visual style of the action button. Optional here
|
|
365
|
+
* The visual style of the action button. Optional here: `AlertDialog.Action`
|
|
360
366
|
* defaults to `"filled"` so the confirming action carries the heaviest
|
|
361
367
|
* visual weight in the dialog.
|
|
362
368
|
*
|
|
@@ -364,7 +370,7 @@ type AlertDialogActionProps = Omit<ButtonProps, "appearance" | "intent"> & {
|
|
|
364
370
|
*/
|
|
365
371
|
appearance?: ButtonAppearance;
|
|
366
372
|
/**
|
|
367
|
-
* The tone of the action button. Optional here
|
|
373
|
+
* The tone of the action button. Optional here. When omitted,
|
|
368
374
|
* `AlertDialog.Action` derives the tone from the parent `AlertDialog.Root`'s
|
|
369
375
|
* `intent` (`"danger"` → `"danger"`, `"info"` → `"neutral"`). A passed
|
|
370
376
|
* value always wins over the context-derived tone.
|
|
@@ -417,7 +423,7 @@ type AlertDialogActionProps = Omit<ButtonProps, "appearance" | "intent"> & {
|
|
|
417
423
|
declare const Action: ({ "data-slot": dataSlot, appearance, intent, ref, ...props }: AlertDialogActionProps) => import("react").JSX.Element;
|
|
418
424
|
type AlertDialogCancelProps = Omit<ButtonProps, "appearance" | "intent"> & {
|
|
419
425
|
/**
|
|
420
|
-
* The visual style of the cancel button. Optional here
|
|
426
|
+
* The visual style of the cancel button. Optional here: `AlertDialog.Cancel`
|
|
421
427
|
* defaults to `"outlined"` so it visually de-emphasizes against
|
|
422
428
|
* `AlertDialog.Action`.
|
|
423
429
|
*
|
|
@@ -425,7 +431,7 @@ type AlertDialogCancelProps = Omit<ButtonProps, "appearance" | "intent"> & {
|
|
|
425
431
|
*/
|
|
426
432
|
appearance?: ButtonAppearance;
|
|
427
433
|
/**
|
|
428
|
-
* The tone of the cancel button. Optional here
|
|
434
|
+
* The tone of the cancel button. Optional here: `AlertDialog.Cancel`
|
|
429
435
|
* defaults to `"neutral"`, the workhorse tone for routine actions.
|
|
430
436
|
*
|
|
431
437
|
* @default "neutral"
|
|
@@ -564,7 +570,7 @@ declare const Close: ({ "data-slot": dataSlot, ref, ...props }: ComponentProps<t
|
|
|
564
570
|
* A modal dialog that interrupts the user with important content and expects a
|
|
565
571
|
* response. Use AlertDialog for destructive or irreversible confirmations
|
|
566
572
|
* (delete, sign out, leave without saving) where the user must explicitly
|
|
567
|
-
* acknowledge before proceeding
|
|
573
|
+
* acknowledge before proceeding. It blocks all background interaction by
|
|
568
574
|
* default. For non-destructive input modals or confirmation flows, use
|
|
569
575
|
* `Dialog` instead. For side-panel content (filter panels, detail views,
|
|
570
576
|
* navigation drawers), use `Sheet`.
|
|
@@ -863,6 +869,12 @@ declare const AlertDialog: {
|
|
|
863
869
|
* focus and hides outside content from assistive technology. Put a control that
|
|
864
870
|
* every user must reach inside the content.
|
|
865
871
|
*
|
|
872
|
+
* A script can show its own popup in a frame on `<body>`, above the alert
|
|
873
|
+
* dialog, such as the 3-D Secure challenge of a payment script. While that
|
|
874
|
+
* frame is on top at the center of the viewport, the alert dialog yields to
|
|
875
|
+
* the popup. Focus that a script moves into the popup stays there. Escape
|
|
876
|
+
* moves focus into the popup and does not close the alert dialog.
|
|
877
|
+
*
|
|
866
878
|
* @see https://mantle.ngrok.com/components/overlays/alert-dialog#alertdialogcontent
|
|
867
879
|
*
|
|
868
880
|
* @example
|
package/dist/alert-dialog.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"./layer-container-
|
|
1
|
+
"use client";import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./layer-container-DL4yclOu.js";import{t as r}from"./button-DNLTJ32M.js";import{a as i,c as a,i as o,n as s,o as c,r as l,s as u,t as d}from"./primitive-D8CzV_Ft.js";import{t as f}from"./icon-BudQMD2S.js";import{t as p}from"./slot-B7rwscwd.js";import{c as m}from"react/compiler-runtime";import{createContext as h,useContext as g}from"react";import _ from"tiny-invariant";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{InfoIcon as b}from"@phosphor-icons/react/Info";import{WarningIcon as x}from"@phosphor-icons/react/Warning";const S=h(null);function C(){let e=g(S);return _(e,`AlertDialog parts must be rendered inside AlertDialog.Root.`),e}function w(e){let t=m(10),n,r;t[0]===e?(n=t[1],r=t[2]):({intent:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i={intent:n},t[3]=n,t[4]=i);let a=i,o;t[5]===r?o=t[6]:(o=/* @__PURE__ */ v(c,{...r}),t[5]=r,t[6]=o);let s;return t[7]!==a||t[8]!==o?(s=/* @__PURE__ */ v(S.Provider,{value:a,children:o}),t[7]=a,t[8]=o,t[9]=s):s=t[9],s}const T=e=>{let n=m(10),r,i,o;n[0]===e?(r=n[1],i=n[2],o=n[3]):({"data-slot":r,ref:o,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=o);let s;n[4]===r?s=n[5]:(s=t(r,`alert-dialog-trigger`),n[4]=r,n[5]=s);let c;return n[6]!==i||n[7]!==o||n[8]!==s?(c=/* @__PURE__ */ v(a,{ref:o,"data-slot":s,...i}),n[6]=i,n[7]=o,n[8]=s,n[9]=c):c=n[9],c},E=i,D=n=>{let r=m(14),i,a,s,c;r[0]===n?(i=r[1],a=r[2],s=r[3],c=r[4]):({"data-slot":a,className:i,ref:c,...s}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=s,r[4]=c);let l;r[5]===a?l=r[6]:(l=t(a,`alert-dialog-overlay`),r[5]=a,r[6]=l);let u;r[7]===i?u=r[8]:(u=e(`data-state-open:animate-in data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:fade-in-0 duration-200 ease-out-strong data-state-closed:duration-150 bg-overlay fixed inset-0 z-60 backdrop-blur-xs`,i),r[7]=i,r[8]=u);let d;return r[9]!==s||r[10]!==c||r[11]!==l||r[12]!==u?(d=/* @__PURE__ */ v(o,{"data-slot":l,className:u,...s,ref:c}),r[9]=s,r[10]=c,r[11]=l,r[12]=u,r[13]=d):d=r[13],d},O=r=>{let i=m(21),a,o,c,l,u,d;i[0]===r?(a=i[1],o=i[2],c=i[3],l=i[4],u=i[5],d=i[6]):({"data-slot":o,className:a,onInteractOutside:c,preferredWidth:d,ref:u,...l}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=c,i[4]=l,i[5]=u,i[6]=d);let f=d===void 0?`max-w-md`:d,p;i[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=/* @__PURE__ */ v(D,{}),i[7]=p):p=i[7];let h;i[8]===o?h=i[9]:(h=t(o,`alert-dialog-content`),i[8]=o,i[9]=h);let g;i[10]===c?g=i[11]:(g=e=>{c?.(e),e.preventDefault()},i[10]=c,i[11]=g);let _;i[12]!==a||i[13]!==f?(_=e(`flex w-full flex-1 flex-col items-center gap-4 sm:flex-row sm:items-start`,`outline-hidden focus-within:outline-hidden`,`p-6`,`border-dialog bg-dialog rounded-xl border shadow-lg duration-200 ease-out-strong data-state-closed:duration-150 motion-reduce:animate-none!`,`data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95`,f,a),i[12]=a,i[13]=f,i[14]=_):_=i[14];let b;return i[15]!==l||i[16]!==u||i[17]!==h||i[18]!==g||i[19]!==_?(b=/* @__PURE__ */ y(E,{children:[p,/* @__PURE__ */ v(n,{"data-slot":`alert-dialog-positioner`,className:`fixed inset-4 z-60 flex items-center justify-center motion-safe:not-has-[>[data-mantle-modal-content][data-state=open]]:animate-exit-hold`,children:/* @__PURE__ */ v(s,{role:`alertdialog`,"data-slot":h,"data-mantle-modal-content":!0,ref:u,onInteractOutside:g,className:_,...l})})]}),i[15]=l,i[16]=u,i[17]=h,i[18]=g,i[19]=_,i[20]=b):b=i[20],b},k=n=>{let r=m(16),i,a,o,s,c;r[0]===n?(i=r[1],a=r[2],o=r[3],s=r[4],c=r[5]):({"data-slot":a,asChild:c,className:i,ref:s,...o}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=s,r[5]=c);let l=c!==void 0&&c?p:`div`,u;r[6]===a?u=r[7]:(u=t(a,`alert-dialog-body`),r[6]=a,r[7]=u);let d;r[8]===i?d=r[9]:(d=e(`flex-1 space-y-4`,i),r[8]=i,r[9]=d);let f;return r[10]!==l||r[11]!==o||r[12]!==s||r[13]!==u||r[14]!==d?(f=/* @__PURE__ */ v(l,{"data-slot":u,className:d,ref:s,...o}),r[10]=l,r[11]=o,r[12]=s,r[13]=u,r[14]=d,r[15]=f):f=r[15],f},A=n=>{let r=m(16),i,a,o,s,c;r[0]===n?(i=r[1],a=r[2],o=r[3],s=r[4],c=r[5]):({"data-slot":a,asChild:c,className:i,ref:s,...o}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=s,r[5]=c);let l=c!==void 0&&c?p:`div`,u;r[6]===a?u=r[7]:(u=t(a,`alert-dialog-header`),r[6]=a,r[7]=u);let d;r[8]===i?d=r[9]:(d=e(`flex flex-col space-y-2 text-center sm:text-start`,i),r[8]=i,r[9]=d);let f;return r[10]!==l||r[11]!==o||r[12]!==s||r[13]!==u||r[14]!==d?(f=/* @__PURE__ */ v(l,{"data-slot":u,className:d,ref:s,...o}),r[10]=l,r[11]=o,r[12]=s,r[13]=u,r[14]=d,r[15]=f):f=r[15],f},j=n=>{let r=m(16),i,a,o,s,c;r[0]===n?(i=r[1],a=r[2],o=r[3],s=r[4],c=r[5]):({"data-slot":a,asChild:c,className:i,ref:s,...o}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=s,r[5]=c);let l=c!==void 0&&c?p:`div`,u;r[6]===a?u=r[7]:(u=t(a,`alert-dialog-footer`),r[6]=a,r[7]=u);let d;r[8]===i?d=r[9]:(d=e(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,i),r[8]=i,r[9]=d);let f;return r[10]!==l||r[11]!==o||r[12]!==s||r[13]!==u||r[14]!==d?(f=/* @__PURE__ */ v(l,{"data-slot":u,className:d,ref:s,...o}),r[10]=l,r[11]=o,r[12]=s,r[13]=u,r[14]=d,r[15]=f):f=r[15],f},M=n=>{let r=m(14),i,a,o,s;r[0]===n?(i=r[1],a=r[2],o=r[3],s=r[4]):({"data-slot":a,className:i,ref:s,...o}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=s);let c;r[5]===a?c=r[6]:(c=t(a,`alert-dialog-title`),r[5]=a,r[6]=c);let l;r[7]===i?l=r[8]:(l=e(`text-strong text-center text-lg font-medium sm:text-start`,i),r[7]=i,r[8]=l);let d;return r[9]!==o||r[10]!==s||r[11]!==c||r[12]!==l?(d=/* @__PURE__ */ v(u,{ref:s,"data-slot":c,className:l,...o}),r[9]=o,r[10]=s,r[11]=c,r[12]=l,r[13]=d):d=r[13],d},N=n=>{let r=m(14),i,a,o,s;r[0]===n?(i=r[1],a=r[2],o=r[3],s=r[4]):({"data-slot":a,className:i,ref:s,...o}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=s);let c;r[5]===a?c=r[6]:(c=t(a,`alert-dialog-description`),r[5]=a,r[6]=c);let u;r[7]===i?u=r[8]:(u=e(`text-body text-center text-sm font-normal sm:text-start`,i),r[7]=i,r[8]=u);let d;return r[9]!==o||r[10]!==s||r[11]!==c||r[12]!==u?(d=/* @__PURE__ */ v(l,{ref:s,"data-slot":c,className:u,...o}),r[9]=o,r[10]=s,r[11]=c,r[12]=u,r[13]=d):d=r[13],d},P={danger:`danger`,info:`neutral`},F=e=>{let n=m(14),i,a,o,s,c;n[0]===e?(i=n[1],a=n[2],o=n[3],s=n[4],c=n[5]):({"data-slot":i,appearance:c,intent:a,ref:s,...o}=e,n[0]=e,n[1]=i,n[2]=a,n[3]=o,n[4]=s,n[5]=c);let l=c===void 0?`filled`:c,u=C(),d=P[u.intent],f;n[6]===i?f=n[7]:(f=t(i,`alert-dialog-action`),n[6]=i,n[7]=f);let p=a??d,h;return n[8]!==l||n[9]!==o||n[10]!==s||n[11]!==f||n[12]!==p?(h=/* @__PURE__ */ v(r,{appearance:l,"data-slot":f,intent:p,ref:s,...o}),n[8]=l,n[9]=o,n[10]=s,n[11]=f,n[12]=p,n[13]=h):h=n[13],h},I=n=>{let i=m(18),a,o,s,c,l,u;i[0]===n?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5],u=i[6]):({"data-slot":o,appearance:l,className:a,intent:u,ref:c,...s}=n,i[0]=n,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l,i[6]=u);let f=l===void 0?`outlined`:l,p=u===void 0?`neutral`:u,h;i[7]===o?h=i[8]:(h=t(o,`alert-dialog-cancel`),i[7]=o,i[8]=h);let g;i[9]===a?g=i[10]:(g=e(`mt-2 sm:mt-0`,a),i[9]=a,i[10]=g);let _;return i[11]!==f||i[12]!==p||i[13]!==s||i[14]!==c||i[15]!==h||i[16]!==g?(_=/* @__PURE__ */ v(d,{asChild:!0,children:/* @__PURE__ */ v(r,{appearance:f,"data-slot":h,className:g,intent:p,ref:c,...s})}),i[11]=f,i[12]=p,i[13]=s,i[14]=c,i[15]=h,i[16]=g,i[17]=_):_=i[17],_},L={danger:/* @__PURE__ */ v(x,{}),info:/* @__PURE__ */ v(b,{})},R={danger:`text-danger-600`,info:`text-accent-600`},z={Root:w,Action:F,Body:k,Cancel:I,Close:e=>{let n=m(10),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({"data-slot":r,ref:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===r?o=n[5]:(o=t(r,`alert-dialog-close`),n[4]=r,n[5]=o);let s;return n[6]!==i||n[7]!==a||n[8]!==o?(s=/* @__PURE__ */ v(d,{ref:a,"data-slot":o,...i}),n[6]=i,n[7]=a,n[8]=o,n[9]=s):s=n[9],s},Content:O,Description:N,Footer:j,Header:A,Icon:n=>{let r=m(17),i,a,o,s,c;r[0]===n?(i=r[1],a=r[2],o=r[3],s=r[4],c=r[5]):({"data-slot":a,className:i,ref:s,svg:c,...o}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=s,r[5]=c);let l=C(),u=R[l.intent],d=L[l.intent],p;r[6]===a?p=r[7]:(p=t(a,`alert-dialog-icon`),r[6]=a,r[7]=p);let h;r[8]!==i||r[9]!==u?(h=e(`size-12 sm:size-7`,u,i),r[8]=i,r[9]=u,r[10]=h):h=r[10];let g=c??d,_;return r[11]!==o||r[12]!==s||r[13]!==p||r[14]!==h||r[15]!==g?(_=/* @__PURE__ */ v(f,{ref:s,"data-slot":p,className:h,svg:g,...o}),r[11]=o,r[12]=s,r[13]=p,r[14]=h,r[15]=g,r[16]=_):_=r[16],_},Title:M,Trigger:T};export{z as AlertDialog};
|
package/dist/alert.d.ts
CHANGED
package/dist/alert.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{t as Alert}from"./alert-
|
|
1
|
+
export{t as Alert}from"./alert-BkJHDx9X.js";
|
|
@@ -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"./icon-xb7d9M7X.js";import{t as r}from"./slot-B7rwscwd.js";import{c as i}from"react/compiler-runtime";import{Children as a,cloneElement as o,isValidElement as s}from"react";import c from"tiny-invariant";import{Fragment as l,jsx as u,jsxs as d}from"react/jsx-runtime";const f=t=>e(`cursor-pointer rounded bg-transparent text-accent-600 hover:underline focus:outline-hidden focus-visible:ring-3 focus-visible:ring-focus-accent`,t),p=e=>{let p=i(72),g,_,v,y,b,x,S,C,w;p[0]===e?(g=p[1],_=p[2],v=p[3],y=p[4],b=p[5],x=p[6],S=p[7],C=p[8],w=p[9]):({"data-slot":y,asChild:g,children:_,className:v,rel:x,icon:b,iconPlacement:w,ref:C,...S}=e,p[0]=e,p[1]=g,p[2]=_,p[3]=v,p[4]=y,p[5]=b,p[6]=x,p[7]=S,p[8]=C,p[9]=w);let T=w===void 0?`start`:w,E;p[10]===x?E=p[11]:(E=h(x),p[10]=x,p[11]=E);let D=E;if(g){let e,i,h,g,x,w,E;if(p[12]!==_||p[13]!==v||p[14]!==y||p[15]!==b||p[16]!==T||p[17]!==S||p[18]!==C||p[19]!==D){let O=a.only(_);c(s(O),"When using `asChild`, Anchor must be passed a single child as a JSX tag.");let k=O.props?.children,A=S.target===`_blank`||O.props?.target===`_blank`;e=r,p[27]===y?i=p[28]:(i=t(y,`anchor`),p[27]=y,p[28]=i),p[29]===v?h=p[30]:(h=f(v),p[29]=v,p[30]=h),g=C,p[31]!==A||p[32]!==D?(x=D??m(A),p[31]=A,p[32]=D,p[33]=x):x=p[33],w=S;let j;p[34]!==b||p[35]!==T?(j=b&&T===`start`&&/* @__PURE__ */ u(n,{className:`inline-block mr-1.5`,svg:b}),p[34]=b,p[35]=T,p[36]=j):j=p[36];let M;p[37]!==b||p[38]!==T?(M=b&&T===`end`&&/* @__PURE__ */ u(n,{className:`inline-block ml-1.5`,svg:b}),p[37]=b,p[38]=T,p[39]=M):M=p[39],E=o(O,{},/* @__PURE__ */ d(l,{children:[j,/* @__PURE__ */ u(`span`,{"data-slot":`anchor-label`,children:k}),M]})),p[12]=_,p[13]=v,p[14]=y,p[15]=b,p[16]=T,p[17]=S,p[18]=C,p[19]=D,p[20]=e,p[21]=i,p[22]=h,p[23]=g,p[24]=x,p[25]=w,p[26]=E}else e=p[20],i=p[21],h=p[22],g=p[23],x=p[24],w=p[25],E=p[26];let O;return p[40]!==e||p[41]!==i||p[42]!==h||p[43]!==g||p[44]!==x||p[45]!==w||p[46]!==E?(O=/* @__PURE__ */ u(e,{"data-slot":i,className:h,ref:g,rel:x,...w,children:E}),p[40]=e,p[41]=i,p[42]=h,p[43]=g,p[44]=x,p[45]=w,p[46]=E,p[47]=O):O=p[47],O}let O;p[48]===y?O=p[49]:(O=t(y,`anchor`),p[48]=y,p[49]=O);let k;p[50]===v?k=p[51]:(k=f(v),p[50]=v,p[51]=k);let A;p[52]!==S||p[53]!==D?(A=D??m(S.target===`_blank`),p[52]=S,p[53]=D,p[54]=A):A=p[54];let j;p[55]!==b||p[56]!==T?(j=b&&T===`start`&&/* @__PURE__ */ u(n,{className:`inline-block mr-1.5`,svg:b}),p[55]=b,p[56]=T,p[57]=j):j=p[57];let M;p[58]===_?M=p[59]:(M=/* @__PURE__ */ u(`span`,{"data-slot":`anchor-label`,children:_}),p[58]=_,p[59]=M);let N;p[60]!==b||p[61]!==T?(N=b&&T===`end`&&/* @__PURE__ */ u(n,{className:`inline-block ml-1.5`,svg:b}),p[60]=b,p[61]=T,p[62]=N):N=p[62];let P;return p[63]!==S||p[64]!==C||p[65]!==O||p[66]!==k||p[67]!==A||p[68]!==j||p[69]!==M||p[70]!==N?(P=/* @__PURE__ */ d(`a`,{"data-slot":O,className:k,ref:C,rel:A,...S,children:[j,M,N]}),p[63]=S,p[64]=C,p[65]=O,p[66]=k,p[67]=A,p[68]=j,p[69]=M,p[70]=N,p[71]=P):P=p[71],P};function m(e){return e?`noopener noreferrer`:void 0}function h(e){return Array.isArray(e)?[...new Set(e)].map(e=>e?.trim()).filter(Boolean).toSorted().join(` `)||void 0:e?.trim()||void 0}export{f as n,h as r,p as t};
|
package/dist/anchor.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @see https://mantle.ngrok.com/components/navigation/anchor
|
|
5
5
|
*/
|
|
6
6
|
import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
|
|
7
|
-
import { t as WithDataSlot } from "./data-slot-
|
|
7
|
+
import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
|
|
8
8
|
import { ComponentProps, ReactNode } from "react";
|
|
9
9
|
/**
|
|
10
10
|
* The rel attribute defines the relationship between a linked resource and the current document. Valid on <link>, <a>, <area>, and <form>, the supported values depend on the element on which the attribute is found.
|
|
@@ -42,7 +42,7 @@ type AnchorProps = Omit<ComponentProps<"a">, "rel"> & WithAsChild & WithDataSlot
|
|
|
42
42
|
rel?: Rel | (string & {}) | undefined | (Rel | (string & {}) | undefined | null)[];
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
45
|
-
* A styled hyperlink
|
|
45
|
+
* A styled hyperlink: a native `<a>` with mantle's link styling, focus
|
|
46
46
|
* treatment, optional leading/trailing icon, and a safer default for the
|
|
47
47
|
* `rel` attribute. Use for links that point _outside_ the current
|
|
48
48
|
* application.
|
|
@@ -52,16 +52,16 @@ type AnchorProps = Omit<ComponentProps<"a">, "rel"> & WithAsChild & WithDataSlot
|
|
|
52
52
|
* - Links to files or `mailto:` / `tel:` destinations.
|
|
53
53
|
*
|
|
54
54
|
* **When not to use**
|
|
55
|
-
* - Internal application routes
|
|
55
|
+
* - Internal application routes: prefer the framework router's link
|
|
56
56
|
* primitive ({@link https://reactrouter.com/en/main/components/link `react-router` `<Link>`})
|
|
57
57
|
* so client-side navigation kicks in. You can keep mantle's styling by
|
|
58
58
|
* composing: `<Anchor asChild><Link to="/foo">…</Link></Anchor>`.
|
|
59
|
-
* - For triggering an action
|
|
59
|
+
* - For triggering an action: use a {@link https://mantle.ngrok.com/components/actions/button Button}
|
|
60
60
|
* instead. If it doesn't navigate, it's not a link.
|
|
61
61
|
*
|
|
62
62
|
* **Icons.** Pass `icon` (a phosphor or custom SVG) and optionally
|
|
63
63
|
* `iconPlacement` (`"start"` default, or `"end"`) to render a small inline
|
|
64
|
-
* icon
|
|
64
|
+
* icon. It suits "external link" or "download" affordances. Icons are
|
|
65
65
|
* decorative; the link text must still describe the destination on its own.
|
|
66
66
|
*
|
|
67
67
|
* **Security.** When `target="_blank"` and `rel` is omitted, the anchor
|
package/dist/anchor.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{t as Anchor,n as anchorClassNames,r as resolveRel}from"./anchor-
|
|
1
|
+
export{t as Anchor,n as anchorClassNames,r as resolveRel}from"./anchor-Dc6IgvXV.js";
|