@ngrok/mantle 0.82.0 → 0.82.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.
Files changed (86) hide show
  1. package/dist/accordion.js +1 -1
  2. package/dist/agent.json +1 -1
  3. package/dist/alert-center.d.ts +217 -19
  4. package/dist/alert-center.js +1 -1
  5. package/dist/alert-dialog.js +1 -1
  6. package/dist/{alert-QMs0PqMq.js → alert-vwFd7qdp.js} +1 -1
  7. package/dist/alert.js +1 -1
  8. package/dist/{anchor-DvbNsphX.js → anchor-3OGK2UKU.js} +1 -1
  9. package/dist/anchor.js +1 -1
  10. package/dist/app-layout.d.ts +296 -213
  11. package/dist/app-layout.js +1 -1
  12. package/dist/area-chart.js +1 -1
  13. package/dist/badge.js +1 -1
  14. package/dist/bar-chart.js +1 -1
  15. package/dist/breadcrumb.js +1 -1
  16. package/dist/{button-BUospUB3.js → button-Cnja9Bsr.js} +1 -1
  17. package/dist/{button-BO2CKsz6.js → button-DmJkYfyl.js} +1 -1
  18. package/dist/{button-C0S8RbaJ.js → button-IlxHhjPK.js} +1 -1
  19. package/dist/button.js +1 -1
  20. package/dist/card.js +1 -1
  21. package/dist/centered-layout.js +1 -1
  22. package/dist/{chart-DdBQ3xwx.js → chart-B3pAvmkk.js} +1 -1
  23. package/dist/{choice-C9gLKECf.js → choice-CnwfjSEu.js} +1 -1
  24. package/dist/choice.js +1 -1
  25. package/dist/code-block.js +1 -1
  26. package/dist/code.js +1 -1
  27. package/dist/combobox.js +1 -1
  28. package/dist/command.js +1 -1
  29. package/dist/cookie-ca4g5CKp.js +1 -0
  30. package/dist/data-table.js +1 -1
  31. package/dist/description-list.js +1 -1
  32. package/dist/{dialog-Bsj_dX6r.js → dialog-DozL6n-F.js} +1 -1
  33. package/dist/dialog.js +1 -1
  34. package/dist/{dropdown-menu-fUMqjRC0.js → dropdown-menu-BRH0Wd_z.js} +1 -1
  35. package/dist/dropdown-menu.js +1 -1
  36. package/dist/empty.js +1 -1
  37. package/dist/field.d.ts +1 -1
  38. package/dist/field.js +1 -1
  39. package/dist/{icons-CPbOq7cF.js → icons-Bb_zF2OV.js} +1 -1
  40. package/dist/icons.js +1 -1
  41. package/dist/line-chart.js +1 -1
  42. package/dist/{list-CQFWx6Z8.js → list-CJABVHwi.js} +1 -1
  43. package/dist/list.js +1 -1
  44. package/dist/llms.txt +1 -1
  45. package/dist/main.d.ts +32 -1
  46. package/dist/media-object.js +1 -1
  47. package/dist/multi-select.js +1 -1
  48. package/dist/otp-input.js +1 -1
  49. package/dist/pagination.js +1 -1
  50. package/dist/platform-BVD3gpKD.js +1 -0
  51. package/dist/{primitive-Dv-3snU3.js → primitive-D-9GIFWb.js} +1 -1
  52. package/dist/qr-code.js +1 -1
  53. package/dist/radio-group.js +1 -1
  54. package/dist/sandboxed-on-click.js +1 -1
  55. package/dist/scatter-plot.js +1 -1
  56. package/dist/{select-B-9yWrif.js → select-BReznXaw.js} +1 -1
  57. package/dist/select.js +1 -1
  58. package/dist/selectable-list.js +1 -1
  59. package/dist/{separator-BepAcFFy.js → separator-D0D6VyyM.js} +1 -1
  60. package/dist/separator.js +1 -1
  61. package/dist/{sheet-_fXLjiq2.js → sheet-BxvTfPLM.js} +1 -1
  62. package/dist/sheet.js +1 -1
  63. package/dist/sidebar.d.ts +534 -60
  64. package/dist/sidebar.js +1 -1
  65. package/dist/{skeleton-DsHXIa9j.js → skeleton-BhcJMpem.js} +1 -1
  66. package/dist/skeleton.js +1 -1
  67. package/dist/skip-to-main-link.js +1 -1
  68. package/dist/slot-DdgxmuI5.d.ts +67 -0
  69. package/dist/slot-DpNWVci8.js +1 -0
  70. package/dist/slot.d.ts +1 -1
  71. package/dist/slot.js +1 -1
  72. package/dist/split-button.js +1 -1
  73. package/dist/theme-BorfgnNh.js +1 -0
  74. package/dist/theme-switcher.d.ts +1 -1
  75. package/dist/theme-switcher.js +1 -1
  76. package/dist/theme.js +1 -1
  77. package/dist/toast.js +1 -1
  78. package/dist/tooltip-Dnu35cjU.js +1 -0
  79. package/dist/tooltip-mrpLz4DZ.d.ts +218 -0
  80. package/dist/tooltip.d.ts +1 -217
  81. package/dist/tooltip.js +1 -1
  82. package/dist/well.js +1 -1
  83. package/package.json +1 -1
  84. package/dist/slot-BtwKJTLq.d.ts +0 -25
  85. package/dist/slot-Dpsqz16D.js +0 -1
  86. package/dist/theme-IAnQ35bd.js +0 -1
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-BdBMM9ga.js";import{t as n}from"./cx-IiQEAKf5.js";import{t as r}from"./icon-lZ48P8Nn.js";import{t as i}from"./slot-Dpsqz16D.js";import{CaretDownIcon as a}from"@phosphor-icons/react/CaretDown";import{createContext as o,useCallback as s,useContext as c,useEffect as l,useMemo as u,useRef as d,useState as f}from"react";import p from"tiny-invariant";import{jsx as m}from"react/jsx-runtime";function h(e,t){return e.includes(t)}function g(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 _(e){return e==null?[]:typeof e==`string`?e===``?[]:[e]:e}function v(e,t){e.type===`single`?e.onValueChange?.(t[0]??``):e.onValueChange?.([...t])}function y(){return typeof document<`u`&&document.body!=null&&`onbeforematch`in document.body}const b=o(null);function x(e){let t=c(b);return p(t,`\`${e}\` must be rendered within \`Accordion.Root\`.`),t}const S=o(null);function C(e){let t=c(S);return p(t,`\`${e}\` must be rendered within \`Accordion.Item\`.`),t}const w=e=>{let{type:t=`multiple`,value:r,defaultValue:a,onValueChange:o,asChild:s,children:c,className:l,ref:d,...p}=e,h=r!=null,[y,x]=f(()=>_(a)),S=h?_(r):y,C=u(()=>({type:t,openValues:S,setItemOpen:(n,r)=>{let i=g(S,n,r,t);i!==S&&(h||x(i),v(e,i))}}),[t,S,h,e]),w={...p,"data-slot":`accordion`,className:n(`w-full divide-y divide-separator`,l)};return m(b.Provider,{value:C,children:m(s?i:`div`,{ref:d,...w,children:c})})},T=({children:e,value:t,ref:n,...r})=>{let{openValues:i,setItemOpen:a}=x(`Accordion.Item`),o=h(i,t),c=s(e=>{a(t,e)},[a,t]),l=u(()=>({open:o,setOpen:c}),[o,c]);return m(S.Provider,{value:l,children:m(`div`,{ref:n,...r,role:`group`,"data-slot":`accordion-item`,"data-state":o?`open`:`closed`,children:e})})},E=({className:e,children:t,onClick:r,ref:i,...a})=>{let{open:o,setOpen:s}=C(`Accordion.Trigger`);return m(`button`,{ref:i,type:`button`,...a,"data-slot":`accordion-trigger`,"data-state":o?`open`:`closed`,"aria-expanded":o,className: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`,e),onClick:e=>{r?.(e),s(!o)},children:t})},D=m(a,{weight:`bold`}),O={Root:w,Item:T,Trigger:E,TriggerIcon:({className:e,svg:t=D,...i})=>m(r,{...i,"data-slot":`accordion-trigger-icon`,svg:t,className:n(`size-4 shrink-0 text-muted transition-transform duration-200 group-data-state-open:rotate-180`,e)}),Content:({className:r,children:i,ref:a,...o})=>{let{open:s,setOpen:c}=C(`Accordion.Content`),u=d(null),f=t(u,a);return l(()=>{let e=u.current;if(!e||!y())return;let t=()=>{e.removeAttribute(`hidden`),e.style.height=`auto`,c(!0)};return e.addEventListener(`beforematch`,t),()=>{e.removeEventListener(`beforematch`,t)}},[c]),e(()=>{let e=u.current;e&&(s||!y()?e.removeAttribute(`hidden`):(e.setAttribute(`hidden`,`until-found`),e.style.height=``))},[s]),m(`div`,{ref:f,...o,"data-slot":`accordion-content`,"data-state":s?`open`:`closed`,className: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`,r),children:i})},Body:({className:e,ref:t,...r})=>m(`div`,{ref:t,...r,"data-slot":`accordion-body`,className:n(`pt-2 pb-4`,e)})};export{O as Accordion};
1
+ import{t as e}from"./use-isomorphic-layout-effect-DdTRtMY-.js";import{n as t}from"./compose-refs-BdBMM9ga.js";import{t as n}from"./cx-IiQEAKf5.js";import{t as r}from"./icon-lZ48P8Nn.js";import{t as i}from"./slot-DpNWVci8.js";import{CaretDownIcon as a}from"@phosphor-icons/react/CaretDown";import{createContext as o,useCallback as s,useContext as c,useEffect as l,useMemo as u,useRef as d,useState as f}from"react";import p from"tiny-invariant";import{jsx as m}from"react/jsx-runtime";function h(e,t){return e.includes(t)}function g(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 _(e){return e==null?[]:typeof e==`string`?e===``?[]:[e]:e}function v(e,t){e.type===`single`?e.onValueChange?.(t[0]??``):e.onValueChange?.([...t])}function y(){return typeof document<`u`&&document.body!=null&&`onbeforematch`in document.body}const b=o(null);function x(e){let t=c(b);return p(t,`\`${e}\` must be rendered within \`Accordion.Root\`.`),t}const S=o(null);function C(e){let t=c(S);return p(t,`\`${e}\` must be rendered within \`Accordion.Item\`.`),t}const w=e=>{let{type:t=`multiple`,value:r,defaultValue:a,onValueChange:o,asChild:s,children:c,className:l,ref:d,...p}=e,h=r!=null,[y,x]=f(()=>_(a)),S=h?_(r):y,C=u(()=>({type:t,openValues:S,setItemOpen:(n,r)=>{let i=g(S,n,r,t);i!==S&&(h||x(i),v(e,i))}}),[t,S,h,e]),w={...p,"data-slot":`accordion`,className:n(`w-full divide-y divide-separator`,l)};return m(b.Provider,{value:C,children:m(s?i:`div`,{ref:d,...w,children:c})})},T=({children:e,value:t,ref:n,...r})=>{let{openValues:i,setItemOpen:a}=x(`Accordion.Item`),o=h(i,t),c=s(e=>{a(t,e)},[a,t]),l=u(()=>({open:o,setOpen:c}),[o,c]);return m(S.Provider,{value:l,children:m(`div`,{ref:n,...r,role:`group`,"data-slot":`accordion-item`,"data-state":o?`open`:`closed`,children:e})})},E=({className:e,children:t,onClick:r,ref:i,...a})=>{let{open:o,setOpen:s}=C(`Accordion.Trigger`);return m(`button`,{ref:i,type:`button`,...a,"data-slot":`accordion-trigger`,"data-state":o?`open`:`closed`,"aria-expanded":o,className: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`,e),onClick:e=>{r?.(e),s(!o)},children:t})},D=m(a,{weight:`bold`}),O={Root:w,Item:T,Trigger:E,TriggerIcon:({className:e,svg:t=D,...i})=>m(r,{...i,"data-slot":`accordion-trigger-icon`,svg:t,className:n(`size-4 shrink-0 text-muted transition-transform duration-200 group-data-state-open:rotate-180`,e)}),Content:({className:r,children:i,ref:a,...o})=>{let{open:s,setOpen:c}=C(`Accordion.Content`),u=d(null),f=t(u,a);return l(()=>{let e=u.current;if(!e||!y())return;let t=()=>{e.removeAttribute(`hidden`),e.style.height=`auto`,c(!0)};return e.addEventListener(`beforematch`,t),()=>{e.removeEventListener(`beforematch`,t)}},[c]),e(()=>{let e=u.current;e&&(s||!y()?e.removeAttribute(`hidden`):(e.setAttribute(`hidden`,`until-found`),e.style.height=``))},[s]),m(`div`,{ref:f,...o,"data-slot":`accordion-content`,"data-state":s?`open`:`closed`,className: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`,r),children:i})},Body:({className:e,ref:t,...r})=>m(`div`,{ref:t,...r,"data-slot":`accordion-body`,className:n(`pt-2 pb-4`,e)})};export{O as Accordion};
package/dist/agent.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngrok/mantle",
3
- "version": "0.82.0",
3
+ "version": "0.82.1",
4
4
  "origin": "https://mantle.ngrok.com",
