@gv-tech/ui-web 2.19.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
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
import { t as e } from "./jsx-runtime-CW53Uo-e.mjs";
|
|
2
|
+
import { t } from "./utils-yc5uc46c.mjs";
|
|
3
|
+
import { n } from "./dist-Cvwtowos.mjs";
|
|
4
|
+
import { n as r } from "./dist-BC_VB6JL.mjs";
|
|
5
|
+
import { n as i, r as a, t as o } from "./dist-bDoR0CBU.mjs";
|
|
6
|
+
import { t as s } from "./dist-BrCTkQXt.mjs";
|
|
7
|
+
import { t as c } from "./dist-BmjFh8i_.mjs";
|
|
8
|
+
import { t as l } from "./dist-VI9bl_Wk.mjs";
|
|
9
|
+
import { t as u } from "./dist-d_pecHgw.mjs";
|
|
10
|
+
import { t as d } from "./dist-ALQAoSGx.mjs";
|
|
11
|
+
import { r as f, t as p } from "./dist-Ba7mQG9D.mjs";
|
|
12
|
+
import { t as m } from "./dist-Jtk3jeb9.mjs";
|
|
13
|
+
import { r as h } from "./dist-C9wnUiS4.mjs";
|
|
14
|
+
import * as g from "react";
|
|
15
|
+
import * as ee from "react-dom";
|
|
16
|
+
import { X as _ } from "lucide-react";
|
|
17
|
+
import { cva as v } from "class-variance-authority";
|
|
18
|
+
//#region ../../node_modules/.bun/@radix-ui+react-toast@1.2.15+2d3f272c3a65784a/node_modules/@radix-ui/react-toast/dist/index.mjs
|
|
19
|
+
var y = e(), b = "ToastProvider", [x, S, C] = s("Toast"), [w, te] = n("Toast", [C]), [T, E] = w(b), D = (e) => {
|
|
20
|
+
let { __scopeToast: t, label: n = "Notification", duration: r = 5e3, swipeDirection: i = "right", swipeThreshold: a = 50, children: o } = e, [s, c] = g.useState(null), [l, u] = g.useState(0), d = g.useRef(!1), f = g.useRef(!1);
|
|
21
|
+
return n.trim() || console.error(`Invalid prop \`label\` supplied to \`${b}\`. Expected non-empty \`string\`.`), /* @__PURE__ */ (0, y.jsx)(x.Provider, {
|
|
22
|
+
scope: t,
|
|
23
|
+
children: /* @__PURE__ */ (0, y.jsx)(T, {
|
|
24
|
+
scope: t,
|
|
25
|
+
label: n,
|
|
26
|
+
duration: r,
|
|
27
|
+
swipeDirection: i,
|
|
28
|
+
swipeThreshold: a,
|
|
29
|
+
toastCount: l,
|
|
30
|
+
viewport: s,
|
|
31
|
+
onViewportChange: c,
|
|
32
|
+
onToastAdd: g.useCallback(() => u((e) => e + 1), []),
|
|
33
|
+
onToastRemove: g.useCallback(() => u((e) => e - 1), []),
|
|
34
|
+
isFocusedToastEscapeKeyDownRef: d,
|
|
35
|
+
isClosePausedRef: f,
|
|
36
|
+
children: o
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
D.displayName = b;
|
|
41
|
+
var O = "ToastViewport", k = ["F8"], A = "toast.viewportPause", j = "toast.viewportResume", M = g.forwardRef((e, t) => {
|
|
42
|
+
let { __scopeToast: n, hotkey: i = k, label: a = "Notifications ({hotkey})", ...s } = e, c = E(O, n), l = S(n), u = g.useRef(null), d = g.useRef(null), f = g.useRef(null), m = g.useRef(null), h = r(t, m, c.onViewportChange), ee = i.join("+").replace(/Key/g, "").replace(/Digit/g, ""), _ = c.toastCount > 0;
|
|
43
|
+
g.useEffect(() => {
|
|
44
|
+
let e = (e) => {
|
|
45
|
+
i.length !== 0 && i.every((t) => e[t] || e.code === t) && m.current?.focus();
|
|
46
|
+
};
|
|
47
|
+
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
48
|
+
}, [i]), g.useEffect(() => {
|
|
49
|
+
let e = u.current, t = m.current;
|
|
50
|
+
if (_ && e && t) {
|
|
51
|
+
let n = () => {
|
|
52
|
+
if (!c.isClosePausedRef.current) {
|
|
53
|
+
let e = new CustomEvent(A);
|
|
54
|
+
t.dispatchEvent(e), c.isClosePausedRef.current = !0;
|
|
55
|
+
}
|
|
56
|
+
}, r = () => {
|
|
57
|
+
if (c.isClosePausedRef.current) {
|
|
58
|
+
let e = new CustomEvent(j);
|
|
59
|
+
t.dispatchEvent(e), c.isClosePausedRef.current = !1;
|
|
60
|
+
}
|
|
61
|
+
}, i = (t) => {
|
|
62
|
+
e.contains(t.relatedTarget) || r();
|
|
63
|
+
}, a = () => {
|
|
64
|
+
e.contains(document.activeElement) || r();
|
|
65
|
+
};
|
|
66
|
+
return e.addEventListener("focusin", n), e.addEventListener("focusout", i), e.addEventListener("pointermove", n), e.addEventListener("pointerleave", a), window.addEventListener("blur", n), window.addEventListener("focus", r), () => {
|
|
67
|
+
e.removeEventListener("focusin", n), e.removeEventListener("focusout", i), e.removeEventListener("pointermove", n), e.removeEventListener("pointerleave", a), window.removeEventListener("blur", n), window.removeEventListener("focus", r);
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}, [_, c.isClosePausedRef]);
|
|
71
|
+
let v = g.useCallback(({ tabbingDirection: e }) => {
|
|
72
|
+
let t = l().map((t) => {
|
|
73
|
+
let n = t.ref.current, r = [n, ...fe(n)];
|
|
74
|
+
return e === "forwards" ? r : r.reverse();
|
|
75
|
+
});
|
|
76
|
+
return (e === "forwards" ? t.reverse() : t).flat();
|
|
77
|
+
}, [l]);
|
|
78
|
+
return g.useEffect(() => {
|
|
79
|
+
let e = m.current;
|
|
80
|
+
if (e) {
|
|
81
|
+
let t = (t) => {
|
|
82
|
+
let n = t.altKey || t.ctrlKey || t.metaKey;
|
|
83
|
+
if (t.key === "Tab" && !n) {
|
|
84
|
+
let n = document.activeElement, r = t.shiftKey;
|
|
85
|
+
if (t.target === e && r) {
|
|
86
|
+
d.current?.focus();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
let i = v({ tabbingDirection: r ? "backwards" : "forwards" }), a = i.findIndex((e) => e === n);
|
|
90
|
+
Y(i.slice(a + 1)) ? t.preventDefault() : r ? d.current?.focus() : f.current?.focus();
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
return e.addEventListener("keydown", t), () => e.removeEventListener("keydown", t);
|
|
94
|
+
}
|
|
95
|
+
}, [l, v]), /* @__PURE__ */ (0, y.jsxs)(p, {
|
|
96
|
+
ref: u,
|
|
97
|
+
role: "region",
|
|
98
|
+
"aria-label": a.replace("{hotkey}", ee),
|
|
99
|
+
tabIndex: -1,
|
|
100
|
+
style: { pointerEvents: _ ? void 0 : "none" },
|
|
101
|
+
children: [
|
|
102
|
+
_ && /* @__PURE__ */ (0, y.jsx)(P, {
|
|
103
|
+
ref: d,
|
|
104
|
+
onFocusFromOutsideViewport: () => {
|
|
105
|
+
Y(v({ tabbingDirection: "forwards" }));
|
|
106
|
+
}
|
|
107
|
+
}),
|
|
108
|
+
/* @__PURE__ */ (0, y.jsx)(x.Slot, {
|
|
109
|
+
scope: n,
|
|
110
|
+
children: /* @__PURE__ */ (0, y.jsx)(o.ol, {
|
|
111
|
+
tabIndex: -1,
|
|
112
|
+
...s,
|
|
113
|
+
ref: h
|
|
114
|
+
})
|
|
115
|
+
}),
|
|
116
|
+
_ && /* @__PURE__ */ (0, y.jsx)(P, {
|
|
117
|
+
ref: f,
|
|
118
|
+
onFocusFromOutsideViewport: () => {
|
|
119
|
+
Y(v({ tabbingDirection: "backwards" }));
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
]
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
M.displayName = O;
|
|
126
|
+
var N = "ToastFocusProxy", P = g.forwardRef((e, t) => {
|
|
127
|
+
let { __scopeToast: n, onFocusFromOutsideViewport: r, ...i } = e, a = E(N, n);
|
|
128
|
+
return /* @__PURE__ */ (0, y.jsx)(h, {
|
|
129
|
+
tabIndex: 0,
|
|
130
|
+
...i,
|
|
131
|
+
ref: t,
|
|
132
|
+
style: { position: "fixed" },
|
|
133
|
+
onFocus: (e) => {
|
|
134
|
+
let t = e.relatedTarget;
|
|
135
|
+
a.viewport?.contains(t) || r();
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
P.displayName = N;
|
|
140
|
+
var F = "Toast", ne = "toast.swipeStart", re = "toast.swipeMove", ie = "toast.swipeCancel", ae = "toast.swipeEnd", I = g.forwardRef((e, t) => {
|
|
141
|
+
let { forceMount: n, open: r, defaultOpen: i, onOpenChange: o, ...s } = e, [c, f] = l({
|
|
142
|
+
prop: r,
|
|
143
|
+
defaultProp: i ?? !0,
|
|
144
|
+
onChange: o,
|
|
145
|
+
caller: F
|
|
146
|
+
});
|
|
147
|
+
return /* @__PURE__ */ (0, y.jsx)(u, {
|
|
148
|
+
present: n || c,
|
|
149
|
+
children: /* @__PURE__ */ (0, y.jsx)(R, {
|
|
150
|
+
open: c,
|
|
151
|
+
...s,
|
|
152
|
+
ref: t,
|
|
153
|
+
onClose: () => f(!1),
|
|
154
|
+
onPause: d(e.onPause),
|
|
155
|
+
onResume: d(e.onResume),
|
|
156
|
+
onSwipeStart: a(e.onSwipeStart, (e) => {
|
|
157
|
+
e.currentTarget.setAttribute("data-swipe", "start");
|
|
158
|
+
}),
|
|
159
|
+
onSwipeMove: a(e.onSwipeMove, (e) => {
|
|
160
|
+
let { x: t, y: n } = e.detail.delta;
|
|
161
|
+
e.currentTarget.setAttribute("data-swipe", "move"), e.currentTarget.style.setProperty("--radix-toast-swipe-move-x", `${t}px`), e.currentTarget.style.setProperty("--radix-toast-swipe-move-y", `${n}px`);
|
|
162
|
+
}),
|
|
163
|
+
onSwipeCancel: a(e.onSwipeCancel, (e) => {
|
|
164
|
+
e.currentTarget.setAttribute("data-swipe", "cancel"), e.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), e.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), e.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"), e.currentTarget.style.removeProperty("--radix-toast-swipe-end-y");
|
|
165
|
+
}),
|
|
166
|
+
onSwipeEnd: a(e.onSwipeEnd, (e) => {
|
|
167
|
+
let { x: t, y: n } = e.detail.delta;
|
|
168
|
+
e.currentTarget.setAttribute("data-swipe", "end"), e.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), e.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), e.currentTarget.style.setProperty("--radix-toast-swipe-end-x", `${t}px`), e.currentTarget.style.setProperty("--radix-toast-swipe-end-y", `${n}px`), f(!1);
|
|
169
|
+
})
|
|
170
|
+
})
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
I.displayName = F;
|
|
174
|
+
var [oe, L] = w(F, { onClose() {} }), R = g.forwardRef((e, t) => {
|
|
175
|
+
let { __scopeToast: n, type: i = "foreground", duration: s, open: c, onClose: l, onEscapeKeyDown: u, onPause: p, onResume: m, onSwipeStart: h, onSwipeMove: _, onSwipeCancel: v, onSwipeEnd: b, ...S } = e, C = E(F, n), [w, te] = g.useState(null), T = r(t, (e) => te(e)), D = g.useRef(null), O = g.useRef(null), k = s || C.duration, M = g.useRef(0), N = g.useRef(k), P = g.useRef(0), { onToastAdd: I, onToastRemove: L } = C, R = d(() => {
|
|
176
|
+
w?.contains(document.activeElement) && C.viewport?.focus(), l();
|
|
177
|
+
}), z = g.useCallback((e) => {
|
|
178
|
+
!e || e === Infinity || (window.clearTimeout(P.current), M.current = (/* @__PURE__ */ new Date()).getTime(), P.current = window.setTimeout(R, e));
|
|
179
|
+
}, [R]);
|
|
180
|
+
g.useEffect(() => {
|
|
181
|
+
let e = C.viewport;
|
|
182
|
+
if (e) {
|
|
183
|
+
let t = () => {
|
|
184
|
+
z(N.current), m?.();
|
|
185
|
+
}, n = () => {
|
|
186
|
+
let e = (/* @__PURE__ */ new Date()).getTime() - M.current;
|
|
187
|
+
N.current -= e, window.clearTimeout(P.current), p?.();
|
|
188
|
+
};
|
|
189
|
+
return e.addEventListener(A, n), e.addEventListener(j, t), () => {
|
|
190
|
+
e.removeEventListener(A, n), e.removeEventListener(j, t);
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}, [
|
|
194
|
+
C.viewport,
|
|
195
|
+
k,
|
|
196
|
+
p,
|
|
197
|
+
m,
|
|
198
|
+
z
|
|
199
|
+
]), g.useEffect(() => {
|
|
200
|
+
c && !C.isClosePausedRef.current && z(k);
|
|
201
|
+
}, [
|
|
202
|
+
c,
|
|
203
|
+
k,
|
|
204
|
+
C.isClosePausedRef,
|
|
205
|
+
z
|
|
206
|
+
]), g.useEffect(() => (I(), () => L()), [I, L]);
|
|
207
|
+
let B = g.useMemo(() => w ? K(w) : null, [w]);
|
|
208
|
+
return C.viewport ? /* @__PURE__ */ (0, y.jsxs)(y.Fragment, { children: [B && /* @__PURE__ */ (0, y.jsx)(se, {
|
|
209
|
+
__scopeToast: n,
|
|
210
|
+
role: "status",
|
|
211
|
+
"aria-live": i === "foreground" ? "assertive" : "polite",
|
|
212
|
+
children: B
|
|
213
|
+
}), /* @__PURE__ */ (0, y.jsx)(oe, {
|
|
214
|
+
scope: n,
|
|
215
|
+
onClose: R,
|
|
216
|
+
children: ee.createPortal(/* @__PURE__ */ (0, y.jsx)(x.ItemSlot, {
|
|
217
|
+
scope: n,
|
|
218
|
+
children: /* @__PURE__ */ (0, y.jsx)(f, {
|
|
219
|
+
asChild: !0,
|
|
220
|
+
onEscapeKeyDown: a(u, () => {
|
|
221
|
+
C.isFocusedToastEscapeKeyDownRef.current || R(), C.isFocusedToastEscapeKeyDownRef.current = !1;
|
|
222
|
+
}),
|
|
223
|
+
children: /* @__PURE__ */ (0, y.jsx)(o.li, {
|
|
224
|
+
tabIndex: 0,
|
|
225
|
+
"data-state": c ? "open" : "closed",
|
|
226
|
+
"data-swipe-direction": C.swipeDirection,
|
|
227
|
+
...S,
|
|
228
|
+
ref: T,
|
|
229
|
+
style: {
|
|
230
|
+
userSelect: "none",
|
|
231
|
+
touchAction: "none",
|
|
232
|
+
...e.style
|
|
233
|
+
},
|
|
234
|
+
onKeyDown: a(e.onKeyDown, (e) => {
|
|
235
|
+
e.key === "Escape" && (u?.(e.nativeEvent), e.nativeEvent.defaultPrevented || (C.isFocusedToastEscapeKeyDownRef.current = !0, R()));
|
|
236
|
+
}),
|
|
237
|
+
onPointerDown: a(e.onPointerDown, (e) => {
|
|
238
|
+
e.button === 0 && (D.current = {
|
|
239
|
+
x: e.clientX,
|
|
240
|
+
y: e.clientY
|
|
241
|
+
});
|
|
242
|
+
}),
|
|
243
|
+
onPointerMove: a(e.onPointerMove, (e) => {
|
|
244
|
+
if (!D.current) return;
|
|
245
|
+
let t = e.clientX - D.current.x, n = e.clientY - D.current.y, r = !!O.current, i = ["left", "right"].includes(C.swipeDirection), a = ["left", "up"].includes(C.swipeDirection) ? Math.min : Math.max, o = i ? a(0, t) : 0, s = i ? 0 : a(0, n), c = e.pointerType === "touch" ? 10 : 2, l = {
|
|
246
|
+
x: o,
|
|
247
|
+
y: s
|
|
248
|
+
}, u = {
|
|
249
|
+
originalEvent: e,
|
|
250
|
+
delta: l
|
|
251
|
+
};
|
|
252
|
+
r ? (O.current = l, q(re, _, u, { discrete: !1 })) : J(l, C.swipeDirection, c) ? (O.current = l, q(ne, h, u, { discrete: !1 }), e.target.setPointerCapture(e.pointerId)) : (Math.abs(t) > c || Math.abs(n) > c) && (D.current = null);
|
|
253
|
+
}),
|
|
254
|
+
onPointerUp: a(e.onPointerUp, (e) => {
|
|
255
|
+
let t = O.current, n = e.target;
|
|
256
|
+
if (n.hasPointerCapture(e.pointerId) && n.releasePointerCapture(e.pointerId), O.current = null, D.current = null, t) {
|
|
257
|
+
let n = e.currentTarget, r = {
|
|
258
|
+
originalEvent: e,
|
|
259
|
+
delta: t
|
|
260
|
+
};
|
|
261
|
+
J(t, C.swipeDirection, C.swipeThreshold) ? q(ae, b, r, { discrete: !0 }) : q(ie, v, r, { discrete: !0 }), n.addEventListener("click", (e) => e.preventDefault(), { once: !0 });
|
|
262
|
+
}
|
|
263
|
+
})
|
|
264
|
+
})
|
|
265
|
+
})
|
|
266
|
+
}), C.viewport)
|
|
267
|
+
})] }) : null;
|
|
268
|
+
}), se = (e) => {
|
|
269
|
+
let { __scopeToast: t, children: n, ...r } = e, i = E(F, t), [a, o] = g.useState(!1), [s, c] = g.useState(!1);
|
|
270
|
+
return ue(() => o(!0)), g.useEffect(() => {
|
|
271
|
+
let e = window.setTimeout(() => c(!0), 1e3);
|
|
272
|
+
return () => window.clearTimeout(e);
|
|
273
|
+
}, []), s ? null : /* @__PURE__ */ (0, y.jsx)(m, {
|
|
274
|
+
asChild: !0,
|
|
275
|
+
children: /* @__PURE__ */ (0, y.jsx)(h, {
|
|
276
|
+
...r,
|
|
277
|
+
children: a && /* @__PURE__ */ (0, y.jsxs)(y.Fragment, { children: [
|
|
278
|
+
i.label,
|
|
279
|
+
" ",
|
|
280
|
+
n
|
|
281
|
+
] })
|
|
282
|
+
})
|
|
283
|
+
});
|
|
284
|
+
}, z = "ToastTitle", B = g.forwardRef((e, t) => {
|
|
285
|
+
let { __scopeToast: n, ...r } = e;
|
|
286
|
+
return /* @__PURE__ */ (0, y.jsx)(o.div, {
|
|
287
|
+
...r,
|
|
288
|
+
ref: t
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
B.displayName = z;
|
|
292
|
+
var ce = "ToastDescription", V = g.forwardRef((e, t) => {
|
|
293
|
+
let { __scopeToast: n, ...r } = e;
|
|
294
|
+
return /* @__PURE__ */ (0, y.jsx)(o.div, {
|
|
295
|
+
...r,
|
|
296
|
+
ref: t
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
V.displayName = ce;
|
|
300
|
+
var le = "ToastAction", H = g.forwardRef((e, t) => {
|
|
301
|
+
let { altText: n, ...r } = e;
|
|
302
|
+
return n.trim() ? /* @__PURE__ */ (0, y.jsx)(G, {
|
|
303
|
+
altText: n,
|
|
304
|
+
asChild: !0,
|
|
305
|
+
children: /* @__PURE__ */ (0, y.jsx)(W, {
|
|
306
|
+
...r,
|
|
307
|
+
ref: t
|
|
308
|
+
})
|
|
309
|
+
}) : (console.error(`Invalid prop \`altText\` supplied to \`${le}\`. Expected non-empty \`string\`.`), null);
|
|
310
|
+
});
|
|
311
|
+
H.displayName = le;
|
|
312
|
+
var U = "ToastClose", W = g.forwardRef((e, t) => {
|
|
313
|
+
let { __scopeToast: n, ...r } = e, i = L(U, n);
|
|
314
|
+
return /* @__PURE__ */ (0, y.jsx)(G, {
|
|
315
|
+
asChild: !0,
|
|
316
|
+
children: /* @__PURE__ */ (0, y.jsx)(o.button, {
|
|
317
|
+
type: "button",
|
|
318
|
+
...r,
|
|
319
|
+
ref: t,
|
|
320
|
+
onClick: a(e.onClick, i.onClose)
|
|
321
|
+
})
|
|
322
|
+
});
|
|
323
|
+
});
|
|
324
|
+
W.displayName = U;
|
|
325
|
+
var G = g.forwardRef((e, t) => {
|
|
326
|
+
let { __scopeToast: n, altText: r, ...i } = e;
|
|
327
|
+
return /* @__PURE__ */ (0, y.jsx)(o.div, {
|
|
328
|
+
"data-radix-toast-announce-exclude": "",
|
|
329
|
+
"data-radix-toast-announce-alt": r || void 0,
|
|
330
|
+
...i,
|
|
331
|
+
ref: t
|
|
332
|
+
});
|
|
333
|
+
});
|
|
334
|
+
function K(e) {
|
|
335
|
+
let t = [];
|
|
336
|
+
return Array.from(e.childNodes).forEach((e) => {
|
|
337
|
+
if (e.nodeType === e.TEXT_NODE && e.textContent && t.push(e.textContent), de(e)) {
|
|
338
|
+
let n = e.ariaHidden || e.hidden || e.style.display === "none", r = e.dataset.radixToastAnnounceExclude === "";
|
|
339
|
+
if (!n) if (r) {
|
|
340
|
+
let n = e.dataset.radixToastAnnounceAlt;
|
|
341
|
+
n && t.push(n);
|
|
342
|
+
} else t.push(...K(e));
|
|
343
|
+
}
|
|
344
|
+
}), t;
|
|
345
|
+
}
|
|
346
|
+
function q(e, t, n, { discrete: r }) {
|
|
347
|
+
let a = n.originalEvent.currentTarget, o = new CustomEvent(e, {
|
|
348
|
+
bubbles: !0,
|
|
349
|
+
cancelable: !0,
|
|
350
|
+
detail: n
|
|
351
|
+
});
|
|
352
|
+
t && a.addEventListener(e, t, { once: !0 }), r ? i(a, o) : a.dispatchEvent(o);
|
|
353
|
+
}
|
|
354
|
+
var J = (e, t, n = 0) => {
|
|
355
|
+
let r = Math.abs(e.x), i = Math.abs(e.y), a = r > i;
|
|
356
|
+
return t === "left" || t === "right" ? a && r > n : !a && i > n;
|
|
357
|
+
};
|
|
358
|
+
function ue(e = () => {}) {
|
|
359
|
+
let t = d(e);
|
|
360
|
+
c(() => {
|
|
361
|
+
let e = 0, n = 0;
|
|
362
|
+
return e = window.requestAnimationFrame(() => n = window.requestAnimationFrame(t)), () => {
|
|
363
|
+
window.cancelAnimationFrame(e), window.cancelAnimationFrame(n);
|
|
364
|
+
};
|
|
365
|
+
}, [t]);
|
|
366
|
+
}
|
|
367
|
+
function de(e) {
|
|
368
|
+
return e.nodeType === e.ELEMENT_NODE;
|
|
369
|
+
}
|
|
370
|
+
function fe(e) {
|
|
371
|
+
let t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, { acceptNode: (e) => {
|
|
372
|
+
let t = e.tagName === "INPUT" && e.type === "hidden";
|
|
373
|
+
return e.disabled || e.hidden || t ? NodeFilter.FILTER_SKIP : e.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
374
|
+
} });
|
|
375
|
+
for (; n.nextNode();) t.push(n.currentNode);
|
|
376
|
+
return t;
|
|
377
|
+
}
|
|
378
|
+
function Y(e) {
|
|
379
|
+
let t = document.activeElement;
|
|
380
|
+
return e.some((e) => e === t ? !0 : (e.focus(), document.activeElement !== t));
|
|
381
|
+
}
|
|
382
|
+
var pe = D, X = M, Z = I, Q = B, me = V, he = H, $ = W, ge = pe, _e = g.forwardRef(({ className: e, ...n }, r) => /* @__PURE__ */ (0, y.jsx)(X, {
|
|
383
|
+
ref: r,
|
|
384
|
+
className: t("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]", e),
|
|
385
|
+
...n
|
|
386
|
+
}));
|
|
387
|
+
_e.displayName = X?.displayName || "ToastViewport";
|
|
388
|
+
var ve = v("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", {
|
|
389
|
+
variants: { variant: {
|
|
390
|
+
default: "border bg-background text-foreground",
|
|
391
|
+
destructive: "destructive group border-destructive bg-destructive text-destructive-foreground"
|
|
392
|
+
} },
|
|
393
|
+
defaultVariants: { variant: "default" }
|
|
394
|
+
}), ye = g.forwardRef(({ className: e, variant: n, ...r }, i) => /* @__PURE__ */ (0, y.jsx)(Z, {
|
|
395
|
+
ref: i,
|
|
396
|
+
className: t(ve({ variant: n }), e),
|
|
397
|
+
...r
|
|
398
|
+
}));
|
|
399
|
+
ye.displayName = Z?.displayName || "Toast";
|
|
400
|
+
var be = g.forwardRef(({ className: e, ...n }, r) => /* @__PURE__ */ (0, y.jsx)(he, {
|
|
401
|
+
ref: r,
|
|
402
|
+
className: t("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", e),
|
|
403
|
+
...n
|
|
404
|
+
}));
|
|
405
|
+
be.displayName = he?.displayName || "ToastAction";
|
|
406
|
+
var xe = g.forwardRef(({ className: e, ...n }, r) => /* @__PURE__ */ (0, y.jsx)($, {
|
|
407
|
+
ref: r,
|
|
408
|
+
className: t("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", e),
|
|
409
|
+
"toast-close": "",
|
|
410
|
+
...n,
|
|
411
|
+
children: /* @__PURE__ */ (0, y.jsx)(_, { className: "h-4 w-4" })
|
|
412
|
+
}));
|
|
413
|
+
xe.displayName = $?.displayName || "ToastClose";
|
|
414
|
+
var Se = g.forwardRef(({ className: e, ...n }, r) => /* @__PURE__ */ (0, y.jsx)(Q, {
|
|
415
|
+
ref: r,
|
|
416
|
+
className: t("text-sm font-semibold [&+div]:text-xs", e),
|
|
417
|
+
...n
|
|
418
|
+
}));
|
|
419
|
+
Se.displayName = Q?.displayName || "ToastTitle";
|
|
420
|
+
var Ce = g.forwardRef(({ className: e, ...n }, r) => /* @__PURE__ */ (0, y.jsx)(me, {
|
|
421
|
+
ref: r,
|
|
422
|
+
className: t("text-sm opacity-90", e),
|
|
423
|
+
...n
|
|
424
|
+
}));
|
|
425
|
+
Ce.displayName = me?.displayName || "ToastDescription";
|
|
426
|
+
//#endregion
|
|
427
|
+
export { ge as a, Ce as i, be as n, Se as o, xe as r, _e as s, ye as t };
|
package/dist/toast.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./jsx-runtime-nZSsnGb7.js"),Ae=require("react"),Ie=require("react-dom"),x=require("./index-BtZvtDmp.js"),te=require("./index-_XxjJPRD.js"),Fe=require("./index-BGIK9FQF.js"),Oe=require("./index-D2HnlO3y.js"),se=require("./index-BoNjHhm4.js"),Le=require("./index-CwyAfCwY.js"),Me=require("./index-B2XtpfGY.js"),K=require("./index-CzY-WZXL.js"),ke=require("./index-Ce5TOFAK.js"),Ve=require("./index-MQ0c3ZX_.js"),oe=require("./index-Cl3G0jzM.js"),$e=require("class-variance-authority"),He=require("lucide-react"),S=require("./utils-cdbZV8DZ.js");function re(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const o=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,o.get?o:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const r=re(Ae),Ke=re(Ie);var z="ToastProvider",[G,qe,We]=Fe.createCollection("Toast"),[ne]=Oe.createContextScope("Toast",[We]),[Xe,q]=ne(z),ae=e=>{const{__scopeToast:t,label:s="Notification",duration:o=5e3,swipeDirection:u="right",swipeThreshold:l=50,children:p}=e,[v,T]=r.useState(null),[c,b]=r.useState(0),E=r.useRef(!1),D=r.useRef(!1);return s.trim()||console.error(`Invalid prop \`label\` supplied to \`${z}\`. Expected non-empty \`string\`.`),n.jsxRuntimeExports.jsx(G.Provider,{scope:t,children:n.jsxRuntimeExports.jsx(Xe,{scope:t,label:s,duration:o,swipeDirection:u,swipeThreshold:l,toastCount:c,viewport:v,onViewportChange:T,onToastAdd:r.useCallback(()=>b(C=>C+1),[]),onToastRemove:r.useCallback(()=>b(C=>C-1),[]),isFocusedToastEscapeKeyDownRef:E,isClosePausedRef:D,children:p})})};ae.displayName=z;var ie="ToastViewport",Ue=["F8"],U="toast.viewportPause",Y="toast.viewportResume",ce=r.forwardRef((e,t)=>{const{__scopeToast:s,hotkey:o=Ue,label:u="Notifications ({hotkey})",...l}=e,p=q(ie,s),v=qe(s),T=r.useRef(null),c=r.useRef(null),b=r.useRef(null),E=r.useRef(null),D=te.useComposedRefs(t,E,p.onViewportChange),C=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),j=p.toastCount>0;r.useEffect(()=>{const i=y=>{o.length!==0&&o.every(m=>y[m]||y.code===m)&&E.current?.focus()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[o]),r.useEffect(()=>{const i=T.current,y=E.current;if(j&&i&&y){const f=()=>{if(!p.isClosePausedRef.current){const w=new CustomEvent(U);y.dispatchEvent(w),p.isClosePausedRef.current=!0}},m=()=>{if(p.isClosePausedRef.current){const w=new CustomEvent(Y);y.dispatchEvent(w),p.isClosePausedRef.current=!1}},R=w=>{!i.contains(w.relatedTarget)&&m()},g=()=>{i.contains(document.activeElement)||m()};return i.addEventListener("focusin",f),i.addEventListener("focusout",R),i.addEventListener("pointermove",f),i.addEventListener("pointerleave",g),window.addEventListener("blur",f),window.addEventListener("focus",m),()=>{i.removeEventListener("focusin",f),i.removeEventListener("focusout",R),i.removeEventListener("pointermove",f),i.removeEventListener("pointerleave",g),window.removeEventListener("blur",f),window.removeEventListener("focus",m)}}},[j,p.isClosePausedRef]);const d=r.useCallback(({tabbingDirection:i})=>{const f=v().map(m=>{const R=m.ref.current,g=[R,...nt(R)];return i==="forwards"?g:g.reverse()});return(i==="forwards"?f.reverse():f).flat()},[v]);return r.useEffect(()=>{const i=E.current;if(i){const y=f=>{const m=f.altKey||f.ctrlKey||f.metaKey;if(f.key==="Tab"&&!m){const g=document.activeElement,w=f.shiftKey;if(f.target===i&&w){c.current?.focus();return}const A=d({tabbingDirection:w?"backwards":"forwards"}),M=A.findIndex(N=>N===g);X(A.slice(M+1))?f.preventDefault():w?c.current?.focus():b.current?.focus()}};return i.addEventListener("keydown",y),()=>i.removeEventListener("keydown",y)}},[v,d]),n.jsxRuntimeExports.jsxs(se.Branch,{ref:T,role:"region","aria-label":u.replace("{hotkey}",C),tabIndex:-1,style:{pointerEvents:j?void 0:"none"},children:[j&&n.jsxRuntimeExports.jsx(B,{ref:c,onFocusFromOutsideViewport:()=>{const i=d({tabbingDirection:"forwards"});X(i)}}),n.jsxRuntimeExports.jsx(G.Slot,{scope:s,children:n.jsxRuntimeExports.jsx(x.Primitive.ol,{tabIndex:-1,...l,ref:D})}),j&&n.jsxRuntimeExports.jsx(B,{ref:b,onFocusFromOutsideViewport:()=>{const i=d({tabbingDirection:"backwards"});X(i)}})]})});ce.displayName=ie;var ue="ToastFocusProxy",B=r.forwardRef((e,t)=>{const{__scopeToast:s,onFocusFromOutsideViewport:o,...u}=e,l=q(ue,s);return n.jsxRuntimeExports.jsx(oe.VisuallyHidden,{tabIndex:0,...u,ref:t,style:{position:"fixed"},onFocus:p=>{const v=p.relatedTarget;!l.viewport?.contains(v)&&o()}})});B.displayName=ue;var O="Toast",Ye="toast.swipeStart",Be="toast.swipeMove",ze="toast.swipeCancel",Ge="toast.swipeEnd",de=r.forwardRef((e,t)=>{const{forceMount:s,open:o,defaultOpen:u,onOpenChange:l,...p}=e,[v,T]=ke.useControllableState({prop:o,defaultProp:u??!0,onChange:l,caller:O});return n.jsxRuntimeExports.jsx(Me.Presence,{present:s||v,children:n.jsxRuntimeExports.jsx(Ze,{open:v,...p,ref:t,onClose:()=>T(!1),onPause:K.useCallbackRef(e.onPause),onResume:K.useCallbackRef(e.onResume),onSwipeStart:x.composeEventHandlers(e.onSwipeStart,c=>{c.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:x.composeEventHandlers(e.onSwipeMove,c=>{const{x:b,y:E}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","move"),c.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${b}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${E}px`)}),onSwipeCancel:x.composeEventHandlers(e.onSwipeCancel,c=>{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")}),onSwipeEnd:x.composeEventHandlers(e.onSwipeEnd,c=>{const{x:b,y:E}=c.detail.delta;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",`${b}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${E}px`),T(!1)})})})});de.displayName=O;var[Je,Qe]=ne(O,{onClose(){}}),Ze=r.forwardRef((e,t)=>{const{__scopeToast:s,type:o="foreground",duration:u,open:l,onClose:p,onEscapeKeyDown:v,onPause:T,onResume:c,onSwipeStart:b,onSwipeMove:E,onSwipeCancel:D,onSwipeEnd:C,...j}=e,d=q(O,s),[i,y]=r.useState(null),f=te.useComposedRefs(t,a=>y(a)),m=r.useRef(null),R=r.useRef(null),g=u||d.duration,w=r.useRef(0),_=r.useRef(g),L=r.useRef(0),{onToastAdd:A,onToastRemove:M}=d,N=K.useCallbackRef(()=>{i?.contains(document.activeElement)&&d.viewport?.focus(),p()}),k=r.useCallback(a=>{!a||a===1/0||(window.clearTimeout(L.current),w.current=new Date().getTime(),L.current=window.setTimeout(N,a))},[N]);r.useEffect(()=>{const a=d.viewport;if(a){const h=()=>{k(_.current),c?.()},P=()=>{const I=new Date().getTime()-w.current;_.current=_.current-I,window.clearTimeout(L.current),T?.()};return a.addEventListener(U,P),a.addEventListener(Y,h),()=>{a.removeEventListener(U,P),a.removeEventListener(Y,h)}}},[d.viewport,g,T,c,k]),r.useEffect(()=>{l&&!d.isClosePausedRef.current&&k(g)},[l,g,d.isClosePausedRef,k]),r.useEffect(()=>(A(),()=>M()),[A,M]);const Q=r.useMemo(()=>i?Te(i):null,[i]);return d.viewport?n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[Q&&n.jsxRuntimeExports.jsx(et,{__scopeToast:s,role:"status","aria-live":o==="foreground"?"assertive":"polite",children:Q}),n.jsxRuntimeExports.jsx(Je,{scope:s,onClose:N,children:Ke.createPortal(n.jsxRuntimeExports.jsx(G.ItemSlot,{scope:s,children:n.jsxRuntimeExports.jsx(se.Root,{asChild:!0,onEscapeKeyDown:x.composeEventHandlers(v,()=>{d.isFocusedToastEscapeKeyDownRef.current||N(),d.isFocusedToastEscapeKeyDownRef.current=!1}),children:n.jsxRuntimeExports.jsx(x.Primitive.li,{tabIndex:0,"data-state":l?"open":"closed","data-swipe-direction":d.swipeDirection,...j,ref:f,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:x.composeEventHandlers(e.onKeyDown,a=>{a.key==="Escape"&&(v?.(a.nativeEvent),a.nativeEvent.defaultPrevented||(d.isFocusedToastEscapeKeyDownRef.current=!0,N()))}),onPointerDown:x.composeEventHandlers(e.onPointerDown,a=>{a.button===0&&(m.current={x:a.clientX,y:a.clientY})}),onPointerMove:x.composeEventHandlers(e.onPointerMove,a=>{if(!m.current)return;const h=a.clientX-m.current.x,P=a.clientY-m.current.y,I=!!R.current,F=["left","right"].includes(d.swipeDirection),V=["left","up"].includes(d.swipeDirection)?Math.min:Math.max,De=F?V(0,h):0,_e=F?0:V(0,P),W=a.pointerType==="touch"?10:2,$={x:De,y:_e},Z={originalEvent:a,delta:$};I?(R.current=$,H(Be,E,Z,{discrete:!1})):ee($,d.swipeDirection,W)?(R.current=$,H(Ye,b,Z,{discrete:!1}),a.target.setPointerCapture(a.pointerId)):(Math.abs(h)>W||Math.abs(P)>W)&&(m.current=null)}),onPointerUp:x.composeEventHandlers(e.onPointerUp,a=>{const h=R.current,P=a.target;if(P.hasPointerCapture(a.pointerId)&&P.releasePointerCapture(a.pointerId),R.current=null,m.current=null,h){const I=a.currentTarget,F={originalEvent:a,delta:h};ee(h,d.swipeDirection,d.swipeThreshold)?H(Ge,C,F,{discrete:!0}):H(ze,D,F,{discrete:!0}),I.addEventListener("click",V=>V.preventDefault(),{once:!0})}})})})}),d.viewport)})]}):null}),et=e=>{const{__scopeToast:t,children:s,...o}=e,u=q(O,t),[l,p]=r.useState(!1),[v,T]=r.useState(!1);return ot(()=>p(!0)),r.useEffect(()=>{const c=window.setTimeout(()=>T(!0),1e3);return()=>window.clearTimeout(c)},[]),v?null:n.jsxRuntimeExports.jsx(Le.Portal,{asChild:!0,children:n.jsxRuntimeExports.jsx(oe.VisuallyHidden,{...o,children:l&&n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[u.label," ",s]})})})},tt="ToastTitle",le=r.forwardRef((e,t)=>{const{__scopeToast:s,...o}=e;return n.jsxRuntimeExports.jsx(x.Primitive.div,{...o,ref:t})});le.displayName=tt;var st="ToastDescription",pe=r.forwardRef((e,t)=>{const{__scopeToast:s,...o}=e;return n.jsxRuntimeExports.jsx(x.Primitive.div,{...o,ref:t})});pe.displayName=st;var fe="ToastAction",me=r.forwardRef((e,t)=>{const{altText:s,...o}=e;return s.trim()?n.jsxRuntimeExports.jsx(ve,{altText:s,asChild:!0,children:n.jsxRuntimeExports.jsx(J,{...o,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${fe}\`. Expected non-empty \`string\`.`),null)});me.displayName=fe;var xe="ToastClose",J=r.forwardRef((e,t)=>{const{__scopeToast:s,...o}=e,u=Qe(xe,s);return n.jsxRuntimeExports.jsx(ve,{asChild:!0,children:n.jsxRuntimeExports.jsx(x.Primitive.button,{type:"button",...o,ref:t,onClick:x.composeEventHandlers(e.onClick,u.onClose)})})});J.displayName=xe;var ve=r.forwardRef((e,t)=>{const{__scopeToast:s,altText:o,...u}=e;return n.jsxRuntimeExports.jsx(x.Primitive.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":o||void 0,...u,ref:t})});function Te(e){const t=[];return Array.from(e.childNodes).forEach(o=>{if(o.nodeType===o.TEXT_NODE&&o.textContent&&t.push(o.textContent),rt(o)){const u=o.ariaHidden||o.hidden||o.style.display==="none",l=o.dataset.radixToastAnnounceExclude==="";if(!u)if(l){const p=o.dataset.radixToastAnnounceAlt;p&&t.push(p)}else t.push(...Te(o))}}),t}function H(e,t,s,{discrete:o}){const u=s.originalEvent.currentTarget,l=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:s});t&&u.addEventListener(e,t,{once:!0}),o?x.dispatchDiscreteCustomEvent(u,l):u.dispatchEvent(l)}var ee=(e,t,s=0)=>{const o=Math.abs(e.x),u=Math.abs(e.y),l=o>u;return t==="left"||t==="right"?l&&o>s:!l&&u>s};function ot(e=()=>{}){const t=K.useCallbackRef(e);Ve.useLayoutEffect2(()=>{let s=0,o=0;return s=window.requestAnimationFrame(()=>o=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(s),window.cancelAnimationFrame(o)}},[t])}function rt(e){return e.nodeType===e.ELEMENT_NODE}function nt(e){const t=[],s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const u=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||u?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;s.nextNode();)t.push(s.currentNode);return t}function X(e){const t=document.activeElement;return e.some(s=>s===t?!0:(s.focus(),document.activeElement!==t))}var at=ae,we=ce,Ee=de,ye=le,Re=pe,ge=me,be=J;const it=at,he=r.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(we,{ref:s,className:S.cn("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]",e),...t}));he.displayName=we?.displayName||"ToastViewport";const ct=$e.cva("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",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Pe=r.forwardRef(({className:e,variant:t,...s},o)=>n.jsxRuntimeExports.jsx(Ee,{ref:o,className:S.cn(ct({variant:t}),e),...s}));Pe.displayName=Ee?.displayName||"Toast";const Ce=r.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(ge,{ref:s,className:S.cn("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",e),...t}));Ce.displayName=ge?.displayName||"ToastAction";const je=r.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(be,{ref:s,className:S.cn("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",e),"toast-close":"",...t,children:n.jsxRuntimeExports.jsx(He.X,{className:"h-4 w-4"})}));je.displayName=be?.displayName||"ToastClose";const Ne=r.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(ye,{ref:s,className:S.cn("text-sm font-semibold [&+div]:text-xs",e),...t}));Ne.displayName=ye?.displayName||"ToastTitle";const Se=r.forwardRef(({className:e,...t},s)=>n.jsxRuntimeExports.jsx(Re,{ref:s,className:S.cn("text-sm opacity-90",e),...t}));Se.displayName=Re?.displayName||"ToastDescription";exports.Toast=Pe;exports.ToastAction=Ce;exports.ToastClose=je;exports.ToastDescription=Se;exports.ToastProvider=it;exports.ToastTitle=Ne;exports.ToastViewport=he;
|
|
1
|
+
"use client";"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./toast-C84Cpidq.js`);exports.Toast=e.t,exports.ToastAction=e.n,exports.ToastClose=e.r,exports.ToastDescription=e.i,exports.ToastProvider=e.a,exports.ToastTitle=e.o,exports.ToastViewport=e.s;
|