@mortenbrudvik/waveui 0.10.0 → 0.12.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 (258) hide show
  1. package/README.md +454 -74
  2. package/dist/components/button/Link.cjs +1 -1
  3. package/dist/components/button/Link.cjs.map +1 -1
  4. package/dist/components/button/Link.mjs +4 -4
  5. package/dist/components/button/Toolbar.cjs +1 -1
  6. package/dist/components/button/Toolbar.cjs.map +1 -1
  7. package/dist/components/button/Toolbar.mjs +25 -30
  8. package/dist/components/button/Toolbar.mjs.map +1 -1
  9. package/dist/components/button/Toolbar.navigation.cjs +2 -0
  10. package/dist/components/button/Toolbar.navigation.cjs.map +1 -0
  11. package/dist/components/button/Toolbar.navigation.mjs +17 -0
  12. package/dist/components/button/Toolbar.navigation.mjs.map +1 -0
  13. package/dist/components/data-display/Avatar.cjs +1 -1
  14. package/dist/components/data-display/Avatar.cjs.map +1 -1
  15. package/dist/components/data-display/Avatar.context.cjs +2 -0
  16. package/dist/components/data-display/Avatar.context.cjs.map +1 -0
  17. package/dist/components/data-display/Avatar.context.mjs +9 -0
  18. package/dist/components/data-display/Avatar.context.mjs.map +1 -0
  19. package/dist/components/data-display/Avatar.mjs +66 -61
  20. package/dist/components/data-display/Avatar.mjs.map +1 -1
  21. package/dist/components/data-display/AvatarGroup.cjs +1 -1
  22. package/dist/components/data-display/AvatarGroup.cjs.map +1 -1
  23. package/dist/components/data-display/AvatarGroup.mjs +10 -10
  24. package/dist/components/data-display/InfoButton.cjs +1 -1
  25. package/dist/components/data-display/InfoButton.cjs.map +1 -1
  26. package/dist/components/data-display/InfoButton.mjs +12 -12
  27. package/dist/components/data-display/InteractionTag.cjs +2 -0
  28. package/dist/components/data-display/InteractionTag.cjs.map +1 -0
  29. package/dist/components/data-display/InteractionTag.mjs +234 -0
  30. package/dist/components/data-display/InteractionTag.mjs.map +1 -0
  31. package/dist/components/data-display/Tag.cjs +1 -1
  32. package/dist/components/data-display/Tag.cjs.map +1 -1
  33. package/dist/components/data-display/Tag.mjs +222 -90
  34. package/dist/components/data-display/Tag.mjs.map +1 -1
  35. package/dist/components/data-display/TagGroup.cjs +2 -0
  36. package/dist/components/data-display/TagGroup.cjs.map +1 -0
  37. package/dist/components/data-display/TagGroup.context.cjs +2 -0
  38. package/dist/components/data-display/TagGroup.context.cjs.map +1 -0
  39. package/dist/components/data-display/TagGroup.context.mjs +113 -0
  40. package/dist/components/data-display/TagGroup.context.mjs.map +1 -0
  41. package/dist/components/data-display/TagGroup.mjs +149 -0
  42. package/dist/components/data-display/TagGroup.mjs.map +1 -0
  43. package/dist/components/data-display/tagStyles.cjs +2 -0
  44. package/dist/components/data-display/tagStyles.cjs.map +1 -0
  45. package/dist/components/data-display/tagStyles.mjs +108 -0
  46. package/dist/components/data-display/tagStyles.mjs.map +1 -0
  47. package/dist/components/feedback/Toaster.cjs +1 -1
  48. package/dist/components/feedback/Toaster.cjs.map +1 -1
  49. package/dist/components/feedback/Toaster.mjs +287 -255
  50. package/dist/components/feedback/Toaster.mjs.map +1 -1
  51. package/dist/components/input/Combobox.cjs +1 -1
  52. package/dist/components/input/Combobox.cjs.map +1 -1
  53. package/dist/components/input/Combobox.expand.cjs +1 -1
  54. package/dist/components/input/Combobox.expand.cjs.map +1 -1
  55. package/dist/components/input/Combobox.expand.mjs +7 -7
  56. package/dist/components/input/Combobox.expand.mjs.map +1 -1
  57. package/dist/components/input/Combobox.mjs +176 -175
  58. package/dist/components/input/Combobox.mjs.map +1 -1
  59. package/dist/components/input/DatePicker.cjs +1 -1
  60. package/dist/components/input/DatePicker.cjs.map +1 -1
  61. package/dist/components/input/DatePicker.mjs +188 -187
  62. package/dist/components/input/DatePicker.mjs.map +1 -1
  63. package/dist/components/input/Dropdown.cjs +1 -1
  64. package/dist/components/input/Dropdown.cjs.map +1 -1
  65. package/dist/components/input/Dropdown.mjs +41 -40
  66. package/dist/components/input/Dropdown.mjs.map +1 -1
  67. package/dist/components/input/Option.cjs +1 -1
  68. package/dist/components/input/Option.cjs.map +1 -1
  69. package/dist/components/input/Option.mjs +101 -94
  70. package/dist/components/input/Option.mjs.map +1 -1
  71. package/dist/components/input/SwatchPicker.cjs.map +1 -1
  72. package/dist/components/input/SwatchPicker.context.cjs.map +1 -1
  73. package/dist/components/input/SwatchPicker.context.mjs.map +1 -1
  74. package/dist/components/input/SwatchPicker.mjs.map +1 -1
  75. package/dist/components/input/TagPicker.cjs +1 -1
  76. package/dist/components/input/TagPicker.cjs.map +1 -1
  77. package/dist/components/input/TagPicker.context.cjs +2 -0
  78. package/dist/components/input/TagPicker.context.cjs.map +1 -0
  79. package/dist/components/input/TagPicker.context.mjs +20 -0
  80. package/dist/components/input/TagPicker.context.mjs.map +1 -0
  81. package/dist/components/input/TagPicker.create.cjs +2 -0
  82. package/dist/components/input/TagPicker.create.cjs.map +1 -0
  83. package/dist/components/input/TagPicker.create.mjs +24 -0
  84. package/dist/components/input/TagPicker.create.mjs.map +1 -0
  85. package/dist/components/input/TagPicker.mjs +13 -279
  86. package/dist/components/input/TagPicker.mjs.map +1 -1
  87. package/dist/components/input/TagPicker.option.cjs +2 -0
  88. package/dist/components/input/TagPicker.option.cjs.map +1 -0
  89. package/dist/components/input/TagPicker.option.mjs +45 -0
  90. package/dist/components/input/TagPicker.option.mjs.map +1 -0
  91. package/dist/components/input/TagPicker.overflow.cjs +2 -0
  92. package/dist/components/input/TagPicker.overflow.cjs.map +1 -0
  93. package/dist/components/input/TagPicker.overflow.mjs +153 -0
  94. package/dist/components/input/TagPicker.overflow.mjs.map +1 -0
  95. package/dist/components/input/TagPicker.parts.cjs +2 -0
  96. package/dist/components/input/TagPicker.parts.cjs.map +1 -0
  97. package/dist/components/input/TagPicker.parts.mjs +425 -0
  98. package/dist/components/input/TagPicker.parts.mjs.map +1 -0
  99. package/dist/components/input/TagPicker.root.cjs +2 -0
  100. package/dist/components/input/TagPicker.root.cjs.map +1 -0
  101. package/dist/components/input/TagPicker.root.mjs +417 -0
  102. package/dist/components/input/TagPicker.root.mjs.map +1 -0
  103. package/dist/components/input/TimePicker.cjs +1 -1
  104. package/dist/components/input/TimePicker.cjs.map +1 -1
  105. package/dist/components/input/TimePicker.mjs +156 -154
  106. package/dist/components/input/TimePicker.mjs.map +1 -1
  107. package/dist/components/layout/Accordion.cjs.map +1 -1
  108. package/dist/components/layout/Accordion.mjs.map +1 -1
  109. package/dist/components/navigation/Hamburger.cjs +2 -0
  110. package/dist/components/navigation/Hamburger.cjs.map +1 -0
  111. package/dist/components/navigation/Hamburger.mjs +54 -0
  112. package/dist/components/navigation/Hamburger.mjs.map +1 -0
  113. package/dist/components/navigation/Menu.popover.cjs +1 -1
  114. package/dist/components/navigation/Menu.popover.cjs.map +1 -1
  115. package/dist/components/navigation/Menu.popover.mjs +137 -127
  116. package/dist/components/navigation/Menu.popover.mjs.map +1 -1
  117. package/dist/components/navigation/Menu.root.cjs +1 -1
  118. package/dist/components/navigation/Menu.root.cjs.map +1 -1
  119. package/dist/components/navigation/Menu.root.mjs +4 -4
  120. package/dist/components/navigation/Nav.cjs +1 -1
  121. package/dist/components/navigation/Nav.cjs.map +1 -1
  122. package/dist/components/navigation/Nav.context.cjs +2 -0
  123. package/dist/components/navigation/Nav.context.cjs.map +1 -0
  124. package/dist/components/navigation/Nav.context.mjs +137 -0
  125. package/dist/components/navigation/Nav.context.mjs.map +1 -0
  126. package/dist/components/navigation/Nav.mjs +151 -258
  127. package/dist/components/navigation/Nav.mjs.map +1 -1
  128. package/dist/components/navigation/Nav.parts.cjs +2 -0
  129. package/dist/components/navigation/Nav.parts.cjs.map +1 -0
  130. package/dist/components/navigation/Nav.parts.mjs +77 -0
  131. package/dist/components/navigation/Nav.parts.mjs.map +1 -0
  132. package/dist/components/navigation/Nav.root.cjs +2 -0
  133. package/dist/components/navigation/Nav.root.cjs.map +1 -0
  134. package/dist/components/navigation/Nav.root.mjs +78 -0
  135. package/dist/components/navigation/Nav.root.mjs.map +1 -0
  136. package/dist/components/navigation/NavDrawer.cjs +2 -0
  137. package/dist/components/navigation/NavDrawer.cjs.map +1 -0
  138. package/dist/components/navigation/NavDrawer.context.cjs +2 -0
  139. package/dist/components/navigation/NavDrawer.context.cjs.map +1 -0
  140. package/dist/components/navigation/NavDrawer.context.mjs +11 -0
  141. package/dist/components/navigation/NavDrawer.context.mjs.map +1 -0
  142. package/dist/components/navigation/NavDrawer.mjs +179 -0
  143. package/dist/components/navigation/NavDrawer.mjs.map +1 -0
  144. package/dist/components/overlays/Dialog.cjs +1 -1
  145. package/dist/components/overlays/Dialog.cjs.map +1 -1
  146. package/dist/components/overlays/Dialog.mjs +188 -123
  147. package/dist/components/overlays/Dialog.mjs.map +1 -1
  148. package/dist/components/overlays/Dialog.shared.cjs +1 -1
  149. package/dist/components/overlays/Dialog.shared.cjs.map +1 -1
  150. package/dist/components/overlays/Dialog.shared.mjs +157 -81
  151. package/dist/components/overlays/Dialog.shared.mjs.map +1 -1
  152. package/dist/components/overlays/Dialog.slots.cjs +2 -0
  153. package/dist/components/overlays/Dialog.slots.cjs.map +1 -0
  154. package/dist/components/overlays/Dialog.slots.mjs +129 -0
  155. package/dist/components/overlays/Dialog.slots.mjs.map +1 -0
  156. package/dist/components/overlays/Drawer.cjs +1 -1
  157. package/dist/components/overlays/Drawer.cjs.map +1 -1
  158. package/dist/components/overlays/Drawer.context.cjs +2 -0
  159. package/dist/components/overlays/Drawer.context.cjs.map +1 -0
  160. package/dist/components/overlays/Drawer.context.mjs +29 -0
  161. package/dist/components/overlays/Drawer.context.mjs.map +1 -0
  162. package/dist/components/overlays/Drawer.mjs +12 -187
  163. package/dist/components/overlays/Drawer.mjs.map +1 -1
  164. package/dist/components/overlays/Drawer.panel.cjs +2 -0
  165. package/dist/components/overlays/Drawer.panel.cjs.map +1 -0
  166. package/dist/components/overlays/Drawer.panel.mjs +159 -0
  167. package/dist/components/overlays/Drawer.panel.mjs.map +1 -0
  168. package/dist/components/overlays/Drawer.parts.cjs +2 -0
  169. package/dist/components/overlays/Drawer.parts.cjs.map +1 -0
  170. package/dist/components/overlays/Drawer.parts.mjs +152 -0
  171. package/dist/components/overlays/Drawer.parts.mjs.map +1 -0
  172. package/dist/components/overlays/Drawer.root.cjs +2 -0
  173. package/dist/components/overlays/Drawer.root.cjs.map +1 -0
  174. package/dist/components/overlays/Drawer.root.mjs +207 -0
  175. package/dist/components/overlays/Drawer.root.mjs.map +1 -0
  176. package/dist/components/overlays/Drawer.scroll.cjs +2 -0
  177. package/dist/components/overlays/Drawer.scroll.cjs.map +1 -0
  178. package/dist/components/overlays/Drawer.scroll.mjs +42 -0
  179. package/dist/components/overlays/Drawer.scroll.mjs.map +1 -0
  180. package/dist/components/overlays/Popover.cjs +1 -1
  181. package/dist/components/overlays/Popover.cjs.map +1 -1
  182. package/dist/components/overlays/Popover.mjs +173 -162
  183. package/dist/components/overlays/Popover.mjs.map +1 -1
  184. package/dist/components/overlays/TeachingPopover.cjs +1 -1
  185. package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
  186. package/dist/components/overlays/TeachingPopover.mjs +96 -91
  187. package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
  188. package/dist/components/overlays/Tooltip.cjs +1 -1
  189. package/dist/components/overlays/Tooltip.cjs.map +1 -1
  190. package/dist/components/overlays/Tooltip.mjs +47 -47
  191. package/dist/components/overlays/Tooltip.mjs.map +1 -1
  192. package/dist/components/portal/Portal.cjs +1 -1
  193. package/dist/components/portal/Portal.cjs.map +1 -1
  194. package/dist/components/portal/Portal.mjs +5 -5
  195. package/dist/components/table/DataGrid.cjs +1 -1
  196. package/dist/components/table/DataGrid.cjs.map +1 -1
  197. package/dist/components/table/DataGrid.mjs +1 -1
  198. package/dist/hooks/useDismiss.cjs.map +1 -1
  199. package/dist/hooks/useDismiss.mjs.map +1 -1
  200. package/dist/hooks/useFocusTrap.cjs +1 -1
  201. package/dist/hooks/useFocusTrap.cjs.map +1 -1
  202. package/dist/hooks/useFocusTrap.mjs +115 -98
  203. package/dist/hooks/useFocusTrap.mjs.map +1 -1
  204. package/dist/hooks/useFocusVisible.cjs +2 -0
  205. package/dist/hooks/useFocusVisible.cjs.map +1 -0
  206. package/dist/hooks/useFocusVisible.mjs +49 -0
  207. package/dist/hooks/useFocusVisible.mjs.map +1 -0
  208. package/dist/hooks/useFocusableGroup.cjs +2 -0
  209. package/dist/hooks/useFocusableGroup.cjs.map +1 -0
  210. package/dist/hooks/useFocusableGroup.mjs +70 -0
  211. package/dist/hooks/useFocusableGroup.mjs.map +1 -0
  212. package/dist/hooks/useModalLayer.cjs +1 -1
  213. package/dist/hooks/useModalLayer.cjs.map +1 -1
  214. package/dist/hooks/useModalLayer.mjs +34 -21
  215. package/dist/hooks/useModalLayer.mjs.map +1 -1
  216. package/dist/hooks/useModalOpen.cjs +2 -0
  217. package/dist/hooks/useModalOpen.cjs.map +1 -0
  218. package/dist/hooks/useModalOpen.mjs +14 -0
  219. package/dist/hooks/useModalOpen.mjs.map +1 -0
  220. package/dist/hooks/usePopupPosition.cjs +1 -1
  221. package/dist/hooks/usePopupPosition.cjs.map +1 -1
  222. package/dist/hooks/usePopupPosition.mjs +82 -53
  223. package/dist/hooks/usePopupPosition.mjs.map +1 -1
  224. package/dist/hooks/useResolvedTarget.cjs +2 -0
  225. package/dist/hooks/useResolvedTarget.cjs.map +1 -0
  226. package/dist/hooks/useResolvedTarget.mjs +37 -0
  227. package/dist/hooks/useResolvedTarget.mjs.map +1 -0
  228. package/dist/hooks/useRestoreFocus.cjs +1 -1
  229. package/dist/hooks/useRestoreFocus.cjs.map +1 -1
  230. package/dist/hooks/useRestoreFocus.mjs +91 -78
  231. package/dist/hooks/useRestoreFocus.mjs.map +1 -1
  232. package/dist/hooks/useRovingGrid.cjs +1 -1
  233. package/dist/hooks/useRovingGrid.cjs.map +1 -1
  234. package/dist/hooks/useRovingGrid.mjs +8 -57
  235. package/dist/hooks/useRovingGrid.mjs.map +1 -1
  236. package/dist/hooks/useRovingTabIndex.cjs +1 -1
  237. package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
  238. package/dist/hooks/useRovingTabIndex.mjs +180 -121
  239. package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
  240. package/dist/index.cjs +1 -1
  241. package/dist/index.d.cts +3070 -269
  242. package/dist/index.d.ts +3070 -269
  243. package/dist/index.mjs +127 -107
  244. package/dist/lib/classNames.cjs +1 -1
  245. package/dist/lib/classNames.cjs.map +1 -1
  246. package/dist/lib/classNames.mjs +137 -77
  247. package/dist/lib/classNames.mjs.map +1 -1
  248. package/dist/lib/icons.cjs +1 -1
  249. package/dist/lib/icons.cjs.map +1 -1
  250. package/dist/lib/icons.mjs +13 -6
  251. package/dist/lib/icons.mjs.map +1 -1
  252. package/dist/lib/layers.cjs +1 -1
  253. package/dist/lib/layers.cjs.map +1 -1
  254. package/dist/lib/layers.mjs +120 -111
  255. package/dist/lib/layers.mjs.map +1 -1
  256. package/dist/styles.css +1 -1
  257. package/package.json +1 -1
  258. package/src/styles/tokens.css +25 -0
