@koide-labs/ui 0.0.15 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (310) hide show
  1. package/dist/-utils.d.ts +2 -2
  2. package/dist/-utils.js +1 -1
  3. package/dist/{Button-DrPFFzo7.js → Button-BmcVHRRW.js} +2 -2
  4. package/dist/{CompositeRoot-CVk5a-pR.js → CompositeRoot-CCgh2M64.js} +6 -6
  5. package/dist/{FloatingPortal-tWyuKRSN.js → FloatingPortal-BQsQhvIr.js} +27 -27
  6. package/dist/{FloatingPortalLite-DVyq6YhV.js → FloatingPortalLite-_ECdFE7b.js} +1 -1
  7. package/dist/{InternalBackdrop-jYAiOJ8v.js → InternalBackdrop-BSMKU-hc.js} +13 -13
  8. package/dist/{LabelableContext-BMvjVwor.js → LabelableContext-Be1u-eFg.js} +2 -2
  9. package/dist/accordion.css +1 -0
  10. package/dist/alert-dialog.css +1 -0
  11. package/dist/anchor.css +1 -0
  12. package/dist/avatar.css +1 -0
  13. package/dist/badge.css +1 -0
  14. package/dist/button.css +1 -0
  15. package/dist/checkbox.css +1 -0
  16. package/dist/code.css +1 -0
  17. package/dist/collapse.css +1 -0
  18. package/dist/command.css +1 -0
  19. package/dist/components/accordion/accordion.d.ts +19 -0
  20. package/dist/components/accordion/accordion.js +701 -0
  21. package/dist/components/accordion/index.d.ts +1 -12
  22. package/dist/components/accordion/index.js +2 -697
  23. package/dist/components/alert-dialog/alert-dialog.d.ts +36 -0
  24. package/dist/components/alert-dialog/alert-dialog.js +138 -0
  25. package/dist/components/alert-dialog/index.d.ts +1 -26
  26. package/dist/components/alert-dialog/index.js +2 -134
  27. package/dist/components/anchor/anchor.d.ts +12 -0
  28. package/dist/components/anchor/anchor.js +21 -0
  29. package/dist/components/anchor/index.d.ts +1 -8
  30. package/dist/components/anchor/index.js +2 -19
  31. package/dist/components/avatar/avatar.d.ts +25 -0
  32. package/dist/components/avatar/avatar.js +161 -0
  33. package/dist/components/avatar/index.d.ts +1 -21
  34. package/dist/components/avatar/index.js +2 -159
  35. package/dist/components/badge/badge.d.ts +20 -0
  36. package/dist/components/badge/badge.js +42 -0
  37. package/dist/components/badge/index.d.ts +1 -16
  38. package/dist/components/badge/index.js +2 -40
  39. package/dist/components/button/button.d.ts +27 -0
  40. package/dist/components/button/button.js +47 -0
  41. package/dist/components/button/index.d.ts +1 -24
  42. package/dist/components/button/index.js +2 -45
  43. package/dist/components/checkbox/checkbox.d.ts +13 -0
  44. package/dist/components/checkbox/checkbox.js +269 -0
  45. package/dist/components/checkbox/index.d.ts +1 -9
  46. package/dist/components/checkbox/index.js +2 -267
  47. package/dist/components/code/code.d.ts +13 -0
  48. package/dist/components/code/code.js +1206 -0
  49. package/dist/components/code/index.d.ts +1 -9
  50. package/dist/components/code/index.js +2 -1204
  51. package/dist/components/collapse/collapse.d.ts +14 -0
  52. package/dist/components/collapse/collapse.js +35 -0
  53. package/dist/components/collapse/index.d.ts +1 -11
  54. package/dist/components/collapse/index.js +2 -33
  55. package/dist/components/command/command.d.ts +36 -0
  56. package/dist/components/command/command.js +1695 -0
  57. package/dist/components/command/index.d.ts +1 -15
  58. package/dist/components/command/index.js +2 -1693
  59. package/dist/components/context-menu/context-menu.d.ts +82 -0
  60. package/dist/components/context-menu/context-menu.js +1445 -0
  61. package/dist/components/context-menu/index.d.ts +1 -42
  62. package/dist/components/context-menu/index.js +2 -1442
  63. package/dist/components/dialog/dialog.d.ts +22 -0
  64. package/dist/components/dialog/dialog.js +140 -0
  65. package/dist/components/dialog/dialog.types.d.ts +38 -0
  66. package/dist/components/dialog/index.d.ts +1 -48
  67. package/dist/components/dialog/index.js +2 -136
  68. package/dist/components/heading/heading.d.ts +25 -0
  69. package/dist/components/heading/heading.js +36 -0
  70. package/dist/components/heading/index.d.ts +1 -44
  71. package/dist/components/heading/index.js +2 -49
  72. package/dist/components/icon/icon.d.ts +28 -0
  73. package/dist/components/icon/icon.js +43 -0
  74. package/dist/components/icon/{icon-names.d.ts → icon.types.d.ts} +4 -0
  75. package/dist/components/icon/icon.types.js +1 -0
  76. package/dist/components/icon/index.d.ts +2 -24
  77. package/dist/components/icon/index.js +2 -41
  78. package/dist/components/icon-button/icon-button.d.ts +16 -0
  79. package/dist/components/icon-button/icon-button.js +46 -0
  80. package/dist/components/icon-button/index.d.ts +1 -12
  81. package/dist/components/icon-button/index.js +2 -44
  82. package/dist/components/inline-code/index.d.ts +1 -6
  83. package/dist/components/inline-code/index.js +2 -20
  84. package/dist/components/inline-code/inline-code.d.ts +10 -0
  85. package/dist/components/inline-code/inline-code.js +25 -0
  86. package/dist/components/input/index.d.ts +1 -3
  87. package/dist/components/input/index.js +2 -117
  88. package/dist/components/input/input.d.ts +9 -0
  89. package/dist/components/input/input.js +126 -0
  90. package/dist/components/meter/index.d.ts +1 -18
  91. package/dist/components/meter/index.js +2 -163
  92. package/dist/components/meter/meter.d.ts +22 -0
  93. package/dist/components/meter/meter.js +165 -0
  94. package/dist/components/multiline-input/index.d.ts +1 -6
  95. package/dist/components/multiline-input/index.js +2 -98
  96. package/dist/components/multiline-input/multiline-input.d.ts +10 -0
  97. package/dist/components/multiline-input/multiline-input.js +100 -0
  98. package/dist/components/number-input/index.d.ts +1 -10
  99. package/dist/components/number-input/index.js +2 -1167
  100. package/dist/components/number-input/number-input.d.ts +14 -0
  101. package/dist/components/number-input/number-input.js +1169 -0
  102. package/dist/components/password-input/index.d.ts +1 -2
  103. package/dist/components/password-input/index.js +2 -27
  104. package/dist/components/password-input/password-input.d.ts +7 -0
  105. package/dist/components/password-input/password-input.js +29 -0
  106. package/dist/components/pill/index.d.ts +1 -13
  107. package/dist/components/pill/index.js +2 -36
  108. package/dist/components/pill/pill.d.ts +17 -0
  109. package/dist/components/pill/pill.js +38 -0
  110. package/dist/components/popover/index.d.ts +1 -21
  111. package/dist/components/popover/index.js +2 -634
  112. package/dist/components/popover/popover.d.ts +22 -0
  113. package/dist/components/popover/popover.js +634 -0
  114. package/dist/components/preview-card/index.d.ts +1 -17
  115. package/dist/components/preview-card/index.js +2 -400
  116. package/dist/components/preview-card/preview-card.d.ts +21 -0
  117. package/dist/components/preview-card/preview-card.js +402 -0
  118. package/dist/components/radio-group/index.d.ts +1 -0
  119. package/dist/components/radio-group/index.js +5 -0
  120. package/dist/components/radio-group/radio-group.d.ts +25 -0
  121. package/dist/components/{radio/index.js → radio-group/radio-group.js} +91 -90
  122. package/dist/components/search-bar/index.d.ts +1 -12
  123. package/dist/components/search-bar/index.js +2 -46
  124. package/dist/components/search-bar/search-bar.d.ts +16 -0
  125. package/dist/components/search-bar/search-bar.js +43 -0
  126. package/dist/components/select/index.d.ts +1 -16
  127. package/dist/components/select/index.js +2 -1261
  128. package/dist/components/select/select.d.ts +22 -0
  129. package/dist/components/select/select.js +1263 -0
  130. package/dist/components/separator/index.d.ts +1 -7
  131. package/dist/components/separator/index.js +2 -4
  132. package/dist/components/separator/separator.d.ts +10 -0
  133. package/dist/components/separator/separator.js +6 -0
  134. package/dist/components/slider/index.d.ts +1 -5
  135. package/dist/components/slider/index.js +2 -900
  136. package/dist/components/slider/slider.d.ts +10 -0
  137. package/dist/components/slider/slider.js +899 -0
  138. package/dist/components/spinner/index.d.ts +1 -2
  139. package/dist/components/spinner/index.js +2 -11
  140. package/dist/components/spinner/spinner.d.ts +7 -0
  141. package/dist/components/spinner/spinner.js +13 -0
  142. package/dist/components/stacked-avatars/index.d.ts +1 -14
  143. package/dist/components/stacked-avatars/index.js +2 -90
  144. package/dist/components/stacked-avatars/stacked-avatars.d.ts +18 -0
  145. package/dist/components/stacked-avatars/stacked-avatars.js +92 -0
  146. package/dist/components/status-banner/index.d.ts +1 -17
  147. package/dist/components/status-banner/index.js +2 -69
  148. package/dist/components/status-banner/status-banner.d.ts +22 -0
  149. package/dist/components/status-banner/status-banner.js +71 -0
  150. package/dist/components/surface/index.d.ts +2 -27
  151. package/dist/components/surface/index.js +2 -39
  152. package/dist/components/surface/surface.d.ts +26 -0
  153. package/dist/components/surface/surface.js +36 -0
  154. package/dist/components/surface/surface.types.d.ts +1 -0
  155. package/dist/components/surface/surface.types.js +1 -0
  156. package/dist/components/switch/index.d.ts +1 -5
  157. package/dist/components/switch/index.js +2 -194
  158. package/dist/components/switch/switch.d.ts +10 -0
  159. package/dist/components/switch/switch.js +193 -0
  160. package/dist/components/tabs/index.d.ts +1 -18
  161. package/dist/components/tabs/index.js +2 -507
  162. package/dist/components/tabs/tabs.d.ts +28 -0
  163. package/dist/components/tabs/tabs.js +511 -0
  164. package/dist/components/text/index.d.ts +1 -26
  165. package/dist/components/text/index.js +2 -46
  166. package/dist/components/text/text.d.ts +29 -0
  167. package/dist/components/text/text.js +48 -0
  168. package/dist/components/theme-provider/index.d.ts +1 -1
  169. package/dist/components/theme-provider/theme-provider.d.ts +8 -4
  170. package/dist/components/theme-provider/theme-provider.js +3 -3
  171. package/dist/components/timestamp/index.d.ts +1 -23
  172. package/dist/components/timestamp/index.js +2 -1390
  173. package/dist/components/timestamp/timestamp.d.ts +26 -0
  174. package/dist/components/timestamp/timestamp.js +1391 -0
  175. package/dist/components/toaster/index.d.ts +2 -0
  176. package/dist/components/toaster/index.js +7 -0
  177. package/dist/components/toaster/toaster.d.ts +7 -0
  178. package/dist/components/toaster/toaster.js +923 -0
  179. package/dist/components/{toast → toaster}/use-toast-manager.d.ts +3 -3
  180. package/dist/components/tooltip/index.d.ts +1 -14
  181. package/dist/components/tooltip/index.js +2 -710
  182. package/dist/components/tooltip/tooltip.d.ts +24 -0
  183. package/dist/components/tooltip/tooltip.js +9 -0
  184. package/dist/components/view/index.d.ts +2 -30
  185. package/dist/components/view/index.js +2 -79
  186. package/dist/components/view/view.d.ts +31 -0
  187. package/dist/components/view/view.js +83 -0
  188. package/dist/components/view/view.types.d.ts +5 -0
  189. package/dist/components/view/view.types.js +1 -0
  190. package/dist/components/visually-hidden/index.d.ts +5 -1
  191. package/dist/{composite-Bx7Szd_T.js → composite-BZzP-LlG.js} +3 -3
  192. package/dist/{composite-C9L5QmZL.js → composite-BwEK5cWH.js} +1 -1
  193. package/dist/context-menu.css +1 -0
  194. package/dist/{createBaseUIEventDetails-D8M2Yl-a.js → createBaseUIEventDetails-CCSfZ2vM.js} +7 -7
  195. package/dist/{detectBrowser-I-s3yzIE.js → detectBrowser-Bl8Ki_1I.js} +2 -2
  196. package/dist/dialog.css +1 -1
  197. package/dist/{dialog.module-BeF-6XAo.js → dialog.module-DsbQRp-d.js} +55 -55
  198. package/dist/{element-CZEOj04G.js → element-u5WgOZX1.js} +7 -7
  199. package/dist/{event-CKoGyQEJ.js → event-B89-Ng5h.js} +4 -4
  200. package/dist/{floating-ui.utils-C7pRWMZ_.js → floating-ui.utils-DUVaIF3G.js} +7 -7
  201. package/dist/{floating-ui.utils.dom-C7FS5id0.js → floating-ui.utils.dom-cbi420Pg.js} +4 -4
  202. package/dist/{getDisabledMountTransitionStyles-YfHPge6T.js → getDisabledMountTransitionStyles-E2x-_lte.js} +7 -7
  203. package/dist/heading.css +1 -0
  204. package/dist/icon-button.css +1 -0
  205. package/dist/icon.css +1 -0
  206. package/dist/index.d.ts +10 -10
  207. package/dist/index.js +86 -104
  208. package/dist/{inertValue-BCYGsdmf.js → inertValue-BTpPjX30.js} +1 -1
  209. package/dist/inline-code.css +1 -0
  210. package/dist/input.css +1 -1
  211. package/dist/input.module-CtE19OH8.js +8 -0
  212. package/dist/integrations/react-markdown/index.js +12 -12
  213. package/dist/meter.css +1 -0
  214. package/dist/number-input.css +1 -0
  215. package/dist/password-input.css +1 -0
  216. package/dist/pill.css +1 -0
  217. package/dist/popover.css +1 -0
  218. package/dist/preview-card.css +1 -0
  219. package/dist/radio-group.css +1 -0
  220. package/dist/safePolygon-DnkzOIur.js +558 -0
  221. package/dist/search-bar.css +1 -0
  222. package/dist/select.css +1 -0
  223. package/dist/{index-DVjyPAD4.js → separator-fh_wDZNf.js} +7 -11
  224. package/dist/separator.css +1 -0
  225. package/dist/slider.css +1 -0
  226. package/dist/spinner.css +1 -0
  227. package/dist/stacked-avatars.css +1 -0
  228. package/dist/status-banner.css +1 -0
  229. package/dist/styles/core.css +1 -1
  230. package/dist/surface.css +1 -0
  231. package/dist/switch.css +1 -0
  232. package/dist/tabs.css +1 -0
  233. package/dist/text.css +1 -0
  234. package/dist/timestamp.css +1 -0
  235. package/dist/toaster.css +1 -0
  236. package/dist/tooltip-oCp-elli.js +765 -0
  237. package/dist/tooltip.css +1 -0
  238. package/dist/transitions.css +1 -1
  239. package/dist/{transitions.module-CWX8e5cx.js → transitions.module-D9mMAtfI.js} +11 -11
  240. package/dist/{useAnimationFrame-451ugS_6.js → useAnimationFrame-DvK1s63A.js} +1 -1
  241. package/dist/{useButton-DfIwsdb8.js → useButton-d3_JgBNr.js} +3 -3
  242. package/dist/{useCompositeListItem-OkcAim_1.js → useCompositeListItem-CZp9WTnF.js} +2 -2
  243. package/dist/{useLabelableId-Ci_jDvmv.js → useLabelableId-CX4tcfzK.js} +3 -3
  244. package/dist/{useOpenChangeComplete-Dse9kY9E.js → useOpenChangeComplete-BHd-N7Ig.js} +5 -5
  245. package/dist/{useRender-CLx7dR_1.js → useRender-C3vlzS3t.js} +1 -1
  246. package/dist/{useRenderElement-DwToLA61.js → useRenderElement-DngNDu_P.js} +2 -2
  247. package/dist/{useRole-oDBdbuwQ.js → useRole-BD3OL1rr.js} +3 -3
  248. package/dist/{useStableCallback-CkTrVkNX.js → useStableCallback-DKZHlUAT.js} +1 -1
  249. package/dist/{useSyncedFloatingRootContext-Dorsv-jf.js → useSyncedFloatingRootContext-BB1vwkV-.js} +20 -20
  250. package/dist/{useTimeout-CflX-kz3.js → useTimeout-BNni6aw5.js} +1 -1
  251. package/dist/{useTransitionStatus-CUfcuGAV.js → useTransitionStatus-CmMyUh74.js} +1 -1
  252. package/dist/{useTypeahead-D85V2IUx.js → useTypeahead-BiL5IAVb.js} +11 -11
  253. package/dist/{useValueAsRef-HURLzret.js → useValueAsRef-B4EriRsI.js} +1 -1
  254. package/dist/{useValueChanged-DL757-yD.js → useValueChanged-MJRmEWz1.js} +1 -1
  255. package/dist/view.css +1 -1
  256. package/dist/view.module-Dj7wj0kk.js +6 -0
  257. package/dist/view2.css +1 -0
  258. package/package.json +1 -1
  259. package/dist/components/radio/index.d.ts +0 -13
  260. package/dist/components/toast/index.d.ts +0 -2
  261. package/dist/components/toast/index.js +0 -8
  262. package/dist/components/toast/toast.d.ts +0 -2
  263. package/dist/components/toast/toast.js +0 -921
  264. package/dist/components/tooltip/tooltip-arrow.d.ts +0 -3
  265. package/dist/components/tooltip/tooltip-arrow.js +0 -6
  266. package/dist/index10.css +0 -1
  267. package/dist/index11.css +0 -1
  268. package/dist/index12.css +0 -1
  269. package/dist/index13.css +0 -1
  270. package/dist/index14.css +0 -1
  271. package/dist/index15.css +0 -1
  272. package/dist/index16.css +0 -1
  273. package/dist/index17.css +0 -1
  274. package/dist/index18.css +0 -1
  275. package/dist/index19.css +0 -1
  276. package/dist/index20.css +0 -1
  277. package/dist/index21.css +0 -1
  278. package/dist/index22.css +0 -1
  279. package/dist/index23.css +0 -1
  280. package/dist/index24.css +0 -1
  281. package/dist/index25.css +0 -1
  282. package/dist/index26.css +0 -1
  283. package/dist/index27.css +0 -1
  284. package/dist/index28.css +0 -1
  285. package/dist/index29.css +0 -1
  286. package/dist/index3.css +0 -1
  287. package/dist/index30.css +0 -1
  288. package/dist/index31.css +0 -1
  289. package/dist/index32.css +0 -1
  290. package/dist/index33.css +0 -1
  291. package/dist/index34.css +0 -1
  292. package/dist/index35.css +0 -1
  293. package/dist/index36.css +0 -1
  294. package/dist/index37.css +0 -1
  295. package/dist/index4.css +0 -1
  296. package/dist/index5.css +0 -1
  297. package/dist/index6.css +0 -1
  298. package/dist/index7.css +0 -1
  299. package/dist/index8.css +0 -1
  300. package/dist/index9.css +0 -1
  301. package/dist/input.module-DDQY_Ij6.js +0 -7
  302. package/dist/safePolygon-DWy1dGKJ.js +0 -308
  303. package/dist/toast.css +0 -1
  304. package/dist/tooltip-arrow-cs6vjjqZ.js +0 -24
  305. package/dist/tooltip-arrow.css +0 -1
  306. package/dist/useHoverReferenceInteraction-SfOBPoXM.js +0 -264
  307. package/dist/usePopupAutoResize-CNR6Ekmx.js +0 -85
  308. package/dist/view.module-DfDLgJE0.js +0 -6
  309. /package/dist/components/{icon/icon-names.js → dialog/dialog.types.js} +0 -0
  310. /package/dist/components/{toast → toaster}/use-toast-manager.js +0 -0
