@spear-ai/spectral 1.9.0 → 1.10.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 (237) hide show
  1. package/README.md +6 -5
  2. package/dist/.js +112 -239
  3. package/dist/Accordion-CDXdSAST.js +363 -0
  4. package/dist/Accordion.js +3 -498
  5. package/dist/Alert/AlertBase.js +69 -152
  6. package/dist/Alert.js +58 -106
  7. package/dist/AnimatePresence-D-9jXfgI.js +178 -0
  8. package/dist/App.js +6 -6
  9. package/dist/Avatar.js +83 -65
  10. package/dist/Badge.d.ts +1 -3
  11. package/dist/Badge.js +21 -25
  12. package/dist/Button.js +102 -178
  13. package/dist/ButtonGroup/ButtonGroupButton.js +38 -40
  14. package/dist/ButtonGroup.js +55 -59
  15. package/dist/ButtonIcon.js +58 -134
  16. package/dist/Calendar-s4lyijkn.js +3109 -0
  17. package/dist/Checkbox/CheckboxBase.js +94 -126
  18. package/dist/Checkbox.d.ts +1 -1
  19. package/dist/Checkbox.js +40 -105
  20. package/dist/Combobox/ComboboxBase.js +2 -79
  21. package/dist/Combobox.js +106 -172
  22. package/dist/ComboboxBase-D8Nf4xC-.js +491 -0
  23. package/dist/ControlGroup/ControlGroupSelect.d.ts +1 -1
  24. package/dist/ControlGroup/ControlGroupSelect.js +85 -101
  25. package/dist/ControlGroup.js +45 -48
  26. package/dist/DataCard/Card.js +37 -12
  27. package/dist/DataCard.d.ts +1 -1
  28. package/dist/DataCard.js +36 -16
  29. package/dist/DateTimePicker/Calendar.js +2 -2967
  30. package/dist/DateTimePicker/DateTimeDisplayInput.d.ts +1 -1
  31. package/dist/DateTimePicker/DateTimeDisplayInput.js +379 -274
  32. package/dist/DateTimePicker/DateTimeInput.d.ts +5 -3
  33. package/dist/DateTimePicker/DateTimeInput.js +133 -88
  34. package/dist/DateTimePicker/DateTimeUtils.js +2 -2193
  35. package/dist/DateTimePicker/TimePeriodSelect.d.ts +1 -1
  36. package/dist/DateTimePicker/TimePeriodSelect.js +45 -20
  37. package/dist/DateTimePicker/TimePicker.d.ts +1 -1
  38. package/dist/DateTimePicker/TimePicker.js +76 -60
  39. package/dist/DateTimePicker.d.ts +2 -2
  40. package/dist/DateTimePicker.js +87 -205
  41. package/dist/DateTimeUtils-DVvG6H-p.js +2098 -0
  42. package/dist/Dialog.js +74 -74
  43. package/dist/Drawer.js +67 -37
  44. package/dist/HoverCard-CYDsIiVK.js +201 -0
  45. package/dist/HoverCard.d.ts +1 -1
  46. package/dist/HoverCard.js +2 -218
  47. package/dist/Icons/AnalyzeIcon.js +50 -57
  48. package/dist/Icons/AnnotationsIcon.js +20 -15
  49. package/dist/Icons/ApprovedIcon.js +26 -18
  50. package/dist/Icons/ArrowDownIcon.js +20 -6
  51. package/dist/Icons/ArrowUpIcon.js +20 -6
  52. package/dist/Icons/BoxToolIcon.js +17 -12
  53. package/dist/Icons/CalendarIcon.js +43 -20
  54. package/dist/Icons/CheckCircleIcon.js +26 -10
  55. package/dist/Icons/CheckSquareIcon.js +26 -10
  56. package/dist/Icons/CheckmarkIcon.js +22 -9
  57. package/dist/Icons/ChevronDownIcon.js +22 -9
  58. package/dist/Icons/ChevronUpIcon.js +22 -9
  59. package/dist/Icons/ClockIcon.js +26 -18
  60. package/dist/Icons/CloseCircleIcon.js +26 -10
  61. package/dist/Icons/CloseIcon.js +18 -9
  62. package/dist/Icons/DashboardIcon.js +36 -10
  63. package/dist/Icons/DatabaseIcon.js +36 -19
  64. package/dist/Icons/DeleteIcon.js +36 -19
  65. package/dist/Icons/DurationIcon.js +57 -22
  66. package/dist/Icons/EditIcon.js +26 -27
  67. package/dist/Icons/EmailIcon.js +26 -10
  68. package/dist/Icons/EraserIcon.js +41 -25
  69. package/dist/Icons/ErrorIcon.js +27 -11
  70. package/dist/Icons/EyeClosedIcon.js +29 -13
  71. package/dist/Icons/EyeClosedIcon2.js +27 -11
  72. package/dist/Icons/EyeOpenIcon.js +22 -9
  73. package/dist/Icons/FileDownloadIcon.js +43 -20
  74. package/dist/Icons/GoToFirstIcon.js +26 -9
  75. package/dist/Icons/GoToLastIcon.js +26 -9
  76. package/dist/Icons/HarmonicCursorsIcon.js +23 -9
  77. package/dist/Icons/IconBase.d.ts +3 -3
  78. package/dist/Icons/IconBase.js +49 -23
  79. package/dist/Icons/InfoIcon.js +36 -10
  80. package/dist/Icons/KeyboardIcon.js +26 -27
  81. package/dist/Icons/LabelIcon.js +19 -14
  82. package/dist/Icons/LassoIcon.js +36 -28
  83. package/dist/Icons/LineToolIcon.js +48 -39
  84. package/dist/Icons/LiveViewIcon.js +50 -12
  85. package/dist/Icons/LoaderIcon.js +67 -27
  86. package/dist/Icons/LocationIcon.js +26 -27
  87. package/dist/Icons/LogoutIcon.js +20 -15
  88. package/dist/Icons/MeasureIcon.js +78 -25
  89. package/dist/Icons/MessagesIcon.js +33 -18
  90. package/dist/Icons/MetadataIcon.js +20 -15
  91. package/dist/Icons/MinusIcon.d.ts +1 -1
  92. package/dist/Icons/MinusIcon.js +18 -6
  93. package/dist/Icons/OntologyIcon.js +87 -71
  94. package/dist/Icons/PanelIconClose.js +28 -10
  95. package/dist/Icons/PanelIconOpen.js +28 -10
  96. package/dist/Icons/PlayIcon.js +20 -6
  97. package/dist/Icons/PlusIcon.js +20 -14
  98. package/dist/Icons/PolygonIcon.js +50 -39
  99. package/dist/Icons/ProgressCheckIcon.d.ts +5 -0
  100. package/dist/Icons/ProgressCheckIcon.js +58 -0
  101. package/dist/Icons/ResetIcon.js +17 -12
  102. package/dist/Icons/ReviewedIcon.js +36 -19
  103. package/dist/Icons/ScissorsIcon.js +22 -17
  104. package/dist/Icons/SearchIcon.js +26 -9
  105. package/dist/Icons/SettingsIcon.js +26 -27
  106. package/dist/Icons/SortAscendingIcon.js +50 -12
  107. package/dist/Icons/SortAtoZIcon.js +50 -12
  108. package/dist/Icons/SortDescendingIcon.js +50 -12
  109. package/dist/Icons/SortZtoAIcon.js +50 -12
  110. package/dist/Icons/StackIcon.js +26 -9
  111. package/dist/Icons/StarIcon.js +20 -6
  112. package/dist/Icons/TrashIcon.js +17 -12
  113. package/dist/Icons/UndoIcon.js +20 -15
  114. package/dist/Icons/User2Icon.js +26 -10
  115. package/dist/Icons/UserIcon.js +19 -14
  116. package/dist/Icons/WarningIcon.js +19 -14
  117. package/dist/Icons/ZoomAllIcon.js +71 -15
  118. package/dist/Icons/ZoomXIcon.js +36 -10
  119. package/dist/Icons/ZoomYIcon.js +36 -10
  120. package/dist/Icons/index.d.ts +1 -0
  121. package/dist/Icons.js +68 -136
  122. package/dist/IconsAnimated/PanelLeftCloseIcon.js +66 -36
  123. package/dist/IconsAnimated/PanelLeftOpenIcon.js +66 -36
  124. package/dist/IconsAnimated.js +3 -6
  125. package/dist/Input/InputUtils.js +51 -52
  126. package/dist/Input.js +132 -185
  127. package/dist/InputOTP-XUWW9xcI.js +461 -0
  128. package/dist/InputOTP.js +2 -382
  129. package/dist/Kbd.d.ts +1 -1
  130. package/dist/Kbd.js +182 -86
  131. package/dist/Label.js +12 -14
  132. package/dist/MultiSelect/MultiSelectBase.js +331 -403
  133. package/dist/MultiSelect.d.ts +1 -1
  134. package/dist/MultiSelect.js +23 -23
  135. package/dist/Popover.js +28 -32
  136. package/dist/RadioButton.d.ts +17 -0
  137. package/dist/RadioButton.js +33 -0
  138. package/dist/RadioButtonGroup/RadioButtonGroupBase.d.ts +3 -1
  139. package/dist/RadioButtonGroup/RadioButtonGroupBase.js +49 -46
  140. package/dist/RadioButtonGroup.d.ts +1 -1
  141. package/dist/RadioButtonGroup.js +11 -8
  142. package/dist/RadioGroup-w_q6RGEK.js +447 -0
  143. package/dist/RadioGroup.js +2 -505
  144. package/dist/Select.js +163 -186
  145. package/dist/Separator.js +16 -19
  146. package/dist/Skeleton.js +10 -6
  147. package/dist/Slider-BzzZT3Zm.js +490 -0
  148. package/dist/Slider.js +2 -562
  149. package/dist/SpectralProvider.js +8 -5
  150. package/dist/Switch/SwitchBase.js +91 -95
  151. package/dist/Switch-CVzRJ-0n.js +126 -0
  152. package/dist/Switch.d.ts +1 -1
  153. package/dist/Switch.js +2 -134
  154. package/dist/Tabs/TabsBase.js +242 -250
  155. package/dist/Tabs/tabsUtils.js +65 -73
  156. package/dist/Tabs.d.ts +1 -1
  157. package/dist/Tabs.js +73 -103
  158. package/dist/Textarea/TextareaUtils.js +35 -46
  159. package/dist/Textarea.js +83 -160
  160. package/dist/Toast-9zqXxKKO.js +711 -0
  161. package/dist/Toast.js +2 -885
  162. package/dist/Toggle/ToggleBase.js +46 -56
  163. package/dist/Toggle.d.ts +1 -1
  164. package/dist/Toggle.js +52 -62
  165. package/dist/ToggleGroup/ToggleGroupBase.js +128 -104
  166. package/dist/ToggleGroup.d.ts +1 -1
  167. package/dist/ToggleGroup.js +52 -63
  168. package/dist/Tooltip-D1K8kY1y.js +389 -0
  169. package/dist/Tooltip.js +2 -365
  170. package/dist/Tray.js +174 -217
  171. package/dist/chunk-h9knIhTc.js +20 -0
  172. package/dist/clsx-jM1GlMvB.js +16 -0
  173. package/dist/dist-3Af8168y.js +913 -0
  174. package/dist/dist-7HRQ5IKN.js +249 -0
  175. package/dist/dist-B2k1iWFp.js +129 -0
  176. package/dist/dist-B4FgboI8.js +122 -0
  177. package/dist/dist-B4g6zpUF.js +33 -0
  178. package/dist/dist-B9tup-4O.js +216 -0
  179. package/dist/dist-BK1K0g9W.js +29 -0
  180. package/dist/dist-Bfjk-jx9.js +28 -0
  181. package/dist/dist-Bft31cJh.js +65 -0
  182. package/dist/dist-BtdmHAzK.js +190 -0
  183. package/dist/dist-C0Hifjgh.js +1287 -0
  184. package/dist/dist-CGzgmYB9.js +68 -0
  185. package/dist/dist-ClmepHp4.js +10 -0
  186. package/dist/dist-D8Wb_MX9.js +6 -0
  187. package/dist/dist-Dtvmk11N.js +12 -0
  188. package/dist/dist-fW81qjVl.js +677 -0
  189. package/dist/dist-s1uWaZYZ.js +11 -0
  190. package/dist/es2015-YHaMV-St.js +701 -0
  191. package/dist/hooks/useAccordionAutoScroll.js +66 -67
  192. package/dist/hooks/useControllableState.js +14 -13
  193. package/dist/hooks/useTheme.js +21 -17
  194. package/dist/index.d.ts +2 -1
  195. package/dist/index.d.ts.map +1 -1
  196. package/dist/main.js +18954 -27224
  197. package/dist/primitives/button.js +39 -41
  198. package/dist/primitives/input-group.js +57 -73
  199. package/dist/primitives/input.js +11 -20
  200. package/dist/primitives/popover.d.ts.map +1 -1
  201. package/dist/primitives/popover.js +34 -25
  202. package/dist/primitives/select.js +70 -138
  203. package/dist/primitives/slot.js +32 -31
  204. package/dist/primitives/textarea.js +10 -16
  205. package/dist/proxy-Dn10Pl_g.js +4920 -0
  206. package/dist/styles/main.css +2 -1
  207. package/dist/styles/spectral.css +1 -1
  208. package/dist/twUtils-VNWgstKL.js +1673 -0
  209. package/dist/use-animation-CBUDycyW.js +57 -0
  210. package/dist/utils/constants.js +4 -4
  211. package/dist/utils/formFieldUtils.js +136 -148
  212. package/dist/utils/sharedUtils.js +26 -7
  213. package/dist/utils/twUtils.js +2 -2919
  214. package/package.json +24 -28
  215. package/dist/ComboboxBase-CxNxYtdT.js +0 -408
  216. package/dist/clsx-OuTLNxxd.js +0 -16
  217. package/dist/index-0ioNhtNM.js +0 -10
  218. package/dist/index-6oYKCvIn.js +0 -677
  219. package/dist/index-BFOf48AQ.js +0 -69
  220. package/dist/index-BZPx6jYI.js +0 -8
  221. package/dist/index-BlHU_t18.js +0 -142
  222. package/dist/index-Bm1RbF6w.js +0 -1037
  223. package/dist/index-Bv2OIg5P.js +0 -225
  224. package/dist/index-CKEI0pDv.js +0 -56
  225. package/dist/index-CM_hWgfC.js +0 -32
  226. package/dist/index-C_YVr64u.js +0 -1538
  227. package/dist/index-Cl8VeY0o.js +0 -149
  228. package/dist/index-CwSyIPrv.js +0 -13
  229. package/dist/index-D29mdTf5.js +0 -34
  230. package/dist/index-DEYs15GP.js +0 -66
  231. package/dist/index-Dc0No4pV.js +0 -233
  232. package/dist/index-T6XEa11q.js +0 -822
  233. package/dist/index-pBCLb6Gr.js +0 -240
  234. package/dist/index-psiVrsnE.js +0 -27
  235. package/dist/index-rKs9bXHr.js +0 -6
  236. package/dist/proxy-CO_-Vget.js +0 -4975
  237. package/dist/use-animation-DhEPRwZ3.js +0 -62
