@ngrok/mantle 0.82.0 → 0.83.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.
Files changed (175) hide show
  1. package/dist/accordion.d.ts +7 -7
  2. package/dist/accordion.js +1 -1
  3. package/dist/agent.json +3 -1
  4. package/dist/{alert-BWwNPOMI.d.ts → alert-B1HXfkYn.d.ts} +9 -7
  5. package/dist/{alert-QMs0PqMq.js → alert-BuG2qS5l.js} +1 -1
  6. package/dist/alert-center.d.ts +220 -22
  7. package/dist/alert-center.js +1 -1
  8. package/dist/alert-dialog.d.ts +18 -18
  9. package/dist/alert-dialog.js +1 -1
  10. package/dist/alert.d.ts +1 -1
  11. package/dist/alert.js +1 -1
  12. package/dist/{anchor-DvbNsphX.js → anchor-3OGK2UKU.js} +1 -1
  13. package/dist/anchor.d.ts +2 -2
  14. package/dist/anchor.js +1 -1
  15. package/dist/app-layout.d.ts +296 -213
  16. package/dist/app-layout.js +1 -1
  17. package/dist/area-chart.d.ts +67 -19
  18. package/dist/area-chart.js +1 -1
  19. package/dist/avatar.d.ts +319 -0
  20. package/dist/avatar.js +1 -0
  21. package/dist/badge.js +1 -1
  22. package/dist/bar-chart.d.ts +73 -20
  23. package/dist/bar-chart.js +1 -1
  24. package/dist/breadcrumb.d.ts +50 -17
  25. package/dist/breadcrumb.js +1 -1
  26. package/dist/browser-only.d.ts +3 -3
  27. package/dist/{button-C-gMbPso.d.ts → button-BIf69CSV.d.ts} +2 -2
  28. package/dist/button-BLDjW1u9.js +1 -0
  29. package/dist/{button-C0S8RbaJ.js → button-CCkGqE1t.js} +1 -1
  30. package/dist/{button-BUospUB3.js → button-Cnja9Bsr.js} +1 -1
  31. package/dist/{button-C7vAl6lS.d.ts → button-DJ7AAgII.d.ts} +4 -6
  32. package/dist/{button-BO2CKsz6.js → button-DmJkYfyl.js} +1 -1
  33. package/dist/{button-DARFK2KJ.d.ts → button-PoIujPMX.d.ts} +2 -2
  34. package/dist/button.d.ts +3 -3
  35. package/dist/button.js +1 -1
  36. package/dist/calendar.d.ts +1 -1
  37. package/dist/calendar.js +1 -1
  38. package/dist/card.d.ts +15 -15
  39. package/dist/card.js +1 -1
  40. package/dist/centered-layout.js +1 -1
  41. package/dist/{chart-1cVjAcj8.d.ts → chart-0zcFJh4n.d.ts} +75 -22
  42. package/dist/chart-DBxT9BNl.js +2 -0
  43. package/dist/{choice-BNRQXszu.d.ts → choice-CVdQrs-m.d.ts} +118 -6
  44. package/dist/{choice-C9gLKECf.js → choice-CnwfjSEu.js} +1 -1
  45. package/dist/choice.d.ts +1 -1
  46. package/dist/choice.js +1 -1
  47. package/dist/{code-block-C9uaM9-V.js → code-block-CIE0F2fu.js} +1 -1
  48. package/dist/{code-block-B6OlZrSI.d.ts → code-block-CZWPrV4k.d.ts} +3 -3
  49. package/dist/code-block.d.ts +10 -7
  50. package/dist/code-block.js +2 -2
  51. package/dist/code-block_highlight-utils.d.ts +1 -1
  52. package/dist/code-block_highlight-utils.js +1 -1
  53. package/dist/code.js +1 -1
  54. package/dist/combobox.d.ts +8 -9
  55. package/dist/combobox.js +1 -1
  56. package/dist/command.d.ts +668 -106
  57. package/dist/command.js +1 -1
  58. package/dist/cookie-ca4g5CKp.js +1 -0
  59. package/dist/data-table.d.ts +6 -6
  60. package/dist/data-table.js +1 -1
  61. package/dist/description-list.js +1 -1
  62. package/dist/dialog-02mNrAT1.d.ts +806 -0
  63. package/dist/{dialog-Bsj_dX6r.js → dialog-BRjTD83p.js} +1 -1
  64. package/dist/dialog.d.ts +2 -805
  65. package/dist/dialog.js +1 -1
  66. package/dist/{dropdown-menu-fUMqjRC0.js → dropdown-menu-BRH0Wd_z.js} +1 -1
  67. package/dist/dropdown-menu-BcALUQMp.d.ts +1 -0
  68. package/dist/{dropdown-menu-D6pMAY7I.d.ts → dropdown-menu-DZOfj6HB.d.ts} +1 -1
  69. package/dist/dropdown-menu.d.ts +2 -2
  70. package/dist/dropdown-menu.js +1 -1
  71. package/dist/empty.js +1 -1
  72. package/dist/field.d.ts +5 -5
  73. package/dist/field.js +1 -1
  74. package/dist/flag.js +1 -1
  75. package/dist/hooks.d.ts +16 -17
  76. package/dist/hooks.js +1 -1
  77. package/dist/icons-DEVx1oP9.js +1 -0
  78. package/dist/icons.d.ts +7 -6
  79. package/dist/icons.js +1 -1
  80. package/dist/{in-view-DDEGUKDR.d.ts → in-view-gxyc9Q1_.d.ts} +1 -1
  81. package/dist/{input-BuYDU6CF.d.ts → input-DpnC3Xgj.d.ts} +2 -2
  82. package/dist/input.d.ts +1 -1
  83. package/dist/kbd.d.ts +1 -1
  84. package/dist/line-chart.d.ts +60 -13
  85. package/dist/line-chart.js +1 -1
  86. package/dist/list-CwL23L_B.js +1 -0
  87. package/dist/list.d.ts +2 -2
  88. package/dist/list.js +1 -1
  89. package/dist/llms.txt +3 -1
  90. package/dist/main.d.ts +32 -1
  91. package/dist/mantle-dark-high-contrast.css +30 -17
  92. package/dist/mantle-dark.css +48 -13
  93. package/dist/mantle-light-high-contrast.css +33 -15
  94. package/dist/mantle.css +436 -26
  95. package/dist/media-object.d.ts +5 -1
  96. package/dist/media-object.js +1 -1
  97. package/dist/multi-select.d.ts +7 -7
  98. package/dist/multi-select.js +1 -1
  99. package/dist/otp-input.d.ts +4 -4
  100. package/dist/otp-input.js +1 -1
  101. package/dist/pagination.d.ts +2 -2
  102. package/dist/pagination.js +1 -1
  103. package/dist/{primitive-Dv-3snU3.js → primitive-D-9GIFWb.js} +1 -1
  104. package/dist/progress.d.ts +4 -4
  105. package/dist/qr-code.d.ts +2 -2
  106. package/dist/qr-code.js +1 -1
  107. package/dist/radio-group.js +1 -1
  108. package/dist/sandbar.d.ts +471 -0
  109. package/dist/sandbar.js +1 -0
  110. package/dist/sandboxed-on-click.d.ts +4 -6
  111. package/dist/sandboxed-on-click.js +1 -1
  112. package/dist/scatter-plot.d.ts +69 -24
  113. package/dist/scatter-plot.js +1 -1
  114. package/dist/{select-0z7HVS6r.d.ts → select-DVHmgih8.d.ts} +13 -7
  115. package/dist/select-LK9NX-vV.js +1 -0
  116. package/dist/select.d.ts +1 -1
  117. package/dist/select.js +1 -1
  118. package/dist/selectable-list.d.ts +4 -4
  119. package/dist/selectable-list.js +1 -1
  120. package/dist/{separator-B5UmkVRL.d.ts → separator-CNDs98Dv.d.ts} +2 -2
  121. package/dist/{separator-BepAcFFy.js → separator-D0D6VyyM.js} +1 -1
  122. package/dist/separator.d.ts +1 -1
  123. package/dist/separator.js +1 -1
  124. package/dist/{sheet-_fXLjiq2.js → sheet-BOSknSN9.js} +1 -1
  125. package/dist/sheet.d.ts +1 -1
  126. package/dist/sheet.js +1 -1
  127. package/dist/sidebar.d.ts +783 -328
  128. package/dist/sidebar.js +1 -1
  129. package/dist/{skeleton-DsHXIa9j.js → skeleton-BhcJMpem.js} +1 -1
  130. package/dist/skeleton.js +1 -1
  131. package/dist/skip-to-main-link.js +1 -1
  132. package/dist/slider.d.ts +1 -1
  133. package/dist/slot-DdgxmuI5.d.ts +67 -0
  134. package/dist/slot-DpNWVci8.js +1 -0
  135. package/dist/slot.d.ts +1 -1
  136. package/dist/slot.js +1 -1
  137. package/dist/split-button.d.ts +12 -12
  138. package/dist/split-button.js +1 -1
  139. package/dist/switch.d.ts +2 -1
  140. package/dist/{table-CGxJwtbL.js → table-C_Nm_RSV.js} +1 -1
  141. package/dist/{table-CZBYEmyK.d.ts → table-D51ZtV4U.d.ts} +18 -8
  142. package/dist/table.d.ts +1 -1
  143. package/dist/table.js +1 -1
  144. package/dist/tabs.d.ts +8 -13
  145. package/dist/tabs.js +1 -1
  146. package/dist/{theme-FbfjYiD3.d.ts → theme-6OxNhf6l.d.ts} +6 -6
  147. package/dist/theme-CVfq037P.js +1 -0
  148. package/dist/theme-switcher.d.ts +4 -4
  149. package/dist/theme-switcher.js +1 -1
  150. package/dist/theme.d.ts +86 -23
  151. package/dist/theme.js +1 -1
  152. package/dist/toast.d.ts +9 -9
  153. package/dist/toast.js +1 -1
  154. package/dist/tooltip-Dnu35cjU.js +1 -0
  155. package/dist/tooltip-DuXGxIse.d.ts +220 -0
  156. package/dist/tooltip.d.ts +1 -217
  157. package/dist/tooltip.js +1 -1
  158. package/dist/use-breakpoint-Dqu12Szq.js +1 -0
  159. package/dist/use-callback-ref-IYti9y7x.js +1 -0
  160. package/dist/use-is-apple-platform-Cxwrb86L.js +1 -0
  161. package/dist/use-matches-media-query-Bd_GhhVd.js +1 -0
  162. package/dist/utils.d.ts +1 -1
  163. package/dist/well.js +1 -1
  164. package/package.json +4 -2
  165. package/dist/button-DvHMWAPl.js +0 -1
  166. package/dist/chart-DdBQ3xwx.js +0 -2
  167. package/dist/dropdown-menu-BbbQuae2.d.ts +0 -1
  168. package/dist/icons-CPbOq7cF.js +0 -1
  169. package/dist/list-CQFWx6Z8.js +0 -1
  170. package/dist/select-B-9yWrif.js +0 -1
  171. package/dist/slot-BtwKJTLq.d.ts +0 -25
  172. package/dist/slot-Dpsqz16D.js +0 -1
  173. package/dist/theme-IAnQ35bd.js +0 -1
  174. package/dist/use-breakpoint-Wd7_5-Mu.js +0 -1
  175. package/dist/use-matches-media-query-CMSxHR9n.js +0 -1
