@gv-tech/ui-web 2.20.0 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion-Be1vGv6M.js +1 -0
- package/dist/accordion-DXnU0LgU.mjs +221 -0
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.mjs +3 -259
- package/dist/alert-dialog-BXRY0Ghq.js +7 -0
- package/dist/alert-dialog-fcZ-sL7h.mjs +164 -0
- package/dist/alert-dialog.cjs +1 -7
- package/dist/alert-dialog.mjs +4 -171
- package/dist/alert.cjs +1 -1
- package/dist/alert.mjs +35 -32
- package/dist/aspect-ratio-BP5HarYZ.js +1 -0
- package/dist/aspect-ratio-Bp8HMg-1.mjs +33 -0
- package/dist/aspect-ratio.cjs +1 -1
- package/dist/aspect-ratio.mjs +3 -43
- package/dist/avatar-klFl8Sqa.js +1 -0
- package/dist/avatar-vGm9JN1a.mjs +184 -0
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.mjs +3 -205
- package/dist/badge.cjs +1 -1
- package/dist/badge.mjs +21 -24
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.mjs +60 -68
- package/dist/button.cjs +1 -1
- package/dist/button.mjs +40 -40
- package/dist/calendar-aIuSXzs7.js +1 -0
- package/dist/calendar-oitID53a.mjs +3154 -0
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.mjs +4 -2976
- package/dist/card.cjs +1 -1
- package/dist/card.mjs +42 -32
- package/dist/carousel-BjTSkVh9.js +1 -0
- package/dist/carousel-CENzZCXN.mjs +1178 -0
- package/dist/carousel.cjs +1 -1
- package/dist/carousel.mjs +4 -1403
- package/dist/chart.cjs +4 -4
- package/dist/chart.d.ts +3 -35
- package/dist/chart.mjs +123 -182
- package/dist/checkbox-Bwq7mXA2.mjs +170 -0
- package/dist/checkbox-DzEO1q4R.js +1 -0
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.mjs +3 -258
- package/dist/collapsible.cjs +1 -1
- package/dist/collapsible.mjs +6 -7
- package/dist/command-D7hksKY6.js +1 -0
- package/dist/command-Ws_iF1hM.mjs +531 -0
- package/dist/command.cjs +1 -1
- package/dist/command.mjs +3 -396
- package/dist/context-menu-DJbgNJ7N.js +1 -0
- package/dist/context-menu-fu39gePi.mjs +292 -0
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.mjs +3 -328
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.mjs +50 -66
- package/dist/dist-0FXx-pUX.js +1 -0
- package/dist/dist-4A0ut6a8.mjs +10 -0
- package/dist/dist-ALQAoSGx.mjs +10 -0
- package/dist/dist-B4N_7Tps.js +1 -0
- package/dist/dist-B5776DvK.js +5 -0
- package/dist/dist-B57mzJP3.mjs +28 -0
- package/dist/dist-B5VmV2K7.js +1 -0
- package/dist/dist-BBRD-Qfb.js +1 -0
- package/dist/dist-BC_VB6JL.mjs +25 -0
- package/dist/dist-BKFtvTm8.mjs +6 -0
- package/dist/dist-BUS_s_6N.js +1 -0
- package/dist/dist-BVKPqhkg.js +1 -0
- package/dist/dist-Ba7mQG9D.mjs +117 -0
- package/dist/dist-BeFCyPgD.js +1 -0
- package/dist/dist-Bf4P28CV.js +1 -0
- package/dist/dist-BfFVoFJN.js +1 -0
- package/dist/dist-BhtQH_6Z.js +1 -0
- package/dist/dist-BmjFh8i_.mjs +5 -0
- package/dist/dist-BrCTkQXt.mjs +62 -0
- package/dist/dist-BxmpAHsT.mjs +219 -0
- package/dist/dist-C2ArLRnq.js +1 -0
- package/dist/dist-C2pRTcV_.mjs +62 -0
- package/dist/dist-C9wnUiS4.mjs +27 -0
- package/dist/dist-CIRItnqs.js +1 -0
- package/dist/dist-CL1DhkaL.js +1 -0
- package/dist/dist-CRe7xawr.js +1 -0
- package/dist/dist-CUFjt0cI.js +1 -0
- package/dist/dist-CaaGWewc.mjs +557 -0
- package/dist/dist-Ci2whnVp.js +1 -0
- package/dist/dist-CmBtqW5f.js +1 -0
- package/dist/dist-CsEsK2jW.js +1 -0
- package/dist/dist-CscAxhT8.js +1 -0
- package/dist/dist-CvtF5JdF.mjs +95 -0
- package/dist/dist-Cvwtowos.mjs +77 -0
- package/dist/dist-D2f83VMO.mjs +73 -0
- package/dist/dist-Dh_jWJh-.mjs +11 -0
- package/dist/dist-DikyKBU3.mjs +12 -0
- package/dist/dist-DmmUjo_P.js +1 -0
- package/dist/dist-DqvQ5UFr.mjs +38 -0
- package/dist/dist-FGQAMrhH.mjs +29 -0
- package/dist/dist-Jtk3jeb9.mjs +18 -0
- package/dist/dist-Kqk0oQYU.js +1 -0
- package/dist/dist-VI9bl_Wk.mjs +45 -0
- package/dist/dist-Z7lEV5Nx.mjs +1282 -0
- package/dist/dist-_Osar3kp.js +1 -0
- package/dist/dist-bDoR0CBU.mjs +112 -0
- package/dist/dist-cRjbOZRf.js +1 -0
- package/dist/dist-d_pecHgw.mjs +66 -0
- package/dist/dist-r36zVVcK.js +1 -0
- package/dist/dist-sRlXdzvf.mjs +152 -0
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.mjs +48 -54
- package/dist/dropdown-menu-BGkQXJ-r.mjs +288 -0
- package/dist/dropdown-menu-uGMnmGL-.js +1 -0
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.mjs +3 -316
- package/dist/es2015-Cx0gpR1a.js +41 -0
- package/dist/es2015-a1b8kENC.mjs +701 -0
- package/dist/form.cjs +1 -1
- package/dist/form.mjs +76 -67
- package/dist/hover-card-DdIYJP-Q.mjs +167 -0
- package/dist/hover-card-Ua-2KlY-.js +1 -0
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.mjs +3 -188
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -35
- package/dist/index.mjs +56 -296
- package/dist/input.cjs +1 -1
- package/dist/input.mjs +14 -19
- package/dist/jsx-runtime-CN3qjQQx.js +6 -0
- package/dist/jsx-runtime-CW53Uo-e.mjs +189 -0
- package/dist/label-8YSUv4kt.js +1 -0
- package/dist/label-Bur66PVg.mjs +22 -0
- package/dist/label.cjs +1 -1
- package/dist/label.mjs +3 -22
- package/dist/menubar-Bq1Sfbf5.js +1 -0
- package/dist/menubar-D2fY6zkQ.mjs +410 -0
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.mjs +3 -473
- package/dist/navigation-menu-BuOakbgA.mjs +602 -0
- package/dist/navigation-menu-so6EvLAY.js +1 -0
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.mjs +3 -673
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.mjs +63 -68
- package/dist/popover-BUADXRkO.mjs +201 -0
- package/dist/popover-nBrSPqHk.js +1 -0
- package/dist/popover.cjs +1 -1
- package/dist/popover.mjs +3 -242
- package/dist/progress-BTApMbqg.js +6 -0
- package/dist/progress-BbN-RNvs.mjs +81 -0
- package/dist/progress.cjs +1 -6
- package/dist/progress.mjs +3 -99
- package/dist/radio-group-C5oprOrt.mjs +193 -0
- package/dist/radio-group-FDXr6VLM.js +1 -0
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.mjs +3 -253
- package/dist/resizable-ChdgCzzx.mjs +1534 -0
- package/dist/resizable-ztiFzq_y.js +1 -0
- package/dist/resizable.cjs +1 -1
- package/dist/resizable.mjs +3 -1990
- package/dist/scroll-area-3o0-cc3n.mjs +520 -0
- package/dist/scroll-area-DXZqIKXN.js +1 -0
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.mjs +3 -546
- package/dist/scroll-to-top.cjs +1 -1
- package/dist/scroll-to-top.mjs +71 -84
- package/dist/search.cjs +1 -1
- package/dist/search.mjs +53 -63
- package/dist/select-B2qM503G.mjs +744 -0
- package/dist/select-BHCeW-MD.js +1 -0
- package/dist/select.cjs +1 -1
- package/dist/select.mjs +3 -908
- package/dist/separator-BZJ-SDvg.js +1 -0
- package/dist/separator-DJ_IwKUQ.mjs +31 -0
- package/dist/separator.cjs +1 -1
- package/dist/separator.mjs +3 -35
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.mjs +59 -66
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.mjs +13 -7
- package/dist/slider-CJJPQ0fH.mjs +366 -0
- package/dist/slider-DHccqrW2.js +1 -0
- package/dist/slider.cjs +1 -1
- package/dist/slider.mjs +3 -442
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.mjs +21 -24
- package/dist/support-fab.cjs +1 -1
- package/dist/support-fab.mjs +81 -117
- package/dist/switch-BbcAUYjl.mjs +103 -0
- package/dist/switch-DZfRzgWs.js +1 -0
- package/dist/switch.cjs +1 -1
- package/dist/switch.mjs +3 -149
- package/dist/table-of-contents.cjs +1 -1
- package/dist/table-of-contents.mjs +159 -155
- package/dist/table.cjs +1 -1
- package/dist/table.mjs +58 -57
- package/dist/tabs-BEy0IIV0.js +1 -0
- package/dist/tabs-DqAKyl9T.mjs +136 -0
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.mjs +3 -195
- package/dist/text.cjs +1 -1
- package/dist/text.mjs +41 -42
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.mjs +12 -17
- package/dist/theme-provider.cjs +1 -1
- package/dist/theme-provider.mjs +15 -7
- package/dist/theme-toggle-DKQmD-FO.js +1 -0
- package/dist/theme-toggle-dQbFWNI8.mjs +65 -0
- package/dist/theme-toggle.cjs +1 -1
- package/dist/theme-toggle.mjs +3 -8
- package/dist/toast-C84Cpidq.js +1 -0
- package/dist/toast-CQbUslcw.mjs +427 -0
- package/dist/toast.cjs +1 -1
- package/dist/toast.mjs +3 -494
- package/dist/toaster-BpcpNRz1.js +1 -0
- package/dist/toaster-i6giQYiq.mjs +126 -0
- package/dist/toaster.cjs +1 -1
- package/dist/toaster.mjs +3 -6
- package/dist/toggle-group-B2S7fkhA.mjs +155 -0
- package/dist/toggle-group-BNn6MNiJ.js +1 -0
- package/dist/toggle-group.cjs +1 -1
- package/dist/toggle-group.mjs +3 -170
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.mjs +19 -14
- package/dist/tooltip-CElrNodA.js +1 -0
- package/dist/tooltip-oKfTBTbv.mjs +364 -0
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.mjs +3 -342
- package/dist/utils-BxDanjP7.js +1 -0
- package/dist/utils-yc5uc46c.mjs +11 -0
- package/package.json +2 -2
- package/src/chart.tsx +7 -7
- package/src/setupTests.ts +5 -4
- package/dist/index-0ioNhtNM.mjs +0 -10
- package/dist/index-3j-XAIXT.mjs +0 -55
- package/dist/index-B2XtpfGY.js +0 -1
- package/dist/index-B39Lzq0v.js +0 -1
- package/dist/index-B7n6fy75.js +0 -1
- package/dist/index-B8dxbSWX.js +0 -41
- package/dist/index-BGIK9FQF.js +0 -1
- package/dist/index-BZPx6jYI.mjs +0 -8
- package/dist/index-BoNjHhm4.js +0 -1
- package/dist/index-BtZvtDmp.js +0 -1
- package/dist/index-Bv7qrYW6.mjs +0 -180
- package/dist/index-ByiPJW53.js +0 -5
- package/dist/index-C0dlIQIi.js +0 -1
- package/dist/index-C1qb0595.mjs +0 -27
- package/dist/index-C7HEunrh.mjs +0 -15
- package/dist/index-C8ni3LLa.js +0 -1
- package/dist/index-CCKe-Mpx.mjs +0 -6
- package/dist/index-CD6_IrA-.mjs +0 -10
- package/dist/index-CRyCZJLa.mjs +0 -677
- package/dist/index-CVx1AgNG.mjs +0 -615
- package/dist/index-Ce5TOFAK.js +0 -1
- package/dist/index-CeSLNJ60.mjs +0 -32
- package/dist/index-CefEQe_4.js +0 -1
- package/dist/index-Cj5hzyBi.js +0 -1
- package/dist/index-Cjj_rUPu.js +0 -1
- package/dist/index-Cl3G0jzM.js +0 -1
- package/dist/index-CwfE56Ep.mjs +0 -1545
- package/dist/index-CwyAfCwY.js +0 -1
- package/dist/index-CzY-WZXL.js +0 -1
- package/dist/index-D2HnlO3y.js +0 -1
- package/dist/index-DFdF7K7v.mjs +0 -50
- package/dist/index-DIsg7zU7.js +0 -1
- package/dist/index-DKN_vhyX.mjs +0 -32
- package/dist/index-DLcqcWxM.mjs +0 -29
- package/dist/index-DSxf1gN6.mjs +0 -118
- package/dist/index-DYxWvftI.js +0 -1
- package/dist/index-DaILh3TV.mjs +0 -32
- package/dist/index-Dfzl8TxY.mjs +0 -136
- package/dist/index-Dko2XdTk.js +0 -1
- package/dist/index-DlY82G31.mjs +0 -245
- package/dist/index-DnFcfnA9.mjs +0 -13
- package/dist/index-IZ2gq03c.mjs +0 -68
- package/dist/index-K9FzbxYw.mjs +0 -93
- package/dist/index-Le8p9oP4.mjs +0 -60
- package/dist/index-MQ0c3ZX_.js +0 -1
- package/dist/index-_XxjJPRD.js +0 -1
- package/dist/index-_wdrnYim.js +0 -1
- package/dist/index-jv3B4mTd.js +0 -1
- package/dist/index-kaM0u2Q1.js +0 -1
- package/dist/index-p6xVFRb4.mjs +0 -52
- package/dist/index-rKs9bXHr.mjs +0 -6
- package/dist/index-vuPgkS0V.mjs +0 -70
- package/dist/jsx-runtime-nZSsnGb7.js +0 -6
- package/dist/jsx-runtime-tc70JA_2.mjs +0 -264
- package/dist/theme-toggle-DXQGNfCe.js +0 -1
- package/dist/theme-toggle-tHXIbr8W.mjs +0 -79
- package/dist/toaster-C_S9hnXa.js +0 -1
- package/dist/toaster-k5DnQSsh.mjs +0 -118
- package/dist/utils-DY6fhrgS.mjs +0 -12
- package/dist/utils-cdbZV8DZ.js +0 -1
package/dist/toast.mjs
CHANGED
|
@@ -1,495 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import { P as A, c as P, d as Ce } from "./index-K9FzbxYw.mjs";
|
|
6
|
-
import { u as oe } from "./index-DLcqcWxM.mjs";
|
|
7
|
-
import { c as Ne } from "./index-DFdF7K7v.mjs";
|
|
8
|
-
import { c as Se } from "./index-IZ2gq03c.mjs";
|
|
9
|
-
import { B as Ae, R as Ie } from "./index-Dfzl8TxY.mjs";
|
|
10
|
-
import { P as De } from "./index-C7HEunrh.mjs";
|
|
11
|
-
import { P as Fe } from "./index-vuPgkS0V.mjs";
|
|
12
|
-
import { u as W } from "./index-0ioNhtNM.mjs";
|
|
13
|
-
import { u as _e } from "./index-p6xVFRb4.mjs";
|
|
14
|
-
import { u as je } from "./index-CCKe-Mpx.mjs";
|
|
15
|
-
import { a as re } from "./index-DKN_vhyX.mjs";
|
|
16
|
-
import { cva as Le } from "class-variance-authority";
|
|
17
|
-
import { X as Me } from "lucide-react";
|
|
18
|
-
import { c as I } from "./utils-DY6fhrgS.mjs";
|
|
19
|
-
var G = "ToastProvider", [J, Oe, ke] = Ne("Toast"), [se] = Se("Toast", [ke]), [Ve, X] = se(G), ne = (e) => {
|
|
20
|
-
const {
|
|
21
|
-
__scopeToast: t,
|
|
22
|
-
label: o = "Notification",
|
|
23
|
-
duration: r = 5e3,
|
|
24
|
-
swipeDirection: u = "right",
|
|
25
|
-
swipeThreshold: l = 50,
|
|
26
|
-
children: p
|
|
27
|
-
} = e, [v, w] = s.useState(null), [c, h] = s.useState(0), x = s.useRef(!1), D = s.useRef(!1);
|
|
28
|
-
return o.trim() || console.error(
|
|
29
|
-
`Invalid prop \`label\` supplied to \`${G}\`. Expected non-empty \`string\`.`
|
|
30
|
-
), /* @__PURE__ */ n.jsx(J.Provider, { scope: t, children: /* @__PURE__ */ n.jsx(
|
|
31
|
-
Ve,
|
|
32
|
-
{
|
|
33
|
-
scope: t,
|
|
34
|
-
label: o,
|
|
35
|
-
duration: r,
|
|
36
|
-
swipeDirection: u,
|
|
37
|
-
swipeThreshold: l,
|
|
38
|
-
toastCount: c,
|
|
39
|
-
viewport: v,
|
|
40
|
-
onViewportChange: w,
|
|
41
|
-
onToastAdd: s.useCallback(() => h((C) => C + 1), []),
|
|
42
|
-
onToastRemove: s.useCallback(() => h((C) => C - 1), []),
|
|
43
|
-
isFocusedToastEscapeKeyDownRef: x,
|
|
44
|
-
isClosePausedRef: D,
|
|
45
|
-
children: p
|
|
46
|
-
}
|
|
47
|
-
) });
|
|
48
|
-
};
|
|
49
|
-
ne.displayName = G;
|
|
50
|
-
var ae = "ToastViewport", Ke = ["F8"], B = "toast.viewportPause", q = "toast.viewportResume", ie = s.forwardRef(
|
|
51
|
-
(e, t) => {
|
|
52
|
-
const {
|
|
53
|
-
__scopeToast: o,
|
|
54
|
-
hotkey: r = Ke,
|
|
55
|
-
label: u = "Notifications ({hotkey})",
|
|
56
|
-
...l
|
|
57
|
-
} = e, p = X(ae, o), v = Oe(o), w = s.useRef(null), c = s.useRef(null), h = s.useRef(null), x = s.useRef(null), D = oe(t, x, p.onViewportChange), C = r.join("+").replace(/Key/g, "").replace(/Digit/g, ""), N = p.toastCount > 0;
|
|
58
|
-
s.useEffect(() => {
|
|
59
|
-
const i = (E) => {
|
|
60
|
-
r.length !== 0 && r.every((m) => E[m] || E.code === m) && x.current?.focus();
|
|
61
|
-
};
|
|
62
|
-
return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
|
|
63
|
-
}, [r]), s.useEffect(() => {
|
|
64
|
-
const i = w.current, E = x.current;
|
|
65
|
-
if (N && i && E) {
|
|
66
|
-
const f = () => {
|
|
67
|
-
if (!p.isClosePausedRef.current) {
|
|
68
|
-
const T = new CustomEvent(B);
|
|
69
|
-
E.dispatchEvent(T), p.isClosePausedRef.current = !0;
|
|
70
|
-
}
|
|
71
|
-
}, m = () => {
|
|
72
|
-
if (p.isClosePausedRef.current) {
|
|
73
|
-
const T = new CustomEvent(q);
|
|
74
|
-
E.dispatchEvent(T), p.isClosePausedRef.current = !1;
|
|
75
|
-
}
|
|
76
|
-
}, y = (T) => {
|
|
77
|
-
!i.contains(T.relatedTarget) && m();
|
|
78
|
-
}, g = () => {
|
|
79
|
-
i.contains(document.activeElement) || m();
|
|
80
|
-
};
|
|
81
|
-
return i.addEventListener("focusin", f), i.addEventListener("focusout", y), i.addEventListener("pointermove", f), i.addEventListener("pointerleave", g), window.addEventListener("blur", f), window.addEventListener("focus", m), () => {
|
|
82
|
-
i.removeEventListener("focusin", f), i.removeEventListener("focusout", y), i.removeEventListener("pointermove", f), i.removeEventListener("pointerleave", g), window.removeEventListener("blur", f), window.removeEventListener("focus", m);
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
}, [N, p.isClosePausedRef]);
|
|
86
|
-
const d = s.useCallback(
|
|
87
|
-
({ tabbingDirection: i }) => {
|
|
88
|
-
const f = v().map((m) => {
|
|
89
|
-
const y = m.ref.current, g = [y, ...Ze(y)];
|
|
90
|
-
return i === "forwards" ? g : g.reverse();
|
|
91
|
-
});
|
|
92
|
-
return (i === "forwards" ? f.reverse() : f).flat();
|
|
93
|
-
},
|
|
94
|
-
[v]
|
|
95
|
-
);
|
|
96
|
-
return s.useEffect(() => {
|
|
97
|
-
const i = x.current;
|
|
98
|
-
if (i) {
|
|
99
|
-
const E = (f) => {
|
|
100
|
-
const m = f.altKey || f.ctrlKey || f.metaKey;
|
|
101
|
-
if (f.key === "Tab" && !m) {
|
|
102
|
-
const g = document.activeElement, T = f.shiftKey;
|
|
103
|
-
if (f.target === i && T) {
|
|
104
|
-
c.current?.focus();
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
const _ = d({ tabbingDirection: T ? "backwards" : "forwards" }), k = _.findIndex((S) => S === g);
|
|
108
|
-
Y(_.slice(k + 1)) ? f.preventDefault() : T ? c.current?.focus() : h.current?.focus();
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
return i.addEventListener("keydown", E), () => i.removeEventListener("keydown", E);
|
|
112
|
-
}
|
|
113
|
-
}, [v, d]), /* @__PURE__ */ n.jsxs(
|
|
114
|
-
Ae,
|
|
115
|
-
{
|
|
116
|
-
ref: w,
|
|
117
|
-
role: "region",
|
|
118
|
-
"aria-label": u.replace("{hotkey}", C),
|
|
119
|
-
tabIndex: -1,
|
|
120
|
-
style: { pointerEvents: N ? void 0 : "none" },
|
|
121
|
-
children: [
|
|
122
|
-
N && /* @__PURE__ */ n.jsx(
|
|
123
|
-
z,
|
|
124
|
-
{
|
|
125
|
-
ref: c,
|
|
126
|
-
onFocusFromOutsideViewport: () => {
|
|
127
|
-
const i = d({
|
|
128
|
-
tabbingDirection: "forwards"
|
|
129
|
-
});
|
|
130
|
-
Y(i);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
),
|
|
134
|
-
/* @__PURE__ */ n.jsx(J.Slot, { scope: o, children: /* @__PURE__ */ n.jsx(A.ol, { tabIndex: -1, ...l, ref: D }) }),
|
|
135
|
-
N && /* @__PURE__ */ n.jsx(
|
|
136
|
-
z,
|
|
137
|
-
{
|
|
138
|
-
ref: h,
|
|
139
|
-
onFocusFromOutsideViewport: () => {
|
|
140
|
-
const i = d({
|
|
141
|
-
tabbingDirection: "backwards"
|
|
142
|
-
});
|
|
143
|
-
Y(i);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
)
|
|
147
|
-
]
|
|
148
|
-
}
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
);
|
|
152
|
-
ie.displayName = ae;
|
|
153
|
-
var ce = "ToastFocusProxy", z = s.forwardRef(
|
|
154
|
-
(e, t) => {
|
|
155
|
-
const { __scopeToast: o, onFocusFromOutsideViewport: r, ...u } = e, l = X(ce, o);
|
|
156
|
-
return /* @__PURE__ */ n.jsx(
|
|
157
|
-
re,
|
|
158
|
-
{
|
|
159
|
-
tabIndex: 0,
|
|
160
|
-
...u,
|
|
161
|
-
ref: t,
|
|
162
|
-
style: { position: "fixed" },
|
|
163
|
-
onFocus: (p) => {
|
|
164
|
-
const v = p.relatedTarget;
|
|
165
|
-
!l.viewport?.contains(v) && r();
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
);
|
|
171
|
-
z.displayName = ce;
|
|
172
|
-
var M = "Toast", $e = "toast.swipeStart", He = "toast.swipeMove", We = "toast.swipeCancel", Xe = "toast.swipeEnd", ue = s.forwardRef(
|
|
173
|
-
(e, t) => {
|
|
174
|
-
const { forceMount: o, open: r, defaultOpen: u, onOpenChange: l, ...p } = e, [v, w] = _e({
|
|
175
|
-
prop: r,
|
|
176
|
-
defaultProp: u ?? !0,
|
|
177
|
-
onChange: l,
|
|
178
|
-
caller: M
|
|
179
|
-
});
|
|
180
|
-
return /* @__PURE__ */ n.jsx(Fe, { present: o || v, children: /* @__PURE__ */ n.jsx(
|
|
181
|
-
Be,
|
|
182
|
-
{
|
|
183
|
-
open: v,
|
|
184
|
-
...p,
|
|
185
|
-
ref: t,
|
|
186
|
-
onClose: () => w(!1),
|
|
187
|
-
onPause: W(e.onPause),
|
|
188
|
-
onResume: W(e.onResume),
|
|
189
|
-
onSwipeStart: P(e.onSwipeStart, (c) => {
|
|
190
|
-
c.currentTarget.setAttribute("data-swipe", "start");
|
|
191
|
-
}),
|
|
192
|
-
onSwipeMove: P(e.onSwipeMove, (c) => {
|
|
193
|
-
const { x: h, y: x } = c.detail.delta;
|
|
194
|
-
c.currentTarget.setAttribute("data-swipe", "move"), c.currentTarget.style.setProperty("--radix-toast-swipe-move-x", `${h}px`), c.currentTarget.style.setProperty("--radix-toast-swipe-move-y", `${x}px`);
|
|
195
|
-
}),
|
|
196
|
-
onSwipeCancel: P(e.onSwipeCancel, (c) => {
|
|
197
|
-
c.currentTarget.setAttribute("data-swipe", "cancel"), c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), c.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"), c.currentTarget.style.removeProperty("--radix-toast-swipe-end-y");
|
|
198
|
-
}),
|
|
199
|
-
onSwipeEnd: P(e.onSwipeEnd, (c) => {
|
|
200
|
-
const { x: h, y: x } = c.detail.delta;
|
|
201
|
-
c.currentTarget.setAttribute("data-swipe", "end"), c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), c.currentTarget.style.setProperty("--radix-toast-swipe-end-x", `${h}px`), c.currentTarget.style.setProperty("--radix-toast-swipe-end-y", `${x}px`), w(!1);
|
|
202
|
-
})
|
|
203
|
-
}
|
|
204
|
-
) });
|
|
205
|
-
}
|
|
206
|
-
);
|
|
207
|
-
ue.displayName = M;
|
|
208
|
-
var [Ue, Ye] = se(M, {
|
|
209
|
-
onClose() {
|
|
210
|
-
}
|
|
211
|
-
}), Be = s.forwardRef(
|
|
212
|
-
(e, t) => {
|
|
213
|
-
const {
|
|
214
|
-
__scopeToast: o,
|
|
215
|
-
type: r = "foreground",
|
|
216
|
-
duration: u,
|
|
217
|
-
open: l,
|
|
218
|
-
onClose: p,
|
|
219
|
-
onEscapeKeyDown: v,
|
|
220
|
-
onPause: w,
|
|
221
|
-
onResume: c,
|
|
222
|
-
onSwipeStart: h,
|
|
223
|
-
onSwipeMove: x,
|
|
224
|
-
onSwipeCancel: D,
|
|
225
|
-
onSwipeEnd: C,
|
|
226
|
-
...N
|
|
227
|
-
} = e, d = X(M, o), [i, E] = s.useState(null), f = oe(t, (a) => E(a)), m = s.useRef(null), y = s.useRef(null), g = u || d.duration, T = s.useRef(0), F = s.useRef(g), O = s.useRef(0), { onToastAdd: _, onToastRemove: k } = d, S = W(() => {
|
|
228
|
-
i?.contains(document.activeElement) && d.viewport?.focus(), p();
|
|
229
|
-
}), V = s.useCallback(
|
|
230
|
-
(a) => {
|
|
231
|
-
!a || a === 1 / 0 || (window.clearTimeout(O.current), T.current = (/* @__PURE__ */ new Date()).getTime(), O.current = window.setTimeout(S, a));
|
|
232
|
-
},
|
|
233
|
-
[S]
|
|
234
|
-
);
|
|
235
|
-
s.useEffect(() => {
|
|
236
|
-
const a = d.viewport;
|
|
237
|
-
if (a) {
|
|
238
|
-
const b = () => {
|
|
239
|
-
V(F.current), c?.();
|
|
240
|
-
}, R = () => {
|
|
241
|
-
const j = (/* @__PURE__ */ new Date()).getTime() - T.current;
|
|
242
|
-
F.current = F.current - j, window.clearTimeout(O.current), w?.();
|
|
243
|
-
};
|
|
244
|
-
return a.addEventListener(B, R), a.addEventListener(q, b), () => {
|
|
245
|
-
a.removeEventListener(B, R), a.removeEventListener(q, b);
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
}, [d.viewport, g, w, c, V]), s.useEffect(() => {
|
|
249
|
-
l && !d.isClosePausedRef.current && V(g);
|
|
250
|
-
}, [l, g, d.isClosePausedRef, V]), s.useEffect(() => (_(), () => k()), [_, k]);
|
|
251
|
-
const Z = s.useMemo(() => i ? we(i) : null, [i]);
|
|
252
|
-
return d.viewport ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
|
|
253
|
-
Z && /* @__PURE__ */ n.jsx(
|
|
254
|
-
qe,
|
|
255
|
-
{
|
|
256
|
-
__scopeToast: o,
|
|
257
|
-
role: "status",
|
|
258
|
-
"aria-live": r === "foreground" ? "assertive" : "polite",
|
|
259
|
-
children: Z
|
|
260
|
-
}
|
|
261
|
-
),
|
|
262
|
-
/* @__PURE__ */ n.jsx(Ue, { scope: o, onClose: S, children: Re.createPortal(
|
|
263
|
-
/* @__PURE__ */ n.jsx(J.ItemSlot, { scope: o, children: /* @__PURE__ */ n.jsx(
|
|
264
|
-
Ie,
|
|
265
|
-
{
|
|
266
|
-
asChild: !0,
|
|
267
|
-
onEscapeKeyDown: P(v, () => {
|
|
268
|
-
d.isFocusedToastEscapeKeyDownRef.current || S(), d.isFocusedToastEscapeKeyDownRef.current = !1;
|
|
269
|
-
}),
|
|
270
|
-
children: /* @__PURE__ */ n.jsx(
|
|
271
|
-
A.li,
|
|
272
|
-
{
|
|
273
|
-
tabIndex: 0,
|
|
274
|
-
"data-state": l ? "open" : "closed",
|
|
275
|
-
"data-swipe-direction": d.swipeDirection,
|
|
276
|
-
...N,
|
|
277
|
-
ref: f,
|
|
278
|
-
style: { userSelect: "none", touchAction: "none", ...e.style },
|
|
279
|
-
onKeyDown: P(e.onKeyDown, (a) => {
|
|
280
|
-
a.key === "Escape" && (v?.(a.nativeEvent), a.nativeEvent.defaultPrevented || (d.isFocusedToastEscapeKeyDownRef.current = !0, S()));
|
|
281
|
-
}),
|
|
282
|
-
onPointerDown: P(e.onPointerDown, (a) => {
|
|
283
|
-
a.button === 0 && (m.current = { x: a.clientX, y: a.clientY });
|
|
284
|
-
}),
|
|
285
|
-
onPointerMove: P(e.onPointerMove, (a) => {
|
|
286
|
-
if (!m.current) return;
|
|
287
|
-
const b = a.clientX - m.current.x, R = a.clientY - m.current.y, j = !!y.current, L = ["left", "right"].includes(d.swipeDirection), K = ["left", "up"].includes(d.swipeDirection) ? Math.min : Math.max, Pe = L ? K(0, b) : 0, be = L ? 0 : K(0, R), U = a.pointerType === "touch" ? 10 : 2, $ = { x: Pe, y: be }, ee = { originalEvent: a, delta: $ };
|
|
288
|
-
j ? (y.current = $, H(He, x, ee, {
|
|
289
|
-
discrete: !1
|
|
290
|
-
})) : te($, d.swipeDirection, U) ? (y.current = $, H($e, h, ee, {
|
|
291
|
-
discrete: !1
|
|
292
|
-
}), a.target.setPointerCapture(a.pointerId)) : (Math.abs(b) > U || Math.abs(R) > U) && (m.current = null);
|
|
293
|
-
}),
|
|
294
|
-
onPointerUp: P(e.onPointerUp, (a) => {
|
|
295
|
-
const b = y.current, R = a.target;
|
|
296
|
-
if (R.hasPointerCapture(a.pointerId) && R.releasePointerCapture(a.pointerId), y.current = null, m.current = null, b) {
|
|
297
|
-
const j = a.currentTarget, L = { originalEvent: a, delta: b };
|
|
298
|
-
te(b, d.swipeDirection, d.swipeThreshold) ? H(Xe, C, L, {
|
|
299
|
-
discrete: !0
|
|
300
|
-
}) : H(
|
|
301
|
-
We,
|
|
302
|
-
D,
|
|
303
|
-
L,
|
|
304
|
-
{
|
|
305
|
-
discrete: !0
|
|
306
|
-
}
|
|
307
|
-
), j.addEventListener("click", (K) => K.preventDefault(), {
|
|
308
|
-
once: !0
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
})
|
|
312
|
-
}
|
|
313
|
-
)
|
|
314
|
-
}
|
|
315
|
-
) }),
|
|
316
|
-
d.viewport
|
|
317
|
-
) })
|
|
318
|
-
] }) : null;
|
|
319
|
-
}
|
|
320
|
-
), qe = (e) => {
|
|
321
|
-
const { __scopeToast: t, children: o, ...r } = e, u = X(M, t), [l, p] = s.useState(!1), [v, w] = s.useState(!1);
|
|
322
|
-
return Je(() => p(!0)), s.useEffect(() => {
|
|
323
|
-
const c = window.setTimeout(() => w(!0), 1e3);
|
|
324
|
-
return () => window.clearTimeout(c);
|
|
325
|
-
}, []), v ? null : /* @__PURE__ */ n.jsx(De, { asChild: !0, children: /* @__PURE__ */ n.jsx(re, { ...r, children: l && /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
|
|
326
|
-
u.label,
|
|
327
|
-
" ",
|
|
328
|
-
o
|
|
329
|
-
] }) }) });
|
|
330
|
-
}, ze = "ToastTitle", de = s.forwardRef(
|
|
331
|
-
(e, t) => {
|
|
332
|
-
const { __scopeToast: o, ...r } = e;
|
|
333
|
-
return /* @__PURE__ */ n.jsx(A.div, { ...r, ref: t });
|
|
334
|
-
}
|
|
335
|
-
);
|
|
336
|
-
de.displayName = ze;
|
|
337
|
-
var Ge = "ToastDescription", le = s.forwardRef(
|
|
338
|
-
(e, t) => {
|
|
339
|
-
const { __scopeToast: o, ...r } = e;
|
|
340
|
-
return /* @__PURE__ */ n.jsx(A.div, { ...r, ref: t });
|
|
341
|
-
}
|
|
342
|
-
);
|
|
343
|
-
le.displayName = Ge;
|
|
344
|
-
var pe = "ToastAction", fe = s.forwardRef(
|
|
345
|
-
(e, t) => {
|
|
346
|
-
const { altText: o, ...r } = e;
|
|
347
|
-
return o.trim() ? /* @__PURE__ */ n.jsx(ve, { altText: o, asChild: !0, children: /* @__PURE__ */ n.jsx(Q, { ...r, ref: t }) }) : (console.error(
|
|
348
|
-
`Invalid prop \`altText\` supplied to \`${pe}\`. Expected non-empty \`string\`.`
|
|
349
|
-
), null);
|
|
350
|
-
}
|
|
351
|
-
);
|
|
352
|
-
fe.displayName = pe;
|
|
353
|
-
var me = "ToastClose", Q = s.forwardRef(
|
|
354
|
-
(e, t) => {
|
|
355
|
-
const { __scopeToast: o, ...r } = e, u = Ye(me, o);
|
|
356
|
-
return /* @__PURE__ */ n.jsx(ve, { asChild: !0, children: /* @__PURE__ */ n.jsx(
|
|
357
|
-
A.button,
|
|
358
|
-
{
|
|
359
|
-
type: "button",
|
|
360
|
-
...r,
|
|
361
|
-
ref: t,
|
|
362
|
-
onClick: P(e.onClick, u.onClose)
|
|
363
|
-
}
|
|
364
|
-
) });
|
|
365
|
-
}
|
|
366
|
-
);
|
|
367
|
-
Q.displayName = me;
|
|
368
|
-
var ve = s.forwardRef((e, t) => {
|
|
369
|
-
const { __scopeToast: o, altText: r, ...u } = e;
|
|
370
|
-
return /* @__PURE__ */ n.jsx(
|
|
371
|
-
A.div,
|
|
372
|
-
{
|
|
373
|
-
"data-radix-toast-announce-exclude": "",
|
|
374
|
-
"data-radix-toast-announce-alt": r || void 0,
|
|
375
|
-
...u,
|
|
376
|
-
ref: t
|
|
377
|
-
}
|
|
378
|
-
);
|
|
379
|
-
});
|
|
380
|
-
function we(e) {
|
|
381
|
-
const t = [];
|
|
382
|
-
return Array.from(e.childNodes).forEach((r) => {
|
|
383
|
-
if (r.nodeType === r.TEXT_NODE && r.textContent && t.push(r.textContent), Qe(r)) {
|
|
384
|
-
const u = r.ariaHidden || r.hidden || r.style.display === "none", l = r.dataset.radixToastAnnounceExclude === "";
|
|
385
|
-
if (!u)
|
|
386
|
-
if (l) {
|
|
387
|
-
const p = r.dataset.radixToastAnnounceAlt;
|
|
388
|
-
p && t.push(p);
|
|
389
|
-
} else
|
|
390
|
-
t.push(...we(r));
|
|
391
|
-
}
|
|
392
|
-
}), t;
|
|
393
|
-
}
|
|
394
|
-
function H(e, t, o, { discrete: r }) {
|
|
395
|
-
const u = o.originalEvent.currentTarget, l = new CustomEvent(e, { bubbles: !0, cancelable: !0, detail: o });
|
|
396
|
-
t && u.addEventListener(e, t, { once: !0 }), r ? Ce(u, l) : u.dispatchEvent(l);
|
|
397
|
-
}
|
|
398
|
-
var te = (e, t, o = 0) => {
|
|
399
|
-
const r = Math.abs(e.x), u = Math.abs(e.y), l = r > u;
|
|
400
|
-
return t === "left" || t === "right" ? l && r > o : !l && u > o;
|
|
401
|
-
};
|
|
402
|
-
function Je(e = () => {
|
|
403
|
-
}) {
|
|
404
|
-
const t = W(e);
|
|
405
|
-
je(() => {
|
|
406
|
-
let o = 0, r = 0;
|
|
407
|
-
return o = window.requestAnimationFrame(() => r = window.requestAnimationFrame(t)), () => {
|
|
408
|
-
window.cancelAnimationFrame(o), window.cancelAnimationFrame(r);
|
|
409
|
-
};
|
|
410
|
-
}, [t]);
|
|
411
|
-
}
|
|
412
|
-
function Qe(e) {
|
|
413
|
-
return e.nodeType === e.ELEMENT_NODE;
|
|
414
|
-
}
|
|
415
|
-
function Ze(e) {
|
|
416
|
-
const t = [], o = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
417
|
-
acceptNode: (r) => {
|
|
418
|
-
const u = r.tagName === "INPUT" && r.type === "hidden";
|
|
419
|
-
return r.disabled || r.hidden || u ? NodeFilter.FILTER_SKIP : r.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
for (; o.nextNode(); ) t.push(o.currentNode);
|
|
423
|
-
return t;
|
|
424
|
-
}
|
|
425
|
-
function Y(e) {
|
|
426
|
-
const t = document.activeElement;
|
|
427
|
-
return e.some((o) => o === t ? !0 : (o.focus(), document.activeElement !== t));
|
|
428
|
-
}
|
|
429
|
-
var et = ne, Te = ie, xe = ue, Ee = de, ye = le, ge = fe, he = Q;
|
|
430
|
-
const Pt = et, tt = s.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ n.jsx(
|
|
431
|
-
Te,
|
|
432
|
-
{
|
|
433
|
-
ref: o,
|
|
434
|
-
className: I(
|
|
435
|
-
"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:top-auto sm:right-0 sm:bottom-0 sm:flex-col md:max-w-[420px]",
|
|
436
|
-
e
|
|
437
|
-
),
|
|
438
|
-
...t
|
|
439
|
-
}
|
|
440
|
-
));
|
|
441
|
-
tt.displayName = Te?.displayName || "ToastViewport";
|
|
442
|
-
const ot = Le(
|
|
443
|
-
"group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
|
|
444
|
-
{
|
|
445
|
-
variants: {
|
|
446
|
-
variant: {
|
|
447
|
-
default: "border bg-background text-foreground",
|
|
448
|
-
destructive: "destructive group border-destructive bg-destructive text-destructive-foreground"
|
|
449
|
-
}
|
|
450
|
-
},
|
|
451
|
-
defaultVariants: {
|
|
452
|
-
variant: "default"
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
), rt = s.forwardRef(({ className: e, variant: t, ...o }, r) => /* @__PURE__ */ n.jsx(xe, { ref: r, className: I(ot({ variant: t }), e), ...o }));
|
|
456
|
-
rt.displayName = xe?.displayName || "Toast";
|
|
457
|
-
const st = s.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ n.jsx(
|
|
458
|
-
ge,
|
|
459
|
-
{
|
|
460
|
-
ref: o,
|
|
461
|
-
className: I(
|
|
462
|
-
"hover:bg-secondary focus:ring-ring group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors focus:ring-1 focus:outline-none disabled:pointer-events-none disabled:opacity-50",
|
|
463
|
-
e
|
|
464
|
-
),
|
|
465
|
-
...t
|
|
466
|
-
}
|
|
467
|
-
));
|
|
468
|
-
st.displayName = ge?.displayName || "ToastAction";
|
|
469
|
-
const nt = s.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ n.jsx(
|
|
470
|
-
he,
|
|
471
|
-
{
|
|
472
|
-
ref: o,
|
|
473
|
-
className: I(
|
|
474
|
-
"text-foreground/50 hover:text-foreground absolute top-1 right-1 rounded-md p-1 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:ring-1 focus:outline-none group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",
|
|
475
|
-
e
|
|
476
|
-
),
|
|
477
|
-
"toast-close": "",
|
|
478
|
-
...t,
|
|
479
|
-
children: /* @__PURE__ */ n.jsx(Me, { className: "h-4 w-4" })
|
|
480
|
-
}
|
|
481
|
-
));
|
|
482
|
-
nt.displayName = he?.displayName || "ToastClose";
|
|
483
|
-
const at = s.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ n.jsx(Ee, { ref: o, className: I("text-sm font-semibold [&+div]:text-xs", e), ...t }));
|
|
484
|
-
at.displayName = Ee?.displayName || "ToastTitle";
|
|
485
|
-
const it = s.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ n.jsx(ye, { ref: o, className: I("text-sm opacity-90", e), ...t }));
|
|
486
|
-
it.displayName = ye?.displayName || "ToastDescription";
|
|
487
|
-
export {
|
|
488
|
-
rt as Toast,
|
|
489
|
-
st as ToastAction,
|
|
490
|
-
nt as ToastClose,
|
|
491
|
-
it as ToastDescription,
|
|
492
|
-
Pt as ToastProvider,
|
|
493
|
-
at as ToastTitle,
|
|
494
|
-
tt as ToastViewport
|
|
495
|
-
};
|
|
2
|
+
"use client";
|
|
3
|
+
import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./toast-CQbUslcw.mjs";
|
|
4
|
+
export { o as Toast, n as ToastAction, i as ToastClose, t as ToastDescription, e as ToastProvider, r as ToastTitle, a as ToastViewport };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./jsx-runtime-CN3qjQQx.js`),t=require(`./toast-C84Cpidq.js`);let n=require(`react`);n=e.i(n);var r=1,i=1e6,a={ADD_TOAST:`ADD_TOAST`,UPDATE_TOAST:`UPDATE_TOAST`,DISMISS_TOAST:`DISMISS_TOAST`,REMOVE_TOAST:`REMOVE_TOAST`},o=0;function s(){return o=(o+1)%(2**53-1),o.toString()}var c=new Map,l=e=>{if(c.has(e))return;let t=setTimeout(()=>{c.delete(e),p({type:`REMOVE_TOAST`,toastId:e})},i);c.set(e,t)},u=(e,t)=>{switch(t.type){case a.ADD_TOAST:return{...e,toasts:[t.toast,...e.toasts].slice(0,r)};case a.UPDATE_TOAST:return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case a.DISMISS_TOAST:{let{toastId:n}=t;return n?l(n):e.toasts.forEach(e=>{l(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===n||n===void 0?{...e,open:!1}:e)}}case a.REMOVE_TOAST:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},d=[],f={toasts:[]};function p(e){f=u(f,e),d.forEach(e=>{e(f)})}function m({...e}){let t=s(),n=e=>p({type:`UPDATE_TOAST`,toast:{...e,id:t}}),r=()=>p({type:`DISMISS_TOAST`,toastId:t});return p({type:`ADD_TOAST`,toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:n}}function h(){let[e,t]=n.useState(f);return n.useEffect(()=>(d.push(t),()=>{let e=d.indexOf(t);e>-1&&d.splice(e,1)}),[e]),{...e,toast:m,dismiss:e=>p({type:`DISMISS_TOAST`,toastId:e})}}var g=e.t();function _({...e}){let{toasts:n}=h();return(0,g.jsxs)(t.a,{...e,children:[n.map(function({id:e,title:n,description:r,action:i,...a}){return(0,g.jsxs)(t.t,{...a,children:[(0,g.jsxs)(`div`,{className:`grid gap-1`,children:[n&&(0,g.jsx)(t.o,{children:n}),r&&(0,g.jsx)(t.i,{children:r})]}),i,(0,g.jsx)(t.r,{})]},e)}),(0,g.jsx)(t.s,{})]})}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return _}});
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { t as e } from "./jsx-runtime-CW53Uo-e.mjs";
|
|
2
|
+
import { a as t, i as n, o as r, r as i, s as a, t as o } from "./toast-CQbUslcw.mjs";
|
|
3
|
+
import * as s from "react";
|
|
4
|
+
//#region src/hooks/use-toast.ts
|
|
5
|
+
var c = 1, l = 1e6, u = {
|
|
6
|
+
ADD_TOAST: "ADD_TOAST",
|
|
7
|
+
UPDATE_TOAST: "UPDATE_TOAST",
|
|
8
|
+
DISMISS_TOAST: "DISMISS_TOAST",
|
|
9
|
+
REMOVE_TOAST: "REMOVE_TOAST"
|
|
10
|
+
}, d = 0;
|
|
11
|
+
function f() {
|
|
12
|
+
return d = (d + 1) % (2 ** 53 - 1), d.toString();
|
|
13
|
+
}
|
|
14
|
+
var p = /* @__PURE__ */ new Map(), m = (e) => {
|
|
15
|
+
if (p.has(e)) return;
|
|
16
|
+
let t = setTimeout(() => {
|
|
17
|
+
p.delete(e), v({
|
|
18
|
+
type: "REMOVE_TOAST",
|
|
19
|
+
toastId: e
|
|
20
|
+
});
|
|
21
|
+
}, l);
|
|
22
|
+
p.set(e, t);
|
|
23
|
+
}, h = (e, t) => {
|
|
24
|
+
switch (t.type) {
|
|
25
|
+
case u.ADD_TOAST: return {
|
|
26
|
+
...e,
|
|
27
|
+
toasts: [t.toast, ...e.toasts].slice(0, c)
|
|
28
|
+
};
|
|
29
|
+
case u.UPDATE_TOAST: return {
|
|
30
|
+
...e,
|
|
31
|
+
toasts: e.toasts.map((e) => e.id === t.toast.id ? {
|
|
32
|
+
...e,
|
|
33
|
+
...t.toast
|
|
34
|
+
} : e)
|
|
35
|
+
};
|
|
36
|
+
case u.DISMISS_TOAST: {
|
|
37
|
+
let { toastId: n } = t;
|
|
38
|
+
return n ? m(n) : e.toasts.forEach((e) => {
|
|
39
|
+
m(e.id);
|
|
40
|
+
}), {
|
|
41
|
+
...e,
|
|
42
|
+
toasts: e.toasts.map((e) => e.id === n || n === void 0 ? {
|
|
43
|
+
...e,
|
|
44
|
+
open: !1
|
|
45
|
+
} : e)
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
case u.REMOVE_TOAST: return t.toastId === void 0 ? {
|
|
49
|
+
...e,
|
|
50
|
+
toasts: []
|
|
51
|
+
} : {
|
|
52
|
+
...e,
|
|
53
|
+
toasts: e.toasts.filter((e) => e.id !== t.toastId)
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}, g = [], _ = { toasts: [] };
|
|
57
|
+
function v(e) {
|
|
58
|
+
_ = h(_, e), g.forEach((e) => {
|
|
59
|
+
e(_);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function y({ ...e }) {
|
|
63
|
+
let t = f(), n = (e) => v({
|
|
64
|
+
type: "UPDATE_TOAST",
|
|
65
|
+
toast: {
|
|
66
|
+
...e,
|
|
67
|
+
id: t
|
|
68
|
+
}
|
|
69
|
+
}), r = () => v({
|
|
70
|
+
type: "DISMISS_TOAST",
|
|
71
|
+
toastId: t
|
|
72
|
+
});
|
|
73
|
+
return v({
|
|
74
|
+
type: "ADD_TOAST",
|
|
75
|
+
toast: {
|
|
76
|
+
...e,
|
|
77
|
+
id: t,
|
|
78
|
+
open: !0,
|
|
79
|
+
onOpenChange: (e) => {
|
|
80
|
+
e || r();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}), {
|
|
84
|
+
id: t,
|
|
85
|
+
dismiss: r,
|
|
86
|
+
update: n
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function b() {
|
|
90
|
+
let [e, t] = s.useState(_);
|
|
91
|
+
return s.useEffect(() => (g.push(t), () => {
|
|
92
|
+
let e = g.indexOf(t);
|
|
93
|
+
e > -1 && g.splice(e, 1);
|
|
94
|
+
}), [e]), {
|
|
95
|
+
...e,
|
|
96
|
+
toast: y,
|
|
97
|
+
dismiss: (e) => v({
|
|
98
|
+
type: "DISMISS_TOAST",
|
|
99
|
+
toastId: e
|
|
100
|
+
})
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/toaster.tsx
|
|
105
|
+
var x = e();
|
|
106
|
+
function S({ ...e }) {
|
|
107
|
+
let { toasts: s } = b();
|
|
108
|
+
return /* @__PURE__ */ (0, x.jsxs)(t, {
|
|
109
|
+
...e,
|
|
110
|
+
children: [s.map(function({ id: e, title: t, description: a, action: s, ...c }) {
|
|
111
|
+
return /* @__PURE__ */ (0, x.jsxs)(o, {
|
|
112
|
+
...c,
|
|
113
|
+
children: [
|
|
114
|
+
/* @__PURE__ */ (0, x.jsxs)("div", {
|
|
115
|
+
className: "grid gap-1",
|
|
116
|
+
children: [t && /* @__PURE__ */ (0, x.jsx)(r, { children: t }), a && /* @__PURE__ */ (0, x.jsx)(n, { children: a })]
|
|
117
|
+
}),
|
|
118
|
+
s,
|
|
119
|
+
/* @__PURE__ */ (0, x.jsx)(i, {})
|
|
120
|
+
]
|
|
121
|
+
}, e);
|
|
122
|
+
}), /* @__PURE__ */ (0, x.jsx)(a, {})]
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
//#endregion
|
|
126
|
+
export { y as n, b as r, S as t };
|
package/dist/toaster.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use
|
|
1
|
+
"use client";"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./toaster-BpcpNRz1.js`);exports.Toaster=e.t;
|
package/dist/toaster.mjs
CHANGED