@@ -8,22 +8,22 @@ import { useEventCallback as s } from "../../hooks/useEventCallback.mjs";
8
8
  import { useId as c } from "../../hooks/useId.mjs";
9
9
  import { getDirection as l } from "../../lib/direction.mjs";
10
10
  import { getFirstTabbable as u, getTabbableElements as d, isConnectedAndFocusable as f } from "../../lib/focus.mjs";
11
- import { useMergedRefs as ee } from "../../hooks/useMergedRefs.mjs";
12
- import { joinIds as p } from "../../lib/aria.mjs";
13
- import { usePresence as m } from "../../hooks/usePresence.mjs";
14
- import { getOpenLayers as h, isInsideLayerTree as g, subscribeLayers as _ } from "../../lib/layers.mjs";
15
- import { useDirection as te } from "../../hooks/useDirection.mjs";
16
- import { Portal as v } from "../portal/Portal.mjs";
17
- import { focusRing as ne } from "../../lib/styles.mjs";
18
- import { isEditableTarget as re, isOwnEvent as ie } from "../../lib/events.mjs";
19
- import { usePreserveFocus as ae } from "../../hooks/usePreserveFocus.mjs";
20
- import { StatusText as oe, getStatusLabel as y } from "./MessageBar.status.mjs";
21
- import { ToastContext as se, ToasterContext as b } from "./Toast.context.mjs";
22
- import { ToastRoot as ce } from "./Toast.root.mjs";
23
- import * as x from "react";
24
- import { jsx as S, jsxs as C } from "react/jsx-runtime";
11
+ import { useMergedRefs as p } from "../../hooks/useMergedRefs.mjs";
12
+ import { joinIds as m } from "../../lib/aria.mjs";
13
+ import { usePresence as ee } from "../../hooks/usePresence.mjs";
14
+ import { useDirection as h } from "../../hooks/useDirection.mjs";
15
+ import { getOpenLayers as g, isInsideLayerTree as _, subscribeLayers as v } from "../../lib/layers.mjs";
16
+ import { focusRing as te } from "../../lib/styles.mjs";
17
+ import { Portal as y } from "../portal/Portal.mjs";
18
+ import { isEditableTarget as ne, isOwnEvent as re } from "../../lib/events.mjs";
19
+ import { usePreserveFocus as ie } from "../../hooks/usePreserveFocus.mjs";
20
+ import { StatusText as ae, getStatusLabel as b } from "./MessageBar.status.mjs";
21
+ import { ToastContext as oe, ToasterContext as x } from "./Toast.context.mjs";
22
+ import { ToastRoot as se } from "./Toast.root.mjs";
23
+ import * as S from "react";
24
+ import { jsx as C, jsxs as w } from "react/jsx-runtime";
25
25
  //#region src/components/feedback/Toaster.tsx
