@gv-tech/ui-web 2.14.0 → 2.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/dist/{alert-dialog.cjs.js → alert-dialog.cjs} +1 -1
  2. package/dist/{alert-dialog.es.js → alert-dialog.mjs} +1 -1
  3. package/dist/calendar.cjs +1 -0
  4. package/dist/{calendar.es.js → calendar.mjs} +1 -1
  5. package/dist/carousel.cjs +1 -0
  6. package/dist/{carousel.es.js → carousel.mjs} +1 -1
  7. package/dist/chart.cjs +7 -0
  8. package/dist/chart.mjs +188 -0
  9. package/dist/command.cjs +1 -0
  10. package/dist/{command.es.js → command.mjs} +1 -1
  11. package/dist/drawer.cjs +1 -0
  12. package/dist/drawer.mjs +55 -0
  13. package/dist/form.cjs +1 -0
  14. package/dist/form.mjs +72 -0
  15. package/dist/index.cjs +1 -0
  16. package/dist/index.d.ts +52 -0
  17. package/dist/{index.es.js → index.mjs} +66 -65
  18. package/dist/pagination.cjs +1 -0
  19. package/dist/{pagination.es.js → pagination.mjs} +1 -1
  20. package/dist/search.cjs +1 -0
  21. package/dist/{search.es.js → search.mjs} +2 -2
  22. package/dist/sonner.cjs +1 -0
  23. package/dist/sonner.mjs +26 -0
  24. package/dist/theme-provider.cjs +1 -0
  25. package/dist/theme-provider.mjs +9 -0
  26. package/dist/theme-toggle-B4VZTDpe.js +1 -0
  27. package/dist/{theme-toggle.es.js → theme-toggle-WtPW9UZi.mjs} +21 -21
  28. package/dist/theme-toggle.cjs +1 -0
  29. package/dist/theme-toggle.mjs +10 -0
  30. package/dist/toaster-C_S9hnXa.js +1 -0
  31. package/dist/{toaster-jBYXAPRk.mjs → toaster-k5DnQSsh.mjs} +1 -1
  32. package/dist/{toaster.cjs.js → toaster.cjs} +1 -1
  33. package/dist/{toaster.es.js → toaster.mjs} +2 -2
  34. package/package.json +10 -9
  35. package/src/index.ts +3 -0
  36. package/dist/calendar.cjs.js +0 -1
  37. package/dist/carousel.cjs.js +0 -1
  38. package/dist/chart.cjs.js +0 -16
  39. package/dist/chart.es.js +0 -4403
  40. package/dist/command.cjs.js +0 -1
  41. package/dist/drawer.cjs.js +0 -3
  42. package/dist/drawer.es.js +0 -1086
  43. package/dist/form.cjs.js +0 -1
  44. package/dist/form.es.js +0 -356
  45. package/dist/index-CsjrqSSN.js +0 -1
  46. package/dist/index-DAWHN3cH.mjs +0 -85
  47. package/dist/index.cjs.js +0 -1
  48. package/dist/pagination.cjs.js +0 -1
  49. package/dist/search.cjs.js +0 -1
  50. package/dist/sonner.cjs.js +0 -1
  51. package/dist/sonner.es.js +0 -765
  52. package/dist/theme-provider.cjs.js +0 -1
  53. package/dist/theme-provider.es.js +0 -9
  54. package/dist/theme-toggle.cjs.js +0 -1
  55. package/dist/toaster-CIpfms4W.js +0 -1
  56. /package/dist/{accordion.cjs.js → accordion.cjs} +0 -0
  57. /package/dist/{accordion.es.js → accordion.mjs} +0 -0
  58. /package/dist/{alert.cjs.js → alert.cjs} +0 -0
  59. /package/dist/{alert.es.js → alert.mjs} +0 -0
  60. /package/dist/{aspect-ratio.cjs.js → aspect-ratio.cjs} +0 -0
  61. /package/dist/{aspect-ratio.es.js → aspect-ratio.mjs} +0 -0
  62. /package/dist/{avatar.cjs.js → avatar.cjs} +0 -0
  63. /package/dist/{avatar.es.js → avatar.mjs} +0 -0
  64. /package/dist/{badge.cjs.js → badge.cjs} +0 -0
  65. /package/dist/{badge.es.js → badge.mjs} +0 -0
  66. /package/dist/{breadcrumb.cjs.js → breadcrumb.cjs} +0 -0
  67. /package/dist/{breadcrumb.es.js → breadcrumb.mjs} +0 -0
  68. /package/dist/{button.cjs.js → button.cjs} +0 -0
  69. /package/dist/{button.es.js → button.mjs} +0 -0
  70. /package/dist/{card.cjs.js → card.cjs} +0 -0
  71. /package/dist/{card.es.js → card.mjs} +0 -0
  72. /package/dist/{checkbox.cjs.js → checkbox.cjs} +0 -0
  73. /package/dist/{checkbox.es.js → checkbox.mjs} +0 -0
  74. /package/dist/{collapsible.cjs.js → collapsible.cjs} +0 -0
  75. /package/dist/{collapsible.es.js → collapsible.mjs} +0 -0
  76. /package/dist/{context-menu.cjs.js → context-menu.cjs} +0 -0
  77. /package/dist/{context-menu.es.js → context-menu.mjs} +0 -0
  78. /package/dist/{dialog.cjs.js → dialog.cjs} +0 -0
  79. /package/dist/{dialog.es.js → dialog.mjs} +0 -0
  80. /package/dist/{dropdown-menu.cjs.js → dropdown-menu.cjs} +0 -0
  81. /package/dist/{dropdown-menu.es.js → dropdown-menu.mjs} +0 -0
  82. /package/dist/{hover-card.cjs.js → hover-card.cjs} +0 -0
  83. /package/dist/{hover-card.es.js → hover-card.mjs} +0 -0
  84. /package/dist/{input.cjs.js → input.cjs} +0 -0
  85. /package/dist/{input.es.js → input.mjs} +0 -0
  86. /package/dist/{label.cjs.js → label.cjs} +0 -0
  87. /package/dist/{label.es.js → label.mjs} +0 -0
  88. /package/dist/{menubar.cjs.js → menubar.cjs} +0 -0
  89. /package/dist/{menubar.es.js → menubar.mjs} +0 -0
  90. /package/dist/{navigation-menu.cjs.js → navigation-menu.cjs} +0 -0
  91. /package/dist/{navigation-menu.es.js → navigation-menu.mjs} +0 -0
  92. /package/dist/{popover.cjs.js → popover.cjs} +0 -0
  93. /package/dist/{popover.es.js → popover.mjs} +0 -0
  94. /package/dist/{progress.cjs.js → progress.cjs} +0 -0
  95. /package/dist/{progress.es.js → progress.mjs} +0 -0
  96. /package/dist/{radio-group.cjs.js → radio-group.cjs} +0 -0
  97. /package/dist/{radio-group.es.js → radio-group.mjs} +0 -0
  98. /package/dist/{resizable.cjs.js → resizable.cjs} +0 -0
  99. /package/dist/{resizable.es.js → resizable.mjs} +0 -0
  100. /package/dist/{scroll-area.cjs.js → scroll-area.cjs} +0 -0
  101. /package/dist/{scroll-area.es.js → scroll-area.mjs} +0 -0
  102. /package/dist/{select.cjs.js → select.cjs} +0 -0
  103. /package/dist/{select.es.js → select.mjs} +0 -0
  104. /package/dist/{separator.cjs.js → separator.cjs} +0 -0
  105. /package/dist/{separator.es.js → separator.mjs} +0 -0
  106. /package/dist/{sheet.cjs.js → sheet.cjs} +0 -0
  107. /package/dist/{sheet.es.js → sheet.mjs} +0 -0
  108. /package/dist/{skeleton.cjs.js → skeleton.cjs} +0 -0
  109. /package/dist/{skeleton.es.js → skeleton.mjs} +0 -0
  110. /package/dist/{slider.cjs.js → slider.cjs} +0 -0
  111. /package/dist/{slider.es.js → slider.mjs} +0 -0
  112. /package/dist/{switch.cjs.js → switch.cjs} +0 -0
  113. /package/dist/{switch.es.js → switch.mjs} +0 -0
  114. /package/dist/{table.cjs.js → table.cjs} +0 -0
  115. /package/dist/{table.es.js → table.mjs} +0 -0
  116. /package/dist/{tabs.cjs.js → tabs.cjs} +0 -0
  117. /package/dist/{tabs.es.js → tabs.mjs} +0 -0
  118. /package/dist/{text.cjs.js → text.cjs} +0 -0
  119. /package/dist/{text.es.js → text.mjs} +0 -0
  120. /package/dist/{textarea.cjs.js → textarea.cjs} +0 -0
  121. /package/dist/{textarea.es.js → textarea.mjs} +0 -0
  122. /package/dist/{toast.cjs.js → toast.cjs} +0 -0
  123. /package/dist/{toast.es.js → toast.mjs} +0 -0
  124. /package/dist/{toggle-group.cjs.js → toggle-group.cjs} +0 -0
  125. /package/dist/{toggle-group.es.js → toggle-group.mjs} +0 -0
  126. /package/dist/{toggle.cjs.js → toggle.cjs} +0 -0
  127. /package/dist/{toggle.es.js → toggle.mjs} +0 -0
  128. /package/dist/{tooltip.cjs.js → tooltip.cjs} +0 -0
  129. /package/dist/{tooltip.es.js → tooltip.mjs} +0 -0
