@koide-labs/ui 0.0.14 → 0.1.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 (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 +16 -19
  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
@@ -1,921 +0,0 @@
1
- import { jsx as E, jsxs as ae } from "react/jsx-runtime";
2
- import { c as Ne } from "../../clsx-OuTLNxxd.js";
3
- import { Button as it } from "../button/index.js";
4
- import { Heading as at } from "../heading/index.js";
5
- import { IconButton as ct } from "../icon-button/index.js";
6
- import { Surface as ut } from "../surface/index.js";
7
- import { Text as lt } from "../text/index.js";
8
- import { View as Pe } from "../view/index.js";
9
- import { T as ft, a as be, u as dt } from "../../use-toast-manager-Dq-44AuW.js";
10
- import * as e from "react";
11
- import { o as ne } from "../../owner-rKN292Q9.js";
12
- import { u as U } from "../../useStableCallback-CkTrVkNX.js";
13
- import { T as Oe } from "../../useTimeout-CflX-kz3.js";
14
- import { h as pe, f as re, m as Ee, e as Re } from "../../element-CZEOj04G.js";
15
- import { F as pt } from "../../FloatingPortalLite-DVyq6YhV.js";
16
- import { v as mt } from "../../visuallyHidden-CpJ-mhai.js";
17
- import { F as Te } from "../../FloatingPortal-tWyuKRSN.js";
18
- import { u as oe } from "../../useRenderElement-DwToLA61.js";
19
- import { d as Ce } from "../../floating-ui.utils.dom-C7FS5id0.js";
20
- import * as ht from "react-dom";
21
- import { i as gt } from "../../inertValue-BCYGsdmf.js";
22
- import { u as me } from "../../useIsoLayoutEffect-CIDbvm3Q.js";
23
- import { f as vt } from "../../formatErrorMessage-BqPuTBN-.js";
24
- import { a as _t, t as wt } from "../../useOpenChangeComplete-Dse9kY9E.js";
25
- import { u as He } from "../../useId-C5kyn6tA.js";
26
- import { u as yt } from "../../useButton-DfIwsdb8.js";
27
- import '../../toast.css';let Fe = 0;
28
- function xt(f) {
29
- return Fe += 1, `${f}-${Math.random().toString(36).slice(2, 6)}-${Fe}`;
30
- }
31
- function De(f, d) {
32
- if (typeof f == "string")
33
- return {
34
- description: f
35
- };
36
- if (typeof f == "function") {
37
- const h = f(d);
38
- return typeof h == "string" ? {
39
- description: h
40
- } : h;
41
- }
42
- return f;
43
- }
44
- const ke = function(d) {
45
- const {
46
- children: h,
47
- timeout: s = 5e3,
48
- limit: F = 3,
49
- toastManager: M
50
- } = d, [y, a] = e.useState([]), [g, t] = e.useState(!1), [l, _] = e.useState(!1), [o, R] = e.useState(null);
51
- y.length === 0 && (g && t(!1), l && _(!1));
52
- const b = g || l, N = e.useRef(/* @__PURE__ */ new Map()), Y = e.useRef(null), C = e.useRef(!0), X = e.useRef(!1);
53
- function j(n) {
54
- const m = pe(ne(Y.current));
55
- if (!Y.current || !re(Y.current, m) || !Ee(m))
56
- return;
57
- const w = y.findIndex((r) => r.id === n);
58
- let i = null, v = w + 1;
59
- for (; v < y.length; ) {
60
- if (y[v].transitionStatus !== "ending") {
61
- i = y[v];
62
- break;
63
- }
64
- v += 1;
65
- }
66
- if (!i)
67
- for (v = w - 1; v >= 0; ) {
68
- if (y[v].transitionStatus !== "ending") {
69
- i = y[v];
70
- break;
71
- }
72
- v -= 1;
73
- }
74
- i ? i.ref?.current?.focus() : o?.focus({
75
- preventScroll: !0
76
- });
77
- }
78
- const D = 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
- a((i) => {
94
- const v = i.map((p) => p.id === n ? {
95
- ...p,
96
- transitionStatus: "ending",
97
- height: 0
98
- } : p), r = v.filter((p) => p.transitionStatus !== "ending");
99
- return v.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)), y.find((i) => i.id === n)?.onClose?.(), j(n), y.length === 1 && (t(!1), _(!1));
111
- }), q = U((n) => {
112
- a((w) => w.filter((i) => i.id !== n)), y.find((w) => w.id === n)?.onRemove?.();
113
- }), V = U((n, m, w) => {
114
- const i = Date.now(), v = C.current && !g && !l, r = v ? Oe.create() : void 0;
115
- r?.start(m, () => {
116
- N.current.delete(n), w();
117
- }), N.current.set(n, {
118
- timeout: r,
119
- start: v ? 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
- a((v) => {
131
- const r = [w, ...v], 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 && V(m, i, () => L(m)), (g || l || !C.current) && D(), m;
149
- }), K = U((n, m) => {
150
- a((w) => w.map((i) => i.id === n ? {
151
- ...i,
152
- ...m
153
- } : i));
154
- }), O = U((n, m) => {
155
- const w = De(m.loading), i = G({
156
- ...w,
157
- type: "loading"
158
- }), v = n.then((r) => {
159
- const p = De(m.success, r);
160
- K(i, {
161
- ...p,
162
- type: "success"
163
- });
164
- const x = p.timeout ?? s;
165
- return x > 0 && V(i, x, () => L(i)), (g || l || !C.current) && D(), r;
166
- }).catch((r) => {
167
- const p = De(m.error, r);
168
- K(i, {
169
- ...p,
170
- type: "error"
171
- });
172
- const x = p.timeout ?? s;
173
- return x > 0 && V(i, x, () => L(i)), (g || l || !C.current) && D(), Promise.reject(r);
174
- });
175
- return {}.hasOwnProperty.call(m, "setPromise") && m.setPromise(v), v;
176
- });
177
- e.useEffect(function() {
178
- return M ? M[" subscribe"](({
179
- action: w,
180
- options: i
181
- }) => {
182
- const v = i.id;
183
- w === "promise" && i.promise ? O(i.promise, i) : w === "update" && v ? K(v, i) : w === "close" && v ? L(v) : G(i);
184
- }) : void 0;
185
- }, [G, K, V, s, M, O, L]);
186
- const J = e.useMemo(() => ({
187
- toasts: y,
188
- setToasts: a,
189
- hovering: g,
190
- setHovering: t,
191
- focused: l,
192
- setFocused: _,
193
- expanded: b,
194
- add: G,
195
- close: L,
196
- remove: q,
197
- update: K,
198
- promise: O,
199
- pauseTimers: D,
200
- resumeTimers: I,
201
- prevFocusElement: o,
202
- setPrevFocusElement: R,
203
- viewportRef: Y,
204
- scheduleTimer: V,
205
- windowFocusedRef: C
206
- }), [G, L, l, g, b, D, o, O, q, I, V, y, K]);
207
- return /* @__PURE__ */ E(ft.Provider, {
208
- value: J,
209
- children: h
210
- });
211
- };
212
- process.env.NODE_ENV !== "production" && (ke.displayName = "ToastProvider");
213
- const ze = /* @__PURE__ */ e.createContext(void 0);
214
- process.env.NODE_ENV !== "production" && (ze.displayName = "ToastViewportContext");
215
- let Tt = /* @__PURE__ */ (function(f) {
216
- return f.frontmostHeight = "--toast-frontmost-height", f;
217
- })({});
218
- const Ve = /* @__PURE__ */ e.forwardRef(function(d, h) {
219
- const {
220
- render: s,
221
- className: F,
222
- children: M,
223
- ...y
224
- } = d, {
225
- toasts: a,
226
- pauseTimers: g,
227
- resumeTimers: t,
228
- setHovering: l,
229
- setFocused: _,
230
- viewportRef: o,
231
- windowFocusedRef: R,
232
- prevFocusElement: b,
233
- setPrevFocusElement: N,
234
- expanded: Y,
235
- focused: C
236
- } = be(), X = e.useRef(!1), j = e.useRef(!1), D = a.length, I = a[0]?.height ?? 0, L = e.useMemo(() => a.some((r) => r.transitionStatus === "ending"), [a]);
237
- e.useEffect(() => {
238
- if (!o.current)
239
- return;
240
- function r(x) {
241
- D !== 0 && x.key === "F6" && x.target !== o.current && (x.preventDefault(), N(pe(ne(o.current))), o.current?.focus({
242
- preventScroll: !0
243
- }), g(), _(!0));
244
- }
245
- const p = Ce(o.current);
246
- return p.addEventListener("keydown", r), () => {
247
- p.removeEventListener("keydown", r);
248
- };
249
- }, [g, _, N, D, o]), e.useEffect(() => {
250
- if (!o.current || !D)
251
- return;
252
- const r = Ce(o.current);
253
- function p(T) {
254
- T.target === r && (R.current = !1, g());
255
- }
256
- function x(T) {
257
- if (T.relatedTarget || T.target === r)
258
- return;
259
- const H = Re(T), Z = pe(ne(o.current));
260
- (!re(o.current, H) || !Ee(Z)) && t(), setTimeout(() => {
261
- R.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
- R,
272
- _,
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
- D
278
- ]), e.useEffect(() => {
279
- const r = o.current;
280
- if (!r || D === 0)
281
- return;
282
- const p = ne(r);
283
- function x(T) {
284
- if (T.pointerType !== "touch")
285
- return;
286
- const H = Re(T);
287
- re(r, H) || (t(), l(!1), _(!1));
288
- }
289
- return p.addEventListener("pointerdown", x, !0), () => {
290
- p.removeEventListener("pointerdown", x, !0);
291
- };
292
- }, [D, t, _, l, o]);
293
- function q(r) {
294
- o.current && (X.current = !0, r.relatedTarget === o.current ? a[0]?.ref?.current?.focus() : b?.focus({
295
- preventScroll: !0
296
- }));
297
- }
298
- function V(r) {
299
- r.key === "Tab" && r.shiftKey && r.target === o.current && (r.preventDefault(), b?.focus({
300
- preventScroll: !0
301
- }), t());
302
- }
303
- e.useEffect(() => {
304
- !R.current || L || !j.current || (t(), l(!1), j.current = !1);
305
- }, [L, t, l, R]);
306
- function G() {
307
- g(), l(!0), j.current = !1;
308
- }
309
- function K() {
310
- a.some((r) => r.transitionStatus === "ending") ? j.current = !0 : (t(), l(!1));
311
- }
312
- function O() {
313
- if (X.current) {
314
- X.current = !1;
315
- return;
316
- }
317
- C || Ee(ne(o.current).activeElement) && (_(!0), g());
318
- }
319
- function J(r) {
320
- !C || re(o.current, r.relatedTarget) || (_(!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: V,
335
- onClick: O
336
- }, m = e.useMemo(() => ({
337
- expanded: Y
338
- }), [Y]), w = oe("div", d, {
339
- ref: [h, o],
340
- state: m,
341
- props: [n, {
342
- style: {
343
- [Tt.frontmostHeight]: I ? `${I}px` : void 0
344
- }
345
- }, y, {
346
- children: /* @__PURE__ */ ae(e.Fragment, {
347
- children: [D > 0 && b && /* @__PURE__ */ E(Te, {
348
- onFocus: q
349
- }), M, D > 0 && b && /* @__PURE__ */ E(Te, {
350
- onFocus: q
351
- })]
352
- })
353
- }]
354
- }), i = e.useMemo(() => ({
355
- viewportRef: o
356
- }), [o]), v = e.useMemo(() => a.filter((r) => r.priority === "high"), [a]);
357
- return /* @__PURE__ */ ae(ze.Provider, {
358
- value: i,
359
- children: [D > 0 && b && /* @__PURE__ */ E(Te, {
360
- onFocus: q
361
- }), w, !C && v.length > 0 && /* @__PURE__ */ E("div", {
362
- style: mt,
363
- children: v.map((r) => /* @__PURE__ */ ae("div", {
364
- role: "alert",
365
- "aria-atomic": !0,
366
- children: [/* @__PURE__ */ E("div", {
367
- children: r.title
368
- }), /* @__PURE__ */ E("div", {
369
- children: r.description
370
- })]
371
- }, r.id))
372
- })]
373
- });
374
- });
375
- process.env.NODE_ENV !== "production" && (Ve.displayName = "ToastViewport");
376
- const Se = /* @__PURE__ */ e.createContext(void 0);
377
- process.env.NODE_ENV !== "production" && (Se.displayName = "ToastRootContext");
378
- function se() {
379
- const f = e.useContext(Se);
380
- if (!f)
381
- throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>." : vt(66));
382
- return f;
383
- }
384
- let ee = /* @__PURE__ */ (function(f) {
385
- return f.index = "--toast-index", f.offsetY = "--toast-offset-y", f.height = "--toast-height", f.swipeMovementX = "--toast-swipe-movement-x", f.swipeMovementY = "--toast-swipe-movement-y", f;
386
- })({});
387
- const Dt = {
388
- ...wt,
389
- swipeDirection(f) {
390
- return f ? {
391
- "data-swipe-direction": f
392
- } : null;
393
- }
394
- }, ie = 40, Et = 10, Q = 0.5, Rt = 1;
395
- function Ie(f, d, h) {
396
- switch (f) {
397
- case "up":
398
- return -h;
399
- case "down":
400
- return h;
401
- case "left":
402
- return -d;
403
- case "right":
404
- return d;
405
- default:
406
- return 0;
407
- }
408
- }
409
- function bt(f) {
410
- const h = window.getComputedStyle(f).transform;
411
- let s = 0, F = 0, M = 1;
412
- if (h && h !== "none") {
413
- const y = h.match(/matrix(?:3d)?\(([^)]+)\)/);
414
- if (y) {
415
- const a = y[1].split(", ").map(parseFloat);
416
- a.length === 6 ? (s = a[4], F = a[5], M = Math.sqrt(a[0] * a[0] + a[1] * a[1])) : a.length === 16 && (s = a[12], F = a[13], M = a[0]);
417
- }
418
- }
419
- return {
420
- x: s,
421
- y: F,
422
- scale: M
423
- };
424
- }
425
- const $e = /* @__PURE__ */ e.forwardRef(function(d, h) {
426
- const {
427
- toast: s,
428
- render: F,
429
- className: M,
430
- swipeDirection: y = ["down", "right"],
431
- ...a
432
- } = d, g = s.positionerProps?.anchor !== void 0;
433
- let t = [];
434
- g || (t = Array.isArray(y) ? y : [y]);
435
- const l = t.length > 0, {
436
- toasts: _,
437
- focused: o,
438
- close: R,
439
- remove: b,
440
- setToasts: N,
441
- pauseTimers: Y,
442
- expanded: C,
443
- setHovering: X
444
- } = be(), [j, D] = e.useState(void 0), [I, L] = e.useState(!1), [q, V] = 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(), [v, 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), ve = e.useMemo(() => _.indexOf(s), [s, _]), _e = e.useMemo(() => _.filter((c) => c.transitionStatus !== "ending").indexOf(s), [s, _]), Ge = e.useMemo(() => _.slice(0, _.indexOf(s)).reduce((c, u) => c + (u.height || 0), 0), [_, s]);
462
- _t({
463
- open: s.transitionStatus !== "ending",
464
- ref: T,
465
- onComplete() {
466
- s.transitionStatus === "ending" && b(s.id);
467
- }
468
- });
469
- const le = U((c = !1) => {
470
- const u = T.current;
471
- if (!u)
472
- return;
473
- const S = u.style.height;
474
- u.style.height = "auto";
475
- const P = u.offsetHeight;
476
- u.style.height = S;
477
- function B() {
478
- N((k) => k.map((z) => z.id === s.id ? {
479
- ...z,
480
- ref: T,
481
- height: P,
482
- transitionStatus: void 0
483
- } : z));
484
- }
485
- c ? ht.flushSync(B) : B();
486
- });
487
- me(le, [le]);
488
- function Ke(c, u) {
489
- let S = c, P = u;
490
- return !t.includes("left") && !t.includes("right") ? S = c > 0 ? c ** Q : -(Math.abs(c) ** Q) : (!t.includes("right") && c > 0 && (S = c ** Q), !t.includes("left") && c < 0 && (S = -(Math.abs(c) ** Q))), !t.includes("up") && !t.includes("down") ? P = u > 0 ? u ** Q : -(Math.abs(u) ** Q) : (!t.includes("down") && u > 0 && (P = u ** Q), !t.includes("up") && u < 0 && (P = -(Math.abs(u) ** Q))), {
491
- x: S,
492
- y: P
493
- };
494
- }
495
- function We(c) {
496
- if (c.button !== 0)
497
- return;
498
- c.pointerType === "touch" && Y();
499
- const u = Re(c.nativeEvent);
500
- if (!(u && u.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: c.clientX,
503
- y: c.clientY
504
- }, $.current = H.current, T.current) {
505
- const P = bt(T.current);
506
- Z.current = P, m(P), J({
507
- x: P.x,
508
- y: P.y
509
- });
510
- }
511
- X(!0), L(!0), V(!1), x(null), ge.current = !0, T.current?.setPointerCapture(c.pointerId);
512
- }
513
- }
514
- function je(c) {
515
- if (!I)
516
- return;
517
- c.preventDefault(), ge.current && (H.current = {
518
- x: c.clientX,
519
- y: c.clientY
520
- }, ge.current = !1);
521
- const {
522
- clientY: u,
523
- clientX: S,
524
- movementX: P,
525
- movementY: B
526
- } = c;
527
- (B < 0 && u > $.current.y || B > 0 && u < $.current.y) && ($.current = {
528
- x: $.current.x,
529
- y: u
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, z = u - H.current.y, tt = u - $.current.y, nt = S - $.current.x;
535
- if (!q && Math.sqrt(k * k + z * z) >= Rt && (V(!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(z);
539
- x(st > ot ? "horizontal" : "vertical");
540
- }
541
- }
542
- let A;
543
- if (!ce.current)
544
- p === "vertical" ? z > 0 ? A = "down" : z < 0 && (A = "up") : p === "horizontal" ? k > 0 ? A = "right" : k < 0 && (A = "left") : Math.abs(k) >= Math.abs(z) ? A = k > 0 ? "right" : "left" : A = z > 0 ? "down" : "up", A && t.includes(A) && (ce.current = A, he.current = Ie(A, k, z), D(A));
545
- else {
546
- const xe = ce.current, de = Ie(xe, nt, tt);
547
- de > ie ? (ue.current = !1, D(xe)) : !(t.includes("left") && t.includes("right")) && !(t.includes("up") && t.includes("down")) && he.current - de >= Et && (ue.current = !0);
548
- }
549
- const fe = Ke(k, z);
550
- let we = Z.current.x, ye = 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")) && (ye += fe.y)), J({
552
- x: we,
553
- y: ye
554
- });
555
- }
556
- function Ue(c) {
557
- if (!I)
558
- return;
559
- if (L(!1), V(!1), x(null), T.current?.releasePointerCapture(c.pointerId), ue.current) {
560
- J({
561
- x: n.x,
562
- y: n.y
563
- }), D(void 0);
564
- return;
565
- }
566
- let u = !1;
567
- const S = O.x - n.x, P = O.y - n.y;
568
- let B;
569
- for (const k of t) {
570
- switch (k) {
571
- case "right":
572
- S > ie && (u = !0, B = "right");
573
- break;
574
- case "left":
575
- S < -ie && (u = !0, B = "left");
576
- break;
577
- case "down":
578
- P > ie && (u = !0, B = "down");
579
- break;
580
- case "up":
581
- P < -ie && (u = !0, B = "up");
582
- break;
583
- }
584
- if (u)
585
- break;
586
- }
587
- u ? (D(B), K(!0), R(s.id)) : (J({
588
- x: n.x,
589
- y: n.y
590
- }), D(void 0));
591
- }
592
- function qe(c) {
593
- if (c.key === "Escape") {
594
- if (!T.current || !re(T.current, pe(ne(T.current))))
595
- return;
596
- R(s.id);
597
- }
598
- }
599
- e.useEffect(() => {
600
- if (!l)
601
- return;
602
- const c = T.current;
603
- if (!c)
604
- return;
605
- function u(S) {
606
- re(c, S.target) && S.preventDefault();
607
- }
608
- return c.addEventListener("touchmove", u, {
609
- passive: !1
610
- }), () => {
611
- c.removeEventListener("touchmove", u);
612
- };
613
- }, [l]);
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 c = O.x - n.x, u = 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]: `${c}px`,
627
- [ee.swipeMovementY]: `${u}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": v,
636
- "aria-hidden": Me && !o ? !0 : void 0,
637
- onPointerDown: l ? We : void 0,
638
- onPointerMove: l ? je : void 0,
639
- onPointerUp: l ? Ue : void 0,
640
- onKeyDown: qe,
641
- inert: gt(s.limited),
642
- style: {
643
- ...Je(),
644
- [ee.index]: s.transitionStatus === "ending" ? ve : _e,
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: v,
654
- setDescriptionId: r,
655
- swiping: I,
656
- swipeDirection: j,
657
- recalculateHeight: le,
658
- index: ve,
659
- visibleIndex: _e,
660
- expanded: C
661
- }), [s, w, v, I, j, le, ve, _e, 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 = oe("div", d, {
669
- ref: [h, te.rootRef],
670
- state: Ze,
671
- stateAttributesMapping: Dt,
672
- props: [Qe, a]
673
- });
674
- return /* @__PURE__ */ E(Se.Provider, {
675
- value: te,
676
- children: et
677
- });
678
- });
679
- process.env.NODE_ENV !== "production" && ($e.displayName = "ToastRoot");
680
- const Be = /* @__PURE__ */ e.forwardRef(function(d, h) {
681
- const {
682
- render: s,
683
- className: F,
684
- ...M
685
- } = d, {
686
- visibleIndex: y,
687
- expanded: a,
688
- recalculateHeight: g
689
- } = se(), t = e.useRef(null);
690
- me(() => {
691
- const R = t.current;
692
- if (!R || (g(), typeof ResizeObserver != "function" || typeof MutationObserver != "function"))
693
- return;
694
- const b = new ResizeObserver(() => g(!0)), N = new MutationObserver(() => g(!0));
695
- return b.observe(R), N.observe(R, {
696
- childList: !0,
697
- subtree: !0,
698
- characterData: !0
699
- }), () => {
700
- b.disconnect(), N.disconnect();
701
- };
702
- }, [g]);
703
- const l = y > 0, _ = e.useMemo(() => ({
704
- expanded: a,
705
- behind: l
706
- }), [a, l]);
707
- return oe("div", d, {
708
- ref: [h, t],
709
- state: _,
710
- props: M
711
- });
712
- });
713
- process.env.NODE_ENV !== "production" && (Be.displayName = "ToastContent");
714
- const Ae = /* @__PURE__ */ e.forwardRef(function(d, h) {
715
- const {
716
- render: s,
717
- className: F,
718
- id: M,
719
- children: y,
720
- ...a
721
- } = d, {
722
- toast: g
723
- } = se(), t = y ?? g.description, l = !!t, _ = He(M), {
724
- setDescriptionId: o
725
- } = se();
726
- me(() => {
727
- if (l)
728
- return o(_), () => {
729
- o(void 0);
730
- };
731
- }, [l, _, o]);
732
- const R = e.useMemo(() => ({
733
- type: g.type
734
- }), [g.type]), b = oe("p", d, {
735
- ref: h,
736
- state: R,
737
- props: {
738
- ...a,
739
- id: _,
740
- children: t
741
- }
742
- });
743
- return l ? b : null;
744
- });
745
- process.env.NODE_ENV !== "production" && (Ae.displayName = "ToastDescription");
746
- const Ye = /* @__PURE__ */ e.forwardRef(function(d, h) {
747
- const {
748
- render: s,
749
- className: F,
750
- id: M,
751
- children: y,
752
- ...a
753
- } = d, {
754
- toast: g
755
- } = se(), t = y ?? g.title, l = !!t, _ = He(M), {
756
- setTitleId: o
757
- } = se();
758
- me(() => {
759
- if (l)
760
- return o(_), () => {
761
- o(void 0);
762
- };
763
- }, [l, _, o]);
764
- const R = e.useMemo(() => ({
765
- type: g.type
766
- }), [g.type]), b = oe("h2", d, {
767
- ref: h,
768
- state: R,
769
- props: {
770
- ...a,
771
- id: _,
772
- children: t
773
- }
774
- });
775
- return l ? b : null;
776
- });
777
- process.env.NODE_ENV !== "production" && (Ye.displayName = "ToastTitle");
778
- const Xe = /* @__PURE__ */ e.forwardRef(function(d, h) {
779
- const {
780
- render: s,
781
- className: F,
782
- disabled: M,
783
- nativeButton: y = !0,
784
- ...a
785
- } = d, {
786
- close: g,
787
- expanded: t
788
- } = be(), {
789
- toast: l
790
- } = se(), [_, o] = e.useState(!1), {
791
- getButtonProps: R,
792
- buttonRef: b
793
- } = yt({
794
- disabled: M,
795
- native: y
796
- }), N = e.useMemo(() => ({
797
- type: l.type
798
- }), [l.type]);
799
- return oe("button", d, {
800
- ref: [h, b],
801
- state: N,
802
- props: [{
803
- "aria-hidden": !t && !_,
804
- onClick() {
805
- g(l.id);
806
- },
807
- onFocus() {
808
- o(!0);
809
- },
810
- onBlur() {
811
- o(!1);
812
- }
813
- }, a, R]
814
- });
815
- });
816
- process.env.NODE_ENV !== "production" && (Xe.displayName = "ToastClose");
817
- const St = pt, Mt = "_toast__viewport_uzvu6_1", Nt = "_toast_uzvu6_1", Pt = "_toast_variant_neutral_uzvu6_111", Ot = "_toast_variant_colorway_uzvu6_117", Ct = "_toast__content_uzvu6_123", Ft = "_toast__header_uzvu6_142", It = "_toast__header_pad_uzvu6_146", Lt = "_toast__title_uzvu6_150", Ht = "_toast__description_uzvu6_154", kt = "_toast__close_uzvu6_158", W = {
818
- toast__viewport: Mt,
819
- toast: Nt,
820
- toast_variant_neutral: Pt,
821
- toast_variant_colorway: Ot,
822
- toast__content: Ct,
823
- toast__header: Ft,
824
- toast__header_pad: It,
825
- toast__title: Lt,
826
- toast__description: Ht,
827
- toast__close: kt
828
- }, ln = ke, Le = {
829
- info: "blue",
830
- error: "red",
831
- warning: "yellow",
832
- success: "green"
833
- };
834
- function fn() {
835
- return /* @__PURE__ */ E(St, { children: /* @__PURE__ */ E(Ve, { className: W.toast__viewport, children: /* @__PURE__ */ E(zt, {}) }) });
836
- }
837
- function zt() {
838
- return dt().toasts.map((d) => {
839
- const h = d.type && d.type in Le ? Le[d.type] : void 0;
840
- return /* @__PURE__ */ E(
841
- $e,
842
- {
843
- toast: d,
844
- className: Ne(
845
- W.toast,
846
- h ? W.toast_variant_colorway : W.toast_variant_neutral
847
- ),
848
- render: /* @__PURE__ */ E(ut, { background: "default", color: h }),
849
- children: /* @__PURE__ */ ae(
850
- Pe,
851
- {
852
- render: /* @__PURE__ */ E(Be, {}),
853
- className: W.toast__content,
854
- children: [
855
- /* @__PURE__ */ ae(
856
- Pe,
857
- {
858
- className: Ne(
859
- W.toast__header,
860
- !d.title && W.toast__header_pad
861
- ),
862
- children: [
863
- /* @__PURE__ */ E(
864
- Ye,
865
- {
866
- render: /* @__PURE__ */ E(
867
- at,
868
- {
869
- level: 2,
870
- size: "lg",
871
- color: "inherit",
872
- className: W.toast__title
873
- }
874
- )
875
- }
876
- ),
877
- /* @__PURE__ */ E(
878
- Ae,
879
- {
880
- render: /* @__PURE__ */ E(lt, { multiline: !0, color: h ? "inherit" : "dimmer" }),
881
- className: W.toast__description
882
- }
883
- )
884
- ]
885
- }
886
- ),
887
- /* @__PURE__ */ E(
888
- Xe,
889
- {
890
- render: /* @__PURE__ */ E(
891
- ct,
892
- {
893
- interactive: h ? `${h}_no-fill` : "no-fill",
894
- icon: "close-line",
895
- size: "sm",
896
- alt: "Close",
897
- className: W.toast__close
898
- }
899
- )
900
- }
901
- ),
902
- d.action ? /* @__PURE__ */ E(
903
- it,
904
- {
905
- ...d.action,
906
- interactive: h ? `${h}_fill` : !0,
907
- children: d.action.children
908
- }
909
- ) : null
910
- ]
911
- }
912
- )
913
- },
914
- d.id
915
- );
916
- });
917
- }
918
- export {
919
- ln as ToastProvider,
920
- fn as ToastViewport
921
- };