26
- function le(e, t) {
26
+ function ce(e, t) {
27
27
  let n = 0, r = !1;
28
28
  for (let t of e) t.shown ? t.dismissed || (n += 1) : r = !0;
29
29
  return !r || n >= t ? e : e.map((e) => e.shown || n >= t ? e : (n += 1, {
@@ -31,7 +31,7 @@ function le(e, t) {
31
31
  shown: !0
32
32
  }));
33
33
  }
34
- function w(e, t) {
34
+ function T(e, t) {
35
35
  let n = e.findIndex((e) => e.id === t);
36
36
  if (n === -1) return e;
37
37
  let r = e[n];
@@ -43,40 +43,40 @@ function w(e, t) {
43
43
  dismissed: !0
44
44
  }, i;
45
45
  }
46
- function T(e) {
46
+ function E(e) {
47
47
  return e.every((e) => e.shown && e.dismissed) ? e : e.filter((e) => e.shown).map((e) => e.dismissed ? e : {
48
48
  ...e,
49
49
  dismissed: !0
50
50
  });
51
51
  }
52
- function E(e) {
52
+ function D(e) {
53
53
  let t;
54
54
  for (let n of e) n.shown && !n.dismissed && (!t || n.seq > t.seq) && (t = n);
55
55
  return t;
56
56
  }
57
- function D(e, t) {
58
- return e.contains(t) ? !0 : h().some((n) => {
57
+ function O(e, t) {
58
+ return e.contains(t) ? !0 : g().some((n) => {
59
59
  let r = n.getAnchor();
60
- return r !== null && e.contains(r) && g(n.id, t);
60
+ return r !== null && e.contains(r) && _(n.id, t);
61
61
  });
62
62
  }
63
- function ue(e, t) {
63
+ function le(e, t) {
64
64
  let n = t?.getDismissButton() ?? null;
65
65
  return d(e).some((e) => e !== n);
66
66
  }
67
- function O(e) {
67
+ function k(e) {
68
68
  return e === void 0 ? Infinity : e >= 1 ? Math.floor(e) : 1;
69
69
  }
70
- var k = {
70
+ var A = {
71
71
  dispatchToast: (e, t) => (o(e) ? e.toastId : t?.toastId) ?? "",
72
72
  dismissToast: () => {},
73
73
  dismissAllToasts: () => {}
74
- }, A = "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.";
75
- function j() {
76
- return x.useContext(b) || (t("useToastController", "<Toaster>", A), k);
74
+ }, j = "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.";
75
+ function M() {
76
+ return S.useContext(x) || (t("useToastController", "<Toaster>", j), A);
77
77
  }
78
- var de = 5e3;
79
- function M(e) {
78
+ var ue = 5e3;
79
+ function N(e) {
80
80
  let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map(), i = !1, a = !1, o = (o) => {
81
81
  let s = t.get(o);
82
82
  if (!s) return;
@@ -119,67 +119,84 @@ function M(e) {
119
119
  }
120
120
  };
121
121
  }
122
- var N = {
123
- "top-start": "top-4 start-4 ms-(--wave-toaster-offset)",
124
- "top-end": "top-4 end-4 me-(--wave-toaster-offset)",
125
- "bottom-start": "bottom-4 start-4 ms-(--wave-toaster-offset)",
126
- "bottom-end": "bottom-4 end-4 me-(--wave-toaster-offset)",
127
- "top-right": "top-4 right-4 mr-(--wave-toaster-offset)",
128
- "top-left": "top-4 left-4 ml-(--wave-toaster-offset)",
129
- "bottom-right": "bottom-4 right-4 mr-(--wave-toaster-offset)",
130
- "bottom-left": "bottom-4 left-4 ml-(--wave-toaster-offset)"
131
- }, P = 16;
132
- function F(e, t) {
122
+ var P = {
123
+ "top-start": "top-4 start-4 ms-(--wave-toaster-offset) mt-(--wave-toaster-offset-block)",
124
+ "top-end": "top-4 end-4 me-(--wave-toaster-offset) mt-(--wave-toaster-offset-block)",
125
+ "bottom-start": "bottom-4 start-4 ms-(--wave-toaster-offset) mb-(--wave-toaster-offset-block)",
126
+ "bottom-end": "bottom-4 end-4 me-(--wave-toaster-offset) mb-(--wave-toaster-offset-block)",
127
+ "top-right": "top-4 right-4 mr-(--wave-toaster-offset) mt-(--wave-toaster-offset-block)",
128
+ "top-left": "top-4 left-4 ml-(--wave-toaster-offset) mt-(--wave-toaster-offset-block)",
129
+ "bottom-right": "bottom-4 right-4 mr-(--wave-toaster-offset) mb-(--wave-toaster-offset-block)",
130
+ "bottom-left": "bottom-4 left-4 ml-(--wave-toaster-offset) mb-(--wave-toaster-offset-block)"
131
+ }, F = 16;
132
+ function I(e, t) {
133
133
  let n = e.slice(e.indexOf("-") + 1);
134
134
  if (n === "right" || n === "left") return n === "right";
135
135
  let r = l(t) === "rtl";
136
136
  return n === "end" ? !r : r;
137
137
  }
138
- function fe(e, t) {
139
- let n = h().filter((e) => e.kind === "modal");
140
- if (n.length === 0) return 0;
138
+ var L = {
139
+ inline: 0,
140
+ block: 0
141
+ };
142
+ function R() {
143
+ return g().filter((e) => e.kind === "modal" || e.kind === "dialog");
144
+ }
145
+ function de() {
146
+ let e = /* @__PURE__ */ new Set();
147
+ for (let t of R()) for (let n of t.getElements()) n?.isConnected && e.add(n);
148
+ return e;
149
+ }
150
+ function z(e, t) {
151
+ let n = R();
152
+ if (n.length === 0) return L;
141
153
  let r = e.ownerDocument, i = r.defaultView;
142
- if (!i) return 0;
143
- let a = r.documentElement.clientWidth || i.innerWidth, o = r.documentElement.clientHeight || i.innerHeight, s = F(t, e), c = t.startsWith("top"), l = 0;
154
+ if (!i) return L;
155
+ let a = r.documentElement.clientWidth || i.innerWidth, o = r.documentElement.clientHeight || i.innerHeight, s = I(t, e), c = t.startsWith("top"), l = (t) => a - t >= e.offsetWidth + 32, u = (t) => o - t >= e.offsetHeight + 32, d = 0, f = 0;
144
156
  for (let e of n) for (let t of e.getElements()) {
145
157
  if (!t?.isConnected) continue;
146
158
  let e = t.getBoundingClientRect();
147
159
  if (e.width <= 0 || e.height <= 0) continue;
148
- let n = s ? e.right >= a - P : e.left <= P, r = c ? e.top <= P : e.bottom >= o - P;
149
- n && r && (l = Math.max(l, s ? a - e.left : e.right));
160
+ let n = s ? e.right >= a - F : e.left <= F, r = c ? e.top <= F : e.bottom >= o - F;
161
+ if (!n || !r) continue;
162
+ let i = s ? a - e.left : e.right, p = c ? e.bottom : o - e.top;
163
+ l(i) ? d = Math.max(d, i) : u(p) && (f = Math.max(f, p));
150
164
  }
151
- return l <= 0 || a - l < e.offsetWidth + 32 ? 0 : Math.ceil(l);
165
+ return {
166
+ inline: d > 0 && l(d) ? Math.ceil(d) : 0,
167
+ block: f > 0 && u(f) ? Math.ceil(f) : 0
168
+ };
152
169
  }
153
- var I = 2e3;
154
- function L({ text: e }) {
155
- let [t, n] = x.useState(!0);
156
- return x.useEffect(() => {
157
- let e = setTimeout(() => n(!1), I);
170
+ var B = 2e3;
171
+ function V({ text: e }) {
172
+ let [t, n] = S.useState(!0);
173
+ return S.useEffect(() => {
174
+ let e = setTimeout(() => n(!1), B);
158
175
  return () => clearTimeout(e);
159
- }, []), t ? /* @__PURE__ */ S("div", { children: e }) : null;
176
+ }, []), t ? /* @__PURE__ */ C("div", { children: e }) : null;
160
177
  }
161
- L.displayName = "LiveMessage";
162
- function R(e) {
178
+ V.displayName = "LiveMessage";
179
+ function H(e) {
163
180
  return e.kind === "title";
164
181
  }
165
- function z(e) {
182
+ function U(e) {
166
183
  return e.kind === "body";
167
184
  }
168
- function B(e) {
185
+ function W(e) {
169
186
  return e.kind === "footer";
170
187
  }
171
- var V = /* @__PURE__ */ new Set(/* @__PURE__ */ "a.abbr.b.bdi.bdo.cite.code.data.dfn.em.i.kbd.label.mark.q.s.samp.small.span.strong.sub.sup.time.u.var.wbr".split(".")), H = /* @__PURE__ */ new Set([
188
+ var fe = /* @__PURE__ */ new Set(/* @__PURE__ */ "a.abbr.b.bdi.bdo.cite.code.data.dfn.em.i.kbd.label.mark.q.s.samp.small.span.strong.sub.sup.time.u.var.wbr".split(".")), G = /* @__PURE__ */ new Set([
172
189
  "noscript",
173
190
  "script",
174
191
  "style",
175
192
  "template"
176
- ]), U = /* @__PURE__ */ new Set([
193
+ ]), pe = /* @__PURE__ */ new Set([
177
194
  "button",
178
195
  "img",
179
196
  "input",
180
197
  "select",
181
198
  "textarea"
182
- ]), pe = /* @__PURE__ */ new Set([
199
+ ]), K = /* @__PURE__ */ new Set([
183
200
  "button",
184
201
  "checkbox",
185
202
  "combobox",
@@ -193,14 +210,14 @@ var V = /* @__PURE__ */ new Set(/* @__PURE__ */ "a.abbr.b.bdi.bdo.cite.code.data
193
210
  "tab",
194
211
  "textbox"
195
212
  ]);
196
- function W(e) {
213
+ function me(e) {
197
214
  let t = e.getAttribute("role")?.trim().split(/\s+/)[0];
198
- return t ? pe.has(t) || t.startsWith("menuitem") : e.localName === "a" ? e.hasAttribute("href") : U.has(e.localName);
215
+ return t ? K.has(t) || t.startsWith("menuitem") : e.localName === "a" ? e.hasAttribute("href") : pe.has(e.localName);
199
216
  }
200
- function G(e) {
201
- return e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden") || H.has(e.localName);
217
+ function q(e) {
218
+ return e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden") || G.has(e.localName);
202
219
  }
203
- function K(e, t) {
220
+ function J(e, t) {
204
221
  if (!e) return "";
205
222
  let n = [], r = (e, i) => {
206
223
  if (e.nodeType === Node.TEXT_NODE) {
@@ -209,9 +226,9 @@ function K(e, t) {
209
226
  }
210
227
  if (e.nodeType !== Node.ELEMENT_NODE) return;
211
228
  let a = e;
212
- if (!i && t?.(a) || G(a)) return;
229
+ if (!i && t?.(a) || q(a)) return;
213
230
  let o = a.getAttribute("aria-label");
214
- if (o && W(a)) {
231
+ if (o && me(a)) {
215
232
  n.push(` ${o} `);
216
233
  return;
217
234
  }
@@ -219,64 +236,64 @@ function K(e, t) {
219
236
  n.push(` ${a.getAttribute("alt") ?? ""} `);
220
237
  return;
221
238
  }
222
- let s = !V.has(a.localName);
239
+ let s = !fe.has(a.localName);
223
240
  s && n.push(" ");
224
241
  for (let e of Array.from(a.childNodes)) r(e, !1);
225
242
  s && n.push(" ");
226
243
  };
227
244
  return r(e, !0), n.join("").replace(/\s+/g, " ").trim();
228
245
  }
229
- function q(e) {
230
- return !e || G(e) ? [] : Array.from(e.childNodes, (e) => e.nodeType === Node.TEXT_NODE ? (e.textContent ?? "").replace(/\s+/g, " ").trim() : e.nodeType === Node.ELEMENT_NODE ? K(e) : "").filter(Boolean);
246
+ function Y(e) {
247
+ return !e || q(e) ? [] : Array.from(e.childNodes, (e) => e.nodeType === Node.TEXT_NODE ? (e.textContent ?? "").replace(/\s+/g, " ").trim() : e.nodeType === Node.ELEMENT_NODE ? J(e) : "").filter(Boolean);
231
248
  }
232
- function J(e, t, n, r) {
233
- let i = t.find(R), a = t.find(z);
249
+ function X(e, t, n, r) {
250
+ let i = t.find(H), a = t.find(U);
234
251
  if (!i && !a) {
235
252
  let t = n?.getDismissButton() ?? null;
236
- return K(e, (e) => e === t || e.id !== "" && (e.id === r || e.id === n?.statusTextId));
253
+ return J(e, (e) => e === t || e.id !== "" && (e.id === r || e.id === n?.statusTextId));
237
254
  }
238
- let o = i?.getLabel() ?? null, s = i?.getRow() ?? null, c = s ? Array.from(s.children).filter((e) => e !== o).flatMap((e) => q(e)) : [];
255
+ let o = i?.getLabel() ?? null, s = i?.getRow() ?? null, c = s ? Array.from(s.children).filter((e) => e !== o).flatMap((e) => Y(e)) : [];
239
256
  return [
240
- K(o),
241
- K(a?.getElement() ?? null),
257
+ J(o),
258
+ J(a?.getElement() ?? null),
242
259
  ...c,
243
- ...t.filter(B).flatMap((e) => q(e.getElement()))
260
+ ...t.filter(W).flatMap((e) => Y(e.getElement()))
244
261
  ].filter(Boolean).join(" ");
245
262
  }
246
- function me({ entry: t, timers: r, onDismiss: a, onExited: o, getFocusFallback: l, announce: u, registerContainer: d }) {
247
- let { id: f, dismissed: h } = t, { isMounted: g, ref: _, presenceProps: te } = m(!h, {
263
+ function he({ entry: t, timers: r, onDismiss: a, onExited: o, getFocusFallback: l, announce: u, registerContainer: d }) {
264
+ let { id: f, dismissed: h } = t, { isMounted: g, ref: _, presenceProps: v } = ee(!h, {
248
265
  appear: !0,
249
266
  onExited: () => o(f)
250
- }), v = x.useRef(null), b = x.useRef(null), le = x.useCallback((e) => {
251
- v.current = e, e && (b.current = e), d(f, e);
252
- }, [f, d]), w = ee(le, _);
253
- ae(v, () => l(b.current), { enabled: !h });
254
- let T = c("wave-toast-title"), E = c("wave-toast-status"), [D, O] = x.useState([]), k = x.useRef([]), A = x.useCallback((e) => (k.current = [...k.current, e], O(k.current), () => {
255
- k.current = k.current.filter((t) => t !== e), O(k.current);
256
- }), []), [j, M] = x.useState(null), N = x.useRef(null), P = x.useCallback((e) => (N.current = e, M(e), () => {
257
- N.current === e && (N.current = null, M(null));
258
- }), []), F = s(() => {
259
- N.current?.onDismiss?.(), a(f);
260
- }), fe = x.useMemo(() => ({
261
- titleId: T,
262
- dismiss: F,
263
- registerPart: A,
264
- registerToast: P
267
+ }), y = S.useRef(null), x = S.useRef(null), ce = S.useCallback((e) => {
268
+ y.current = e, e && (x.current = e), d(f, e);
269
+ }, [f, d]), T = p(ce, _);
270
+ ie(y, () => l(x.current), { enabled: !h });
271
+ let E = c("wave-toast-title"), D = c("wave-toast-status"), [O, k] = S.useState([]), A = S.useRef([]), j = S.useCallback((e) => (A.current = [...A.current, e], k(A.current), () => {
272
+ A.current = A.current.filter((t) => t !== e), k(A.current);
273
+ }), []), [M, N] = S.useState(null), P = S.useRef(null), F = S.useCallback((e) => (P.current = e, N(e), () => {
274
+ P.current === e && (P.current = null, N(null));
275
+ }), []), I = s(() => {
276
+ P.current?.onDismiss?.(), a(f);
277
+ }), L = S.useMemo(() => ({
278
+ titleId: E,
279
+ dismiss: I,
280
+ registerPart: j,
281
+ registerToast: F
265
282
  }), [
266
- T,
267
- F,
268
- A,
269
- P
270
- ]), I = D.find(R), L = D.find(z), B = t.form === "content" && j === null ? y(t.options.status ?? "info", t.options.statusLabel) : "", V = j ? j.statusTextId : B ? E : void 0;
271
- x.useLayoutEffect(() => {
272
- let e = v.current;
283
+ E,
284
+ I,
285
+ j,
286
+ F
287
+ ]), R = O.find(H), de = O.find(U), z = t.form === "content" && M === null ? b(t.options.status ?? "info", t.options.statusLabel) : "", B = M ? M.statusTextId : z ? D : void 0;
288
+ S.useLayoutEffect(() => {
289
+ let e = y.current;
273
290
  if (t.dismissed || !e) return;
274
- let n = t.options.timeout ?? (ue(e, N.current) ? 0 : de);
291
+ let n = t.options.timeout ?? (le(e, P.current) ? 0 : ue);
275
292
  r.start(t.id, t.seq, n);
276
- }, [t, r]), x.useLayoutEffect(() => {
277
- let e = v.current;
293
+ }, [t, r]), S.useLayoutEffect(() => {
294
+ let e = y.current;
278
295
  if (t.dismissed || !e) return;
279
- let n = N.current, r = n?.status ?? t.options.status ?? "info", i = n ? n.statusLabel : y(r, t.options.statusLabel), a = t.form === "content" && t.options.announcement !== void 0 ? t.options.announcement : J(e, k.current, n, E);
296
+ let n = P.current, r = n?.status ?? t.options.status ?? "info", i = n ? n.statusLabel : b(r, t.options.statusLabel), a = t.form === "content" && t.options.announcement !== void 0 ? t.options.announcement : X(e, A.current, n, D);
280
297
  u(t.id, {
281
298
  seq: t.seq,
282
299
  text: [i, a].filter(Boolean).join(" "),
@@ -285,37 +302,37 @@ function me({ entry: t, timers: r, onDismiss: a, onExited: o, getFocusFallback:
285
302
  }, [
286
303
  t,
287
304
  u,
288
- E,
289
- j
305
+ D,
306
+ M
290
307
  ]);
291
- let H = t.form === "content" ? t.options.status : void 0;
292
- x.useEffect(() => {
293
- let e = N.current?.status;
294
- H !== void 0 && e !== void 0 && H !== e && n("Toaster:status-conflict", `Toaster: the dispatched Toast has status "${e}" but the dispatch options pass "${H}"; the Toast's status is used. Remove \`status\` from the options.`);
308
+ let V = t.form === "content" ? t.options.status : void 0;
309
+ S.useEffect(() => {
310
+ let e = P.current?.status;
311
+ V !== void 0 && e !== void 0 && V !== e && n("Toaster:status-conflict", `Toaster: the dispatched Toast has status "${e}" but the dispatch options pass "${V}"; the Toast's status is used. Remove \`status\` from the options.`);
295
312
  }, [
296
313
  t,
297
- H,
298
- j
314
+ V,
315
+ M
299
316
  ]);
300
- let U = (e) => {
301
- (e.key === "Delete" || e.key === "Backspace") && (e.defaultPrevented || !ie(e) || re(e.target) || (e.preventDefault(), a(f)));
317
+ let W = (e) => {
318
+ (e.key === "Delete" || e.key === "Backspace") && (e.defaultPrevented || !re(e) || ne(e.target) || (e.preventDefault(), a(f)));
302
319
  };
303
- return g ? /* @__PURE__ */ C("div", {
304
- ref: w,
320
+ return g ? /* @__PURE__ */ w("div", {
321
+ ref: T,
305
322
  role: "group",
306
323
  tabIndex: -1,
307
324
  "data-wave-toast": "",
308
- "aria-labelledby": p(V, I?.id),
309
- "aria-describedby": L?.id,
310
- className: e(i.toast, "rounded", ne),
311
- ...te,
312
- onKeyDown: U,
313
- children: [B ? /* @__PURE__ */ S(oe, {
314
- label: B,
315
- id: E
316
- }) : null, /* @__PURE__ */ S(se.Provider, {
317
- value: fe,
318
- children: t.form === "options" ? /* @__PURE__ */ S(ce, {
325
+ "aria-labelledby": m(B, R?.id),
326
+ "aria-describedby": de?.id,
327
+ className: e(i.toast, "rounded", te),
328
+ ...v,
329
+ onKeyDown: W,
330
+ children: [z ? /* @__PURE__ */ C(ae, {
331
+ label: z,
332
+ id: D
333
+ }) : null, /* @__PURE__ */ C(oe.Provider, {
334
+ value: L,
335
+ children: t.form === "options" ? /* @__PURE__ */ C(se, {
319
336
  status: t.options.status,
320
337
  statusLabel: t.options.statusLabel,
321
338
  title: t.options.title,
@@ -325,55 +342,69 @@ function me({ entry: t, timers: r, onDismiss: a, onExited: o, getFocusFallback:
325
342
  })]
326
343
  }) : null;
327
344
  }
328
- me.displayName = "ToastContainer";
329
- var Y = ({ position: t = "bottom-end", limit: l, shortcuts: d, toaster: p, className: m, style: g, children: ne, onFocus: re, onBlur: ae, onKeyDown: oe, onPointerEnter: y, onPointerLeave: se, onPointerOver: ce, ref: ue, ...k }) => {
330
- let [A, j] = x.useState([]), [de, P] = x.useState(() => /* @__PURE__ */ new Map()), F = x.useCallback((e, t) => {
331
- P((n) => {
345
+ he.displayName = "ToastContainer";
346
+ var Z = ({ position: t = "bottom-end", limit: l, shortcuts: d, toaster: m, className: ee, style: _, children: te, onFocus: ne, onBlur: ie, onKeyDown: ae, onPointerEnter: b, onPointerLeave: oe, onPointerOver: se, ref: le, ...A }) => {
347
+ let [j, M] = S.useState([]), [ue, F] = S.useState(() => /* @__PURE__ */ new Map()), I = S.useCallback((e, t) => {
348
+ F((n) => {
332
349
  let r = n.get(e);
333
350
  if (r && r.seq === t.seq && r.text === t.text && r.assertive === t.assertive) return n;
334
351
  let i = new Map(n);
335
352
  return i.set(e, t), i;
336
353
  });
337
- }, []), I = le(A, O(l));
338
- I !== A && j(I);
339
- let R = I.filter((e) => e.shown);
340
- x.useEffect(() => {
354
+ }, []), R = ce(j, k(l));
355
+ R !== j && M(R);
356
+ let B = R.filter((e) => e.shown);
357
+ S.useEffect(() => {
341
358
  l !== void 0 && !(l >= 1) && n("Toaster:limit", `Toaster: \`limit\` must be 1 or more (got ${String(l)}); it counts as 1.`);
342
359
  }, [l]);
343
- let z = c("toast"), B = x.useRef(0), V = x.useRef(null), H = ee(ue, V), U = x.useRef(null), pe = te(), [W, G] = x.useState(0);
344
- x.useLayoutEffect(() => {
345
- let e = () => {
346
- let e = V.current;
347
- G(e ? fe(e, t) : 0);
360
+ let H = c("toast"), U = S.useRef(0), W = S.useRef(null), fe = p(le, W), G = S.useRef(null), pe = h(), [K, me] = S.useState(L);
361
+ S.useLayoutEffect(() => {
362
+ let e = null, n = null, r = null, i = /* @__PURE__ */ new Set(), a = () => {
363
+ let t = de();
364
+ for (let n of i) t.has(n) || e?.unobserve(n);
365
+ for (let n of t) i.has(n) || e?.observe(n);
366
+ let r = t.size !== i.size || [...t].some((e) => !i.has(e));
367
+ if (i = t, r && n) {
368
+ n.disconnect();
369
+ for (let e of t) n.observe(e, {
370
+ attributes: !0,
371
+ attributeFilter: ["class", "style"]
372
+ });
373
+ }
374
+ }, o = () => {
375
+ let n = W.current;
376
+ e && n !== r && (r && e.unobserve(r), n && e.observe(n), r = n), a();
377
+ let i = n ? z(n, t) : L;
378
+ me((e) => e.inline === i.inline && e.block === i.block ? e : i);
348
379
  };
349
- e();
350
- let n = _(e);
351
- return window.addEventListener("resize", e), document.addEventListener("transitionend", e, !0), document.addEventListener("animationend", e, !0), () => {
352
- n(), window.removeEventListener("resize", e), document.removeEventListener("transitionend", e, !0), document.removeEventListener("animationend", e, !0);
380
+ typeof ResizeObserver < "u" && (e = new ResizeObserver(() => o())), typeof MutationObserver < "u" && (n = new MutationObserver(o)), o();
381
+ let s = v(o);
382
+ return window.addEventListener("resize", o), document.addEventListener("transitionend", o, !0), document.addEventListener("animationend", o, !0), () => {
383
+ s(), e?.disconnect(), n?.disconnect(), window.removeEventListener("resize", o), document.removeEventListener("transitionend", o, !0), document.removeEventListener("animationend", o, !0);
353
384
  };
354
385
  }, [t, pe]);
355
- let [K] = x.useState(() => M((e) => j((t) => w(t, e))));
356
- x.useEffect(() => {
357
- let e = document, t = !1, n = () => K.setInBackground(t || e.visibilityState === "hidden"), r = (e) => {
386
+ let [q] = S.useState(() => N((e) => M((t) => T(t, e))));
387
+ S.useEffect(() => {
388
+ let e = document, t = !1, n = () => q.setInBackground(t || e.visibilityState === "hidden"), r = (e) => {
358
389
  e.target instanceof Node || (t = !0, n());
359
390
  }, i = (e) => {
360
391
  e.target instanceof Node || (t = !1, n());
361
392
  };
362
- return n(), K.setSuspended(!1), window.addEventListener("blur", r), window.addEventListener("focus", i), e.addEventListener("visibilitychange", n), () => {
363
- window.removeEventListener("blur", r), window.removeEventListener("focus", i), e.removeEventListener("visibilitychange", n), K.setSuspended(!0);
393
+ return n(), q.setSuspended(!1), window.addEventListener("blur", r), window.addEventListener("focus", i), e.addEventListener("visibilitychange", n), () => {
394
+ window.removeEventListener("blur", r), window.removeEventListener("focus", i), e.removeEventListener("visibilitychange", n), q.setSuspended(!0);
364
395
  };
365
- }, [K]);
366
- let q = x.useCallback((e, t) => {
367
- B.current += 1;
368
- let n = B.current, r = o(e) ? {
396
+ }, [q]);
397
+ let J = S.useCallback((e, t) => {
398
+ U.current += 1;
399
+ let n = U.current, r = o(e) ? {
369
400
  form: "options",
370
401
  options: e
371
402
  } : {
372
403
  form: "content",
373
404
  content: e,
374
405
  options: t ?? {}
375
- }, i = r.options.toastId ?? `${z}-${n}`;
376
- return j((e) => {
406
+ }, i = r.options.toastId ?? `${H}-${n}`;
407
+ return M((e) => {
377
408
  let t = e.findIndex((e) => e.id === i), a = t !== -1 && e[t].shown, o = {
378
409
  ...r,
379
410
  id: i,
@@ -385,180 +416,181 @@ var Y = ({ position: t = "bottom-end", limit: l, shortcuts: d, toaster: p, class
385
416
  let s = e.slice();
386
417
  return s[t] = o, s;
387
418
  }), i;
388
- }, [z]), J = x.useCallback((e) => {
389
- K.remove(e), j((t) => w(t, e));
390
- }, [K]), Y = x.useCallback(() => {
391
- K.clear(), j((e) => T(e));
392
- }, [K]), he = x.useCallback((e) => {
393
- j((t) => t.some((t) => t.id === e && t.dismissed) ? t.filter((t) => !(t.id === e && t.dismissed)) : t), P((t) => {
419
+ }, [H]), Y = S.useCallback((e) => {
420
+ q.remove(e), M((t) => T(t, e));
421
+ }, [q]), X = S.useCallback(() => {
422
+ q.clear(), M((e) => E(e));
423
+ }, [q]), Z = S.useCallback((e) => {
424
+ M((t) => t.some((t) => t.id === e && t.dismissed) ? t.filter((t) => !(t.id === e && t.dismissed)) : t), F((t) => {
394
425
  if (!t.has(e)) return t;
395
426
  let n = new Map(t);
396
427
  return n.delete(e), n;
397
428
  });
398
- }, []), X = x.useMemo(() => ({
399
- dispatchToast: q,
400
- dismissToast: J,
401
- dismissAllToasts: Y
429
+ }, []), Q = S.useMemo(() => ({
430
+ dispatchToast: J,
431
+ dismissToast: Y,
432
+ dismissAllToasts: X
402
433
  }), [
403
- q,
404
434
  J,
405
- Y
406
- ]), [ge] = x.useState(() => ({}));
407
- x.useLayoutEffect(() => {
408
- if (!p) return;
409
- let e = a(p, ge, X);
435
+ Y,
436
+ X
437
+ ]), [ge] = S.useState(() => ({}));
438
+ S.useLayoutEffect(() => {
439
+ if (!m) return;
440
+ let e = a(m, ge, Q);
410
441
  if (e.status === "bound") return e.unbind;
411
442
  e.status === "taken" ? n("Toaster:handle-bound", "Toaster: this handle is already bound to another Toaster; a handle binds one Toaster. Create one handle per Toaster.") : n("Toaster:handle-unknown", "Toaster: `toaster` is not a handle from createToaster(), so nothing is bound. Pass the value createToaster() returns.");
412
443
  }, [
413
- p,
444
+ m,
414
445
  ge,
415
- X
446
+ Q
416
447
  ]);
417
- let _e = x.useCallback((e) => {
418
- let t = V.current, n = t ? Array.from(t.children).filter((e) => e instanceof HTMLElement && e.hasAttribute("data-wave-toast")) : [], r = !!e && e.ownerDocument.activeElement === e, i = e ? n.indexOf(e) : -1, a = (t) => t !== e && t.isConnected && t.getAttribute("data-presence") !== "exiting", o = n.slice(i + 1).find(a), s = i > 0 ? n.slice(0, i).reverse().find(a) : void 0;
448
+ let _e = S.useCallback((e) => {
449
+ let t = W.current, n = t ? Array.from(t.children).filter((e) => e instanceof HTMLElement && e.hasAttribute("data-wave-toast")) : [], r = !!e && e.ownerDocument.activeElement === e, i = e ? n.indexOf(e) : -1, a = (t) => t !== e && t.isConnected && t.getAttribute("data-presence") !== "exiting", o = n.slice(i + 1).find(a), s = i > 0 ? n.slice(0, i).reverse().find(a) : void 0;
419
450
  for (let e of [o, s]) {
420
451
  if (!e) continue;
421
452
  let t = r ? e : u(e);
422
453
  if (t) return t;
423
454
  }
424
- let c = U.current;
425
- return U.current = null, c?.isConnected ? c : null;
426
- }, []), Z = s(() => {
427
- let e = V.current;
455
+ let c = G.current;
456
+ return G.current = null, c?.isConnected ? c : null;
457
+ }, []), $ = s(() => {
458
+ let e = W.current;
428
459
  if (!e) return;
429
460
  let t = e.ownerDocument;
430
461
  if (t.activeElement && t.activeElement !== t.body) return;
431
- let n = K.isPaused("focus");
432
- K.setPaused("focus", !1);
433
- let r = U.current;
434
- U.current = null, n && r && f(r) && r.focus({ preventScroll: !0 });
462
+ let n = q.isPaused("focus");
463
+ q.setPaused("focus", !1);
464
+ let r = G.current;
465
+ G.current = null, n && r && f(r) && r.focus({ preventScroll: !0 });
435
466
  });
436
- x.useLayoutEffect(() => {
437
- Z();
438
- }, [I, Z]), x.useLayoutEffect(() => _(() => queueMicrotask(Z)), [Z]);
439
- let Q = x.useRef(null);
440
- x.useEffect(() => {
467
+ S.useLayoutEffect(() => {
468
+ $();
469
+ }, [R, $]), S.useLayoutEffect(() => v(() => queueMicrotask($)), [$]);
470
+ let ve = S.useRef(null);
471
+ S.useEffect(() => {
441
472
  let e = (e) => {
442
- let t = Q.current === e;
443
- if (Q.current = null, t || !K.isPaused("hover")) return;
444
- let n = V.current;
445
- n && e.target instanceof Node && D(n, e.target) || K.setPaused("hover", !1);
473
+ let t = ve.current === e;
474
+ if (ve.current = null, t || !q.isPaused("hover")) return;
475
+ let n = W.current;
476
+ n && e.target instanceof Node && O(n, e.target) || q.setPaused("hover", !1);
446
477
  };
447
478
  return document.addEventListener("pointerover", e), () => document.removeEventListener("pointerover", e);
448
- }, [K]);
449
- let ve = x.useRef(I);
450
- x.useLayoutEffect(() => {
451
- ve.current = I;
479
+ }, [q]);
480
+ let ye = S.useRef(R);
481
+ S.useLayoutEffect(() => {
482
+ ye.current = R;
452
483
  });
453
- let $ = x.useRef(/* @__PURE__ */ new Map()), ye = x.useCallback((e, t) => {
454
- t ? $.current.set(e, t) : $.current.delete(e);
455
- }, []), be = typeof d?.focus == "function", xe = s((e) => {
484
+ let be = S.useRef(/* @__PURE__ */ new Map()), xe = S.useCallback((e, t) => {
485
+ t ? be.current.set(e, t) : be.current.delete(e);
486
+ }, []), Se = typeof d?.focus == "function", Ce = s((e) => {
456
487
  if (e.defaultPrevented || e.isComposing || !d?.focus?.(e)) return;
457
- let t = E(ve.current), n = t ? $.current.get(t.id) : void 0;
488
+ let t = D(ye.current), n = t ? be.current.get(t.id) : void 0;
458
489
  if (!n?.isConnected) return;
459
490
  e.preventDefault();
460
- let r = V.current, i = n.ownerDocument.activeElement;
461
- i instanceof HTMLElement && i !== n.ownerDocument.body && !(r && D(r, i)) && (U.current = i), n.focus({ preventScroll: !1 });
491
+ let r = W.current, i = n.ownerDocument.activeElement;
492
+ i instanceof HTMLElement && i !== n.ownerDocument.body && !(r && O(r, i)) && (G.current = i), n.focus({ preventScroll: !1 });
462
493
  });
463
- x.useEffect(() => {
464
- if (!be) return;
465
- let e = (e) => xe(e);
494
+ S.useEffect(() => {
495
+ if (!Se) return;
496
+ let e = (e) => Ce(e);
466
497
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
467
- }, [be, xe]);
468
- let Se = (e) => {
498
+ }, [Se, Ce]);
499
+ let we = (e) => {
469
500
  let t = e.relatedTarget;
470
- t instanceof HTMLElement && f(t) && (D(e.currentTarget, t) || (U.current = t));
471
- }, Ce = (e) => {
501
+ t instanceof HTMLElement && f(t) && (O(e.currentTarget, t) || (G.current = t));
502
+ }, Te = (e) => {
472
503
  let t = e.currentTarget, n = e.relatedTarget;
473
- if (!(n instanceof Node && D(t, n)) && !e.target.closest("[data-wave-toast][data-presence=\"exiting\"]")) {
504
+ if (!(n instanceof Node && O(t, n)) && !e.target.closest("[data-wave-toast][data-presence=\"exiting\"]")) {
474
505
  if (n === null) {
475
506
  let n = e.target;
476
507
  if (!n.isConnected) return;
477
508
  let r = n.ownerDocument.activeElement;
478
- if (r && D(t, r)) return;
509
+ if (r && O(t, r)) return;
479
510
  }
480
- U.current = null;
511
+ G.current = null;
481
512
  }
482
- }, we = (e) => {
483
- if (e.key !== "Escape" && e.key !== "Esc" || e.defaultPrevented || e.nativeEvent.isComposing || !ie(e)) return;
513
+ }, Ee = (e) => {
514
+ if (e.key !== "Escape" && e.key !== "Esc" || e.defaultPrevented || e.nativeEvent.isComposing || !re(e)) return;
484
515
  let t = e.currentTarget;
485
- if (h().some((e) => e.escape && t.contains(e.getAnchor()))) return;
516
+ if (g().some((e) => e.escape && t.contains(e.getAnchor()))) return;
486
517
  e.preventDefault();
487
- let n = U.current;
488
- U.current = null, n?.isConnected && n.focus({ preventScroll: !0 }), Y();
489
- }, Te = [], Ee = [];
490
- for (let e of R) {
518
+ let n = G.current;
519
+ G.current = null, n?.isConnected && n.focus({ preventScroll: !0 }), X();
520
+ }, De = [], Oe = [];
521
+ for (let e of B) {
491
522
  if (e.dismissed) continue;
492
- let t = de.get(e.id);
523
+ let t = ue.get(e.id);
493
524
  if (!t || t.seq !== e.seq || !t.text) continue;
494
- let n = /* @__PURE__ */ S(L, { text: t.text }, t.seq);
495
- (t.assertive ? Ee : Te).push(n);
525
+ let n = /* @__PURE__ */ C(V, { text: t.text }, t.seq);
526
+ (t.assertive ? Oe : De).push(n);
496
527
  }
497
- let De = W > 0 ? {
498
- ...g,
499
- "--wave-toaster-offset": `${W}px`
500
- } : g;
501
- return /* @__PURE__ */ C(b.Provider, {
502
- value: X,
503
- children: [ne, /* @__PURE__ */ S(v, {
528
+ let ke = K.inline > 0 || K.block > 0 ? {
529
+ ..._,
530
+ ...K.inline > 0 && { "--wave-toaster-offset": `${K.inline}px` },
531
+ ...K.block > 0 && { "--wave-toaster-offset-block": `${K.block}px` }
532
+ } : _;
533
+ return /* @__PURE__ */ w(x.Provider, {
534
+ value: Q,
535
+ children: [te, /* @__PURE__ */ C(y, {
504
536
  layer: "toast",
505
- children: /* @__PURE__ */ C("div", {
506
- ref: H,
537
+ children: /* @__PURE__ */ w("div", {
538
+ ref: fe,
507
539
  role: "region",
508
540
  "aria-label": "Notifications",
509
541
  "data-wave-focus-trap-allow": "",
510
542
  "data-position": t,
511
- ...k,
512
- style: De,
543
+ ...A,
544
+ style: ke,
513
545
  onFocus: (e) => {
514
- re?.(e), Se(e), K.setPaused("focus", !0);
546
+ ne?.(e), we(e), q.setPaused("focus", !0);
515
547
  },
516
548
  onBlur: (e) => {
517
- ae?.(e), Ce(e);
549
+ ie?.(e), Te(e);
518
550
  let t = e.relatedTarget;
519
- t instanceof Node && D(e.currentTarget, t) || K.setPaused("focus", !1);
551
+ t instanceof Node && O(e.currentTarget, t) || q.setPaused("focus", !1);
520
552
  },
521
553
  onPointerEnter: (e) => {
522
- y?.(e), K.setPaused("hover", !0);
554
+ b?.(e), q.setPaused("hover", !0);
523
555
  },
524
556
  onPointerLeave: (e) => {
525
- se?.(e), K.setPaused("hover", !1);
557
+ oe?.(e), q.setPaused("hover", !1);
526
558
  },
527
559
  onPointerOver: (e) => {
528
- ce?.(e), Q.current = e.nativeEvent;
560
+ se?.(e), ve.current = e.nativeEvent;
529
561
  },
530
- onKeyDown: (e) => r(oe, we)(e),
531
- className: e(i.root, "fixed flex w-80 max-w-[calc(100vw-2rem)] flex-col gap-2", N[t], m),
562
+ onKeyDown: (e) => r(ae, Ee)(e),
563
+ className: e(i.root, "fixed flex w-80 max-w-[calc(100vw-2rem)] flex-col gap-2", P[t], ee),
532
564
  children: [
533
- /* @__PURE__ */ S("div", {
565
+ /* @__PURE__ */ C("div", {
534
566
  role: "status",
535
567
  "aria-live": "polite",
536
568
  "aria-atomic": "false",
537
569
  className: "sr-only",
538
- children: Te
570
+ children: De
539
571
  }),
540
- /* @__PURE__ */ S("div", {
572
+ /* @__PURE__ */ C("div", {
541
573
  "aria-live": "assertive",
542
574
  "aria-atomic": "false",
543
575
  className: "sr-only",
544
- children: Ee
576
+ children: Oe
545
577
  }),
546
- R.map((e) => /* @__PURE__ */ S(me, {
578
+ B.map((e) => /* @__PURE__ */ C(he, {
547
579
  entry: e,
548
- timers: K,
549
- onDismiss: J,
550
- onExited: he,
580
+ timers: q,
581
+ onDismiss: Y,
582
+ onExited: Z,
551
583
  getFocusFallback: _e,
552
- announce: F,
553
- registerContainer: ye
584
+ announce: I,
585
+ registerContainer: xe
554
586
  }, e.id))
555
587
  ]
556
588
  })
557
589
  })]
558
590
  });
559
591
  };
560
- Y.displayName = "Toaster";
592
+ Z.displayName = "Toaster";
561
593
  //#endregion
562
- export { Y as Toaster, j as useToastController };
594
+ export { Z as Toaster, M as useToastController };
563
595
 
564
596
  //# sourceMappingURL=Toaster.mjs.map