@spark-ui/components 17.2.3 → 17.2.4

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 (302) hide show
  1. package/dist/DialogContent.styles-BSxCCi-u.mjs +62 -0
  2. package/dist/DialogContent.styles-BSxCCi-u.mjs.map +1 -0
  3. package/dist/DialogContent.styles-CAhJtUud.js +2 -0
  4. package/dist/DialogContent.styles-CAhJtUud.js.map +1 -0
  5. package/dist/FormFieldRequiredIndicator-CtgkvPZo.js +2 -0
  6. package/dist/FormFieldRequiredIndicator-CtgkvPZo.js.map +1 -0
  7. package/dist/FormFieldRequiredIndicator-DOGQ_HxO.mjs +14 -0
  8. package/dist/FormFieldRequiredIndicator-DOGQ_HxO.mjs.map +1 -0
  9. package/dist/accordion/index.js +2 -2
  10. package/dist/accordion/index.js.map +1 -1
  11. package/dist/accordion/index.mjs +99 -161
  12. package/dist/accordion/index.mjs.map +1 -1
  13. package/dist/alert-dialog/index.js +2 -2
  14. package/dist/alert-dialog/index.js.map +1 -1
  15. package/dist/alert-dialog/index.mjs +169 -235
  16. package/dist/alert-dialog/index.mjs.map +1 -1
  17. package/dist/avatar/index.js +2 -2
  18. package/dist/avatar/index.js.map +1 -1
  19. package/dist/avatar/index.mjs +187 -224
  20. package/dist/avatar/index.mjs.map +1 -1
  21. package/dist/badge/index.js +2 -2
  22. package/dist/badge/index.js.map +1 -1
  23. package/dist/badge/index.mjs +115 -81
  24. package/dist/badge/index.mjs.map +1 -1
  25. package/dist/breadcrumb/index.js +2 -2
  26. package/dist/breadcrumb/index.js.map +1 -1
  27. package/dist/breadcrumb/index.mjs +73 -106
  28. package/dist/breadcrumb/index.mjs.map +1 -1
  29. package/dist/button/index.js +1 -2
  30. package/dist/button/index.mjs +2 -5
  31. package/dist/button-BTDRzvpB.js +2 -0
  32. package/dist/button-BTDRzvpB.js.map +1 -0
  33. package/dist/button-_YZ_4J42.mjs +643 -0
  34. package/dist/button-_YZ_4J42.mjs.map +1 -0
  35. package/dist/card/index.js +2 -2
  36. package/dist/card/index.js.map +1 -1
  37. package/dist/card/index.mjs +327 -394
  38. package/dist/card/index.mjs.map +1 -1
  39. package/dist/carousel/index.js +2 -2
  40. package/dist/carousel/index.js.map +1 -1
  41. package/dist/carousel/index.mjs +515 -618
  42. package/dist/carousel/index.mjs.map +1 -1
  43. package/dist/checkbox/index.js +2 -2
  44. package/dist/checkbox/index.js.map +1 -1
  45. package/dist/checkbox/index.mjs +213 -246
  46. package/dist/checkbox/index.mjs.map +1 -1
  47. package/dist/chip/index.js +2 -2
  48. package/dist/chip/index.js.map +1 -1
  49. package/dist/chip/index.mjs +601 -652
  50. package/dist/chip/index.mjs.map +1 -1
  51. package/dist/chunk-C91j1N6u.js +1 -0
  52. package/dist/circular-meter/index.js +2 -2
  53. package/dist/circular-meter/index.js.map +1 -1
  54. package/dist/circular-meter/index.mjs +354 -309
  55. package/dist/circular-meter/index.mjs.map +1 -1
  56. package/dist/collapsible/index.js +2 -2
  57. package/dist/collapsible/index.js.map +1 -1
  58. package/dist/collapsible/index.mjs +53 -53
  59. package/dist/collapsible/index.mjs.map +1 -1
  60. package/dist/combobox/index.js +2 -2
  61. package/dist/combobox/index.js.map +1 -1
  62. package/dist/combobox/index.mjs +721 -876
  63. package/dist/combobox/index.mjs.map +1 -1
  64. package/dist/dialog/index.js +2 -2
  65. package/dist/dialog/index.js.map +1 -1
  66. package/dist/dialog/index.mjs +181 -206
  67. package/dist/dialog/index.mjs.map +1 -1
  68. package/dist/divider/index.js +2 -2
  69. package/dist/divider/index.js.map +1 -1
  70. package/dist/divider/index.mjs +178 -183
  71. package/dist/divider/index.mjs.map +1 -1
  72. package/dist/drawer/index.js +2 -2
  73. package/dist/drawer/index.js.map +1 -1
  74. package/dist/drawer/index.mjs +277 -309
  75. package/dist/drawer/index.mjs.map +1 -1
  76. package/dist/dropdown/index.js +2 -2
  77. package/dist/dropdown/index.js.map +1 -1
  78. package/dist/dropdown/index.mjs +429 -492
  79. package/dist/dropdown/index.mjs.map +1 -1
  80. package/dist/file-upload/index.js +2 -2
  81. package/dist/file-upload/index.js.map +1 -1
  82. package/dist/file-upload/index.mjs +540 -677
  83. package/dist/file-upload/index.mjs.map +1 -1
  84. package/dist/form-field/index.js +1 -2
  85. package/dist/form-field/index.mjs +2 -284
  86. package/dist/form-field-B8QzM655.mjs +231 -0
  87. package/dist/form-field-B8QzM655.mjs.map +1 -0
  88. package/dist/form-field-Bu_0E9tb.js +2 -0
  89. package/dist/form-field-Bu_0E9tb.js.map +1 -0
  90. package/dist/icon/index.js +1 -2
  91. package/dist/icon/index.mjs +2 -5
  92. package/dist/icon-CRPcdgYp.js +2 -0
  93. package/dist/icon-CRPcdgYp.js.map +1 -0
  94. package/dist/icon-D05Uqh8_.mjs +41 -0
  95. package/dist/icon-D05Uqh8_.mjs.map +1 -0
  96. package/dist/icon-button/index.js +1 -2
  97. package/dist/icon-button/index.mjs +2 -5
  98. package/dist/icon-button-6p3O7NIm.mjs +28 -0
  99. package/dist/icon-button-6p3O7NIm.mjs.map +1 -0
  100. package/dist/icon-button-CykysbgJ.js +2 -0
  101. package/dist/icon-button-CykysbgJ.js.map +1 -0
  102. package/dist/input/index.js +1 -2
  103. package/dist/input/index.mjs +2 -455
  104. package/dist/input-CmYeHYWQ.mjs +355 -0
  105. package/dist/input-CmYeHYWQ.mjs.map +1 -0
  106. package/dist/input-DNr40G2Z.js +2 -0
  107. package/dist/input-DNr40G2Z.js.map +1 -0
  108. package/dist/input-otp/index.js +2 -2
  109. package/dist/input-otp/index.js.map +1 -1
  110. package/dist/input-otp/index.mjs +344 -407
  111. package/dist/input-otp/index.mjs.map +1 -1
  112. package/dist/kbd/index.js +2 -2
  113. package/dist/kbd/index.js.map +1 -1
  114. package/dist/kbd/index.mjs +12 -17
  115. package/dist/kbd/index.mjs.map +1 -1
  116. package/dist/label/index.js +1 -2
  117. package/dist/label/index.mjs +2 -40
  118. package/dist/label-BqRlrca0.mjs +31 -0
  119. package/dist/label-BqRlrca0.mjs.map +1 -0
  120. package/dist/label-DU0p0d-f.js +2 -0
  121. package/dist/label-DU0p0d-f.js.map +1 -0
  122. package/dist/link-box/index.js +2 -2
  123. package/dist/link-box/index.js.map +1 -1
  124. package/dist/link-box/index.mjs +36 -34
  125. package/dist/link-box/index.mjs.map +1 -1
  126. package/dist/meter/index.js +2 -2
  127. package/dist/meter/index.js.map +1 -1
  128. package/dist/meter/index.mjs +149 -171
  129. package/dist/meter/index.mjs.map +1 -1
  130. package/dist/pagination/index.js +2 -2
  131. package/dist/pagination/index.js.map +1 -1
  132. package/dist/pagination/index.mjs +253 -214
  133. package/dist/pagination/index.mjs.map +1 -1
  134. package/dist/popover/index.js +1 -2
  135. package/dist/popover/index.mjs +2 -239
  136. package/dist/popover-CxZAQmw6.mjs +211 -0
  137. package/dist/popover-CxZAQmw6.mjs.map +1 -0
  138. package/dist/popover-GOovJ27J.js +2 -0
  139. package/dist/popover-GOovJ27J.js.map +1 -0
  140. package/dist/portal/index.js +2 -2
  141. package/dist/portal/index.js.map +1 -1
  142. package/dist/portal/index.mjs +8 -7
  143. package/dist/portal/index.mjs.map +1 -1
  144. package/dist/progress/index.js +1 -2
  145. package/dist/progress/index.mjs +2 -178
  146. package/dist/progress-cEf3tFbn.mjs +132 -0
  147. package/dist/progress-cEf3tFbn.mjs.map +1 -0
  148. package/dist/progress-rJZcPJsZ.js +2 -0
  149. package/dist/progress-rJZcPJsZ.js.map +1 -0
  150. package/dist/progress-tracker/index.js +2 -2
  151. package/dist/progress-tracker/index.js.map +1 -1
  152. package/dist/progress-tracker/index.mjs +303 -380
  153. package/dist/progress-tracker/index.mjs.map +1 -1
  154. package/dist/radio-group/index.js +2 -2
  155. package/dist/radio-group/index.js.map +1 -1
  156. package/dist/radio-group/index.mjs +204 -213
  157. package/dist/radio-group/index.mjs.map +1 -1
  158. package/dist/rating/index.js +2 -2
  159. package/dist/rating/index.js.map +1 -1
  160. package/dist/rating/index.mjs +189 -244
  161. package/dist/rating/index.mjs.map +1 -1
  162. package/dist/rating-display/index.js +2 -2
  163. package/dist/rating-display/index.js.map +1 -1
  164. package/dist/rating-display/index.mjs +165 -166
  165. package/dist/rating-display/index.mjs.map +1 -1
  166. package/dist/scrolling-list/index.js +2 -2
  167. package/dist/scrolling-list/index.js.map +1 -1
  168. package/dist/scrolling-list/index.mjs +216 -273
  169. package/dist/scrolling-list/index.mjs.map +1 -1
  170. package/dist/segmented-control/index.js +2 -2
  171. package/dist/segmented-control/index.js.map +1 -1
  172. package/dist/segmented-control/index.mjs +146 -180
  173. package/dist/segmented-control/index.mjs.map +1 -1
  174. package/dist/segmented-gauge/index.js +2 -2
  175. package/dist/segmented-gauge/index.js.map +1 -1
  176. package/dist/segmented-gauge/index.mjs +146 -195
  177. package/dist/segmented-gauge/index.mjs.map +1 -1
  178. package/dist/select/index.js +2 -2
  179. package/dist/select/index.js.map +1 -1
  180. package/dist/select/index.mjs +279 -327
  181. package/dist/select/index.mjs.map +1 -1
  182. package/dist/skeleton/index.js +2 -2
  183. package/dist/skeleton/index.js.map +1 -1
  184. package/dist/skeleton/index.mjs +92 -114
  185. package/dist/skeleton/index.mjs.map +1 -1
  186. package/dist/slider/index.js +2 -2
  187. package/dist/slider/index.js.map +1 -1
  188. package/dist/slider/index.mjs +259 -326
  189. package/dist/slider/index.mjs.map +1 -1
  190. package/dist/slot/index.js +2 -2
  191. package/dist/slot/index.js.map +1 -1
  192. package/dist/slot/index.mjs +12 -7
  193. package/dist/slot/index.mjs.map +1 -1
  194. package/dist/snackbar/index.js +2 -2
  195. package/dist/snackbar/index.js.map +1 -1
  196. package/dist/snackbar/index.mjs +404 -529
  197. package/dist/snackbar/index.mjs.map +1 -1
  198. package/dist/spinner/index.js +1 -2
  199. package/dist/spinner/index.mjs +2 -5
  200. package/dist/spinner-DFUoYvmm.js +2 -0
  201. package/dist/spinner-DFUoYvmm.js.map +1 -0
  202. package/dist/spinner-DULLiM6a.mjs +56 -0
  203. package/dist/spinner-DULLiM6a.mjs.map +1 -0
  204. package/dist/src/avatar/index.d.mts +2 -2
  205. package/dist/src/avatar/index.d.ts +2 -2
  206. package/dist/src/file-upload/index.d.mts +1 -1
  207. package/dist/src/file-upload/index.d.ts +1 -1
  208. package/dist/stepper/index.js +2 -2
  209. package/dist/stepper/index.js.map +1 -1
  210. package/dist/stepper/index.mjs +139 -176
  211. package/dist/stepper/index.mjs.map +1 -1
  212. package/dist/switch/index.js +2 -2
  213. package/dist/switch/index.js.map +1 -1
  214. package/dist/switch/index.mjs +194 -197
  215. package/dist/switch/index.mjs.map +1 -1
  216. package/dist/tabs/index.js +2 -2
  217. package/dist/tabs/index.js.map +1 -1
  218. package/dist/tabs/index.mjs +337 -389
  219. package/dist/tabs/index.mjs.map +1 -1
  220. package/dist/tag/index.js +2 -2
  221. package/dist/tag/index.js.map +1 -1
  222. package/dist/tag/index.mjs +192 -211
  223. package/dist/tag/index.mjs.map +1 -1
  224. package/dist/text-link/index.js +2 -2
  225. package/dist/text-link/index.js.map +1 -1
  226. package/dist/text-link/index.mjs +44 -5
  227. package/dist/text-link/index.mjs.map +1 -1
  228. package/dist/textarea/index.js +2 -2
  229. package/dist/textarea/index.js.map +1 -1
  230. package/dist/textarea/index.mjs +51 -50
  231. package/dist/textarea/index.mjs.map +1 -1
  232. package/dist/toast/index.js +2 -2
  233. package/dist/toast/index.js.map +1 -1
  234. package/dist/toast/index.mjs +314 -367
  235. package/dist/toast/index.mjs.map +1 -1
  236. package/dist/useRenderSlot-DP4fYerF.mjs +11 -0
  237. package/dist/useRenderSlot-DP4fYerF.mjs.map +1 -0
  238. package/dist/useRenderSlot-Xxf_s88b.js +2 -0
  239. package/dist/useRenderSlot-Xxf_s88b.js.map +1 -0
  240. package/dist/visually-hidden/index.js +2 -2
  241. package/dist/visually-hidden/index.js.map +1 -1
  242. package/dist/visually-hidden/index.mjs +25 -5
  243. package/dist/visually-hidden/index.mjs.map +1 -1
  244. package/package.json +4 -4
  245. package/dist/Button-1M9DcZl0.mjs +0 -704
  246. package/dist/Button-1M9DcZl0.mjs.map +0 -1
  247. package/dist/Button-FZceRWG2.js +0 -2
  248. package/dist/Button-FZceRWG2.js.map +0 -1
  249. package/dist/DialogContent.styles-CziMQtYr.js +0 -2
  250. package/dist/DialogContent.styles-CziMQtYr.js.map +0 -1
  251. package/dist/DialogContent.styles-Du7_Dkde.mjs +0 -60
  252. package/dist/DialogContent.styles-Du7_Dkde.mjs.map +0 -1
  253. package/dist/FormFieldRequiredIndicator-CHfcoT2y.js +0 -2
  254. package/dist/FormFieldRequiredIndicator-CHfcoT2y.js.map +0 -1
  255. package/dist/FormFieldRequiredIndicator-DTnCGiX2.mjs +0 -13
  256. package/dist/FormFieldRequiredIndicator-DTnCGiX2.mjs.map +0 -1
  257. package/dist/Icon-BO327oHU.mjs +0 -57
  258. package/dist/Icon-BO327oHU.mjs.map +0 -1
  259. package/dist/Icon-C-cNTnzd.js +0 -2
  260. package/dist/Icon-C-cNTnzd.js.map +0 -1
  261. package/dist/IconButton-BR1bJSQA.js +0 -2
  262. package/dist/IconButton-BR1bJSQA.js.map +0 -1
  263. package/dist/IconButton-DdB3Pq13.mjs +0 -43
  264. package/dist/IconButton-DdB3Pq13.mjs.map +0 -1
  265. package/dist/Slot-DLY1rJrG.mjs +0 -14
  266. package/dist/Slot-DLY1rJrG.mjs.map +0 -1
  267. package/dist/Slot-DQ8z2zsy.js +0 -2
  268. package/dist/Slot-DQ8z2zsy.js.map +0 -1
  269. package/dist/Spinner-Br4Rp9V2.js +0 -2
  270. package/dist/Spinner-Br4Rp9V2.js.map +0 -1
  271. package/dist/Spinner-Co3AjkQV.mjs +0 -68
  272. package/dist/Spinner-Co3AjkQV.mjs.map +0 -1
  273. package/dist/TextLink-5MvP0P8D.js +0 -2
  274. package/dist/TextLink-5MvP0P8D.js.map +0 -1
  275. package/dist/TextLink-Cc_LeVcx.mjs +0 -57
  276. package/dist/TextLink-Cc_LeVcx.mjs.map +0 -1
  277. package/dist/VisuallyHidden-CB6Nx76j.js +0 -2
  278. package/dist/VisuallyHidden-CB6Nx76j.js.map +0 -1
  279. package/dist/VisuallyHidden-DjlV0-CW.mjs +0 -28
  280. package/dist/VisuallyHidden-DjlV0-CW.mjs.map +0 -1
  281. package/dist/button/index.js.map +0 -1
  282. package/dist/button/index.mjs.map +0 -1
  283. package/dist/form-field/index.js.map +0 -1
  284. package/dist/form-field/index.mjs.map +0 -1
  285. package/dist/icon/index.js.map +0 -1
  286. package/dist/icon/index.mjs.map +0 -1
  287. package/dist/icon-button/index.js.map +0 -1
  288. package/dist/icon-button/index.mjs.map +0 -1
  289. package/dist/input/index.js.map +0 -1
  290. package/dist/input/index.mjs.map +0 -1
  291. package/dist/label/index.js.map +0 -1
  292. package/dist/label/index.mjs.map +0 -1
  293. package/dist/popover/index.js.map +0 -1
  294. package/dist/popover/index.mjs.map +0 -1
  295. package/dist/progress/index.js.map +0 -1
  296. package/dist/progress/index.mjs.map +0 -1
  297. package/dist/spinner/index.js.map +0 -1
  298. package/dist/spinner/index.mjs.map +0 -1
  299. package/dist/useRenderSlot-Bta2kdp4.mjs +0 -10
  300. package/dist/useRenderSlot-Bta2kdp4.mjs.map +0 -1
  301. package/dist/useRenderSlot-DATwjgpo.js +0 -2
  302. package/dist/useRenderSlot-DATwjgpo.js.map +0 -1