5
5
  "endpoints": {
6
6
  "docs": "https://mantle.ngrok.com/",
@@ -1,3 +1,4 @@
1
+ import { t as WithDataSlot } from "./data-slot-CChfb_cv.js";
1
2
  import { t as Alert } from "./alert-BWwNPOMI.js";
2
3
  import { ComponentProps, ReactNode } from "react";
3
4
  //#region src/components/alert-center/alert-center.d.ts
@@ -31,12 +32,21 @@ type AlertCenterIntent = "danger" | "important" | "info" | "success" | "warning"
31
32
  * ```
32
33
  */
33
34
  type AlertCenterRootProps = {
34
- /** Controlled expanded state of the additional-alert list. */
35
+ /** Controlled expanded state of the additional-alert list. Pair with `onOpenChange`. */
35
36
  open?: boolean;
36
- /** Uncontrolled initial expanded state of the additional-alert list. */
37
+ /**
38
+ * Uncontrolled initial expanded state of the additional-alert list.
39
+ *
40
+ * @default false
41
+ */
37
42
  defaultOpen?: boolean;
38
43
  /** Called when the additional-alert list expands or collapses. */
39
44
  onOpenChange?: (open: boolean) => void;
45
+ /**
46
+ * The `AlertCenter.Bar`, `AlertCenter.Content`, and every `AlertCenter.Item`.
47
+ * Items may be authored anywhere under the root — their children stay in this
48
+ * tree and are projected into the bar or an expansion row by rank.
49
+ */
40
50
  children?: ReactNode;
41
51
  };
42
52
  /**
@@ -50,6 +60,12 @@ type AlertCenterRootProps = {
50
60
  * contains no bar; it enters with its height animation after hydration — the
51
61
  * same entrance every arriving alert gets by design.
52
62
  *
63
+ * **Data attributes:**
64
+ *
65
+ * | Data Attribute | Value | Description |
66
+ * | --- | --- | --- |
67
+ * | `data-slot` | `alert-center-announcer` | On the persistent visually-hidden `role="status"` live region Root mounts. |
68
+ *
53
69
  * @see https://mantle.ngrok.com/components/feedback/alert-center#alertcenterroot
54
70
  *
55
71
  * @example
@@ -98,8 +114,10 @@ type AlertCenterItemProps = {
98
114
  * Stable identity. It keys the item's stable host element (children keep
99
115
  * their state as the host moves between the bar and a row), pins the
100
116
  * item's arrival order (a returning id resumes its original position), and
101
- * is stamped on the chrome as `data-alert-id` for styling. Two mounted
102
- * items sharing an id is an authoring error the last registration wins.
117
+ * is stamped on the chrome as `data-alert-id` for styling. Must be unique
118
+ * among the items mounted under one `AlertCenter.Root`a second mounted
119
+ * item claiming the same id throws, since both would project into that
120
+ * id's single host.
103
121
  */
104
122
  id: string;
105
123
  /**
@@ -136,6 +154,13 @@ type AlertCenterItemProps = {
136
154
  * Server rendering emits no alert DOM — the bar enters after hydration with
137
155
  * its height animation, the same entrance every arriving alert gets.
138
156
  *
157
+ * **Data attributes:**
158
+ *
159
+ * | Data Attribute | Value | Description |
160
+ * | --- | --- | --- |
161
+ * | `data-slot` | `alert-center-item-host` | On the stable per-id host element the item's children portal into. |
162
+ * | `data-alert-host` | the item's `id` | On that same host — which alert's projected children it holds. |
163
+ *
139
164
  * @see https://mantle.ngrok.com/components/feedback/alert-center#alertcenteritem
140
165
  *
141
166
  * @example
@@ -157,7 +182,7 @@ type AlertCenterItemProps = {
157
182
  * ```
158
183
  */
159
184
  declare const Item: ({ children, className, id, intent }: AlertCenterItemProps) => import("react").ReactPortal | null;
160
- type AlertCenterDismissIconButtonProps = ComponentProps<typeof Alert.DismissIconButton> & {
185
+ type AlertCenterDismissIconButtonProps = ComponentProps<typeof Alert.DismissIconButton> & WithDataSlot & {
161
186
  /**
162
187
  * Dismissal is consumer-owned: remove the alert by unmounting its
163
188
  * `AlertCenter.Item` (and persist that however you like). Required because a
@@ -174,10 +199,17 @@ type AlertCenterDismissIconButtonProps = ComponentProps<typeof Alert.DismissIcon
174
199
  * out — per alert; its presence IS the alert's dismissability.
175
200
  *
176
201
  * Where the control sits in each placement is the chrome's business, not this
177
- * wrapper's: `Alert.Root`'s existing expand-aware CSS seats it beside the bar's
202
+ * wrapper's: {@link dismissClearsExpandControl} seats it beside the bar's
178
203
  * expand control, and {@link singleLineBarControls} re-centers it in a
179
204
  * single-line bar.
180
205
  *
206
+ * **Data attributes:**
207
+ *
208
+ * | Data Attribute | Value | Description |
209
+ * | --- | --- | --- |
210
+ * | `data-slot` | `alert-center-dismiss-icon-button` | Replaces `Alert.DismissIconButton`'s own `alert-dismiss-icon-button` on the rendered button. |
211
+ * | `data-alert-dismiss` | present | Read, not stamped — `Alert` emits it, and `AlertCenter`'s bar CSS positions the control with it. |
212
+ *
181
213
  * @see https://mantle.ngrok.com/components/feedback/alert-center#alertcenterdismissiconbutton
182
214
  *
183
215
  * @example
@@ -195,8 +227,8 @@ type AlertCenterDismissIconButtonProps = ComponentProps<typeof Alert.DismissIcon
195
227
  * </AlertCenter.Root>
196
228
  * ```
197
229
  */
198
- declare const DismissIconButton: ({ label, ref, ...props }: AlertCenterDismissIconButtonProps) => import("react").JSX.Element;
199
- type AlertCenterBarProps = Omit<ComponentProps<typeof Alert.Root>, "appearance" | "intent" | "children"> & {
230
+ declare const DismissIconButton: ({ "data-slot": dataSlot, label, ref, ...props }: AlertCenterDismissIconButtonProps) => import("react").JSX.Element;
231
+ type AlertCenterBarProps = Omit<ComponentProps<typeof Alert.Root>, "appearance" | "intent" | "children"> & WithDataSlot & {
200
232
  /** The bar renders the top-ranked item's authored children — it takes none of its own. */
201
233
  children?: never;
202
234
  };
@@ -219,6 +251,19 @@ type AlertCenterBarProps = Omit<ComponentProps<typeof Alert.Root>, "appearance"
219
251
  * — arrivals and re-ranks are announced by the persistent visually-hidden
220
252
  * `role="status"` region that `AlertCenter.Root` mounts.
221
253
  *
254
+ * **Data attributes:**
255
+ *
256
+ * | Data Attribute | Value | Description |
257
+ * | --- | --- | --- |
258
+ * | `data-slot` | `alert-center-bar-wrapper` | On the presence wrapper that owns the enter/exit animation. |
259
+ * | `data-slot` | `alert-center-bar` | On the banner chrome (`Alert.Root`) the top item's children render inside. |
260
+ * | `data-slot` | `alert-center-bar-mount` | On the layout-transparent element the top item's host is adopted into. |
261
+ * | `data-state` | `"open"` \| `"closed"` | On the wrapper; drives the enter/exit transition, and stays `closed` while the exit plays. |
262
+ * | `data-placement` | `"bar"` | On the chrome — where the top item's children are currently rendering. |
263
+ * | `data-alert-id` | the top item's `id` | On the chrome; per-alert styling and testing hook. |
264
+ * | `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. |
265
+ * | `data-alert-expand` | present on the expand control | Read, not stamped — `Alert` emits it; the bar's CSS centers the control with it. |
266
+ *
222
267
  * @see https://mantle.ngrok.com/components/feedback/alert-center#alertcenterbar
223
268
  *
224
269
  * @example
@@ -227,13 +272,34 @@ type AlertCenterBarProps = Omit<ComponentProps<typeof Alert.Root>, "appearance"
227
272
  * <AlertCenter.Bar />
228
273
  * <AlertCenter.Content />
229
274
  * <AlertCenter.Item id="payment-failed" intent="danger">
230
- *
275
+ * <Alert.Icon />
276
+ * <Alert.Content>
277
+ * <Alert.Title>
278
+ * Payment failed — we couldn't charge your card.{" "}
279
+ * <a href="/billing">Update payment method</a>
280
+ * </Alert.Title>
281
+ * <Alert.Description>
282
+ * Update your payment method to avoid a service interruption.
283
+ * </Alert.Description>
284
+ * </Alert.Content>
231
285
  * </AlertCenter.Item>
286
+ * {!dismissed.has("transfer-limit") && (
287
+ * <AlertCenter.Item id="transfer-limit" intent="warning">
288
+ * <Alert.Icon />
289
+ * <Alert.Content>
290
+ * <Alert.Title>
291
+ * You've used 92% of your monthly transfer.{" "}
292
+ * <a href="/billing/choose-a-plan">Upgrade</a>
293
+ * </Alert.Title>
294
+ * <AlertCenter.DismissIconButton onClick={() => dismiss("transfer-limit")} />
295
+ * </Alert.Content>
296
+ * </AlertCenter.Item>
297
+ * )}
232
298
  * </AlertCenter.Root>
233
299
  * ```
234
300
  */
235
- declare const Bar: ({ className, ref, ...props }: AlertCenterBarProps) => import("react").JSX.Element | null;
236
- type AlertCenterContentProps = Omit<ComponentProps<"div">, "children" | "id"> & {
301
+ declare const Bar: ({ className, "data-slot": dataSlot, ref, ...props }: AlertCenterBarProps) => import("react").JSX.Element | null;
302
+ type AlertCenterContentProps = Omit<ComponentProps<"div">, "children" | "id"> & WithDataSlot & {
237
303
  /** Rows are the registered items' authored children — Content takes none of its own. */
238
304
  children?: never;
239
305
  };
@@ -249,6 +315,17 @@ type AlertCenterContentProps = Omit<ComponentProps<"div">, "children" | "id"> &
249
315
  * list itself — the outer wrapper is `role="generic"`, where ARIA prohibits
250
316
  * accessible names, so a name passed here would otherwise be dropped.
251
317
  *
318
+ * **Data attributes:**
319
+ *
320
+ * | Data Attribute | Value | Description |
321
+ * | --- | --- | --- |
322
+ * | `data-slot` | `alert-center-content` | On the expansion wrapper that owns the collapse animation. |
323
+ * | `data-slot` | `alert-center-item` | On each row's banner chrome (`Alert.Root`). |
324
+ * | `data-state` | `"open"` \| `"closed"` | On the wrapper; drives the collapse transition. |
325
+ * | `data-placement` | `"list"` | On each row's chrome — where that item's children are currently rendering. |
326
+ * | `data-alert-id` | the row item's `id` | On each row's chrome; per-alert styling and testing hook. |
327
+ * | `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. |
328
+ *
252
329
  * @see https://mantle.ngrok.com/components/feedback/alert-center#alertcentercontent
253
330
  *
254
331
  * @example
@@ -256,13 +333,27 @@ type AlertCenterContentProps = Omit<ComponentProps<"div">, "children" | "id"> &
256
333
  * <AlertCenter.Root>
257
334
  * <AlertCenter.Bar />
258
335
  * <AlertCenter.Content aria-label="Autres alertes" />
259
- * <AlertCenter.Item id="transfer-limit" intent="warning">
260
- *
336
+ * <AlertCenter.Item id="payment-failed" intent="danger">
337
+ * <Alert.Icon />
338
+ * <Alert.Content>
339
+ * <Alert.Title>
340
+ * Payment failed — <a href="/billing">update your card</a>
341
+ * </Alert.Title>
342
+ * </Alert.Content>
261
343
  * </AlertCenter.Item>
344
+ * {!dismissed.has("transfer-limit") && (
345
+ * <AlertCenter.Item id="transfer-limit" intent="warning">
346
+ * <Alert.Icon />
347
+ * <Alert.Content>
348
+ * <Alert.Title>Approaching your data transfer limit</Alert.Title>
349
+ * <AlertCenter.DismissIconButton onClick={() => dismiss("transfer-limit")} />
350
+ * </Alert.Content>
351
+ * </AlertCenter.Item>
352
+ * )}
262
353
  * </AlertCenter.Root>
263
354
  * ```
264
355
  */
265
- declare const Content: ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, className, ref, ...props }: AlertCenterContentProps) => import("react").JSX.Element | null;
356
+ declare const Content: ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, className, "data-slot": dataSlot, ref, ...props }: AlertCenterContentProps) => import("react").JSX.Element | null;
266
357
  /**
267
358
  * A single, top-level entry point for one-to-many account alerts and their
268
359
  * upgrade CTAs — the aggregation layer that replaces a stack of independent
@@ -286,6 +377,13 @@ declare const Content: ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabell
286
377
  * written) while their DOM renders through a stable per-id host that the bar
287
378
  * and rows physically adopt — so content keeps its state across re-ranks.
288
379
  *
380
+ * Siblings: `Alert` (`@ngrok/mantle/alert`) is a single inline banner you place
381
+ * and control yourself; `Toast` (`@ngrok/mantle/toast`) is for transient,
382
+ * ephemeral notifications; `AppLayout.Notice` (`@ngrok/mantle/app-layout`) is
383
+ * the layout slot this composes INTO, not a competitor. `AlertCenter` answers
384
+ * only the one-to-many case: persistent, ACCOUNT-level alerts that must be
385
+ * ranked and collapsed into a single top-level bar.
386
+ *
289
387
  * @see https://mantle.ngrok.com/components/feedback/alert-center
290
388
  *
291
389
  * @example
@@ -334,7 +432,7 @@ declare const Content: ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabell
334
432
  * )}
335
433
  * </AlertCenter.Root>
336
434
  * </AppLayout.Notice>
337
- * <AppLayout.Body>…</AppLayout.Body>
435
+ * <AppLayout.Workspace>…</AppLayout.Workspace>
338
436
  * </AppLayout.Root>
339
437
  * ```
340
438
  */
@@ -343,6 +441,12 @@ declare const AlertCenter: {
343
441
  * The renderless state owner: creates the registration store, owns the
344
442
  * expansion's open state, and mounts the persistent live-region announcer.
345
443
  *
444
+ * **Data attributes:**
445
+ *
446
+ * | Data Attribute | Value | Description |
447
+ * | --- | --- | --- |
448
+ * | `data-slot` | `alert-center-announcer` | On the persistent visually-hidden `role="status"` live region Root mounts. |
449
+ *
346
450
  * @see https://mantle.ngrok.com/components/feedback/alert-center#alertcenterroot
347
451
  *
348
452
  * @example
@@ -351,8 +455,29 @@ declare const AlertCenter: {
351
455
  * <AlertCenter.Bar />
352
456
  * <AlertCenter.Content />
353
457
  * <AlertCenter.Item id="payment-failed" intent="danger">
354
- *
458
+ * <Alert.Icon />
459
+ * <Alert.Content>
460
+ * <Alert.Title>
461
+ * Payment failed — we couldn't charge your card.{" "}
462
+ * <a href="/billing">Update payment method</a>
463
+ * </Alert.Title>
464
+ * <Alert.Description>
465
+ * Update your payment method to avoid a service interruption.
466
+ * </Alert.Description>
467
+ * </Alert.Content>
355
468
  * </AlertCenter.Item>
469
+ * {!dismissed.has("transfer-limit") && (
470
+ * <AlertCenter.Item id="transfer-limit" intent="warning">
471
+ * <Alert.Icon />
472
+ * <Alert.Content>
473
+ * <Alert.Title>
474
+ * You've used 92% of your monthly transfer.{" "}
475
+ * <a href="/billing/choose-a-plan">Upgrade</a>
476
+ * </Alert.Title>
477
+ * <AlertCenter.DismissIconButton onClick={() => dismiss("transfer-limit")} />
478
+ * </Alert.Content>
479
+ * </AlertCenter.Item>
480
+ * )}
356
481
  * </AlertCenter.Root>
357
482
  * ```
358
483
  */
@@ -363,6 +488,19 @@ declare const AlertCenter: {
363
488
  * Collapses to nothing when empty. Claims no ARIA landmark; arrivals are
364
489
  * announced by Root's persistent live region.
365
490
  *
491
+ * **Data attributes:**
492
+ *
493
+ * | Data Attribute | Value | Description |
494
+ * | --- | --- | --- |
495
+ * | `data-slot` | `alert-center-bar-wrapper` | On the presence wrapper that owns the enter/exit animation. |
496
+ * | `data-slot` | `alert-center-bar` | On the banner chrome (`Alert.Root`) the top item's children render inside. |
497
+ * | `data-slot` | `alert-center-bar-mount` | On the layout-transparent element the top item's host is adopted into. |
498
+ * | `data-state` | `"open"` \| `"closed"` | On the wrapper; drives the enter/exit transition, and stays `closed` while the exit plays. |
499
+ * | `data-placement` | `"bar"` | On the chrome — where the top item's children are currently rendering. |
500
+ * | `data-alert-id` | the top item's `id` | On the chrome; per-alert styling and testing hook. |
501
+ * | `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. |
502
+ * | `data-alert-expand` | present on the expand control | Read, not stamped — `Alert` emits it; the bar's CSS centers the control with it. |
503
+ *
366
504
  * @see https://mantle.ngrok.com/components/feedback/alert-center#alertcenterbar
367
505
  *
368
506
  * @example
@@ -371,8 +509,29 @@ declare const AlertCenter: {
371
509
  * <AlertCenter.Bar />
372
510
  * <AlertCenter.Content />
373
511
  * <AlertCenter.Item id="payment-failed" intent="danger">
374
- *
512
+ * <Alert.Icon />
513
+ * <Alert.Content>
514
+ * <Alert.Title>
515
+ * Payment failed — we couldn't charge your card.{" "}
516
+ * <a href="/billing">Update payment method</a>
517
+ * </Alert.Title>
518
+ * <Alert.Description>
519
+ * Update your payment method to avoid a service interruption.
520
+ * </Alert.Description>
521
+ * </Alert.Content>
375
522
  * </AlertCenter.Item>
523
+ * {!dismissed.has("transfer-limit") && (
524
+ * <AlertCenter.Item id="transfer-limit" intent="warning">
525
+ * <Alert.Icon />
526
+ * <Alert.Content>
527
+ * <Alert.Title>
528
+ * You've used 92% of your monthly transfer.{" "}
529
+ * <a href="/billing/choose-a-plan">Upgrade</a>
530
+ * </Alert.Title>
531
+ * <AlertCenter.DismissIconButton onClick={() => dismiss("transfer-limit")} />
532
+ * </Alert.Content>
533
+ * </AlertCenter.Item>
534
+ * )}
376
535
  * </AlertCenter.Root>
377
536
  * ```
378
537
  */
@@ -382,6 +541,17 @@ declare const AlertCenter: {
382
541
  * highest-severity-first as full-width banner rows of the items' authored
383
542
  * children.
384
543
  *
544
+ * **Data attributes:**
545
+ *
546
+ * | Data Attribute | Value | Description |
547
+ * | --- | --- | --- |
548
+ * | `data-slot` | `alert-center-content` | On the expansion wrapper that owns the collapse animation. |
549
+ * | `data-slot` | `alert-center-item` | On each row's banner chrome (`Alert.Root`). |
550
+ * | `data-state` | `"open"` \| `"closed"` | On the wrapper; drives the collapse transition. |
551
+ * | `data-placement` | `"list"` | On each row's chrome — where that item's children are currently rendering. |
552
+ * | `data-alert-id` | the row item's `id` | On each row's chrome; per-alert styling and testing hook. |
553
+ * | `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. |
554
+ *
385
555
  * @see https://mantle.ngrok.com/components/feedback/alert-center#alertcentercontent
386
556
  *
387
557
  * @example
@@ -389,9 +559,23 @@ declare const AlertCenter: {
389
559
  * <AlertCenter.Root>
390
560
  * <AlertCenter.Bar />
391
561
  * <AlertCenter.Content />
392
- * <AlertCenter.Item id="transfer-limit" intent="warning">
393
- *
562
+ * <AlertCenter.Item id="payment-failed" intent="danger">
563
+ * <Alert.Icon />
564
+ * <Alert.Content>
565
+ * <Alert.Title>
566
+ * Payment failed — <a href="/billing">update your card</a>
567
+ * </Alert.Title>
568
+ * </Alert.Content>
394
569
  * </AlertCenter.Item>
570
+ * {!dismissed.has("transfer-limit") && (
571
+ * <AlertCenter.Item id="transfer-limit" intent="warning">
572
+ * <Alert.Icon />
573
+ * <Alert.Content>
574
+ * <Alert.Title>Approaching your data transfer limit</Alert.Title>
575
+ * <AlertCenter.DismissIconButton onClick={() => dismiss("transfer-limit")} />
576
+ * </Alert.Content>
577
+ * </AlertCenter.Item>
578
+ * )}
395
579
  * </AlertCenter.Root>
396
580
  * ```
397
581
  */
@@ -402,6 +586,13 @@ declare const AlertCenter: {
402
586
  * expansion row adopts by rank — children stay in the author's React tree
403
587
  * and keep their state across re-ranks. Mount to show; unmount to dismiss.
404
588
  *
589
+ * **Data attributes:**
590
+ *
591
+ * | Data Attribute | Value | Description |
592
+ * | --- | --- | --- |
593
+ * | `data-slot` | `alert-center-item-host` | On the stable per-id host element the item's children portal into. |
594
+ * | `data-alert-host` | the item's `id` | On that same host — which alert's projected children it holds. |
595
+ *
405
596
  * @see https://mantle.ngrok.com/components/feedback/alert-center#alertcenteritem
406
597
  *
407
598
  * @example
@@ -426,6 +617,13 @@ declare const AlertCenter: {
426
617
  * enclosing banner's rendered title and the bar's control centering. Its
427
618
  * presence in an item's children is what makes that alert dismissable.
428
619
  *
620
+ * **Data attributes:**
621
+ *
622
+ * | Data Attribute | Value | Description |
623
+ * | --- | --- | --- |
624
+ * | `data-slot` | `alert-center-dismiss-icon-button` | Replaces `Alert.DismissIconButton`'s own `alert-dismiss-icon-button` on the rendered button. |
625
+ * | `data-alert-dismiss` | present | Read, not stamped — `Alert` emits it, and `AlertCenter`'s bar CSS positions the control with it. |
626
+ *
429
627
  * @see https://mantle.ngrok.com/components/feedback/alert-center#alertcenterdismissiconbutton
430
628
  *
431
629
  * @example
@@ -1 +1 @@
1
- import{t as e}from"./use-isomorphic-layout-effect-DdTRtMY-.js";import{n as t}from"./compose-refs-BdBMM9ga.js";import{t as n}from"./cx-IiQEAKf5.js";import{n as r,t as i}from"./alert-QMs0PqMq.js";import{createContext as a,useCallback as o,useContext as s,useEffect as c,useId as l,useMemo 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]||e.sequence-t.sequence)}function w(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 T=[];var E=class{#e=new Set;#t=new Map;#n=new Map;#r=new Map;#i=0;#a=T;#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.hasChildNodes()&&(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){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 D=a(null),O=a(null);function k(e){let t=s(D);return h(t,`${e} must be rendered inside <AlertCenter.Root>.`),t}function A(e){let t=s(O);return h(t,`${e} must be rendered inside <AlertCenter.Root>.`),t}const j=e=>m(e.subscribe,e.getSnapshot,e.getSnapshot),M=a(!1);function N({store:e}){let t=j(e);return g(`div`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:w(m(e.subscribe,e.getTopLabel,e.getTopLabel),t.length)})}const P=({children:e,defaultOpen:t,onOpenChange:n,open:r})=>{let[i]=p(()=>new E),a=l(),[s,c]=p(t??!1),d=r??s,f=o(e=>{r??c(e),n?.(e)},[r,n]),m=u(()=>({store:i,contentId:a}),[i,a]),h=u(()=>({isExpanded:d,setExpanded:f}),[d,f]);return _(D.Provider,{value:m,children:[g(O.Provider,{value:h,children:e}),g(N,{store:i})]})},F=({children:t,className:n,id:i,intent:a})=>{let{store:o}=k(`AlertCenter.Item`);h(!s(M),`AlertCenter.Item cannot be rendered inside another item's children.`);let[c,l]=p(null);return e(()=>{l(o.getHost(i))},[o,i]),e(()=>o.register({id:i,intent:a,className:n}),[o,i,a,n]),e(()=>{o.captureHostSnapshot(i)}),c==null?null:v(g(r,{intent:a,children:g(M.Provider,{value:!0,children:t})}),c)},I=({label:n,ref:r,...a})=>{h(s(M),`AlertCenter.DismissIconButton must be composed inside an <AlertCenter.Item>'s children.`);let{store:o}=k(`AlertCenter.DismissIconButton`);m(o.subscribe,o.getPlacementVersion,o.getPlacementVersion);let c=f(null),l=t(c,r),[u,d]=p(null);return e(()=>{if(n!=null)return;let e=c.current?.closest(`[data-alert-id]`),t=e==null?``:S(e);d(t===``?null:`Dismiss ${t}`)}),g(i.DismissIconButton,{ref:l,label:n??u??void 0,...a})};function L(e,t){switch(t){case`show`:return`open`;case`hide`:return e===`closed`?`closed`:`closing`;case`exited`:return e===`closing`?`closed`:e}}function R({present:t}){let[n,r]=d(L,t?`open`:`closed`);e(()=>{r(t?`show`:`hide`)},[t]),c(()=>{if(n!==`closing`)return;let e=window.setTimeout(()=>r(`exited`),200);return()=>window.clearTimeout(e)},[n]);let i=o(e=>{e.target===e.currentTarget&&e.propertyName===`height`&&r(`exited`)},[]);return{isMounted:n!==`closed`,dataState:n===`open`?`open`:`closed`,onExitTransitionEnd:i}}function z({containerRef:t,isAttached:n}){let r=f(null);return e(()=>{let e=t.current;if(!n||e==null)return;let i=e=>{e.target instanceof Element&&(r.current=e.target)},a=t=>{t.relatedTarget instanceof Node&&!e.contains(t.relatedTarget)&&(r.current=null)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[t,n]),{lastFocusedWithinRef:r}}function B(){let e=document.querySelector(`main, [role="main"]`);e!=null&&(e.hasAttribute(`tabindex`)||(e.tabIndex=-1),e.focus({preventScroll:!0}))}function V({isMounted:t,store:n,topId:r}){let i=f(null),{lastFocusedWithinRef:a}=z({containerRef:i,isAttached:t}),o=f(r);return e(()=>{let e=o.current;if(o.current=r,e==null||r===e)return;let t=a.current;if(n.hasAlert(e)){t instanceof HTMLElement&&document.activeElement!==t&&n.requestFocusRestore(t);return}if(t==null||t.isConnected)return;a.current=null;let s=i.current;if(r==null){B();return}s!=null&&(s.querySelector(`[data-slot="alert-dismiss-icon-button"], [data-slot="alert-expand-button"]`)??s).focus()},[n,r]),{wrapperRef:i}}const H=`gap-2 py-2 pr-2 [&_[data-slot=alert-icon]]:shrink-0`,U={Root:P,Bar:({className:t,ref:r,...a})=>{let{store:o,contentId:s}=k(`AlertCenter.Bar`),{isExpanded:c,setExpanded:l}=A(`AlertCenter.Bar`),u=j(o),d=m(o.subscribe,o.getContentMounted,o.getContentMounted),p=u[0]??null,h=p!=null,{isMounted:v,dataState:y,onExitTransitionEnd:x}=R({present:h}),C=f(p);e(()=>{p!=null&&(C.current=p)},[p]);let w=p??C.current,T=f(null);e(()=>{let e=T.current;if(e==null)return;if(p!=null){let t=o.getHost(p.id);t.parentElement!==e&&e.childNodes.length>0&&e.replaceChildren(),b(e,t)&&o.notifyPlacementChange(),o.flushFocusRestore();return}let t=w==null?null:o.getHostSnapshot(w.id);t!=null&&t.parentNode!==e&&e.replaceChildren(t)});let{wrapperRef:E}=V({isMounted:v,store:o,topId:p?.id});if(e(()=>{let e=E.current;o.setTopLabel(h&&e!=null?S(e):``)}),e(()=>{let e=E.current;if(e==null)return;let t=new MutationObserver(()=>{o.setTopLabel(h?S(e):``)});return t.observe(e,{subtree:!0,childList:!0,characterData:!0}),()=>{t.disconnect()}},[o,h,v]),e(()=>()=>{o.setTopLabel(``)},[o]),e(()=>{o.setBarElement(E.current)}),e(()=>()=>{o.setBarElement(null)},[o]),!v||w==null)return null;let D=h?u.length-1:0;return g(`div`,{ref:E,tabIndex:-1,inert:!h,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":y,onTransitionEnd:x,children:_(i.Root,{ref:r,appearance:`banner`,intent:w.intent,className:n(H,`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`,t,w.className),...a,"data-slot":`alert-center-bar`,"data-placement":`bar`,"data-alert-id":w.id,children:[g(`div`,{ref:T,className:`contents`,"data-slot":`alert-center-bar-mount`}),D>0&&d&&g(i.ExpandButton,{count:D,expanded:c,"aria-controls":s,onClick:()=>l(!c)})]})})},Content:({"aria-label":r=`More alerts`,"aria-labelledby":a,className:o,ref:s,...c})=>{let{store:l,contentId:u}=k(`AlertCenter.Content`),{isExpanded:d,setExpanded:p}=A(`AlertCenter.Content`),m=j(l).slice(1),h=m.length>0;e(()=>(l.setContentMounted(!0),()=>{l.setContentMounted(!1)}),[l]);let _=f(h);e(()=>{let e=_.current&&!h;_.current=h,e&&d&&p(!1)},[h,d,p]);let v=f(null),y=t(v,s),{lastFocusedWithinRef:x}=z({containerRef:v,isAttached:h}),S=m.map(e=>e.id).join(` `);return e(()=>{let e=v.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,l.getHost(e))&&(t=!0)}t&&l.notifyPlacementChange(),l.flushFocusRestore()},[l,S]),e(()=>{let e=x.current;if(e==null)return;if(e.isConnected){let t=v.current;e instanceof HTMLElement&&document.activeElement!==e&&(t==null||!t.contains(e))&&(x.current=null,e.focus({preventScroll:!0}));return}x.current=null;let t=v.current?.querySelector(`[data-slot="alert-dismiss-icon-button"]`);if(t!=null){t.focus();return}let n=l.getBarElement()?.querySelector(`[data-slot="alert-dismiss-icon-button"], [data-slot="alert-expand-button"]`);if(n!=null){n.focus();return}B()},[l,S]),m.length===0?null:g(`div`,{...c,ref:y,"data-slot":`alert-center-content`,id:u,"data-state":d?`open`:`closed`,className: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`,o),children:g(`ul`,{"aria-label":a==null?r:void 0,"aria-labelledby":a,className:`flex w-full flex-col`,children:m.map(e=>g(`li`,{children:g(i.Root,{appearance:`banner`,intent:e.intent,className:n(H,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))})})},Item:F,DismissIconButton:I};export{U as AlertCenter};
1
+ import{t as e}from"./use-isomorphic-layout-effect-DdTRtMY-.js";import{n as t}from"./compose-refs-BdBMM9ga.js";import{t as n}from"./cx-IiQEAKf5.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{n as i,t as a}from"./alert-vwFd7qdp.js";import{createContext as o,useCallback as s,useContext as c,useEffect as l,useId as u,useMemo as d,useReducer as f,useRef as p,useState as m,useSyncExternalStore as h}from"react";import g from"tiny-invariant";import{jsx as _,jsxs as v}from"react/jsx-runtime";import{createPortal as y}from"react-dom";const b={danger:5,warning:4,important:3,info:2,success:1};function x(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 S(e){return e.replace(/\s+/g,` `).trim()}function C(e){let t=e.querySelector(`[data-slot="alert-title"]`);if(t==null)return``;let n=t.cloneNode(!0);if(!(n instanceof Element))return S(t.textContent??``);for(let e of n.querySelectorAll(`button`))e.remove();let r=S(n.textContent??``);for(let e of n.querySelectorAll(`a`))e.remove();let i=S(n.textContent??``);return i===``?r:i}function w(e){return e.toSorted((e,t)=>b[t.intent]-b[e.intent]||e.sequence-t.sequence)}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.hasChildNodes()&&(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){g(!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=w([...this.#t.values()]),this.#p()}#p(){for(let e of this.#e)e()}};const O=o(null),k=o(null);function A(e){let t=c(O);return g(t,`${e} must be rendered inside <AlertCenter.Root>.`),t}function j(e){let t=c(k);return g(t,`${e} must be rendered inside <AlertCenter.Root>.`),t}const M=e=>h(e.subscribe,e.getSnapshot,e.getSnapshot),N=o(!1);function P({store:e}){let t=M(e);return _(`div`,{"data-slot":`alert-center-announcer`,className:`sr-only`,role:`status`,"aria-live":`polite`,children:T(h(e.subscribe,e.getTopLabel,e.getTopLabel),t.length)})}const F=({children:e,defaultOpen:t,onOpenChange:n,open:r})=>{let[i]=m(()=>new D),a=u(),[o,c]=m(t??!1),l=r??o,f=s(e=>{r??c(e),n?.(e)},[r,n]),p=d(()=>({store:i,contentId:a}),[i,a]),h=d(()=>({isExpanded:l,setExpanded:f}),[l,f]);return v(O.Provider,{value:p,children:[_(k.Provider,{value:h,children:e}),_(P,{store:i})]})},I=({children:t,className:n,id:r,intent:a})=>{let{store:o}=A(`AlertCenter.Item`);g(!c(N),`AlertCenter.Item cannot be rendered inside another item's children.`);let[s,l]=m(null);return e(()=>{l(o.getHost(r))},[o,r]),e(()=>o.register({id:r,intent:a,className:n}),[o,r,a,n]),e(()=>{o.captureHostSnapshot(r)}),s==null?null:y(_(i,{intent:a,children:_(N.Provider,{value:!0,children:t})}),s)},L=({"data-slot":n,label:i,ref:o,...s})=>{g(c(N),`AlertCenter.DismissIconButton must be composed inside an <AlertCenter.Item>'s children.`);let{store:l}=A(`AlertCenter.DismissIconButton`);h(l.subscribe,l.getPlacementVersion,l.getPlacementVersion);let u=p(null),d=t(u,o),[f,v]=m(null);return e(()=>{if(i!=null)return;let e=u.current?.closest(`[data-alert-id]`),t=e==null?``:C(e);v(t===``?null:`Dismiss ${t}`)}),_(a.DismissIconButton,{ref:d,label:i??f??void 0,...s,"data-slot":r(n,`alert-center-dismiss-icon-button`)})};function R(e,t){switch(t){case`show`:return`open`;case`hide`:return e===`closed`?`closed`:`closing`;case`exited`:return e===`closing`?`closed`:e}}function z({present:t}){let[n,r]=f(R,t?`open`:`closed`);e(()=>{r(t?`show`:`hide`)},[t]),l(()=>{if(n!==`closing`)return;let e=window.setTimeout(()=>r(`exited`),200);return()=>window.clearTimeout(e)},[n]);let i=s(e=>{e.target===e.currentTarget&&e.propertyName===`height`&&r(`exited`)},[]);return{isMounted:n!==`closed`,dataState:n===`open`?`open`:`closed`,onExitTransitionEnd:i}}function B({containerRef:t,isAttached:n}){let r=p(null);return e(()=>{let e=t.current;if(!n||e==null)return;let i=e=>{e.target instanceof Element&&(r.current=e.target)},a=t=>{t.relatedTarget instanceof Node&&!e.contains(t.relatedTarget)&&(r.current=null)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[t,n]),{lastFocusedWithinRef:r}}function V(){let e=document.querySelector(`main, [role="main"]`);e!=null&&(e.hasAttribute(`tabindex`)||(e.tabIndex=-1),e.focus({preventScroll:!0}))}function H({isMounted:t,store:n,topId:r}){let i=p(null),{lastFocusedWithinRef:a}=B({containerRef:i,isAttached:t}),o=p(r);return e(()=>{let e=o.current;if(o.current=r,e==null||r===e)return;let t=a.current;if(n.hasAlert(e)){t instanceof HTMLElement&&document.activeElement!==t&&n.requestFocusRestore(t);return}if(t==null||t.isConnected)return;a.current=null;let s=i.current;if(r==null){V();return}s!=null&&(s.querySelector(`[data-alert-dismiss], [data-alert-expand]`)??s).focus()},[n,r]),{wrapperRef:i}}const U=`gap-2 py-2 pr-2 [&_[data-slot=alert-icon]]:shrink-0`,W={Root:F,Bar:({className:t,"data-slot":i,ref:o,...s})=>{let{store:c,contentId:l}=A(`AlertCenter.Bar`),{isExpanded:u,setExpanded:d}=j(`AlertCenter.Bar`),f=M(c),m=h(c.subscribe,c.getContentMounted,c.getContentMounted),g=f[0]??null,y=g!=null,{isMounted:b,dataState:S,onExitTransitionEnd:w}=z({present:y}),T=p(g);e(()=>{g!=null&&(T.current=g)},[g]);let E=g??T.current,D=p(null);e(()=>{let e=D.current;if(e==null)return;if(g!=null){let t=c.getHost(g.id);t.parentElement!==e&&e.childNodes.length>0&&e.replaceChildren(),x(e,t)&&c.notifyPlacementChange(),c.flushFocusRestore();return}let t=E==null?null:c.getHostSnapshot(E.id);t!=null&&t.parentNode!==e&&e.replaceChildren(t)});let{wrapperRef:O}=H({isMounted:b,store:c,topId:g?.id});if(e(()=>{let e=O.current;c.setTopLabel(y&&e!=null?C(e):``)}),e(()=>{let e=O.current;if(e==null)return;let t=new MutationObserver(()=>{c.setTopLabel(y?C(e):``)});return t.observe(e,{subtree:!0,childList:!0,characterData:!0}),()=>{t.disconnect()}},[c,y,b]),e(()=>()=>{c.setTopLabel(``)},[c]),e(()=>{c.setBarElement(O.current)}),e(()=>()=>{c.setBarElement(null)},[c]),!b||E==null)return null;let k=y?f.length-1:0;return _(`div`,{ref:O,"data-slot":`alert-center-bar-wrapper`,tabIndex:-1,inert:!y,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":S,onTransitionEnd:w,children:v(a.Root,{ref:o,appearance:`banner`,intent:E.intent,className:n(U,`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`,t,E.className),...s,"data-slot":r(i,`alert-center-bar`),"data-placement":`bar`,"data-alert-id":E.id,children:[_(`div`,{ref:D,className:`contents`,"data-slot":`alert-center-bar-mount`}),k>0&&m&&_(a.ExpandButton,{count:k,expanded:u,"aria-controls":l,onClick:()=>d(!u)})]})})},Content:({"aria-label":i=`More alerts`,"aria-labelledby":o,className:s,"data-slot":c,ref:l,...u})=>{let{store:d,contentId:f}=A(`AlertCenter.Content`),{isExpanded:m,setExpanded:h}=j(`AlertCenter.Content`),g=M(d).slice(1),v=g.length>0;e(()=>(d.setContentMounted(!0),()=>{d.setContentMounted(!1)}),[d]);let y=p(v);e(()=>{let e=y.current&&!v;y.current=v,e&&m&&h(!1)},[v,m,h]);let b=p(null),S=t(b,l),{lastFocusedWithinRef:C}=B({containerRef:b,isAttached:v}),w=g.map(e=>e.id).join(` `);return e(()=>{let e=b.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&&x(n,d.getHost(e))&&(t=!0)}t&&d.notifyPlacementChange(),d.flushFocusRestore()},[d,w]),e(()=>{let e=C.current;if(e==null)return;if(e.isConnected){let t=b.current;e instanceof HTMLElement&&document.activeElement!==e&&(t==null||!t.contains(e))&&(C.current=null,e.focus({preventScroll:!0}));return}C.current=null;let t=b.current?.querySelector(`[data-alert-dismiss]`);if(t!=null){t.focus();return}let n=d.getBarElement()?.querySelector(`[data-alert-dismiss], [data-alert-expand]`);if(n!=null){n.focus();return}V()},[d,w]),g.length===0?null:_(`div`,{...u,ref:S,"data-slot":r(c,`alert-center-content`),id:f,"data-state":m?`open`:`closed`,className: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`,s),children:_(`ul`,{"aria-label":o==null?i:void 0,"aria-labelledby":o,className:`flex w-full flex-col`,children:g.map(e=>_(`li`,{children:_(a.Root,{appearance:`banner`,intent:e.intent,className:n(U,e.className),"data-slot":`alert-center-item`,"data-placement":`list`,"data-alert-id":e.id,children:_(`div`,{className:`contents`,"data-alert-mount":e.id})})},e.id))})})},Item:I,DismissIconButton:L};export{W as AlertCenter};
@@ -1 +1 @@
1
- import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-d-nMCfAI.js";import{t as n}from"./slot-Dpsqz16D.js";import{t as r}from"./button-BUospUB3.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-Dv-3snU3.js";import{createContext as f,useContext as p,useMemo as m}from"react";import h from"tiny-invariant";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{InfoIcon as v}from"@phosphor-icons/react/Info";import{WarningIcon as y}from"@phosphor-icons/react/Warning";const b=f(null);function x(){let e=p(b);return h(e,`AlertDialog child component used outside of AlertDialog parent!`),e}function S({intent:e,...t}){let n=m(()=>({intent:e}),[e]);return g(b.Provider,{value:n,children:g(c,{...t})})}const C=({ref:e,...t})=>g(a,{ref:e,"data-slot":`alert-dialog-trigger`,...t}),w=i,T=({className:t,ref:n,...r})=>g(o,{"data-slot":`alert-dialog-overlay`,className:e(`data-state-open:animate-in data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:fade-in-0 bg-overlay fixed inset-0 z-50 backdrop-blur-xs`,t),...r,ref:n}),E=({className:t,preferredWidth:n=`max-w-md`,ref:r,...i})=>_(w,{children:[g(T,{}),g(`div`,{className:`fixed inset-4 z-50 flex items-center justify-center`,children:g(s,{"data-slot":`alert-dialog-content`,"data-mantle-modal-content":!0,ref:r,className: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 transition-transform duration-200`,`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`,n,t),...i})})]}),D=({asChild:t=!1,className:r,ref:i,...a})=>g(t?n:`div`,{"data-slot":`alert-dialog-body`,className:e(`flex-1 space-y-4`,r),ref:i,...a}),O=({asChild:t=!1,className:r,ref:i,...a})=>g(t?n:`div`,{"data-slot":`alert-dialog-header`,className:e(`flex flex-col space-y-2 text-center sm:text-start`,r),ref:i,...a}),k=({asChild:t=!1,className:r,ref:i,...a})=>g(t?n:`div`,{"data-slot":`alert-dialog-footer`,className:e(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,r),ref:i,...a}),A=({className:t,ref:n,...r})=>g(u,{ref:n,"data-slot":`alert-dialog-title`,className:e(`text-strong text-center text-lg font-medium sm:text-start`,t),...r}),j=({className:t,ref:n,...r})=>g(l,{ref:n,"data-slot":`alert-dialog-description`,className:e(`text-body text-center text-sm font-normal sm:text-start`,t),...r}),M={danger:`danger`,info:`neutral`},N=({appearance:e=`filled`,intent:t,ref:n,...i})=>{let a=x(),o=M[a.intent];return g(r,{appearance:e,"data-slot":`alert-dialog-action`,intent:t??o,ref:n,...i})},P=({appearance:t=`outlined`,className:n,intent:i=`neutral`,ref:a,...o})=>g(d,{asChild:!0,children:g(r,{appearance:t,"data-slot":`alert-dialog-cancel`,className:e(`mt-2 sm:mt-0`,n),intent:i,ref:a,...o})}),F={danger:g(y,{}),info:g(v,{})},I={danger:`text-danger-600`,info:`text-accent-600`},L={Root:S,Action:N,Body:D,Cancel:P,Close:({ref:e,...t})=>g(d,{ref:e,"data-slot":`alert-dialog-close`,...t}),Content:E,Description:j,Footer:k,Header:O,Icon:({className:n,ref:r,svg:i,...a})=>{let o=x(),s=I[o.intent],c=F[o.intent];return g(t,{ref:r,"data-slot":`alert-dialog-icon`,className:e(`size-12 sm:size-7`,s,n),svg:i??c,...a})},Title:A,Trigger:C};export{L as AlertDialog};
1
+ import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-d-nMCfAI.js";import{t as n}from"./slot-DpNWVci8.js";import{t as r}from"./button-Cnja9Bsr.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-D-9GIFWb.js";import{createContext as f,useContext as p,useMemo as m}from"react";import h from"tiny-invariant";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{InfoIcon as v}from"@phosphor-icons/react/Info";import{WarningIcon as y}from"@phosphor-icons/react/Warning";const b=f(null);function x(){let e=p(b);return h(e,`AlertDialog child component used outside of AlertDialog parent!`),e}function S({intent:e,...t}){let n=m(()=>({intent:e}),[e]);return g(b.Provider,{value:n,children:g(c,{...t})})}const C=({ref:e,...t})=>g(a,{ref:e,"data-slot":`alert-dialog-trigger`,...t}),w=i,T=({className:t,ref:n,...r})=>g(o,{"data-slot":`alert-dialog-overlay`,className:e(`data-state-open:animate-in data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:fade-in-0 bg-overlay fixed inset-0 z-50 backdrop-blur-xs`,t),...r,ref:n}),E=({className:t,preferredWidth:n=`max-w-md`,ref:r,...i})=>_(w,{children:[g(T,{}),g(`div`,{className:`fixed inset-4 z-50 flex items-center justify-center`,children:g(s,{"data-slot":`alert-dialog-content`,"data-mantle-modal-content":!0,ref:r,className: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 transition-transform duration-200`,`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`,n,t),...i})})]}),D=({asChild:t=!1,className:r,ref:i,...a})=>g(t?n:`div`,{"data-slot":`alert-dialog-body`,className:e(`flex-1 space-y-4`,r),ref:i,...a}),O=({asChild:t=!1,className:r,ref:i,...a})=>g(t?n:`div`,{"data-slot":`alert-dialog-header`,className:e(`flex flex-col space-y-2 text-center sm:text-start`,r),ref:i,...a}),k=({asChild:t=!1,className:r,ref:i,...a})=>g(t?n:`div`,{"data-slot":`alert-dialog-footer`,className:e(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,r),ref:i,...a}),A=({className:t,ref:n,...r})=>g(u,{ref:n,"data-slot":`alert-dialog-title`,className:e(`text-strong text-center text-lg font-medium sm:text-start`,t),...r}),j=({className:t,ref:n,...r})=>g(l,{ref:n,"data-slot":`alert-dialog-description`,className:e(`text-body text-center text-sm font-normal sm:text-start`,t),...r}),M={danger:`danger`,info:`neutral`},N=({appearance:e=`filled`,intent:t,ref:n,...i})=>{let a=x(),o=M[a.intent];return g(r,{appearance:e,"data-slot":`alert-dialog-action`,intent:t??o,ref:n,...i})},P=({appearance:t=`outlined`,className:n,intent:i=`neutral`,ref:a,...o})=>g(d,{asChild:!0,children:g(r,{appearance:t,"data-slot":`alert-dialog-cancel`,className:e(`mt-2 sm:mt-0`,n),intent:i,ref:a,...o})}),F={danger:g(y,{}),info:g(v,{})},I={danger:`text-danger-600`,info:`text-accent-600`},L={Root:S,Action:N,Body:D,Cancel:P,Close:({ref:e,...t})=>g(d,{ref:e,"data-slot":`alert-dialog-close`,...t}),Content:E,Description:j,Footer:k,Header:O,Icon:({className:n,ref:r,svg:i,...a})=>{let o=x(),s=I[o.intent],c=F[o.intent];return g(t,{ref:r,"data-slot":`alert-dialog-icon`,className:e(`size-12 sm:size-7`,s,n),svg:i??c,...a})},Title:A,Trigger:C};export{L as AlertDialog};
@@ -1 +1 @@
1
- import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-d-nMCfAI.js";import{t as n}from"./slot-Dpsqz16D.js";import{t as r}from"./types-D85fCNV3.js";import{t as i}from"./button-BUospUB3.js";import{t as a}from"./button-C0S8RbaJ.js";import{CaretDownIcon as o}from"@phosphor-icons/react/CaretDown";import{createContext as s,useContext as c,useMemo as l}from"react";import u from"tiny-invariant";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{CheckCircleIcon as p}from"@phosphor-icons/react/CheckCircle";import{InfoIcon as m}from"@phosphor-icons/react/Info";import{MegaphoneIcon as h}from"@phosphor-icons/react/Megaphone";import{WarningIcon as g}from"@phosphor-icons/react/Warning";import{WarningDiamondIcon as _}from"@phosphor-icons/react/WarningDiamond";import{XIcon as v}from"@phosphor-icons/react/X";import{cva as y}from"class-variance-authority";const b=s(null),x=d(v,{});function S(){let e=c(b);return u(e,`useAlertContext hook used outside of Alert parent!`),e}const C=({children:e,intent:t})=>{let n=l(()=>({intent:t}),[t]);return d(b.Provider,{value:n,children:e})},w=y(`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:``}}}),T=({appearance:t=`default`,className:n,intent:i,ref:a,style:o,...s})=>d(C,{intent:i,children:d(`div`,{ref:a,"data-slot":`alert`,className:e(w({appearance:t,intent:i}),`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]`,n),style:r({"--alert-control-color":j(i),"--alert-control-hover-color":M(i),"--alert-control-hover-bg":N(i),...o}),...s})}),E={danger:d(g,{}),important:d(h,{mirrored:!0}),info:d(m,{}),success:d(p,{}),warning:d(_,{})},D=({className:n,ref:r,svg:i,...a})=>{let o=S(),s=E[o.intent];return d(t,{ref:r,"data-slot":`alert-icon`,className:e(`size-5`,n),svg:i??s,...a})},O=({className:t,ref:n,...r})=>d(`div`,{ref:n,"data-slot":`alert-content`,className:e(`min-w-0 flex-1 has-data-alert-dismiss:pr-6`,t),...r}),k=({asChild:t=!1,className:r,ref:i,...a})=>d(t?n:`h5`,{ref:i,"data-slot":`alert-title`,className:e(`font-medium`,r),...a}),A=({asChild:t=!1,className:r,ref:i,...a})=>d(t?n:`div`,{ref:i,"data-slot":`alert-description`,className:e(`text-sm`,r),...a}),j=e=>`var(--color-${e}-700)`,M=e=>`var(--color-${e}-800)`,N=e=>`color-mix(in oklab, var(--color-${e}-500) 10%, transparent)`,P={Root:T,Content:O,ExpandButton:({count:t,expanded:n,className:r,...a})=>f(i,{type:`button`,appearance:`ghost`,intent:`neutral`,size:`sm`,"aria-expanded":n,"aria-label":n?`Collapse additional alerts`:`Show ${t} more ${t===1?`alert`:`alerts`}`,"data-slot":`alert-expand-button`,"data-alert-expand":!0,className:e(`right-1.5 top-1.5 absolute gap-1 px-1.5`,`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)]`,r),...a,children:[f(`span`,{className:`min-w-[2ch] text-center tabular-nums`,children:[`+`,t]}),d(`span`,{className:`hidden md:inline`,children:`more`}),d(o,{weight:`bold`,className:e(`size-4 transition-transform ease-out duration-150`,n&&`-rotate-180`)})]}),Description:A,DismissIconButton:({size:t=`sm`,type:n=`button`,label:r=`Dismiss Alert`,appearance:i=`ghost`,className:o,icon:s=x,...c})=>d(a,{appearance:i,icon:s,intent:`neutral`,label:r,size:t,"data-slot":`alert-dismiss-icon-button`,"data-alert-dismiss":!0,className:e(`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)]`,o),type:n,...c}),Icon:D,Title:k};export{C as n,P as t};
1
+ import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-d-nMCfAI.js";import{t as n}from"./slot-DpNWVci8.js";import{t as r}from"./types-D85fCNV3.js";import{t as i}from"./button-Cnja9Bsr.js";import{t as a}from"./button-IlxHhjPK.js";import{CaretDownIcon as o}from"@phosphor-icons/react/CaretDown";import{createContext as s,useContext as c,useMemo as l}from"react";import u from"tiny-invariant";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{CheckCircleIcon as p}from"@phosphor-icons/react/CheckCircle";import{InfoIcon as m}from"@phosphor-icons/react/Info";import{MegaphoneIcon as h}from"@phosphor-icons/react/Megaphone";import{WarningIcon as g}from"@phosphor-icons/react/Warning";import{WarningDiamondIcon as _}from"@phosphor-icons/react/WarningDiamond";import{XIcon as v}from"@phosphor-icons/react/X";import{cva as y}from"class-variance-authority";const b=s(null),x=d(v,{});function S(){let e=c(b);return u(e,`useAlertContext hook used outside of Alert parent!`),e}const C=({children:e,intent:t})=>{let n=l(()=>({intent:t}),[t]);return d(b.Provider,{value:n,children:e})},w=y(`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:``}}}),T=({appearance:t=`default`,className:n,intent:i,ref:a,style:o,...s})=>d(C,{intent:i,children:d(`div`,{ref:a,"data-slot":`alert`,className:e(w({appearance:t,intent:i}),`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]`,n),style:r({"--alert-control-color":j(i),"--alert-control-hover-color":M(i),"--alert-control-hover-bg":N(i),...o}),...s})}),E={danger:d(g,{}),important:d(h,{mirrored:!0}),info:d(m,{}),success:d(p,{}),warning:d(_,{})},D=({className:n,ref:r,svg:i,...a})=>{let o=S(),s=E[o.intent];return d(t,{ref:r,"data-slot":`alert-icon`,className:e(`size-5`,n),svg:i??s,...a})},O=({className:t,ref:n,...r})=>d(`div`,{ref:n,"data-slot":`alert-content`,className:e(`min-w-0 flex-1 has-data-alert-dismiss:pr-6`,t),...r}),k=({asChild:t=!1,className:r,ref:i,...a})=>d(t?n:`h5`,{ref:i,"data-slot":`alert-title`,className:e(`font-medium`,r),...a}),A=({asChild:t=!1,className:r,ref:i,...a})=>d(t?n:`div`,{ref:i,"data-slot":`alert-description`,className:e(`text-sm`,r),...a}),j=e=>`var(--color-${e}-700)`,M=e=>`var(--color-${e}-800)`,N=e=>`color-mix(in oklab, var(--color-${e}-500) 10%, transparent)`,P={Root:T,Content:O,ExpandButton:({count:t,expanded:n,className:r,...a})=>f(i,{type:`button`,appearance:`ghost`,intent:`neutral`,size:`sm`,"aria-expanded":n,"aria-label":n?`Collapse additional alerts`:`Show ${t} more ${t===1?`alert`:`alerts`}`,"data-slot":`alert-expand-button`,"data-alert-expand":!0,className:e(`right-1.5 top-1.5 absolute gap-1 px-1.5`,`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)]`,r),...a,children:[f(`span`,{className:`min-w-[2ch] text-center tabular-nums`,children:[`+`,t]}),d(`span`,{className:`hidden md:inline`,children:`more`}),d(o,{weight:`bold`,className:e(`size-4 transition-transform ease-out duration-150`,n&&`-rotate-180`)})]}),Description:A,DismissIconButton:({size:t=`sm`,type:n=`button`,label:r=`Dismiss Alert`,appearance:i=`ghost`,className:o,icon:s=x,...c})=>d(a,{appearance:i,icon:s,intent:`neutral`,label:r,size:t,"data-slot":`alert-dismiss-icon-button`,"data-alert-dismiss":!0,className:e(`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)]`,o),type:n,...c}),Icon:D,Title:k};export{C as n,P as t};
package/dist/alert.js CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./alert-QMs0PqMq.js";export{e as Alert};
1
+ import{t as e}from"./alert-vwFd7qdp.js";export{e as Alert};
@@ -1 +1 @@
1
- import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-lZ48P8Nn.js";import{t as n}from"./slot-Dpsqz16D.js";import{Children as r,cloneElement as i,isValidElement as a}from"react";import o from"tiny-invariant";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";const u=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),d=({asChild:e,children:d,className:p,rel:m,icon:h,iconPlacement:g=`start`,ref:_,...v})=>{let y=f(m),b={"data-slot":`anchor`,className:u(p),ref:_,rel:y,...v};if(e){let e=r.only(d);o(a(e),"When using `asChild`, Anchor must be passed a single child as a JSX tag.");let u=e.props?.children;return c(n,{...b,children:i(e,{},l(s,{children:[h&&g===`start`&&c(t,{className:`inline-block mr-1.5`,svg:h}),u,h&&g===`end`&&c(t,{className:`inline-block ml-1.5`,svg:h})]}))})}return l(`a`,{...b,children:[h&&g===`start`&&c(t,{className:`inline-block mr-1.5`,svg:h}),d,h&&g===`end`&&c(t,{className:`inline-block ml-1.5`,svg:h})]})};function f(e){return Array.isArray(e)?[...new Set(e)].map(e=>e?.trim()).filter(Boolean).toSorted().join(` `)||void 0:e?.trim()||void 0}export{u as n,f as r,d as t};
1
+ import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-lZ48P8Nn.js";import{t as n}from"./slot-DpNWVci8.js";import{Children as r,cloneElement as i,isValidElement as a}from"react";import o from"tiny-invariant";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";const u=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),d=({asChild:e,children:d,className:p,rel:m,icon:h,iconPlacement:g=`start`,ref:_,...v})=>{let y=f(m),b={"data-slot":`anchor`,className:u(p),ref:_,rel:y,...v};if(e){let e=r.only(d);o(a(e),"When using `asChild`, Anchor must be passed a single child as a JSX tag.");let u=e.props?.children;return c(n,{...b,children:i(e,{},l(s,{children:[h&&g===`start`&&c(t,{className:`inline-block mr-1.5`,svg:h}),u,h&&g===`end`&&c(t,{className:`inline-block ml-1.5`,svg:h})]}))})}return l(`a`,{...b,children:[h&&g===`start`&&c(t,{className:`inline-block mr-1.5`,svg:h}),d,h&&g===`end`&&c(t,{className:`inline-block ml-1.5`,svg:h})]})};function f(e){return Array.isArray(e)?[...new Set(e)].map(e=>e?.trim()).filter(Boolean).toSorted().join(` `)||void 0:e?.trim()||void 0}export{u as n,f as r,d as t};
package/dist/anchor.js CHANGED
@@ -1 +1 @@
1
- import{n as e,r as t,t as n}from"./anchor-DvbNsphX.js";export{n as Anchor,e as anchorClassNames,t as resolveRel};
1
+ import{n as e,r as t,t as n}from"./anchor-3OGK2UKU.js";export{n as Anchor,e as anchorClassNames,t as resolveRel};