@enya-learning/nova 0.6.0 → 0.7.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.
- package/dist/chunks/dist-fahbq1psobj0ox6s.js.map +1 -1
- package/dist/chunks/dist-i6l6wqicjhnap81o.js +37 -0
- package/dist/chunks/{dist-o8x0ip0z71xkr2oh.js.map → dist-i6l6wqicjhnap81o.js.map} +1 -1
- package/dist/chunks/utils-chr77evsz8gs6wle.js +10 -0
- package/dist/chunks/{utils-kyb5nny4y41y7hd8.js.map → utils-chr77evsz8gs6wle.js.map} +1 -1
- package/dist/chunks/{vendor-styling-eeiy57tyznmxsfky.js → vendor-styling-bq164a52kub0yzw7.js} +84 -81
- package/dist/chunks/{vendor-styling-eeiy57tyznmxsfky.js.map → vendor-styling-bq164a52kub0yzw7.js.map} +1 -1
- package/dist/chunks/{vendor-utils-egkaeebaqpft6cxj.js → vendor-utils-dzqqqwem43r86lbz.js} +48 -48
- package/dist/chunks/{vendor-utils-egkaeebaqpft6cxj.js.map → vendor-utils-dzqqqwem43r86lbz.js.map} +1 -1
- package/dist/components/accordion.js +1 -1
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/alert-dialog.js +1 -1
- package/dist/components/alert.js +2 -2
- package/dist/components/aspect-ratio.js +1 -1
- package/dist/components/avatar.js +1 -1
- package/dist/components/badge.js +2 -2
- package/dist/components/box.js +1 -1
- package/dist/components/breadcrumb.js +1 -1
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/button-group.js +2 -2
- package/dist/components/button.js +2 -2
- package/dist/components/calendar.js +59 -58
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/card.js +1 -1
- package/dist/components/carousel.js +27 -26
- package/dist/components/carousel.js.map +1 -1
- package/dist/components/chart.js +1460 -1455
- package/dist/components/chart.js.map +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/combobox.js +7 -7
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/command.js +83 -83
- package/dist/components/command.js.map +1 -1
- package/dist/components/context-menu.js +1 -1
- package/dist/components/context-menu.js.map +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/drawer.js +1 -1
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.js +1 -1
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/empty.js +2 -2
- package/dist/components/enya-logo.js +88 -78
- package/dist/components/enya-logo.js.map +1 -1
- package/dist/components/field.js +2 -2
- package/dist/components/field.js.map +1 -1
- package/dist/components/heading.js +11 -11
- package/dist/components/heading.js.map +1 -1
- package/dist/components/hover-card.js +1 -1
- package/dist/components/hover-card.js.map +1 -1
- package/dist/components/input-group.js +2 -2
- package/dist/components/input-otp.js +61 -60
- package/dist/components/input-otp.js.map +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/item.js +2 -2
- package/dist/components/kbd.js +1 -1
- package/dist/components/label.js +1 -1
- package/dist/components/menubar.js +1 -1
- package/dist/components/menubar.js.map +1 -1
- package/dist/components/native-select.js +1 -1
- package/dist/components/native-select.js.map +1 -1
- package/dist/components/navigation-menu.js +2 -2
- package/dist/components/navigation-menu.js.map +1 -1
- package/dist/components/pagination.js +1 -1
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/popover.js +1 -1
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress.js +1 -1
- package/dist/components/progress.js.map +1 -1
- package/dist/components/radio-group.js +1 -1
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/resizable.js +119 -116
- package/dist/components/resizable.js.map +1 -1
- package/dist/components/scroll-area.js +1 -1
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.js +1 -1
- package/dist/components/sheet.js +1 -1
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/sidebar.js +10 -10
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/skeleton.js +1 -1
- package/dist/components/slider.js +1 -1
- package/dist/components/slider.js.map +1 -1
- package/dist/components/sonner.js +163 -165
- package/dist/components/sonner.js.map +1 -1
- package/dist/components/spinner.js +1 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.js +2 -2
- package/dist/components/text.js +2 -2
- package/dist/components/textarea.js +1 -1
- package/dist/components/toggle-group.js +1 -1
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/toggle.js +2 -2
- package/dist/components/tooltip.js +1 -1
- package/dist/components/tooltip.js.map +1 -1
- package/dist/index.js +28 -21
- package/dist/src/index.d.ts +1 -0
- package/dist/styles/nova.css +1 -1
- package/dist/styles/shadcn-variants.css +98 -0
- package/dist/utils.js +1 -1
- package/package.json +15 -11
- package/src/eslint/no-primitive-colors.test.ts +1 -1
- package/dist/chunks/dist-o8x0ip0z71xkr2oh.js +0 -37
- package/dist/chunks/utils-kyb5nny4y41y7hd8.js +0 -10
|
@@ -1,46 +1,44 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as Z } from "react/jsx-runtime";
|
|
3
3
|
import { HugeiconsIcon as st } from "@hugeicons/react";
|
|
4
|
-
import { Alert02Icon as
|
|
4
|
+
import { Alert02Icon as Wt, CircleCheckIcon as Kt, InformationCircleIcon as qt, Loading03Icon as Gt, OctagonXIcon as Jt } from "@hugeicons/core-free-icons";
|
|
5
5
|
import * as vt from "react";
|
|
6
6
|
import o from "react";
|
|
7
|
-
import
|
|
8
|
-
var Zt = (e, a, r, d, u, f, b,
|
|
7
|
+
import Qt from "react-dom";
|
|
8
|
+
var Zt = (e, a, r, d, u, f, b, g) => {
|
|
9
9
|
let i = document.documentElement, n = ["light", "dark"];
|
|
10
10
|
function y(E) {
|
|
11
|
-
(Array.isArray(e) ? e : [e]).forEach((
|
|
12
|
-
let
|
|
13
|
-
|
|
11
|
+
(Array.isArray(e) ? e : [e]).forEach((B) => {
|
|
12
|
+
let X = B === "class", j = X && f ? u.map((c) => f[c] || c) : u;
|
|
13
|
+
X ? (i.classList.remove(...j), i.classList.add(f && f[E] ? f[E] : E)) : i.setAttribute(B, E);
|
|
14
14
|
}), t(E);
|
|
15
15
|
}
|
|
16
16
|
function t(E) {
|
|
17
|
-
|
|
17
|
+
g && n.includes(E) && (i.style.colorScheme = E);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function R() {
|
|
20
20
|
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
21
21
|
}
|
|
22
22
|
if (d) y(d);
|
|
23
23
|
else try {
|
|
24
24
|
let E = localStorage.getItem(a) || r;
|
|
25
|
-
y(b && E === "system" ?
|
|
25
|
+
y(b && E === "system" ? R() : E);
|
|
26
26
|
} catch {
|
|
27
27
|
}
|
|
28
|
-
}
|
|
29
|
-
var te = vt.createContext(void 0), ee = {
|
|
28
|
+
}, te = vt.createContext(void 0), ee = {
|
|
30
29
|
setTheme: (e) => {
|
|
31
30
|
},
|
|
32
31
|
themes: []
|
|
33
32
|
}, ae = () => {
|
|
34
33
|
var e;
|
|
35
34
|
return (e = vt.useContext(te)) != null ? e : ee;
|
|
36
|
-
}
|
|
37
|
-
var Le = vt.memo(({ forcedTheme: e, storageKey: a, attribute: r, enableSystem: d, enableColorScheme: u, defaultTheme: f, value: b, themes: h, nonce: i, scriptProps: n }) => {
|
|
35
|
+
}, ze = vt.memo(({ forcedTheme: e, storageKey: a, attribute: r, enableSystem: d, enableColorScheme: u, defaultTheme: f, value: b, themes: g, nonce: i, scriptProps: n }) => {
|
|
38
36
|
let y = JSON.stringify([
|
|
39
37
|
r,
|
|
40
38
|
a,
|
|
41
39
|
f,
|
|
42
40
|
e,
|
|
43
|
-
|
|
41
|
+
g,
|
|
44
42
|
b,
|
|
45
43
|
d,
|
|
46
44
|
u
|
|
@@ -155,19 +153,19 @@ var re = (e) => {
|
|
|
155
153
|
this.publish(e), this.toasts = [...this.toasts, e];
|
|
156
154
|
}, this.create = (e) => {
|
|
157
155
|
var a;
|
|
158
|
-
const { message: r, ...d } = e, u = typeof e?.id == "number" || ((a = e.id) == null ? void 0 : a.length) > 0 ? e.id : St++, f = this.toasts.find((
|
|
159
|
-
return this.dismissedToasts.has(u) && this.dismissedToasts.delete(u), f ? this.toasts = this.toasts.map((
|
|
160
|
-
...
|
|
156
|
+
const { message: r, ...d } = e, u = typeof e?.id == "number" || ((a = e.id) == null ? void 0 : a.length) > 0 ? e.id : St++, f = this.toasts.find((g) => g.id === u), b = e.dismissible === void 0 ? !0 : e.dismissible;
|
|
157
|
+
return this.dismissedToasts.has(u) && this.dismissedToasts.delete(u), f ? this.toasts = this.toasts.map((g) => g.id === u ? (this.publish({
|
|
158
|
+
...g,
|
|
161
159
|
...e,
|
|
162
160
|
id: u,
|
|
163
161
|
title: r
|
|
164
162
|
}), {
|
|
165
|
-
...
|
|
163
|
+
...g,
|
|
166
164
|
...e,
|
|
167
165
|
id: u,
|
|
168
166
|
dismissible: b,
|
|
169
167
|
title: r
|
|
170
|
-
}) :
|
|
168
|
+
}) : g) : this.addToast({
|
|
171
169
|
title: r,
|
|
172
170
|
...d,
|
|
173
171
|
dismissible: b,
|
|
@@ -223,7 +221,7 @@ var re = (e) => {
|
|
|
223
221
|
type: "default",
|
|
224
222
|
message: i
|
|
225
223
|
});
|
|
226
|
-
else if (
|
|
224
|
+
else if (ge(i) && !i.ok) {
|
|
227
225
|
u = !1;
|
|
228
226
|
const n = typeof a.error == "function" ? await a.error(`HTTP error! status: ${i.status}`) : a.error, y = typeof a.description == "function" ? await a.description(`HTTP error! status: ${i.status}`) : a.description, t = typeof n == "object" && !o.isValidElement(n) ? n : { message: n };
|
|
229
227
|
this.create({
|
|
@@ -264,8 +262,8 @@ var re = (e) => {
|
|
|
264
262
|
}
|
|
265
263
|
}).finally(() => {
|
|
266
264
|
u && (this.dismiss(r), r = void 0), a.finally == null || a.finally.call(a);
|
|
267
|
-
}),
|
|
268
|
-
return typeof r != "string" && typeof r != "number" ? { unwrap:
|
|
265
|
+
}), g = () => new Promise((i, n) => b.then(() => f[0] === "reject" ? n(f[1]) : i(f[1])).catch(n));
|
|
266
|
+
return typeof r != "string" && typeof r != "number" ? { unwrap: g } : Object.assign(r, { unwrap: g });
|
|
269
267
|
}, this.custom = (e, a) => {
|
|
270
268
|
const r = a?.id || St++;
|
|
271
269
|
return this.create({
|
|
@@ -275,106 +273,106 @@ var re = (e) => {
|
|
|
275
273
|
}), r;
|
|
276
274
|
}, this.getActiveToasts = () => this.toasts.filter((e) => !this.dismissedToasts.has(e.id)), this.subscribers = [], this.toasts = [], this.dismissedToasts = /* @__PURE__ */ new Set();
|
|
277
275
|
}
|
|
278
|
-
},
|
|
276
|
+
}, k = new fe(), pe = (e, a) => {
|
|
279
277
|
const r = a?.id || St++;
|
|
280
|
-
return
|
|
278
|
+
return k.addToast({
|
|
281
279
|
title: e,
|
|
282
280
|
...a,
|
|
283
281
|
id: r
|
|
284
282
|
}), r;
|
|
285
|
-
},
|
|
286
|
-
success:
|
|
287
|
-
info:
|
|
288
|
-
warning:
|
|
289
|
-
error:
|
|
290
|
-
custom:
|
|
291
|
-
message:
|
|
292
|
-
promise:
|
|
293
|
-
dismiss:
|
|
294
|
-
loading:
|
|
283
|
+
}, ge = (e) => e && typeof e == "object" && "ok" in e && typeof e.ok == "boolean" && "status" in e && typeof e.status == "number", he = pe, ve = () => k.toasts, be = () => k.getActiveToasts(), Oe = Object.assign(he, {
|
|
284
|
+
success: k.success,
|
|
285
|
+
info: k.info,
|
|
286
|
+
warning: k.warning,
|
|
287
|
+
error: k.error,
|
|
288
|
+
custom: k.custom,
|
|
289
|
+
message: k.message,
|
|
290
|
+
promise: k.promise,
|
|
291
|
+
dismiss: k.dismiss,
|
|
292
|
+
loading: k.loading
|
|
295
293
|
}, {
|
|
296
294
|
getHistory: ve,
|
|
297
295
|
getToasts: be
|
|
298
296
|
});
|
|
299
297
|
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%)}");
|
|
300
|
-
function
|
|
298
|
+
function ht(e) {
|
|
301
299
|
return e.label !== void 0;
|
|
302
300
|
}
|
|
303
|
-
var ye = 3, we = "24px", xe = "16px",
|
|
301
|
+
var ye = 3, we = "24px", xe = "16px", Rt = 4e3, Ee = 356, Te = 14, Se = 45, Ne = 200;
|
|
304
302
|
function O(...e) {
|
|
305
303
|
return e.filter(Boolean).join(" ");
|
|
306
304
|
}
|
|
307
|
-
function
|
|
305
|
+
function ke(e) {
|
|
308
306
|
const [a, r] = e.split("-"), d = [];
|
|
309
307
|
return a && d.push(a), r && d.push(r), d;
|
|
310
308
|
}
|
|
311
309
|
var _e = (e) => {
|
|
312
|
-
var a, r, d, u, f, b,
|
|
313
|
-
const { invert: y, toast: t, unstyled:
|
|
310
|
+
var a, r, d, u, f, b, g, i, n;
|
|
311
|
+
const { invert: y, toast: t, unstyled: R, interacting: E, setHeights: B, visibleToasts: X, heights: j, index: c, toasts: it, expanded: W, removeToast: lt, defaultRichColors: bt, closeButton: H, style: tt, cancelButtonStyle: Y, actionButtonStyle: yt, className: dt = "", descriptionClassName: wt = "", duration: et, position: A, gap: ct, expandByDefault: at, classNames: m, icons: T, closeButtonAriaLabel: P = "Close toast" } = e, [F, M] = o.useState(null), [V, ut] = o.useState(null), [l, h] = o.useState(!1), [p, N] = o.useState(!1), [K, v] = o.useState(!1), [mt, ft] = o.useState(!1), [pt, q] = o.useState(!1), [zt, xt] = o.useState(0), [Ot, Nt] = o.useState(0), ot = o.useRef(t.duration || et || Rt), kt = o.useRef(null), L = o.useRef(null), Ht = c === 0, Lt = c + 1 <= X, _ = t.type, G = t.dismissible !== !1, jt = t.className || "", Pt = t.descriptionClassName || "", gt = o.useMemo(() => j.findIndex((s) => s.toastId === t.id) || 0, [j, t.id]), $t = o.useMemo(() => {
|
|
314
312
|
var s;
|
|
315
|
-
return (s = t.closeButton) != null ? s :
|
|
316
|
-
}, [t.closeButton,
|
|
317
|
-
|
|
313
|
+
return (s = t.closeButton) != null ? s : H;
|
|
314
|
+
}, [t.closeButton, H]), _t = o.useMemo(() => t.duration || et || Rt, [t.duration, et]), Et = o.useRef(0), J = o.useRef(0), It = o.useRef(0), Q = o.useRef(null), [Yt, Ft] = A.split("-"), Bt = o.useMemo(() => j.reduce((s, w, S) => S >= gt ? s : s + w.height, 0), [j, gt]), Mt = me(), Vt = t.invert || y, Tt = _ === "loading";
|
|
315
|
+
J.current = o.useMemo(() => gt * ct + Bt, [gt, Bt]), o.useEffect(() => {
|
|
318
316
|
ot.current = _t;
|
|
319
317
|
}, [_t]), o.useEffect(() => {
|
|
320
|
-
|
|
318
|
+
h(!0);
|
|
321
319
|
}, []), o.useEffect(() => {
|
|
322
|
-
const s =
|
|
320
|
+
const s = L.current;
|
|
323
321
|
if (s) {
|
|
324
322
|
const w = s.getBoundingClientRect().height;
|
|
325
|
-
return
|
|
323
|
+
return Nt(w), B((S) => [{
|
|
326
324
|
toastId: t.id,
|
|
327
325
|
height: w,
|
|
328
326
|
position: t.position
|
|
329
|
-
}, ...S]), () =>
|
|
327
|
+
}, ...S]), () => B((S) => S.filter((I) => I.toastId !== t.id));
|
|
330
328
|
}
|
|
331
|
-
}, [
|
|
329
|
+
}, [B, t.id]), o.useLayoutEffect(() => {
|
|
332
330
|
if (!l) return;
|
|
333
|
-
const s =
|
|
331
|
+
const s = L.current, w = s.style.height;
|
|
334
332
|
s.style.height = "auto";
|
|
335
333
|
const S = s.getBoundingClientRect().height;
|
|
336
|
-
s.style.height = w,
|
|
334
|
+
s.style.height = w, Nt(S), B((I) => I.find((x) => x.toastId === t.id) ? I.map((x) => x.toastId === t.id ? {
|
|
337
335
|
...x,
|
|
338
336
|
height: S
|
|
339
337
|
} : x) : [{
|
|
340
338
|
toastId: t.id,
|
|
341
339
|
height: S,
|
|
342
340
|
position: t.position
|
|
343
|
-
}, ...
|
|
341
|
+
}, ...I]);
|
|
344
342
|
}, [
|
|
345
343
|
l,
|
|
346
344
|
t.title,
|
|
347
345
|
t.description,
|
|
348
|
-
|
|
346
|
+
B,
|
|
349
347
|
t.id,
|
|
350
348
|
t.jsx,
|
|
351
349
|
t.action,
|
|
352
350
|
t.cancel
|
|
353
351
|
]);
|
|
354
352
|
const $ = o.useCallback(() => {
|
|
355
|
-
|
|
353
|
+
N(!0), xt(J.current), B((s) => s.filter((w) => w.toastId !== t.id)), setTimeout(() => {
|
|
356
354
|
lt(t);
|
|
357
|
-
},
|
|
355
|
+
}, Ne);
|
|
358
356
|
}, [
|
|
359
357
|
t,
|
|
360
358
|
lt,
|
|
361
|
-
|
|
362
|
-
|
|
359
|
+
B,
|
|
360
|
+
J
|
|
363
361
|
]);
|
|
364
362
|
o.useEffect(() => {
|
|
365
363
|
if (t.promise && _ === "loading" || t.duration === 1 / 0 || t.type === "loading") return;
|
|
366
364
|
let s;
|
|
367
|
-
return
|
|
368
|
-
if (
|
|
369
|
-
const
|
|
370
|
-
ot.current = ot.current -
|
|
365
|
+
return W || E || Mt ? (() => {
|
|
366
|
+
if (It.current < Et.current) {
|
|
367
|
+
const I = (/* @__PURE__ */ new Date()).getTime() - Et.current;
|
|
368
|
+
ot.current = ot.current - I;
|
|
371
369
|
}
|
|
372
|
-
|
|
370
|
+
It.current = (/* @__PURE__ */ new Date()).getTime();
|
|
373
371
|
})() : ot.current !== 1 / 0 && (Et.current = (/* @__PURE__ */ new Date()).getTime(), s = setTimeout(() => {
|
|
374
372
|
t.onAutoClose == null || t.onAutoClose.call(t, t), $();
|
|
375
373
|
}, ot.current)), () => clearTimeout(s);
|
|
376
374
|
}, [
|
|
377
|
-
|
|
375
|
+
W,
|
|
378
376
|
E,
|
|
379
377
|
t,
|
|
380
378
|
_,
|
|
@@ -383,7 +381,7 @@ var _e = (e) => {
|
|
|
383
381
|
]), o.useEffect(() => {
|
|
384
382
|
t.delete && ($(), t.onDismiss == null || t.onDismiss.call(t, t));
|
|
385
383
|
}, [$, t.delete]);
|
|
386
|
-
function
|
|
384
|
+
function Ut() {
|
|
387
385
|
var s;
|
|
388
386
|
if (T?.loading) {
|
|
389
387
|
var w;
|
|
@@ -397,103 +395,103 @@ var _e = (e) => {
|
|
|
397
395
|
visible: _ === "loading"
|
|
398
396
|
});
|
|
399
397
|
}
|
|
400
|
-
const
|
|
401
|
-
var
|
|
398
|
+
const Xt = t.icon || T?.[_] || re(_);
|
|
399
|
+
var Dt, Ct;
|
|
402
400
|
return /* @__PURE__ */ o.createElement("li", {
|
|
403
401
|
tabIndex: 0,
|
|
404
|
-
ref:
|
|
405
|
-
className: O(dt,
|
|
402
|
+
ref: L,
|
|
403
|
+
className: O(dt, jt, m?.toast, t == null || (a = t.classNames) == null ? void 0 : a.toast, m?.default, m?.[_], t == null || (r = t.classNames) == null ? void 0 : r[_]),
|
|
406
404
|
"data-sonner-toast": "",
|
|
407
|
-
"data-rich-colors": (
|
|
408
|
-
"data-styled": !(t.jsx || t.unstyled ||
|
|
405
|
+
"data-rich-colors": (Dt = t.richColors) != null ? Dt : bt,
|
|
406
|
+
"data-styled": !(t.jsx || t.unstyled || R),
|
|
409
407
|
"data-mounted": l,
|
|
410
408
|
"data-promise": !!t.promise,
|
|
411
409
|
"data-swiped": pt,
|
|
412
410
|
"data-removed": p,
|
|
413
|
-
"data-visible":
|
|
411
|
+
"data-visible": Lt,
|
|
414
412
|
"data-y-position": Yt,
|
|
415
413
|
"data-x-position": Ft,
|
|
416
414
|
"data-index": c,
|
|
417
|
-
"data-front":
|
|
415
|
+
"data-front": Ht,
|
|
418
416
|
"data-swiping": K,
|
|
419
|
-
"data-dismissible":
|
|
417
|
+
"data-dismissible": G,
|
|
420
418
|
"data-type": _,
|
|
421
419
|
"data-invert": Vt,
|
|
422
420
|
"data-swipe-out": mt,
|
|
423
421
|
"data-swipe-direction": V,
|
|
424
|
-
"data-expanded": !!(
|
|
422
|
+
"data-expanded": !!(W || at && l),
|
|
425
423
|
"data-testid": t.testId,
|
|
426
424
|
style: {
|
|
427
425
|
"--index": c,
|
|
428
426
|
"--toasts-before": c,
|
|
429
427
|
"--z-index": it.length - c,
|
|
430
|
-
"--offset": `${p ?
|
|
428
|
+
"--offset": `${p ? zt : J.current}px`,
|
|
431
429
|
"--initial-height": at ? "auto" : `${Ot}px`,
|
|
432
430
|
...tt,
|
|
433
431
|
...t.style
|
|
434
432
|
},
|
|
435
433
|
onDragEnd: () => {
|
|
436
|
-
v(!1), M(null),
|
|
434
|
+
v(!1), M(null), Q.current = null;
|
|
437
435
|
},
|
|
438
436
|
onPointerDown: (s) => {
|
|
439
|
-
s.button !== 2 && (Tt || !
|
|
437
|
+
s.button !== 2 && (Tt || !G || (kt.current = /* @__PURE__ */ new Date(), xt(J.current), s.target.setPointerCapture(s.pointerId), s.target.tagName !== "BUTTON" && (v(!0), Q.current = {
|
|
440
438
|
x: s.clientX,
|
|
441
439
|
y: s.clientY
|
|
442
440
|
})));
|
|
443
441
|
},
|
|
444
442
|
onPointerUp: () => {
|
|
445
443
|
var s, w, S;
|
|
446
|
-
if (mt || !
|
|
447
|
-
|
|
448
|
-
const
|
|
449
|
-
if (Math.abs(rt) >= Se ||
|
|
450
|
-
xt(
|
|
444
|
+
if (mt || !G) return;
|
|
445
|
+
Q.current = null;
|
|
446
|
+
const I = Number(((s = L.current) == null ? void 0 : s.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0), x = Number(((w = L.current) == null ? void 0 : w.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0), D = (/* @__PURE__ */ new Date()).getTime() - ((S = kt.current) == null ? void 0 : S.getTime()), rt = F === "x" ? I : x, z = Math.abs(rt) / D;
|
|
447
|
+
if (Math.abs(rt) >= Se || z > 0.11) {
|
|
448
|
+
xt(J.current), t.onDismiss == null || t.onDismiss.call(t, t), ut(F === "x" ? I > 0 ? "right" : "left" : x > 0 ? "down" : "up"), $(), ft(!0);
|
|
451
449
|
return;
|
|
452
450
|
} else {
|
|
453
|
-
var
|
|
454
|
-
(
|
|
451
|
+
var C, nt;
|
|
452
|
+
(C = L.current) == null || C.style.setProperty("--swipe-amount-x", "0px"), (nt = L.current) == null || nt.style.setProperty("--swipe-amount-y", "0px");
|
|
455
453
|
}
|
|
456
454
|
q(!1), v(!1), M(null);
|
|
457
455
|
},
|
|
458
456
|
onPointerMove: (s) => {
|
|
459
|
-
var w, S,
|
|
460
|
-
if (!
|
|
461
|
-
const x = s.clientY -
|
|
457
|
+
var w, S, I;
|
|
458
|
+
if (!Q.current || !G || ((w = window.getSelection()) == null ? void 0 : w.toString().length) > 0) return;
|
|
459
|
+
const x = s.clientY - Q.current.y, D = s.clientX - Q.current.x;
|
|
462
460
|
var rt;
|
|
463
|
-
const
|
|
464
|
-
!F && (Math.abs(
|
|
465
|
-
let
|
|
461
|
+
const z = (rt = e.swipeDirections) != null ? rt : ke(A);
|
|
462
|
+
!F && (Math.abs(D) > 1 || Math.abs(x) > 1) && M(Math.abs(D) > Math.abs(x) ? "x" : "y");
|
|
463
|
+
let C = {
|
|
466
464
|
x: 0,
|
|
467
465
|
y: 0
|
|
468
466
|
};
|
|
469
|
-
const nt = (
|
|
467
|
+
const nt = (U) => 1 / (1.5 + Math.abs(U) / 20);
|
|
470
468
|
if (F === "y") {
|
|
471
|
-
if (
|
|
469
|
+
if (z.includes("top") || z.includes("bottom")) if (z.includes("top") && x < 0 || z.includes("bottom") && x > 0) C.y = x;
|
|
472
470
|
else {
|
|
473
|
-
const
|
|
474
|
-
|
|
471
|
+
const U = x * nt(x);
|
|
472
|
+
C.y = Math.abs(U) < Math.abs(x) ? U : x;
|
|
475
473
|
}
|
|
476
|
-
} else if (F === "x" && (
|
|
477
|
-
if (
|
|
474
|
+
} else if (F === "x" && (z.includes("left") || z.includes("right")))
|
|
475
|
+
if (z.includes("left") && D < 0 || z.includes("right") && D > 0) C.x = D;
|
|
478
476
|
else {
|
|
479
|
-
const
|
|
480
|
-
|
|
477
|
+
const U = D * nt(D);
|
|
478
|
+
C.x = Math.abs(U) < Math.abs(D) ? U : D;
|
|
481
479
|
}
|
|
482
|
-
(Math.abs(
|
|
480
|
+
(Math.abs(C.x) > 0 || Math.abs(C.y) > 0) && q(!0), (S = L.current) == null || S.style.setProperty("--swipe-amount-x", `${C.x}px`), (I = L.current) == null || I.style.setProperty("--swipe-amount-y", `${C.y}px`);
|
|
483
481
|
}
|
|
484
482
|
}, $t && !t.jsx && _ !== "loading" ? /* @__PURE__ */ o.createElement("button", {
|
|
485
|
-
"aria-label":
|
|
483
|
+
"aria-label": P,
|
|
486
484
|
"data-disabled": Tt,
|
|
487
485
|
"data-close-button": !0,
|
|
488
|
-
onClick: Tt || !
|
|
486
|
+
onClick: Tt || !G ? () => {
|
|
489
487
|
} : () => {
|
|
490
488
|
$(), t.onDismiss == null || t.onDismiss.call(t, t);
|
|
491
489
|
},
|
|
492
490
|
className: O(m?.closeButton, t == null || (d = t.classNames) == null ? void 0 : d.closeButton)
|
|
493
|
-
}, (
|
|
491
|
+
}, (Ct = T?.close) != null ? Ct : ue) : null, (_ || t.icon || t.promise) && t.icon !== null && (T?.[_] !== null || t.icon) ? /* @__PURE__ */ o.createElement("div", {
|
|
494
492
|
"data-icon": "",
|
|
495
493
|
className: O(m?.icon, t == null || (u = t.classNames) == null ? void 0 : u.icon)
|
|
496
|
-
}, t.promise || t.type === "loading" && !t.icon ? t.icon ||
|
|
494
|
+
}, t.promise || t.type === "loading" && !t.icon ? t.icon || Ut() : null, t.type !== "loading" ? Xt : null) : null, /* @__PURE__ */ o.createElement("div", {
|
|
497
495
|
"data-content": "",
|
|
498
496
|
className: O(m?.content, t == null || (f = t.classNames) == null ? void 0 : f.content)
|
|
499
497
|
}, /* @__PURE__ */ o.createElement("div", {
|
|
@@ -501,34 +499,34 @@ var _e = (e) => {
|
|
|
501
499
|
className: O(m?.title, t == null || (b = t.classNames) == null ? void 0 : b.title)
|
|
502
500
|
}, t.jsx ? t.jsx : typeof t.title == "function" ? t.title() : t.title), t.description ? /* @__PURE__ */ o.createElement("div", {
|
|
503
501
|
"data-description": "",
|
|
504
|
-
className: O(wt,
|
|
505
|
-
}, typeof t.description == "function" ? t.description() : t.description) : null), /* @__PURE__ */ o.isValidElement(t.cancel) ? t.cancel : t.cancel &&
|
|
502
|
+
className: O(wt, Pt, m?.description, t == null || (g = t.classNames) == null ? void 0 : g.description)
|
|
503
|
+
}, typeof t.description == "function" ? t.description() : t.description) : null), /* @__PURE__ */ o.isValidElement(t.cancel) ? t.cancel : t.cancel && ht(t.cancel) ? /* @__PURE__ */ o.createElement("button", {
|
|
506
504
|
"data-button": !0,
|
|
507
505
|
"data-cancel": !0,
|
|
508
506
|
style: t.cancelButtonStyle || Y,
|
|
509
507
|
onClick: (s) => {
|
|
510
|
-
|
|
508
|
+
ht(t.cancel) && G && (t.cancel.onClick == null || t.cancel.onClick.call(t.cancel, s), $());
|
|
511
509
|
},
|
|
512
510
|
className: O(m?.cancelButton, t == null || (i = t.classNames) == null ? void 0 : i.cancelButton)
|
|
513
|
-
}, t.cancel.label) : null, /* @__PURE__ */ o.isValidElement(t.action) ? t.action : t.action &&
|
|
511
|
+
}, t.cancel.label) : null, /* @__PURE__ */ o.isValidElement(t.action) ? t.action : t.action && ht(t.action) ? /* @__PURE__ */ o.createElement("button", {
|
|
514
512
|
"data-button": !0,
|
|
515
513
|
"data-action": !0,
|
|
516
514
|
style: t.actionButtonStyle || yt,
|
|
517
515
|
onClick: (s) => {
|
|
518
|
-
|
|
516
|
+
ht(t.action) && (t.action.onClick == null || t.action.onClick.call(t.action, s), !s.defaultPrevented && $());
|
|
519
517
|
},
|
|
520
518
|
className: O(m?.actionButton, t == null || (n = t.classNames) == null ? void 0 : n.actionButton)
|
|
521
519
|
}, t.action.label) : null);
|
|
522
520
|
};
|
|
523
|
-
function
|
|
521
|
+
function At() {
|
|
524
522
|
if (typeof window > "u" || typeof document > "u") return "ltr";
|
|
525
523
|
const e = document.documentElement.getAttribute("dir");
|
|
526
524
|
return e === "auto" || !e ? window.getComputedStyle(document.documentElement).direction : e;
|
|
527
525
|
}
|
|
528
|
-
function
|
|
526
|
+
function Ie(e, a) {
|
|
529
527
|
const r = {};
|
|
530
528
|
return [e, a].forEach((d, u) => {
|
|
531
|
-
const f = u === 1, b = f ? "--mobile-offset" : "--offset",
|
|
529
|
+
const f = u === 1, b = f ? "--mobile-offset" : "--offset", g = f ? xe : we;
|
|
532
530
|
function i(n) {
|
|
533
531
|
[
|
|
534
532
|
"top",
|
|
@@ -545,21 +543,21 @@ function Ce(e, a) {
|
|
|
545
543
|
"bottom",
|
|
546
544
|
"left"
|
|
547
545
|
].forEach((n) => {
|
|
548
|
-
d[n] === void 0 ? r[`${b}-${n}`] =
|
|
549
|
-
}) : i(
|
|
546
|
+
d[n] === void 0 ? r[`${b}-${n}`] = g : r[`${b}-${n}`] = typeof d[n] == "number" ? `${d[n]}px` : d[n];
|
|
547
|
+
}) : i(g);
|
|
550
548
|
}), r;
|
|
551
549
|
}
|
|
552
|
-
var
|
|
553
|
-
const { id: d, invert: u, position: f = "bottom-right", hotkey: b = ["altKey", "KeyT"], expand:
|
|
554
|
-
tt((
|
|
550
|
+
var Be = /* @__PURE__ */ o.forwardRef(function(a, r) {
|
|
551
|
+
const { id: d, invert: u, position: f = "bottom-right", hotkey: b = ["altKey", "KeyT"], expand: g, closeButton: i, className: n, offset: y, mobileOffset: t, theme: R = "light", richColors: E, duration: B, style: X, visibleToasts: j = ye, toastOptions: c, dir: it = At(), gap: W = Te, icons: lt, containerAriaLabel: bt = "Notifications" } = a, [H, tt] = o.useState([]), Y = o.useMemo(() => d ? H.filter((l) => l.toasterId === d) : H.filter((l) => !l.toasterId), [H, d]), yt = o.useMemo(() => Array.from(new Set([f].concat(Y.filter((l) => l.position).map((l) => l.position)))), [Y, f]), [dt, wt] = o.useState([]), [et, A] = o.useState(!1), [ct, at] = o.useState(!1), [m, T] = o.useState(R !== "system" ? R : typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"), P = o.useRef(null), F = b.join("+").replace(/Key/g, "").replace(/Digit/g, ""), M = o.useRef(null), V = o.useRef(!1), ut = o.useCallback((l) => {
|
|
552
|
+
tt((h) => {
|
|
555
553
|
var p;
|
|
556
|
-
return (p =
|
|
554
|
+
return (p = h.find((N) => N.id === l.id)) != null && p.delete || k.dismiss(l.id), h.filter(({ id: N }) => N !== l.id);
|
|
557
555
|
});
|
|
558
556
|
}, []);
|
|
559
|
-
return o.useEffect(() =>
|
|
557
|
+
return o.useEffect(() => k.subscribe((l) => {
|
|
560
558
|
if (l.dismiss) {
|
|
561
559
|
requestAnimationFrame(() => {
|
|
562
|
-
tt((
|
|
560
|
+
tt((h) => h.map((p) => p.id === l.id ? {
|
|
563
561
|
...p,
|
|
564
562
|
delete: !0
|
|
565
563
|
} : p));
|
|
@@ -567,57 +565,57 @@ var Ie = /* @__PURE__ */ o.forwardRef(function(a, r) {
|
|
|
567
565
|
return;
|
|
568
566
|
}
|
|
569
567
|
setTimeout(() => {
|
|
570
|
-
|
|
571
|
-
tt((
|
|
572
|
-
const p =
|
|
568
|
+
Qt.flushSync(() => {
|
|
569
|
+
tt((h) => {
|
|
570
|
+
const p = h.findIndex((N) => N.id === l.id);
|
|
573
571
|
return p !== -1 ? [
|
|
574
|
-
...
|
|
572
|
+
...h.slice(0, p),
|
|
575
573
|
{
|
|
576
|
-
...
|
|
574
|
+
...h[p],
|
|
577
575
|
...l
|
|
578
576
|
},
|
|
579
|
-
...
|
|
580
|
-
] : [l, ...
|
|
577
|
+
...h.slice(p + 1)
|
|
578
|
+
] : [l, ...h];
|
|
581
579
|
});
|
|
582
580
|
});
|
|
583
581
|
});
|
|
584
|
-
}), [
|
|
585
|
-
if (
|
|
586
|
-
T(
|
|
582
|
+
}), [H]), o.useEffect(() => {
|
|
583
|
+
if (R !== "system") {
|
|
584
|
+
T(R);
|
|
587
585
|
return;
|
|
588
586
|
}
|
|
589
|
-
if (
|
|
587
|
+
if (R === "system" && (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? T("dark") : T("light")), typeof window > "u") return;
|
|
590
588
|
const l = window.matchMedia("(prefers-color-scheme: dark)");
|
|
591
589
|
try {
|
|
592
|
-
l.addEventListener("change", ({ matches:
|
|
593
|
-
T(
|
|
590
|
+
l.addEventListener("change", ({ matches: h }) => {
|
|
591
|
+
T(h ? "dark" : "light");
|
|
594
592
|
});
|
|
595
593
|
} catch {
|
|
596
594
|
l.addListener(({ matches: p }) => {
|
|
597
595
|
try {
|
|
598
596
|
T(p ? "dark" : "light");
|
|
599
|
-
} catch (
|
|
600
|
-
console.error(
|
|
597
|
+
} catch (N) {
|
|
598
|
+
console.error(N);
|
|
601
599
|
}
|
|
602
600
|
});
|
|
603
601
|
}
|
|
604
|
-
}, [
|
|
605
|
-
|
|
606
|
-
}, [
|
|
607
|
-
const l = (
|
|
602
|
+
}, [R]), o.useEffect(() => {
|
|
603
|
+
H.length <= 1 && A(!1);
|
|
604
|
+
}, [H]), o.useEffect(() => {
|
|
605
|
+
const l = (h) => {
|
|
608
606
|
var p;
|
|
609
|
-
if (b.every((K) =>
|
|
610
|
-
var
|
|
611
|
-
|
|
607
|
+
if (b.every((K) => h[K] || h.code === K)) {
|
|
608
|
+
var N;
|
|
609
|
+
A(!0), (N = P.current) == null || N.focus();
|
|
612
610
|
}
|
|
613
|
-
|
|
611
|
+
h.code === "Escape" && (document.activeElement === P.current || (p = P.current) != null && p.contains(document.activeElement)) && A(!1);
|
|
614
612
|
};
|
|
615
613
|
return document.addEventListener("keydown", l), () => document.removeEventListener("keydown", l);
|
|
616
614
|
}, [b]), o.useEffect(() => {
|
|
617
|
-
if (
|
|
615
|
+
if (P.current) return () => {
|
|
618
616
|
M.current && (M.current.focus({ preventScroll: !0 }), M.current = null, V.current = !1);
|
|
619
617
|
};
|
|
620
|
-
}, [
|
|
618
|
+
}, [P.current]), /* @__PURE__ */ o.createElement("section", {
|
|
621
619
|
ref: r,
|
|
622
620
|
"aria-label": `${bt} ${F}`,
|
|
623
621
|
tabIndex: -1,
|
|
@@ -625,25 +623,25 @@ var Ie = /* @__PURE__ */ o.forwardRef(function(a, r) {
|
|
|
625
623
|
"aria-relevant": "additions text",
|
|
626
624
|
"aria-atomic": "false",
|
|
627
625
|
suppressHydrationWarning: !0
|
|
628
|
-
}, yt.map((l,
|
|
626
|
+
}, yt.map((l, h) => {
|
|
629
627
|
var p;
|
|
630
|
-
const [
|
|
628
|
+
const [N, K] = l.split("-");
|
|
631
629
|
return Y.length ? /* @__PURE__ */ o.createElement("ol", {
|
|
632
630
|
key: l,
|
|
633
|
-
dir: it === "auto" ?
|
|
631
|
+
dir: it === "auto" ? At() : it,
|
|
634
632
|
tabIndex: -1,
|
|
635
|
-
ref:
|
|
633
|
+
ref: P,
|
|
636
634
|
className: n,
|
|
637
635
|
"data-sonner-toaster": !0,
|
|
638
636
|
"data-sonner-theme": m,
|
|
639
|
-
"data-y-position":
|
|
637
|
+
"data-y-position": N,
|
|
640
638
|
"data-x-position": K,
|
|
641
639
|
style: {
|
|
642
640
|
"--front-toast-height": `${((p = dt[0]) == null ? void 0 : p.height) || 0}px`,
|
|
643
641
|
"--width": `${Ee}px`,
|
|
644
|
-
"--gap": `${
|
|
645
|
-
...
|
|
646
|
-
...
|
|
642
|
+
"--gap": `${W}px`,
|
|
643
|
+
...X,
|
|
644
|
+
...Ie(y, t)
|
|
647
645
|
},
|
|
648
646
|
onBlur: (v) => {
|
|
649
647
|
V.current && !v.currentTarget.contains(v.relatedTarget) && (V.current = !1, M.current && (M.current.focus({ preventScroll: !0 }), M.current = null));
|
|
@@ -651,17 +649,17 @@ var Ie = /* @__PURE__ */ o.forwardRef(function(a, r) {
|
|
|
651
649
|
onFocus: (v) => {
|
|
652
650
|
v.target instanceof HTMLElement && v.target.dataset.dismissible === "false" || V.current || (V.current = !0, M.current = v.relatedTarget);
|
|
653
651
|
},
|
|
654
|
-
onMouseEnter: () =>
|
|
655
|
-
onMouseMove: () =>
|
|
652
|
+
onMouseEnter: () => A(!0),
|
|
653
|
+
onMouseMove: () => A(!0),
|
|
656
654
|
onMouseLeave: () => {
|
|
657
|
-
ct ||
|
|
655
|
+
ct || A(!1);
|
|
658
656
|
},
|
|
659
|
-
onDragEnd: () =>
|
|
657
|
+
onDragEnd: () => A(!1),
|
|
660
658
|
onPointerDown: (v) => {
|
|
661
659
|
v.target instanceof HTMLElement && v.target.dataset.dismissible === "false" || at(!0);
|
|
662
660
|
},
|
|
663
661
|
onPointerUp: () => at(!1)
|
|
664
|
-
}, Y.filter((v) => !v.position &&
|
|
662
|
+
}, Y.filter((v) => !v.position && h === 0 || v.position === l).map((v, mt) => {
|
|
665
663
|
var ft, pt;
|
|
666
664
|
return /* @__PURE__ */ o.createElement(_e, {
|
|
667
665
|
key: v.id,
|
|
@@ -669,11 +667,11 @@ var Ie = /* @__PURE__ */ o.forwardRef(function(a, r) {
|
|
|
669
667
|
index: mt,
|
|
670
668
|
toast: v,
|
|
671
669
|
defaultRichColors: E,
|
|
672
|
-
duration: (ft = c?.duration) != null ? ft :
|
|
670
|
+
duration: (ft = c?.duration) != null ? ft : B,
|
|
673
671
|
className: c?.className,
|
|
674
672
|
descriptionClassName: c?.descriptionClassName,
|
|
675
673
|
invert: u,
|
|
676
|
-
visibleToasts:
|
|
674
|
+
visibleToasts: j,
|
|
677
675
|
closeButton: (pt = c?.closeButton) != null ? pt : i,
|
|
678
676
|
interacting: ct,
|
|
679
677
|
position: l,
|
|
@@ -687,16 +685,16 @@ var Ie = /* @__PURE__ */ o.forwardRef(function(a, r) {
|
|
|
687
685
|
toasts: Y.filter((q) => q.position == v.position),
|
|
688
686
|
heights: dt.filter((q) => q.position == v.position),
|
|
689
687
|
setHeights: wt,
|
|
690
|
-
expandByDefault:
|
|
691
|
-
gap:
|
|
688
|
+
expandByDefault: g,
|
|
689
|
+
gap: W,
|
|
692
690
|
expanded: et,
|
|
693
691
|
swipeDirections: a.swipeDirections
|
|
694
692
|
});
|
|
695
693
|
})) : null;
|
|
696
694
|
}));
|
|
697
|
-
}),
|
|
695
|
+
}), He = ({ ...e }) => {
|
|
698
696
|
const { theme: a = "system" } = ae();
|
|
699
|
-
return /* @__PURE__ */ Z(
|
|
697
|
+
return /* @__PURE__ */ Z(Be, {
|
|
700
698
|
theme: a,
|
|
701
699
|
className: "toaster group",
|
|
702
700
|
icons: {
|
|
@@ -709,15 +707,15 @@ var Ie = /* @__PURE__ */ o.forwardRef(function(a, r) {
|
|
|
709
707
|
className: "size-4"
|
|
710
708
|
}),
|
|
711
709
|
warning: /* @__PURE__ */ Z(st, {
|
|
712
|
-
icon:
|
|
710
|
+
icon: Wt,
|
|
713
711
|
className: "size-4"
|
|
714
712
|
}),
|
|
715
713
|
error: /* @__PURE__ */ Z(st, {
|
|
716
|
-
icon:
|
|
714
|
+
icon: Jt,
|
|
717
715
|
className: "size-4"
|
|
718
716
|
}),
|
|
719
717
|
loading: /* @__PURE__ */ Z(st, {
|
|
720
|
-
icon:
|
|
718
|
+
icon: Gt,
|
|
721
719
|
className: "size-4 animate-spin"
|
|
722
720
|
})
|
|
723
721
|
},
|
|
@@ -732,7 +730,7 @@ var Ie = /* @__PURE__ */ o.forwardRef(function(a, r) {
|
|
|
732
730
|
});
|
|
733
731
|
};
|
|
734
732
|
export {
|
|
735
|
-
|
|
733
|
+
He as Toaster
|
|
736
734
|
};
|
|
737
735
|
|
|
738
736
|
//# sourceMappingURL=sonner.js.map
|