package/dist/Toast.js CHANGED
@@ -1,885 +1,2 @@
1
- "use client";
2
- import "./styles/main.css";
3
- import { jsx as P, jsxs as Gt } from "react/jsx-runtime";
4
- import "./Icons/AnalyzeIcon.js";
5
- import "./Icons/AnnotationsIcon.js";
6
- import "./Icons/ApprovedIcon.js";
7
- import "./Icons/ArrowDownIcon.js";
8
- import "./Icons/ArrowUpIcon.js";
9
- import "./Icons/BoxToolIcon.js";
10
- import "./Icons/CalendarIcon.js";
11
- import "./Icons/CheckCircleIcon.js";
12
- import { CheckSquareIcon as Qt } from "./Icons/CheckSquareIcon.js";
13
- import "./Icons/CheckmarkIcon.js";
14
- import "./Icons/ChevronDownIcon.js";
15
- import "./Icons/ChevronUpIcon.js";
16
- import "./Icons/ClockIcon.js";
17
- import { CloseCircleIcon as Jt } from "./Icons/CloseCircleIcon.js";
18
- import "./Icons/CloseIcon.js";
19
- import "./Icons/DashboardIcon.js";
20
- import "./Icons/DatabaseIcon.js";
21
- import "./Icons/DeleteIcon.js";
22
- import "./Icons/DurationIcon.js";
23
- import "./Icons/EditIcon.js";
24
- import "./Icons/EmailIcon.js";
25
- import "./Icons/EraserIcon.js";
26
- import "./Icons/ErrorIcon.js";
27
- import "./Icons/EyeClosedIcon.js";
28
- import "./Icons/EyeClosedIcon2.js";
29
- import "./Icons/EyeOpenIcon.js";
30
- import "./Icons/FileDownloadIcon.js";
31
- import "./Icons/GoToFirstIcon.js";
32
- import "./Icons/GoToLastIcon.js";
33
- import "./Icons/HarmonicCursorsIcon.js";
34
- import { InfoIcon as Zt } from "./Icons/InfoIcon.js";
35
- import "./Icons/KeyboardIcon.js";
36
- import "./Icons/LabelIcon.js";
37
- import "./Icons/LassoIcon.js";
38
- import "./Icons/LineToolIcon.js";
39
- import "./Icons/LiveViewIcon.js";
40
- import "./Icons/LoaderIcon.js";
41
- import "./Icons/LocationIcon.js";
42
- import "./Icons/LogoutIcon.js";
43
- import "./Icons/MeasureIcon.js";
44
- import "./Icons/MessagesIcon.js";
45
- import "./Icons/MetadataIcon.js";
46
- import "./Icons/MinusIcon.js";
47
- import "./Icons/OntologyIcon.js";
48
- import "./Icons/PanelIconClose.js";
49
- import "./Icons/PanelIconOpen.js";
50
- import "./Icons/PlayIcon.js";
51
- import "./Icons/PlusIcon.js";
52
- import "./Icons/PolygonIcon.js";
53
- import "./Icons/ResetIcon.js";
54
- import "./Icons/ReviewedIcon.js";
55
- import "./Icons/ScissorsIcon.js";
56
- import "./Icons/SearchIcon.js";
57
- import "./Icons/SettingsIcon.js";
58
- import "./Icons/SortAscendingIcon.js";
59
- import "./Icons/SortAtoZIcon.js";
60
- import "./Icons/SortDescendingIcon.js";
61
- import "./Icons/SortZtoAIcon.js";
62
- import "./Icons/StackIcon.js";
63
- import "./Icons/StarIcon.js";
64
- import "./Icons/TrashIcon.js";
65
- import "./Icons/UndoIcon.js";
66
- import "./Icons/User2Icon.js";
67
- import "./Icons/UserIcon.js";
68
- import { WarningIcon as te } from "./Icons/WarningIcon.js";
69
- import "./Icons/ZoomAllIcon.js";
70
- import "./Icons/ZoomXIcon.js";
71
- import "./Icons/ZoomYIcon.js";
72
- import { cn as ee } from "./utils/twUtils.js";
73
- import { c as zt } from "./index-D29mdTf5.js";
74
- import a from "react";
75
- import ae from "react-dom";
76
- function oe(n) {
77
- if (typeof document > "u") return;
78
- let o = document.head || document.getElementsByTagName("head")[0], e = document.createElement("style");
79
- e.type = "text/css", o.appendChild(e), e.styleSheet ? e.styleSheet.cssText = n : e.appendChild(document.createTextNode(n));
80
- }
81
- const se = (n) => {
82
- switch (n) {
83
- case "success":
84
- return ie;
85
- case "info":
86
- return de;
87
- case "warning":
88
- return le;
89
- case "error":
90
- return ce;
91
- default:
92
- return null;
93
- }
94
- }, ne = Array(12).fill(0), re = ({ visible: n, className: o }) => /* @__PURE__ */ a.createElement("div", {
95
- className: [
96
- "sonner-loading-wrapper",
97
- o
98
- ].filter(Boolean).join(" "),
99
- "data-visible": n
100
- }, /* @__PURE__ */ a.createElement("div", {
101
- className: "sonner-spinner"
102
- }, ne.map((e, s) => /* @__PURE__ */ a.createElement("div", {
103
- className: "sonner-loading-bar",
104
- key: `spinner-bar-${s}`
105
- })))), ie = /* @__PURE__ */ a.createElement("svg", {
106
- xmlns: "http://www.w3.org/2000/svg",
107
- viewBox: "0 0 20 20",
108
- fill: "currentColor",
109
- height: "20",
110
- width: "20"
111
- }, /* @__PURE__ */ a.createElement("path", {
112
- fillRule: "evenodd",
113
- d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
114
- clipRule: "evenodd"
115
- })), le = /* @__PURE__ */ a.createElement("svg", {
116
- xmlns: "http://www.w3.org/2000/svg",
117
- viewBox: "0 0 24 24",
118
- fill: "currentColor",
119
- height: "20",
120
- width: "20"
121
- }, /* @__PURE__ */ a.createElement("path", {
122
- fillRule: "evenodd",
123
- d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
124
- clipRule: "evenodd"
125
- })), de = /* @__PURE__ */ a.createElement("svg", {
126
- xmlns: "http://www.w3.org/2000/svg",
127
- viewBox: "0 0 20 20",
128
- fill: "currentColor",
129
- height: "20",
130
- width: "20"
131
- }, /* @__PURE__ */ a.createElement("path", {
132
- fillRule: "evenodd",
133
- d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
134
- clipRule: "evenodd"
135
- })), ce = /* @__PURE__ */ a.createElement("svg", {
136
- xmlns: "http://www.w3.org/2000/svg",
137
- viewBox: "0 0 20 20",
138
- fill: "currentColor",
139
- height: "20",
140
- width: "20"
141
- }, /* @__PURE__ */ a.createElement("path", {
142
- fillRule: "evenodd",
143
- d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
144
- clipRule: "evenodd"
145
- })), ue = /* @__PURE__ */ a.createElement("svg", {
146
- xmlns: "http://www.w3.org/2000/svg",
147
- width: "12",
148
- height: "12",
149
- viewBox: "0 0 24 24",
150
- fill: "none",
151
- stroke: "currentColor",
152
- strokeWidth: "1.5",
153
- strokeLinecap: "round",
154
- strokeLinejoin: "round"
155
- }, /* @__PURE__ */ a.createElement("line", {
156
- x1: "18",
157
- y1: "6",
158
- x2: "6",
159
- y2: "18"
160
- }), /* @__PURE__ */ a.createElement("line", {
161
- x1: "6",
162
- y1: "6",
163
- x2: "18",
164
- y2: "18"
165
- })), me = () => {
166
- const [n, o] = a.useState(document.hidden);
167
- return a.useEffect(() => {
168
- const e = () => {
169
- o(document.hidden);
170
- };
171
- return document.addEventListener("visibilitychange", e), () => window.removeEventListener("visibilitychange", e);
172
- }, []), n;
173
- };
174
- let Tt = 1;
175
- class fe {
176
- constructor() {
177
- this.subscribe = (o) => (this.subscribers.push(o), () => {
178
- const e = this.subscribers.indexOf(o);
179
- this.subscribers.splice(e, 1);
180
- }), this.publish = (o) => {
181
- this.subscribers.forEach((e) => e(o));
182
- }, this.addToast = (o) => {
183
- this.publish(o), this.toasts = [
184
- ...this.toasts,
185
- o
186
- ];
187
- }, this.create = (o) => {
188
- var e;
189
- const { message: s, ...w } = o, d = typeof o?.id == "number" || ((e = o.id) == null ? void 0 : e.length) > 0 ? o.id : Tt++, u = this.toasts.find((h) => h.id === d), v = o.dismissible === void 0 ? !0 : o.dismissible;
190
- return this.dismissedToasts.has(d) && this.dismissedToasts.delete(d), u ? this.toasts = this.toasts.map((h) => h.id === d ? (this.publish({
191
- ...h,
192
- ...o,
193
- id: d,
194
- title: s
195
- }), {
196
- ...h,
197
- ...o,
198
- id: d,
199
- dismissible: v,
200
- title: s
201
- }) : h) : this.addToast({
202
- title: s,
203
- ...w,
204
- dismissible: v,
205
- id: d
206
- }), d;
207
- }, this.dismiss = (o) => (o ? (this.dismissedToasts.add(o), requestAnimationFrame(() => this.subscribers.forEach((e) => e({
208
- id: o,
209
- dismiss: !0
210
- })))) : this.toasts.forEach((e) => {
211
- this.subscribers.forEach((s) => s({
212
- id: e.id,
213
- dismiss: !0
214
- }));
215
- }), o), this.message = (o, e) => this.create({
216
- ...e,
217
- message: o
218
- }), this.error = (o, e) => this.create({
219
- ...e,
220
- message: o,
221
- type: "error"
222
- }), this.success = (o, e) => this.create({
223
- ...e,
224
- type: "success",
225
- message: o
226
- }), this.info = (o, e) => this.create({
227
- ...e,
228
- type: "info",
229
- message: o
230
- }), this.warning = (o, e) => this.create({
231
- ...e,
232
- type: "warning",
233
- message: o
234
- }), this.loading = (o, e) => this.create({
235
- ...e,
236
- type: "loading",
237
- message: o
238
- }), this.promise = (o, e) => {
239
- if (!e)
240
- return;
241
- let s;
242
- e.loading !== void 0 && (s = this.create({
243
- ...e,
244
- promise: o,
245
- type: "loading",
246
- message: e.loading,
247
- description: typeof e.description != "function" ? e.description : void 0
248
- }));
249
- const w = Promise.resolve(o instanceof Function ? o() : o);
250
- let d = s !== void 0, u;
251
- const v = w.then(async (i) => {
252
- if (u = [
253
- "resolve",
254
- i
255
- ], a.isValidElement(i))
256
- d = !1, this.create({
257
- id: s,
258
- type: "default",
259
- message: i
260
- });
261
- else if (ge(i) && !i.ok) {
262
- d = !1;
263
- const t = typeof e.error == "function" ? await e.error(`HTTP error! status: ${i.status}`) : e.error, T = typeof e.description == "function" ? await e.description(`HTTP error! status: ${i.status}`) : e.description, N = typeof t == "object" && !a.isValidElement(t) ? t : {
264
- message: t
265
- };
266
- this.create({
267
- id: s,
268
- type: "error",
269
- description: T,
270
- ...N
271
- });
272
- } else if (i instanceof Error) {
273
- d = !1;
274
- const t = typeof e.error == "function" ? await e.error(i) : e.error, T = typeof e.description == "function" ? await e.description(i) : e.description, N = typeof t == "object" && !a.isValidElement(t) ? t : {
275
- message: t
276
- };
277
- this.create({
278
- id: s,
279
- type: "error",
280
- description: T,
281
- ...N
282
- });
283
- } else if (e.success !== void 0) {
284
- d = !1;
285
- const t = typeof e.success == "function" ? await e.success(i) : e.success, T = typeof e.description == "function" ? await e.description(i) : e.description, N = typeof t == "object" && !a.isValidElement(t) ? t : {
286
- message: t
287
- };
288
- this.create({
289
- id: s,
290
- type: "success",
291
- description: T,
292
- ...N
293
- });
294
- }
295
- }).catch(async (i) => {
296
- if (u = [
297
- "reject",
298
- i
299
- ], e.error !== void 0) {
300
- d = !1;
301
- const S = typeof e.error == "function" ? await e.error(i) : e.error, t = typeof e.description == "function" ? await e.description(i) : e.description, z = typeof S == "object" && !a.isValidElement(S) ? S : {
302
- message: S
303
- };
304
- this.create({
305
- id: s,
306
- type: "error",
307
- description: t,
308
- ...z
309
- });
310
- }
311
- }).finally(() => {
312
- d && (this.dismiss(s), s = void 0), e.finally == null || e.finally.call(e);
313
- }), h = () => new Promise((i, S) => v.then(() => u[0] === "reject" ? S(u[1]) : i(u[1])).catch(S));
314
- return typeof s != "string" && typeof s != "number" ? {
315
- unwrap: h
316
- } : Object.assign(s, {
317
- unwrap: h
318
- });
319
- }, this.custom = (o, e) => {
320
- const s = e?.id || Tt++;
321
- return this.create({
322
- jsx: o(s),
323
- id: s,
324
- ...e
325
- }), s;
326
- }, this.getActiveToasts = () => this.toasts.filter((o) => !this.dismissedToasts.has(o.id)), this.subscribers = [], this.toasts = [], this.dismissedToasts = /* @__PURE__ */ new Set();
327
- }
328
- }
329
- const k = new fe(), pe = (n, o) => {
330
- const e = o?.id || Tt++;
331
- return k.addToast({
332
- title: n,
333
- ...o,
334
- id: e
335
- }), e;
336
- }, ge = (n) => n && typeof n == "object" && "ok" in n && typeof n.ok == "boolean" && "status" in n && typeof n.status == "number", he = pe, be = () => k.toasts, ve = () => k.getActiveToasts(), ye = Object.assign(he, {
337
- success: k.success,
338
- info: k.info,
339
- warning: k.warning,
340
- error: k.error,
341
- custom: k.custom,
342
- message: k.message,
343
- promise: k.promise,
344
- dismiss: k.dismiss,
345
- loading: k.loading
346
- }, {
347
- getHistory: be,
348
- getToasts: ve
349
- });
350
- oe("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
351
- function gt(n) {
352
- return n.label !== void 0;
353
- }
354
- const xe = 3, we = "24px", Ee = "16px", At = 4e3, Te = 356, Ne = 14, Se = 45, ke = 200;
355
- function O(...n) {
356
- return n.filter(Boolean).join(" ");
357
- }
358
- function _e(n) {
359
- const [o, e] = n.split("-"), s = [];
360
- return o && s.push(o), e && s.push(e), s;
361
- }
362
- const Ie = (n) => {
363
- var o, e, s, w, d, u, v, h, i;
364
- const { invert: S, toast: t, unstyled: T, interacting: z, setHeights: N, visibleToasts: ht, heights: U, index: c, toasts: nt, expanded: X, removeToast: rt, defaultRichColors: bt, closeButton: H, style: tt, cancelButtonStyle: Y, actionButtonStyle: vt, className: it = "", descriptionClassName: yt = "", duration: et, position: A, gap: lt, expandByDefault: at, classNames: m, icons: y, closeButtonAriaLabel: $ = "Close toast" } = n, [V, B] = a.useState(null), [F, dt] = a.useState(null), [l, g] = a.useState(!1), [p, D] = a.useState(!1), [K, f] = a.useState(!1), [q, ct] = a.useState(!1), [ut, G] = a.useState(!1), [jt, xt] = a.useState(0), [Pt, St] = a.useState(0), ot = a.useRef(t.duration || et || At), kt = a.useRef(null), j = a.useRef(null), $t = c === 0, Lt = c + 1 <= ht, _ = t.type, Q = t.dismissible !== !1, Yt = t.className || "", Vt = t.descriptionClassName || "", mt = a.useMemo(() => U.findIndex((r) => r.toastId === t.id) || 0, [
365
- U,
366
- t.id
367
- ]), Ft = a.useMemo(() => {
368
- var r;
369
- return (r = t.closeButton) != null ? r : H;
370
- }, [
371
- t.closeButton,
372
- H
373
- ]), _t = a.useMemo(() => t.duration || et || At, [
374
- t.duration,
375
- et
376
- ]), wt = a.useRef(0), J = a.useRef(0), It = a.useRef(0), Z = a.useRef(null), [Wt, Ut] = A.split("-"), Dt = a.useMemo(() => U.reduce((r, b, E) => E >= mt ? r : r + b.height, 0), [
377
- U,
378
- mt
379
- ]), Rt = me(), Xt = t.invert || S, Et = _ === "loading";
380
- J.current = a.useMemo(() => mt * lt + Dt, [
381
- mt,
382
- Dt
383
- ]), a.useEffect(() => {
384
- ot.current = _t;
385
- }, [
386
- _t
387
- ]), a.useEffect(() => {
388
- g(!0);
389
- }, []), a.useEffect(() => {
390
- const r = j.current;
391
- if (r) {
392
- const b = r.getBoundingClientRect().height;
393
- return St(b), N((E) => [
394
- {
395
- toastId: t.id,
396
- height: b,
397
- position: t.position
398
- },
399
- ...E
400
- ]), () => N((E) => E.filter((I) => I.toastId !== t.id));
401
- }
402
- }, [
403
- N,
404
- t.id
405
- ]), a.useLayoutEffect(() => {
406
- if (!l) return;
407
- const r = j.current, b = r.style.height;
408
- r.style.height = "auto";
409
- const E = r.getBoundingClientRect().height;
410
- r.style.height = b, St(E), N((I) => I.find((x) => x.toastId === t.id) ? I.map((x) => x.toastId === t.id ? {
411
- ...x,
412
- height: E
413
- } : x) : [
414
- {
415
- toastId: t.id,
416
- height: E,
417
- position: t.position
418
- },
419
- ...I
420
- ]);
421
- }, [
422
- l,
423
- t.title,
424
- t.description,
425
- N,
426
- t.id,
427
- t.jsx,
428
- t.action,
429
- t.cancel
430
- ]);
431
- const L = a.useCallback(() => {
432
- D(!0), xt(J.current), N((r) => r.filter((b) => b.toastId !== t.id)), setTimeout(() => {
433
- rt(t);
434
- }, ke);
435
- }, [
436
- t,
437
- rt,
438
- N,
439
- J
440
- ]);
441
- a.useEffect(() => {
442
- if (t.promise && _ === "loading" || t.duration === 1 / 0 || t.type === "loading") return;
443
- let r;
444
- return X || z || Rt ? (() => {
445
- if (It.current < wt.current) {
446
- const I = (/* @__PURE__ */ new Date()).getTime() - wt.current;
447
- ot.current = ot.current - I;
448
- }
449
- It.current = (/* @__PURE__ */ new Date()).getTime();
450
- })() : ot.current !== 1 / 0 && (wt.current = (/* @__PURE__ */ new Date()).getTime(), r = setTimeout(() => {
451
- t.onAutoClose == null || t.onAutoClose.call(t, t), L();
452
- }, ot.current)), () => clearTimeout(r);
453
- }, [
454
- X,
455
- z,
456
- t,
457
- _,
458
- Rt,
459
- L
460
- ]), a.useEffect(() => {
461
- t.delete && (L(), t.onDismiss == null || t.onDismiss.call(t, t));
462
- }, [
463
- L,
464
- t.delete
465
- ]);
466
- function Kt() {
467
- var r;
468
- if (y?.loading) {
469
- var b;
470
- return /* @__PURE__ */ a.createElement("div", {
471
- className: O(m?.loader, t == null || (b = t.classNames) == null ? void 0 : b.loader, "sonner-loader"),
472
- "data-visible": _ === "loading"
473
- }, y.loading);
474
- }
475
- return /* @__PURE__ */ a.createElement(re, {
476
- className: O(m?.loader, t == null || (r = t.classNames) == null ? void 0 : r.loader),
477
- visible: _ === "loading"
478
- });
479
- }
480
- const qt = t.icon || y?.[_] || se(_);
481
- var Bt, Mt;
482
- return /* @__PURE__ */ a.createElement("li", {
483
- tabIndex: 0,
484
- ref: j,
485
- className: O(it, Yt, m?.toast, t == null || (o = t.classNames) == null ? void 0 : o.toast, m?.default, m?.[_], t == null || (e = t.classNames) == null ? void 0 : e[_]),
486
- "data-sonner-toast": "",
487
- "data-rich-colors": (Bt = t.richColors) != null ? Bt : bt,
488
- "data-styled": !(t.jsx || t.unstyled || T),
489
- "data-mounted": l,
490
- "data-promise": !!t.promise,
491
- "data-swiped": ut,
492
- "data-removed": p,
493
- "data-visible": Lt,
494
- "data-y-position": Wt,
495
- "data-x-position": Ut,
496
- "data-index": c,
497
- "data-front": $t,
498
- "data-swiping": K,
499
- "data-dismissible": Q,
500
- "data-type": _,
501
- "data-invert": Xt,
502
- "data-swipe-out": q,
503
- "data-swipe-direction": F,
504
- "data-expanded": !!(X || at && l),
505
- "data-testid": t.testId,
506
- style: {
507
- "--index": c,
508
- "--toasts-before": c,
509
- "--z-index": nt.length - c,
510
- "--offset": `${p ? jt : J.current}px`,
511
- "--initial-height": at ? "auto" : `${Pt}px`,
512
- ...tt,
513
- ...t.style
514
- },
515
- onDragEnd: () => {
516
- f(!1), B(null), Z.current = null;
517
- },
518
- onPointerDown: (r) => {
519
- r.button !== 2 && (Et || !Q || (kt.current = /* @__PURE__ */ new Date(), xt(J.current), r.target.setPointerCapture(r.pointerId), r.target.tagName !== "BUTTON" && (f(!0), Z.current = {
520
- x: r.clientX,
521
- y: r.clientY
522
- })));
523
- },
524
- onPointerUp: () => {
525
- var r, b, E;
526
- if (q || !Q) return;
527
- Z.current = null;
528
- const I = Number(((r = j.current) == null ? void 0 : r.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0), ft = Number(((b = j.current) == null ? void 0 : b.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0), x = (/* @__PURE__ */ new Date()).getTime() - ((E = kt.current) == null ? void 0 : E.getTime()), R = V === "x" ? I : ft, pt = Math.abs(R) / x;
529
- if (Math.abs(R) >= Se || pt > 0.11) {
530
- xt(J.current), t.onDismiss == null || t.onDismiss.call(t, t), dt(V === "x" ? I > 0 ? "right" : "left" : ft > 0 ? "down" : "up"), L(), ct(!0);
531
- return;
532
- } else {
533
- var M, C;
534
- (M = j.current) == null || M.style.setProperty("--swipe-amount-x", "0px"), (C = j.current) == null || C.style.setProperty("--swipe-amount-y", "0px");
535
- }
536
- G(!1), f(!1), B(null);
537
- },
538
- onPointerMove: (r) => {
539
- var b, E, I;
540
- if (!Z.current || !Q || ((b = window.getSelection()) == null ? void 0 : b.toString().length) > 0) return;
541
- const x = r.clientY - Z.current.y, R = r.clientX - Z.current.x;
542
- var pt;
543
- const M = (pt = n.swipeDirections) != null ? pt : _e(A);
544
- !V && (Math.abs(R) > 1 || Math.abs(x) > 1) && B(Math.abs(R) > Math.abs(x) ? "x" : "y");
545
- let C = {
546
- x: 0,
547
- y: 0
548
- };
549
- const Ct = (W) => 1 / (1.5 + Math.abs(W) / 20);
550
- if (V === "y") {
551
- if (M.includes("top") || M.includes("bottom"))
552
- if (M.includes("top") && x < 0 || M.includes("bottom") && x > 0)
553
- C.y = x;
554
- else {
555
- const W = x * Ct(x);
556
- C.y = Math.abs(W) < Math.abs(x) ? W : x;
557
- }
558
- } else if (V === "x" && (M.includes("left") || M.includes("right")))
559
- if (M.includes("left") && R < 0 || M.includes("right") && R > 0)
560
- C.x = R;
561
- else {
562
- const W = R * Ct(R);
563
- C.x = Math.abs(W) < Math.abs(R) ? W : R;
564
- }
565
- (Math.abs(C.x) > 0 || Math.abs(C.y) > 0) && G(!0), (E = j.current) == null || E.style.setProperty("--swipe-amount-x", `${C.x}px`), (I = j.current) == null || I.style.setProperty("--swipe-amount-y", `${C.y}px`);
566
- }
567
- }, Ft && !t.jsx && _ !== "loading" ? /* @__PURE__ */ a.createElement("button", {
568
- "aria-label": $,
569
- "data-disabled": Et,
570
- "data-close-button": !0,
571
- onClick: Et || !Q ? () => {
572
- } : () => {
573
- L(), t.onDismiss == null || t.onDismiss.call(t, t);
574
- },
575
- className: O(m?.closeButton, t == null || (s = t.classNames) == null ? void 0 : s.closeButton)
576
- }, (Mt = y?.close) != null ? Mt : ue) : null, (_ || t.icon || t.promise) && t.icon !== null && (y?.[_] !== null || t.icon) ? /* @__PURE__ */ a.createElement("div", {
577
- "data-icon": "",
578
- className: O(m?.icon, t == null || (w = t.classNames) == null ? void 0 : w.icon)
579
- }, t.promise || t.type === "loading" && !t.icon ? t.icon || Kt() : null, t.type !== "loading" ? qt : null) : null, /* @__PURE__ */ a.createElement("div", {
580
- "data-content": "",
581
- className: O(m?.content, t == null || (d = t.classNames) == null ? void 0 : d.content)
582
- }, /* @__PURE__ */ a.createElement("div", {
583
- "data-title": "",
584
- className: O(m?.title, t == null || (u = t.classNames) == null ? void 0 : u.title)
585
- }, t.jsx ? t.jsx : typeof t.title == "function" ? t.title() : t.title), t.description ? /* @__PURE__ */ a.createElement("div", {
586
- "data-description": "",
587
- className: O(yt, Vt, m?.description, t == null || (v = t.classNames) == null ? void 0 : v.description)
588
- }, typeof t.description == "function" ? t.description() : t.description) : null), /* @__PURE__ */ a.isValidElement(t.cancel) ? t.cancel : t.cancel && gt(t.cancel) ? /* @__PURE__ */ a.createElement("button", {
589
- "data-button": !0,
590
- "data-cancel": !0,
591
- style: t.cancelButtonStyle || Y,
592
- onClick: (r) => {
593
- gt(t.cancel) && Q && (t.cancel.onClick == null || t.cancel.onClick.call(t.cancel, r), L());
594
- },
595
- className: O(m?.cancelButton, t == null || (h = t.classNames) == null ? void 0 : h.cancelButton)
596
- }, t.cancel.label) : null, /* @__PURE__ */ a.isValidElement(t.action) ? t.action : t.action && gt(t.action) ? /* @__PURE__ */ a.createElement("button", {
597
- "data-button": !0,
598
- "data-action": !0,
599
- style: t.actionButtonStyle || vt,
600
- onClick: (r) => {
601
- gt(t.action) && (t.action.onClick == null || t.action.onClick.call(t.action, r), !r.defaultPrevented && L());
602
- },
603
- className: O(m?.actionButton, t == null || (i = t.classNames) == null ? void 0 : i.actionButton)
604
- }, t.action.label) : null);
605
- };
606
- function Ot() {
607
- if (typeof window > "u" || typeof document > "u") return "ltr";
608
- const n = document.documentElement.getAttribute("dir");
609
- return n === "auto" || !n ? window.getComputedStyle(document.documentElement).direction : n;
610
- }
611
- function De(n, o) {
612
- const e = {};
613
- return [
614
- n,
615
- o
616
- ].forEach((s, w) => {
617
- const d = w === 1, u = d ? "--mobile-offset" : "--offset", v = d ? Ee : we;
618
- function h(i) {
619
- [
620
- "top",
621
- "right",
622
- "bottom",
623
- "left"
624
- ].forEach((S) => {
625
- e[`${u}-${S}`] = typeof i == "number" ? `${i}px` : i;
626
- });
627
- }
628
- typeof s == "number" || typeof s == "string" ? h(s) : typeof s == "object" ? [
629
- "top",
630
- "right",
631
- "bottom",
632
- "left"
633
- ].forEach((i) => {
634
- s[i] === void 0 ? e[`${u}-${i}`] = v : e[`${u}-${i}`] = typeof s[i] == "number" ? `${s[i]}px` : s[i];
635
- }) : h(v);
636
- }), e;
637
- }
638
- const Re = /* @__PURE__ */ a.forwardRef(function(o, e) {
639
- const { id: s, invert: w, position: d = "bottom-right", hotkey: u = [
640
- "altKey",
641
- "KeyT"
642
- ], expand: v, closeButton: h, className: i, offset: S, mobileOffset: t, theme: T = "light", richColors: z, duration: N, style: ht, visibleToasts: U = xe, toastOptions: c, dir: nt = Ot(), gap: X = Ne, icons: rt, containerAriaLabel: bt = "Notifications" } = o, [H, tt] = a.useState([]), Y = a.useMemo(() => s ? H.filter((l) => l.toasterId === s) : H.filter((l) => !l.toasterId), [
643
- H,
644
- s
645
- ]), vt = a.useMemo(() => Array.from(new Set([
646
- d
647
- ].concat(Y.filter((l) => l.position).map((l) => l.position)))), [
648
- Y,
649
- d
650
- ]), [it, yt] = a.useState([]), [et, A] = a.useState(!1), [lt, at] = a.useState(!1), [m, y] = a.useState(T !== "system" ? T : typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"), $ = a.useRef(null), V = u.join("+").replace(/Key/g, "").replace(/Digit/g, ""), B = a.useRef(null), F = a.useRef(!1), dt = a.useCallback((l) => {
651
- tt((g) => {
652
- var p;
653
- return (p = g.find((D) => D.id === l.id)) != null && p.delete || k.dismiss(l.id), g.filter(({ id: D }) => D !== l.id);
654
- });
655
- }, []);
656
- return a.useEffect(() => k.subscribe((l) => {
657
- if (l.dismiss) {
658
- requestAnimationFrame(() => {
659
- tt((g) => g.map((p) => p.id === l.id ? {
660
- ...p,
661
- delete: !0
662
- } : p));
663
- });
664
- return;
665
- }
666
- setTimeout(() => {
667
- ae.flushSync(() => {
668
- tt((g) => {
669
- const p = g.findIndex((D) => D.id === l.id);
670
- return p !== -1 ? [
671
- ...g.slice(0, p),
672
- {
673
- ...g[p],
674
- ...l
675
- },
676
- ...g.slice(p + 1)
677
- ] : [
678
- l,
679
- ...g
680
- ];
681
- });
682
- });
683
- });
684
- }), [
685
- H
686
- ]), a.useEffect(() => {
687
- if (T !== "system") {
688
- y(T);
689
- return;
690
- }
691
- if (T === "system" && (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? y("dark") : y("light")), typeof window > "u") return;
692
- const l = window.matchMedia("(prefers-color-scheme: dark)");
693
- try {
694
- l.addEventListener("change", ({ matches: g }) => {
695
- y(g ? "dark" : "light");
696
- });
697
- } catch {
698
- l.addListener(({ matches: p }) => {
699
- try {
700
- y(p ? "dark" : "light");
701
- } catch (D) {
702
- console.error(D);
703
- }
704
- });
705
- }
706
- }, [
707
- T
708
- ]), a.useEffect(() => {
709
- H.length <= 1 && A(!1);
710
- }, [
711
- H
712
- ]), a.useEffect(() => {
713
- const l = (g) => {
714
- var p;
715
- if (u.every((f) => g[f] || g.code === f)) {
716
- var K;
717
- A(!0), (K = $.current) == null || K.focus();
718
- }
719
- g.code === "Escape" && (document.activeElement === $.current || (p = $.current) != null && p.contains(document.activeElement)) && A(!1);
720
- };
721
- return document.addEventListener("keydown", l), () => document.removeEventListener("keydown", l);
722
- }, [
723
- u
724
- ]), a.useEffect(() => {
725
- if ($.current)
726
- return () => {
727
- B.current && (B.current.focus({
728
- preventScroll: !0
729
- }), B.current = null, F.current = !1);
730
- };
731
- }, [
732
- $.current
733
- ]), // Remove item from normal navigation flow, only available via hotkey
734
- /* @__PURE__ */ a.createElement("section", {
735
- ref: e,
736
- "aria-label": `${bt} ${V}`,
737
- tabIndex: -1,
738
- "aria-live": "polite",
739
- "aria-relevant": "additions text",
740
- "aria-atomic": "false",
741
- suppressHydrationWarning: !0
742
- }, vt.map((l, g) => {
743
- var p;
744
- const [D, K] = l.split("-");
745
- return Y.length ? /* @__PURE__ */ a.createElement("ol", {
746
- key: l,
747
- dir: nt === "auto" ? Ot() : nt,
748
- tabIndex: -1,
749
- ref: $,
750
- className: i,
751
- "data-sonner-toaster": !0,
752
- "data-sonner-theme": m,
753
- "data-y-position": D,
754
- "data-x-position": K,
755
- style: {
756
- "--front-toast-height": `${((p = it[0]) == null ? void 0 : p.height) || 0}px`,
757
- "--width": `${Te}px`,
758
- "--gap": `${X}px`,
759
- ...ht,
760
- ...De(S, t)
761
- },
762
- onBlur: (f) => {
763
- F.current && !f.currentTarget.contains(f.relatedTarget) && (F.current = !1, B.current && (B.current.focus({
764
- preventScroll: !0
765
- }), B.current = null));
766
- },
767
- onFocus: (f) => {
768
- f.target instanceof HTMLElement && f.target.dataset.dismissible === "false" || F.current || (F.current = !0, B.current = f.relatedTarget);
769
- },
770
- onMouseEnter: () => A(!0),
771
- onMouseMove: () => A(!0),
772
- onMouseLeave: () => {
773
- lt || A(!1);
774
- },
775
- onDragEnd: () => A(!1),
776
- onPointerDown: (f) => {
777
- f.target instanceof HTMLElement && f.target.dataset.dismissible === "false" || at(!0);
778
- },
779
- onPointerUp: () => at(!1)
780
- }, Y.filter((f) => !f.position && g === 0 || f.position === l).map((f, q) => {
781
- var ct, ut;
782
- return /* @__PURE__ */ a.createElement(Ie, {
783
- key: f.id,
784
- icons: rt,
785
- index: q,
786
- toast: f,
787
- defaultRichColors: z,
788
- duration: (ct = c?.duration) != null ? ct : N,
789
- className: c?.className,
790
- descriptionClassName: c?.descriptionClassName,
791
- invert: w,
792
- visibleToasts: U,
793
- closeButton: (ut = c?.closeButton) != null ? ut : h,
794
- interacting: lt,
795
- position: l,
796
- style: c?.style,
797
- unstyled: c?.unstyled,
798
- classNames: c?.classNames,
799
- cancelButtonStyle: c?.cancelButtonStyle,
800
- actionButtonStyle: c?.actionButtonStyle,
801
- closeButtonAriaLabel: c?.closeButtonAriaLabel,
802
- removeToast: dt,
803
- toasts: Y.filter((G) => G.position == f.position),
804
- heights: it.filter((G) => G.position == f.position),
805
- setHeights: yt,
806
- expandByDefault: v,
807
- gap: X,
808
- expanded: et,
809
- swipeDirections: o.swipeDirections
810
- });
811
- })) : null;
812
- }));
813
- }), Be = zt("rounded-md border px-4 py-3 text-sm flex items-start gap-3 shadow-lg min-w-[300px] max-w-[420px]", {
814
- variants: {
815
- variant: {
816
- default: "bg-toast-bg border-toast-border text-toast-text",
817
- success: "bg-toast-success-bg border-toast-success-border text-toast-success-text",
818
- error: "bg-toast-danger-bg border-toast-danger-border text-toast-danger-text",
819
- info: "bg-toast-info-bg border-toast-info-border text-toast-info-text",
820
- warning: "bg-toast-warning-bg border-toast-warning-border text-toast-warning-text"
821
- }
822
- },
823
- defaultVariants: {
824
- variant: "default"
825
- }
826
- }), Me = zt("mt-1 text-sm opacity-90", {
827
- variants: {
828
- variant: {
829
- default: "text-toast-text",
830
- success: "text-toast-success-text",
831
- error: "text-toast-danger-text",
832
- info: "text-toast-info-text",
833
- warning: "text-toast-warning-text"
834
- }
835
- },
836
- defaultVariants: {
837
- variant: "default"
838
- }
839
- }), Ce = {
840
- default: null,
841
- success: /* @__PURE__ */ P(Qt, { className: "text-toast-success-icon size-5 shrink-0" }),
842
- info: /* @__PURE__ */ P(Zt, { className: "text-toast-info-icon size-5 shrink-0" }),
843
- warning: /* @__PURE__ */ P(te, { className: "text-toast-warning-icon size-5 shrink-0" }),
844
- error: /* @__PURE__ */ P(Jt, { className: "text-toast-danger-icon size-5 shrink-0" })
845
- }, Ht = ({ gap: n = 14, offset: o = 32, position: e = "bottom-right", visibleToasts: s = 3, ...w }) => /* @__PURE__ */ P(
846
- Re,
847
- {
848
- position: e,
849
- visibleToasts: s,
850
- offset: o,
851
- gap: n,
852
- toastOptions: {
853
- unstyled: !0,
854
- classNames: {
855
- toast: "spectral-toast"
856
- }
857
- },
858
- ...w
859
- }
860
- );
861
- Ht.displayName = "Toast.Provider";
862
- const Nt = ({ className: n, containerAriaLabel: o = "Notification", dataTestId: e, icon: s, message: w, variant: d = "default" }) => {
863
- const u = d ?? "default", v = s ?? Ce[u];
864
- return /* @__PURE__ */ Gt("div", { "aria-label": o, className: ee(Be({ variant: u }), n), "data-variant": u, "data-testid": e ?? `spectral-toast-${u}`, role: "status", "aria-live": "polite", children: [
865
- v && /* @__PURE__ */ P("div", { className: "mt-0.5", "aria-hidden": "true", children: v }),
866
- /* @__PURE__ */ P("div", { className: "flex flex-col", children: /* @__PURE__ */ P("p", { className: Me({ variant: u }), children: w }) })
867
- ] });
868
- };
869
- Nt.displayName = "Toast";
870
- const st = ({ className: n, containerAriaLabel: o, dataTestId: e, duration: s = 4e3, icon: w, message: d, onAutoClose: u, position: v, variant: h = "default" }) => ye.custom((i) => /* @__PURE__ */ P(Nt, { className: n, containerAriaLabel: o, dataTestId: e, icon: w, id: i, message: d, variant: h }), {
871
- duration: s,
872
- onAutoClose: u,
873
- position: v
874
- }), to = Object.assign(Nt, {
875
- Provider: Ht
876
- }), eo = Object.assign(st, {
877
- success: (n) => st({ ...n, variant: "success" }),
878
- error: (n) => st({ ...n, variant: "error" }),
879
- info: (n) => st({ ...n, variant: "info" }),
880
- warning: (n) => st({ ...n, variant: "warning" })
881
- });
882
- export {
883
- to as Toast,
884
- eo as toast
885
- };
1
+ import { n as e, t } from "./Toast-9zqXxKKO.js";
2
+ export { t as Toast, e as toast };