@mortenbrudvik/waveui 0.4.0 → 0.7.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 (574) hide show
  1. package/README.md +1221 -173
  2. package/dist/_virtual/_rolldown/runtime.cjs +1 -0
  3. package/dist/components/button/Button.cjs +2 -0
  4. package/dist/components/button/Button.cjs.map +1 -0
  5. package/dist/components/button/Button.mjs +50 -0
  6. package/dist/components/button/Button.mjs.map +1 -0
  7. package/dist/components/button/Button.semantics.cjs +2 -0
  8. package/dist/components/button/Button.semantics.cjs.map +1 -0
  9. package/dist/components/button/Button.semantics.mjs +61 -0
  10. package/dist/components/button/Button.semantics.mjs.map +1 -0
  11. package/dist/components/button/Button.slots.cjs +2 -0
  12. package/dist/components/button/Button.slots.cjs.map +1 -0
  13. package/dist/components/button/Button.slots.mjs +47 -0
  14. package/dist/components/button/Button.slots.mjs.map +1 -0
  15. package/dist/components/button/CompoundButton.cjs +2 -0
  16. package/dist/components/button/CompoundButton.cjs.map +1 -0
  17. package/dist/components/button/CompoundButton.mjs +53 -0
  18. package/dist/components/button/CompoundButton.mjs.map +1 -0
  19. package/dist/components/button/Link.cjs +2 -0
  20. package/dist/components/button/Link.cjs.map +1 -0
  21. package/dist/components/button/Link.mjs +37 -0
  22. package/dist/components/button/Link.mjs.map +1 -0
  23. package/dist/components/button/MenuButton.cjs +2 -0
  24. package/dist/components/button/MenuButton.cjs.map +1 -0
  25. package/dist/components/button/MenuButton.mjs +45 -0
  26. package/dist/components/button/MenuButton.mjs.map +1 -0
  27. package/dist/components/button/SplitButton.cjs +2 -0
  28. package/dist/components/button/SplitButton.cjs.map +1 -0
  29. package/dist/components/button/SplitButton.mjs +66 -0
  30. package/dist/components/button/SplitButton.mjs.map +1 -0
  31. package/dist/components/button/ToggleButton.cjs +2 -0
  32. package/dist/components/button/ToggleButton.cjs.map +1 -0
  33. package/dist/components/button/ToggleButton.mjs +65 -0
  34. package/dist/components/button/ToggleButton.mjs.map +1 -0
  35. package/dist/components/button/Toolbar.cjs +2 -0
  36. package/dist/components/button/Toolbar.cjs.map +1 -0
  37. package/dist/components/button/Toolbar.context.cjs +2 -0
  38. package/dist/components/button/Toolbar.context.cjs.map +1 -0
  39. package/dist/components/button/Toolbar.context.mjs +31 -0
  40. package/dist/components/button/Toolbar.context.mjs.map +1 -0
  41. package/dist/components/button/Toolbar.mjs +63 -0
  42. package/dist/components/button/Toolbar.mjs.map +1 -0
  43. package/dist/components/button/Toolbar.parts.cjs +2 -0
  44. package/dist/components/button/Toolbar.parts.cjs.map +1 -0
  45. package/dist/components/button/Toolbar.parts.mjs +131 -0
  46. package/dist/components/button/Toolbar.parts.mjs.map +1 -0
  47. package/dist/components/button/buttonStyles.cjs +2 -0
  48. package/dist/components/button/buttonStyles.cjs.map +1 -0
  49. package/dist/components/button/buttonStyles.mjs +39 -0
  50. package/dist/components/button/buttonStyles.mjs.map +1 -0
  51. package/dist/components/data-display/Avatar.cjs +2 -0
  52. package/dist/components/data-display/Avatar.cjs.map +1 -0
  53. package/dist/components/data-display/Avatar.mjs +157 -0
  54. package/dist/components/data-display/Avatar.mjs.map +1 -0
  55. package/dist/components/data-display/AvatarGroup.cjs +2 -0
  56. package/dist/components/data-display/AvatarGroup.cjs.map +1 -0
  57. package/dist/components/data-display/AvatarGroup.mjs +134 -0
  58. package/dist/components/data-display/AvatarGroup.mjs.map +1 -0
  59. package/dist/components/data-display/Badge.cjs +2 -0
  60. package/dist/components/data-display/Badge.cjs.map +1 -0
  61. package/dist/components/data-display/Badge.colors.cjs +2 -0
  62. package/dist/components/data-display/Badge.colors.cjs.map +1 -0
  63. package/dist/components/data-display/Badge.colors.mjs +58 -0
  64. package/dist/components/data-display/Badge.colors.mjs.map +1 -0
  65. package/dist/components/data-display/Badge.mjs +32 -0
  66. package/dist/components/data-display/Badge.mjs.map +1 -0
  67. package/dist/components/data-display/CounterBadge.cjs +2 -0
  68. package/dist/components/data-display/CounterBadge.cjs.map +1 -0
  69. package/dist/components/data-display/CounterBadge.mjs +28 -0
  70. package/dist/components/data-display/CounterBadge.mjs.map +1 -0
  71. package/dist/components/data-display/Divider.cjs +2 -0
  72. package/dist/components/data-display/Divider.cjs.map +1 -0
  73. package/dist/components/data-display/Divider.mjs +52 -0
  74. package/dist/components/data-display/Divider.mjs.map +1 -0
  75. package/dist/components/data-display/Image.cjs +2 -0
  76. package/dist/components/data-display/Image.cjs.map +1 -0
  77. package/dist/components/data-display/Image.mjs +32 -0
  78. package/dist/components/data-display/Image.mjs.map +1 -0
  79. package/dist/components/data-display/InfoLabel.cjs +2 -0
  80. package/dist/components/data-display/InfoLabel.cjs.map +1 -0
  81. package/dist/components/data-display/InfoLabel.mjs +104 -0
  82. package/dist/components/data-display/InfoLabel.mjs.map +1 -0
  83. package/dist/components/data-display/List.cjs +2 -0
  84. package/dist/components/data-display/List.cjs.map +1 -0
  85. package/dist/components/data-display/List.mjs +381 -0
  86. package/dist/components/data-display/List.mjs.map +1 -0
  87. package/dist/components/data-display/List.registry.cjs +2 -0
  88. package/dist/components/data-display/List.registry.cjs.map +1 -0
  89. package/dist/components/data-display/List.registry.mjs +101 -0
  90. package/dist/components/data-display/List.registry.mjs.map +1 -0
  91. package/dist/components/data-display/Persona.cjs +2 -0
  92. package/dist/components/data-display/Persona.cjs.map +1 -0
  93. package/dist/components/data-display/Persona.mjs +48 -0
  94. package/dist/components/data-display/Persona.mjs.map +1 -0
  95. package/dist/components/data-display/PresenceBadge.cjs +2 -0
  96. package/dist/components/data-display/PresenceBadge.cjs.map +1 -0
  97. package/dist/components/data-display/PresenceBadge.mjs +71 -0
  98. package/dist/components/data-display/PresenceBadge.mjs.map +1 -0
  99. package/dist/components/data-display/Tag.cjs +2 -0
  100. package/dist/components/data-display/Tag.cjs.map +1 -0
  101. package/dist/components/data-display/Tag.mjs +147 -0
  102. package/dist/components/data-display/Tag.mjs.map +1 -0
  103. package/dist/components/feedback/MessageBar.cjs +2 -0
  104. package/dist/components/feedback/MessageBar.cjs.map +1 -0
  105. package/dist/components/feedback/MessageBar.mjs +144 -0
  106. package/dist/components/feedback/MessageBar.mjs.map +1 -0
  107. package/dist/components/feedback/MessageBar.status.cjs +2 -0
  108. package/dist/components/feedback/MessageBar.status.cjs.map +1 -0
  109. package/dist/components/feedback/MessageBar.status.mjs +45 -0
  110. package/dist/components/feedback/MessageBar.status.mjs.map +1 -0
  111. package/dist/components/feedback/ProgressBar.cjs +2 -0
  112. package/dist/components/feedback/ProgressBar.cjs.map +1 -0
  113. package/dist/components/feedback/ProgressBar.mjs +72 -0
  114. package/dist/components/feedback/ProgressBar.mjs.map +1 -0
  115. package/dist/components/feedback/Skeleton.cjs +2 -0
  116. package/dist/components/feedback/Skeleton.cjs.map +1 -0
  117. package/dist/components/feedback/Skeleton.mjs +47 -0
  118. package/dist/components/feedback/Skeleton.mjs.map +1 -0
  119. package/dist/components/feedback/Spinner.cjs +2 -0
  120. package/dist/components/feedback/Spinner.cjs.map +1 -0
  121. package/dist/components/feedback/Spinner.mjs +60 -0
  122. package/dist/components/feedback/Spinner.mjs.map +1 -0
  123. package/dist/components/feedback/Toast.cjs +2 -0
  124. package/dist/components/feedback/Toast.cjs.map +1 -0
  125. package/dist/components/feedback/Toast.mjs +347 -0
  126. package/dist/components/feedback/Toast.mjs.map +1 -0
  127. package/dist/components/input/Checkbox.cjs +2 -0
  128. package/dist/components/input/Checkbox.cjs.map +1 -0
  129. package/dist/components/input/Checkbox.mjs +96 -0
  130. package/dist/components/input/Checkbox.mjs.map +1 -0
  131. package/dist/components/input/ColorPicker.cjs +6 -0
  132. package/dist/components/input/ColorPicker.cjs.map +1 -0
  133. package/dist/components/input/ColorPicker.mjs +236 -0
  134. package/dist/components/input/ColorPicker.mjs.map +1 -0
  135. package/dist/components/input/Combobox.cjs +2 -0
  136. package/dist/components/input/Combobox.cjs.map +1 -0
  137. package/dist/components/input/Combobox.expand.cjs +2 -0
  138. package/dist/components/input/Combobox.expand.cjs.map +1 -0
  139. package/dist/components/input/Combobox.expand.mjs +38 -0
  140. package/dist/components/input/Combobox.expand.mjs.map +1 -0
  141. package/dist/components/input/Combobox.mjs +187 -0
  142. package/dist/components/input/Combobox.mjs.map +1 -0
  143. package/dist/components/input/DatePicker.cjs +2 -0
  144. package/dist/components/input/DatePicker.cjs.map +1 -0
  145. package/dist/components/input/DatePicker.mjs +340 -0
  146. package/dist/components/input/DatePicker.mjs.map +1 -0
  147. package/dist/components/input/Dropdown.cjs +2 -0
  148. package/dist/components/input/Dropdown.cjs.map +1 -0
  149. package/dist/components/input/Dropdown.mjs +128 -0
  150. package/dist/components/input/Dropdown.mjs.map +1 -0
  151. package/dist/components/input/Field.cjs +2 -0
  152. package/dist/components/input/Field.cjs.map +1 -0
  153. package/dist/components/input/Field.mjs +200 -0
  154. package/dist/components/input/Field.mjs.map +1 -0
  155. package/dist/components/input/Input.cjs +2 -0
  156. package/dist/components/input/Input.cjs.map +1 -0
  157. package/dist/components/input/Input.mjs +81 -0
  158. package/dist/components/input/Input.mjs.map +1 -0
  159. package/dist/components/input/Label.cjs +2 -0
  160. package/dist/components/input/Label.cjs.map +1 -0
  161. package/dist/components/input/Label.mjs +28 -0
  162. package/dist/components/input/Label.mjs.map +1 -0
  163. package/dist/components/input/Option.cjs +2 -0
  164. package/dist/components/input/Option.cjs.map +1 -0
  165. package/dist/components/input/Option.mjs +169 -0
  166. package/dist/components/input/Option.mjs.map +1 -0
  167. package/dist/components/input/RadioGroup.cjs +2 -0
  168. package/dist/components/input/RadioGroup.cjs.map +1 -0
  169. package/dist/components/input/RadioGroup.mjs +139 -0
  170. package/dist/components/input/RadioGroup.mjs.map +1 -0
  171. package/dist/components/input/Rating.cjs +2 -0
  172. package/dist/components/input/Rating.cjs.map +1 -0
  173. package/dist/components/input/Rating.mjs +196 -0
  174. package/dist/components/input/Rating.mjs.map +1 -0
  175. package/dist/components/input/SearchBox.cjs +2 -0
  176. package/dist/components/input/SearchBox.cjs.map +1 -0
  177. package/dist/components/input/SearchBox.mjs +205 -0
  178. package/dist/components/input/SearchBox.mjs.map +1 -0
  179. package/dist/components/input/Select.cjs +2 -0
  180. package/dist/components/input/Select.cjs.map +1 -0
  181. package/dist/components/input/Select.mjs +33 -0
  182. package/dist/components/input/Select.mjs.map +1 -0
  183. package/dist/components/input/Slider.cjs +2 -0
  184. package/dist/components/input/Slider.cjs.map +1 -0
  185. package/dist/components/input/Slider.mjs +79 -0
  186. package/dist/components/input/Slider.mjs.map +1 -0
  187. package/dist/components/input/SpinButton.cjs +2 -0
  188. package/dist/components/input/SpinButton.cjs.map +1 -0
  189. package/dist/components/input/SpinButton.mjs +157 -0
  190. package/dist/components/input/SpinButton.mjs.map +1 -0
  191. package/dist/components/input/SwatchPicker.cjs +2 -0
  192. package/dist/components/input/SwatchPicker.cjs.map +1 -0
  193. package/dist/components/input/SwatchPicker.mjs +113 -0
  194. package/dist/components/input/SwatchPicker.mjs.map +1 -0
  195. package/dist/components/input/Switch.cjs +2 -0
  196. package/dist/components/input/Switch.cjs.map +1 -0
  197. package/dist/components/input/Switch.mjs +92 -0
  198. package/dist/components/input/Switch.mjs.map +1 -0
  199. package/dist/components/input/TagPicker.cjs +2 -0
  200. package/dist/components/input/TagPicker.cjs.map +1 -0
  201. package/dist/components/input/TagPicker.mjs +249 -0
  202. package/dist/components/input/TagPicker.mjs.map +1 -0
  203. package/dist/components/input/Textarea.cjs +2 -0
  204. package/dist/components/input/Textarea.cjs.map +1 -0
  205. package/dist/components/input/Textarea.mjs +32 -0
  206. package/dist/components/input/Textarea.mjs.map +1 -0
  207. package/dist/components/input/TimePicker.cjs +2 -0
  208. package/dist/components/input/TimePicker.cjs.map +1 -0
  209. package/dist/components/input/TimePicker.mjs +292 -0
  210. package/dist/components/input/TimePicker.mjs.map +1 -0
  211. package/dist/components/input/colorUtils.cjs +2 -0
  212. package/dist/components/input/colorUtils.cjs.map +1 -0
  213. package/dist/components/input/colorUtils.mjs +96 -0
  214. package/dist/components/input/colorUtils.mjs.map +1 -0
  215. package/dist/components/input/dateUtils.cjs +2 -0
  216. package/dist/components/input/dateUtils.cjs.map +1 -0
  217. package/dist/components/input/dateUtils.mjs +250 -0
  218. package/dist/components/input/dateUtils.mjs.map +1 -0
  219. package/dist/components/input/pickerStyles.cjs +2 -0
  220. package/dist/components/input/pickerStyles.cjs.map +1 -0
  221. package/dist/components/input/pickerStyles.mjs +10 -0
  222. package/dist/components/input/pickerStyles.mjs.map +1 -0
  223. package/dist/components/internal/HiddenInput.cjs +2 -0
  224. package/dist/components/internal/HiddenInput.cjs.map +1 -0
  225. package/dist/components/internal/HiddenInput.mjs +88 -0
  226. package/dist/components/internal/HiddenInput.mjs.map +1 -0
  227. package/dist/components/layout/Accordion.cjs +2 -0
  228. package/dist/components/layout/Accordion.cjs.map +1 -0
  229. package/dist/components/layout/Accordion.mjs +236 -0
  230. package/dist/components/layout/Accordion.mjs.map +1 -0
  231. package/dist/components/layout/Card.cjs +2 -0
  232. package/dist/components/layout/Card.cjs.map +1 -0
  233. package/dist/components/layout/Card.mjs +121 -0
  234. package/dist/components/layout/Card.mjs.map +1 -0
  235. package/dist/components/layout/Carousel.cjs +2 -0
  236. package/dist/components/layout/Carousel.cjs.map +1 -0
  237. package/dist/components/layout/Carousel.mjs +205 -0
  238. package/dist/components/layout/Carousel.mjs.map +1 -0
  239. package/dist/components/layout/Flex.cjs +2 -0
  240. package/dist/components/layout/Flex.cjs.map +1 -0
  241. package/dist/components/layout/Flex.mjs +54 -0
  242. package/dist/components/layout/Flex.mjs.map +1 -0
  243. package/dist/components/layout/Grid.cjs +2 -0
  244. package/dist/components/layout/Grid.cjs.map +1 -0
  245. package/dist/components/layout/Grid.mjs +62 -0
  246. package/dist/components/layout/Grid.mjs.map +1 -0
  247. package/dist/components/layout/Overflow.cjs +2 -0
  248. package/dist/components/layout/Overflow.cjs.map +1 -0
  249. package/dist/components/layout/Overflow.mjs +269 -0
  250. package/dist/components/layout/Overflow.mjs.map +1 -0
  251. package/dist/components/layout/Stack.cjs +2 -0
  252. package/dist/components/layout/Stack.cjs.map +1 -0
  253. package/dist/components/layout/Stack.mjs +39 -0
  254. package/dist/components/layout/Stack.mjs.map +1 -0
  255. package/dist/components/layout/TabList.cjs +2 -0
  256. package/dist/components/layout/TabList.cjs.map +1 -0
  257. package/dist/components/layout/TabList.mjs +238 -0
  258. package/dist/components/layout/TabList.mjs.map +1 -0
  259. package/dist/components/layout/Tree.cjs +2 -0
  260. package/dist/components/layout/Tree.cjs.map +1 -0
  261. package/dist/components/layout/Tree.mjs +220 -0
  262. package/dist/components/layout/Tree.mjs.map +1 -0
  263. package/dist/components/layout/disclosureIds.cjs +2 -0
  264. package/dist/components/layout/disclosureIds.cjs.map +1 -0
  265. package/dist/components/layout/disclosureIds.mjs +12 -0
  266. package/dist/components/layout/disclosureIds.mjs.map +1 -0
  267. package/dist/components/motion/Presence.cjs +2 -0
  268. package/dist/components/motion/Presence.cjs.map +1 -0
  269. package/dist/components/motion/Presence.mjs +35 -0
  270. package/dist/components/motion/Presence.mjs.map +1 -0
  271. package/dist/components/navigation/Breadcrumb.cjs +2 -0
  272. package/dist/components/navigation/Breadcrumb.cjs.map +1 -0
  273. package/dist/components/navigation/Breadcrumb.mjs +144 -0
  274. package/dist/components/navigation/Breadcrumb.mjs.map +1 -0
  275. package/dist/components/navigation/Menu.cjs +2 -0
  276. package/dist/components/navigation/Menu.cjs.map +1 -0
  277. package/dist/components/navigation/Menu.context.cjs +2 -0
  278. package/dist/components/navigation/Menu.context.cjs.map +1 -0
  279. package/dist/components/navigation/Menu.context.mjs +82 -0
  280. package/dist/components/navigation/Menu.context.mjs.map +1 -0
  281. package/dist/components/navigation/Menu.group.cjs +2 -0
  282. package/dist/components/navigation/Menu.group.cjs.map +1 -0
  283. package/dist/components/navigation/Menu.group.mjs +58 -0
  284. package/dist/components/navigation/Menu.group.mjs.map +1 -0
  285. package/dist/components/navigation/Menu.items.cjs +2 -0
  286. package/dist/components/navigation/Menu.items.cjs.map +1 -0
  287. package/dist/components/navigation/Menu.items.mjs +127 -0
  288. package/dist/components/navigation/Menu.items.mjs.map +1 -0
  289. package/dist/components/navigation/Menu.link.cjs +2 -0
  290. package/dist/components/navigation/Menu.link.cjs.map +1 -0
  291. package/dist/components/navigation/Menu.link.mjs +41 -0
  292. package/dist/components/navigation/Menu.link.mjs.map +1 -0
  293. package/dist/components/navigation/Menu.mjs +27 -0
  294. package/dist/components/navigation/Menu.mjs.map +1 -0
  295. package/dist/components/navigation/Menu.popover.cjs +2 -0
  296. package/dist/components/navigation/Menu.popover.cjs.map +1 -0
  297. package/dist/components/navigation/Menu.popover.mjs +231 -0
  298. package/dist/components/navigation/Menu.popover.mjs.map +1 -0
  299. package/dist/components/navigation/Menu.root.cjs +2 -0
  300. package/dist/components/navigation/Menu.root.cjs.map +1 -0
  301. package/dist/components/navigation/Menu.root.mjs +308 -0
  302. package/dist/components/navigation/Menu.root.mjs.map +1 -0
  303. package/dist/components/navigation/Menu.selectable.cjs +2 -0
  304. package/dist/components/navigation/Menu.selectable.cjs.map +1 -0
  305. package/dist/components/navigation/Menu.selectable.mjs +89 -0
  306. package/dist/components/navigation/Menu.selectable.mjs.map +1 -0
  307. package/dist/components/navigation/Menu.shared.cjs +2 -0
  308. package/dist/components/navigation/Menu.shared.cjs.map +1 -0
  309. package/dist/components/navigation/Menu.shared.mjs +23 -0
  310. package/dist/components/navigation/Menu.shared.mjs.map +1 -0
  311. package/dist/components/navigation/Menu.splitGroup.cjs +2 -0
  312. package/dist/components/navigation/Menu.splitGroup.cjs.map +1 -0
  313. package/dist/components/navigation/Menu.splitGroup.mjs +51 -0
  314. package/dist/components/navigation/Menu.splitGroup.mjs.map +1 -0
  315. package/dist/components/navigation/Menu.trigger.cjs +2 -0
  316. package/dist/components/navigation/Menu.trigger.cjs.map +1 -0
  317. package/dist/components/navigation/Menu.trigger.mjs +79 -0
  318. package/dist/components/navigation/Menu.trigger.mjs.map +1 -0
  319. package/dist/components/navigation/Nav.cjs +2 -0
  320. package/dist/components/navigation/Nav.cjs.map +1 -0
  321. package/dist/components/navigation/Nav.mjs +276 -0
  322. package/dist/components/navigation/Nav.mjs.map +1 -0
  323. package/dist/components/navigation/Pagination.cjs +2 -0
  324. package/dist/components/navigation/Pagination.cjs.map +1 -0
  325. package/dist/components/navigation/Pagination.mjs +110 -0
  326. package/dist/components/navigation/Pagination.mjs.map +1 -0
  327. package/dist/components/navigation/Stepper.cjs +2 -0
  328. package/dist/components/navigation/Stepper.cjs.map +1 -0
  329. package/dist/components/navigation/Stepper.mjs +204 -0
  330. package/dist/components/navigation/Stepper.mjs.map +1 -0
  331. package/dist/components/overlays/Dialog.cjs +2 -0
  332. package/dist/components/overlays/Dialog.cjs.map +1 -0
  333. package/dist/components/overlays/Dialog.mjs +180 -0
  334. package/dist/components/overlays/Dialog.mjs.map +1 -0
  335. package/dist/components/overlays/Dialog.shared.cjs +2 -0
  336. package/dist/components/overlays/Dialog.shared.cjs.map +1 -0
  337. package/dist/components/overlays/Dialog.shared.mjs +227 -0
  338. package/dist/components/overlays/Dialog.shared.mjs.map +1 -0
  339. package/dist/components/overlays/Drawer.cjs +2 -0
  340. package/dist/components/overlays/Drawer.cjs.map +1 -0
  341. package/dist/components/overlays/Drawer.mjs +192 -0
  342. package/dist/components/overlays/Drawer.mjs.map +1 -0
  343. package/dist/components/overlays/Popover.cjs +2 -0
  344. package/dist/components/overlays/Popover.cjs.map +1 -0
  345. package/dist/components/overlays/Popover.mjs +365 -0
  346. package/dist/components/overlays/Popover.mjs.map +1 -0
  347. package/dist/components/overlays/Popover.shared.cjs +2 -0
  348. package/dist/components/overlays/Popover.shared.cjs.map +1 -0
  349. package/dist/components/overlays/Popover.shared.mjs +182 -0
  350. package/dist/components/overlays/Popover.shared.mjs.map +1 -0
  351. package/dist/components/overlays/TeachingPopover.cjs +2 -0
  352. package/dist/components/overlays/TeachingPopover.cjs.map +1 -0
  353. package/dist/components/overlays/TeachingPopover.mjs +181 -0
  354. package/dist/components/overlays/TeachingPopover.mjs.map +1 -0
  355. package/dist/components/overlays/Tooltip.cjs +2 -0
  356. package/dist/components/overlays/Tooltip.cjs.map +1 -0
  357. package/dist/components/overlays/Tooltip.mjs +160 -0
  358. package/dist/components/overlays/Tooltip.mjs.map +1 -0
  359. package/dist/components/portal/Portal.cjs +2 -0
  360. package/dist/components/portal/Portal.cjs.map +1 -0
  361. package/dist/components/portal/Portal.mjs +45 -0
  362. package/dist/components/portal/Portal.mjs.map +1 -0
  363. package/dist/components/provider/WaveProvider.cjs +2 -0
  364. package/dist/components/provider/WaveProvider.cjs.map +1 -0
  365. package/dist/components/provider/WaveProvider.mjs +51 -0
  366. package/dist/components/provider/WaveProvider.mjs.map +1 -0
  367. package/dist/components/table/DataGrid.cjs +2 -0
  368. package/dist/components/table/DataGrid.cjs.map +1 -0
  369. package/dist/components/table/DataGrid.mjs +489 -0
  370. package/dist/components/table/DataGrid.mjs.map +1 -0
  371. package/dist/components/table/Table.cjs +2 -0
  372. package/dist/components/table/Table.cjs.map +1 -0
  373. package/dist/components/table/Table.mjs +99 -0
  374. package/dist/components/table/Table.mjs.map +1 -0
  375. package/dist/components/table/useGridNavigation.cjs +2 -0
  376. package/dist/components/table/useGridNavigation.cjs.map +1 -0
  377. package/dist/components/table/useGridNavigation.mjs +336 -0
  378. package/dist/components/table/useGridNavigation.mjs.map +1 -0
  379. package/dist/components/typography/Text.cjs +2 -0
  380. package/dist/components/typography/Text.cjs.map +1 -0
  381. package/dist/components/typography/Text.mjs +38 -0
  382. package/dist/components/typography/Text.mjs.map +1 -0
  383. package/dist/hooks/useAnnounce.cjs +2 -0
  384. package/dist/hooks/useAnnounce.cjs.map +1 -0
  385. package/dist/hooks/useAnnounce.mjs +88 -0
  386. package/dist/hooks/useAnnounce.mjs.map +1 -0
  387. package/dist/hooks/useCheckedValues.cjs +2 -0
  388. package/dist/hooks/useCheckedValues.cjs.map +1 -0
  389. package/dist/hooks/useCheckedValues.mjs +102 -0
  390. package/dist/hooks/useCheckedValues.mjs.map +1 -0
  391. package/dist/hooks/useContextMenuAnchor.cjs +2 -0
  392. package/dist/hooks/useContextMenuAnchor.cjs.map +1 -0
  393. package/dist/hooks/useContextMenuAnchor.mjs +132 -0
  394. package/dist/hooks/useContextMenuAnchor.mjs.map +1 -0
  395. package/dist/hooks/useControllable.cjs +2 -0
  396. package/dist/hooks/useControllable.cjs.map +1 -0
  397. package/dist/hooks/useControllable.mjs +37 -0
  398. package/dist/hooks/useControllable.mjs.map +1 -0
  399. package/dist/hooks/useDirection.cjs +2 -0
  400. package/dist/hooks/useDirection.cjs.map +1 -0
  401. package/dist/hooks/useDirection.mjs +57 -0
  402. package/dist/hooks/useDirection.mjs.map +1 -0
  403. package/dist/hooks/useDismiss.cjs +2 -0
  404. package/dist/hooks/useDismiss.cjs.map +1 -0
  405. package/dist/hooks/useDismiss.mjs +57 -0
  406. package/dist/hooks/useDismiss.mjs.map +1 -0
  407. package/dist/hooks/useEventCallback.cjs +2 -0
  408. package/dist/hooks/useEventCallback.cjs.map +1 -0
  409. package/dist/hooks/useEventCallback.mjs +16 -0
  410. package/dist/hooks/useEventCallback.mjs.map +1 -0
  411. package/dist/hooks/useFieldControl.cjs +2 -0
  412. package/dist/hooks/useFieldControl.cjs.map +1 -0
  413. package/dist/hooks/useFieldControl.mjs +62 -0
  414. package/dist/hooks/useFieldControl.mjs.map +1 -0
  415. package/dist/hooks/useFocusTrap.cjs +2 -0
  416. package/dist/hooks/useFocusTrap.cjs.map +1 -0
  417. package/dist/hooks/useFocusTrap.mjs +266 -0
  418. package/dist/hooks/useFocusTrap.mjs.map +1 -0
  419. package/dist/hooks/useFormReset.cjs +2 -0
  420. package/dist/hooks/useFormReset.cjs.map +1 -0
  421. package/dist/hooks/useFormReset.mjs +33 -0
  422. package/dist/hooks/useFormReset.mjs.map +1 -0
  423. package/dist/hooks/useHoverIntent.cjs +2 -0
  424. package/dist/hooks/useHoverIntent.cjs.map +1 -0
  425. package/dist/hooks/useHoverIntent.mjs +201 -0
  426. package/dist/hooks/useHoverIntent.mjs.map +1 -0
  427. package/dist/hooks/useId.cjs +2 -0
  428. package/dist/hooks/useId.cjs.map +1 -0
  429. package/dist/hooks/useId.mjs +11 -0
  430. package/dist/hooks/useId.mjs.map +1 -0
  431. package/dist/hooks/useIsClient.cjs +2 -0
  432. package/dist/hooks/useIsClient.cjs.map +1 -0
  433. package/dist/hooks/useIsClient.mjs +19 -0
  434. package/dist/hooks/useIsClient.mjs.map +1 -0
  435. package/dist/hooks/useListbox.cjs +2 -0
  436. package/dist/hooks/useListbox.cjs.map +1 -0
  437. package/dist/hooks/useListbox.mjs +492 -0
  438. package/dist/hooks/useListbox.mjs.map +1 -0
  439. package/dist/hooks/useMergedRefs.cjs +2 -0
  440. package/dist/hooks/useMergedRefs.cjs.map +1 -0
  441. package/dist/hooks/useMergedRefs.mjs +57 -0
  442. package/dist/hooks/useMergedRefs.mjs.map +1 -0
  443. package/dist/hooks/useModalIsolation.cjs +2 -0
  444. package/dist/hooks/useModalIsolation.cjs.map +1 -0
  445. package/dist/hooks/useModalIsolation.mjs +87 -0
  446. package/dist/hooks/useModalIsolation.mjs.map +1 -0
  447. package/dist/hooks/useModalLayer.cjs +2 -0
  448. package/dist/hooks/useModalLayer.cjs.map +1 -0
  449. package/dist/hooks/useModalLayer.mjs +30 -0
  450. package/dist/hooks/useModalLayer.mjs.map +1 -0
  451. package/dist/hooks/usePopupPosition.cjs +2 -0
  452. package/dist/hooks/usePopupPosition.cjs.map +1 -0
  453. package/dist/hooks/usePopupPosition.mjs +117 -0
  454. package/dist/hooks/usePopupPosition.mjs.map +1 -0
  455. package/dist/hooks/usePrefersReducedMotion.cjs +2 -0
  456. package/dist/hooks/usePrefersReducedMotion.cjs.map +1 -0
  457. package/dist/hooks/usePrefersReducedMotion.mjs +24 -0
  458. package/dist/hooks/usePrefersReducedMotion.mjs.map +1 -0
  459. package/dist/hooks/usePresence.cjs +2 -0
  460. package/dist/hooks/usePresence.cjs.map +1 -0
  461. package/dist/hooks/usePresence.mjs +136 -0
  462. package/dist/hooks/usePresence.mjs.map +1 -0
  463. package/dist/hooks/usePreserveFocus.cjs +2 -0
  464. package/dist/hooks/usePreserveFocus.cjs.map +1 -0
  465. package/dist/hooks/usePreserveFocus.mjs +50 -0
  466. package/dist/hooks/usePreserveFocus.mjs.map +1 -0
  467. package/dist/hooks/useRestoreFocus.cjs +2 -0
  468. package/dist/hooks/useRestoreFocus.cjs.map +1 -0
  469. package/dist/hooks/useRestoreFocus.mjs +271 -0
  470. package/dist/hooks/useRestoreFocus.mjs.map +1 -0
  471. package/dist/hooks/useRovingTabIndex.cjs +2 -0
  472. package/dist/hooks/useRovingTabIndex.cjs.map +1 -0
  473. package/dist/hooks/useRovingTabIndex.mjs +389 -0
  474. package/dist/hooks/useRovingTabIndex.mjs.map +1 -0
  475. package/dist/hooks/useScrollLock.cjs +2 -0
  476. package/dist/hooks/useScrollLock.cjs.map +1 -0
  477. package/dist/hooks/useScrollLock.mjs +71 -0
  478. package/dist/hooks/useScrollLock.mjs.map +1 -0
  479. package/dist/hooks/useTriggerElement.cjs +2 -0
  480. package/dist/hooks/useTriggerElement.cjs.map +1 -0
  481. package/dist/hooks/useTriggerElement.mjs +126 -0
  482. package/dist/hooks/useTriggerElement.mjs.map +1 -0
  483. package/dist/hooks/useTypeahead.cjs +2 -0
  484. package/dist/hooks/useTypeahead.cjs.map +1 -0
  485. package/dist/hooks/useTypeahead.mjs +38 -0
  486. package/dist/hooks/useTypeahead.mjs.map +1 -0
  487. package/dist/index.cjs +1 -1
  488. package/dist/index.d.cts +9099 -0
  489. package/dist/index.d.ts +7688 -1027
  490. package/dist/index.mjs +91 -5695
  491. package/dist/lib/aria.cjs +2 -0
  492. package/dist/lib/aria.cjs.map +1 -0
  493. package/dist/lib/aria.mjs +29 -0
  494. package/dist/lib/aria.mjs.map +1 -0
  495. package/dist/lib/children.cjs +2 -0
  496. package/dist/lib/children.cjs.map +1 -0
  497. package/dist/lib/children.mjs +37 -0
  498. package/dist/lib/children.mjs.map +1 -0
  499. package/dist/lib/cn.cjs +2 -0
  500. package/dist/lib/cn.cjs.map +1 -0
  501. package/dist/lib/cn.mjs +64 -0
  502. package/dist/lib/cn.mjs.map +1 -0
  503. package/dist/lib/composeEventHandlers.cjs +2 -0
  504. package/dist/lib/composeEventHandlers.cjs.map +1 -0
  505. package/dist/lib/composeEventHandlers.mjs +11 -0
  506. package/dist/lib/composeEventHandlers.mjs.map +1 -0
  507. package/dist/lib/dev.cjs +2 -0
  508. package/dist/lib/dev.cjs.map +1 -0
  509. package/dist/lib/dev.mjs +42 -0
  510. package/dist/lib/dev.mjs.map +1 -0
  511. package/dist/lib/direction.cjs +2 -0
  512. package/dist/lib/direction.cjs.map +1 -0
  513. package/dist/lib/direction.mjs +35 -0
  514. package/dist/lib/direction.mjs.map +1 -0
  515. package/dist/lib/events.cjs +2 -0
  516. package/dist/lib/events.cjs.map +1 -0
  517. package/dist/lib/events.mjs +31 -0
  518. package/dist/lib/events.mjs.map +1 -0
  519. package/dist/lib/focus.cjs +2 -0
  520. package/dist/lib/focus.cjs.map +1 -0
  521. package/dist/lib/focus.mjs +119 -0
  522. package/dist/lib/focus.mjs.map +1 -0
  523. package/dist/lib/globalRegistry.cjs +2 -0
  524. package/dist/lib/globalRegistry.cjs.map +1 -0
  525. package/dist/lib/globalRegistry.mjs +13 -0
  526. package/dist/lib/globalRegistry.mjs.map +1 -0
  527. package/dist/lib/icons.cjs +2 -0
  528. package/dist/lib/icons.cjs.map +1 -0
  529. package/dist/lib/icons.mjs +254 -0
  530. package/dist/lib/icons.mjs.map +1 -0
  531. package/dist/lib/labelInName.cjs +2 -0
  532. package/dist/lib/labelInName.cjs.map +1 -0
  533. package/dist/lib/labelInName.mjs +54 -0
  534. package/dist/lib/labelInName.mjs.map +1 -0
  535. package/dist/lib/layers.cjs +2 -0
  536. package/dist/lib/layers.cjs.map +1 -0
  537. package/dist/lib/layers.mjs +224 -0
  538. package/dist/lib/layers.mjs.map +1 -0
  539. package/dist/lib/mergeProps.cjs +2 -0
  540. package/dist/lib/mergeProps.cjs.map +1 -0
  541. package/dist/lib/mergeProps.mjs +21 -0
  542. package/dist/lib/mergeProps.mjs.map +1 -0
  543. package/dist/lib/mergeRefs.cjs +2 -0
  544. package/dist/lib/mergeRefs.cjs.map +1 -0
  545. package/dist/lib/mergeRefs.mjs +29 -0
  546. package/dist/lib/mergeRefs.mjs.map +1 -0
  547. package/dist/lib/renderTrigger.cjs +2 -0
  548. package/dist/lib/renderTrigger.cjs.map +1 -0
  549. package/dist/lib/renderTrigger.mjs +29 -0
  550. package/dist/lib/renderTrigger.mjs.map +1 -0
  551. package/dist/lib/slot.cjs +2 -0
  552. package/dist/lib/slot.cjs.map +1 -0
  553. package/dist/lib/slot.mjs +122 -0
  554. package/dist/lib/slot.mjs.map +1 -0
  555. package/dist/lib/styles.cjs +2 -0
  556. package/dist/lib/styles.cjs.map +1 -0
  557. package/dist/lib/styles.mjs +16 -0
  558. package/dist/lib/styles.mjs.map +1 -0
  559. package/dist/lib/theme.cjs +2 -0
  560. package/dist/lib/theme.cjs.map +1 -0
  561. package/dist/lib/theme.mjs +16 -0
  562. package/dist/lib/theme.mjs.map +1 -0
  563. package/dist/preflight.css +2 -0
  564. package/dist/styles.css +2 -0
  565. package/package.json +149 -100
  566. package/src/styles/animations.css +7 -39
  567. package/src/styles/base.css +103 -0
  568. package/src/styles/globals.css +10 -22
  569. package/src/styles/legacy-tokens.css +184 -0
  570. package/src/styles/preflight.css +7 -0
  571. package/src/styles/styles.css +32 -0
  572. package/src/styles/tailwind.css +17 -0
  573. package/src/styles/tokens.css +561 -221
  574. package/src/styles/variants.css +29 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spinner.cjs","names":["React","cn","forcedColors","require_runtime","require_cn","require_styles","react","react_jsx_runtime","isName","value","sizeClasses","appearanceClasses","Spinner","rest","wait","delay","shown","setShown","announced","setAnnounced","handle","frame","nameFromLabel","role","resolvedAppearance","appearance","colors","label","className","size","labelVisible"],"sources":["../../../src/components/feedback/Spinner.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { forcedColors } from '../../lib/styles';\nimport type { Size } from '../../lib/types';\n\n/** Color treatment of a {@link Spinner}. */\nexport type SpinnerAppearance = 'primary' | 'inverted';\n\n/** Properties for the Spinner component. */\nexport interface SpinnerProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Size of the spinner.\n * @default 'medium'\n */\n size?: Size;\n /**\n * Text announced by the spinner's status region (and shown with `labelVisible`). Localize it.\n * @default 'Loading'\n */\n label?: string;\n /** Whether the label text is visually displayed alongside the spinner. */\n labelVisible?: boolean;\n /**\n * `primary`: a primary arc on the track color. `inverted`: drawn in the current text color (a\n * 30% track), for brand or inverted surfaces such as a primary Button.\n * @default 'primary'\n */\n appearance?: SpinnerAppearance;\n /**\n * Milliseconds to wait before the ring and the label appear, so a fast load does not flash the\n * spinner. The status region is mounted (empty) at once and announces the label once shown.\n * A non-finite or negative value means 0.\n * @default 0\n */\n delay?: number;\n /**\n * Role of the root; a forwarded `undefined` keeps the default live region. Use `none` inside a\n * region that already announces the busy state, or `progressbar`, which `label` names\n * (`aria-label`) unless you pass `aria-label` or `aria-labelledby` (a progress bar is not named by\n * its content).\n * @default 'status'\n */\n role?: React.AriaRole;\n ref?: React.Ref<HTMLSpanElement>;\n}\n\n/** Whether a name prop (`aria-label`, `aria-labelledby`) holds more than whitespace. */\nfunction isName(value: unknown): value is string {\n return typeof value === 'string' && value.trim() !== '';\n}\n\nconst sizeClasses: Record<Size, string> = {\n 'extra-small': 'w-3 h-3',\n small: 'w-4 h-4',\n medium: 'w-6 h-6',\n large: 'w-9 h-9',\n 'extra-large': 'w-12 h-12',\n};\n\n/** Ring (track, then arc) and visible-label colors of each appearance. */\nconst appearanceClasses: Record<SpinnerAppearance, { ring: string; label: string }> = {\n primary: { ring: 'border-track border-t-primary', label: 'text-muted-foreground' },\n // The current text color matches any surface the spinner sits on (on-brand text in a primary\n // Button, the inverted foreground), so no token is needed.\n inverted: { ring: 'border-current/30 border-t-current', label: 'text-current' },\n};\n\n/**\n * An indeterminate loading indicator.\n *\n * - The root is a `role=\"status\"` live region (override `role`, e.g. `role=\"none\"` inside a region\n * that already announces the busy state, or `role=\"progressbar\"`, which `label` names unless you\n * pass `aria-label` or `aria-labelledby`).\n * - The region mounts **empty** and receives its `label` (default \"Loading\") one animation frame\n * after the spinner is shown, so screen readers announce it (a live region that mounts with its\n * content is often not announced). With `labelVisible` the label also shows next to the ring\n * from that frame on.\n * - `delay` holds back the ring and the label for that many milliseconds (the region mounts at\n * once), so a fast load does not flash the spinner. The root's `data-state` is `delayed`, then\n * `shown`.\n * - `appearance=\"inverted\"` draws the spinner in the current text color, for a primary Button or\n * another brand or inverted surface. The root carries `data-appearance`.\n * - The ring is decorative (`aria-hidden`) and spins slower for reduced motion. In forced-colors\n * mode its arc is drawn in `Highlight` on a `Canvas` track, so the rotation stays perceivable.\n *\n * @example\n * <Spinner label=\"Loading results\" delay={300} />\n *\n * @example\n * // In a primary Button's (decorative) icon slot; the Button's text names the busy state.\n * <Button appearance=\"primary\" icon={<Spinner appearance=\"inverted\" size=\"extra-small\" />}>\n * Saving\n * </Button>\n */\nexport const Spinner = ({\n size = 'medium',\n label = 'Loading',\n labelVisible,\n appearance = 'primary',\n delay = 0,\n className,\n // Destructured with a default rather than set before `{...rest}`: a wrapper that forwards\n // `role={props.role}` passes `undefined`, which must not strip the live region.\n role = 'status',\n ref,\n ...rest\n}: SpinnerProps) => {\n const wait = Number.isFinite(delay) && delay > 0 ? delay : 0;\n const [shown, setShown] = React.useState(wait === 0);\n const [announced, setAnnounced] = React.useState(false);\n\n // C-HOOKS deferred updates: each state is set in its callback, never in the effect body. Once\n // shown, the spinner stays shown; a delay that changes while it waits starts the wait again.\n React.useEffect(() => {\n if (shown) return;\n const handle = setTimeout(() => setShown(true), wait);\n return () => clearTimeout(handle);\n }, [shown, wait]);\n\n React.useEffect(() => {\n if (!shown) return;\n const frame = requestAnimationFrame(() => setAnnounced(true));\n return () => cancelAnimationFrame(frame);\n }, [shown]);\n\n // A progressbar takes its name from the author, never from its content (the label text): name it\n // with `label` unless the consumer does. Also applies to a forwarded `aria-label={undefined}`.\n const nameFromLabel =\n role === 'progressbar' && !isName(rest['aria-label']) && !isName(rest['aria-labelledby']);\n // An appearance outside the union (from untyped code) renders as primary instead of throwing.\n const resolvedAppearance: SpinnerAppearance = Object.hasOwn(appearanceClasses, appearance ?? '')\n ? appearance\n : 'primary';\n const colors = appearanceClasses[resolvedAppearance];\n\n return (\n <span\n data-appearance={resolvedAppearance}\n data-state={shown ? 'shown' : 'delayed'}\n {...rest}\n role={role}\n aria-label={nameFromLabel ? label : rest['aria-label']}\n ref={ref}\n className={cn('inline-flex items-center gap-2', className)}\n >\n {shown ? (\n <span\n aria-hidden=\"true\"\n data-wave-spinner-ring=\"\"\n className={cn(\n 'rounded-full border-2 animate-wave-spin motion-reduce:animate-wave-spin-slow',\n colors.ring,\n forcedColors.ringArc,\n sizeClasses[size],\n )}\n />\n ) : null}\n <span\n data-wave-spinner-label=\"\"\n className={labelVisible ? cn('text-body-1', colors.label) : 'sr-only'}\n >\n {announced ? label : null}\n </span>\n </span>\n );\n};\n\nSpinner.displayName = 'Spinner';\n"],"mappings":"gNA8CA,SAASQ,EAAO,EAAiC,CAC/C,OAAO,OAAOC,GAAU,UAAYA,EAAM,KAAK,IAAM,EACvD,CAEA,IAAMC,EAAoC,CACxC,cAAe,UACf,MAAO,UACP,OAAQ,UACR,MAAO,UACP,cAAe,WACjB,EAGMC,EAAgF,CACpF,QAAS,CAAE,KAAM,gCAAiC,MAAO,uBAAwB,EAGjF,SAAU,CAAE,KAAM,qCAAsC,MAAO,cAAe,CAChF,EA6BaC,GAAW,CACtB,OAAO,SACP,QAAQ,UACR,eACA,aAAa,UACb,QAAQ,EACR,YAGA,OAAO,SACP,MACA,GAAGC,KACe,CAClB,IAAMC,EAAO,OAAO,SAASC,CAAK,GAAK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edColors as t } from "../../lib/styles.mjs";
4
+ import * as n from "react";
5
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
6
+ //#region src/components/feedback/Spinner.tsx
7
+ function a(e) {
8
+ return typeof e == "string" && e.trim() !== "";
9
+ }
10
+ var o = {
11
+ "extra-small": "w-3 h-3",
12
+ small: "w-4 h-4",
13
+ medium: "w-6 h-6",
14
+ large: "w-9 h-9",
15
+ "extra-large": "w-12 h-12"
16
+ }, s = {
17
+ primary: {
18
+ ring: "border-track border-t-primary",
19
+ label: "text-muted-foreground"
20
+ },
21
+ inverted: {
22
+ ring: "border-current/30 border-t-current",
23
+ label: "text-current"
24
+ }
25
+ }, c = ({ size: c = "medium", label: l = "Loading", labelVisible: u, appearance: d = "primary", delay: f = 0, className: p, role: m = "status", ref: h, ...g }) => {
26
+ let _ = Number.isFinite(f) && f > 0 ? f : 0, [v, y] = n.useState(_ === 0), [b, x] = n.useState(!1);
27
+ n.useEffect(() => {
28
+ if (v) return;
29
+ let e = setTimeout(() => y(!0), _);
30
+ return () => clearTimeout(e);
31
+ }, [v, _]), n.useEffect(() => {
32
+ if (!v) return;
33
+ let e = requestAnimationFrame(() => x(!0));
34
+ return () => cancelAnimationFrame(e);
35
+ }, [v]);
36
+ let S = m === "progressbar" && !a(g["aria-label"]) && !a(g["aria-labelledby"]), C = Object.hasOwn(s, d ?? "") ? d : "primary", w = s[C];
37
+ return /* @__PURE__ */ i("span", {
38
+ "data-appearance": C,
39
+ "data-state": v ? "shown" : "delayed",
40
+ ...g,
41
+ role: m,
42
+ "aria-label": S ? l : g["aria-label"],
43
+ ref: h,
44
+ className: e("inline-flex items-center gap-2", p),
45
+ children: [v ? /* @__PURE__ */ r("span", {
46
+ "aria-hidden": "true",
47
+ "data-wave-spinner-ring": "",
48
+ className: e("rounded-full border-2 animate-wave-spin motion-reduce:animate-wave-spin-slow", w.ring, t.ringArc, o[c])
49
+ }) : null, /* @__PURE__ */ r("span", {
50
+ "data-wave-spinner-label": "",
51
+ className: u ? e("text-body-1", w.label) : "sr-only",
52
+ children: b ? l : null
53
+ })]
54
+ });
55
+ };
56
+ c.displayName = "Spinner";
57
+ //#endregion
58
+ export { c as Spinner };
59
+
60
+ //# sourceMappingURL=Spinner.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spinner.mjs","names":["React","isName","value","sizeClasses","appearanceClasses","Spinner","rest","wait","delay","shown","setShown","announced","setAnnounced","handle","frame","nameFromLabel","role","resolvedAppearance","appearance","colors","label","cn","className","forcedColors","size","labelVisible"],"sources":["../../../src/components/feedback/Spinner.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { forcedColors } from '../../lib/styles';\nimport type { Size } from '../../lib/types';\n\n/** Color treatment of a {@link Spinner}. */\nexport type SpinnerAppearance = 'primary' | 'inverted';\n\n/** Properties for the Spinner component. */\nexport interface SpinnerProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Size of the spinner.\n * @default 'medium'\n */\n size?: Size;\n /**\n * Text announced by the spinner's status region (and shown with `labelVisible`). Localize it.\n * @default 'Loading'\n */\n label?: string;\n /** Whether the label text is visually displayed alongside the spinner. */\n labelVisible?: boolean;\n /**\n * `primary`: a primary arc on the track color. `inverted`: drawn in the current text color (a\n * 30% track), for brand or inverted surfaces such as a primary Button.\n * @default 'primary'\n */\n appearance?: SpinnerAppearance;\n /**\n * Milliseconds to wait before the ring and the label appear, so a fast load does not flash the\n * spinner. The status region is mounted (empty) at once and announces the label once shown.\n * A non-finite or negative value means 0.\n * @default 0\n */\n delay?: number;\n /**\n * Role of the root; a forwarded `undefined` keeps the default live region. Use `none` inside a\n * region that already announces the busy state, or `progressbar`, which `label` names\n * (`aria-label`) unless you pass `aria-label` or `aria-labelledby` (a progress bar is not named by\n * its content).\n * @default 'status'\n */\n role?: React.AriaRole;\n ref?: React.Ref<HTMLSpanElement>;\n}\n\n/** Whether a name prop (`aria-label`, `aria-labelledby`) holds more than whitespace. */\nfunction isName(value: unknown): value is string {\n return typeof value === 'string' && value.trim() !== '';\n}\n\nconst sizeClasses: Record<Size, string> = {\n 'extra-small': 'w-3 h-3',\n small: 'w-4 h-4',\n medium: 'w-6 h-6',\n large: 'w-9 h-9',\n 'extra-large': 'w-12 h-12',\n};\n\n/** Ring (track, then arc) and visible-label colors of each appearance. */\nconst appearanceClasses: Record<SpinnerAppearance, { ring: string; label: string }> = {\n primary: { ring: 'border-track border-t-primary', label: 'text-muted-foreground' },\n // The current text color matches any surface the spinner sits on (on-brand text in a primary\n // Button, the inverted foreground), so no token is needed.\n inverted: { ring: 'border-current/30 border-t-current', label: 'text-current' },\n};\n\n/**\n * An indeterminate loading indicator.\n *\n * - The root is a `role=\"status\"` live region (override `role`, e.g. `role=\"none\"` inside a region\n * that already announces the busy state, or `role=\"progressbar\"`, which `label` names unless you\n * pass `aria-label` or `aria-labelledby`).\n * - The region mounts **empty** and receives its `label` (default \"Loading\") one animation frame\n * after the spinner is shown, so screen readers announce it (a live region that mounts with its\n * content is often not announced). With `labelVisible` the label also shows next to the ring\n * from that frame on.\n * - `delay` holds back the ring and the label for that many milliseconds (the region mounts at\n * once), so a fast load does not flash the spinner. The root's `data-state` is `delayed`, then\n * `shown`.\n * - `appearance=\"inverted\"` draws the spinner in the current text color, for a primary Button or\n * another brand or inverted surface. The root carries `data-appearance`.\n * - The ring is decorative (`aria-hidden`) and spins slower for reduced motion. In forced-colors\n * mode its arc is drawn in `Highlight` on a `Canvas` track, so the rotation stays perceivable.\n *\n * @example\n * <Spinner label=\"Loading results\" delay={300} />\n *\n * @example\n * // In a primary Button's (decorative) icon slot; the Button's text names the busy state.\n * <Button appearance=\"primary\" icon={<Spinner appearance=\"inverted\" size=\"extra-small\" />}>\n * Saving\n * </Button>\n */\nexport const Spinner = ({\n size = 'medium',\n label = 'Loading',\n labelVisible,\n appearance = 'primary',\n delay = 0,\n className,\n // Destructured with a default rather than set before `{...rest}`: a wrapper that forwards\n // `role={props.role}` passes `undefined`, which must not strip the live region.\n role = 'status',\n ref,\n ...rest\n}: SpinnerProps) => {\n const wait = Number.isFinite(delay) && delay > 0 ? delay : 0;\n const [shown, setShown] = React.useState(wait === 0);\n const [announced, setAnnounced] = React.useState(false);\n\n // C-HOOKS deferred updates: each state is set in its callback, never in the effect body. Once\n // shown, the spinner stays shown; a delay that changes while it waits starts the wait again.\n React.useEffect(() => {\n if (shown) return;\n const handle = setTimeout(() => setShown(true), wait);\n return () => clearTimeout(handle);\n }, [shown, wait]);\n\n React.useEffect(() => {\n if (!shown) return;\n const frame = requestAnimationFrame(() => setAnnounced(true));\n return () => cancelAnimationFrame(frame);\n }, [shown]);\n\n // A progressbar takes its name from the author, never from its content (the label text): name it\n // with `label` unless the consumer does. Also applies to a forwarded `aria-label={undefined}`.\n const nameFromLabel =\n role === 'progressbar' && !isName(rest['aria-label']) && !isName(rest['aria-labelledby']);\n // An appearance outside the union (from untyped code) renders as primary instead of throwing.\n const resolvedAppearance: SpinnerAppearance = Object.hasOwn(appearanceClasses, appearance ?? '')\n ? appearance\n : 'primary';\n const colors = appearanceClasses[resolvedAppearance];\n\n return (\n <span\n data-appearance={resolvedAppearance}\n data-state={shown ? 'shown' : 'delayed'}\n {...rest}\n role={role}\n aria-label={nameFromLabel ? label : rest['aria-label']}\n ref={ref}\n className={cn('inline-flex items-center gap-2', className)}\n >\n {shown ? (\n <span\n aria-hidden=\"true\"\n data-wave-spinner-ring=\"\"\n className={cn(\n 'rounded-full border-2 animate-wave-spin motion-reduce:animate-wave-spin-slow',\n colors.ring,\n forcedColors.ringArc,\n sizeClasses[size],\n )}\n />\n ) : null}\n <span\n data-wave-spinner-label=\"\"\n className={labelVisible ? cn('text-body-1', colors.label) : 'sr-only'}\n >\n {announced ? label : null}\n </span>\n </span>\n );\n};\n\nSpinner.displayName = 'Spinner';\n"],"mappings":";;;;;;AA8CA,SAASC,EAAO,GAAiC;CAC/C,OAAO,OAAOC,KAAU,YAAYA,EAAM,KAAK,MAAM;AACvD;AAEA,IAAMC,IAA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AAA,IACC,MACJ,kBAAC,QAAD;GACE,2BAAwB;GACxB,WAAWC,IAAeJ,EAAG,eAAeF,EAAO,KAAK,IAAI;GAE3D,UAAAR,IAAYS,IAAQ;EACjB,CAAA,CACF;;AAEV;AAEA,EAAQ,cAAc"}
@@ -0,0 +1,2 @@
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/dev.cjs"),r=require("../../lib/slot.cjs"),i=require("../../hooks/useId.cjs"),a=require("../../lib/direction.cjs"),o=require("../../lib/focus.cjs"),s=require("../../hooks/useMergedRefs.cjs"),c=require("../../lib/layers.cjs"),l=require("../../hooks/useDirection.cjs"),u=require("../portal/Portal.cjs"),d=require("../../lib/styles.cjs"),f=require("../../lib/icons.cjs"),p=require("../../hooks/usePreserveFocus.cjs"),m=require("./MessageBar.status.cjs");let h=require("react");h=e.__toESM(h,1);let g=require("react/jsx-runtime");function _(e,t){let n=0;for(let t of e)t.shown&&(n+=1);return n>=t||n===e.length?e:e.map(e=>e.shown||n>=t?e:(n+=1,{...e,shown:!0}))}function v(e){return e===void 0?1/0:e>=1?Math.floor(e):1}var y=h.createContext(null);y.displayName=`ToasterContext`;var b=h.createContext(!1);b.displayName=`ToasterRegionContext`;var x={dispatchToast:e=>e.toastId??``,dismissToast:()=>{},dismissAllToasts:()=>{}},S=`useToastController must be used within <Toaster>. Wrap your app (or the part of it that shows toasts) in <Toaster>: it provides the controller to its children.`;function C(){return h.useContext(y)||(n.reportMissingContext(`useToastController`,`<Toaster>`,S),x)}var w=({status:e=`info`,title:n,statusLabel:i,onDismiss:a,dismissLabel:o=`Dismiss`,className:s,children:c,ref:l,...u})=>{let p=h.useContext(b),_=r.materialiseSlotContent(c),v=r.slotRendersContent(_);return(0,g.jsxs)(`div`,{ref:l,...p?{}:e===`error`?{role:`alert`,"aria-live":`assertive`}:{role:`status`,"aria-live":`polite`},...u,className:t.cn(`flex items-start gap-3 rounded border border-s-4 border-border bg-background p-3 text-foreground shadow-4`,m.STATUS_BORDER[e],s),children:[(0,g.jsx)(`span`,{"aria-hidden":`true`,className:t.cn(`mt-0.5 inline-flex shrink-0`,m.STATUS_ICON_COLOR[e]),children:(0,g.jsx)(m.StatusIcon,{status:e})}),(0,g.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,g.jsx)(m.StatusText,{label:m.getStatusLabel(e,i)}),n?(0,g.jsx)(`div`,{className:`text-body-2 font-semibold text-foreground`,children:n}):null,v?(0,g.jsx)(`div`,{className:`mt-0.5 text-body-1 text-muted-foreground`,children:_}):null]}),a?(0,g.jsx)(`button`,{type:`button`,onClick:()=>a(),className:t.cn(`inline-flex shrink-0 cursor-pointer items-center justify-center rounded border-none bg-transparent p-1 text-muted-foreground`,`not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground`,`not-disabled:not-aria-disabled:active:bg-subtle-pressed`,d.focusRing),"aria-label":o,children:(0,g.jsx)(f.DismissIcon,{})}):null]})};w.displayName=`Toast`;var T=5e3;function E(e){let t=new Map,n=new Map,r=new Map,i=!1,a=!1,o=o=>{let s=t.get(o);if(!s)return;let c=!a&&!i&&!(n.get(o)?.size??0);c&&s.handle===null?(s.startedAt=Date.now(),s.handle=setTimeout(()=>{t.delete(o),n.delete(o),r.delete(o),e(o)},s.remaining)):!c&&s.handle!==null&&(clearTimeout(s.handle),s.handle=null,s.remaining=Math.max(0,s.remaining-(Date.now()-s.startedAt)))},s=()=>{for(let e of Array.from(t.keys()))o(e)},c=e=>{let n=t.get(e);n?.handle!=null&&clearTimeout(n.handle),t.delete(e)};return{start(e,n,i){r.get(e)!==n&&(r.set(e,n),c(e),i>0&&Number.isFinite(i)&&(t.set(e,{handle:null,remaining:i,startedAt:0}),o(e)))},remove(e){c(e),n.delete(e),r.delete(e)},clear(){for(let e of Array.from(t.keys()))c(e);n.clear(),r.clear()},pause(e,t){let r=n.get(e);r||(r=new Set,n.set(e,r)),r.add(t),o(e)},resume(e,t){n.get(e)?.delete(t),o(e)},setInBackground(e){i=e,s()},setSuspended(e){a=e,s()}}}var D={"top-start":`top-4 start-4 ms-(--wave-toaster-offset)`,"top-end":`top-4 end-4 me-(--wave-toaster-offset)`,"bottom-start":`bottom-4 start-4 ms-(--wave-toaster-offset)`,"bottom-end":`bottom-4 end-4 me-(--wave-toaster-offset)`,"top-right":`top-4 right-4 mr-(--wave-toaster-offset)`,"top-left":`top-4 left-4 ml-(--wave-toaster-offset)`,"bottom-right":`bottom-4 right-4 mr-(--wave-toaster-offset)`,"bottom-left":`bottom-4 left-4 ml-(--wave-toaster-offset)`},O=16;function k(e,t){let n=e.slice(e.indexOf(`-`)+1);if(n===`right`||n===`left`)return n===`right`;let r=a.getDirection(t)===`rtl`;return n===`end`?!r:r}function A(e,t){let n=c.getOpenLayers().filter(e=>e.kind===`modal`);if(n.length===0)return 0;let r=e.ownerDocument,i=r.defaultView;if(!i)return 0;let a=r.documentElement.clientWidth||i.innerWidth,o=r.documentElement.clientHeight||i.innerHeight,s=k(t,e),l=t.startsWith(`top`),u=0;for(let e of n)for(let t of e.getElements()){if(!t?.isConnected)continue;let e=t.getBoundingClientRect();if(e.width<=0||e.height<=0)continue;let n=s?e.right>=a-O:e.left<=O,r=l?e.top<=O:e.bottom>=o-O;n&&r&&(u=Math.max(u,s?a-e.left:e.right))}return u<=0||a-u<e.offsetWidth+32?0:Math.ceil(u)}function j({status:e=`info`,statusLabel:t,title:n,body:r}){return[m.getStatusLabel(e,t),n,r].filter(Boolean).join(` `)}var M=2e3;function N({text:e}){let[t,n]=h.useState(!0);return h.useEffect(()=>{let e=setTimeout(()=>n(!1),M);return()=>clearTimeout(e)},[]),t?(0,g.jsx)(`div`,{children:e}):null}N.displayName=`LiveMessage`;function P({entry:e,index:t,timers:n,onDismiss:r,getFocusFallback:i}){let a=h.useRef(null);p.usePreserveFocus(a,()=>i(t));let{id:o,options:s}=e;return(0,g.jsx)(w,{ref:a,"data-wave-toast":``,status:s.status,statusLabel:s.statusLabel,title:s.title,dismissLabel:s.dismissLabel,onDismiss:()=>r(o),onPointerEnter:()=>n.pause(o,`hover`),onPointerLeave:()=>n.resume(o,`hover`),onFocus:()=>n.pause(o,`focus`),onBlur:e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||n.resume(o,`focus`)},children:s.body})}P.displayName=`ToasterItem`;var F=({position:e=`bottom-end`,limit:r,className:a,style:d,children:f,onFocus:p,onBlur:m,ref:x,...S})=>{let[C,w]=h.useState([]),O=_(C,v(r));O!==C&&w(O);let k=O.filter(e=>e.shown);h.useEffect(()=>{r!==void 0&&!(r>=1)&&n.warnOnce(`Toaster:limit`,`Toaster: \`limit\` must be 1 or more (got ${String(r)}); it counts as 1.`)},[r]);let M=i.useId(`toast`),F=h.useRef(0),I=h.useRef(null),L=s.useMergedRefs(x,I),R=h.useRef(null),z=l.useDirection(),[B,V]=h.useState(0);h.useLayoutEffect(()=>{let t=()=>{let t=I.current;V(t?A(t,e):0)};t();let n=c.subscribeLayers(t);return window.addEventListener(`resize`,t),document.addEventListener(`transitionend`,t,!0),document.addEventListener(`animationend`,t,!0),()=>{n(),window.removeEventListener(`resize`,t),document.removeEventListener(`transitionend`,t,!0),document.removeEventListener(`animationend`,t,!0)}},[e,z]);let[H]=h.useState(()=>E(e=>w(t=>t.some(t=>t.id===e)?t.filter(t=>t.id!==e):t)));h.useEffect(()=>{let e=document,t=!1,n=()=>H.setInBackground(t||e.visibilityState===`hidden`),r=e=>{e.target instanceof Node||(t=!0,n())},i=e=>{e.target instanceof Node||(t=!1,n())};return n(),H.setSuspended(!1),window.addEventListener(`blur`,r),window.addEventListener(`focus`,i),e.addEventListener(`visibilitychange`,n),()=>{window.removeEventListener(`blur`,r),window.removeEventListener(`focus`,i),e.removeEventListener(`visibilitychange`,n),H.setSuspended(!0)}},[H]),h.useEffect(()=>{for(let e of C)e.shown&&H.start(e.id,e.seq,e.options.timeout??T)},[C,H]);let U=h.useCallback(e=>{F.current+=1;let t=F.current,n=e.toastId??`${M}-${t}`;return w(r=>{let i=r.findIndex(e=>e.id===n);if(i===-1)return[...r,{id:n,options:e,seq:t,shown:!1}];let a=r.slice();return a[i]={id:n,options:e,seq:t,shown:r[i].shown},a}),n},[M]),W=h.useCallback(e=>{H.remove(e),w(t=>t.some(t=>t.id===e)?t.filter(t=>t.id!==e):t)},[H]),G=h.useCallback(()=>{H.clear(),w(e=>e.length===0?e:[])},[H]),K=h.useMemo(()=>({dispatchToast:U,dismissToast:W,dismissAllToasts:G}),[U,W,G]),q=h.useCallback(e=>{let t=I.current,n=t?Array.from(t.children).filter(e=>e instanceof HTMLElement&&e.hasAttribute(`data-wave-toast`)):[];for(let t of[n[e],n[e-1]]){let e=t?.isConnected?o.getFirstTabbable(t):null;if(e)return e}let r=R.current;return R.current=null,r?.isConnected?r:null},[]),J=e=>{let t=e.relatedTarget;t instanceof HTMLElement&&!e.currentTarget.contains(t)&&(R.current=t)},Y=e=>{let t=e.currentTarget,n=e.relatedTarget;if(!(n instanceof Node&&t.contains(n))){if(n===null){let n=e.target;if(!n.isConnected)return;let r=n.ownerDocument.activeElement;if(r&&t.contains(r))return}R.current=null}},X=[],Z=[];for(let e of k){let t=(0,g.jsx)(N,{text:j(e.options)},e.seq);(e.options.status===`error`?Z:X).push(t)}let Q=B>0?{...d,"--wave-toaster-offset":`${B}px`}:d;return(0,g.jsxs)(y.Provider,{value:K,children:[f,(0,g.jsx)(u.Portal,{layer:`toast`,children:(0,g.jsxs)(`div`,{ref:L,role:`region`,"aria-label":`Notifications`,"data-wave-focus-trap-allow":``,"data-position":e,...S,style:Q,onFocus:e=>{p?.(e),J(e)},onBlur:e=>{m?.(e),Y(e)},className:t.cn(`fixed flex w-80 max-w-[calc(100vw-2rem)] flex-col gap-2`,D[e],a),children:[(0,g.jsx)(`div`,{role:`status`,"aria-live":`polite`,"aria-atomic":`false`,className:`sr-only`,children:X}),(0,g.jsx)(`div`,{"aria-live":`assertive`,"aria-atomic":`false`,className:`sr-only`,children:Z}),(0,g.jsx)(b.Provider,{value:!0,children:k.map((e,t)=>(0,g.jsx)(P,{entry:e,index:t,timers:H,onDismiss:W,getFocusFallback:q},e.id))})]})})]})};F.displayName=`Toaster`,exports.Toast=w,exports.Toaster=F,exports.useToastController=C;
2
+ //# sourceMappingURL=Toast.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toast.cjs","names":["React","materialiseSlotContent","slotRendersContent","cn","STATUS_BORDER","STATUS_ICON_COLOR","StatusIcon","StatusText","getStatusLabel","focusRing","DismissIcon","getDirection","getOpenLayers","useId","useMergedRefs","useDirection","subscribeLayers","getFirstTabbable","Portal","require_runtime","require_cn","require_dev","require_slot","require_useId","require_direction","require_focus","require_useMergedRefs","require_layers","require_useDirection","require_Portal","require_styles","require_icons","require_usePreserveFocus","require_MessageBar_status","react","react_jsx_runtime","promoteQueued","shownCount","toast","toasts","limit","resolveLimit","ToasterContext","ToasterRegionContext","INERT_CONTROLLER","options","MISSING_TOASTER_MESSAGE","useToastController","Toast","rest","inToasterRegion","body","children","hasBody","status","className","statusLabel","title","onDismiss","dismissLabel","DEFAULT_TIMEOUT","createToastTimers","timers","pauses","started","inBackground","suspended","sync","timer","id","canRun","onExpire","syncAll","stop","seq","timeout","reasons","reason","value","positionClasses","EDGE_GAP","isOnRightSide","inline","position","rtl","viewport","getSidePanelOffset","modals","layer","doc","view","width","height","right","top","offset","el","box","onSide","onEdge","getAnnouncement","ANNOUNCEMENT_DURATION","LiveMessage","present","setPresent","handle","text","ToasterItem","ref","getFocusFallback","index","entry","next","event","Toaster","limitProp","setToasts","settled","shownToasts","prefix","counterRef","viewportRef","viewportRefs","previousFocusRef","dir","sideOffset","setSideOffset","update","unsubscribe","prev","blurred","handleBlur","handleFocus","dispatchToast","t","dismissToast","dismissAllToasts","controller","remaining","target","previous","rememberFocusOrigin","from","forgetFocusOrigin","to","active","polite","assertive","message","viewportStyle","style","onFocus","onBlur"],"sources":["../../../src/components/feedback/Toast.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { reportMissingContext, warnOnce } from '../../lib/dev';\nimport { getDirection } from '../../lib/direction';\nimport { getFirstTabbable } from '../../lib/focus';\nimport { DismissIcon } from '../../lib/icons';\nimport { getOpenLayers, subscribeLayers } from '../../lib/layers';\nimport { materialiseSlotContent, slotRendersContent } from '../../lib/slot';\nimport { focusRing } from '../../lib/styles';\nimport type { Status } from '../../lib/types';\nimport { useDirection } from '../../hooks/useDirection';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { usePreserveFocus } from '../../hooks/usePreserveFocus';\nimport { Portal } from '../portal/Portal';\nimport {\n STATUS_BORDER,\n STATUS_ICON_COLOR,\n StatusIcon,\n StatusText,\n getStatusLabel,\n} from './MessageBar.status';\n\n/* ------------------------------------------------------------------ */\n/* Types */\n/* ------------------------------------------------------------------ */\n\n/** Options for dispatching a toast notification. */\nexport interface ToastOptions {\n /** Status level controlling the toast color, icon, status text and announcement politeness\n * (`error` is announced assertively, every other status politely).\n * @default 'info'\n */\n status?: Status;\n /** Title text of the toast. */\n title: string;\n /** Optional body text displayed below the title. */\n body?: string;\n /**\n * Auto-dismiss timeout in milliseconds. The countdown starts when the toast is shown (a toast\n * waiting beyond the Toaster's `limit` does not count down) and pauses while the pointer is over\n * the toast, while focus is inside it and while the browser window is in the background (it has\n * lost focus, or the page is not shown, as in a background tab, also when the Toaster mounts\n * there). `0` (or any value that is not a positive finite number) keeps the toast until it is\n * dismissed.\n * @default 5000\n */\n timeout?: number;\n /**\n * Identifier of the toast. `dispatchToast` returns it (a generated one when omitted). Dispatching\n * again with the id of a toast that is still shown replaces that toast (content and timer); with\n * the id of a toast that waits beyond the Toaster's `limit`, it replaces its options and the toast\n * keeps its place in the queue.\n */\n toastId?: string;\n /**\n * Visually hidden status text read before the toast (`'Info:'`, `'Success:'`, `'Warning:'`,\n * `'Error:'` by default). Pass a translation for other languages, or `''` to omit it.\n */\n statusLabel?: string;\n /**\n * Accessible name of the toast's dismiss button. Pass a translation for other languages.\n * @default 'Dismiss'\n */\n dismissLabel?: string;\n}\n\n/** The toast API returned by {@link useToastController}. */\nexport interface ToastController {\n /**\n * Shows a toast and returns its id (`options.toastId`, or a generated one). A toast with the same\n * id is replaced. Beyond the Toaster's `limit`, the toast waits in a queue until it can be shown.\n */\n dispatchToast: (options: ToastOptions) => string;\n /**\n * Removes the toast with this id (shown or waiting) and cancels its timer. Unknown ids are\n * ignored.\n */\n dismissToast: (id: string) => void;\n /** Removes every toast, shown and queued, and cancels their timers. */\n dismissAllToasts: () => void;\n}\n\ninterface ToastEntry {\n id: string;\n options: ToastOptions;\n /** Increases with every dispatch, so a replaced toast is announced again. */\n seq: number;\n /**\n * Whether the toast is shown (rendered, announced, its timer running) or still waits beyond the\n * Toaster's `limit`. Only {@link promoteQueued} sets it; it never goes back to `false`.\n */\n shown: boolean;\n}\n\n/**\n * Flags the oldest waiting toasts as shown while fewer than `limit` are shown. Returns `toasts`\n * itself when nothing changes, so the Toaster's render-time update settles.\n */\nfunction promoteQueued(toasts: ToastEntry[], limit: number): ToastEntry[] {\n let shownCount = 0;\n for (const toast of toasts) if (toast.shown) shownCount += 1;\n if (shownCount >= limit || shownCount === toasts.length) return toasts;\n return toasts.map((toast) => {\n if (toast.shown || shownCount >= limit) return toast;\n shownCount += 1;\n return { ...toast, shown: true };\n });\n}\n\n/** `limit` as the Toaster applies it: whole toasts, at least 1; `undefined` means no limit. */\nfunction resolveLimit(limit: number | undefined): number {\n if (limit === undefined) return Infinity;\n return limit >= 1 ? Math.floor(limit) : 1;\n}\n\n/* ------------------------------------------------------------------ */\n/* Context */\n/* ------------------------------------------------------------------ */\n\nconst ToasterContext = React.createContext<ToastController | null>(null);\nToasterContext.displayName = 'ToasterContext';\n\n/**\n * `true` for the toasts the Toaster renders in its region, which its live regions announce. A\n * Toast rendered anywhere else (also as app content inside `<Toaster>`) is a live region itself.\n */\nconst ToasterRegionContext = React.createContext(false);\nToasterRegionContext.displayName = 'ToasterRegionContext';\n\nconst INERT_CONTROLLER: ToastController = {\n dispatchToast: (options) => options.toastId ?? '',\n dismissToast: () => {},\n dismissAllToasts: () => {},\n};\n\n/** The C-CONTEXT message without the `[WaveUI] ` prefix, which `reportMissingContext` adds. */\nconst MISSING_TOASTER_MESSAGE =\n 'useToastController must be used within <Toaster>. Wrap your app (or the part of it that shows toasts) in <Toaster>: it provides the controller to its children.';\n\n/**\n * Returns the {@link ToastController} of the enclosing `<Toaster>`: `dispatchToast(options)` shows\n * a toast and returns its id, `dismissToast(id)` removes it, `dismissAllToasts()` removes every\n * toast.\n *\n * Must be called inside `<Toaster>`, which provides the controller to its children — wrap the app\n * (or the part of it that shows toasts) in `<Toaster>`; a sibling `<Toaster />` does not work.\n * Outside a Toaster it throws in development; in production it logs an error (once) and returns a\n * controller that does nothing.\n *\n * @example\n * function SaveButton() {\n * const { dispatchToast } = useToastController();\n * return <Button onClick={() => dispatchToast({ status: 'success', title: 'Saved' })}>Save</Button>;\n * }\n * // <Toaster><App /></Toaster>\n */\nexport function useToastController(): ToastController {\n const controller = React.useContext(ToasterContext);\n if (controller) return controller;\n reportMissingContext('useToastController', '<Toaster>', MISSING_TOASTER_MESSAGE);\n return INERT_CONTROLLER;\n}\n\n/* ------------------------------------------------------------------ */\n/* Toast (individual notification) */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the Toast component. */\nexport interface ToastProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Status level controlling the toast color, icon and status text.\n * @default 'info'\n */\n status?: Status;\n /** Title text displayed in the toast. */\n title?: string;\n /**\n * Visually hidden status text read before the toast (`'Info:'`, `'Success:'`, `'Warning:'`,\n * `'Error:'` by default). Pass a translation for other languages, or `''` to omit it.\n */\n statusLabel?: string;\n /** Called when the dismiss button is activated. Passing it renders the dismiss button. */\n onDismiss?: () => void;\n /**\n * Accessible name of the dismiss button. Pass a translation for other languages.\n * @default 'Dismiss'\n */\n dismissLabel?: string;\n /** Ref to the root `<div>`. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * The visual of a single notification: status icon, visually hidden status text, title, body and an\n * optional dismiss button. Usually rendered by `<Toaster>` through `useToastController()`.\n *\n * - **In a Toaster** (dispatched with `useToastController()`): not a live region itself; the\n * Toaster announces it through its permanent live regions.\n * - **On its own** (your own container, an inline notice): a live region, as in 0.4 —\n * `role=\"status\"` with `aria-live=\"polite\"`, or `role=\"alert\"` with `aria-live=\"assertive\"` for\n * `error` (override with `role`/`aria-live`). A live region that is added together with its\n * text is not announced by every screen reader, so render the Toast in advance and change its\n * content, or dispatch it through a Toaster.\n */\nexport const Toast = ({\n status = 'info',\n title,\n statusLabel,\n onDismiss,\n dismissLabel = 'Dismiss',\n className,\n children,\n ref,\n ...rest\n}: ToastProps) => {\n const inToasterRegion = React.useContext(ToasterRegionContext);\n // Content that renders nothing (`''`, `[]`, `<></>`) gets no body element; a generator is read\n // once by the check and its items render.\n const body = materialiseSlotContent(children);\n const hasBody = slotRendersContent(body);\n const liveRegion: React.HTMLAttributes<HTMLDivElement> = inToasterRegion\n ? {}\n : status === 'error'\n ? { role: 'alert', 'aria-live': 'assertive' }\n : { role: 'status', 'aria-live': 'polite' };\n return (\n <div\n ref={ref}\n {...liveRegion}\n {...rest}\n className={cn(\n 'flex items-start gap-3 rounded border border-s-4 border-border bg-background p-3 text-foreground shadow-4',\n STATUS_BORDER[status],\n className,\n )}\n >\n <span\n aria-hidden=\"true\"\n className={cn('mt-0.5 inline-flex shrink-0', STATUS_ICON_COLOR[status])}\n >\n <StatusIcon status={status} />\n </span>\n <div className=\"min-w-0 flex-1\">\n <StatusText label={getStatusLabel(status, statusLabel)} />\n {title ? <div className=\"text-body-2 font-semibold text-foreground\">{title}</div> : null}\n {hasBody ? <div className=\"mt-0.5 text-body-1 text-muted-foreground\">{body}</div> : null}\n </div>\n {onDismiss ? (\n <button\n type=\"button\"\n onClick={() => onDismiss()}\n className={cn(\n 'inline-flex shrink-0 cursor-pointer items-center justify-center rounded border-none bg-transparent p-1 text-muted-foreground',\n 'not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground',\n 'not-disabled:not-aria-disabled:active:bg-subtle-pressed',\n focusRing,\n )}\n aria-label={dismissLabel}\n >\n <DismissIcon />\n </button>\n ) : null}\n </div>\n );\n};\nToast.displayName = 'Toast';\n\n/* ------------------------------------------------------------------ */\n/* Timers */\n/* ------------------------------------------------------------------ */\n\nconst DEFAULT_TIMEOUT = 5000;\n\ntype PauseReason = 'hover' | 'focus';\n\ninterface RunningTimer {\n handle: ReturnType<typeof setTimeout> | null;\n remaining: number;\n startedAt: number;\n}\n\n/**\n * Auto-dismiss timers of one Toaster. A timer runs only while its toast is neither hovered nor\n * focused, the window is in the foreground and the Toaster is mounted; otherwise it is suspended\n * and keeps its remaining time. Every method is called from event handlers or effects, never\n * during render.\n */\ninterface ToastTimers {\n /**\n * Starts the timer of the shown toast `id` for its dispatch `seq`, once: a call with the `seq`\n * already started does nothing, a new `seq` (the toast was replaced) restarts it. A timeout that\n * is not a positive finite number means none. The pause state of `id` is kept: a replaced toast\n * that is hovered or focused stays paused.\n */\n start(id: string, seq: number, timeout: number): void;\n /** Cancels the timer of `id` and forgets its pause state. */\n remove(id: string): void;\n /** Cancels every timer and forgets every pause state. */\n clear(): void;\n pause(id: string, reason: PauseReason): void;\n resume(id: string, reason: PauseReason): void;\n /** `true` while the window has lost focus or the page is not shown (a background tab). */\n setInBackground(inBackground: boolean): void;\n /** `true` while the Toaster is unmounted (including StrictMode's simulated unmount). */\n setSuspended(suspended: boolean): void;\n}\n\nfunction createToastTimers(onExpire: (id: string) => void): ToastTimers {\n const timers = new Map<string, RunningTimer>();\n const pauses = new Map<string, Set<PauseReason>>();\n /** The dispatch (`seq`) whose timer was started last, per toast. */\n const started = new Map<string, number>();\n let inBackground = false;\n let suspended = false;\n\n const sync = (id: string) => {\n const timer = timers.get(id);\n if (!timer) return;\n const canRun = !suspended && !inBackground && !(pauses.get(id)?.size ?? 0);\n if (canRun && timer.handle === null) {\n timer.startedAt = Date.now();\n timer.handle = setTimeout(() => {\n timers.delete(id);\n pauses.delete(id);\n started.delete(id);\n onExpire(id);\n }, timer.remaining);\n } else if (!canRun && timer.handle !== null) {\n clearTimeout(timer.handle);\n timer.handle = null;\n timer.remaining = Math.max(0, timer.remaining - (Date.now() - timer.startedAt));\n }\n };\n const syncAll = () => {\n for (const id of Array.from(timers.keys())) sync(id);\n };\n const stop = (id: string) => {\n const timer = timers.get(id);\n if (timer?.handle != null) clearTimeout(timer.handle);\n timers.delete(id);\n };\n\n return {\n start(id, seq, timeout) {\n if (started.get(id) === seq) return;\n started.set(id, seq);\n stop(id);\n if (!(timeout > 0) || !Number.isFinite(timeout)) return;\n timers.set(id, { handle: null, remaining: timeout, startedAt: 0 });\n sync(id);\n },\n remove(id) {\n stop(id);\n pauses.delete(id);\n started.delete(id);\n },\n clear() {\n for (const id of Array.from(timers.keys())) stop(id);\n pauses.clear();\n started.clear();\n },\n pause(id, reason) {\n let reasons = pauses.get(id);\n if (!reasons) {\n reasons = new Set();\n pauses.set(id, reasons);\n }\n reasons.add(reason);\n sync(id);\n },\n resume(id, reason) {\n pauses.get(id)?.delete(reason);\n sync(id);\n },\n setInBackground(value) {\n inBackground = value;\n syncAll();\n },\n setSuspended(value) {\n suspended = value;\n syncAll();\n },\n };\n}\n\n/* ------------------------------------------------------------------ */\n/* Toaster (container) */\n/* ------------------------------------------------------------------ */\n\n/**\n * Corner of the viewport a {@link Toaster} shows its toasts in (`ToasterProps.position`).\n * `start`/`end` follow the writing direction; `left`/`right` are physical.\n */\nexport type ToastPosition =\n | 'top-start'\n | 'top-end'\n | 'bottom-start'\n | 'bottom-end'\n | 'top-right'\n | 'top-left'\n | 'bottom-right'\n | 'bottom-left';\n\n/** Properties for the Toaster container component. */\nexport interface ToasterProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Corner of the viewport the toasts appear in. `start`/`end` follow the writing direction (the\n * `end` side is the right in LTR and the left in RTL); `left`/`right` are physical.\n * @default 'bottom-end'\n */\n position?: ToastPosition;\n /**\n * Most toasts shown at once. Further toasts wait in a queue (in dispatch order) and appear when\n * a shown toast goes; a queued toast is not announced and its timer does not run until then.\n * Lowering it never hides a toast that is already shown. A value below 1 counts as 1\n * (development warning); `Infinity` means no limit.\n * @default Infinity\n */\n limit?: number;\n /** Ref to the toast region (the portaled `<div role=\"region\">`). */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * Corner placement. The margin on the toasts' side is `--wave-toaster-offset`, which the Toaster\n * sets while a modal panel covers that side (see {@link getSidePanelOffset}); unset, it is `0`.\n */\nconst positionClasses: Record<ToastPosition, string> = {\n 'top-start': 'top-4 start-4 ms-(--wave-toaster-offset)',\n 'top-end': 'top-4 end-4 me-(--wave-toaster-offset)',\n 'bottom-start': 'bottom-4 start-4 ms-(--wave-toaster-offset)',\n 'bottom-end': 'bottom-4 end-4 me-(--wave-toaster-offset)',\n 'top-right': 'top-4 right-4 mr-(--wave-toaster-offset)', // wave-allow-physical: explicit physical position value\n 'top-left': 'top-4 left-4 ml-(--wave-toaster-offset)', // wave-allow-physical: explicit physical position value\n 'bottom-right': 'bottom-4 right-4 mr-(--wave-toaster-offset)', // wave-allow-physical: explicit physical position value\n 'bottom-left': 'bottom-4 left-4 ml-(--wave-toaster-offset)', // wave-allow-physical: explicit physical position value\n};\n\n/** The toasts' distance from the window edges (`*-4`), also the tolerance for \"at the edge\". */\nconst EDGE_GAP = 16;\n\n/** Whether the toasts sit at the right edge of the window (`end` is the right in LTR). */\nfunction isOnRightSide(position: ToastPosition, viewport: HTMLElement): boolean {\n const inline = position.slice(position.indexOf('-') + 1);\n if (inline === 'right' || inline === 'left') return inline === 'right';\n const rtl = getDirection(viewport) === 'rtl';\n return inline === 'end' ? !rtl : rtl;\n}\n\n/**\n * How far the toasts move away from their side while an open modal surface (a Drawer panel) covers\n * their corner, so they never hide the panel's controls (WCAG 2.4.11 Focus Not Obscured): the\n * surface's width from that side of the window, which leaves the usual gap between toasts and\n * panel. A surface counts when it reaches the toasts' side and their top or bottom edge (a centered\n * Dialog does not). `0` when no such surface is open, or when the toasts would not fit beside it\n * (a full-width panel on a phone): then they keep their corner.\n */\nfunction getSidePanelOffset(viewport: HTMLElement, position: ToastPosition): number {\n const modals = getOpenLayers().filter((layer) => layer.kind === 'modal');\n if (modals.length === 0) return 0;\n const doc = viewport.ownerDocument;\n const view = doc.defaultView;\n if (!view) return 0;\n // The box fixed elements are placed in: the window without its scrollbars.\n const width = doc.documentElement.clientWidth || view.innerWidth;\n const height = doc.documentElement.clientHeight || view.innerHeight;\n const right = isOnRightSide(position, viewport);\n const top = position.startsWith('top');\n\n let offset = 0;\n for (const layer of modals) {\n for (const el of layer.getElements()) {\n if (!el?.isConnected) continue;\n const box = el.getBoundingClientRect();\n if (box.width <= 0 || box.height <= 0) continue;\n const onSide = right ? box.right >= width - EDGE_GAP : box.left <= EDGE_GAP;\n const onEdge = top ? box.top <= EDGE_GAP : box.bottom >= height - EDGE_GAP;\n if (onSide && onEdge) offset = Math.max(offset, right ? width - box.left : box.right);\n }\n }\n if (offset <= 0 || width - offset < viewport.offsetWidth + 2 * EDGE_GAP) return 0;\n return Math.ceil(offset);\n}\n\n/** The text written into the live region for a toast (\"Error: Upload failed Try again.\"). */\nfunction getAnnouncement({ status = 'info', statusLabel, title, body }: ToastOptions): string {\n return [getStatusLabel(status, statusLabel), title, body].filter(Boolean).join(' ');\n}\n\n/**\n * How long a toast's text stays in the live region: long enough for screen readers to pick it up\n * (also a polite message queued behind other speech), short enough that someone browsing the\n * Notifications region later meets the text once, in the toast, not a second time in the region.\n */\nconst ANNOUNCEMENT_DURATION = 2000;\n\n/**\n * One toast's message in a live region. It is added when the toast is shown (at dispatch, or when\n * a waiting toast appears; a replacement remounts it, so it is read again) and removed after\n * {@link ANNOUNCEMENT_DURATION} or with the toast. Removal is not announced (`aria-relevant` stays\n * at its default, additions and text).\n */\nfunction LiveMessage({ text }: { text: string }) {\n const [present, setPresent] = React.useState(true);\n React.useEffect(() => {\n const handle = setTimeout(() => setPresent(false), ANNOUNCEMENT_DURATION);\n return () => clearTimeout(handle);\n }, []);\n return present ? <div>{text}</div> : null;\n}\nLiveMessage.displayName = 'LiveMessage';\n\ninterface ToasterItemProps {\n entry: ToastEntry;\n index: number;\n timers: ToastTimers;\n onDismiss: (id: string) => void;\n getFocusFallback: (index: number) => HTMLElement | null;\n}\n\n/** One toast of the Toaster: pause handlers and focus preservation on removal. */\nfunction ToasterItem({ entry, index, timers, onDismiss, getFocusFallback }: ToasterItemProps) {\n const ref = React.useRef<HTMLDivElement>(null);\n usePreserveFocus(ref, () => getFocusFallback(index));\n const { id, options } = entry;\n return (\n <Toast\n ref={ref}\n data-wave-toast=\"\"\n status={options.status}\n statusLabel={options.statusLabel}\n title={options.title}\n dismissLabel={options.dismissLabel}\n onDismiss={() => onDismiss(id)}\n onPointerEnter={() => timers.pause(id, 'hover')}\n onPointerLeave={() => timers.resume(id, 'hover')}\n onFocus={() => timers.pause(id, 'focus')}\n onBlur={(event) => {\n const next = event.relatedTarget;\n if (next instanceof Node && event.currentTarget.contains(next)) return;\n timers.resume(id, 'focus');\n }}\n >\n {options.body}\n </Toast>\n );\n}\nToasterItem.displayName = 'ToasterItem';\n\n/**\n * Provides {@link useToastController} to its children and shows the dispatched toasts.\n *\n * - **Wrap the app** in `<Toaster>`; components below it call `useToastController()`.\n * - The toasts render in a portal (the `toast` layer, above dialogs) inside a region labelled\n * \"Notifications\" (override with `aria-label`). The region is allow-listed for modals\n * (`data-wave-focus-trap-allow`): it stays reachable by Tab and exposed to assistive technology\n * while a Dialog or Drawer is open, and clicking a toast never dismisses the overlay below.\n * - Two permanent, visually hidden live regions (polite, and assertive for `error`) announce every\n * toast; the toasts themselves are not live regions. Each message stays in its live region for\n * 2 seconds (or until its toast goes), so browsing the region later meets the text only once.\n * - While an open modal panel covers the toasts' corner (a Drawer on the same side), the toasts\n * move beside it, so they never hide its focused controls (WCAG 2.4.11). Without room beside it\n * (a full-width panel on a narrow screen) they keep their corner.\n * - Timers pause while a toast is hovered or focused and while the window is in the background\n * (it has lost focus, or the page is not shown, as in a background tab).\n * When a toast that contains focus goes away, focus moves to the next toast (or the previous one\n * when the last toast goes), or back to the element that was focused before focus entered the\n * toasts once no toast is left (kept across the moves between toasts and while another window\n * is active; forgotten once focus has returned to it, and when focus leaves the toasts for\n * another element or for the page body).\n * - Each toast's dismiss button is named \"Dismiss\"; pass `dismissLabel` to `dispatchToast` for\n * other languages.\n * - `limit` caps how many toasts show at once: the others wait in a queue, in dispatch order,\n * unannounced and without a running timer, and appear as shown toasts go.\n * `dismissAllToasts()` removes every toast, shown and queued.\n *\n * @example\n * <Toaster position=\"bottom-end\" limit={3}>\n * <App />\n * </Toaster>\n */\nexport const Toaster = ({\n position = 'bottom-end',\n limit: limitProp,\n className,\n style,\n children,\n onFocus,\n onBlur,\n ref,\n ...rest\n}: ToasterProps) => {\n const [toasts, setToasts] = React.useState<ToastEntry[]>([]);\n const limit = resolveLimit(limitProp);\n // Waiting toasts are shown here, during render, with the current limit (adjust state while\n // rendering, C-HOOKS): every path that frees a place or raises the limit promotes them, and a\n // lowered limit never hides a shown toast. `promoteQueued` returns the same array once settled.\n const settled = promoteQueued(toasts, limit);\n if (settled !== toasts) setToasts(settled);\n const shownToasts = settled.filter((toast) => toast.shown);\n\n // Development diagnostics (C-DEV): emitted from an effect, once per page.\n React.useEffect(() => {\n if (limitProp !== undefined && !(limitProp >= 1)) {\n warnOnce(\n 'Toaster:limit',\n `Toaster: \\`limit\\` must be 1 or more (got ${String(limitProp)}); it counts as 1.`,\n );\n }\n }, [limitProp]);\n const prefix = useId('toast');\n const counterRef = React.useRef(0);\n const viewportRef = React.useRef<HTMLDivElement | null>(null);\n const viewportRefs = useMergedRefs(ref, viewportRef);\n const previousFocusRef = React.useRef<HTMLElement | null>(null);\n const dir = useDirection();\n\n // Beside an open modal panel on the toasts' side (a Drawer), not over its controls. Measured when\n // a layer opens or closes (synchronously in its layout effect, before paint), on resize, and\n // after a transition or animation (a panel that slides in reaches its place only then).\n const [sideOffset, setSideOffset] = React.useState(0);\n React.useLayoutEffect(() => {\n const update = () => {\n const viewport = viewportRef.current;\n setSideOffset(viewport ? getSidePanelOffset(viewport, position) : 0);\n };\n update();\n const unsubscribe = subscribeLayers(update);\n window.addEventListener('resize', update);\n document.addEventListener('transitionend', update, true);\n document.addEventListener('animationend', update, true);\n return () => {\n unsubscribe();\n window.removeEventListener('resize', update);\n document.removeEventListener('transitionend', update, true);\n document.removeEventListener('animationend', update, true);\n };\n }, [position, dir]);\n\n const [timers] = React.useState(() =>\n createToastTimers((id) =>\n setToasts((prev) => (prev.some((t) => t.id === id) ? prev.filter((t) => t.id !== id) : prev)),\n ),\n );\n\n // Timers run only while mounted (StrictMode's simulated unmount suspends and resumes them) and\n // pause while the window is in the background: after the window loses focus, and while the page\n // is not shown. The page visibility is read at mount too, so a Toaster that mounts in a\n // background tab waits until the tab is shown. (Focus is not read at mount: `hasFocus()` is also\n // false in an embedded frame nobody clicked yet and in test DOMs.)\n React.useEffect(() => {\n const doc = document;\n let blurred = false;\n const update = () => timers.setInBackground(blurred || doc.visibilityState === 'hidden');\n // Only the window's own blur/focus (element focus events do not bubble to a bubble-phase\n // window listener; anything targeted at a node is ignored).\n const handleBlur = (event: FocusEvent) => {\n if (event.target instanceof Node) return;\n blurred = true;\n update();\n };\n const handleFocus = (event: FocusEvent) => {\n if (event.target instanceof Node) return;\n blurred = false;\n update();\n };\n update();\n timers.setSuspended(false);\n window.addEventListener('blur', handleBlur);\n window.addEventListener('focus', handleFocus);\n doc.addEventListener('visibilitychange', update);\n return () => {\n window.removeEventListener('blur', handleBlur);\n window.removeEventListener('focus', handleFocus);\n doc.removeEventListener('visibilitychange', update);\n timers.setSuspended(true);\n };\n }, [timers]);\n\n // Starts the timer of every newly shown toast, and restarts it for a shown toast dispatched again\n // (a new `seq`); `timers.start` ignores a dispatch it has already started.\n React.useEffect(() => {\n for (const toast of toasts) {\n if (toast.shown) timers.start(toast.id, toast.seq, toast.options.timeout ?? DEFAULT_TIMEOUT);\n }\n }, [toasts, timers]);\n\n // A new toast waits until the render promotes it; a replaced one keeps its place and whether it\n // is shown (a waiting toast keeps waiting with the new options).\n const dispatchToast = React.useCallback(\n (options: ToastOptions): string => {\n counterRef.current += 1;\n const seq = counterRef.current;\n const id = options.toastId ?? `${prefix}-${seq}`;\n setToasts((prev) => {\n const index = prev.findIndex((t) => t.id === id);\n if (index === -1) return [...prev, { id, options, seq, shown: false }];\n const next = prev.slice();\n next[index] = { id, options, seq, shown: prev[index].shown };\n return next;\n });\n return id;\n },\n [prefix],\n );\n\n const dismissToast = React.useCallback(\n (id: string) => {\n timers.remove(id);\n setToasts((prev) => (prev.some((t) => t.id === id) ? prev.filter((t) => t.id !== id) : prev));\n },\n [timers],\n );\n\n const dismissAllToasts = React.useCallback(() => {\n timers.clear();\n setToasts((prev) => (prev.length === 0 ? prev : []));\n }, [timers]);\n\n const controller = React.useMemo<ToastController>(\n () => ({ dispatchToast, dismissToast, dismissAllToasts }),\n [dispatchToast, dismissToast, dismissAllToasts],\n );\n\n // Runs after the removed toast is gone (possibly after the whole Toaster): never throws.\n const getFocusFallback = React.useCallback((index: number): HTMLElement | null => {\n const viewport = viewportRef.current;\n const remaining = viewport\n ? Array.from(viewport.children).filter(\n (el): el is HTMLElement =>\n el instanceof HTMLElement && el.hasAttribute('data-wave-toast'),\n )\n : [];\n for (const toast of [remaining[index], remaining[index - 1]]) {\n const target = toast?.isConnected ? getFirstTabbable(toast) : null;\n if (target) return target;\n }\n // Focus leaves the toasts here without a blur of the viewport (the focused node is gone), so\n // the element is forgotten as it is used: a toast focused later from nowhere does not send\n // focus back to it.\n const previous = previousFocusRef.current;\n previousFocusRef.current = null;\n return previous?.isConnected ? previous : null;\n }, []);\n\n // Focus entering the toasts from an element outside: return there when the focused toast goes.\n // Focus that arrives with no related target keeps what is remembered: that is the Toaster's own\n // move to the next toast after a removal (focus passed through `<body>` while the removed node\n // was gone) or the window regaining focus. Moves between toasts change nothing.\n const rememberFocusOrigin = (event: React.FocusEvent<HTMLDivElement>) => {\n const from = event.relatedTarget;\n if (from instanceof HTMLElement && !event.currentTarget.contains(from)) {\n previousFocusRef.current = from;\n }\n };\n\n // Focus leaving the toasts for another element or for `<body>` forgets the element, so a toast\n // focused again later from nowhere never sends focus back to something focused long before.\n // Kept: moves between toasts, a removed toast (its node is gone; the Toaster moves focus itself)\n // and the window losing focus (the element keeps document focus while another window is active).\n const forgetFocusOrigin = (event: React.FocusEvent<HTMLDivElement>) => {\n const viewport = event.currentTarget;\n const to = event.relatedTarget;\n if (to instanceof Node && viewport.contains(to)) return;\n if (to === null) {\n const from = event.target;\n if (!from.isConnected) return;\n const active = from.ownerDocument.activeElement;\n if (active && viewport.contains(active)) return;\n }\n previousFocusRef.current = null;\n };\n\n // Only shown toasts are announced: a waiting toast is announced when it appears.\n const polite: React.ReactNode[] = [];\n const assertive: React.ReactNode[] = [];\n for (const toast of shownToasts) {\n const message = <LiveMessage key={toast.seq} text={getAnnouncement(toast.options)} />;\n (toast.options.status === 'error' ? assertive : polite).push(message);\n }\n\n const viewportStyle =\n sideOffset > 0\n ? ({ ...style, '--wave-toaster-offset': `${sideOffset}px` } as React.CSSProperties)\n : style;\n\n return (\n <ToasterContext.Provider value={controller}>\n {children}\n <Portal layer=\"toast\">\n <div\n ref={viewportRefs}\n role=\"region\"\n aria-label=\"Notifications\"\n data-wave-focus-trap-allow=\"\"\n data-position={position}\n {...rest}\n style={viewportStyle}\n onFocus={(event) => {\n // Bookkeeping always runs (a consumer's preventDefault() cannot cancel a focus change).\n onFocus?.(event);\n rememberFocusOrigin(event);\n }}\n onBlur={(event) => {\n onBlur?.(event);\n forgetFocusOrigin(event);\n }}\n className={cn(\n 'fixed flex w-80 max-w-[calc(100vw-2rem)] flex-col gap-2',\n positionClasses[position],\n className,\n )}\n >\n {/* One message per toast for its first 2 s; not atomic, so only the added one is read. */}\n <div role=\"status\" aria-live=\"polite\" aria-atomic=\"false\" className=\"sr-only\">\n {polite}\n </div>\n <div aria-live=\"assertive\" aria-atomic=\"false\" className=\"sr-only\">\n {assertive}\n </div>\n <ToasterRegionContext.Provider value={true}>\n {/* The index within the rendered (shown) toasts, which getFocusFallback walks. Today the\n shown toasts are a prefix of the entries (appended, promoted oldest first, replaced\n in place, removed in order), so it equals the entry index; the shown list stays the\n source so that a change to that order cannot break focus movement. */}\n {shownToasts.map((toast, index) => (\n <ToasterItem\n key={toast.id}\n entry={toast}\n index={index}\n timers={timers}\n onDismiss={dismissToast}\n getFocusFallback={getFocusFallback}\n />\n ))}\n </ToasterRegionContext.Provider>\n </div>\n </Portal>\n </ToasterContext.Provider>\n );\n};\nToaster.displayName = 'Toaster';\n"],"mappings":"qoBAmGA,SAASoC,EAAc,EAAsB,EAA6B,CACxE,IAAIC,EAAa,EACjB,IAAK,IAAMC,KAASC,EAAYD,EAAM,QAAO,GAAc,GAE3D,OADID,GAAcG,GAASH,IAAeE,EAAO,OAAeA,EACzDA,EAAO,IAAK,GACbD,EAAM,OAASD,GAAcG,EAAcF,GAC/C,GAAc,EACP,CAAE,GAAGA,EAAO,MAAO,EAAK,EAChC,CACH,CAGA,SAASG,EAAa,EAAmC,CAEvD,OADID,IAAU,IAAA,GAAkB,IACzBA,GAAS,EAAI,KAAK,MAAMA,CAAK,EAAI,CAC1C,CAMA,IAAME,EAAiB1C,EAAM,cAAsC,IAAI,EACvE,EAAe,YAAc,iBAM7B,IAAM2C,EAAuB3C,EAAM,cAAc,EAAK,EACtD,EAAqB,YAAc,uBAEnC,IAAM4C,EAAoC,CACxC,cAAgB,GAAYC,EAAQ,SAAW,GAC/C,iBAAoB,CAAC,EACrB,qBAAwB,CAAC,CAC3B,EAGMC,EACJ,kKAmBF,SAAgBC,GAAsC,CAIpD,OAHmB/C,EAAM,WAAW0C,CAChC,IACJrB,EAAA,qBAAqB,qBAA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AA4C,GACnFA,EAAM,QAAQ,SAAW,QAAU6G,EAAYD,EAAA,CAAQ,KAAKE,CAAO,CACtE,CAEA,IAAMC,EACJxB,EAAa,EACR,CAAE,GAAGyB,EAAO,wBAAyB,GAAGzB,EAAW,GAAI,EACxDyB,EAEN,OACE,EAAAnH,EAAA,KAAA,CAACO,EAAe,SAAhB,CAAyB,MAAO+F,EAAhC,SAAA,CACGrF,GACD,EAAAjB,EAAA,IAAA,CAACjB,EAAAA,OAAD,CAAQ,MAAM,QACZ,UAAA,EAAAiB,EAAA,KAAA,CAAC,MAAD,CACE,IAAKuF,EACL,KAAK,SACL,aAAW,gBACX,6BAA2B,GAC3B,gBAAevC,EACf,GAAIlC,EACJ,MAAOoG,EACP,QAAU,GAAU,CAElBE,IAAUtC,CAAK,EACf4B,EAAoB5B,CAAK,CAC3B,EACA,OAAS,GAAU,CACjBuC,IAASvC,CAAK,EACd8B,EAAkB9B,CAAK,CACzB,EACA,UAAW9G,EAAAA,GACT,0DACA4E,EAAgBI,GAChB5B,CACF,EArBF,SAAA,EAwBE,EAAApB,EAAA,IAAA,CAAC,MAAD,CAAK,KAAK,SAAS,YAAU,SAAS,cAAY,QAAQ,UAAU,UACjE,SAAA+G,CACE,CAAA,GACL,EAAA/G,EAAA,IAAA,CAAC,MAAD,CAAK,YAAU,YAAY,cAAY,QAAQ,UAAU,UACtD,SAAAgH,CACE,CAAA,GACL,EAAAhH,EAAA,IAAA,CAACQ,EAAqB,SAAtB,CAA+B,MAAO,GAKnC,SAAA2E,EAAY,KAAK,EAAO,KACvB,EAAAnF,EAAA,IAAA,CAACwE,EAAD,CAEE,MAAOrE,EACA,QACC,SACR,UAAWiG,EACO,kBACnB,EANMjG,EAAM,EAMZ,CACF,CAC4B,CAAA,CAC5B,GACC,CAAA,CACe,GAE7B,EACA,EAAQ,YAAc"}
@@ -0,0 +1,347 @@
1
+ "use client";
2
+ import { cn as e } from "../../lib/cn.mjs";
3
+ import { reportMissingContext as t, warnOnce as n } from "../../lib/dev.mjs";
4
+ import { materialiseSlotContent as r, slotRendersContent as i } from "../../lib/slot.mjs";
5
+ import { useId as a } from "../../hooks/useId.mjs";
6
+ import { getDirection as o } from "../../lib/direction.mjs";
7
+ import { getFirstTabbable as s } from "../../lib/focus.mjs";
8
+ import { useMergedRefs as c } from "../../hooks/useMergedRefs.mjs";
9
+ import { getOpenLayers as l, subscribeLayers as u } from "../../lib/layers.mjs";
10
+ import { useDirection as d } from "../../hooks/useDirection.mjs";
11
+ import { Portal as f } from "../portal/Portal.mjs";
12
+ import { focusRing as p } from "../../lib/styles.mjs";
13
+ import { DismissIcon as m } from "../../lib/icons.mjs";
14
+ import { usePreserveFocus as h } from "../../hooks/usePreserveFocus.mjs";
15
+ import { STATUS_BORDER as g, STATUS_ICON_COLOR as _, StatusIcon as v, StatusText as y, getStatusLabel as b } from "./MessageBar.status.mjs";
16
+ import * as x from "react";
17
+ import { jsx as S, jsxs as C } from "react/jsx-runtime";
18
+ //#region src/components/feedback/Toast.tsx
19
+ function w(e, t) {
20
+ let n = 0;
21
+ for (let t of e) t.shown && (n += 1);
22
+ return n >= t || n === e.length ? e : e.map((e) => e.shown || n >= t ? e : (n += 1, {
23
+ ...e,
24
+ shown: !0
25
+ }));
26
+ }
27
+ function T(e) {
28
+ return e === void 0 ? Infinity : e >= 1 ? Math.floor(e) : 1;
29
+ }
30
+ var E = x.createContext(null);
31
+ E.displayName = "ToasterContext";
32
+ var D = x.createContext(!1);
33
+ D.displayName = "ToasterRegionContext";
34
+ var O = {
35
+ dispatchToast: (e) => e.toastId ?? "",
36
+ dismissToast: () => {},
37
+ dismissAllToasts: () => {}
38
+ }, k = "useToastController must be used within <Toaster>. Wrap your app (or the part of it that shows toasts) in <Toaster>: it provides the controller to its children.";
39
+ function A() {
40
+ return x.useContext(E) || (t("useToastController", "<Toaster>", k), O);
41
+ }
42
+ var j = ({ status: t = "info", title: n, statusLabel: a, onDismiss: o, dismissLabel: s = "Dismiss", className: c, children: l, ref: u, ...d }) => {
43
+ let f = x.useContext(D), h = r(l), w = i(h);
44
+ return /* @__PURE__ */ C("div", {
45
+ ref: u,
46
+ ...f ? {} : t === "error" ? {
47
+ role: "alert",
48
+ "aria-live": "assertive"
49
+ } : {
50
+ role: "status",
51
+ "aria-live": "polite"
52
+ },
53
+ ...d,
54
+ className: e("flex items-start gap-3 rounded border border-s-4 border-border bg-background p-3 text-foreground shadow-4", g[t], c),
55
+ children: [
56
+ /* @__PURE__ */ S("span", {
57
+ "aria-hidden": "true",
58
+ className: e("mt-0.5 inline-flex shrink-0", _[t]),
59
+ children: /* @__PURE__ */ S(v, { status: t })
60
+ }),
61
+ /* @__PURE__ */ C("div", {
62
+ className: "min-w-0 flex-1",
63
+ children: [
64
+ /* @__PURE__ */ S(y, { label: b(t, a) }),
65
+ n ? /* @__PURE__ */ S("div", {
66
+ className: "text-body-2 font-semibold text-foreground",
67
+ children: n
68
+ }) : null,
69
+ w ? /* @__PURE__ */ S("div", {
70
+ className: "mt-0.5 text-body-1 text-muted-foreground",
71
+ children: h
72
+ }) : null
73
+ ]
74
+ }),
75
+ o ? /* @__PURE__ */ S("button", {
76
+ type: "button",
77
+ onClick: () => o(),
78
+ className: e("inline-flex shrink-0 cursor-pointer items-center justify-center rounded border-none bg-transparent p-1 text-muted-foreground", "not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground", "not-disabled:not-aria-disabled:active:bg-subtle-pressed", p),
79
+ "aria-label": s,
80
+ children: /* @__PURE__ */ S(m, {})
81
+ }) : null
82
+ ]
83
+ });
84
+ };
85
+ j.displayName = "Toast";
86
+ var M = 5e3;
87
+ function N(e) {
88
+ let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = !1, a = !1, o = (o) => {
89
+ let s = t.get(o);
90
+ if (!s) return;
91
+ let c = !a && !i && !(n.get(o)?.size ?? 0);
92
+ c && s.handle === null ? (s.startedAt = Date.now(), s.handle = setTimeout(() => {
93
+ t.delete(o), n.delete(o), r.delete(o), e(o);
94
+ }, s.remaining)) : !c && s.handle !== null && (clearTimeout(s.handle), s.handle = null, s.remaining = Math.max(0, s.remaining - (Date.now() - s.startedAt)));
95
+ }, s = () => {
96
+ for (let e of Array.from(t.keys())) o(e);
97
+ }, c = (e) => {
98
+ let n = t.get(e);
99
+ n?.handle != null && clearTimeout(n.handle), t.delete(e);
100
+ };
101
+ return {
102
+ start(e, n, i) {
103
+ r.get(e) !== n && (r.set(e, n), c(e), i > 0 && Number.isFinite(i) && (t.set(e, {
104
+ handle: null,
105
+ remaining: i,
106
+ startedAt: 0
107
+ }), o(e)));
108
+ },
109
+ remove(e) {
110
+ c(e), n.delete(e), r.delete(e);
111
+ },
112
+ clear() {
113
+ for (let e of Array.from(t.keys())) c(e);
114
+ n.clear(), r.clear();
115
+ },
116
+ pause(e, t) {
117
+ let r = n.get(e);
118
+ r || (r = /* @__PURE__ */ new Set(), n.set(e, r)), r.add(t), o(e);
119
+ },
120
+ resume(e, t) {
121
+ n.get(e)?.delete(t), o(e);
122
+ },
123
+ setInBackground(e) {
124
+ i = e, s();
125
+ },
126
+ setSuspended(e) {
127
+ a = e, s();
128
+ }
129
+ };
130
+ }
131
+ var P = {
132
+ "top-start": "top-4 start-4 ms-(--wave-toaster-offset)",
133
+ "top-end": "top-4 end-4 me-(--wave-toaster-offset)",
134
+ "bottom-start": "bottom-4 start-4 ms-(--wave-toaster-offset)",
135
+ "bottom-end": "bottom-4 end-4 me-(--wave-toaster-offset)",
136
+ "top-right": "top-4 right-4 mr-(--wave-toaster-offset)",
137
+ "top-left": "top-4 left-4 ml-(--wave-toaster-offset)",
138
+ "bottom-right": "bottom-4 right-4 mr-(--wave-toaster-offset)",
139
+ "bottom-left": "bottom-4 left-4 ml-(--wave-toaster-offset)"
140
+ }, F = 16;
141
+ function I(e, t) {
142
+ let n = e.slice(e.indexOf("-") + 1);
143
+ if (n === "right" || n === "left") return n === "right";
144
+ let r = o(t) === "rtl";
145
+ return n === "end" ? !r : r;
146
+ }
147
+ function L(e, t) {
148
+ let n = l().filter((e) => e.kind === "modal");
149
+ if (n.length === 0) return 0;
150
+ let r = e.ownerDocument, i = r.defaultView;
151
+ if (!i) return 0;
152
+ let a = r.documentElement.clientWidth || i.innerWidth, o = r.documentElement.clientHeight || i.innerHeight, s = I(t, e), c = t.startsWith("top"), u = 0;
153
+ for (let e of n) for (let t of e.getElements()) {
154
+ if (!t?.isConnected) continue;
155
+ let e = t.getBoundingClientRect();
156
+ if (e.width <= 0 || e.height <= 0) continue;
157
+ let n = s ? e.right >= a - F : e.left <= F, r = c ? e.top <= F : e.bottom >= o - F;
158
+ n && r && (u = Math.max(u, s ? a - e.left : e.right));
159
+ }
160
+ return u <= 0 || a - u < e.offsetWidth + 32 ? 0 : Math.ceil(u);
161
+ }
162
+ function R({ status: e = "info", statusLabel: t, title: n, body: r }) {
163
+ return [
164
+ b(e, t),
165
+ n,
166
+ r
167
+ ].filter(Boolean).join(" ");
168
+ }
169
+ var z = 2e3;
170
+ function B({ text: e }) {
171
+ let [t, n] = x.useState(!0);
172
+ return x.useEffect(() => {
173
+ let e = setTimeout(() => n(!1), z);
174
+ return () => clearTimeout(e);
175
+ }, []), t ? /* @__PURE__ */ S("div", { children: e }) : null;
176
+ }
177
+ B.displayName = "LiveMessage";
178
+ function V({ entry: e, index: t, timers: n, onDismiss: r, getFocusFallback: i }) {
179
+ let a = x.useRef(null);
180
+ h(a, () => i(t));
181
+ let { id: o, options: s } = e;
182
+ return /* @__PURE__ */ S(j, {
183
+ ref: a,
184
+ "data-wave-toast": "",
185
+ status: s.status,
186
+ statusLabel: s.statusLabel,
187
+ title: s.title,
188
+ dismissLabel: s.dismissLabel,
189
+ onDismiss: () => r(o),
190
+ onPointerEnter: () => n.pause(o, "hover"),
191
+ onPointerLeave: () => n.resume(o, "hover"),
192
+ onFocus: () => n.pause(o, "focus"),
193
+ onBlur: (e) => {
194
+ let t = e.relatedTarget;
195
+ t instanceof Node && e.currentTarget.contains(t) || n.resume(o, "focus");
196
+ },
197
+ children: s.body
198
+ });
199
+ }
200
+ V.displayName = "ToasterItem";
201
+ var H = ({ position: t = "bottom-end", limit: r, className: i, style: o, children: l, onFocus: p, onBlur: m, ref: h, ...g }) => {
202
+ let [_, v] = x.useState([]), y = w(_, T(r));
203
+ y !== _ && v(y);
204
+ let b = y.filter((e) => e.shown);
205
+ x.useEffect(() => {
206
+ r !== void 0 && !(r >= 1) && n("Toaster:limit", `Toaster: \`limit\` must be 1 or more (got ${String(r)}); it counts as 1.`);
207
+ }, [r]);
208
+ let O = a("toast"), k = x.useRef(0), A = x.useRef(null), j = c(h, A), F = x.useRef(null), I = d(), [z, H] = x.useState(0);
209
+ x.useLayoutEffect(() => {
210
+ let e = () => {
211
+ let e = A.current;
212
+ H(e ? L(e, t) : 0);
213
+ };
214
+ e();
215
+ let n = u(e);
216
+ return window.addEventListener("resize", e), document.addEventListener("transitionend", e, !0), document.addEventListener("animationend", e, !0), () => {
217
+ n(), window.removeEventListener("resize", e), document.removeEventListener("transitionend", e, !0), document.removeEventListener("animationend", e, !0);
218
+ };
219
+ }, [t, I]);
220
+ let [U] = x.useState(() => N((e) => v((t) => t.some((t) => t.id === e) ? t.filter((t) => t.id !== e) : t)));
221
+ x.useEffect(() => {
222
+ let e = document, t = !1, n = () => U.setInBackground(t || e.visibilityState === "hidden"), r = (e) => {
223
+ e.target instanceof Node || (t = !0, n());
224
+ }, i = (e) => {
225
+ e.target instanceof Node || (t = !1, n());
226
+ };
227
+ return n(), U.setSuspended(!1), window.addEventListener("blur", r), window.addEventListener("focus", i), e.addEventListener("visibilitychange", n), () => {
228
+ window.removeEventListener("blur", r), window.removeEventListener("focus", i), e.removeEventListener("visibilitychange", n), U.setSuspended(!0);
229
+ };
230
+ }, [U]), x.useEffect(() => {
231
+ for (let e of _) e.shown && U.start(e.id, e.seq, e.options.timeout ?? M);
232
+ }, [_, U]);
233
+ let W = x.useCallback((e) => {
234
+ k.current += 1;
235
+ let t = k.current, n = e.toastId ?? `${O}-${t}`;
236
+ return v((r) => {
237
+ let i = r.findIndex((e) => e.id === n);
238
+ if (i === -1) return [...r, {
239
+ id: n,
240
+ options: e,
241
+ seq: t,
242
+ shown: !1
243
+ }];
244
+ let a = r.slice();
245
+ return a[i] = {
246
+ id: n,
247
+ options: e,
248
+ seq: t,
249
+ shown: r[i].shown
250
+ }, a;
251
+ }), n;
252
+ }, [O]), G = x.useCallback((e) => {
253
+ U.remove(e), v((t) => t.some((t) => t.id === e) ? t.filter((t) => t.id !== e) : t);
254
+ }, [U]), K = x.useCallback(() => {
255
+ U.clear(), v((e) => e.length === 0 ? e : []);
256
+ }, [U]), q = x.useMemo(() => ({
257
+ dispatchToast: W,
258
+ dismissToast: G,
259
+ dismissAllToasts: K
260
+ }), [
261
+ W,
262
+ G,
263
+ K
264
+ ]), J = x.useCallback((e) => {
265
+ let t = A.current, n = t ? Array.from(t.children).filter((e) => e instanceof HTMLElement && e.hasAttribute("data-wave-toast")) : [];
266
+ for (let t of [n[e], n[e - 1]]) {
267
+ let e = t?.isConnected ? s(t) : null;
268
+ if (e) return e;
269
+ }
270
+ let r = F.current;
271
+ return F.current = null, r?.isConnected ? r : null;
272
+ }, []), Y = (e) => {
273
+ let t = e.relatedTarget;
274
+ t instanceof HTMLElement && !e.currentTarget.contains(t) && (F.current = t);
275
+ }, X = (e) => {
276
+ let t = e.currentTarget, n = e.relatedTarget;
277
+ if (!(n instanceof Node && t.contains(n))) {
278
+ if (n === null) {
279
+ let n = e.target;
280
+ if (!n.isConnected) return;
281
+ let r = n.ownerDocument.activeElement;
282
+ if (r && t.contains(r)) return;
283
+ }
284
+ F.current = null;
285
+ }
286
+ }, Z = [], Q = [];
287
+ for (let e of b) {
288
+ let t = /* @__PURE__ */ S(B, { text: R(e.options) }, e.seq);
289
+ (e.options.status === "error" ? Q : Z).push(t);
290
+ }
291
+ let $ = z > 0 ? {
292
+ ...o,
293
+ "--wave-toaster-offset": `${z}px`
294
+ } : o;
295
+ return /* @__PURE__ */ C(E.Provider, {
296
+ value: q,
297
+ children: [l, /* @__PURE__ */ S(f, {
298
+ layer: "toast",
299
+ children: /* @__PURE__ */ C("div", {
300
+ ref: j,
301
+ role: "region",
302
+ "aria-label": "Notifications",
303
+ "data-wave-focus-trap-allow": "",
304
+ "data-position": t,
305
+ ...g,
306
+ style: $,
307
+ onFocus: (e) => {
308
+ p?.(e), Y(e);
309
+ },
310
+ onBlur: (e) => {
311
+ m?.(e), X(e);
312
+ },
313
+ className: e("fixed flex w-80 max-w-[calc(100vw-2rem)] flex-col gap-2", P[t], i),
314
+ children: [
315
+ /* @__PURE__ */ S("div", {
316
+ role: "status",
317
+ "aria-live": "polite",
318
+ "aria-atomic": "false",
319
+ className: "sr-only",
320
+ children: Z
321
+ }),
322
+ /* @__PURE__ */ S("div", {
323
+ "aria-live": "assertive",
324
+ "aria-atomic": "false",
325
+ className: "sr-only",
326
+ children: Q
327
+ }),
328
+ /* @__PURE__ */ S(D.Provider, {
329
+ value: !0,
330
+ children: b.map((e, t) => /* @__PURE__ */ S(V, {
331
+ entry: e,
332
+ index: t,
333
+ timers: U,
334
+ onDismiss: G,
335
+ getFocusFallback: J
336
+ }, e.id))
337
+ })
338
+ ]
339
+ })
340
+ })]
341
+ });
342
+ };
343
+ H.displayName = "Toaster";
344
+ //#endregion
345
+ export { j as Toast, H as Toaster, A as useToastController };
346
+
347
+ //# sourceMappingURL=Toast.mjs.map