@@ -1,534 +1,409 @@
1
- import { jsx as g, jsxs as et } from "react/jsx-runtime";
2
- import { useToastQueue as nt, ToastQueue as it } from "@react-stately/toast";
3
- import { createContext as at, useContext as ot, useState as st, useRef as w, useEffect as z, useCallback as S, Children as rt, isValidElement as ct, cloneElement as D, useSyncExternalStore as lt } from "react";
4
- import { createPortal as dt } from "react-dom";
5
- import { useToast as mt, useToastRegion as ut } from "@react-aria/toast";
6
- import { cva as B, cx as V } from "class-variance-authority";
7
- import { B as pt } from "../Button-1M9DcZl0.mjs";
8
- import { Close as gt } from "@spark-ui/icons/Close";
9
- import { I as F } from "../Icon-BO327oHU.mjs";
10
- import { I as ft } from "../IconButton-DdB3Pq13.mjs";
11
- const bt = [
12
- {
13
- design: "filled",
14
- intent: "success",
15
- class: ["bg-success text-on-success"]
16
- },
17
- {
18
- design: "filled",
19
- intent: "alert",
20
- class: ["bg-alert text-on-alert"]
21
- },
22
- {
23
- design: "filled",
24
- intent: "error",
25
- class: ["bg-error text-on-error"]
26
- },
27
- {
28
- design: "filled",
29
- intent: "info",
30
- class: ["bg-info text-on-info"]
31
- },
32
- {
33
- design: "filled",
34
- intent: "neutral",
35
- class: ["bg-neutral text-on-neutral"]
36
- },
37
- {
38
- design: "filled",
39
- intent: "main",
40
- class: ["bg-main text-on-main"]
41
- },
42
- {
43
- design: "filled",
44
- intent: "support",
45
- class: ["bg-support text-on-support"]
46
- },
47
- {
48
- design: "filled",
49
- intent: "accent",
50
- class: ["bg-accent text-on-accent"]
51
- },
52
- {
53
- design: "filled",
54
- intent: "inverse",
55
- class: ["bg-surface-inverse text-on-surface-inverse"]
56
- }
57
- ], xt = [
58
- {
59
- design: "tinted",
60
- intent: "success",
61
- class: ["bg-success-container text-on-success-container"]
62
- },
63
- {
64
- design: "tinted",
65
- intent: "alert",
66
- class: ["bg-alert-container text-on-alert-container"]
67
- },
68
- {
69
- design: "tinted",
70
- intent: "error",
71
- class: ["bg-error-container text-on-error-container"]
72
- },
73
- {
74
- design: "tinted",
75
- intent: "info",
76
- class: ["bg-info-container text-on-info-container"]
77
- },
78
- {
79
- design: "tinted",
80
- intent: "neutral",
81
- class: ["bg-neutral-container text-on-neutral-container"]
82
- },
83
- {
84
- design: "tinted",
85
- intent: "main",
86
- class: ["bg-main-container text-on-main-container"]
87
- },
88
- {
89
- design: "tinted",
90
- intent: "support",
91
- class: ["bg-support-container text-on-support-container"]
92
- },
93
- {
94
- design: "tinted",
95
- intent: "accent",
96
- class: ["bg-accent-container text-on-accent-container"]
97
- },
98
- {
99
- design: "tinted",
100
- intent: "inverse",
101
- class: ["bg-surface-inverse text-on-surface-inverse"]
102
- }
103
- ], yt = B(
104
- [
105
- "rounded-md shadow-sm",
106
- "max-w-[600px]",
107
- "cursor-default pointer-events-auto touch-none select-none",
108
- "absolute",
109
- /**
110
- * Focus
111
- */
112
- "group-focus-visible:outline-hidden group-focus-visible:u-outline group-not-focus-visible:ring-inset",
113
- /**
114
- * Positionning
115
- */
116
- "group-data-[position=bottom]:bottom-0 group-data-[position=bottom-left]:bottom-0 group-data-[position=bottom-right]:bottom-0",
117
- "group-data-[position=top]:top-0 group-data-[position=top-left]:top-0 group-data-[position=top-right]:top-0",
118
- /**
119
- * Animation and opacity
120
- */
121
- "animation-duration-400",
122
- "[animation-fill-mode: forwards]!",
123
- "data-[animation=queued]:animate-fade-in",
124
- "data-[animation=entering]:animation-ease-decelerate-back",
125
- "data-[animation=exiting]:animation-ease-accelerate",
126
- // Parent position bottom|bottom-left|bottom-right
127
- "data-[animation=entering]:group-data-[position=bottom]:[&:not([data-swipe])]:animate-slide-in-bottom",
128
- "data-[animation=exiting]:opacity-0 data-[animation=exiting]:transition-opacity",
129
- "data-[animation=exiting]:group-data-[position=bottom]:[&:not([data-swipe])]:animate-slide-out-bottom",
130
- "data-[animation=entering]:group-data-[position=bottom-left]:[&:not([data-swipe])]:animate-slide-in-bottom",
131
- "data-[animation=exiting]:group-data-[position=bottom-left]:[&:not([data-swipe])]:animate-slide-out-bottom",
132
- "data-[animation=entering]:group-data-[position=bottom-right]:[&:not([data-swipe])]:animate-slide-in-bottom",
133
- "data-[animation=exiting]:group-data-[position=bottom-right]:[&:not([data-swipe])]:animate-slide-out-bottom",
134
- // Parent position top|top-left|top-right
135
- "data-[animation=entering]:group-data-[position=top]:[&:not([data-swipe])]:animate-slide-in-top",
136
- "data-[animation=exiting]:group-data-[position=top]:[&:not([data-swipe])]:animate-slide-out-top",
137
- "data-[animation=entering]:group-data-[position=top-left]:[&:not([data-swipe])]:animate-slide-in-top",
138
- "data-[animation=exiting]:group-data-[position=top-left]:[&:not([data-swipe])]:animate-slide-out-top",
139
- "data-[animation=entering]:group-data-[position=top-right]:[&:not([data-swipe])]:animate-slide-in-top",
140
- "data-[animation=exiting]:group-data-[position=top-right]:[&:not([data-swipe])]:animate-slide-out-top",
141
- /**
142
- * Swipe
143
- */
144
- "data-[swipe=move]:data-[swipe-direction=right]:translate-x-(--swipe-position-x)",
145
- "data-[swipe=move]:data-[swipe-direction=left]:translate-x-(--swipe-position-x)",
146
- "data-[swipe=cancel]:translate-x-0",
147
- "data-[swipe=end]:data-[swipe-direction=right]:animate-standalone-swipe-out-right",
148
- "data-[swipe=end]:data-[swipe-direction=left]:animate-standalone-swipe-out-left"
149
- ],
150
- {
151
- variants: {
152
- /**
153
- * Set different look and feel
154
- * @default 'filled'
155
- */
156
- design: {
157
- filled: "",
158
- tinted: ""
159
- },
160
- /**
161
- * Set color intent
162
- * @default 'neutral'
163
- */
164
- intent: {
165
- success: "",
166
- alert: "",
167
- error: "",
168
- info: "",
169
- neutral: "",
170
- main: "",
171
- support: "",
172
- accent: "",
173
- inverse: ""
174
- }
175
- },
176
- compoundVariants: [...bt, ...xt],
177
- defaultVariants: {
178
- design: "filled",
179
- intent: "neutral"
180
- }
181
- }
182
- ), wt = B(
183
- [
184
- "inline-grid items-center",
185
- "col-start-1 row-start-1",
186
- "pl-md pr-lg"
187
- // applying padding on the parent prevents VoiceOver on Safari from reading snackbar content 🤷
188
- ],
189
- {
190
- variants: {
191
- /**
192
- * Force action button displaying on a new line
193
- * @default false
194
- */
195
- actionOnNewline: {
196
- true: [
197
- "grid-rows-[52px_1fr_52px]",
198
- "grid-cols-[min-content_1fr_min-content]",
199
- "[grid-template-areas:'icon_message_close'_'._message_.'_'action_action_action']"
200
- ],
201
- false: [
202
- "grid-cols-[min-content_1fr_min-content_min-content]",
203
- "[grid-template-areas:'icon_message_action_close']"
204
- ]
205
- }
206
- },
207
- defaultVariants: {
208
- actionOnNewline: !1
209
- }
210
- }
211
- ), Q = at({}), O = () => ot(Q), h = ({
212
- design: t = "filled",
213
- intent: e = "neutral",
214
- onClick: n,
215
- children: r,
216
- className: c,
217
- ref: d,
218
- ...m
219
- }) => {
220
- const { toast: i, state: o } = O(), a = e ?? i.content.intent, f = t ?? i.content.design;
221
- return /* @__PURE__ */ g(
222
- pt,
223
- {
224
- "data-spark-component": "snackbar-item-action",
225
- ref: d,
226
- size: "md",
227
- shape: "rounded",
228
- ...a === "inverse" ? {
229
- design: "ghost",
230
- intent: "surface"
231
- } : {
232
- design: f,
233
- intent: a === "error" ? "danger" : a
234
- },
235
- onClick: (x) => {
236
- n?.(x), o.close(i.key);
237
- },
238
- style: { gridArea: "action", ...m.style },
239
- className: V("ml-md justify-self-end", c),
240
- ...m,
241
- children: r
242
- }
243
- );
1
+ import { t as e } from "../icon-D05Uqh8_.mjs";
2
+ import { t } from "../button-_YZ_4J42.mjs";
3
+ import { t as n } from "../icon-button-6p3O7NIm.mjs";
4
+ import { cva as r, cx as i } from "class-variance-authority";
5
+ import { Children as a, cloneElement as o, createContext as s, isValidElement as c, useCallback as l, useContext as u, useEffect as d, useRef as f, useState as p, useSyncExternalStore as m } from "react";
6
+ import { jsx as h, jsxs as g } from "react/jsx-runtime";
7
+ import { Close as _ } from "@spark-ui/icons/Close";
8
+ import { ToastQueue as v, useToastQueue as y } from "@react-stately/toast";
9
+ import { createPortal as b } from "react-dom";
10
+ import { useToast as x, useToastRegion as S } from "@react-aria/toast";
11
+ //#region src/snackbar/snackbarVariants.ts
12
+ var C = [
13
+ {
14
+ design: "filled",
15
+ intent: "success",
16
+ class: ["bg-success text-on-success"]
17
+ },
18
+ {
19
+ design: "filled",
20
+ intent: "alert",
21
+ class: ["bg-alert text-on-alert"]
22
+ },
23
+ {
24
+ design: "filled",
25
+ intent: "error",
26
+ class: ["bg-error text-on-error"]
27
+ },
28
+ {
29
+ design: "filled",
30
+ intent: "info",
31
+ class: ["bg-info text-on-info"]
32
+ },
33
+ {
34
+ design: "filled",
35
+ intent: "neutral",
36
+ class: ["bg-neutral text-on-neutral"]
37
+ },
38
+ {
39
+ design: "filled",
40
+ intent: "main",
41
+ class: ["bg-main text-on-main"]
42
+ },
43
+ {
44
+ design: "filled",
45
+ intent: "support",
46
+ class: ["bg-support text-on-support"]
47
+ },
48
+ {
49
+ design: "filled",
50
+ intent: "accent",
51
+ class: ["bg-accent text-on-accent"]
52
+ },
53
+ {
54
+ design: "filled",
55
+ intent: "inverse",
56
+ class: ["bg-surface-inverse text-on-surface-inverse"]
57
+ }
58
+ ], w = [
59
+ {
60
+ design: "tinted",
61
+ intent: "success",
62
+ class: ["bg-success-container text-on-success-container"]
63
+ },
64
+ {
65
+ design: "tinted",
66
+ intent: "alert",
67
+ class: ["bg-alert-container text-on-alert-container"]
68
+ },
69
+ {
70
+ design: "tinted",
71
+ intent: "error",
72
+ class: ["bg-error-container text-on-error-container"]
73
+ },
74
+ {
75
+ design: "tinted",
76
+ intent: "info",
77
+ class: ["bg-info-container text-on-info-container"]
78
+ },
79
+ {
80
+ design: "tinted",
81
+ intent: "neutral",
82
+ class: ["bg-neutral-container text-on-neutral-container"]
83
+ },
84
+ {
85
+ design: "tinted",
86
+ intent: "main",
87
+ class: ["bg-main-container text-on-main-container"]
88
+ },
89
+ {
90
+ design: "tinted",
91
+ intent: "support",
92
+ class: ["bg-support-container text-on-support-container"]
93
+ },
94
+ {
95
+ design: "tinted",
96
+ intent: "accent",
97
+ class: ["bg-accent-container text-on-accent-container"]
98
+ },
99
+ {
100
+ design: "tinted",
101
+ intent: "inverse",
102
+ class: ["bg-surface-inverse text-on-surface-inverse"]
103
+ }
104
+ ], T = r(/* @__PURE__ */ "rounded-md shadow-sm.max-w-[600px].cursor-default pointer-events-auto touch-none select-none.absolute.group-focus-visible:outline-hidden group-focus-visible:u-outline group-not-focus-visible:ring-inset.group-data-[position=bottom]:bottom-0 group-data-[position=bottom-left]:bottom-0 group-data-[position=bottom-right]:bottom-0.group-data-[position=top]:top-0 group-data-[position=top-left]:top-0 group-data-[position=top-right]:top-0.animation-duration-400.[animation-fill-mode: forwards]!.data-[animation=queued]:animate-fade-in.data-[animation=entering]:animation-ease-decelerate-back.data-[animation=exiting]:animation-ease-accelerate.data-[animation=entering]:group-data-[position=bottom]:[&:not([data-swipe])]:animate-slide-in-bottom.data-[animation=exiting]:opacity-0 data-[animation=exiting]:transition-opacity.data-[animation=exiting]:group-data-[position=bottom]:[&:not([data-swipe])]:animate-slide-out-bottom.data-[animation=entering]:group-data-[position=bottom-left]:[&:not([data-swipe])]:animate-slide-in-bottom.data-[animation=exiting]:group-data-[position=bottom-left]:[&:not([data-swipe])]:animate-slide-out-bottom.data-[animation=entering]:group-data-[position=bottom-right]:[&:not([data-swipe])]:animate-slide-in-bottom.data-[animation=exiting]:group-data-[position=bottom-right]:[&:not([data-swipe])]:animate-slide-out-bottom.data-[animation=entering]:group-data-[position=top]:[&:not([data-swipe])]:animate-slide-in-top.data-[animation=exiting]:group-data-[position=top]:[&:not([data-swipe])]:animate-slide-out-top.data-[animation=entering]:group-data-[position=top-left]:[&:not([data-swipe])]:animate-slide-in-top.data-[animation=exiting]:group-data-[position=top-left]:[&:not([data-swipe])]:animate-slide-out-top.data-[animation=entering]:group-data-[position=top-right]:[&:not([data-swipe])]:animate-slide-in-top.data-[animation=exiting]:group-data-[position=top-right]:[&:not([data-swipe])]:animate-slide-out-top.data-[swipe=move]:data-[swipe-direction=right]:translate-x-(--swipe-position-x).data-[swipe=move]:data-[swipe-direction=left]:translate-x-(--swipe-position-x).data-[swipe=cancel]:translate-x-0.data-[swipe=end]:data-[swipe-direction=right]:animate-standalone-swipe-out-right.data-[swipe=end]:data-[swipe-direction=left]:animate-standalone-swipe-out-left".split("."), {
105
+ variants: {
106
+ design: {
107
+ filled: "",
108
+ tinted: ""
109
+ },
110
+ intent: {
111
+ success: "",
112
+ alert: "",
113
+ error: "",
114
+ info: "",
115
+ neutral: "",
116
+ main: "",
117
+ support: "",
118
+ accent: "",
119
+ inverse: ""
120
+ }
121
+ },
122
+ compoundVariants: [...C, ...w],
123
+ defaultVariants: {
124
+ design: "filled",
125
+ intent: "neutral"
126
+ }
127
+ }), E = r([
128
+ "inline-grid items-center",
129
+ "col-start-1 row-start-1",
130
+ "pl-md pr-lg"
131
+ ], {
132
+ variants: { actionOnNewline: {
133
+ true: [
134
+ "grid-rows-[52px_1fr_52px]",
135
+ "grid-cols-[min-content_1fr_min-content]",
136
+ "[grid-template-areas:'icon_message_close'_'._message_.'_'action_action_action']"
137
+ ],
138
+ false: ["grid-cols-[min-content_1fr_min-content_min-content]", "[grid-template-areas:'icon_message_action_close']"]
139
+ } },
140
+ defaultVariants: { actionOnNewline: !1 }
141
+ }), D = s({}), O = () => u(D), k = ({ design: e = "filled", intent: n = "neutral", onClick: r, children: a, className: o, ref: s, ...c }) => {
142
+ let { toast: l, state: u } = O(), d = n ?? l.content.intent, f = e ?? l.content.design;
143
+ return /* @__PURE__ */ h(t, {
144
+ "data-spark-component": "snackbar-item-action",
145
+ ref: s,
146
+ size: "md",
147
+ shape: "rounded",
148
+ ...d === "inverse" ? {
149
+ design: "ghost",
150
+ intent: "surface"
151
+ } : {
152
+ design: f,
153
+ intent: d === "error" ? "danger" : d
154
+ },
155
+ onClick: (e) => {
156
+ r?.(e), u.close(l.key);
157
+ },
158
+ style: {
159
+ gridArea: "action",
160
+ ...c.style
161
+ },
162
+ className: i("ml-md justify-self-end", o),
163
+ ...c,
164
+ children: a
165
+ });
244
166
  };
245
- h.displayName = "Snackbar.ItemAction";
246
- const I = ({
247
- design: t = "filled",
248
- intent: e = "neutral",
249
- "aria-label": n,
250
- onClick: r,
251
- className: c,
252
- ref: d,
253
- ...m
254
- }) => {
255
- const { toast: i, state: o } = O(), a = e ?? i.content.intent, f = t ?? i.content.design;
256
- return /* @__PURE__ */ g(
257
- ft,
258
- {
259
- "data-spark-component": "snackbar-item-close",
260
- ref: d,
261
- size: "md",
262
- shape: "rounded",
263
- ...a === "inverse" ? {
264
- design: "ghost",
265
- intent: "surface"
266
- } : {
267
- design: f,
268
- intent: a === "error" ? "danger" : a
269
- },
270
- "aria-label": n,
271
- onClick: (x) => {
272
- r?.(x), o.close(i.key);
273
- },
274
- style: { gridArea: "close", ...m.style },
275
- className: V("ml-md justify-self-end", c),
276
- ...m,
277
- children: /* @__PURE__ */ g(F, { size: "sm", children: /* @__PURE__ */ g(gt, {}) })
278
- }
279
- );
167
+ k.displayName = "Snackbar.ItemAction";
168
+ //#endregion
169
+ //#region src/snackbar/SnackbarItemClose.tsx
170
+ var A = ({ design: t = "filled", intent: r = "neutral", "aria-label": a, onClick: o, className: s, ref: c, ...l }) => {
171
+ let { toast: u, state: d } = O(), f = r ?? u.content.intent, p = t ?? u.content.design;
172
+ return /* @__PURE__ */ h(n, {
173
+ "data-spark-component": "snackbar-item-close",
174
+ ref: c,
175
+ size: "md",
176
+ shape: "rounded",
177
+ ...f === "inverse" ? {
178
+ design: "ghost",
179
+ intent: "surface"
180
+ } : {
181
+ design: p,
182
+ intent: f === "error" ? "danger" : f
183
+ },
184
+ "aria-label": a,
185
+ onClick: (e) => {
186
+ o?.(e), d.close(u.key);
187
+ },
188
+ style: {
189
+ gridArea: "close",
190
+ ...l.style
191
+ },
192
+ className: i("ml-md justify-self-end", s),
193
+ ...l,
194
+ children: /* @__PURE__ */ h(e, {
195
+ size: "sm",
196
+ children: /* @__PURE__ */ h(_, {})
197
+ })
198
+ });
280
199
  };
281
- I.displayName = "Snackbar.ItemClose";
282
- const N = ({
283
- children: t,
284
- className: e,
285
- ...n
286
- }) => /* @__PURE__ */ g(
287
- F,
288
- {
289
- size: "md",
290
- className: V("mx-md", e),
291
- style: { gridArea: "icon", ...n.style },
292
- ...n,
293
- children: t
294
- }
295
- );
296
- N.displayName = "Snackbar.ItemIcon";
297
- const Y = 75, St = ({
298
- swipeRef: t,
299
- onSwipeStart: e,
300
- onSwipeMove: n,
301
- onSwipeCancel: r,
302
- onSwipeEnd: c,
303
- threshold: d = 10
304
- }) => {
305
- const [m, i] = st(), o = w(null), a = w(null), f = w(null), x = (s) => {
306
- a.current = { x: s.clientX, y: s.clientY }, document.addEventListener("selectstart", (u) => u.preventDefault());
307
- }, y = (s) => {
308
- if (!a.current) return;
309
- const u = Math.abs(s.clientX - a.current.x), b = Math.abs(s.clientY - a.current.y);
310
- let l;
311
- u > b && u > d ? o.current = s.clientX > a.current.x ? "right" : "left" : b > d && (o.current = s.clientY > a.current.y ? "down" : "up"), o.current && (f.current ? (l = "move", f.current = { x: u, y: b }, t.current.style.setProperty(
312
- "--swipe-position-x",
313
- `${u > b ? s.clientX - a.current.x : 0}px`
314
- ), t.current.style.setProperty(
315
- "--swipe-position-y",
316
- `${u > b ? 0 : s.clientY - a.current.y}px`
317
- ), n?.({ state: l, direction: o.current })) : (l = "start", f.current = { x: u, y: b }, e?.({ state: l, direction: o.current })), i(l));
318
- }, p = () => {
319
- const s = f.current;
320
- if (a.current = null, f.current = null, s) {
321
- const { x: u, y: b } = s;
322
- let l;
323
- u > b ? u > Y ? (l = "end", c?.({ state: l, direction: o.current })) : (l = "cancel", r?.({ state: l, direction: o.current })) : b > Y ? (l = "end", c?.({ state: l, direction: o.current })) : (l = "cancel", r?.({ state: l, direction: o.current })), i(l), document.removeEventListener("selectstart", (v) => v.preventDefault());
324
- }
325
- };
326
- return z(() => {
327
- if (!t.current) return;
328
- const s = t.current;
329
- return s.addEventListener("pointerdown", x), document.addEventListener("pointermove", y), document.addEventListener("pointerup", p), () => {
330
- s.removeEventListener("pointerdown", x), document.removeEventListener("pointermove", y), document.removeEventListener("pointerup", p);
331
- };
332
- }, []), {
333
- state: m,
334
- direction: o.current
335
- };
336
- }, A = ({
337
- "aria-label": t,
338
- "aria-labelledby": e,
339
- "aria-describedby": n,
340
- "aria-details": r,
341
- design: c,
342
- intent: d,
343
- actionOnNewline: m,
344
- className: i,
345
- children: o,
346
- ref: a,
347
- ...f
348
- }) => {
349
- const x = w(null), y = typeof a != "function" && a || x, { toast: p, state: s } = O(), { state: u, direction: b } = St({
350
- swipeRef: y,
351
- onSwipeStart: s.pauseAll,
352
- onSwipeCancel: s.resumeAll,
353
- onSwipeEnd: ({ direction: P }) => {
354
- ["left", "right"].includes(`${P}`) && s.close(p.key);
355
- }
356
- }), { message: l, icon: v, isClosable: G, onAction: T, actionLabel: X } = p.content, C = d ?? p.content.intent, _ = c ?? p.content.design, M = m ?? p.content.actionOnNewline, $ = {
357
- ariaLabel: t,
358
- ariaLabelledby: e,
359
- ariaDescribedby: n,
360
- ariaDetails: r
361
- }, { toastProps: q, titleProps: H, closeButtonProps: K, contentProps: U } = mt(
362
- { toast: p, ...$ },
363
- s,
364
- y
365
- ), E = S(
366
- (P) => rt.toArray(o).filter(ct).find(
367
- (tt) => !!tt.type.displayName?.includes(
368
- P
369
- )
370
- ),
371
- [o]
372
- ), W = E("Snackbar.ItemIcon"), J = E("Snackbar.ItemAction"), Z = E("Snackbar.ItemClose");
373
- return /* @__PURE__ */ g(
374
- "div",
375
- {
376
- "data-spark-component": "snackbar-item",
377
- className: yt({ design: _, intent: C, className: i }),
378
- "data-animation": p.animation,
379
- ...!(u === "cancel" && p.animation === "exiting") && {
380
- "data-swipe": u,
381
- "data-swipe-direction": b
382
- },
383
- ...p.animation === "exiting" && {
384
- // Remove snackbar when the exiting animation completes
385
- onAnimationEnd: () => s.remove(p.key)
386
- },
387
- ref: y,
388
- ...q,
389
- ...f,
390
- children: /* @__PURE__ */ et("div", { className: wt({ actionOnNewline: M }), ...U, children: [
391
- L(W, v ? N : null, {
392
- children: v
393
- }),
394
- /* @__PURE__ */ g(
395
- "p",
396
- {
397
- className: "px-md py-lg text-body-2 row-span-3",
398
- style: { gridArea: "message" },
399
- ...H,
400
- children: l
401
- }
402
- ),
403
- L(
404
- J,
405
- X && T ? h : null,
406
- { intent: C, design: _, onClick: T, children: X }
407
- ),
408
- L(Z, G ? I : null, {
409
- intent: C,
410
- design: _,
411
- /**
412
- * React Spectrum typing of aria-label is inaccurate, and aria-label value should never be undefined.
413
- * See https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/i18n/src/useLocalizedStringFormatter.ts#L40
414
- */
415
- "aria-label": K["aria-label"]
416
- })
417
- ] })
418
- }
419
- );
420
- };
421
- A.displayName = "Snackbar.Item";
422
- const L = (t, e, n) => t ? D(t, { ...n, ...t.props }) : e ? /* @__PURE__ */ g(e, { ...n }) : null, vt = B(
423
- [
424
- "fixed inset-x-lg z-toast group",
425
- "outline-hidden pointer-events-none",
426
- "grid grid-rows-1 grid-cols-1 gap-lg"
427
- ],
428
- {
429
- variants: {
430
- /**
431
- * Set snackbar item position
432
- * @default 'bottom'
433
- */
434
- position: {
435
- top: "top-lg justify-items-center",
436
- "top-right": "top-lg justify-items-end",
437
- "top-left": "top-lg justify-items-start",
438
- bottom: "bottom-lg justify-items-center",
439
- "bottom-right": "bottom-lg justify-items-end",
440
- "bottom-left": "bottom-lg justify-items-start"
441
- }
442
- },
443
- defaultVariants: {
444
- position: "bottom"
445
- }
446
- }
447
- ), kt = ({
448
- children: t = /* @__PURE__ */ g(A, {}),
449
- state: e,
450
- position: n = "bottom",
451
- className: r,
452
- ref: c,
453
- ...d
454
- }) => {
455
- const m = w(null), i = c && typeof c != "function" ? c : m, { regionProps: o } = ut(d, e, i);
456
- return /* @__PURE__ */ g(
457
- "div",
458
- {
459
- ...o,
460
- ref: i,
461
- "data-position": n,
462
- className: vt({ position: n, className: r }),
463
- children: e.visibleToasts.map((a) => /* @__PURE__ */ g(Q.Provider, { value: { toast: a, state: e }, children: D(t, { key: a.key }) }, a.key))
464
- }
465
- );
466
- }, ht = ({
467
- providers: t,
468
- subscriptions: e
469
- }) => {
470
- const n = S(
471
- (i) => (e.add(i), () => e.delete(i)),
472
- [e]
473
- ), r = S(() => [...t].reverse()[0], [t]), c = S(
474
- (i) => {
475
- t.add(i);
476
- for (const o of e)
477
- o();
478
- },
479
- [t, e]
480
- ), d = S(
481
- (i) => {
482
- t.delete(i);
483
- for (const o of e)
484
- o();
485
- },
486
- [t, e]
487
- );
488
- return {
489
- provider: lt(n, r, r),
490
- addProvider: c,
491
- deleteProvider: d
492
- };
200
+ A.displayName = "Snackbar.ItemClose";
201
+ //#endregion
202
+ //#region src/snackbar/SnackbarItemIcon.tsx
203
+ var j = ({ children: t, className: n, ...r }) => /* @__PURE__ */ h(e, {
204
+ size: "md",
205
+ className: i("mx-md", n),
206
+ style: {
207
+ gridArea: "icon",
208
+ ...r.style
209
+ },
210
+ ...r,
211
+ children: t
212
+ });
213
+ j.displayName = "Snackbar.ItemIcon";
214
+ //#endregion
215
+ //#region src/snackbar/useSwipe.ts
216
+ var M = 75, N = ({ swipeRef: e, onSwipeStart: t, onSwipeMove: n, onSwipeCancel: r, onSwipeEnd: i, threshold: a = 10 }) => {
217
+ let [o, s] = p(), c = f(null), l = f(null), u = f(null), m = (e) => {
218
+ l.current = {
219
+ x: e.clientX,
220
+ y: e.clientY
221
+ }, document.addEventListener("selectstart", (e) => e.preventDefault());
222
+ }, h = (r) => {
223
+ if (!l.current) return;
224
+ let i = Math.abs(r.clientX - l.current.x), o = Math.abs(r.clientY - l.current.y), d;
225
+ i > o && i > a ? c.current = r.clientX > l.current.x ? "right" : "left" : o > a && (c.current = r.clientY > l.current.y ? "down" : "up"), c.current && (u.current ? (d = "move", u.current = {
226
+ x: i,
227
+ y: o
228
+ }, e.current.style.setProperty("--swipe-position-x", `${i > o ? r.clientX - l.current.x : 0}px`), e.current.style.setProperty("--swipe-position-y", `${i > o ? 0 : r.clientY - l.current.y}px`), n?.({
229
+ state: d,
230
+ direction: c.current
231
+ })) : (d = "start", u.current = {
232
+ x: i,
233
+ y: o
234
+ }, t?.({
235
+ state: d,
236
+ direction: c.current
237
+ })), s(d));
238
+ }, g = () => {
239
+ let e = u.current;
240
+ if (l.current = null, u.current = null, e) {
241
+ let { x: t, y: n } = e, a;
242
+ t > n ? t > M ? (a = "end", i?.({
243
+ state: a,
244
+ direction: c.current
245
+ })) : (a = "cancel", r?.({
246
+ state: a,
247
+ direction: c.current
248
+ })) : n > M ? (a = "end", i?.({
249
+ state: a,
250
+ direction: c.current
251
+ })) : (a = "cancel", r?.({
252
+ state: a,
253
+ direction: c.current
254
+ })), s(a), document.removeEventListener("selectstart", (e) => e.preventDefault());
255
+ }
256
+ };
257
+ return d(() => {
258
+ if (!e.current) return;
259
+ let t = e.current;
260
+ return t.addEventListener("pointerdown", m), document.addEventListener("pointermove", h), document.addEventListener("pointerup", g), () => {
261
+ t.removeEventListener("pointerdown", m), document.removeEventListener("pointermove", h), document.removeEventListener("pointerup", g);
262
+ };
263
+ }, []), {
264
+ state: o,
265
+ direction: c.current
266
+ };
267
+ }, P = ({ "aria-label": e, "aria-labelledby": t, "aria-describedby": n, "aria-details": r, design: i, intent: o, actionOnNewline: s, className: u, children: d, ref: p, ...m }) => {
268
+ let _ = f(null), v = typeof p == "function" ? _ : p || _, { toast: y, state: b } = O(), { state: S, direction: C } = N({
269
+ swipeRef: v,
270
+ onSwipeStart: b.pauseAll,
271
+ onSwipeCancel: b.resumeAll,
272
+ onSwipeEnd: ({ direction: e }) => {
273
+ ["left", "right"].includes(`${e}`) && b.close(y.key);
274
+ }
275
+ }), { message: w, icon: D, isClosable: M, onAction: P, actionLabel: I } = y.content, L = o ?? y.content.intent, R = i ?? y.content.design, z = s ?? y.content.actionOnNewline, { toastProps: B, titleProps: V, closeButtonProps: H, contentProps: U } = x({
276
+ toast: y,
277
+ ariaLabel: e,
278
+ ariaLabelledby: t,
279
+ ariaDescribedby: n,
280
+ ariaDetails: r
281
+ }, b, v), W = l((e) => a.toArray(d).filter(c).find((t) => !!t.type.displayName?.includes(e)), [d]), G = W("Snackbar.ItemIcon"), K = W("Snackbar.ItemAction"), q = W("Snackbar.ItemClose");
282
+ return /* @__PURE__ */ h("div", {
283
+ "data-spark-component": "snackbar-item",
284
+ className: T({
285
+ design: R,
286
+ intent: L,
287
+ className: u
288
+ }),
289
+ "data-animation": y.animation,
290
+ ...!(S === "cancel" && y.animation === "exiting") && {
291
+ "data-swipe": S,
292
+ "data-swipe-direction": C
293
+ },
294
+ ...y.animation === "exiting" && { onAnimationEnd: () => b.remove(y.key) },
295
+ ref: v,
296
+ ...B,
297
+ ...m,
298
+ children: /* @__PURE__ */ g("div", {
299
+ className: E({ actionOnNewline: z }),
300
+ ...U,
301
+ children: [
302
+ F(G, D ? j : null, { children: D }),
303
+ /* @__PURE__ */ h("p", {
304
+ className: "px-md py-lg text-body-2 row-span-3",
305
+ style: { gridArea: "message" },
306
+ ...V,
307
+ children: w
308
+ }),
309
+ F(K, I && P ? k : null, {
310
+ intent: L,
311
+ design: R,
312
+ onClick: P,
313
+ children: I
314
+ }),
315
+ F(q, M ? A : null, {
316
+ intent: L,
317
+ design: R,
318
+ "aria-label": H["aria-label"]
319
+ })
320
+ ]
321
+ })
322
+ });
493
323
  };
494
- let k = null;
495
- const j = () => (k || (k = new it({
496
- maxVisibleToasts: 1,
497
- hasExitAnimation: !0
498
- })), k), Yt = () => {
499
- k = null;
500
- }, It = {
501
- providers: /* @__PURE__ */ new Set(),
502
- subscriptions: /* @__PURE__ */ new Set()
503
- }, R = ({ ref: t, ...e }) => {
504
- const n = w(null), r = nt(j()), { provider: c, addProvider: d, deleteProvider: m } = ht(It);
505
- return z(() => (d(n), () => {
506
- for (const i of j().visibleToasts)
507
- i.animation = void 0;
508
- m(n);
509
- }), []), n === c && r.visibleToasts.length > 0 ? dt(/* @__PURE__ */ g(kt, { ref: t, state: r, ...e }), document.body) : null;
324
+ P.displayName = "Snackbar.Item";
325
+ var F = (e, t, n) => e ? o(e, {
326
+ ...n,
327
+ ...e.props
328
+ }) : t ? /* @__PURE__ */ h(t, { ...n }) : null, I = r([
329
+ "fixed inset-x-lg z-toast group",
330
+ "outline-hidden pointer-events-none",
331
+ "grid grid-rows-1 grid-cols-1 gap-lg"
332
+ ], {
333
+ variants: { position: {
334
+ top: "top-lg justify-items-center",
335
+ "top-right": "top-lg justify-items-end",
336
+ "top-left": "top-lg justify-items-start",
337
+ bottom: "bottom-lg justify-items-center",
338
+ "bottom-right": "bottom-lg justify-items-end",
339
+ "bottom-left": "bottom-lg justify-items-start"
340
+ } },
341
+ defaultVariants: { position: "bottom" }
342
+ }), L = ({ children: e = /* @__PURE__ */ h(P, {}), state: t, position: n = "bottom", className: r, ref: i, ...a }) => {
343
+ let s = f(null), c = i && typeof i != "function" ? i : s, { regionProps: l } = S(a, t, c);
344
+ return /* @__PURE__ */ h("div", {
345
+ ...l,
346
+ ref: c,
347
+ "data-position": n,
348
+ className: I({
349
+ position: n,
350
+ className: r
351
+ }),
352
+ children: t.visibleToasts.map((n) => /* @__PURE__ */ h(D.Provider, {
353
+ value: {
354
+ toast: n,
355
+ state: t
356
+ },
357
+ children: o(e, { key: n.key })
358
+ }, n.key))
359
+ });
360
+ }, R = ({ providers: e, subscriptions: t }) => {
361
+ let n = l((e) => (t.add(e), () => t.delete(e)), [t]), r = l(() => [...e].reverse()[0], [e]), i = l((n) => {
362
+ e.add(n);
363
+ for (let e of t) e();
364
+ }, [e, t]), a = l((n) => {
365
+ e.delete(n);
366
+ for (let e of t) e();
367
+ }, [e, t]);
368
+ return {
369
+ provider: m(n, r, r),
370
+ addProvider: i,
371
+ deleteProvider: a
372
+ };
373
+ }, z = null, B = () => (z ||= new v({
374
+ maxVisibleToasts: 1,
375
+ hasExitAnimation: !0
376
+ }), z), V = () => {
377
+ z = null;
378
+ }, H = {
379
+ providers: /* @__PURE__ */ new Set(),
380
+ subscriptions: /* @__PURE__ */ new Set()
381
+ }, U = ({ ref: e, ...t }) => {
382
+ let n = f(null), r = y(B()), { provider: i, addProvider: a, deleteProvider: o } = R(H);
383
+ return d(() => (a(n), () => {
384
+ for (let e of B().visibleToasts) e.animation = void 0;
385
+ o(n);
386
+ }), []), n === i && r.visibleToasts.length > 0 ? b(/* @__PURE__ */ h(L, {
387
+ ref: e,
388
+ state: r,
389
+ ...t
390
+ }), document.body) : null;
510
391
  };
511
- R.displayName = "Snackbar";
512
- const zt = ({ onClose: t, timeout: e = 5e3, priority: n, ...r }) => {
513
- j().add(r, {
514
- onClose: t,
515
- timeout: e && !r.onAction ? Math.max(e, 5e3) : void 0,
516
- priority: n
517
- });
518
- }, Nt = Object.assign(R, {
519
- Item: A,
520
- ItemAction: h,
521
- ItemClose: I,
522
- ItemIcon: N
392
+ U.displayName = "Snackbar";
393
+ var W = ({ onClose: e, timeout: t = 5e3, priority: n, ...r }) => {
394
+ B().add(r, {
395
+ onClose: e,
396
+ timeout: t && !r.onAction ? Math.max(t, 5e3) : void 0,
397
+ priority: n
398
+ });
399
+ }, G = Object.assign(U, {
400
+ Item: P,
401
+ ItemAction: k,
402
+ ItemClose: A,
403
+ ItemIcon: j
523
404
  });
524
- Nt.displayName = "Snackbar";
525
- A.displayName = "Snackbar.Item";
526
- h.displayName = "Snackbar.ItemAction";
527
- I.displayName = "Snackbar.ItemClose";
528
- N.displayName = "Snackbar.ItemIcon";
529
- export {
530
- Nt as Snackbar,
531
- zt as addSnackbar,
532
- Yt as clearSnackbarQueue
533
- };
534
- //# sourceMappingURL=index.mjs.map
405
+ G.displayName = "Snackbar", P.displayName = "Snackbar.Item", k.displayName = "Snackbar.ItemAction", A.displayName = "Snackbar.ItemClose", j.displayName = "Snackbar.ItemIcon";
406
+ //#endregion
407
+ export { G as Snackbar, W as addSnackbar, V as clearSnackbarQueue };
408
+
409
+ //# sourceMappingURL=index.mjs.map