@@ -0,0 +1,923 @@
1
+ import { jsx as D, jsxs as re } from "react/jsx-runtime";
2
+ import { c as Ne } from "../../clsx-OuTLNxxd.js";
3
+ import { T as it, a as Re, u as at } from "../../use-toast-manager-Dq-44AuW.js";
4
+ import { View as Pe } from "../view/view.js";
5
+ import { Heading as ct } from "../heading/heading.js";
6
+ import { Text as ut } from "../text/text.js";
7
+ import { IconButton as lt } from "../icon-button/icon-button.js";
8
+ import { Button as ft } from "../button/button.js";
9
+ import { Surface as dt } from "../surface/surface.js";
10
+ import * as e from "react";
11
+ import { o as ne } from "../../owner-rKN292Q9.js";
12
+ import { u as U } from "../../useStableCallback-DKZHlUAT.js";
13
+ import { T as Oe } from "../../useTimeout-BNni6aw5.js";
14
+ import { d as pe, f as se, m as De, h as Ee } from "../../element-u5WgOZX1.js";
15
+ import { F as pt } from "../../FloatingPortalLite-_ECdFE7b.js";
16
+ import { v as mt } from "../../visuallyHidden-CpJ-mhai.js";
17
+ import { F as Te } from "../../FloatingPortal-BQsQhvIr.js";
18
+ import { u as ie } from "../../useRenderElement-DngNDu_P.js";
19
+ import { g as Ce } from "../../floating-ui.utils.dom-cbi420Pg.js";
20
+ import * as ht from "react-dom";
21
+ import { i as gt } from "../../inertValue-BTpPjX30.js";
22
+ import { u as me } from "../../useIsoLayoutEffect-CIDbvm3Q.js";
23
+ import { f as _t } from "../../formatErrorMessage-BqPuTBN-.js";
24
+ import { u as yt, t as wt } from "../../useOpenChangeComplete-BHd-N7Ig.js";
25
+ import { u as He } from "../../useId-C5kyn6tA.js";
26
+ import { u as vt } from "../../useButton-d3_JgBNr.js";
27
+ import '../../toaster.css';let Fe = 0;
28
+ function xt(a) {
29
+ return Fe += 1, `${a}-${Math.random().toString(36).slice(2, 6)}-${Fe}`;
30
+ }
31
+ function be(a, c) {
32
+ if (typeof a == "string")
33
+ return {
34
+ description: a
35
+ };
36
+ if (typeof a == "function") {
37
+ const h = a(c);
38
+ return typeof h == "string" ? {
39
+ description: h
40
+ } : h;
41
+ }
42
+ return a;
43
+ }
44
+ const ke = function(c) {
45
+ const {
46
+ children: h,
47
+ timeout: s = 5e3,
48
+ limit: F = 3,
49
+ toastManager: M
50
+ } = c, [v, u] = e.useState([]), [g, t] = e.useState(!1), [d, y] = e.useState(!1), [o, E] = e.useState(null);
51
+ v.length === 0 && (g && t(!1), d && y(!1));
52
+ const R = g || d, N = e.useRef(/* @__PURE__ */ new Map()), z = e.useRef(null), C = e.useRef(!0), X = e.useRef(!1);
53
+ function j(n) {
54
+ const m = pe(ne(z.current));
55
+ if (!z.current || !se(z.current, m) || !De(m))
56
+ return;
57
+ const w = v.findIndex((r) => r.id === n);
58
+ let i = null, _ = w + 1;
59
+ for (; _ < v.length; ) {
60
+ if (v[_].transitionStatus !== "ending") {
61
+ i = v[_];
62
+ break;
63
+ }
64
+ _ += 1;
65
+ }
66
+ if (!i)
67
+ for (_ = w - 1; _ >= 0; ) {
68
+ if (v[_].transitionStatus !== "ending") {
69
+ i = v[_];
70
+ break;
71
+ }
72
+ _ -= 1;
73
+ }
74
+ i ? i.ref?.current?.focus() : o?.focus({
75
+ preventScroll: !0
76
+ });
77
+ }
78
+ const b = U(() => {
79
+ X.current || (X.current = !0, N.current.forEach((n) => {
80
+ if (n.timeout) {
81
+ n.timeout.clear();
82
+ const m = Date.now() - n.start, w = n.delay - m;
83
+ n.remaining = w > 0 ? w : 0;
84
+ }
85
+ }));
86
+ }), I = U(() => {
87
+ X.current && (X.current = !1, N.current.forEach((n, m) => {
88
+ n.remaining = n.remaining > 0 ? n.remaining : n.delay, n.timeout ??= Oe.create(), n.timeout.start(n.remaining, () => {
89
+ N.current.delete(m), n.callback();
90
+ }), n.start = Date.now();
91
+ }));
92
+ }), L = U((n) => {
93
+ u((i) => {
94
+ const _ = i.map((p) => p.id === n ? {
95
+ ...p,
96
+ transitionStatus: "ending",
97
+ height: 0
98
+ } : p), r = _.filter((p) => p.transitionStatus !== "ending");
99
+ return _.map((p) => {
100
+ if (p.transitionStatus === "ending")
101
+ return p;
102
+ const x = r.indexOf(p) >= F;
103
+ return {
104
+ ...p,
105
+ limited: x
106
+ };
107
+ });
108
+ });
109
+ const m = N.current.get(n);
110
+ m && m.timeout && (m.timeout.clear(), N.current.delete(n)), v.find((i) => i.id === n)?.onClose?.(), j(n), v.length === 1 && (t(!1), y(!1));
111
+ }), q = U((n) => {
112
+ u((w) => w.filter((i) => i.id !== n)), v.find((w) => w.id === n)?.onRemove?.();
113
+ }), B = U((n, m, w) => {
114
+ const i = Date.now(), _ = C.current && !g && !d, r = _ ? Oe.create() : void 0;
115
+ r?.start(m, () => {
116
+ N.current.delete(n), w();
117
+ }), N.current.set(n, {
118
+ timeout: r,
119
+ start: _ ? i : 0,
120
+ delay: m,
121
+ remaining: m,
122
+ callback: w
123
+ });
124
+ }), G = U((n) => {
125
+ const m = n.id || xt("toast"), w = {
126
+ ...n,
127
+ id: m,
128
+ transitionStatus: "starting"
129
+ };
130
+ u((_) => {
131
+ const r = [w, ..._], p = r.filter((x) => x.transitionStatus !== "ending");
132
+ if (p.length > F) {
133
+ const x = p.length - F, T = p.slice(-x);
134
+ return r.map((H) => T.some((Z) => Z.id === H.id) ? {
135
+ ...H,
136
+ limited: !0
137
+ } : {
138
+ ...H,
139
+ limited: !1
140
+ });
141
+ }
142
+ return r.map((x) => ({
143
+ ...x,
144
+ limited: !1
145
+ }));
146
+ });
147
+ const i = w.timeout ?? s;
148
+ return w.type !== "loading" && i > 0 && B(m, i, () => L(m)), (g || d || !C.current) && b(), m;
149
+ }), K = U((n, m) => {
150
+ u((w) => w.map((i) => i.id === n ? {
151
+ ...i,
152
+ ...m
153
+ } : i));
154
+ }), O = U((n, m) => {
155
+ const w = be(m.loading), i = G({
156
+ ...w,
157
+ type: "loading"
158
+ }), _ = n.then((r) => {
159
+ const p = be(m.success, r);
160
+ K(i, {
161
+ ...p,
162
+ type: "success"
163
+ });
164
+ const x = p.timeout ?? s;
165
+ return x > 0 && B(i, x, () => L(i)), (g || d || !C.current) && b(), r;
166
+ }).catch((r) => {
167
+ const p = be(m.error, r);
168
+ K(i, {
169
+ ...p,
170
+ type: "error"
171
+ });
172
+ const x = p.timeout ?? s;
173
+ return x > 0 && B(i, x, () => L(i)), (g || d || !C.current) && b(), Promise.reject(r);
174
+ });
175
+ return {}.hasOwnProperty.call(m, "setPromise") && m.setPromise(_), _;
176
+ });
177
+ e.useEffect(function() {
178
+ return M ? M[" subscribe"](({
179
+ action: w,
180
+ options: i
181
+ }) => {
182
+ const _ = i.id;
183
+ w === "promise" && i.promise ? O(i.promise, i) : w === "update" && _ ? K(_, i) : w === "close" && _ ? L(_) : G(i);
184
+ }) : void 0;
185
+ }, [G, K, B, s, M, O, L]);
186
+ const J = e.useMemo(() => ({
187
+ toasts: v,
188
+ setToasts: u,
189
+ hovering: g,
190
+ setHovering: t,
191
+ focused: d,
192
+ setFocused: y,
193
+ expanded: R,
194
+ add: G,
195
+ close: L,
196
+ remove: q,
197
+ update: K,
198
+ promise: O,
199
+ pauseTimers: b,
200
+ resumeTimers: I,
201
+ prevFocusElement: o,
202
+ setPrevFocusElement: E,
203
+ viewportRef: z,
204
+ scheduleTimer: B,
205
+ windowFocusedRef: C
206
+ }), [G, L, d, g, R, b, o, O, q, I, B, v, K]);
207
+ return /* @__PURE__ */ D(it.Provider, {
208
+ value: J,
209
+ children: h
210
+ });
211
+ };
212
+ process.env.NODE_ENV !== "production" && (ke.displayName = "ToastProvider");
213
+ const Ve = /* @__PURE__ */ e.createContext(void 0);
214
+ process.env.NODE_ENV !== "production" && (Ve.displayName = "ToastViewportContext");
215
+ let Tt = /* @__PURE__ */ (function(a) {
216
+ return a.frontmostHeight = "--toast-frontmost-height", a;
217
+ })({});
218
+ const Be = /* @__PURE__ */ e.forwardRef(function(c, h) {
219
+ const {
220
+ render: s,
221
+ className: F,
222
+ children: M,
223
+ ...v
224
+ } = c, {
225
+ toasts: u,
226
+ pauseTimers: g,
227
+ resumeTimers: t,
228
+ setHovering: d,
229
+ setFocused: y,
230
+ viewportRef: o,
231
+ windowFocusedRef: E,
232
+ prevFocusElement: R,
233
+ setPrevFocusElement: N,
234
+ expanded: z,
235
+ focused: C
236
+ } = Re(), X = e.useRef(!1), j = e.useRef(!1), b = u.length, I = u[0]?.height ?? 0, L = e.useMemo(() => u.some((r) => r.transitionStatus === "ending"), [u]);
237
+ e.useEffect(() => {
238
+ if (!o.current)
239
+ return;
240
+ function r(x) {
241
+ b !== 0 && x.key === "F6" && x.target !== o.current && (x.preventDefault(), N(pe(ne(o.current))), o.current?.focus({
242
+ preventScroll: !0
243
+ }), g(), y(!0));
244
+ }
245
+ const p = Ce(o.current);
246
+ return p.addEventListener("keydown", r), () => {
247
+ p.removeEventListener("keydown", r);
248
+ };
249
+ }, [g, y, N, b, o]), e.useEffect(() => {
250
+ if (!o.current || !b)
251
+ return;
252
+ const r = Ce(o.current);
253
+ function p(T) {
254
+ T.target === r && (E.current = !1, g());
255
+ }
256
+ function x(T) {
257
+ if (T.relatedTarget || T.target === r)
258
+ return;
259
+ const H = Ee(T), Z = pe(ne(o.current));
260
+ (!se(o.current, H) || !De(Z)) && t(), setTimeout(() => {
261
+ E.current = !0;
262
+ });
263
+ }
264
+ return r.addEventListener("blur", p, !0), r.addEventListener("focus", x, !0), () => {
265
+ r.removeEventListener("blur", p, !0), r.removeEventListener("focus", x, !0);
266
+ };
267
+ }, [
268
+ g,
269
+ t,
270
+ o,
271
+ E,
272
+ y,
273
+ // `viewportRef.current` isn't available on the first render,
274
+ // since the portal node hasn't yet been created.
275
+ // By adding this dependency, we ensure the window listeners
276
+ // are added when toasts have been created, once the ref is available.
277
+ b
278
+ ]), e.useEffect(() => {
279
+ const r = o.current;
280
+ if (!r || b === 0)
281
+ return;
282
+ const p = ne(r);
283
+ function x(T) {
284
+ if (T.pointerType !== "touch")
285
+ return;
286
+ const H = Ee(T);
287
+ se(r, H) || (t(), d(!1), y(!1));
288
+ }
289
+ return p.addEventListener("pointerdown", x, !0), () => {
290
+ p.removeEventListener("pointerdown", x, !0);
291
+ };
292
+ }, [b, t, y, d, o]);
293
+ function q(r) {
294
+ o.current && (X.current = !0, r.relatedTarget === o.current ? u[0]?.ref?.current?.focus() : R?.focus({
295
+ preventScroll: !0
296
+ }));
297
+ }
298
+ function B(r) {
299
+ r.key === "Tab" && r.shiftKey && r.target === o.current && (r.preventDefault(), R?.focus({
300
+ preventScroll: !0
301
+ }), t());
302
+ }
303
+ e.useEffect(() => {
304
+ !E.current || L || !j.current || (t(), d(!1), j.current = !1);
305
+ }, [L, t, d, E]);
306
+ function G() {
307
+ g(), d(!0), j.current = !1;
308
+ }
309
+ function K() {
310
+ u.some((r) => r.transitionStatus === "ending") ? j.current = !0 : (t(), d(!1));
311
+ }
312
+ function O() {
313
+ if (X.current) {
314
+ X.current = !1;
315
+ return;
316
+ }
317
+ C || De(ne(o.current).activeElement) && (y(!0), g());
318
+ }
319
+ function J(r) {
320
+ !C || se(o.current, r.relatedTarget) || (y(!1), t());
321
+ }
322
+ const n = {
323
+ tabIndex: -1,
324
+ role: "region",
325
+ "aria-live": "polite",
326
+ "aria-atomic": !1,
327
+ "aria-relevant": "additions text",
328
+ "aria-label": "Notifications",
329
+ onMouseEnter: G,
330
+ onMouseMove: G,
331
+ onMouseLeave: K,
332
+ onFocus: O,
333
+ onBlur: J,
334
+ onKeyDown: B,
335
+ onClick: O
336
+ }, m = e.useMemo(() => ({
337
+ expanded: z
338
+ }), [z]), w = ie("div", c, {
339
+ ref: [h, o],
340
+ state: m,
341
+ props: [n, {
342
+ style: {
343
+ [Tt.frontmostHeight]: I ? `${I}px` : void 0
344
+ }
345
+ }, v, {
346
+ children: /* @__PURE__ */ re(e.Fragment, {
347
+ children: [b > 0 && R && /* @__PURE__ */ D(Te, {
348
+ onFocus: q
349
+ }), M, b > 0 && R && /* @__PURE__ */ D(Te, {
350
+ onFocus: q
351
+ })]
352
+ })
353
+ }]
354
+ }), i = e.useMemo(() => ({
355
+ viewportRef: o
356
+ }), [o]), _ = e.useMemo(() => u.filter((r) => r.priority === "high"), [u]);
357
+ return /* @__PURE__ */ re(Ve.Provider, {
358
+ value: i,
359
+ children: [b > 0 && R && /* @__PURE__ */ D(Te, {
360
+ onFocus: q
361
+ }), w, !C && _.length > 0 && /* @__PURE__ */ D("div", {
362
+ style: mt,
363
+ children: _.map((r) => /* @__PURE__ */ re("div", {
364
+ role: "alert",
365
+ "aria-atomic": !0,
366
+ children: [/* @__PURE__ */ D("div", {
367
+ children: r.title
368
+ }), /* @__PURE__ */ D("div", {
369
+ children: r.description
370
+ })]
371
+ }, r.id))
372
+ })]
373
+ });
374
+ });
375
+ process.env.NODE_ENV !== "production" && (Be.displayName = "ToastViewport");
376
+ const Se = /* @__PURE__ */ e.createContext(void 0);
377
+ process.env.NODE_ENV !== "production" && (Se.displayName = "ToastRootContext");
378
+ function oe() {
379
+ const a = e.useContext(Se);
380
+ if (!a)
381
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>." : _t(66));
382
+ return a;
383
+ }
384
+ let ee = /* @__PURE__ */ (function(a) {
385
+ return a.index = "--toast-index", a.offsetY = "--toast-offset-y", a.height = "--toast-height", a.swipeMovementX = "--toast-swipe-movement-x", a.swipeMovementY = "--toast-swipe-movement-y", a;
386
+ })({});
387
+ const bt = {
388
+ ...wt,
389
+ swipeDirection(a) {
390
+ return a ? {
391
+ "data-swipe-direction": a
392
+ } : null;
393
+ }
394
+ }, ae = 40, Dt = 10, Q = 0.5, Et = 1;
395
+ function Ie(a, c, h) {
396
+ switch (a) {
397
+ case "up":
398
+ return -h;
399
+ case "down":
400
+ return h;
401
+ case "left":
402
+ return -c;
403
+ case "right":
404
+ return c;
405
+ default:
406
+ return 0;
407
+ }
408
+ }
409
+ function Rt(a) {
410
+ const h = window.getComputedStyle(a).transform;
411
+ let s = 0, F = 0, M = 1;
412
+ if (h && h !== "none") {
413
+ const v = h.match(/matrix(?:3d)?\(([^)]+)\)/);
414
+ if (v) {
415
+ const u = v[1].split(", ").map(parseFloat);
416
+ u.length === 6 ? (s = u[4], F = u[5], M = Math.sqrt(u[0] * u[0] + u[1] * u[1])) : u.length === 16 && (s = u[12], F = u[13], M = u[0]);
417
+ }
418
+ }
419
+ return {
420
+ x: s,
421
+ y: F,
422
+ scale: M
423
+ };
424
+ }
425
+ const $e = /* @__PURE__ */ e.forwardRef(function(c, h) {
426
+ const {
427
+ toast: s,
428
+ render: F,
429
+ className: M,
430
+ swipeDirection: v = ["down", "right"],
431
+ ...u
432
+ } = c, g = s.positionerProps?.anchor !== void 0;
433
+ let t = [];
434
+ g || (t = Array.isArray(v) ? v : [v]);
435
+ const d = t.length > 0, {
436
+ toasts: y,
437
+ focused: o,
438
+ close: E,
439
+ remove: R,
440
+ setToasts: N,
441
+ pauseTimers: z,
442
+ expanded: C,
443
+ setHovering: X
444
+ } = Re(), [j, b] = e.useState(void 0), [I, L] = e.useState(!1), [q, B] = e.useState(!1), [G, K] = e.useState(!1), [O, J] = e.useState({
445
+ x: 0,
446
+ y: 0
447
+ }), [n, m] = e.useState({
448
+ x: 0,
449
+ y: 0,
450
+ scale: 1
451
+ }), [w, i] = e.useState(), [_, r] = e.useState(), [p, x] = e.useState(null), T = e.useRef(null), H = e.useRef({
452
+ x: 0,
453
+ y: 0
454
+ }), Z = e.useRef({
455
+ x: 0,
456
+ y: 0,
457
+ scale: 1
458
+ }), ce = e.useRef(void 0), he = e.useRef(0), ue = e.useRef(!1), $ = e.useRef({
459
+ x: 0,
460
+ y: 0
461
+ }), ge = e.useRef(!1), _e = e.useMemo(() => y.indexOf(s), [s, y]), ye = e.useMemo(() => y.filter((l) => l.transitionStatus !== "ending").indexOf(s), [s, y]), Ge = e.useMemo(() => y.slice(0, y.indexOf(s)).reduce((l, f) => l + (f.height || 0), 0), [y, s]);
462
+ yt({
463
+ open: s.transitionStatus !== "ending",
464
+ ref: T,
465
+ onComplete() {
466
+ s.transitionStatus === "ending" && R(s.id);
467
+ }
468
+ });
469
+ const le = U((l = !1) => {
470
+ const f = T.current;
471
+ if (!f)
472
+ return;
473
+ const S = f.style.height;
474
+ f.style.height = "auto";
475
+ const P = f.offsetHeight;
476
+ f.style.height = S;
477
+ function A() {
478
+ N((k) => k.map((V) => V.id === s.id ? {
479
+ ...V,
480
+ ref: T,
481
+ height: P,
482
+ transitionStatus: void 0
483
+ } : V));
484
+ }
485
+ l ? ht.flushSync(A) : A();
486
+ });
487
+ me(le, [le]);
488
+ function Ke(l, f) {
489
+ let S = l, P = f;
490
+ return !t.includes("left") && !t.includes("right") ? S = l > 0 ? l ** Q : -(Math.abs(l) ** Q) : (!t.includes("right") && l > 0 && (S = l ** Q), !t.includes("left") && l < 0 && (S = -(Math.abs(l) ** Q))), !t.includes("up") && !t.includes("down") ? P = f > 0 ? f ** Q : -(Math.abs(f) ** Q) : (!t.includes("down") && f > 0 && (P = f ** Q), !t.includes("up") && f < 0 && (P = -(Math.abs(f) ** Q))), {
491
+ x: S,
492
+ y: P
493
+ };
494
+ }
495
+ function We(l) {
496
+ if (l.button !== 0)
497
+ return;
498
+ l.pointerType === "touch" && z();
499
+ const f = Ee(l.nativeEvent);
500
+ if (!(f && f.closest('button,a,input,textarea,[role="button"],[data-swipe-ignore]'))) {
501
+ if (ue.current = !1, ce.current = void 0, he.current = 0, H.current = {
502
+ x: l.clientX,
503
+ y: l.clientY
504
+ }, $.current = H.current, T.current) {
505
+ const P = Rt(T.current);
506
+ Z.current = P, m(P), J({
507
+ x: P.x,
508
+ y: P.y
509
+ });
510
+ }
511
+ X(!0), L(!0), B(!1), x(null), ge.current = !0, T.current?.setPointerCapture(l.pointerId);
512
+ }
513
+ }
514
+ function je(l) {
515
+ if (!I)
516
+ return;
517
+ l.preventDefault(), ge.current && (H.current = {
518
+ x: l.clientX,
519
+ y: l.clientY
520
+ }, ge.current = !1);
521
+ const {
522
+ clientY: f,
523
+ clientX: S,
524
+ movementX: P,
525
+ movementY: A
526
+ } = l;
527
+ (A < 0 && f > $.current.y || A > 0 && f < $.current.y) && ($.current = {
528
+ x: $.current.x,
529
+ y: f
530
+ }), (P < 0 && S > $.current.x || P > 0 && S < $.current.x) && ($.current = {
531
+ x: S,
532
+ y: $.current.y
533
+ });
534
+ const k = S - H.current.x, V = f - H.current.y, tt = f - $.current.y, nt = S - $.current.x;
535
+ if (!q && Math.sqrt(k * k + V * V) >= Et && (B(!0), p === null)) {
536
+ const de = t.includes("left") || t.includes("right"), rt = t.includes("up") || t.includes("down");
537
+ if (de && rt) {
538
+ const st = Math.abs(k), ot = Math.abs(V);
539
+ x(st > ot ? "horizontal" : "vertical");
540
+ }
541
+ }
542
+ let Y;
543
+ if (!ce.current)
544
+ p === "vertical" ? V > 0 ? Y = "down" : V < 0 && (Y = "up") : p === "horizontal" ? k > 0 ? Y = "right" : k < 0 && (Y = "left") : Math.abs(k) >= Math.abs(V) ? Y = k > 0 ? "right" : "left" : Y = V > 0 ? "down" : "up", Y && t.includes(Y) && (ce.current = Y, he.current = Ie(Y, k, V), b(Y));
545
+ else {
546
+ const xe = ce.current, de = Ie(xe, nt, tt);
547
+ de > ae ? (ue.current = !1, b(xe)) : !(t.includes("left") && t.includes("right")) && !(t.includes("up") && t.includes("down")) && he.current - de >= Dt && (ue.current = !0);
548
+ }
549
+ const fe = Ke(k, V);
550
+ let we = Z.current.x, ve = Z.current.y;
551
+ p === "horizontal" ? (t.includes("left") || t.includes("right")) && (we += fe.x) : (p === "vertical" || (t.includes("left") || t.includes("right")) && (we += fe.x), (t.includes("up") || t.includes("down")) && (ve += fe.y)), J({
552
+ x: we,
553
+ y: ve
554
+ });
555
+ }
556
+ function Ue(l) {
557
+ if (!I)
558
+ return;
559
+ if (L(!1), B(!1), x(null), T.current?.releasePointerCapture(l.pointerId), ue.current) {
560
+ J({
561
+ x: n.x,
562
+ y: n.y
563
+ }), b(void 0);
564
+ return;
565
+ }
566
+ let f = !1;
567
+ const S = O.x - n.x, P = O.y - n.y;
568
+ let A;
569
+ for (const k of t) {
570
+ switch (k) {
571
+ case "right":
572
+ S > ae && (f = !0, A = "right");
573
+ break;
574
+ case "left":
575
+ S < -ae && (f = !0, A = "left");
576
+ break;
577
+ case "down":
578
+ P > ae && (f = !0, A = "down");
579
+ break;
580
+ case "up":
581
+ P < -ae && (f = !0, A = "up");
582
+ break;
583
+ }
584
+ if (f)
585
+ break;
586
+ }
587
+ f ? (b(A), K(!0), E(s.id)) : (J({
588
+ x: n.x,
589
+ y: n.y
590
+ }), b(void 0));
591
+ }
592
+ function qe(l) {
593
+ if (l.key === "Escape") {
594
+ if (!T.current || !se(T.current, pe(ne(T.current))))
595
+ return;
596
+ E(s.id);
597
+ }
598
+ }
599
+ e.useEffect(() => {
600
+ if (!d)
601
+ return;
602
+ const l = T.current;
603
+ if (!l)
604
+ return;
605
+ function f(S) {
606
+ se(l, S.target) && S.preventDefault();
607
+ }
608
+ return l.addEventListener("touchmove", f, {
609
+ passive: !1
610
+ }), () => {
611
+ l.removeEventListener("touchmove", f);
612
+ };
613
+ }, [d]);
614
+ function Je() {
615
+ if (!I && O.x === n.x && O.y === n.y && !G)
616
+ return {
617
+ [ee.swipeMovementX]: "0px",
618
+ [ee.swipeMovementY]: "0px"
619
+ };
620
+ const l = O.x - n.x, f = O.y - n.y;
621
+ return {
622
+ transition: I ? "none" : void 0,
623
+ // While swiping, freeze the element at its current visual transform so it doesn't snap to the
624
+ // end position.
625
+ transform: I ? `translateX(${O.x}px) translateY(${O.y}px) scale(${n.scale})` : void 0,
626
+ [ee.swipeMovementX]: `${l}px`,
627
+ [ee.swipeMovementY]: `${f}px`
628
+ };
629
+ }
630
+ const Me = s.priority === "high", Qe = {
631
+ role: Me ? "alertdialog" : "dialog",
632
+ tabIndex: 0,
633
+ "aria-modal": !1,
634
+ "aria-labelledby": w,
635
+ "aria-describedby": _,
636
+ "aria-hidden": Me && !o ? !0 : void 0,
637
+ onPointerDown: d ? We : void 0,
638
+ onPointerMove: d ? je : void 0,
639
+ onPointerUp: d ? Ue : void 0,
640
+ onKeyDown: qe,
641
+ inert: gt(s.limited),
642
+ style: {
643
+ ...Je(),
644
+ [ee.index]: s.transitionStatus === "ending" ? _e : ye,
645
+ [ee.offsetY]: `${Ge}px`,
646
+ [ee.height]: s.height ? `${s.height}px` : void 0
647
+ }
648
+ }, te = e.useMemo(() => ({
649
+ rootRef: T,
650
+ toast: s,
651
+ titleId: w,
652
+ setTitleId: i,
653
+ descriptionId: _,
654
+ setDescriptionId: r,
655
+ swiping: I,
656
+ swipeDirection: j,
657
+ recalculateHeight: le,
658
+ index: _e,
659
+ visibleIndex: ye,
660
+ expanded: C
661
+ }), [s, w, _, I, j, le, _e, ye, C]), Ze = e.useMemo(() => ({
662
+ transitionStatus: s.transitionStatus,
663
+ expanded: C,
664
+ limited: s.limited || !1,
665
+ type: s.type,
666
+ swiping: te.swiping,
667
+ swipeDirection: te.swipeDirection
668
+ }), [C, s.transitionStatus, s.limited, s.type, te.swiping, te.swipeDirection]), et = ie("div", c, {
669
+ ref: [h, te.rootRef],
670
+ state: Ze,
671
+ stateAttributesMapping: bt,
672
+ props: [Qe, u]
673
+ });
674
+ return /* @__PURE__ */ D(Se.Provider, {
675
+ value: te,
676
+ children: et
677
+ });
678
+ });
679
+ process.env.NODE_ENV !== "production" && ($e.displayName = "ToastRoot");
680
+ const Ae = /* @__PURE__ */ e.forwardRef(function(c, h) {
681
+ const {
682
+ render: s,
683
+ className: F,
684
+ ...M
685
+ } = c, {
686
+ visibleIndex: v,
687
+ expanded: u,
688
+ recalculateHeight: g
689
+ } = oe(), t = e.useRef(null);
690
+ me(() => {
691
+ const E = t.current;
692
+ if (!E || (g(), typeof ResizeObserver != "function" || typeof MutationObserver != "function"))
693
+ return;
694
+ const R = new ResizeObserver(() => g(!0)), N = new MutationObserver(() => g(!0));
695
+ return R.observe(E), N.observe(E, {
696
+ childList: !0,
697
+ subtree: !0,
698
+ characterData: !0
699
+ }), () => {
700
+ R.disconnect(), N.disconnect();
701
+ };
702
+ }, [g]);
703
+ const d = v > 0, y = e.useMemo(() => ({
704
+ expanded: u,
705
+ behind: d
706
+ }), [u, d]);
707
+ return ie("div", c, {
708
+ ref: [h, t],
709
+ state: y,
710
+ props: M
711
+ });
712
+ });
713
+ process.env.NODE_ENV !== "production" && (Ae.displayName = "ToastContent");
714
+ const Ye = /* @__PURE__ */ e.forwardRef(function(c, h) {
715
+ const {
716
+ render: s,
717
+ className: F,
718
+ id: M,
719
+ children: v,
720
+ ...u
721
+ } = c, {
722
+ toast: g
723
+ } = oe(), t = v ?? g.description, d = !!t, y = He(M), {
724
+ setDescriptionId: o
725
+ } = oe();
726
+ me(() => {
727
+ if (d)
728
+ return o(y), () => {
729
+ o(void 0);
730
+ };
731
+ }, [d, y, o]);
732
+ const E = e.useMemo(() => ({
733
+ type: g.type
734
+ }), [g.type]), R = ie("p", c, {
735
+ ref: h,
736
+ state: E,
737
+ props: {
738
+ ...u,
739
+ id: y,
740
+ children: t
741
+ }
742
+ });
743
+ return d ? R : null;
744
+ });
745
+ process.env.NODE_ENV !== "production" && (Ye.displayName = "ToastDescription");
746
+ const ze = /* @__PURE__ */ e.forwardRef(function(c, h) {
747
+ const {
748
+ render: s,
749
+ className: F,
750
+ id: M,
751
+ children: v,
752
+ ...u
753
+ } = c, {
754
+ toast: g
755
+ } = oe(), t = v ?? g.title, d = !!t, y = He(M), {
756
+ setTitleId: o
757
+ } = oe();
758
+ me(() => {
759
+ if (d)
760
+ return o(y), () => {
761
+ o(void 0);
762
+ };
763
+ }, [d, y, o]);
764
+ const E = e.useMemo(() => ({
765
+ type: g.type
766
+ }), [g.type]), R = ie("h2", c, {
767
+ ref: h,
768
+ state: E,
769
+ props: {
770
+ ...u,
771
+ id: y,
772
+ children: t
773
+ }
774
+ });
775
+ return d ? R : null;
776
+ });
777
+ process.env.NODE_ENV !== "production" && (ze.displayName = "ToastTitle");
778
+ const Xe = /* @__PURE__ */ e.forwardRef(function(c, h) {
779
+ const {
780
+ render: s,
781
+ className: F,
782
+ disabled: M,
783
+ nativeButton: v = !0,
784
+ ...u
785
+ } = c, {
786
+ close: g,
787
+ expanded: t
788
+ } = Re(), {
789
+ toast: d
790
+ } = oe(), [y, o] = e.useState(!1), {
791
+ getButtonProps: E,
792
+ buttonRef: R
793
+ } = vt({
794
+ disabled: M,
795
+ native: v
796
+ }), N = e.useMemo(() => ({
797
+ type: d.type
798
+ }), [d.type]);
799
+ return ie("button", c, {
800
+ ref: [h, R],
801
+ state: N,
802
+ props: [{
803
+ "aria-hidden": !t && !y,
804
+ onClick() {
805
+ g(d.id);
806
+ },
807
+ onFocus() {
808
+ o(!0);
809
+ },
810
+ onBlur() {
811
+ o(!1);
812
+ }
813
+ }, u, E]
814
+ });
815
+ });
816
+ process.env.NODE_ENV !== "production" && (Xe.displayName = "ToastClose");
817
+ const St = pt, Mt = "_toaster__viewport_twmyb_2", Nt = "_toaster_twmyb_2", Pt = "_toaster_variant_neutral_twmyb_112", Ot = "_toaster_variant_colorway_twmyb_118", Ct = "_toaster__content_twmyb_124", Ft = "_toaster__header_twmyb_143", It = "_toaster__header_pad_twmyb_147", Lt = "_toaster__title_twmyb_151", Ht = "_toaster__description_twmyb_155", kt = "_toaster__close_twmyb_159", W = {
818
+ toaster__viewport: Mt,
819
+ toaster: Nt,
820
+ toaster_variant_neutral: Pt,
821
+ toaster_variant_colorway: Ot,
822
+ toaster__content: Ct,
823
+ toaster__header: Ft,
824
+ toaster__header_pad: It,
825
+ toaster__title: Lt,
826
+ toaster__description: Ht,
827
+ toaster__close: kt
828
+ }, Le = {
829
+ info: "blue",
830
+ error: "red",
831
+ warning: "yellow",
832
+ success: "green"
833
+ };
834
+ function ln({ children: a, ...c }) {
835
+ return /* @__PURE__ */ re(ke, { ...c, children: [
836
+ a,
837
+ /* @__PURE__ */ D(St, { children: /* @__PURE__ */ D(Be, { className: W.toaster__viewport, children: /* @__PURE__ */ D(Vt, {}) }) })
838
+ ] });
839
+ }
840
+ function Vt() {
841
+ return at().toasts.map((c) => {
842
+ const h = c.type && c.type in Le ? Le[c.type] : void 0;
843
+ return /* @__PURE__ */ D(
844
+ $e,
845
+ {
846
+ toast: c,
847
+ className: Ne(
848
+ W.toaster,
849
+ h ? W.toaster_variant_colorway : W.toaster_variant_neutral
850
+ ),
851
+ render: /* @__PURE__ */ D(dt, { background: "default", color: h }),
852
+ children: /* @__PURE__ */ re(
853
+ Pe,
854
+ {
855
+ render: /* @__PURE__ */ D(Ae, {}),
856
+ className: W.toaster__content,
857
+ children: [
858
+ /* @__PURE__ */ re(
859
+ Pe,
860
+ {
861
+ className: Ne(
862
+ W.toaster__header,
863
+ !c.title && W.toaster__header_pad
864
+ ),
865
+ children: [
866
+ /* @__PURE__ */ D(
867
+ ze,
868
+ {
869
+ render: /* @__PURE__ */ D(
870
+ ct,
871
+ {
872
+ level: 2,
873
+ size: "lg",
874
+ color: "inherit",
875
+ className: W.toaster__title
876
+ }
877
+ )
878
+ }
879
+ ),
880
+ /* @__PURE__ */ D(
881
+ Ye,
882
+ {
883
+ render: /* @__PURE__ */ D(ut, { multiline: !0, color: h ? "inherit" : "dimmer" }),
884
+ className: W.toaster__description
885
+ }
886
+ )
887
+ ]
888
+ }
889
+ ),
890
+ /* @__PURE__ */ D(
891
+ Xe,
892
+ {
893
+ render: /* @__PURE__ */ D(
894
+ lt,
895
+ {
896
+ interactive: h ? `${h}_no-fill` : "no-fill",
897
+ icon: "close-line",
898
+ size: "sm",
899
+ alt: "Close",
900
+ className: W.toaster__close
901
+ }
902
+ )
903
+ }
904
+ ),
905
+ c.action ? /* @__PURE__ */ D(
906
+ ft,
907
+ {
908
+ ...c.action,
909
+ interactive: h ? `${h}_fill` : !0,
910
+ children: c.action.children
911
+ }
912
+ ) : null
913
+ ]
914
+ }
915
+ )
916
+ },
917
+ c.id
918
+ );
919
+ });
920
+ }
921
+ export {
922
+ ln as Toaster
923
+ };