@@ -59,7 +59,7 @@ type AccordionMultipleProps = {
59
59
  type AccordionRootProps = (AccordionSingleProps | AccordionMultipleProps) & Omit<ComponentProps<"div">, "defaultValue"> & WithAsChild;
60
60
  /**
61
61
  * A vertically stacked set of disclosure sections. The root owns the open/closed
62
- * state and provides it to its items.
62
+ * state and passes it to its items.
63
63
  *
64
64
  * Built without a UI framework's collapsible: each section's collapsed content
65
65
  * stays in the DOM with `hidden="until-found"`, so the browser's find-in-page
@@ -73,10 +73,10 @@ type AccordionRootProps = (AccordionSingleProps | AccordionMultipleProps) & Omit
73
73
  * the classic accordion where opening a section auto-closes the previously open
74
74
  * one.
75
75
  *
76
- * Items are separated by a hairline divider drawn with `divide-y` on the root,
77
- * colored with the shared `separator` token so it matches `Separator` and every
78
- * other divider in the system. Disable the dividers with `divide-y-0` on the root
79
- * (e.g. pair it with `space-y-*` for a spaced-card layout).
76
+ * `divide-y` on the root draws a hairline divider between items. The shared
77
+ * `separator` token colors it, so it matches `Separator` and every other divider
78
+ * in the system. Disable the dividers with `divide-y-0` on the root (e.g. pair it
79
+ * with `space-y-*` for a spaced-card layout).
80
80
  *
81
81
  * @see https://mantle.ngrok.com/components/data-display/accordion#accordionroot
82
82
  *
@@ -99,7 +99,7 @@ declare const Root: (props: AccordionRootProps) => import("react").JSX.Element;
99
99
  * same accessibility role the browser gives a native `<details>`. Derives its
100
100
  * open state from {@link Root}.
101
101
  *
102
- * Because the item is just a `<div>`, its header can be any layout — e.g. a flex
102
+ * Because the item is a plain `<div>`, its header can be any layout — e.g. a flex
103
103
  * row with the {@link Trigger} alongside a separate, non-toggling action button.
104
104
  *
105
105
  * @see https://mantle.ngrok.com/components/data-display/accordion#accordionitem
@@ -123,7 +123,7 @@ declare const Item: ({ children, value, ref, ...props }: ComponentProps<"div"> &
123
123
  }) => import("react").JSX.Element;
124
124
  /**
125
125
  * The interactive header that toggles its section, rendered as a `<button>` with
126
- * `aria-expanded` — the disclosure semantics a native `<summary>` provides, but
126
+ * `aria-expanded` — the disclosure semantics a native `<summary>` carries, but
127
127
  * via a real button so the role is consistent across browsers (native summary's
128
128
  * role varies). Place the {@link TriggerIcon} as the last child so the default
129
129
  * `justify-between` layout pushes it to the trailing edge.
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.83.0",
4
4
  "origin": "https://mantle.ngrok.com",
5
5
  "endpoints": {
6
6
  "docs": "https://mantle.ngrok.com/",
@@ -23,6 +23,7 @@
23
23
  "@ngrok/mantle/anchor",
24
24
  "@ngrok/mantle/app-layout",
25
25
  "@ngrok/mantle/area-chart",
26
+ "@ngrok/mantle/avatar",
26
27
  "@ngrok/mantle/badge",
27
28
  "@ngrok/mantle/bar-chart",
28
29
  "@ngrok/mantle/breadcrumb",
@@ -65,6 +66,7 @@
65
66
  "@ngrok/mantle/progress",
66
67
  "@ngrok/mantle/qr-code",
67
68
  "@ngrok/mantle/radio-group",
69
+ "@ngrok/mantle/sandbar",
68
70
  "@ngrok/mantle/sandboxed-on-click",
69
71
  "@ngrok/mantle/scatter-plot",
70
72
  "@ngrok/mantle/select",
@@ -1,7 +1,7 @@
1
1
  import { n as WithAsChild } from "./as-child-D23mGo4f.js";
2
2
  import { t as SvgAttributes } from "./icon-D1RY5Tcj.js";
3
- import { r as ButtonProps } from "./button-DARFK2KJ.js";
4
- import { n as IconButtonProps, r as IconButtonAppearance } from "./button-C7vAl6lS.js";
3
+ import { r as ButtonProps } from "./button-PoIujPMX.js";
4
+ import { n as IconButtonProps, r as IconButtonAppearance } from "./button-DJ7AAgII.js";
5
5
  import { ComponentProps, ReactNode } from "react";
6
6
  //#region src/components/alert/alert.d.ts
7
7
  declare const intents: readonly ["danger", "important", "info", "success", "warning"];
@@ -16,7 +16,7 @@ type AlertProps = ComponentProps<"div"> & {
16
16
  intent: AlertIntent;
17
17
  /**
18
18
  * Controls the visual style of the Alert.
19
- * - "default" provides standard rounded corners and borders.
19
+ * - "default" keeps the standard rounded corners and borders.
20
20
  * - "banner" creates a banner-style alert with no rounded corners, sticky positioning, and no left/right borders.
21
21
  *
22
22
  * @default "default"
@@ -59,9 +59,9 @@ type AlertIconProps = Omit<SvgAttributes, "children"> & {
59
59
  svg?: ReactNode;
60
60
  };
61
61
  /**
62
- * An optional icon that visually represents the intent of the Alert.
62
+ * An optional icon that visually represents the intent of the `Alert`.
63
63
  *
64
- * The default rendered icon be overridden with a custom icon using the `svg` prop.
64
+ * Pass the `svg` prop to replace the default icon.
65
65
  *
66
66
  * @see https://mantle.ngrok.com/components/feedback/alert#alerticon
67
67
  *
@@ -327,7 +327,7 @@ declare const Alert: {
327
327
  */
328
328
  readonly Description: typeof Description;
329
329
  /**
330
- * An optional dismiss button that can be used to close the alert.
330
+ * An optional, compact, trailing control for dismissing an alert.
331
331
  * It inherits the `--alert-control-color`, `--alert-control-hover-color`, and
332
332
  * `--alert-control-hover-bg` variables from `Alert.Root`, shared with the
333
333
  * expand control.
@@ -349,7 +349,9 @@ declare const Alert: {
349
349
  */
350
350
  readonly DismissIconButton: typeof DismissIconButton;
351
351
  /**
352
- * An optional icon that visually represents the intent of the Alert.
352
+ * An optional icon that visually represents the intent of the `Alert`.
353
+ *
354
+ * Pass the `svg` prop to replace the default icon.
353
355
  *
354
356
  * @see https://mantle.ngrok.com/components/feedback/alert#alerticon
355
357
  *
@@ -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-CCkGqE1t.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,4 +1,5 @@
1
- import { t as Alert } from "./alert-BWwNPOMI.js";
1
+ import { t as WithDataSlot } from "./data-slot-CChfb_cv.js";
2
+ import { t as Alert } from "./alert-B1HXfkYn.js";
2
3
  import { ComponentProps, ReactNode } from "react";
3
4
  //#region src/components/alert-center/alert-center.d.ts
4
5
  /**
@@ -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
  /**
@@ -112,7 +130,7 @@ type AlertCenterItemProps = {
112
130
  /**
113
131
  * The banner content: compose `Alert.Icon`, `Alert.Content`, `Alert.Title`,
114
132
  * `Alert.Description`, and `AlertCenter.DismissIconButton`. Do NOT include
115
- * `Alert.Root` — the center provides the chrome (with this item's `intent`)
133
+ * `Alert.Root` — the center renders the chrome (with this item's `intent`)
116
134
  * at whichever placement the item ranks into.
117
135
  */
118
136
  children: ReactNode;
@@ -122,7 +140,7 @@ type AlertCenterItemProps = {
122
140
  * with the center and renders its children through a portal into a stable
123
141
  * per-id host element that `AlertCenter.Bar` / `AlertCenter.Content`
124
142
  * physically adopt into their chrome. Mount it to show the alert, unmount it
125
- * to remove it — dismissal is just your state flipping the condition off.
143
+ * to remove it — dismissal is your state flipping the condition off.
126
144
  *
127
145
  * Because the children stay in YOUR React tree (only their DOM lands in the
128
146
  * chrome), context providers and error boundaries around the item work, and
@@ -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-BuG2qS5l.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),n=h(e.subscribe,e.getTopLabel,e.getTopLabel);return _(`div`,{"data-slot":`alert-center-announcer`,className:`sr-only`,role:`status`,"aria-live":`polite`,children:T(n,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`),s=c(N);g(!s,`AlertCenter.Item cannot be rendered inside another item's children.`);let[l,u]=m(null);return e(()=>{u(o.getHost(r))},[o,r]),e(()=>o.register({id:r,intent:a,className:n}),[o,r,a,n]),e(()=>{o.captureHostSnapshot(r)}),l==null?null:y(_(i,{intent:a,children:_(N.Provider,{value:!0,children:t})}),l)},L=({"data-slot":n,label:i,ref:o,...s})=>{let l=c(N);g(l,`AlertCenter.DismissIconButton must be composed inside an <AlertCenter.Item>'s children.`);let{store:u}=A(`AlertCenter.DismissIconButton`);h(u.subscribe,u.getPlacementVersion,u.getPlacementVersion);let d=p(null),f=t(d,o),[v,y]=m(null);return e(()=>{if(i!=null)return;let e=d.current?.closest(`[data-alert-id]`),t=e==null?``:C(e);y(t===``?null:`Dismiss ${t}`)}),_(a.DismissIconButton,{ref:f,label:i??v??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};