package/dist/sonner.es.js DELETED
@@ -1,765 +0,0 @@
1
- "use client";
2
- import { j as Ut } from "./jsx-runtime-tc70JA_2.mjs";
3
- import { z as Xt } from "./index-DAWHN3cH.mjs";
4
- import a from "react";
5
- import Wt from "react-dom";
6
- function Kt(r) {
7
- if (typeof document > "u") return;
8
- let o = document.head || document.getElementsByTagName("head")[0], e = document.createElement("style");
9
- e.type = "text/css", o.appendChild(e), e.styleSheet ? e.styleSheet.cssText = r : e.appendChild(document.createTextNode(r));
10
- }
11
- const qt = (r) => {
12
- switch (r) {
13
- case "success":
14
- return Jt;
15
- case "info":
16
- return te;
17
- case "warning":
18
- return Zt;
19
- case "error":
20
- return ee;
21
- default:
22
- return null;
23
- }
24
- }, Gt = Array(12).fill(0), Qt = ({ visible: r, className: o }) => /* @__PURE__ */ a.createElement("div", {
25
- className: [
26
- "sonner-loading-wrapper",
27
- o
28
- ].filter(Boolean).join(" "),
29
- "data-visible": r
30
- }, /* @__PURE__ */ a.createElement("div", {
31
- className: "sonner-spinner"
32
- }, Gt.map((e, s) => /* @__PURE__ */ a.createElement("div", {
33
- className: "sonner-loading-bar",
34
- key: `spinner-bar-${s}`
35
- })))), Jt = /* @__PURE__ */ a.createElement("svg", {
36
- xmlns: "http://www.w3.org/2000/svg",
37
- viewBox: "0 0 20 20",
38
- fill: "currentColor",
39
- height: "20",
40
- width: "20"
41
- }, /* @__PURE__ */ a.createElement("path", {
42
- fillRule: "evenodd",
43
- 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",
44
- clipRule: "evenodd"
45
- })), Zt = /* @__PURE__ */ a.createElement("svg", {
46
- xmlns: "http://www.w3.org/2000/svg",
47
- viewBox: "0 0 24 24",
48
- fill: "currentColor",
49
- height: "20",
50
- width: "20"
51
- }, /* @__PURE__ */ a.createElement("path", {
52
- fillRule: "evenodd",
53
- 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",
54
- clipRule: "evenodd"
55
- })), te = /* @__PURE__ */ a.createElement("svg", {
56
- xmlns: "http://www.w3.org/2000/svg",
57
- viewBox: "0 0 20 20",
58
- fill: "currentColor",
59
- height: "20",
60
- width: "20"
61
- }, /* @__PURE__ */ a.createElement("path", {
62
- fillRule: "evenodd",
63
- 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",
64
- clipRule: "evenodd"
65
- })), ee = /* @__PURE__ */ a.createElement("svg", {
66
- xmlns: "http://www.w3.org/2000/svg",
67
- viewBox: "0 0 20 20",
68
- fill: "currentColor",
69
- height: "20",
70
- width: "20"
71
- }, /* @__PURE__ */ a.createElement("path", {
72
- fillRule: "evenodd",
73
- 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",
74
- clipRule: "evenodd"
75
- })), ae = /* @__PURE__ */ a.createElement("svg", {
76
- xmlns: "http://www.w3.org/2000/svg",
77
- width: "12",
78
- height: "12",
79
- viewBox: "0 0 24 24",
80
- fill: "none",
81
- stroke: "currentColor",
82
- strokeWidth: "1.5",
83
- strokeLinecap: "round",
84
- strokeLinejoin: "round"
85
- }, /* @__PURE__ */ a.createElement("line", {
86
- x1: "18",
87
- y1: "6",
88
- x2: "6",
89
- y2: "18"
90
- }), /* @__PURE__ */ a.createElement("line", {
91
- x1: "6",
92
- y1: "6",
93
- x2: "18",
94
- y2: "18"
95
- })), oe = () => {
96
- const [r, o] = a.useState(document.hidden);
97
- return a.useEffect(() => {
98
- const e = () => {
99
- o(document.hidden);
100
- };
101
- return document.addEventListener("visibilitychange", e), () => window.removeEventListener("visibilitychange", e);
102
- }, []), r;
103
- };
104
- let wt = 1;
105
- class se {
106
- constructor() {
107
- this.subscribe = (o) => (this.subscribers.push(o), () => {
108
- const e = this.subscribers.indexOf(o);
109
- this.subscribers.splice(e, 1);
110
- }), this.publish = (o) => {
111
- this.subscribers.forEach((e) => e(o));
112
- }, this.addToast = (o) => {
113
- this.publish(o), this.toasts = [
114
- ...this.toasts,
115
- o
116
- ];
117
- }, this.create = (o) => {
118
- var e;
119
- const { message: s, ...C } = o, u = typeof o?.id == "number" || ((e = o.id) == null ? void 0 : e.length) > 0 ? o.id : wt++, g = this.toasts.find((b) => b.id === u), _ = o.dismissible === void 0 ? !0 : o.dismissible;
120
- return this.dismissedToasts.has(u) && this.dismissedToasts.delete(u), g ? this.toasts = this.toasts.map((b) => b.id === u ? (this.publish({
121
- ...b,
122
- ...o,
123
- id: u,
124
- title: s
125
- }), {
126
- ...b,
127
- ...o,
128
- id: u,
129
- dismissible: _,
130
- title: s
131
- }) : b) : this.addToast({
132
- title: s,
133
- ...C,
134
- dismissible: _,
135
- id: u
136
- }), u;
137
- }, this.dismiss = (o) => (o ? (this.dismissedToasts.add(o), requestAnimationFrame(() => this.subscribers.forEach((e) => e({
138
- id: o,
139
- dismiss: !0
140
- })))) : this.toasts.forEach((e) => {
141
- this.subscribers.forEach((s) => s({
142
- id: e.id,
143
- dismiss: !0
144
- }));
145
- }), o), this.message = (o, e) => this.create({
146
- ...e,
147
- message: o
148
- }), this.error = (o, e) => this.create({
149
- ...e,
150
- message: o,
151
- type: "error"
152
- }), this.success = (o, e) => this.create({
153
- ...e,
154
- type: "success",
155
- message: o
156
- }), this.info = (o, e) => this.create({
157
- ...e,
158
- type: "info",
159
- message: o
160
- }), this.warning = (o, e) => this.create({
161
- ...e,
162
- type: "warning",
163
- message: o
164
- }), this.loading = (o, e) => this.create({
165
- ...e,
166
- type: "loading",
167
- message: o
168
- }), this.promise = (o, e) => {
169
- if (!e)
170
- return;
171
- let s;
172
- e.loading !== void 0 && (s = this.create({
173
- ...e,
174
- promise: o,
175
- type: "loading",
176
- message: e.loading,
177
- description: typeof e.description != "function" ? e.description : void 0
178
- }));
179
- const C = Promise.resolve(o instanceof Function ? o() : o);
180
- let u = s !== void 0, g;
181
- const _ = C.then(async (i) => {
182
- if (g = [
183
- "resolve",
184
- i
185
- ], a.isValidElement(i))
186
- u = !1, this.create({
187
- id: s,
188
- type: "default",
189
- message: i
190
- });
191
- else if (re(i) && !i.ok) {
192
- u = !1;
193
- const t = typeof e.error == "function" ? await e.error(`HTTP error! status: ${i.status}`) : e.error, w = typeof e.description == "function" ? await e.description(`HTTP error! status: ${i.status}`) : e.description, E = typeof t == "object" && !a.isValidElement(t) ? t : {
194
- message: t
195
- };
196
- this.create({
197
- id: s,
198
- type: "error",
199
- description: w,
200
- ...E
201
- });
202
- } else if (i instanceof Error) {
203
- u = !1;
204
- const t = typeof e.error == "function" ? await e.error(i) : e.error, w = typeof e.description == "function" ? await e.description(i) : e.description, E = typeof t == "object" && !a.isValidElement(t) ? t : {
205
- message: t
206
- };
207
- this.create({
208
- id: s,
209
- type: "error",
210
- description: w,
211
- ...E
212
- });
213
- } else if (e.success !== void 0) {
214
- u = !1;
215
- const t = typeof e.success == "function" ? await e.success(i) : e.success, w = typeof e.description == "function" ? await e.description(i) : e.description, E = typeof t == "object" && !a.isValidElement(t) ? t : {
216
- message: t
217
- };
218
- this.create({
219
- id: s,
220
- type: "success",
221
- description: w,
222
- ...E
223
- });
224
- }
225
- }).catch(async (i) => {
226
- if (g = [
227
- "reject",
228
- i
229
- ], e.error !== void 0) {
230
- u = !1;
231
- const T = typeof e.error == "function" ? await e.error(i) : e.error, t = typeof e.description == "function" ? await e.description(i) : e.description, O = typeof T == "object" && !a.isValidElement(T) ? T : {
232
- message: T
233
- };
234
- this.create({
235
- id: s,
236
- type: "error",
237
- description: t,
238
- ...O
239
- });
240
- }
241
- }).finally(() => {
242
- u && (this.dismiss(s), s = void 0), e.finally == null || e.finally.call(e);
243
- }), b = () => new Promise((i, T) => _.then(() => g[0] === "reject" ? T(g[1]) : i(g[1])).catch(T));
244
- return typeof s != "string" && typeof s != "number" ? {
245
- unwrap: b
246
- } : Object.assign(s, {
247
- unwrap: b
248
- });
249
- }, this.custom = (o, e) => {
250
- const s = e?.id || wt++;
251
- return this.create({
252
- jsx: o(s),
253
- id: s,
254
- ...e
255
- }), s;
256
- }, this.getActiveToasts = () => this.toasts.filter((o) => !this.dismissedToasts.has(o.id)), this.subscribers = [], this.toasts = [], this.dismissedToasts = /* @__PURE__ */ new Set();
257
- }
258
- }
259
- const S = new se(), ne = (r, o) => {
260
- const e = o?.id || wt++;
261
- return S.addToast({
262
- title: r,
263
- ...o,
264
- id: e
265
- }), e;
266
- }, re = (r) => r && typeof r == "object" && "ok" in r && typeof r.ok == "boolean" && "status" in r && typeof r.status == "number", ie = ne, le = () => S.toasts, de = () => S.getActiveToasts();
267
- Object.assign(ie, {
268
- success: S.success,
269
- info: S.info,
270
- warning: S.warning,
271
- error: S.error,
272
- custom: S.custom,
273
- message: S.message,
274
- promise: S.promise,
275
- dismiss: S.dismiss,
276
- loading: S.loading
277
- }, {
278
- getHistory: le,
279
- getToasts: de
280
- });
281
- Kt("[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%)}");
282
- function mt(r) {
283
- return r.label !== void 0;
284
- }
285
- const ce = 3, ue = "24px", fe = "16px", Mt = 4e3, me = 356, pe = 14, ge = 45, he = 200;
286
- function H(...r) {
287
- return r.filter(Boolean).join(" ");
288
- }
289
- function be(r) {
290
- const [o, e] = r.split("-"), s = [];
291
- return o && s.push(o), e && s.push(e), s;
292
- }
293
- const ve = (r) => {
294
- var o, e, s, C, u, g, _, b, i;
295
- const { invert: T, toast: t, unstyled: w, interacting: O, setHeights: E, visibleToasts: pt, heights: U, index: d, toasts: ot, expanded: X, removeToast: st, defaultRichColors: gt, closeButton: z, style: Z, cancelButtonStyle: Y, actionButtonStyle: ht, className: nt = "", descriptionClassName: bt = "", duration: tt, position: A, gap: rt, expandByDefault: et, classNames: c, icons: v, closeButtonAriaLabel: P = "Close toast" } = r, [$, B] = a.useState(null), [F, it] = a.useState(null), [l, p] = a.useState(!1), [m, D] = a.useState(!1), [W, f] = a.useState(!1), [K, lt] = a.useState(!1), [dt, q] = a.useState(!1), [Ct, vt] = a.useState(0), [At, Et] = a.useState(0), at = a.useRef(t.duration || tt || Mt), Tt = a.useRef(null), j = a.useRef(null), Ht = d === 0, Ot = d + 1 <= pt, N = t.type, G = t.dismissible !== !1, zt = t.className || "", jt = t.descriptionClassName || "", ct = a.useMemo(() => U.findIndex((n) => n.toastId === t.id) || 0, [
296
- U,
297
- t.id
298
- ]), Pt = a.useMemo(() => {
299
- var n;
300
- return (n = t.closeButton) != null ? n : z;
301
- }, [
302
- t.closeButton,
303
- z
304
- ]), St = a.useMemo(() => t.duration || tt || Mt, [
305
- t.duration,
306
- tt
307
- ]), yt = a.useRef(0), Q = a.useRef(0), Nt = a.useRef(0), J = a.useRef(null), [Lt, Yt] = A.split("-"), kt = a.useMemo(() => U.reduce((n, h, x) => x >= ct ? n : n + h.height, 0), [
308
- U,
309
- ct
310
- ]), _t = oe(), $t = t.invert || T, xt = N === "loading";
311
- Q.current = a.useMemo(() => ct * rt + kt, [
312
- ct,
313
- kt
314
- ]), a.useEffect(() => {
315
- at.current = St;
316
- }, [
317
- St
318
- ]), a.useEffect(() => {
319
- p(!0);
320
- }, []), a.useEffect(() => {
321
- const n = j.current;
322
- if (n) {
323
- const h = n.getBoundingClientRect().height;
324
- return Et(h), E((x) => [
325
- {
326
- toastId: t.id,
327
- height: h,
328
- position: t.position
329
- },
330
- ...x
331
- ]), () => E((x) => x.filter((k) => k.toastId !== t.id));
332
- }
333
- }, [
334
- E,
335
- t.id
336
- ]), a.useLayoutEffect(() => {
337
- if (!l) return;
338
- const n = j.current, h = n.style.height;
339
- n.style.height = "auto";
340
- const x = n.getBoundingClientRect().height;
341
- n.style.height = h, Et(x), E((k) => k.find((y) => y.toastId === t.id) ? k.map((y) => y.toastId === t.id ? {
342
- ...y,
343
- height: x
344
- } : y) : [
345
- {
346
- toastId: t.id,
347
- height: x,
348
- position: t.position
349
- },
350
- ...k
351
- ]);
352
- }, [
353
- l,
354
- t.title,
355
- t.description,
356
- E,
357
- t.id,
358
- t.jsx,
359
- t.action,
360
- t.cancel
361
- ]);
362
- const L = a.useCallback(() => {
363
- D(!0), vt(Q.current), E((n) => n.filter((h) => h.toastId !== t.id)), setTimeout(() => {
364
- st(t);
365
- }, he);
366
- }, [
367
- t,
368
- st,
369
- E,
370
- Q
371
- ]);
372
- a.useEffect(() => {
373
- if (t.promise && N === "loading" || t.duration === 1 / 0 || t.type === "loading") return;
374
- let n;
375
- return X || O || _t ? (() => {
376
- if (Nt.current < yt.current) {
377
- const k = (/* @__PURE__ */ new Date()).getTime() - yt.current;
378
- at.current = at.current - k;
379
- }
380
- Nt.current = (/* @__PURE__ */ new Date()).getTime();
381
- })() : at.current !== 1 / 0 && (yt.current = (/* @__PURE__ */ new Date()).getTime(), n = setTimeout(() => {
382
- t.onAutoClose == null || t.onAutoClose.call(t, t), L();
383
- }, at.current)), () => clearTimeout(n);
384
- }, [
385
- X,
386
- O,
387
- t,
388
- N,
389
- _t,
390
- L
391
- ]), a.useEffect(() => {
392
- t.delete && (L(), t.onDismiss == null || t.onDismiss.call(t, t));
393
- }, [
394
- L,
395
- t.delete
396
- ]);
397
- function Ft() {
398
- var n;
399
- if (v?.loading) {
400
- var h;
401
- return /* @__PURE__ */ a.createElement("div", {
402
- className: H(c?.loader, t == null || (h = t.classNames) == null ? void 0 : h.loader, "sonner-loader"),
403
- "data-visible": N === "loading"
404
- }, v.loading);
405
- }
406
- return /* @__PURE__ */ a.createElement(Qt, {
407
- className: H(c?.loader, t == null || (n = t.classNames) == null ? void 0 : n.loader),
408
- visible: N === "loading"
409
- });
410
- }
411
- const Vt = t.icon || v?.[N] || qt(N);
412
- var Dt, Rt;
413
- return /* @__PURE__ */ a.createElement("li", {
414
- tabIndex: 0,
415
- ref: j,
416
- className: H(nt, zt, c?.toast, t == null || (o = t.classNames) == null ? void 0 : o.toast, c?.default, c?.[N], t == null || (e = t.classNames) == null ? void 0 : e[N]),
417
- "data-sonner-toast": "",
418
- "data-rich-colors": (Dt = t.richColors) != null ? Dt : gt,
419
- "data-styled": !(t.jsx || t.unstyled || w),
420
- "data-mounted": l,
421
- "data-promise": !!t.promise,
422
- "data-swiped": dt,
423
- "data-removed": m,
424
- "data-visible": Ot,
425
- "data-y-position": Lt,
426
- "data-x-position": Yt,
427
- "data-index": d,
428
- "data-front": Ht,
429
- "data-swiping": W,
430
- "data-dismissible": G,
431
- "data-type": N,
432
- "data-invert": $t,
433
- "data-swipe-out": K,
434
- "data-swipe-direction": F,
435
- "data-expanded": !!(X || et && l),
436
- "data-testid": t.testId,
437
- style: {
438
- "--index": d,
439
- "--toasts-before": d,
440
- "--z-index": ot.length - d,
441
- "--offset": `${m ? Ct : Q.current}px`,
442
- "--initial-height": et ? "auto" : `${At}px`,
443
- ...Z,
444
- ...t.style
445
- },
446
- onDragEnd: () => {
447
- f(!1), B(null), J.current = null;
448
- },
449
- onPointerDown: (n) => {
450
- n.button !== 2 && (xt || !G || (Tt.current = /* @__PURE__ */ new Date(), vt(Q.current), n.target.setPointerCapture(n.pointerId), n.target.tagName !== "BUTTON" && (f(!0), J.current = {
451
- x: n.clientX,
452
- y: n.clientY
453
- })));
454
- },
455
- onPointerUp: () => {
456
- var n, h, x;
457
- if (K || !G) return;
458
- J.current = null;
459
- const k = Number(((n = j.current) == null ? void 0 : n.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0), ut = Number(((h = j.current) == null ? void 0 : h.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0), y = (/* @__PURE__ */ new Date()).getTime() - ((x = Tt.current) == null ? void 0 : x.getTime()), R = $ === "x" ? k : ut, ft = Math.abs(R) / y;
460
- if (Math.abs(R) >= ge || ft > 0.11) {
461
- vt(Q.current), t.onDismiss == null || t.onDismiss.call(t, t), it($ === "x" ? k > 0 ? "right" : "left" : ut > 0 ? "down" : "up"), L(), lt(!0);
462
- return;
463
- } else {
464
- var M, I;
465
- (M = j.current) == null || M.style.setProperty("--swipe-amount-x", "0px"), (I = j.current) == null || I.style.setProperty("--swipe-amount-y", "0px");
466
- }
467
- q(!1), f(!1), B(null);
468
- },
469
- onPointerMove: (n) => {
470
- var h, x, k;
471
- if (!J.current || !G || ((h = window.getSelection()) == null ? void 0 : h.toString().length) > 0) return;
472
- const y = n.clientY - J.current.y, R = n.clientX - J.current.x;
473
- var ft;
474
- const M = (ft = r.swipeDirections) != null ? ft : be(A);
475
- !$ && (Math.abs(R) > 1 || Math.abs(y) > 1) && B(Math.abs(R) > Math.abs(y) ? "x" : "y");
476
- let I = {
477
- x: 0,
478
- y: 0
479
- };
480
- const Bt = (V) => 1 / (1.5 + Math.abs(V) / 20);
481
- if ($ === "y") {
482
- if (M.includes("top") || M.includes("bottom"))
483
- if (M.includes("top") && y < 0 || M.includes("bottom") && y > 0)
484
- I.y = y;
485
- else {
486
- const V = y * Bt(y);
487
- I.y = Math.abs(V) < Math.abs(y) ? V : y;
488
- }
489
- } else if ($ === "x" && (M.includes("left") || M.includes("right")))
490
- if (M.includes("left") && R < 0 || M.includes("right") && R > 0)
491
- I.x = R;
492
- else {
493
- const V = R * Bt(R);
494
- I.x = Math.abs(V) < Math.abs(R) ? V : R;
495
- }
496
- (Math.abs(I.x) > 0 || Math.abs(I.y) > 0) && q(!0), (x = j.current) == null || x.style.setProperty("--swipe-amount-x", `${I.x}px`), (k = j.current) == null || k.style.setProperty("--swipe-amount-y", `${I.y}px`);
497
- }
498
- }, Pt && !t.jsx && N !== "loading" ? /* @__PURE__ */ a.createElement("button", {
499
- "aria-label": P,
500
- "data-disabled": xt,
501
- "data-close-button": !0,
502
- onClick: xt || !G ? () => {
503
- } : () => {
504
- L(), t.onDismiss == null || t.onDismiss.call(t, t);
505
- },
506
- className: H(c?.closeButton, t == null || (s = t.classNames) == null ? void 0 : s.closeButton)
507
- }, (Rt = v?.close) != null ? Rt : ae) : null, (N || t.icon || t.promise) && t.icon !== null && (v?.[N] !== null || t.icon) ? /* @__PURE__ */ a.createElement("div", {
508
- "data-icon": "",
509
- className: H(c?.icon, t == null || (C = t.classNames) == null ? void 0 : C.icon)
510
- }, t.promise || t.type === "loading" && !t.icon ? t.icon || Ft() : null, t.type !== "loading" ? Vt : null) : null, /* @__PURE__ */ a.createElement("div", {
511
- "data-content": "",
512
- className: H(c?.content, t == null || (u = t.classNames) == null ? void 0 : u.content)
513
- }, /* @__PURE__ */ a.createElement("div", {
514
- "data-title": "",
515
- className: H(c?.title, t == null || (g = t.classNames) == null ? void 0 : g.title)
516
- }, t.jsx ? t.jsx : typeof t.title == "function" ? t.title() : t.title), t.description ? /* @__PURE__ */ a.createElement("div", {
517
- "data-description": "",
518
- className: H(bt, jt, c?.description, t == null || (_ = t.classNames) == null ? void 0 : _.description)
519
- }, typeof t.description == "function" ? t.description() : t.description) : null), /* @__PURE__ */ a.isValidElement(t.cancel) ? t.cancel : t.cancel && mt(t.cancel) ? /* @__PURE__ */ a.createElement("button", {
520
- "data-button": !0,
521
- "data-cancel": !0,
522
- style: t.cancelButtonStyle || Y,
523
- onClick: (n) => {
524
- mt(t.cancel) && G && (t.cancel.onClick == null || t.cancel.onClick.call(t.cancel, n), L());
525
- },
526
- className: H(c?.cancelButton, t == null || (b = t.classNames) == null ? void 0 : b.cancelButton)
527
- }, t.cancel.label) : null, /* @__PURE__ */ a.isValidElement(t.action) ? t.action : t.action && mt(t.action) ? /* @__PURE__ */ a.createElement("button", {
528
- "data-button": !0,
529
- "data-action": !0,
530
- style: t.actionButtonStyle || ht,
531
- onClick: (n) => {
532
- mt(t.action) && (t.action.onClick == null || t.action.onClick.call(t.action, n), !n.defaultPrevented && L());
533
- },
534
- className: H(c?.actionButton, t == null || (i = t.classNames) == null ? void 0 : i.actionButton)
535
- }, t.action.label) : null);
536
- };
537
- function It() {
538
- if (typeof window > "u" || typeof document > "u") return "ltr";
539
- const r = document.documentElement.getAttribute("dir");
540
- return r === "auto" || !r ? window.getComputedStyle(document.documentElement).direction : r;
541
- }
542
- function ye(r, o) {
543
- const e = {};
544
- return [
545
- r,
546
- o
547
- ].forEach((s, C) => {
548
- const u = C === 1, g = u ? "--mobile-offset" : "--offset", _ = u ? fe : ue;
549
- function b(i) {
550
- [
551
- "top",
552
- "right",
553
- "bottom",
554
- "left"
555
- ].forEach((T) => {
556
- e[`${g}-${T}`] = typeof i == "number" ? `${i}px` : i;
557
- });
558
- }
559
- typeof s == "number" || typeof s == "string" ? b(s) : typeof s == "object" ? [
560
- "top",
561
- "right",
562
- "bottom",
563
- "left"
564
- ].forEach((i) => {
565
- s[i] === void 0 ? e[`${g}-${i}`] = _ : e[`${g}-${i}`] = typeof s[i] == "number" ? `${s[i]}px` : s[i];
566
- }) : b(_);
567
- }), e;
568
- }
569
- const xe = /* @__PURE__ */ a.forwardRef(function(o, e) {
570
- const { id: s, invert: C, position: u = "bottom-right", hotkey: g = [
571
- "altKey",
572
- "KeyT"
573
- ], expand: _, closeButton: b, className: i, offset: T, mobileOffset: t, theme: w = "light", richColors: O, duration: E, style: pt, visibleToasts: U = ce, toastOptions: d, dir: ot = It(), gap: X = pe, icons: st, containerAriaLabel: gt = "Notifications" } = o, [z, Z] = a.useState([]), Y = a.useMemo(() => s ? z.filter((l) => l.toasterId === s) : z.filter((l) => !l.toasterId), [
574
- z,
575
- s
576
- ]), ht = a.useMemo(() => Array.from(new Set([
577
- u
578
- ].concat(Y.filter((l) => l.position).map((l) => l.position)))), [
579
- Y,
580
- u
581
- ]), [nt, bt] = a.useState([]), [tt, A] = a.useState(!1), [rt, et] = a.useState(!1), [c, v] = a.useState(w !== "system" ? w : typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"), P = a.useRef(null), $ = g.join("+").replace(/Key/g, "").replace(/Digit/g, ""), B = a.useRef(null), F = a.useRef(!1), it = a.useCallback((l) => {
582
- Z((p) => {
583
- var m;
584
- return (m = p.find((D) => D.id === l.id)) != null && m.delete || S.dismiss(l.id), p.filter(({ id: D }) => D !== l.id);
585
- });
586
- }, []);
587
- return a.useEffect(() => S.subscribe((l) => {
588
- if (l.dismiss) {
589
- requestAnimationFrame(() => {
590
- Z((p) => p.map((m) => m.id === l.id ? {
591
- ...m,
592
- delete: !0
593
- } : m));
594
- });
595
- return;
596
- }
597
- setTimeout(() => {
598
- Wt.flushSync(() => {
599
- Z((p) => {
600
- const m = p.findIndex((D) => D.id === l.id);
601
- return m !== -1 ? [
602
- ...p.slice(0, m),
603
- {
604
- ...p[m],
605
- ...l
606
- },
607
- ...p.slice(m + 1)
608
- ] : [
609
- l,
610
- ...p
611
- ];
612
- });
613
- });
614
- });
615
- }), [
616
- z
617
- ]), a.useEffect(() => {
618
- if (w !== "system") {
619
- v(w);
620
- return;
621
- }
622
- if (w === "system" && (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? v("dark") : v("light")), typeof window > "u") return;
623
- const l = window.matchMedia("(prefers-color-scheme: dark)");
624
- try {
625
- l.addEventListener("change", ({ matches: p }) => {
626
- v(p ? "dark" : "light");
627
- });
628
- } catch {
629
- l.addListener(({ matches: m }) => {
630
- try {
631
- v(m ? "dark" : "light");
632
- } catch (D) {
633
- console.error(D);
634
- }
635
- });
636
- }
637
- }, [
638
- w
639
- ]), a.useEffect(() => {
640
- z.length <= 1 && A(!1);
641
- }, [
642
- z
643
- ]), a.useEffect(() => {
644
- const l = (p) => {
645
- var m;
646
- if (g.every((f) => p[f] || p.code === f)) {
647
- var W;
648
- A(!0), (W = P.current) == null || W.focus();
649
- }
650
- p.code === "Escape" && (document.activeElement === P.current || (m = P.current) != null && m.contains(document.activeElement)) && A(!1);
651
- };
652
- return document.addEventListener("keydown", l), () => document.removeEventListener("keydown", l);
653
- }, [
654
- g
655
- ]), a.useEffect(() => {
656
- if (P.current)
657
- return () => {
658
- B.current && (B.current.focus({
659
- preventScroll: !0
660
- }), B.current = null, F.current = !1);
661
- };
662
- }, [
663
- P.current
664
- ]), // Remove item from normal navigation flow, only available via hotkey
665
- /* @__PURE__ */ a.createElement("section", {
666
- ref: e,
667
- "aria-label": `${gt} ${$}`,
668
- tabIndex: -1,
669
- "aria-live": "polite",
670
- "aria-relevant": "additions text",
671
- "aria-atomic": "false",
672
- suppressHydrationWarning: !0
673
- }, ht.map((l, p) => {
674
- var m;
675
- const [D, W] = l.split("-");
676
- return Y.length ? /* @__PURE__ */ a.createElement("ol", {
677
- key: l,
678
- dir: ot === "auto" ? It() : ot,
679
- tabIndex: -1,
680
- ref: P,
681
- className: i,
682
- "data-sonner-toaster": !0,
683
- "data-sonner-theme": c,
684
- "data-y-position": D,
685
- "data-x-position": W,
686
- style: {
687
- "--front-toast-height": `${((m = nt[0]) == null ? void 0 : m.height) || 0}px`,
688
- "--width": `${me}px`,
689
- "--gap": `${X}px`,
690
- ...pt,
691
- ...ye(T, t)
692
- },
693
- onBlur: (f) => {
694
- F.current && !f.currentTarget.contains(f.relatedTarget) && (F.current = !1, B.current && (B.current.focus({
695
- preventScroll: !0
696
- }), B.current = null));
697
- },
698
- onFocus: (f) => {
699
- f.target instanceof HTMLElement && f.target.dataset.dismissible === "false" || F.current || (F.current = !0, B.current = f.relatedTarget);
700
- },
701
- onMouseEnter: () => A(!0),
702
- onMouseMove: () => A(!0),
703
- onMouseLeave: () => {
704
- rt || A(!1);
705
- },
706
- onDragEnd: () => A(!1),
707
- onPointerDown: (f) => {
708
- f.target instanceof HTMLElement && f.target.dataset.dismissible === "false" || et(!0);
709
- },
710
- onPointerUp: () => et(!1)
711
- }, Y.filter((f) => !f.position && p === 0 || f.position === l).map((f, K) => {
712
- var lt, dt;
713
- return /* @__PURE__ */ a.createElement(ve, {
714
- key: f.id,
715
- icons: st,
716
- index: K,
717
- toast: f,
718
- defaultRichColors: O,
719
- duration: (lt = d?.duration) != null ? lt : E,
720
- className: d?.className,
721
- descriptionClassName: d?.descriptionClassName,
722
- invert: C,
723
- visibleToasts: U,
724
- closeButton: (dt = d?.closeButton) != null ? dt : b,
725
- interacting: rt,
726
- position: l,
727
- style: d?.style,
728
- unstyled: d?.unstyled,
729
- classNames: d?.classNames,
730
- cancelButtonStyle: d?.cancelButtonStyle,
731
- actionButtonStyle: d?.actionButtonStyle,
732
- closeButtonAriaLabel: d?.closeButtonAriaLabel,
733
- removeToast: it,
734
- toasts: Y.filter((q) => q.position == f.position),
735
- heights: nt.filter((q) => q.position == f.position),
736
- setHeights: bt,
737
- expandByDefault: _,
738
- gap: X,
739
- expanded: tt,
740
- swipeDirections: o.swipeDirections
741
- });
742
- })) : null;
743
- }));
744
- }), ke = ({ ...r }) => {
745
- const { theme: o = "system" } = Xt();
746
- return /* @__PURE__ */ Ut.jsx(
747
- xe,
748
- {
749
- theme: o,
750
- className: "toaster group",
751
- toastOptions: {
752
- classNames: {
753
- toast: "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
754
- description: "group-[.toast]:text-muted-foreground",
755
- actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
756
- cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"
757
- }
758
- },
759
- ...r
760
- }
761
- );
762
- };
763
- export {
764
- ke as Toaster
765
- };