@ngrok/mantle 0.88.0 → 0.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion.d.ts +10 -9
- package/dist/accordion.js +1 -1
- package/dist/agent.json +2 -1
- package/dist/{alert-DCVfviBx.d.ts → alert-BzPDUaU7.d.ts} +16 -15
- package/dist/alert-CZYYlx9q.js +1 -0
- package/dist/alert-center.d.ts +7 -7
- package/dist/alert-center.js +1 -1
- package/dist/alert-dialog.d.ts +17 -16
- package/dist/alert-dialog.js +1 -1
- package/dist/alert-vfeV_hso.js +1 -0
- package/dist/alert.d.ts +1 -1
- package/dist/alert.js +1 -1
- package/dist/anchor-CgcbWEUs.js +1 -0
- package/dist/anchor.js +1 -1
- package/dist/app-layout.d.ts +1128 -45
- package/dist/app-layout.js +1 -1
- package/dist/area-chart.d.ts +41 -18
- package/dist/area-chart.js +1 -1
- package/dist/avatar.js +1 -1
- package/dist/badge.d.ts +3 -2
- package/dist/badge.js +1 -1
- package/dist/bar-chart.d.ts +37 -13
- package/dist/bar-chart.js +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/browser-only.js +1 -1
- package/dist/button-69InNC_m.js +1 -0
- package/dist/button-BMfUxs_j.js +1 -0
- package/dist/{button-DO53OA70.d.ts → button-CHoYpOzx.d.ts} +5 -4
- package/dist/{button-B52_vczK.js → button-D8rr-1AB.js} +1 -1
- package/dist/{button-crUf0hbR.d.ts → button-DL7V4bzW.d.ts} +5 -4
- package/dist/button-b2HKEIE2.js +1 -0
- package/dist/{button-B5i9n7Qp.d.ts → button-mzUR1U0Y.d.ts} +5 -4
- package/dist/button.d.ts +3 -3
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +3 -2
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +8 -7
- package/dist/card.js +1 -1
- package/dist/centered-layout.js +1 -1
- package/dist/{chart-DgaWVBqi.d.ts → chart-23KQ1ZNO.d.ts} +128 -62
- package/dist/chart-BRkJfptA.js +2 -0
- package/dist/checkbox-C3N2afhB.js +1 -0
- package/dist/checkbox.d.ts +3 -2
- package/dist/checkbox.js +1 -1
- package/dist/{choice-PESu-9s8.d.ts → choice-BCiyqLgO.d.ts} +12 -11
- package/dist/choice-DQmecLfy.js +1 -0
- package/dist/choice.d.ts +1 -1
- package/dist/choice.js +1 -1
- package/dist/code-block-4Esx_gV-.js +12 -0
- package/dist/code-block.d.ts +17 -16
- package/dist/code-block.js +6 -6
- package/dist/code-block_highlight-utils.js +1 -1
- package/dist/code.d.ts +2 -1
- package/dist/code.js +1 -1
- package/dist/combobox.d.ts +15 -14
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +13 -13
- package/dist/command.js +1 -1
- package/dist/cx-CK7o_rVv.js +1 -0
- package/dist/cx.js +1 -1
- package/dist/data-table.d.ts +32 -31
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +6 -6
- package/dist/description-list.js +1 -1
- package/dist/dialog-BDzapPLR.js +1 -0
- package/dist/{dialog-DXpqpdJj.d.ts → dialog-DQdeqvq-.d.ts} +28 -15
- package/dist/dialog.d.ts +1 -1
- package/dist/dialog.js +1 -1
- package/dist/dropdown-menu-CWUzGFgf.d.ts +1 -0
- package/dist/{dropdown-menu-BloQKE_y.d.ts → dropdown-menu-CpRsyt_F.d.ts} +17 -17
- package/dist/dropdown-menu-CutWQ0bl.js +1 -0
- package/dist/dropdown-menu.d.ts +2 -2
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +7 -6
- package/dist/empty.js +1 -1
- package/dist/field.d.ts +16 -15
- package/dist/field.js +1 -1
- package/dist/flag.d.ts +3 -2
- package/dist/flag.js +1 -1
- package/dist/hooks.js +1 -1
- package/dist/hover-card.d.ts +5 -4
- package/dist/hover-card.js +1 -1
- package/dist/icon-BudQMD2S.js +1 -0
- package/dist/icon-kK0c-POG.js +1 -0
- package/dist/{icon-w0HUe7tr.d.ts → icon-r2NvfTWW.d.ts} +3 -2
- package/dist/{icon-BmJ57Tgh.d.ts → icon-ucVgZeXn.d.ts} +3 -2
- package/dist/icon.d.ts +2 -2
- package/dist/icon.js +1 -1
- package/dist/icons-BMZnm4hM.js +1 -0
- package/dist/{icons-Bu-2boul.js → icons-CH3tD_wq.js} +1 -1
- package/dist/icons-CSwTVV2m.js +1 -0
- package/dist/icons.js +1 -1
- package/dist/in-view-Dxv_GrUU.js +1 -0
- package/dist/input-D_DjD9lT.js +1 -0
- package/dist/{input-DpnC3Xgj.d.ts → input-bbB1tC0h.d.ts} +3 -2
- package/dist/input.d.ts +5 -4
- package/dist/input.js +1 -1
- package/dist/kbd-CLHsJ99p.js +1 -0
- package/dist/kbd.d.ts +2 -1
- package/dist/kbd.js +1 -1
- package/dist/label-5T8i7I4X.js +1 -0
- package/dist/{label-Bnfe9YJ6.d.ts → label-C-KbNls8.d.ts} +3 -2
- package/dist/label.d.ts +1 -1
- package/dist/label.js +1 -1
- package/dist/{layer-container-R7aux3n8.js → layer-container-DLf-6eBz.js} +1 -1
- package/dist/layer-container.js +1 -1
- package/dist/line-chart.d.ts +40 -15
- package/dist/line-chart.js +1 -1
- package/dist/list-DOVZoz9t.js +1 -0
- package/dist/list.d.ts +3 -2
- package/dist/list.js +1 -1
- package/dist/live-region-DQ1QLv3L.js +1 -0
- package/dist/live-region.d.ts +3 -2
- package/dist/live-region.js +1 -1
- package/dist/llms.txt +2 -1
- package/dist/{main-Dv2zuT_b.js → main-CC1L9IsH.js} +1 -1
- package/dist/main.js +1 -1
- package/dist/mantle.css +3 -0
- package/dist/media-object.js +1 -1
- package/dist/multi-select.d.ts +23 -22
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +9 -8
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +9 -8
- package/dist/pagination.js +1 -1
- package/dist/{popover-Cco1nw8I.d.ts → popover-Dvls7-j4.d.ts} +5 -4
- package/dist/popover-oQDUvcZ2.js +1 -0
- package/dist/popover.d.ts +1 -1
- package/dist/popover.js +1 -1
- package/dist/primitive-B-6XILB2.js +1 -0
- package/dist/progress.d.ts +9 -8
- package/dist/progress.js +1 -1
- package/dist/qr-code.d.ts +9 -8
- package/dist/qr-code.js +1 -1
- package/dist/radio-group.d.ts +19 -18
- package/dist/radio-group.js +1 -1
- package/dist/sandbar.d.ts +7 -7
- package/dist/sandbar.js +1 -1
- package/dist/{sandboxed-on-click-BLvvSqOP.js → sandboxed-on-click-C7pPu-2M.js} +1 -1
- package/dist/sandboxed-on-click.js +1 -1
- package/dist/scatter-plot.d.ts +39 -14
- package/dist/scatter-plot.js +1 -1
- package/dist/{select-BITJP7I5.d.ts → select-CxXb3aiC.d.ts} +3 -3
- package/dist/select-DcL0-duV.js +1 -0
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +16 -15
- package/dist/selectable-list.js +1 -1
- package/dist/separator-DvPe27fH.js +1 -0
- package/dist/{separator-Bo4nY_3M.d.ts → separator-HzGvuD0B.d.ts} +4 -3
- package/dist/separator.d.ts +1 -1
- package/dist/separator.js +1 -1
- package/dist/sheet-DND_KjmS.js +1 -0
- package/dist/sheet.d.ts +13 -12
- package/dist/sheet.js +1 -1
- package/dist/sidebar.d.ts +147 -93
- package/dist/sidebar.js +1 -1
- package/dist/skeleton-zfqoDAxT.js +1 -0
- package/dist/skeleton.d.ts +3 -2
- package/dist/skeleton.js +1 -1
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slider.d.ts +3 -2
- package/dist/slider.js +1 -1
- package/dist/{slot-BsvE2ntj.js → slot-DdYN1L1C.js} +1 -1
- package/dist/{slot-DdgxmuI5.d.ts → slot-Q996Hqk9.d.ts} +1 -1
- package/dist/slot.d.ts +1 -1
- package/dist/slot.js +1 -1
- package/dist/split-button.d.ts +6 -5
- package/dist/split-button.js +1 -1
- package/dist/switch.d.ts +3 -2
- package/dist/switch.js +1 -1
- package/dist/{table-DEI-qvSC.d.ts → table-BhzITa19.d.ts} +10 -9
- package/dist/table-DBbKqOVq.js +1 -0
- 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 +3 -2
- package/dist/text-area.js +1 -1
- package/dist/theme-BlCZHClJ.js +1 -0
- package/dist/theme-switcher.d.ts +3 -3
- package/dist/theme-switcher.js +1 -1
- package/dist/theme.js +1 -1
- package/dist/toast.d.ts +10 -9
- package/dist/toast.js +1 -1
- package/dist/{tooltip-nuUCoqq8.d.ts → tooltip-CngH7Kl6.d.ts} +7 -6
- package/dist/tooltip-NhYXqStK.js +1 -0
- package/dist/tooltip.d.ts +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/truncated-text.d.ts +138 -0
- package/dist/truncated-text.js +1 -0
- package/dist/types.js +1 -1
- package/dist/use-breakpoint--mo7kr9d.js +1 -0
- package/dist/use-is-hydrated-after-paint-r9Cl2mGp.js +1 -0
- package/dist/utils.js +1 -1
- package/dist/visually-hidden.d.ts +2 -1
- package/dist/visually-hidden.js +1 -1
- package/dist/well.d.ts +3 -2
- package/dist/well.js +1 -1
- package/package.json +16 -15
- package/dist/alert-OP_-aGJD.js +0 -1
- package/dist/anchor-BnMhJYS4.js +0 -1
- package/dist/button-BFpCB99R.js +0 -1
- package/dist/button-Dij5vCQG.js +0 -1
- package/dist/button-pwkdtR3U.js +0 -1
- package/dist/chart-aZLMj4xx.js +0 -2
- package/dist/checkbox-DbJSqSNN.js +0 -1
- package/dist/choice-SRyLguqU.js +0 -1
- package/dist/code-block-BE3Q0iAo.js +0 -12
- package/dist/cx-0HCjnNv1.js +0 -1
- package/dist/dialog-HIdb5d3I.js +0 -1
- package/dist/dropdown-menu-BR_AQNMj.js +0 -1
- package/dist/dropdown-menu-Dlpb7600.d.ts +0 -1
- package/dist/icon-BT8FnkkJ.js +0 -1
- package/dist/icon-U24NfYv7.js +0 -1
- package/dist/icons-BQRcOU6J.js +0 -1
- package/dist/icons-C3rVfpx9.js +0 -1
- package/dist/in-view-T_AAYaaF.js +0 -1
- package/dist/input-yq0jLE4e.js +0 -1
- package/dist/kbd-CJ8hNZfS.js +0 -1
- package/dist/label-BAy0Mg59.js +0 -1
- package/dist/list-BleZ-43e.js +0 -1
- package/dist/live-region-B2vJRvPH.js +0 -1
- package/dist/popover-BJ5XNwzD.js +0 -1
- package/dist/primitive-w3wFk2La.js +0 -1
- package/dist/select-CUWLEeuf.js +0 -1
- package/dist/separator-D98be0gY.js +0 -1
- package/dist/sheet-B5x8EO9Y.js +0 -1
- package/dist/skeleton-bVDP8BzY.js +0 -1
- package/dist/table-D2jh52KA.js +0 -1
- package/dist/theme-C1kFFdIk.js +0 -1
- package/dist/tooltip-H03l7E4Y.js +0 -1
- package/dist/use-is-hydrated-after-paint-Drj0lNi4.js +0 -1
- /package/dist/{types-D85fCNV3.js → css-properties-D85fCNV3.js} +0 -0
package/dist/accordion.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { n as WithAsChild } from "./as-child-D23mGo4f.js";
|
|
2
|
-
import {
|
|
2
|
+
import { t as WithDataSlot } from "./data-slot-CChfb_cv.js";
|
|
3
|
+
import { n as IconProps } from "./icon-ucVgZeXn.js";
|
|
3
4
|
import { ComponentProps } from "react";
|
|
4
5
|
//#region src/components/accordion/accordion.d.ts
|
|
5
6
|
/**
|
|
@@ -56,7 +57,7 @@ type AccordionMultipleProps = {
|
|
|
56
57
|
* accordion that keeps at most one section open at a time. Also accepts all
|
|
57
58
|
* standard `<div>` props (forwarded to the container) plus `asChild`.
|
|
58
59
|
*/
|
|
59
|
-
type AccordionRootProps = (AccordionSingleProps | AccordionMultipleProps) & Omit<ComponentProps<"div">, "defaultValue"> & WithAsChild;
|
|
60
|
+
type AccordionRootProps = (AccordionSingleProps | AccordionMultipleProps) & Omit<ComponentProps<"div">, "defaultValue"> & WithAsChild & WithDataSlot;
|
|
60
61
|
/**
|
|
61
62
|
* A vertically stacked set of disclosure sections. The root owns the open/closed
|
|
62
63
|
* state and passes it to its items.
|
|
@@ -117,10 +118,10 @@ declare const Root: (props: AccordionRootProps) => import("react").JSX.Element;
|
|
|
117
118
|
* </Accordion.Item>
|
|
118
119
|
* </Accordion.Root>
|
|
119
120
|
*/
|
|
120
|
-
declare const Item: ({ children, value, ref, ...props }: ComponentProps<"div"> & {
|
|
121
|
+
declare const Item: ({ "data-slot": dataSlot, children, value, ref, ...props }: ComponentProps<"div"> & {
|
|
121
122
|
/** The unique value identifying this item within its accordion. */
|
|
122
123
|
value: string;
|
|
123
|
-
}) => import("react").JSX.Element;
|
|
124
|
+
} & WithDataSlot) => import("react").JSX.Element;
|
|
124
125
|
/**
|
|
125
126
|
* The interactive header that toggles its section, rendered as a `<button>` with
|
|
126
127
|
* `aria-expanded` — the disclosure semantics a native `<summary>` carries, but
|
|
@@ -144,7 +145,7 @@ declare const Item: ({ children, value, ref, ...props }: ComponentProps<"div"> &
|
|
|
144
145
|
* </Accordion.Item>
|
|
145
146
|
* </Accordion.Root>
|
|
146
147
|
*/
|
|
147
|
-
declare const Trigger: ({ className, children, onClick, ref, ...props }: Omit<ComponentProps<"button">, "type">) => import("react").JSX.Element;
|
|
148
|
+
declare const Trigger: ({ "data-slot": dataSlot, className, children, onClick, ref, ...props }: Omit<ComponentProps<"button">, "type"> & WithDataSlot) => import("react").JSX.Element;
|
|
148
149
|
/**
|
|
149
150
|
* The icon that indicates the open/closed state of its {@link Trigger}. Defaults
|
|
150
151
|
* to a downward caret that rotates 180° when the section is open. Pass `svg` to
|
|
@@ -183,10 +184,10 @@ declare const Trigger: ({ className, children, onClick, ref, ...props }: Omit<Co
|
|
|
183
184
|
* </Accordion.Item>
|
|
184
185
|
* </Accordion.Root>
|
|
185
186
|
*/
|
|
186
|
-
declare const TriggerIcon: ({ className, svg, ...props }: Omit<IconProps, "svg"> & {
|
|
187
|
+
declare const TriggerIcon: ({ "data-slot": dataSlot, className, svg, ...props }: Omit<IconProps, "svg"> & {
|
|
187
188
|
/** The icon to render. Defaults to a downward caret that rotates open. */
|
|
188
189
|
svg?: IconProps["svg"];
|
|
189
|
-
}) => import("react").JSX.Element;
|
|
190
|
+
} & WithDataSlot) => import("react").JSX.Element;
|
|
190
191
|
/**
|
|
191
192
|
* The collapsible region of an {@link Item} — the zero-padding viewport that
|
|
192
193
|
* slides open and closed. Wrap its children in {@link Body} for the standard
|
|
@@ -216,7 +217,7 @@ declare const TriggerIcon: ({ className, svg, ...props }: Omit<IconProps, "svg">
|
|
|
216
217
|
* </Accordion.Item>
|
|
217
218
|
* </Accordion.Root>
|
|
218
219
|
*/
|
|
219
|
-
declare const Content: ({ className, children, ref, ...props }: Omit<ComponentProps<"div">, "id">) => import("react").JSX.Element;
|
|
220
|
+
declare const Content: ({ "data-slot": dataSlot, className, children, ref, ...props }: Omit<ComponentProps<"div">, "id"> & WithDataSlot) => import("react").JSX.Element;
|
|
220
221
|
/**
|
|
221
222
|
* The padded inner region of an {@link Item}'s {@link Content} — where the
|
|
222
223
|
* section's body content lives. Owns the body's padding so {@link Content} can
|
|
@@ -247,7 +248,7 @@ declare const Content: ({ className, children, ref, ...props }: Omit<ComponentPr
|
|
|
247
248
|
* </Accordion.Item>
|
|
248
249
|
* </Accordion.Root>
|
|
249
250
|
*/
|
|
250
|
-
declare const Body: ({ className, ref, ...props }: ComponentProps<"div">) => import("react").JSX.Element;
|
|
251
|
+
declare const Body: ({ "data-slot": dataSlot, className, ref, ...props }: ComponentProps<"div"> & WithDataSlot) => import("react").JSX.Element;
|
|
251
252
|
/**
|
|
252
253
|
* A vertically stacked set of disclosure sections styled after the shadcn /
|
|
253
254
|
* ngrok.com accordion.
|
package/dist/accordion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./use-isomorphic-layout-effect-DdTRtMY-.js";import{n as t}from"./compose-refs-sFdxsL7k.js";import{t as n}from"./cx-
|
|
1
|
+
import{t as e}from"./use-isomorphic-layout-effect-DdTRtMY-.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{t as i}from"./icon-kK0c-POG.js";import{t as a}from"./slot-DdYN1L1C.js";import{c as o}from"react/compiler-runtime";import{CaretDownIcon as s}from"@phosphor-icons/react/CaretDown";import{createContext as c,useContext as l,useEffect as u,useId as d,useRef as f,useState as p}from"react";import m from"tiny-invariant";import{jsx as h}from"react/jsx-runtime";function g(e,t){return e.includes(t)}function _(e,t,n,r){let i=e.includes(t);return n?r===`single`?i&&e.length===1?e:[t]:i?e:[...e,t]:i?e.filter(e=>e!==t):e}function v(e){return e==null?[]:typeof e==`string`?e===``?[]:[e]:e}function y(e,t){e.type===`single`?e.onValueChange?.(t[0]??``):e.onValueChange?.([...t])}function b(){return typeof document<`u`&&document.body!=null&&`onbeforematch`in document.body}const x=c(null);function S(e){let t=l(x);return m(t,`\`${e}\` must be rendered within \`Accordion.Root\`.`),t}const C=c(null);function w(e){let t=l(C);return m(t,`\`${e}\` must be rendered within \`Accordion.Item\`.`),t}const T=t=>{let i=o(42),s,c,l,u,d,m,g,b,S;if(i[0]!==t){let{type:e,value:n,defaultValue:r,onValueChange:a,"data-slot":o,asChild:f,children:p,className:h,ref:_,...v}=t;b=e,S=n,d=r,u=o,s=f,c=p,l=h,g=_,m=v,i[0]=t,i[1]=s,i[2]=c,i[3]=l,i[4]=u,i[5]=d,i[6]=m,i[7]=g,i[8]=b,i[9]=S}else s=i[1],c=i[2],l=i[3],u=i[4],d=i[5],m=i[6],g=i[7],b=i[8],S=i[9];let C=b===void 0?`multiple`:b,w=S!=null,T;i[10]===d?T=i[11]:(T=()=>v(d),i[10]=d,i[11]=T);let[E,D]=p(T),O;i[12]!==E||i[13]!==w||i[14]!==S?(O=w?v(S):E,i[12]=E,i[13]=w,i[14]=S,i[15]=O):O=i[15];let k=O,A=f(t),j;i[16]===t?j=i[17]:(j=()=>{A.current=t},i[16]=t,i[17]=j),e(j);let M;i[18]!==w||i[19]!==k||i[20]!==C?(M=(e,t)=>{let n=_(k,e,t,C);n!==k&&(w||D(n),y(A.current,n))},i[18]=w,i[19]=k,i[20]=C,i[21]=M):M=i[21];let N=M,P;i[22]!==k||i[23]!==N||i[24]!==C?(P={type:C,openValues:k,setItemOpen:N},i[22]=k,i[23]=N,i[24]=C,i[25]=P):P=i[25];let F=P,I;i[26]===u?I=i[27]:(I=r(u,`accordion`),i[26]=u,i[27]=I);let L;i[28]===l?L=i[29]:(L=n(`w-full divide-y divide-separator`,l),i[28]=l,i[29]=L);let R;i[30]!==m||i[31]!==I||i[32]!==L?(R={...m,"data-slot":I,className:L},i[30]=m,i[31]=I,i[32]=L,i[33]=R):R=i[33];let z=R,B;i[34]!==s||i[35]!==c||i[36]!==z||i[37]!==g?(B=h(s?a:`div`,{ref:g,...z,children:c}),i[34]=s,i[35]=c,i[36]=z,i[37]=g,i[38]=B):B=i[38];let V;return i[39]!==F||i[40]!==B?(V=/* @__PURE__ */ h(x.Provider,{value:F,children:B}),i[39]=F,i[40]=B,i[41]=V):V=i[41],V},E=e=>{let t=o(27),n,i,a,s,c;t[0]===e?(n=t[1],i=t[2],a=t[3],s=t[4],c=t[5]):({"data-slot":i,children:n,value:c,ref:s,...a}=e,t[0]=e,t[1]=n,t[2]=i,t[3]=a,t[4]=s,t[5]=c);let{openValues:l,setItemOpen:u}=S(`Accordion.Item`),f;t[6]!==l||t[7]!==c?(f=g(l,c),t[6]=l,t[7]=c,t[8]=f):f=t[8];let p=f,m=d(),_;t[9]!==u||t[10]!==c?(_=e=>{u(c,e)},t[9]=u,t[10]=c,t[11]=_):_=t[11];let v=_,y;t[12]!==m||t[13]!==p||t[14]!==v?(y={open:p,setOpen:v,contentId:m},t[12]=m,t[13]=p,t[14]=v,t[15]=y):y=t[15];let b=y,x;t[16]===i?x=t[17]:(x=r(i,`accordion-item`),t[16]=i,t[17]=x);let w=p?`open`:`closed`,T;t[18]!==n||t[19]!==a||t[20]!==s||t[21]!==x||t[22]!==w?(T=/* @__PURE__ */ h(`div`,{ref:s,...a,role:`group`,"data-slot":x,"data-state":w,children:n}),t[18]=n,t[19]=a,t[20]=s,t[21]=x,t[22]=w,t[23]=T):T=t[23];let E;return t[24]!==b||t[25]!==T?(E=/* @__PURE__ */ h(C.Provider,{value:b,children:T}),t[24]=b,t[25]=T,t[26]=E):E=t[26],E},D=e=>{let t=o(25),i,a,s,c,l,u;t[0]===e?(i=t[1],a=t[2],s=t[3],c=t[4],l=t[5],u=t[6]):({"data-slot":s,className:a,children:i,onClick:c,ref:u,...l}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=s,t[4]=c,t[5]=l,t[6]=u);let{open:d,setOpen:f,contentId:p}=w(`Accordion.Trigger`),m;t[7]===s?m=t[8]:(m=r(s,`accordion-trigger`),t[7]=s,t[8]=m);let g=d?`open`:`closed`,_;t[9]===a?_=t[10]:(_=n(`group flex w-full cursor-pointer items-center justify-between gap-4 py-4 text-left font-medium outline-none`,`-mx-2 rounded-md px-2`,`transition-[padding] duration-200 ease-out data-state-open:pb-2 motion-reduce:transition-none`,`focus:outline-hidden focus-visible:ring-4 focus-visible:ring-focus-accent`,a),t[9]=a,t[10]=_);let v;t[11]!==c||t[12]!==d||t[13]!==f?(v=e=>{c?.(e),f(!d)},t[11]=c,t[12]=d,t[13]=f,t[14]=v):v=t[14];let y;return t[15]!==i||t[16]!==p||t[17]!==d||t[18]!==l||t[19]!==u||t[20]!==m||t[21]!==g||t[22]!==_||t[23]!==v?(y=/* @__PURE__ */ h(`button`,{ref:u,type:`button`,...l,"data-slot":m,"data-state":g,"aria-expanded":d,"aria-controls":p,className:_,onClick:v,children:i}),t[15]=i,t[16]=p,t[17]=d,t[18]=l,t[19]=u,t[20]=m,t[21]=g,t[22]=_,t[23]=v,t[24]=y):y=t[24],y},O=/* @__PURE__ */ h(s,{weight:`bold`}),k={Root:T,Item:E,Trigger:D,TriggerIcon:e=>{let t=o(14),a,s,c,l;t[0]===e?(a=t[1],s=t[2],c=t[3],l=t[4]):({"data-slot":s,className:a,svg:l,...c}=e,t[0]=e,t[1]=a,t[2]=s,t[3]=c,t[4]=l);let u=l===void 0?O:l,d;t[5]===s?d=t[6]:(d=r(s,`accordion-trigger-icon`),t[5]=s,t[6]=d);let f;t[7]===a?f=t[8]:(f=n(`size-4 shrink-0 text-muted transition-transform duration-200 group-data-state-open:rotate-180`,a),t[7]=a,t[8]=f);let p;return t[9]!==c||t[10]!==u||t[11]!==d||t[12]!==f?(p=/* @__PURE__ */ h(i,{...c,"data-slot":d,svg:u,className:f}),t[9]=c,t[10]=u,t[11]=d,t[12]=f,t[13]=p):p=t[13],p},Content:i=>{let a=o(25),s,c,l,d,p;a[0]===i?(s=a[1],c=a[2],l=a[3],d=a[4],p=a[5]):({"data-slot":l,className:c,children:s,ref:p,...d}=i,a[0]=i,a[1]=s,a[2]=c,a[3]=l,a[4]=d,a[5]=p);let{open:m,setOpen:g,contentId:_}=w(`Accordion.Content`),v=f(null),y=t(v,p),x,S;a[6]===g?(x=a[7],S=a[8]):(x=()=>{let e=v.current;if(!e||!b())return;let t=()=>{e.removeAttribute(`hidden`),e.style.height=`auto`,g(!0)};return e.addEventListener(`beforematch`,t),()=>{e.removeEventListener(`beforematch`,t)}},S=[g],a[6]=g,a[7]=x,a[8]=S),u(x,S);let C,T;a[9]===m?(C=a[10],T=a[11]):(C=()=>{let e=v.current;e&&b()&&(e.removeAttribute(`inert`),m?e.removeAttribute(`hidden`):(e.setAttribute(`hidden`,`until-found`),e.style.height=``))},T=[m],a[9]=m,a[10]=C,a[11]=T),e(C,T);let E=!m,D;a[12]===l?D=a[13]:(D=r(l,`accordion-content`),a[12]=l,a[13]=D);let O=m?`open`:`closed`,k;a[14]===c?k=a[15]:(k=n(`h-0 overflow-hidden transition-[height,content-visibility] duration-200 ease-out [interpolate-size:allow-keywords] transition-discrete data-state-open:h-auto motion-reduce:transition-none`,c),a[14]=c,a[15]=k);let A;return a[16]!==s||a[17]!==y||a[18]!==_||a[19]!==d||a[20]!==E||a[21]!==D||a[22]!==O||a[23]!==k?(A=/* @__PURE__ */ h(`div`,{ref:y,...d,id:_,inert:E,"data-slot":D,"data-state":O,className:k,children:s}),a[16]=s,a[17]=y,a[18]=_,a[19]=d,a[20]=E,a[21]=D,a[22]=O,a[23]=k,a[24]=A):A=a[24],A},Body:e=>{let t=o(14),i,a,s,c;t[0]===e?(i=t[1],a=t[2],s=t[3],c=t[4]):({"data-slot":a,className:i,ref:c,...s}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=s,t[4]=c);let l;t[5]===a?l=t[6]:(l=r(a,`accordion-body`),t[5]=a,t[6]=l);let u;t[7]===i?u=t[8]:(u=n(`pt-2 pb-4`,i),t[7]=i,t[8]=u);let d;return t[9]!==s||t[10]!==c||t[11]!==l||t[12]!==u?(d=/* @__PURE__ */ h(`div`,{ref:c,...s,"data-slot":l,className:u}),t[9]=s,t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}};export{k as Accordion};
|
package/dist/agent.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngrok/mantle",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.89.0",
|
|
4
4
|
"origin": "https://mantle.ngrok.com",
|
|
5
5
|
"endpoints": {
|
|
6
6
|
"docs": "https://mantle.ngrok.com/",
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
"@ngrok/mantle/theme-switcher",
|
|
89
89
|
"@ngrok/mantle/toast",
|
|
90
90
|
"@ngrok/mantle/tooltip",
|
|
91
|
+
"@ngrok/mantle/truncated-text",
|
|
91
92
|
"@ngrok/mantle/types",
|
|
92
93
|
"@ngrok/mantle/utils",
|
|
93
94
|
"@ngrok/mantle/visually-hidden",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { n as WithAsChild } from "./as-child-D23mGo4f.js";
|
|
2
|
+
import { t as WithDataSlot } from "./data-slot-CChfb_cv.js";
|
|
2
3
|
import { t as SvgAttributes } from "./icon-D1RY5Tcj.js";
|
|
3
|
-
import { r as ButtonProps } from "./button-
|
|
4
|
-
import { n as IconButtonProps, r as IconButtonAppearance } from "./button-
|
|
4
|
+
import { r as ButtonProps } from "./button-mzUR1U0Y.js";
|
|
5
|
+
import { n as IconButtonProps, r as IconButtonAppearance } from "./button-DL7V4bzW.js";
|
|
5
6
|
import { ComponentProps, ReactNode } from "react";
|
|
6
7
|
//#region src/components/alert/alert.d.ts
|
|
7
8
|
declare const intents: readonly ["danger", "important", "info", "success", "warning"];
|
|
@@ -22,7 +23,7 @@ type AlertProps = ComponentProps<"div"> & {
|
|
|
22
23
|
* @default "default"
|
|
23
24
|
*/
|
|
24
25
|
appearance?: Appearance;
|
|
25
|
-
};
|
|
26
|
+
} & WithDataSlot;
|
|
26
27
|
/**
|
|
27
28
|
* Displays a callout for user attention. Root container for all Alert sub-components.
|
|
28
29
|
*
|
|
@@ -57,13 +58,13 @@ type AlertProps = ComponentProps<"div"> & {
|
|
|
57
58
|
* </Alert.Root>
|
|
58
59
|
*```
|
|
59
60
|
*/
|
|
60
|
-
declare const Root: ({ appearance, className, intent, ref, style, ...props }: AlertProps) => import("react").JSX.Element;
|
|
61
|
+
declare const Root: ({ "data-slot": dataSlot, appearance, className, intent, ref, style, ...props }: AlertProps) => import("react").JSX.Element;
|
|
61
62
|
type AlertIconProps = Omit<SvgAttributes, "children"> & {
|
|
62
63
|
/**
|
|
63
64
|
* An optional icon that renders in place of the default icon for the Alert intent.
|
|
64
65
|
*/
|
|
65
66
|
svg?: ReactNode;
|
|
66
|
-
};
|
|
67
|
+
} & WithDataSlot;
|
|
67
68
|
/**
|
|
68
69
|
* An optional icon that visually represents the intent of the `Alert`.
|
|
69
70
|
*
|
|
@@ -86,7 +87,7 @@ type AlertIconProps = Omit<SvgAttributes, "children"> & {
|
|
|
86
87
|
* </Alert.Root>
|
|
87
88
|
* ```
|
|
88
89
|
*/
|
|
89
|
-
declare const Icon: ({ className, ref, svg, ...props }: AlertIconProps) => import("react").JSX.Element;
|
|
90
|
+
declare const Icon: ({ "data-slot": dataSlot, className, ref, svg, ...props }: AlertIconProps) => import("react").JSX.Element;
|
|
90
91
|
/**
|
|
91
92
|
* The container for the content slot of an alert. Place the title, description,
|
|
92
93
|
* and trailing controls as direct children.
|
|
@@ -108,8 +109,8 @@ declare const Icon: ({ className, ref, svg, ...props }: AlertIconProps) => impor
|
|
|
108
109
|
* </Alert.Root>
|
|
109
110
|
*```
|
|
110
111
|
*/
|
|
111
|
-
declare const Content: ({ className, ref, ...props }: ComponentProps<"div">) => import("react").JSX.Element;
|
|
112
|
-
type AlertTitleProps = ComponentProps<"h5"> & WithAsChild;
|
|
112
|
+
declare const Content: ({ "data-slot": dataSlot, className, ref, ...props }: ComponentProps<"div"> & WithDataSlot) => import("react").JSX.Element;
|
|
113
|
+
type AlertTitleProps = ComponentProps<"h5"> & WithAsChild & WithDataSlot;
|
|
113
114
|
/**
|
|
114
115
|
* The title of an alert. Default renders as an h5 element, use asChild to render something else.
|
|
115
116
|
*
|
|
@@ -130,8 +131,8 @@ type AlertTitleProps = ComponentProps<"h5"> & WithAsChild;
|
|
|
130
131
|
* </Alert.Root>
|
|
131
132
|
*```
|
|
132
133
|
*/
|
|
133
|
-
declare const Title: ({ asChild, className, ref, ...props }: AlertTitleProps) => import("react").JSX.Element;
|
|
134
|
-
type AlertDescriptionProps = ComponentProps<"div"> & WithAsChild;
|
|
134
|
+
declare const Title: ({ "data-slot": dataSlot, asChild, className, ref, ...props }: AlertTitleProps) => import("react").JSX.Element;
|
|
135
|
+
type AlertDescriptionProps = ComponentProps<"div"> & WithAsChild & WithDataSlot;
|
|
135
136
|
/**
|
|
136
137
|
* The optional description of an alert.
|
|
137
138
|
* Renders as a `div` by default, but can be changed to any other element using
|
|
@@ -154,7 +155,7 @@ type AlertDescriptionProps = ComponentProps<"div"> & WithAsChild;
|
|
|
154
155
|
* </Alert.Root>
|
|
155
156
|
* ```
|
|
156
157
|
*/
|
|
157
|
-
declare const Description: ({ asChild, className, ref, ...props }: AlertDescriptionProps) => import("react").JSX.Element;
|
|
158
|
+
declare const Description: ({ "data-slot": dataSlot, asChild, className, ref, ...props }: AlertDescriptionProps) => import("react").JSX.Element;
|
|
158
159
|
type AlertDismissIconButtonProps = Partial<Omit<IconButtonProps, "appearance" | "icon" | "intent">> & {
|
|
159
160
|
/**
|
|
160
161
|
* The visual style of the dismiss button. Optional here —
|
|
@@ -168,7 +169,7 @@ type AlertDismissIconButtonProps = Partial<Omit<IconButtonProps, "appearance" |
|
|
|
168
169
|
* An optional icon to render inside the dismiss button. Defaults to an X icon.
|
|
169
170
|
*/
|
|
170
171
|
icon?: ReactNode;
|
|
171
|
-
};
|
|
172
|
+
} & WithDataSlot;
|
|
172
173
|
/**
|
|
173
174
|
* A compact, trailing control for dismissing an alert.
|
|
174
175
|
*
|
|
@@ -196,13 +197,13 @@ type AlertDismissIconButtonProps = Partial<Omit<IconButtonProps, "appearance" |
|
|
|
196
197
|
* </Alert.Root>
|
|
197
198
|
* ```
|
|
198
199
|
*/
|
|
199
|
-
declare const DismissIconButton: ({ size, type, label, appearance, className, icon, ref, ...props }: AlertDismissIconButtonProps) => import("react").JSX.Element;
|
|
200
|
+
declare const DismissIconButton: ({ "data-slot": dataSlot, size, type, label, appearance, className, icon, ref, ...props }: AlertDismissIconButtonProps) => import("react").JSX.Element;
|
|
200
201
|
type AlertExpandButtonProps = Omit<ButtonProps, "appearance" | "asChild" | "children" | "icon" | "iconPlacement" | "intent" | "size"> & {
|
|
201
202
|
/** The number of alerts hidden by a collapsed alert center. */
|
|
202
203
|
count: number;
|
|
203
204
|
/** Whether the alerts controlled by this button are currently visible. */
|
|
204
205
|
expanded: boolean;
|
|
205
|
-
};
|
|
206
|
+
} & WithDataSlot;
|
|
206
207
|
/**
|
|
207
208
|
* A compact, trailing control for expanding or collapsing related alerts.
|
|
208
209
|
*
|
|
@@ -226,7 +227,7 @@ type AlertExpandButtonProps = Omit<ButtonProps, "appearance" | "asChild" | "chil
|
|
|
226
227
|
* </Alert.Root>
|
|
227
228
|
* ```
|
|
228
229
|
*/
|
|
229
|
-
declare const ExpandButton: ({ count, expanded, className, ...props }: AlertExpandButtonProps) => import("react").JSX.Element;
|
|
230
|
+
declare const ExpandButton: ({ "data-slot": dataSlot, count, expanded, className, ...props }: AlertExpandButtonProps) => import("react").JSX.Element;
|
|
230
231
|
/**
|
|
231
232
|
* Displays a callout for user attention.
|
|
232
233
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./use-isomorphic-layout-effect-DdTRtMY-.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{t as i}from"./icon-BudQMD2S.js";import{t as a}from"./slot-DdYN1L1C.js";import{t as o}from"./css-properties-D85fCNV3.js";import{t as s}from"./button-b2HKEIE2.js";import{t as c}from"./button-BMfUxs_j.js";import{n as l,t as u}from"./alert-vfeV_hso.js";import{c as d}from"react/compiler-runtime";import{CaretDownIcon as f}from"@phosphor-icons/react/CaretDown";import{createContext as p,useContext as m,useEffect as h,useRef as g}from"react";import _ from"tiny-invariant";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{CheckCircleIcon as b}from"@phosphor-icons/react/CheckCircle";import{InfoIcon as x}from"@phosphor-icons/react/Info";import{MegaphoneIcon as S}from"@phosphor-icons/react/Megaphone";import{WarningIcon as C}from"@phosphor-icons/react/Warning";import{WarningDiamondIcon as w}from"@phosphor-icons/react/WarningDiamond";import{XIcon as T}from"@phosphor-icons/react/X";import{cva as E}from"class-variance-authority";const D=p(null),O=/* @__PURE__ */ v(T,{});function k(){let e=m(D);return _(e,`useAlertContext hook used outside of Alert parent!`),e}const A=e=>{let t=d(6),{children:n,intent:r,redirectDismissFocus:i}=e,a=i===void 0||i,o;t[0]!==r||t[1]!==a?(o={intent:r,redirectDismissFocus:a},t[0]=r,t[1]=a,t[2]=o):o=t[2];let s=o,c;return t[3]!==n||t[4]!==s?(c=/* @__PURE__ */ v(D.Provider,{value:s,children:n}),t[3]=n,t[4]=s,t[5]=c):c=t[5],c},j=E(`relative flex w-full gap-1.5 rounded-md border p-2.5 text-sm font-sans`,{variants:{intent:{danger:`border-danger-500/50 bg-danger-500/10 text-danger-700 [&_code]:bg-danger-500/10 [&_code]:border-danger-500/20 [&_code]:text-danger-900 [&_a:not([data-slot~=button])]:text-danger-700 [&_a:not([data-slot~=button])]:underline`,important:`border-important-500/50 bg-important-500/10 text-important-700 [&_code]:bg-important-500/10 [&_code]:border-important-500/20 [&_code]:text-important-900 [&_a:not([data-slot~=button])]:text-important-700 [&_a:not([data-slot~=button])]:underline`,info:`border-info-500/50 bg-info-500/10 text-info-700 [&_code]:bg-info-500/10 [&_code]:border-info-500/20 [&_code]:text-info-900 [&_a:not([data-slot~=button])]:text-info-700 [&_a:not([data-slot~=button])]:underline`,success:`border-success-500/50 bg-success-500/10 text-success-700 [&_code]:bg-success-500/10 [&_code]:border-success-500/20 [&_code]:text-success-900 [&_a:not([data-slot~=button])]:text-success-700 [&_a:not([data-slot~=button])]:underline`,warning:`border-warning-500/50 bg-warning-500/10 text-warning-700 [&_code]:bg-warning-500/10 [&_code]:border-warning-500/20 [&_code]:text-warning-900 [&_a:not([data-slot~=button])]:text-warning-700 [&_a:not([data-slot~=button])]:underline`},appearance:{banner:`border-x-0 border-t-0 rounded-none z-50 sticky`,default:``}}}),M=e=>{let t=d(26),i,a,s,c,l,u,f;t[0]===e?(i=t[1],a=t[2],s=t[3],c=t[4],l=t[5],u=t[6],f=t[7]):({"data-slot":a,appearance:f,className:i,intent:s,ref:l,style:u,...c}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=s,t[4]=c,t[5]=l,t[6]=u,t[7]=f);let p=f===void 0?`default`:f,m;t[8]===a?m=t[9]:(m=r(a,`alert`),t[8]=a,t[9]=m);let h;t[10]!==p||t[11]!==i||t[12]!==s?(h=n(j({appearance:p,intent:s}),`has-data-alert-dismiss:pr-10`,`has-data-alert-expand:[&_[data-slot~=alert-dismiss-icon-button]]:right-16`,`md:has-data-alert-expand:[&_[data-slot~=alert-dismiss-icon-button]]:right-24`,`has-data-alert-expand:[&_[data-slot~=alert-content]]:pr-12`,`md:has-data-alert-expand:[&_[data-slot~=alert-content]]:pr-[5.5rem]`,i),t[10]=p,t[11]=i,t[12]=s,t[13]=h):h=t[13];let g;t[14]!==s||t[15]!==u?(g=o({"--alert-control-color":R(s),"--alert-control-hover-color":z(s),"--alert-control-hover-bg":B(s),...u}),t[14]=s,t[15]=u,t[16]=g):g=t[16];let _;t[17]!==c||t[18]!==l||t[19]!==m||t[20]!==h||t[21]!==g?(_=/* @__PURE__ */ v(`div`,{ref:l,"data-slot":m,className:h,style:g,...c}),t[17]=c,t[18]=l,t[19]=m,t[20]=h,t[21]=g,t[22]=_):_=t[22];let y;return t[23]!==s||t[24]!==_?(y=/* @__PURE__ */ v(A,{intent:s,children:_}),t[23]=s,t[24]=_,t[25]=y):y=t[25],y},N={danger:/* @__PURE__ */ v(C,{}),important:/* @__PURE__ */ v(S,{mirrored:!0}),info:/* @__PURE__ */ v(x,{}),success:/* @__PURE__ */ v(b,{}),warning:/* @__PURE__ */ v(w,{})},P=e=>{let t=d(16),a,o,s,c,l;t[0]===e?(a=t[1],o=t[2],s=t[3],c=t[4],l=t[5]):({"data-slot":o,className:a,ref:c,svg:l,...s}=e,t[0]=e,t[1]=a,t[2]=o,t[3]=s,t[4]=c,t[5]=l);let u=k(),f=N[u.intent],p;t[6]===o?p=t[7]:(p=r(o,`alert-icon`),t[6]=o,t[7]=p);let m;t[8]===a?m=t[9]:(m=n(`size-5`,a),t[8]=a,t[9]=m);let h=l??f,g;return t[10]!==s||t[11]!==c||t[12]!==p||t[13]!==m||t[14]!==h?(g=/* @__PURE__ */ v(i,{ref:c,"data-slot":p,className:m,svg:h,...s}),t[10]=s,t[11]=c,t[12]=p,t[13]=m,t[14]=h,t[15]=g):g=t[15],g},F=e=>{let t=d(14),i,a,o,s;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4]):({"data-slot":a,className:i,ref:s,...o}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s);let c;t[5]===a?c=t[6]:(c=r(a,`alert-content`),t[5]=a,t[6]=c);let l;t[7]===i?l=t[8]:(l=n(`min-w-0 flex-1 has-data-alert-dismiss:pr-6`,i),t[7]=i,t[8]=l);let u;return t[9]!==o||t[10]!==s||t[11]!==c||t[12]!==l?(u=/* @__PURE__ */ v(`div`,{ref:s,"data-slot":c,className:l,...o}),t[9]=o,t[10]=s,t[11]=c,t[12]=l,t[13]=u):u=t[13],u},I=e=>{let t=d(16),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":o,asChild:l,className:i,ref:c,...s}=e,t[0]=e,t[1]=i,t[2]=o,t[3]=s,t[4]=c,t[5]=l);let u=l!==void 0&&l?a:`h5`,f;t[6]===o?f=t[7]:(f=r(o,`alert-title`),t[6]=o,t[7]=f);let p;t[8]===i?p=t[9]:(p=n(`font-medium`,i),t[8]=i,t[9]=p);let m;return t[10]!==u||t[11]!==s||t[12]!==c||t[13]!==f||t[14]!==p?(m=/* @__PURE__ */ v(u,{ref:c,"data-slot":f,className:p,...s}),t[10]=u,t[11]=s,t[12]=c,t[13]=f,t[14]=p,t[15]=m):m=t[15],m},L=e=>{let t=d(16),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":o,asChild:l,className:i,ref:c,...s}=e,t[0]=e,t[1]=i,t[2]=o,t[3]=s,t[4]=c,t[5]=l);let u=l!==void 0&&l?a:`div`,f;t[6]===o?f=t[7]:(f=r(o,`alert-description`),t[6]=o,t[7]=f);let p;t[8]===i?p=t[9]:(p=n(`text-sm`,i),t[8]=i,t[9]=p);let m;return t[10]!==u||t[11]!==s||t[12]!==c||t[13]!==f||t[14]!==p?(m=/* @__PURE__ */ v(u,{ref:c,"data-slot":f,className:p,...s}),t[10]=u,t[11]=s,t[12]=c,t[13]=f,t[14]=p,t[15]=m):m=t[15],m},R=e=>`var(--color-${e}-700)`,z=e=>`var(--color-${e}-800)`,B=e=>`color-mix(in oklab, var(--color-${e}-500) 10%, transparent)`;function V(t){let n=d(8),{buttonRef:r,enabled:i}=t,a;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],n[0]=a):a=n[0];let o=g(a),s,c;n[1]!==r||n[2]!==i?(s=()=>{if(i)return()=>{let e=r.current;if(e==null||document.activeElement!==e)return;let t=e.closest(`[data-slot~="alert"]`)??e;o.current=u(t)}},c=[r,i],n[1]=r,n[2]=i,n[3]=s,n[4]=c):(s=n[3],c=n[4]),e(s,c);let f,p;n[5]===i?(f=n[6],p=n[7]):(f=()=>{if(i)return()=>{let e=o.current;if(o.current=[],e.length===0)return;let{activeElement:t}=document;if(t==null||t===document.body){for(let t of e)if(t.isConnected&&l(t)&&(t.focus(),document.activeElement===t))return}}},p=[i],n[5]=i,n[6]=f,n[7]=p),h(f,p)}const H={Root:M,Content:F,ExpandButton:e=>{let t=d(25),i,a,o,c,l;t[0]===e?(i=t[1],a=t[2],o=t[3],c=t[4],l=t[5]):({"data-slot":o,count:a,expanded:c,className:i,...l}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=c,t[5]=l);let u=c?`Collapse additional alerts`:`Show ${a} more ${a===1?`alert`:`alerts`}`,p;t[6]===o?p=t[7]:(p=r(o,`alert-expand-button`),t[6]=o,t[7]=p);let m=c&&`-rotate-180`,h;t[8]===m?h=t[9]:(h=n(`size-4 transition-transform ease-out duration-150`,m),t[8]=m,t[9]=h);let g;t[10]===h?g=t[11]:(g=/* @__PURE__ */ v(f,{weight:`bold`,className:h}),t[10]=h,t[11]=g);let _;t[12]===i?_=t[13]:(_=n(`right-1.5 top-1.5 absolute gap-1 ps-1.5 pe-1`,`text-[var(--alert-control-color,currentColor)]`,`not-disabled:hover:bg-[var(--alert-control-hover-bg,transparent)] not-disabled:hover:text-[var(--alert-control-hover-color,currentColor)]`,i),t[12]=i,t[13]=_);let b;t[14]===a?b=t[15]:(b=/* @__PURE__ */ y(`span`,{className:`min-w-[2ch] text-center tabular-nums`,children:[`+`,a]}),t[14]=a,t[15]=b);let x;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(x=/* @__PURE__ */ v(`span`,{className:`hidden md:inline`,children:`more`}),t[16]=x):x=t[16];let S;return t[17]!==c||t[18]!==l||t[19]!==u||t[20]!==p||t[21]!==g||t[22]!==_||t[23]!==b?(S=/* @__PURE__ */ y(s,{type:`button`,appearance:`ghost`,intent:`neutral`,size:`sm`,"aria-expanded":c,"aria-label":u,"data-slot":p,"data-alert-expand":!0,icon:g,iconPlacement:`end`,className:_,...l,children:[b,x]}),t[17]=c,t[18]=l,t[19]=u,t[20]=p,t[21]=g,t[22]=_,t[23]=b,t[24]=S):S=t[24],S},Description:L,DismissIconButton:e=>{let i=d(26),a,o,s,l,u,f,p,h,_;i[0]===e?(a=i[1],o=i[2],s=i[3],l=i[4],u=i[5],f=i[6],p=i[7],h=i[8],_=i[9]):({"data-slot":o,size:u,type:f,label:p,appearance:h,className:a,icon:_,ref:l,...s}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=l,i[5]=u,i[6]=f,i[7]=p,i[8]=h,i[9]=_);let y=u===void 0?`sm`:u,b=f===void 0?`button`:f,x=p===void 0?`Dismiss Alert`:p,S=h===void 0?`ghost`:h,C=_===void 0?O:_,w=m(D),T=g(null),E=t(T,l),k=w?.redirectDismissFocus??!0,A;i[10]===k?A=i[11]:(A={buttonRef:T,enabled:k},i[10]=k,i[11]=A),V(A);let j;i[12]===o?j=i[13]:(j=r(o,`alert-dismiss-icon-button`),i[12]=o,i[13]=j);let M;i[14]===a?M=i[15]:(M=n(`right-1.5 top-1.5 absolute`,`text-[var(--alert-control-color,currentColor)]`,`not-disabled:hover:bg-[var(--alert-control-hover-bg,transparent)] not-disabled:hover:text-[var(--alert-control-hover-color,currentColor)]`,a),i[14]=a,i[15]=M);let N;return i[16]!==S||i[17]!==E||i[18]!==C||i[19]!==x||i[20]!==s||i[21]!==y||i[22]!==j||i[23]!==M||i[24]!==b?(N=/* @__PURE__ */ v(c,{ref:E,appearance:S,icon:C,intent:`neutral`,label:x,size:y,"data-slot":j,"data-alert-dismiss":!0,className:M,type:b,...s}),i[16]=S,i[17]=E,i[18]=C,i[19]=x,i[20]=s,i[21]=y,i[22]=j,i[23]=M,i[24]=b,i[25]=N):N=i[25],N},Icon:P,Title:I};export{A as n,H as t};
|
package/dist/alert-center.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as WithDataSlot } from "./data-slot-CChfb_cv.js";
|
|
2
|
-
import { t as Alert } from "./alert-
|
|
2
|
+
import { t as Alert } from "./alert-BzPDUaU7.js";
|
|
3
3
|
import { ComponentProps, ReactNode } from "react";
|
|
4
4
|
//#region src/components/alert-center/alert-center.d.ts
|
|
5
5
|
/**
|
|
@@ -225,7 +225,7 @@ type AlertCenterDismissIconButtonProps = ComponentProps<typeof Alert.DismissIcon
|
|
|
225
225
|
*
|
|
226
226
|
* | Data Attribute | Value | Description |
|
|
227
227
|
* | --- | --- | --- |
|
|
228
|
-
* | `data-slot` | `alert-center-dismiss-icon-button` |
|
|
228
|
+
* | `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. |
|
|
229
229
|
* | `data-alert-dismiss` | present | Read, not stamped — `Alert` emits it, and `AlertCenter`'s bar CSS positions the control with it. |
|
|
230
230
|
*
|
|
231
231
|
* @see https://mantle.ngrok.com/components/feedback/alert-center#alertcenterdismissiconbutton
|
|
@@ -274,7 +274,7 @@ type AlertCenterBarProps = Omit<ComponentProps<typeof Alert.Root>, "appearance"
|
|
|
274
274
|
* | Data Attribute | Value | Description |
|
|
275
275
|
* | --- | --- | --- |
|
|
276
276
|
* | `data-slot` | `alert-center-bar-wrapper` | On the presence wrapper that owns the enter/exit animation. |
|
|
277
|
-
* | `data-slot` | `alert-center-bar` | On the banner chrome
|
|
277
|
+
* | `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. |
|
|
278
278
|
* | `data-slot` | `alert-center-bar-mount` | On the layout-transparent element the top item's host is adopted into. |
|
|
279
279
|
* | `data-state` | `"open"` \| `"closed"` | On the wrapper; drives the enter/exit transition, and stays `closed` while the exit plays. |
|
|
280
280
|
* | `data-placement` | `"bar"` | On the chrome — where the top item's children are currently rendering. |
|
|
@@ -338,7 +338,7 @@ type AlertCenterContentProps = Omit<ComponentProps<"div">, "children" | "id"> &
|
|
|
338
338
|
* | Data Attribute | Value | Description |
|
|
339
339
|
* | --- | --- | --- |
|
|
340
340
|
* | `data-slot` | `alert-center-content` | On the expansion wrapper that owns the collapse animation. |
|
|
341
|
-
* | `data-slot` | `alert-center-item` | On each row's banner chrome
|
|
341
|
+
* | `data-slot` | `alert-center-item alert` | On each row's banner chrome, joined ahead of `Alert.Root`'s own slot. |
|
|
342
342
|
* | `data-state` | `"open"` \| `"closed"` | On the wrapper; drives the collapse transition. |
|
|
343
343
|
* | `data-placement` | `"list"` | On each row's chrome — where that item's children are currently rendering. |
|
|
344
344
|
* | `data-alert-id` | the row item's `id` | On each row's chrome; per-alert styling and testing hook. |
|
|
@@ -511,7 +511,7 @@ declare const AlertCenter: {
|
|
|
511
511
|
* | Data Attribute | Value | Description |
|
|
512
512
|
* | --- | --- | --- |
|
|
513
513
|
* | `data-slot` | `alert-center-bar-wrapper` | On the presence wrapper that owns the enter/exit animation. |
|
|
514
|
-
* | `data-slot` | `alert-center-bar` | On the banner chrome
|
|
514
|
+
* | `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. |
|
|
515
515
|
* | `data-slot` | `alert-center-bar-mount` | On the layout-transparent element the top item's host is adopted into. |
|
|
516
516
|
* | `data-state` | `"open"` \| `"closed"` | On the wrapper; drives the enter/exit transition, and stays `closed` while the exit plays. |
|
|
517
517
|
* | `data-placement` | `"bar"` | On the chrome — where the top item's children are currently rendering. |
|
|
@@ -564,7 +564,7 @@ declare const AlertCenter: {
|
|
|
564
564
|
* | Data Attribute | Value | Description |
|
|
565
565
|
* | --- | --- | --- |
|
|
566
566
|
* | `data-slot` | `alert-center-content` | On the expansion wrapper that owns the collapse animation. |
|
|
567
|
-
* | `data-slot` | `alert-center-item` | On each row's banner chrome
|
|
567
|
+
* | `data-slot` | `alert-center-item alert` | On each row's banner chrome, joined ahead of `Alert.Root`'s own slot. |
|
|
568
568
|
* | `data-state` | `"open"` \| `"closed"` | On the wrapper; drives the collapse transition. |
|
|
569
569
|
* | `data-placement` | `"list"` | On each row's chrome — where that item's children are currently rendering. |
|
|
570
570
|
* | `data-alert-id` | the row item's `id` | On each row's chrome; per-alert styling and testing hook. |
|
|
@@ -643,7 +643,7 @@ declare const AlertCenter: {
|
|
|
643
643
|
*
|
|
644
644
|
* | Data Attribute | Value | Description |
|
|
645
645
|
* | --- | --- | --- |
|
|
646
|
-
* | `data-slot` | `alert-center-dismiss-icon-button` |
|
|
646
|
+
* | `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. |
|
|
647
647
|
* | `data-alert-dismiss` | present | Read, not stamped — `Alert` emits it, and `AlertCenter`'s bar CSS positions the control with it. |
|
|
648
648
|
*
|
|
649
649
|
* @see https://mantle.ngrok.com/components/feedback/alert-center#alertcenterdismissiconbutton
|
package/dist/alert-center.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./use-isomorphic-layout-effect-DdTRtMY-.js";import{n as t}from"./compose-refs-sFdxsL7k.js";import{t as n}from"./cx-0HCjnNv1.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{n as i,t as a}from"./alert-OP_-aGJD.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=new Set;#t=new Map;#n=new Map;#r=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=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=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=g(M,{store:s}),t[12]=s,t[13]=C);let w;return t[14]!==y||t[15]!==S||t[16]!==C?(w=_(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=g(j.Provider,{value:!0,children: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=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=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;if(a==null){z();return}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`,`has-data-alert-expand:[&_[data-alert-dismiss]]:right-16 md:has-data-alert-expand:[&_[data-alert-dismiss]]:right-24`,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=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&&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?($=_(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=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]`);if(n!=null){n.focus();return}z()},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=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=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 g(`li`,{children: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:g(`div`,{className:`contents`,"data-alert-mount":e.id})})},e.id)}export{H as AlertCenter};
|
|
1
|
+
import{t as e}from"./use-isomorphic-layout-effect-DdTRtMY-.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-CZYYlx9q.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`,`has-data-alert-expand:[&_[data-alert-dismiss]]:right-16 md:has-data-alert-expand:[&_[data-alert-dismiss]]:right-24`,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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { n as WithAsChild } from "./as-child-D23mGo4f.js";
|
|
2
|
+
import { t as WithDataSlot } from "./data-slot-CChfb_cv.js";
|
|
2
3
|
import { t as SvgAttributes } from "./icon-D1RY5Tcj.js";
|
|
3
|
-
import { i as ButtonIntent, n as ButtonAppearance, r as ButtonProps } from "./button-
|
|
4
|
+
import { i as ButtonIntent, n as ButtonAppearance, r as ButtonProps } from "./button-mzUR1U0Y.js";
|
|
4
5
|
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-CZYD3xL-.js";
|
|
5
6
|
import { ComponentProps, ReactNode } from "react";
|
|
6
7
|
//#region src/components/alert-dialog/alert-dialog.d.ts
|
|
@@ -93,7 +94,7 @@ declare function Root({ intent, ...props }: AlertDialogProps): import("react").J
|
|
|
93
94
|
* </AlertDialog.Root>
|
|
94
95
|
* ```
|
|
95
96
|
*/
|
|
96
|
-
declare const Trigger: ({ ref, ...props }: ComponentProps<typeof Trigger$1>) => import("react").JSX.Element;
|
|
97
|
+
declare const Trigger: ({ "data-slot": dataSlot, ref, ...props }: ComponentProps<typeof Trigger$1> & WithDataSlot) => import("react").JSX.Element;
|
|
97
98
|
type AlertDialogContentProps = ComponentProps<typeof Content$1> & {
|
|
98
99
|
/**
|
|
99
100
|
* The preferred width of the `AlertDialogContent` as a tailwind `max-w-` class.
|
|
@@ -104,7 +105,7 @@ type AlertDialogContentProps = ComponentProps<typeof Content$1> & {
|
|
|
104
105
|
* @default `max-w-md`
|
|
105
106
|
*/
|
|
106
107
|
preferredWidth?: `max-w-${string}`;
|
|
107
|
-
};
|
|
108
|
+
} & WithDataSlot;
|
|
108
109
|
/**
|
|
109
110
|
* The popover alert dialog container.
|
|
110
111
|
*
|
|
@@ -151,7 +152,7 @@ type AlertDialogContentProps = ComponentProps<typeof Content$1> & {
|
|
|
151
152
|
* </AlertDialog.Root>
|
|
152
153
|
* ```
|
|
153
154
|
*/
|
|
154
|
-
declare const Content: ({ className, onInteractOutside, preferredWidth, ref, ...props }: AlertDialogContentProps) => import("react").JSX.Element;
|
|
155
|
+
declare const Content: ({ "data-slot": dataSlot, className, onInteractOutside, preferredWidth, ref, ...props }: AlertDialogContentProps) => import("react").JSX.Element;
|
|
155
156
|
/**
|
|
156
157
|
* Contains the main content of the alert dialog.
|
|
157
158
|
*
|
|
@@ -187,7 +188,7 @@ declare const Content: ({ className, onInteractOutside, preferredWidth, ref, ...
|
|
|
187
188
|
* </AlertDialog.Root>
|
|
188
189
|
* ```
|
|
189
190
|
*/
|
|
190
|
-
declare const Body: ({ asChild, className, ref, ...props }: ComponentProps<"div"> & WithAsChild) => import("react").JSX.Element;
|
|
191
|
+
declare const Body: ({ "data-slot": dataSlot, asChild, className, ref, ...props }: ComponentProps<"div"> & WithAsChild & WithDataSlot) => import("react").JSX.Element;
|
|
191
192
|
/**
|
|
192
193
|
* Contains the header content of the dialog, including the title and description.
|
|
193
194
|
*
|
|
@@ -223,7 +224,7 @@ declare const Body: ({ asChild, className, ref, ...props }: ComponentProps<"div"
|
|
|
223
224
|
* </AlertDialog.Root>
|
|
224
225
|
* ```
|
|
225
226
|
*/
|
|
226
|
-
declare const Header: ({ asChild, className, ref, ...props }: ComponentProps<"div"> & WithAsChild) => import("react").JSX.Element;
|
|
227
|
+
declare const Header: ({ "data-slot": dataSlot, asChild, className, ref, ...props }: ComponentProps<"div"> & WithAsChild & WithDataSlot) => import("react").JSX.Element;
|
|
227
228
|
/**
|
|
228
229
|
* Contains the footer content of the dialog, including the action and cancel buttons.
|
|
229
230
|
*
|
|
@@ -259,7 +260,7 @@ declare const Header: ({ asChild, className, ref, ...props }: ComponentProps<"di
|
|
|
259
260
|
* </AlertDialog.Root>
|
|
260
261
|
* ```
|
|
261
262
|
*/
|
|
262
|
-
declare const Footer: ({ asChild, className, ref, ...props }: ComponentProps<"div"> & WithAsChild) => import("react").JSX.Element;
|
|
263
|
+
declare const Footer: ({ "data-slot": dataSlot, asChild, className, ref, ...props }: ComponentProps<"div"> & WithAsChild & WithDataSlot) => import("react").JSX.Element;
|
|
263
264
|
/**
|
|
264
265
|
* An accessible name to be announced when the dialog is opened.
|
|
265
266
|
*
|
|
@@ -298,7 +299,7 @@ declare const Footer: ({ asChild, className, ref, ...props }: ComponentProps<"di
|
|
|
298
299
|
* </AlertDialog.Root>
|
|
299
300
|
* ```
|
|
300
301
|
*/
|
|
301
|
-
declare const Title: ({ className, ref, ...props }: ComponentProps<typeof Title$1>) => import("react").JSX.Element;
|
|
302
|
+
declare const Title: ({ "data-slot": dataSlot, className, ref, ...props }: ComponentProps<typeof Title$1> & WithDataSlot) => import("react").JSX.Element;
|
|
302
303
|
/**
|
|
303
304
|
* An accessible description to be announced when the dialog is opened.
|
|
304
305
|
* Renders as a `div` by default, but can be changed to any other element using
|
|
@@ -339,7 +340,7 @@ declare const Title: ({ className, ref, ...props }: ComponentProps<typeof Title$
|
|
|
339
340
|
* </AlertDialog.Root>
|
|
340
341
|
* ```
|
|
341
342
|
*/
|
|
342
|
-
declare const Description: ({ className, ref, ...props }: ComponentProps<typeof Description$1>) => import("react").JSX.Element;
|
|
343
|
+
declare const Description: ({ "data-slot": dataSlot, className, ref, ...props }: ComponentProps<typeof Description$1> & WithDataSlot) => import("react").JSX.Element;
|
|
343
344
|
type AlertDialogActionProps = Omit<ButtonProps, "appearance" | "intent"> & {
|
|
344
345
|
/**
|
|
345
346
|
* The visual style of the action button. Optional here — `AlertDialog.Action`
|
|
@@ -356,7 +357,7 @@ type AlertDialogActionProps = Omit<ButtonProps, "appearance" | "intent"> & {
|
|
|
356
357
|
* value always wins over the context-derived tone.
|
|
357
358
|
*/
|
|
358
359
|
intent?: ButtonIntent;
|
|
359
|
-
};
|
|
360
|
+
} & WithDataSlot;
|
|
360
361
|
/**
|
|
361
362
|
* A button that confirms the Alert Dialog action.
|
|
362
363
|
* Defaults to `appearance="filled"`, with a tone derived from the parent
|
|
@@ -400,7 +401,7 @@ type AlertDialogActionProps = Omit<ButtonProps, "appearance" | "intent"> & {
|
|
|
400
401
|
* </AlertDialog.Root>
|
|
401
402
|
* ```
|
|
402
403
|
*/
|
|
403
|
-
declare const Action: ({ appearance, intent, ref, ...props }: AlertDialogActionProps) => import("react").JSX.Element;
|
|
404
|
+
declare const Action: ({ "data-slot": dataSlot, appearance, intent, ref, ...props }: AlertDialogActionProps) => import("react").JSX.Element;
|
|
404
405
|
type AlertDialogCancelProps = Omit<ButtonProps, "appearance" | "intent"> & {
|
|
405
406
|
/**
|
|
406
407
|
* The visual style of the cancel button. Optional here — `AlertDialog.Cancel`
|
|
@@ -417,7 +418,7 @@ type AlertDialogCancelProps = Omit<ButtonProps, "appearance" | "intent"> & {
|
|
|
417
418
|
* @default "neutral"
|
|
418
419
|
*/
|
|
419
420
|
intent?: ButtonIntent;
|
|
420
|
-
};
|
|
421
|
+
} & WithDataSlot;
|
|
421
422
|
/**
|
|
422
423
|
* A button that closes the dialog and cancels the action.
|
|
423
424
|
* Defaults to `appearance="outlined"` and `intent="neutral"`.
|
|
@@ -458,10 +459,10 @@ type AlertDialogCancelProps = Omit<ButtonProps, "appearance" | "intent"> & {
|
|
|
458
459
|
* </AlertDialog.Root>
|
|
459
460
|
* ```
|
|
460
461
|
*/
|
|
461
|
-
declare const Cancel: ({ appearance, className, intent, ref, ...props }: AlertDialogCancelProps) => import("react").JSX.Element;
|
|
462
|
+
declare const Cancel: ({ "data-slot": dataSlot, appearance, className, intent, ref, ...props }: AlertDialogCancelProps) => import("react").JSX.Element;
|
|
462
463
|
type AlertDialogIconProps = Omit<SvgAttributes, "children"> & {
|
|
463
464
|
svg?: ReactNode;
|
|
464
|
-
};
|
|
465
|
+
} & WithDataSlot;
|
|
465
466
|
/**
|
|
466
467
|
* An icon that visually represents the intent of the AlertDialog.
|
|
467
468
|
*
|
|
@@ -502,7 +503,7 @@ type AlertDialogIconProps = Omit<SvgAttributes, "children"> & {
|
|
|
502
503
|
* </AlertDialog.Root>
|
|
503
504
|
* ```
|
|
504
505
|
*/
|
|
505
|
-
declare const Icon: ({ className, ref, svg, ...props }: AlertDialogIconProps) => import("react").JSX.Element;
|
|
506
|
+
declare const Icon: ({ "data-slot": dataSlot, className, ref, svg, ...props }: AlertDialogIconProps) => import("react").JSX.Element;
|
|
506
507
|
/**
|
|
507
508
|
* A button that closes the Alert Dialog. (Unstyled)
|
|
508
509
|
*
|
|
@@ -545,7 +546,7 @@ declare const Icon: ({ className, ref, svg, ...props }: AlertDialogIconProps) =>
|
|
|
545
546
|
* </AlertDialog.Root>
|
|
546
547
|
* ```
|
|
547
548
|
*/
|
|
548
|
-
declare const Close: ({ ref, ...props }: ComponentProps<typeof Close$1>) => import("react").JSX.Element;
|
|
549
|
+
declare const Close: ({ "data-slot": dataSlot, ref, ...props }: ComponentProps<typeof Close$1> & WithDataSlot) => import("react").JSX.Element;
|
|
549
550
|
/**
|
|
550
551
|
* A modal dialog that interrupts the user with important content and expects a
|
|
551
552
|
* response. Use AlertDialog for destructive or irreversible confirmations
|