@konstructio/ui 0.1.2-alpha.5 → 0.1.2-alpha.51
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/{Combination-VYaRRJBZ.js → Combination-BtmnusWq.js} +141 -138
- package/dist/DatePicker.css +1 -1
- package/dist/Modal-CjC-CIJ8.js +99 -0
- package/dist/assets/icons/index.js +7 -0
- package/dist/chevron-down-DgT-uSF9.js +5 -0
- package/dist/chevron-right-DYvXLeql.js +7 -0
- package/dist/chevron-up-DEfvgPCw.js +54 -0
- package/dist/chevron-up-DrQr2Fwd.js +5 -0
- package/dist/components/Alert/Alert.js +2 -2
- package/dist/components/AlertDialog/AlertDialog.js +81 -53
- package/dist/components/AlertDialog/components/AlertDialogTrigger.js +3 -2
- package/dist/components/AlertDialog/components/index.js +1 -1
- package/dist/components/Badge/Badge.js +41 -44
- package/dist/components/Badge/Badge.variants.js +52 -13
- package/dist/components/Breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.variants.js +3 -3
- package/dist/components/Breadcrumb/components/Item/Item.js +22 -22
- package/dist/components/Breadcrumb/components/Item/Item.variants.js +25 -14
- package/dist/components/Breadcrumb/hooks/useBreadcrumb.js +1 -1
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/Button.variants.js +108 -98
- package/dist/components/Card/Card.variants.js +7 -12
- package/dist/components/Checkbox/Checkbox.js +108 -105
- package/dist/components/Checkbox/Checkbox.variants.js +34 -7
- package/dist/components/Command/Command.js +2 -2
- package/dist/components/Command/components/Command.js +1 -1
- package/dist/components/Command/components/CommandEmpty.js +1 -1
- package/dist/components/Command/components/CommandGroup.js +1 -1
- package/dist/components/Command/components/CommandInput.js +2 -2
- package/dist/components/Command/components/CommandItem.js +1 -1
- package/dist/components/Command/components/CommandList.js +1 -1
- package/dist/components/Command/components/CommandSeparator.js +1 -1
- package/dist/components/Command/components/DialogContent.js +2 -2
- package/dist/components/Command/components/DialogOverlay.js +1 -1
- package/dist/components/Counter/Counter.js +210 -0
- package/dist/components/Counter/Counter.variants.js +70 -0
- package/dist/components/Datepicker/DatePicker.js +1587 -1353
- package/dist/components/Divider/Divider.variants.js +1 -1
- package/dist/components/DropdownButton/DropdownButton.js +1 -1
- package/dist/components/Filter/Filter.js +1 -1
- package/dist/components/Filter/Filter.variants.js +8 -7
- package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.js +71 -45
- package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.hook.js +2 -2
- package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.js +76 -43
- package/dist/components/Filter/components/ResetButton/ResetButton.js +15 -12
- package/dist/components/Filter/events/index.js +3 -3
- package/dist/components/ImageUpload/ImageUpload.js +221 -0
- package/dist/components/ImageUpload/ImageUpload.variants.js +109 -0
- package/dist/components/Input/Input.js +185 -118
- package/dist/components/Input/Input.variants.js +24 -19
- package/dist/components/Loading/Loading.js +1 -7
- package/dist/components/Modal/Modal.js +2 -2
- package/dist/components/Modal/components/Body/Body.js +1 -1
- package/dist/components/Modal/components/Footer/Footer.js +1 -1
- package/dist/components/Modal/components/Header/Header.js +1 -1
- package/dist/components/Modal/components/Wrapper/Wrapper.js +4 -4
- package/dist/components/Modal/components/index.js +1 -1
- package/dist/components/MultiSelectDropdown/MultiSelectDropdown.js +34 -0
- package/dist/components/MultiSelectDropdown/MultiSelectDropdown.variants.js +30 -0
- package/dist/components/MultiSelectDropdown/components/Item/Item.js +30 -0
- package/dist/components/MultiSelectDropdown/components/Item/Item.variants.js +38 -0
- package/dist/components/MultiSelectDropdown/components/List/List.js +30 -0
- package/dist/components/MultiSelectDropdown/components/List/List.variants.js +25 -0
- package/dist/components/MultiSelectDropdown/components/Wrapper/Wrapper.js +119 -0
- package/dist/components/MultiSelectDropdown/components/index.js +8 -0
- package/dist/components/MultiSelectDropdown/contexts/MultiSelectDropdown.context.js +21 -0
- package/dist/components/MultiSelectDropdown/contexts/MultiSelectDropdown.hook.js +13 -0
- package/dist/components/MultiSelectDropdown/contexts/MultiSelectDropdown.provider.js +138 -0
- package/dist/components/MultiSelectDropdown/contexts/index.js +6 -0
- package/dist/components/MultiSelectDropdown/hooks/useMultiSelectDropdown.js +32 -0
- package/dist/components/PhoneNumberInput/PhoneNumberInput.js +8 -0
- package/dist/components/PhoneNumberInput/PhoneNumberInput.variants.js +46 -0
- package/dist/components/PhoneNumberInput/components/FlagContent/FlagContent.js +36 -0
- package/dist/components/PhoneNumberInput/components/FlagSelectorList/FlagSelectorList.js +690 -0
- package/dist/components/PhoneNumberInput/components/FlagSelectorWrapper/FlagSelectorWrapper.js +60 -0
- package/dist/components/PhoneNumberInput/components/TruncateText/TruncateText.js +45 -0
- package/dist/components/PhoneNumberInput/components/Wrapper.js +651 -0
- package/dist/components/PhoneNumberInput/components/index.js +6 -0
- package/dist/components/PhoneNumberInput/contexts/index.js +8 -0
- package/dist/components/PhoneNumberInput/contexts/phone-number.context.js +28 -0
- package/dist/components/PhoneNumberInput/contexts/phone-number.hook.js +13 -0
- package/dist/components/PhoneNumberInput/contexts/phone-number.provider.js +6144 -0
- package/dist/components/PhoneNumberInput/utils/index.js +11 -0
- package/dist/components/PieChart/PieChart.js +463 -482
- package/dist/components/Radio/Radio.js +47 -44
- package/dist/components/Radio/Radio.variants.js +12 -8
- package/dist/components/RadioCard/RadioCard.variants.js +1 -6
- package/dist/components/RadioGroup/RadioGroup.js +10 -10
- package/dist/components/Range/Range.js +1 -1
- package/dist/components/Select/Select.js +48 -0
- package/dist/components/{Dropdown/Dropdown.variants.js → Select/Select.variants.js} +17 -11
- package/dist/components/Select/components/List/List.js +172 -0
- package/dist/components/{Dropdown → Select}/components/List/List.variants.js +11 -8
- package/dist/components/Select/components/ListItem/ListItem.js +117 -0
- package/dist/components/{Dropdown → Select}/components/ListItem/ListItem.variants.js +5 -4
- package/dist/components/Select/components/Wrapper.js +226 -0
- package/dist/components/Select/constants/index.js +4 -0
- package/dist/components/Select/constants/pagination.js +4 -0
- package/dist/components/Select/contexts/index.js +6 -0
- package/dist/components/Select/contexts/select.context.js +36 -0
- package/dist/components/Select/contexts/select.hook.js +11 -0
- package/dist/components/Select/contexts/select.provider.js +58 -0
- package/dist/components/Select/hooks/useNavigationList.js +50 -0
- package/dist/components/Select/hooks/useSelect.js +103 -0
- package/dist/components/Sidebar/Sidebar.variants.js +2 -2
- package/dist/components/Slider/Slider.js +1 -1
- package/dist/components/Switch/Switch.js +156 -129
- package/dist/components/Switch/Switch.variants.js +19 -10
- package/dist/components/Tabs/Tabs.js +1 -1
- package/dist/components/Tabs/Tabs.variants.js +4 -3
- package/dist/components/Tabs/components/Content.js +1 -1
- package/dist/components/Tabs/components/List.js +1 -1
- package/dist/components/Tabs/components/Trigger.js +1 -1
- package/dist/components/Tag/Tag.js +1 -1
- package/dist/components/Tag/Tag.variants.js +1 -0
- package/dist/components/TagSelect/components/Wrapper/Wrapper.js +49 -98
- package/dist/components/TimePicker/TimePicker.js +1 -1
- package/dist/components/TimePicker/TimePicker.variants.js +26 -14
- package/dist/components/TimePicker/components/MeridianList/MeridianList.js +30 -20
- package/dist/components/TimePicker/components/Wrapper/Wrapper.js +57 -35
- package/dist/components/TimePicker/components/WrapperList/WrapperList.js +53 -45
- package/dist/components/Toast/Toast.js +283 -256
- package/dist/components/Toast/Toast.variants.js +37 -24
- package/dist/components/Tooltip/Tooltip.js +15 -14
- package/dist/components/Tooltip/Tooltip.variants.js +5 -4
- package/dist/components/Typography/Typography.js +23 -25
- package/dist/components/Typography/Typography.variants.js +55 -52
- package/dist/components/VirtualizedTable/VirtualizedTable.js +97 -71
- package/dist/components/VirtualizedTable/components/Actions/Actions.js +95 -33
- package/dist/components/VirtualizedTable/components/Body/Body.js +73 -21
- package/dist/components/VirtualizedTable/components/DotPaginate/DotPaginate.js +94 -91
- package/dist/components/VirtualizedTable/components/DropdownPaginate/DropdownPaginate.js +20 -20
- package/dist/components/VirtualizedTable/components/Filter/Filter.js +61 -44
- package/dist/components/VirtualizedTable/components/FormPaginate/FormPaginate.js +33 -21
- package/dist/components/VirtualizedTable/components/Header/Header.js +61 -41
- package/dist/components/VirtualizedTable/components/Pagination/Pagination.js +43 -22
- package/dist/components/VirtualizedTable/components/Skeleton/Skeleton.js +106 -0
- package/dist/components/VirtualizedTable/components/TruncateText/TruncateText.js +22 -1858
- package/dist/components/VirtualizedTable/components/WrapperBody/WrapperBody.js +27 -0
- package/dist/components/VirtualizedTable/components/index.js +8 -6
- package/dist/components/VirtualizedTable/contexts/table.context.js +1 -0
- package/dist/components/VirtualizedTable/contexts/table.provider.js +68 -761
- package/dist/components/index.js +94 -86
- package/dist/contexts/theme.provider.js +0 -1
- package/dist/{createLucideIcon-D2CN7Ma9.js → createLucideIcon-D4r5Phnh.js} +0 -24
- package/dist/ellipsis-vertical-BVPtjl5f.js +9 -0
- package/dist/{index-C1g_chDT.js → index-AV6ZtGhy.js} +2 -2
- package/dist/index-BG8O18ZY.js +93 -0
- package/dist/index-BKjcReYh.js +55 -0
- package/dist/{index-N2OStZoU.js → index-BOE_3f_Z.js} +4 -25
- package/dist/{index-Cd2vhaop.js → index-BlSRBdPy.js} +5 -6
- package/dist/index-BmVmDQGH.js +662 -0
- package/dist/index-BvoZGpli.js +60 -0
- package/dist/index-Byr10W8m.js +1873 -0
- package/dist/{index-Dx2grAuN.js → index-CSWGJT-v.js} +0 -20
- package/dist/index-CeZcoQDw.js +479 -0
- package/dist/index-D6KzX_ef.js +135 -0
- package/dist/{index-B7t8D14s.js → index-D9SSJ6om.js} +4 -4
- package/dist/index-DKfEnhKr.js +200 -0
- package/dist/index-DLcqcWxM.js +29 -0
- package/dist/{index-ti1b9kqV.js → index-DMb4KD0b.js} +4 -4
- package/dist/{index-BAEWsOG1.js → index-DtEcCIrM.js} +1 -1
- package/dist/{index-bwWKd82e.js → index-Dy59FQl5.js} +1 -1
- package/dist/{index-C84F4YyO.js → index-gSPwC-1I.js} +10 -11
- package/dist/{index-Bnb0ezr3.js → index-vcSp8YRZ.js} +11 -12
- package/dist/index.d.ts +2142 -99
- package/dist/index.js +116 -106
- package/dist/libphonenumber-FTwQ9nyV.js +11549 -0
- package/dist/loader-juvMSJ9L.js +5 -0
- package/dist/package.json +43 -33
- package/dist/styles.css +1 -1
- package/dist/ui/civo-theme.css +194 -168
- package/dist/ui/theme.css +27 -0
- package/dist/{useBreadcrumb-B8DnuqkR.js → useBreadcrumb-BAHbGQ_O.js} +0 -10
- package/dist/utils/index.js +534 -501
- package/dist/x-BXShoIAM.js +8 -0
- package/dist/{x-4F_5p77m.js → x-Eoa9FJjA.js} +1 -1
- package/package.json +43 -33
- package/dist/Modal-D-NOEWMX.js +0 -98
- package/dist/chevron-down-MZvQoT2F.js +0 -11
- package/dist/chevron-right-VYBOBhRt.js +0 -19
- package/dist/components/Dropdown/Dropdown.js +0 -42
- package/dist/components/Dropdown/components/List/List.js +0 -79
- package/dist/components/Dropdown/components/ListItem/ListItem.js +0 -67
- package/dist/components/Dropdown/components/Wrapper.js +0 -205
- package/dist/components/Dropdown/contexts/dropdown.context.js +0 -19
- package/dist/components/Dropdown/contexts/dropdown.hook.js +0 -13
- package/dist/components/Dropdown/contexts/dropdown.provider.js +0 -30
- package/dist/components/Dropdown/contexts/index.js +0 -6
- package/dist/components/Dropdown/hooks/useDropdown.js +0 -58
- package/dist/components/Dropdown/hooks/useNavigationList.js +0 -62
- package/dist/components/NumberInput/NumberInput.js +0 -179
- package/dist/components/NumberInput/NumberInput.variants.js +0 -50
- package/dist/components/TimePicker/components/WrapperList/WrapperList.variants.js +0 -16
- package/dist/index-BITvcJAz.js +0 -423
- package/dist/index-BfXxHr_2.js +0 -125
- package/dist/index-Cvx4lqTq.js +0 -47
- package/dist/index-DBbEcSUG.js +0 -31
- package/dist/index-DQH6odE9.js +0 -82
- package/dist/index-DzIBBMjs.js +0 -436
- package/dist/index-os7vysFS.js +0 -131
- /package/dist/components/{Dropdown → Select}/components/EmptyList.js +0 -0
- /package/dist/components/{Dropdown → Select}/components/index.js +0 -0
|
@@ -1,143 +1,167 @@
|
|
|
1
|
-
import { jsx as i, jsxs as A, Fragment as
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as i, jsxs as A, Fragment as ae } from "react/jsx-runtime";
|
|
2
|
+
import { S as B } from "../../index-BvoZGpli.js";
|
|
3
3
|
import * as n from "react";
|
|
4
|
-
import { useRef as xe, useEffect as be, useMemo as
|
|
5
|
-
import
|
|
6
|
-
import { c as Ne, a as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { P as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
4
|
+
import { useRef as xe, useEffect as be, useMemo as re, isValidElement as ne, useCallback as ge } from "react";
|
|
5
|
+
import * as Se from "react-dom";
|
|
6
|
+
import { P as D, c as Ne, a as Ie, b as x, d as Ae, u as De } from "../../index-DKfEnhKr.js";
|
|
7
|
+
import { u as ie } from "../../index-DLcqcWxM.js";
|
|
8
|
+
import { c as _e } from "../../index-BG8O18ZY.js";
|
|
9
|
+
import { B as Fe, R as Le } from "../../index-BlSRBdPy.js";
|
|
10
|
+
import { P as Me } from "../../index-DMb4KD0b.js";
|
|
11
|
+
import { P as Oe } from "../../index-AV6ZtGhy.js";
|
|
12
|
+
import { u as X } from "../../index-0ioNhtNM.js";
|
|
13
|
+
import { R as ke } from "../../index-BKjcReYh.js";
|
|
13
14
|
import { cn as j } from "../../utils/index.js";
|
|
14
15
|
import { closeToastVariants as Ve, toastVariants as Ke, viewportToastVariants as He } from "./Toast.variants.js";
|
|
15
|
-
import { X as We } from "../../x-
|
|
16
|
-
var
|
|
16
|
+
import { X as We } from "../../x-Eoa9FJjA.js";
|
|
17
|
+
var Ue = Object.freeze({
|
|
18
|
+
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
19
|
+
position: "absolute",
|
|
20
|
+
border: 0,
|
|
21
|
+
width: 1,
|
|
22
|
+
height: 1,
|
|
23
|
+
padding: 0,
|
|
24
|
+
margin: -1,
|
|
25
|
+
overflow: "hidden",
|
|
26
|
+
clip: "rect(0, 0, 0, 0)",
|
|
27
|
+
whiteSpace: "nowrap",
|
|
28
|
+
wordWrap: "normal"
|
|
29
|
+
}), Xe = "VisuallyHidden", Q = n.forwardRef(
|
|
30
|
+
(e, o) => /* @__PURE__ */ i(
|
|
31
|
+
D.span,
|
|
32
|
+
{
|
|
33
|
+
...e,
|
|
34
|
+
ref: o,
|
|
35
|
+
style: { ...Ue, ...e.style }
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
);
|
|
39
|
+
Q.displayName = Xe;
|
|
40
|
+
var Z = "ToastProvider", [ee, Ye, $e] = _e("Toast"), [ce, St] = Ne("Toast", [$e]), [Be, Y] = ce(Z), ue = (e) => {
|
|
17
41
|
const {
|
|
18
|
-
__scopeToast:
|
|
19
|
-
label:
|
|
42
|
+
__scopeToast: o,
|
|
43
|
+
label: r = "Notification",
|
|
20
44
|
duration: t = 5e3,
|
|
21
|
-
swipeDirection:
|
|
45
|
+
swipeDirection: u = "right",
|
|
22
46
|
swipeThreshold: d = 50,
|
|
23
|
-
children:
|
|
24
|
-
} = e, [
|
|
25
|
-
return
|
|
26
|
-
`Invalid prop \`label\` supplied to \`${
|
|
27
|
-
), /* @__PURE__ */ i(
|
|
28
|
-
|
|
47
|
+
children: f
|
|
48
|
+
} = e, [w, v] = n.useState(null), [c, E] = n.useState(0), T = n.useRef(!1), N = n.useRef(!1);
|
|
49
|
+
return r.trim() || console.error(
|
|
50
|
+
`Invalid prop \`label\` supplied to \`${Z}\`. Expected non-empty \`string\`.`
|
|
51
|
+
), /* @__PURE__ */ i(ee.Provider, { scope: o, children: /* @__PURE__ */ i(
|
|
52
|
+
Be,
|
|
29
53
|
{
|
|
30
|
-
scope:
|
|
31
|
-
label:
|
|
54
|
+
scope: o,
|
|
55
|
+
label: r,
|
|
32
56
|
duration: t,
|
|
33
|
-
swipeDirection:
|
|
57
|
+
swipeDirection: u,
|
|
34
58
|
swipeThreshold: d,
|
|
35
|
-
toastCount:
|
|
36
|
-
viewport:
|
|
59
|
+
toastCount: c,
|
|
60
|
+
viewport: w,
|
|
37
61
|
onViewportChange: v,
|
|
38
|
-
onToastAdd: n.useCallback(() => E((
|
|
39
|
-
onToastRemove: n.useCallback(() => E((
|
|
40
|
-
isFocusedToastEscapeKeyDownRef:
|
|
41
|
-
isClosePausedRef:
|
|
42
|
-
children:
|
|
62
|
+
onToastAdd: n.useCallback(() => E((R) => R + 1), []),
|
|
63
|
+
onToastRemove: n.useCallback(() => E((R) => R - 1), []),
|
|
64
|
+
isFocusedToastEscapeKeyDownRef: T,
|
|
65
|
+
isClosePausedRef: N,
|
|
66
|
+
children: f
|
|
43
67
|
}
|
|
44
68
|
) });
|
|
45
69
|
};
|
|
46
|
-
ue.displayName =
|
|
47
|
-
var le = "ToastViewport",
|
|
48
|
-
(e,
|
|
70
|
+
ue.displayName = Z;
|
|
71
|
+
var le = "ToastViewport", je = ["F8"], z = "toast.viewportPause", G = "toast.viewportResume", de = n.forwardRef(
|
|
72
|
+
(e, o) => {
|
|
49
73
|
const {
|
|
50
|
-
__scopeToast:
|
|
51
|
-
hotkey: t =
|
|
52
|
-
label:
|
|
74
|
+
__scopeToast: r,
|
|
75
|
+
hotkey: t = je,
|
|
76
|
+
label: u = "Notifications ({hotkey})",
|
|
53
77
|
...d
|
|
54
|
-
} = e,
|
|
78
|
+
} = e, f = Y(le, r), w = Ye(r), v = n.useRef(null), c = n.useRef(null), E = n.useRef(null), T = n.useRef(null), N = ie(o, T, f.onViewportChange), R = t.join("+").replace(/Key/g, "").replace(/Digit/g, ""), b = f.toastCount > 0;
|
|
55
79
|
n.useEffect(() => {
|
|
56
|
-
const
|
|
57
|
-
t.length !== 0 && t.every((m) => h[m] || h.code === m) &&
|
|
80
|
+
const s = (h) => {
|
|
81
|
+
t.length !== 0 && t.every((m) => h[m] || h.code === m) && T.current?.focus();
|
|
58
82
|
};
|
|
59
|
-
return document.addEventListener("keydown",
|
|
83
|
+
return document.addEventListener("keydown", s), () => document.removeEventListener("keydown", s);
|
|
60
84
|
}, [t]), n.useEffect(() => {
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
const
|
|
64
|
-
if (!
|
|
85
|
+
const s = v.current, h = T.current;
|
|
86
|
+
if (b && s && h) {
|
|
87
|
+
const p = () => {
|
|
88
|
+
if (!f.isClosePausedRef.current) {
|
|
65
89
|
const y = new CustomEvent(z);
|
|
66
|
-
h.dispatchEvent(y),
|
|
90
|
+
h.dispatchEvent(y), f.isClosePausedRef.current = !0;
|
|
67
91
|
}
|
|
68
92
|
}, m = () => {
|
|
69
|
-
if (
|
|
93
|
+
if (f.isClosePausedRef.current) {
|
|
70
94
|
const y = new CustomEvent(G);
|
|
71
|
-
h.dispatchEvent(y),
|
|
95
|
+
h.dispatchEvent(y), f.isClosePausedRef.current = !1;
|
|
72
96
|
}
|
|
73
97
|
}, P = (y) => {
|
|
74
|
-
!
|
|
98
|
+
!s.contains(y.relatedTarget) && m();
|
|
75
99
|
}, C = () => {
|
|
76
|
-
|
|
100
|
+
s.contains(document.activeElement) || m();
|
|
77
101
|
};
|
|
78
|
-
return
|
|
79
|
-
|
|
102
|
+
return s.addEventListener("focusin", p), s.addEventListener("focusout", P), s.addEventListener("pointermove", p), s.addEventListener("pointerleave", C), window.addEventListener("blur", p), window.addEventListener("focus", m), () => {
|
|
103
|
+
s.removeEventListener("focusin", p), s.removeEventListener("focusout", P), s.removeEventListener("pointermove", p), s.removeEventListener("pointerleave", C), window.removeEventListener("blur", p), window.removeEventListener("focus", m);
|
|
80
104
|
};
|
|
81
105
|
}
|
|
82
|
-
}, [
|
|
106
|
+
}, [b, f.isClosePausedRef]);
|
|
83
107
|
const l = n.useCallback(
|
|
84
|
-
({ tabbingDirection:
|
|
85
|
-
const
|
|
86
|
-
const P = m.ref.current, C = [P, ...
|
|
87
|
-
return
|
|
108
|
+
({ tabbingDirection: s }) => {
|
|
109
|
+
const p = w().map((m) => {
|
|
110
|
+
const P = m.ref.current, C = [P, ...at(P)];
|
|
111
|
+
return s === "forwards" ? C : C.reverse();
|
|
88
112
|
});
|
|
89
|
-
return (
|
|
113
|
+
return (s === "forwards" ? p.reverse() : p).flat();
|
|
90
114
|
},
|
|
91
|
-
[
|
|
115
|
+
[w]
|
|
92
116
|
);
|
|
93
117
|
return n.useEffect(() => {
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
96
|
-
const h = (
|
|
97
|
-
const m =
|
|
98
|
-
if (
|
|
99
|
-
const C = document.activeElement, y =
|
|
100
|
-
if (
|
|
101
|
-
|
|
118
|
+
const s = T.current;
|
|
119
|
+
if (s) {
|
|
120
|
+
const h = (p) => {
|
|
121
|
+
const m = p.altKey || p.ctrlKey || p.metaKey;
|
|
122
|
+
if (p.key === "Tab" && !m) {
|
|
123
|
+
const C = document.activeElement, y = p.shiftKey;
|
|
124
|
+
if (p.target === s && y) {
|
|
125
|
+
c.current?.focus();
|
|
102
126
|
return;
|
|
103
127
|
}
|
|
104
|
-
const
|
|
105
|
-
q(
|
|
128
|
+
const F = l({ tabbingDirection: y ? "backwards" : "forwards" }), V = F.findIndex((I) => I === C);
|
|
129
|
+
q(F.slice(V + 1)) ? p.preventDefault() : y ? c.current?.focus() : E.current?.focus();
|
|
106
130
|
}
|
|
107
131
|
};
|
|
108
|
-
return
|
|
132
|
+
return s.addEventListener("keydown", h), () => s.removeEventListener("keydown", h);
|
|
109
133
|
}
|
|
110
|
-
}, [
|
|
111
|
-
|
|
134
|
+
}, [w, l]), /* @__PURE__ */ A(
|
|
135
|
+
Fe,
|
|
112
136
|
{
|
|
113
137
|
ref: v,
|
|
114
138
|
role: "region",
|
|
115
|
-
"aria-label":
|
|
139
|
+
"aria-label": u.replace("{hotkey}", R),
|
|
116
140
|
tabIndex: -1,
|
|
117
|
-
style: { pointerEvents:
|
|
141
|
+
style: { pointerEvents: b ? void 0 : "none" },
|
|
118
142
|
children: [
|
|
119
|
-
|
|
143
|
+
b && /* @__PURE__ */ i(
|
|
120
144
|
J,
|
|
121
145
|
{
|
|
122
|
-
ref:
|
|
146
|
+
ref: c,
|
|
123
147
|
onFocusFromOutsideViewport: () => {
|
|
124
|
-
const
|
|
148
|
+
const s = l({
|
|
125
149
|
tabbingDirection: "forwards"
|
|
126
150
|
});
|
|
127
|
-
q(
|
|
151
|
+
q(s);
|
|
128
152
|
}
|
|
129
153
|
}
|
|
130
154
|
),
|
|
131
|
-
/* @__PURE__ */ i(
|
|
132
|
-
|
|
155
|
+
/* @__PURE__ */ i(ee.Slot, { scope: r, children: /* @__PURE__ */ i(D.ol, { tabIndex: -1, ...d, ref: N }) }),
|
|
156
|
+
b && /* @__PURE__ */ i(
|
|
133
157
|
J,
|
|
134
158
|
{
|
|
135
159
|
ref: E,
|
|
136
160
|
onFocusFromOutsideViewport: () => {
|
|
137
|
-
const
|
|
161
|
+
const s = l({
|
|
138
162
|
tabbingDirection: "backwards"
|
|
139
163
|
});
|
|
140
|
-
q(
|
|
164
|
+
q(s);
|
|
141
165
|
}
|
|
142
166
|
}
|
|
143
167
|
)
|
|
@@ -147,122 +171,122 @@ var le = "ToastViewport", Ye = ["F8"], z = "toast.viewportPause", G = "toast.vie
|
|
|
147
171
|
}
|
|
148
172
|
);
|
|
149
173
|
de.displayName = le;
|
|
150
|
-
var
|
|
151
|
-
(e,
|
|
152
|
-
const { __scopeToast:
|
|
174
|
+
var fe = "ToastFocusProxy", J = n.forwardRef(
|
|
175
|
+
(e, o) => {
|
|
176
|
+
const { __scopeToast: r, onFocusFromOutsideViewport: t, ...u } = e, d = Y(fe, r);
|
|
153
177
|
return /* @__PURE__ */ i(
|
|
154
|
-
|
|
178
|
+
Q,
|
|
155
179
|
{
|
|
156
180
|
tabIndex: 0,
|
|
157
|
-
...
|
|
158
|
-
ref:
|
|
181
|
+
...u,
|
|
182
|
+
ref: o,
|
|
159
183
|
style: { position: "fixed" },
|
|
160
|
-
onFocus: (
|
|
161
|
-
const
|
|
162
|
-
!d.viewport?.contains(
|
|
184
|
+
onFocus: (f) => {
|
|
185
|
+
const w = f.relatedTarget;
|
|
186
|
+
!d.viewport?.contains(w) && t();
|
|
163
187
|
}
|
|
164
188
|
}
|
|
165
189
|
);
|
|
166
190
|
}
|
|
167
191
|
);
|
|
168
|
-
J.displayName =
|
|
169
|
-
var O = "Toast",
|
|
170
|
-
(e,
|
|
171
|
-
const { forceMount:
|
|
192
|
+
J.displayName = fe;
|
|
193
|
+
var O = "Toast", qe = "toast.swipeStart", ze = "toast.swipeMove", Ge = "toast.swipeCancel", Je = "toast.swipeEnd", pe = n.forwardRef(
|
|
194
|
+
(e, o) => {
|
|
195
|
+
const { forceMount: r, open: t, defaultOpen: u, onOpenChange: d, ...f } = e, [w, v] = Ie({
|
|
172
196
|
prop: t,
|
|
173
|
-
defaultProp:
|
|
197
|
+
defaultProp: u ?? !0,
|
|
174
198
|
onChange: d,
|
|
175
199
|
caller: O
|
|
176
200
|
});
|
|
177
|
-
return /* @__PURE__ */ i(Oe, { present:
|
|
178
|
-
|
|
201
|
+
return /* @__PURE__ */ i(Oe, { present: r || w, children: /* @__PURE__ */ i(
|
|
202
|
+
et,
|
|
179
203
|
{
|
|
180
|
-
open:
|
|
181
|
-
...
|
|
182
|
-
ref:
|
|
204
|
+
open: w,
|
|
205
|
+
...f,
|
|
206
|
+
ref: o,
|
|
183
207
|
onClose: () => v(!1),
|
|
184
|
-
onPause:
|
|
185
|
-
onResume:
|
|
186
|
-
onSwipeStart: x(e.onSwipeStart, (
|
|
187
|
-
|
|
208
|
+
onPause: X(e.onPause),
|
|
209
|
+
onResume: X(e.onResume),
|
|
210
|
+
onSwipeStart: x(e.onSwipeStart, (c) => {
|
|
211
|
+
c.currentTarget.setAttribute("data-swipe", "start");
|
|
188
212
|
}),
|
|
189
|
-
onSwipeMove: x(e.onSwipeMove, (
|
|
190
|
-
const { x: E, y:
|
|
191
|
-
|
|
213
|
+
onSwipeMove: x(e.onSwipeMove, (c) => {
|
|
214
|
+
const { x: E, y: T } = c.detail.delta;
|
|
215
|
+
c.currentTarget.setAttribute("data-swipe", "move"), c.currentTarget.style.setProperty("--radix-toast-swipe-move-x", `${E}px`), c.currentTarget.style.setProperty("--radix-toast-swipe-move-y", `${T}px`);
|
|
192
216
|
}),
|
|
193
|
-
onSwipeCancel: x(e.onSwipeCancel, (
|
|
194
|
-
|
|
217
|
+
onSwipeCancel: x(e.onSwipeCancel, (c) => {
|
|
218
|
+
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");
|
|
195
219
|
}),
|
|
196
|
-
onSwipeEnd: x(e.onSwipeEnd, (
|
|
197
|
-
const { x: E, y:
|
|
198
|
-
|
|
220
|
+
onSwipeEnd: x(e.onSwipeEnd, (c) => {
|
|
221
|
+
const { x: E, y: T } = c.detail.delta;
|
|
222
|
+
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", `${E}px`), c.currentTarget.style.setProperty("--radix-toast-swipe-end-y", `${T}px`), v(!1);
|
|
199
223
|
})
|
|
200
224
|
}
|
|
201
225
|
) });
|
|
202
226
|
}
|
|
203
227
|
);
|
|
204
|
-
|
|
205
|
-
var [
|
|
228
|
+
pe.displayName = O;
|
|
229
|
+
var [Qe, Ze] = ce(O, {
|
|
206
230
|
onClose() {
|
|
207
231
|
}
|
|
208
|
-
}),
|
|
209
|
-
(e,
|
|
232
|
+
}), et = n.forwardRef(
|
|
233
|
+
(e, o) => {
|
|
210
234
|
const {
|
|
211
|
-
__scopeToast:
|
|
235
|
+
__scopeToast: r,
|
|
212
236
|
type: t = "foreground",
|
|
213
|
-
duration:
|
|
237
|
+
duration: u,
|
|
214
238
|
open: d,
|
|
215
|
-
onClose:
|
|
216
|
-
onEscapeKeyDown:
|
|
239
|
+
onClose: f,
|
|
240
|
+
onEscapeKeyDown: w,
|
|
217
241
|
onPause: v,
|
|
218
|
-
onResume:
|
|
242
|
+
onResume: c,
|
|
219
243
|
onSwipeStart: E,
|
|
220
|
-
onSwipeMove:
|
|
221
|
-
onSwipeCancel:
|
|
222
|
-
onSwipeEnd:
|
|
223
|
-
...
|
|
224
|
-
} = e, l =
|
|
225
|
-
|
|
244
|
+
onSwipeMove: T,
|
|
245
|
+
onSwipeCancel: N,
|
|
246
|
+
onSwipeEnd: R,
|
|
247
|
+
...b
|
|
248
|
+
} = e, l = Y(O, r), [s, h] = n.useState(null), p = ie(o, (a) => h(a)), m = n.useRef(null), P = n.useRef(null), C = u || l.duration, y = n.useRef(0), _ = n.useRef(C), k = n.useRef(0), { onToastAdd: F, onToastRemove: V } = l, I = X(() => {
|
|
249
|
+
s?.contains(document.activeElement) && l.viewport?.focus(), f();
|
|
226
250
|
}), K = n.useCallback(
|
|
227
|
-
(
|
|
228
|
-
!
|
|
251
|
+
(a) => {
|
|
252
|
+
!a || a === 1 / 0 || (window.clearTimeout(k.current), y.current = (/* @__PURE__ */ new Date()).getTime(), k.current = window.setTimeout(I, a));
|
|
229
253
|
},
|
|
230
|
-
[
|
|
254
|
+
[I]
|
|
231
255
|
);
|
|
232
256
|
n.useEffect(() => {
|
|
233
|
-
const
|
|
234
|
-
if (
|
|
257
|
+
const a = l.viewport;
|
|
258
|
+
if (a) {
|
|
235
259
|
const g = () => {
|
|
236
|
-
K(
|
|
237
|
-
},
|
|
260
|
+
K(_.current), c?.();
|
|
261
|
+
}, S = () => {
|
|
238
262
|
const L = (/* @__PURE__ */ new Date()).getTime() - y.current;
|
|
239
|
-
|
|
263
|
+
_.current = _.current - L, window.clearTimeout(k.current), v?.();
|
|
240
264
|
};
|
|
241
|
-
return
|
|
242
|
-
|
|
265
|
+
return a.addEventListener(z, S), a.addEventListener(G, g), () => {
|
|
266
|
+
a.removeEventListener(z, S), a.removeEventListener(G, g);
|
|
243
267
|
};
|
|
244
268
|
}
|
|
245
|
-
}, [l.viewport, C, v,
|
|
269
|
+
}, [l.viewport, C, v, c, K]), n.useEffect(() => {
|
|
246
270
|
d && !l.isClosePausedRef.current && K(C);
|
|
247
|
-
}, [d, C, l.isClosePausedRef, K]), n.useEffect(() => (
|
|
248
|
-
const
|
|
249
|
-
return l.viewport ? /* @__PURE__ */ A(
|
|
250
|
-
|
|
251
|
-
|
|
271
|
+
}, [d, C, l.isClosePausedRef, K]), n.useEffect(() => (F(), () => V()), [F, V]);
|
|
272
|
+
const te = n.useMemo(() => s ? Pe(s) : null, [s]);
|
|
273
|
+
return l.viewport ? /* @__PURE__ */ A(ae, { children: [
|
|
274
|
+
te && /* @__PURE__ */ i(
|
|
275
|
+
tt,
|
|
252
276
|
{
|
|
253
|
-
__scopeToast:
|
|
277
|
+
__scopeToast: r,
|
|
254
278
|
role: "status",
|
|
255
279
|
"aria-live": t === "foreground" ? "assertive" : "polite",
|
|
256
|
-
children:
|
|
280
|
+
children: te
|
|
257
281
|
}
|
|
258
282
|
),
|
|
259
|
-
/* @__PURE__ */ i(
|
|
260
|
-
/* @__PURE__ */ i(
|
|
283
|
+
/* @__PURE__ */ i(Qe, { scope: r, onClose: I, children: Se.createPortal(
|
|
284
|
+
/* @__PURE__ */ i(ee.ItemSlot, { scope: r, children: /* @__PURE__ */ i(
|
|
261
285
|
Le,
|
|
262
286
|
{
|
|
263
287
|
asChild: !0,
|
|
264
|
-
onEscapeKeyDown: x(
|
|
265
|
-
l.isFocusedToastEscapeKeyDownRef.current ||
|
|
288
|
+
onEscapeKeyDown: x(w, () => {
|
|
289
|
+
l.isFocusedToastEscapeKeyDownRef.current || I(), l.isFocusedToastEscapeKeyDownRef.current = !1;
|
|
266
290
|
}),
|
|
267
291
|
children: /* @__PURE__ */ i(
|
|
268
292
|
D.li,
|
|
@@ -270,33 +294,33 @@ var [Ge, Je] = ce(O, {
|
|
|
270
294
|
tabIndex: 0,
|
|
271
295
|
"data-state": d ? "open" : "closed",
|
|
272
296
|
"data-swipe-direction": l.swipeDirection,
|
|
273
|
-
...
|
|
274
|
-
ref:
|
|
297
|
+
...b,
|
|
298
|
+
ref: p,
|
|
275
299
|
style: { userSelect: "none", touchAction: "none", ...e.style },
|
|
276
|
-
onKeyDown: x(e.onKeyDown, (
|
|
277
|
-
|
|
300
|
+
onKeyDown: x(e.onKeyDown, (a) => {
|
|
301
|
+
a.key === "Escape" && (w?.(a.nativeEvent), a.nativeEvent.defaultPrevented || (l.isFocusedToastEscapeKeyDownRef.current = !0, I()));
|
|
278
302
|
}),
|
|
279
|
-
onPointerDown: x(e.onPointerDown, (
|
|
280
|
-
|
|
303
|
+
onPointerDown: x(e.onPointerDown, (a) => {
|
|
304
|
+
a.button === 0 && (m.current = { x: a.clientX, y: a.clientY });
|
|
281
305
|
}),
|
|
282
|
-
onPointerMove: x(e.onPointerMove, (
|
|
306
|
+
onPointerMove: x(e.onPointerMove, (a) => {
|
|
283
307
|
if (!m.current) return;
|
|
284
|
-
const g =
|
|
285
|
-
L ? (P.current = W,
|
|
308
|
+
const g = a.clientX - m.current.x, S = a.clientY - m.current.y, L = !!P.current, M = ["left", "right"].includes(l.swipeDirection), H = ["left", "up"].includes(l.swipeDirection) ? Math.min : Math.max, Ce = M ? H(0, g) : 0, Re = M ? 0 : H(0, S), $ = a.pointerType === "touch" ? 10 : 2, W = { x: Ce, y: Re }, oe = { originalEvent: a, delta: W };
|
|
309
|
+
L ? (P.current = W, U(ze, T, oe, {
|
|
286
310
|
discrete: !1
|
|
287
|
-
})) :
|
|
311
|
+
})) : se(W, l.swipeDirection, $) ? (P.current = W, U(qe, E, oe, {
|
|
288
312
|
discrete: !1
|
|
289
|
-
}),
|
|
313
|
+
}), a.target.setPointerCapture(a.pointerId)) : (Math.abs(g) > $ || Math.abs(S) > $) && (m.current = null);
|
|
290
314
|
}),
|
|
291
|
-
onPointerUp: x(e.onPointerUp, (
|
|
292
|
-
const g = P.current,
|
|
293
|
-
if (
|
|
294
|
-
const L =
|
|
295
|
-
|
|
315
|
+
onPointerUp: x(e.onPointerUp, (a) => {
|
|
316
|
+
const g = P.current, S = a.target;
|
|
317
|
+
if (S.hasPointerCapture(a.pointerId) && S.releasePointerCapture(a.pointerId), P.current = null, m.current = null, g) {
|
|
318
|
+
const L = a.currentTarget, M = { originalEvent: a, delta: g };
|
|
319
|
+
se(g, l.swipeDirection, l.swipeThreshold) ? U(Je, R, M, {
|
|
296
320
|
discrete: !0
|
|
297
|
-
}) :
|
|
298
|
-
|
|
299
|
-
|
|
321
|
+
}) : U(
|
|
322
|
+
Ge,
|
|
323
|
+
N,
|
|
300
324
|
M,
|
|
301
325
|
{
|
|
302
326
|
discrete: !0
|
|
@@ -314,148 +338,151 @@ var [Ge, Je] = ce(O, {
|
|
|
314
338
|
) })
|
|
315
339
|
] }) : null;
|
|
316
340
|
}
|
|
317
|
-
),
|
|
318
|
-
const { __scopeToast:
|
|
319
|
-
return
|
|
320
|
-
const
|
|
321
|
-
return () => window.clearTimeout(
|
|
322
|
-
}, []),
|
|
323
|
-
|
|
341
|
+
), tt = (e) => {
|
|
342
|
+
const { __scopeToast: o, children: r, ...t } = e, u = Y(O, o), [d, f] = n.useState(!1), [w, v] = n.useState(!1);
|
|
343
|
+
return nt(() => f(!0)), n.useEffect(() => {
|
|
344
|
+
const c = window.setTimeout(() => v(!0), 1e3);
|
|
345
|
+
return () => window.clearTimeout(c);
|
|
346
|
+
}, []), w ? null : /* @__PURE__ */ i(Me, { asChild: !0, children: /* @__PURE__ */ i(Q, { ...t, children: d && /* @__PURE__ */ A(ae, { children: [
|
|
347
|
+
u.label,
|
|
324
348
|
" ",
|
|
325
|
-
|
|
349
|
+
r
|
|
326
350
|
] }) }) });
|
|
327
|
-
},
|
|
328
|
-
(e,
|
|
329
|
-
const { __scopeToast:
|
|
330
|
-
return /* @__PURE__ */ i(D.div, { ...t, ref:
|
|
351
|
+
}, ot = "ToastTitle", me = n.forwardRef(
|
|
352
|
+
(e, o) => {
|
|
353
|
+
const { __scopeToast: r, ...t } = e;
|
|
354
|
+
return /* @__PURE__ */ i(D.div, { ...t, ref: o });
|
|
331
355
|
}
|
|
332
356
|
);
|
|
333
|
-
me.displayName =
|
|
334
|
-
var
|
|
335
|
-
(e,
|
|
336
|
-
const { __scopeToast:
|
|
337
|
-
return /* @__PURE__ */ i(D.div, { ...t, ref:
|
|
357
|
+
me.displayName = ot;
|
|
358
|
+
var rt = "ToastDescription", we = n.forwardRef(
|
|
359
|
+
(e, o) => {
|
|
360
|
+
const { __scopeToast: r, ...t } = e;
|
|
361
|
+
return /* @__PURE__ */ i(D.div, { ...t, ref: o });
|
|
338
362
|
}
|
|
339
363
|
);
|
|
340
|
-
|
|
341
|
-
var
|
|
342
|
-
(e,
|
|
343
|
-
const { altText:
|
|
344
|
-
return
|
|
345
|
-
`Invalid prop \`altText\` supplied to \`${
|
|
364
|
+
we.displayName = rt;
|
|
365
|
+
var Te = "ToastAction", ve = n.forwardRef(
|
|
366
|
+
(e, o) => {
|
|
367
|
+
const { altText: r, ...t } = e;
|
|
368
|
+
return r.trim() ? /* @__PURE__ */ i(he, { altText: r, asChild: !0, children: /* @__PURE__ */ i(ye, { ...t, ref: o }) }) : (console.error(
|
|
369
|
+
`Invalid prop \`altText\` supplied to \`${Te}\`. Expected non-empty \`string\`.`
|
|
346
370
|
), null);
|
|
347
371
|
}
|
|
348
372
|
);
|
|
349
|
-
ve.displayName =
|
|
373
|
+
ve.displayName = Te;
|
|
350
374
|
var Ee = "ToastClose", ye = n.forwardRef(
|
|
351
|
-
(e,
|
|
352
|
-
const { __scopeToast:
|
|
375
|
+
(e, o) => {
|
|
376
|
+
const { __scopeToast: r, ...t } = e, u = Ze(Ee, r);
|
|
353
377
|
return /* @__PURE__ */ i(he, { asChild: !0, children: /* @__PURE__ */ i(
|
|
354
378
|
D.button,
|
|
355
379
|
{
|
|
356
380
|
type: "button",
|
|
357
381
|
...t,
|
|
358
|
-
ref:
|
|
359
|
-
onClick: x(e.onClick,
|
|
382
|
+
ref: o,
|
|
383
|
+
onClick: x(e.onClick, u.onClose)
|
|
360
384
|
}
|
|
361
385
|
) });
|
|
362
386
|
}
|
|
363
387
|
);
|
|
364
388
|
ye.displayName = Ee;
|
|
365
|
-
var he = n.forwardRef((e,
|
|
366
|
-
const { __scopeToast:
|
|
389
|
+
var he = n.forwardRef((e, o) => {
|
|
390
|
+
const { __scopeToast: r, altText: t, ...u } = e;
|
|
367
391
|
return /* @__PURE__ */ i(
|
|
368
392
|
D.div,
|
|
369
393
|
{
|
|
370
394
|
"data-radix-toast-announce-exclude": "",
|
|
371
395
|
"data-radix-toast-announce-alt": t || void 0,
|
|
372
|
-
...
|
|
373
|
-
ref:
|
|
396
|
+
...u,
|
|
397
|
+
ref: o
|
|
374
398
|
}
|
|
375
399
|
);
|
|
376
400
|
});
|
|
377
401
|
function Pe(e) {
|
|
378
|
-
const
|
|
402
|
+
const o = [];
|
|
379
403
|
return Array.from(e.childNodes).forEach((t) => {
|
|
380
|
-
if (t.nodeType === t.TEXT_NODE && t.textContent &&
|
|
381
|
-
const
|
|
382
|
-
if (!
|
|
404
|
+
if (t.nodeType === t.TEXT_NODE && t.textContent && o.push(t.textContent), st(t)) {
|
|
405
|
+
const u = t.ariaHidden || t.hidden || t.style.display === "none", d = t.dataset.radixToastAnnounceExclude === "";
|
|
406
|
+
if (!u)
|
|
383
407
|
if (d) {
|
|
384
|
-
const
|
|
385
|
-
|
|
408
|
+
const f = t.dataset.radixToastAnnounceAlt;
|
|
409
|
+
f && o.push(f);
|
|
386
410
|
} else
|
|
387
|
-
|
|
411
|
+
o.push(...Pe(t));
|
|
388
412
|
}
|
|
389
|
-
}),
|
|
413
|
+
}), o;
|
|
390
414
|
}
|
|
391
|
-
function
|
|
392
|
-
const
|
|
393
|
-
|
|
415
|
+
function U(e, o, r, { discrete: t }) {
|
|
416
|
+
const u = r.originalEvent.currentTarget, d = new CustomEvent(e, { bubbles: !0, cancelable: !0, detail: r });
|
|
417
|
+
o && u.addEventListener(e, o, { once: !0 }), t ? Ae(u, d) : u.dispatchEvent(d);
|
|
394
418
|
}
|
|
395
|
-
var
|
|
396
|
-
const t = Math.abs(e.x),
|
|
397
|
-
return
|
|
419
|
+
var se = (e, o, r = 0) => {
|
|
420
|
+
const t = Math.abs(e.x), u = Math.abs(e.y), d = t > u;
|
|
421
|
+
return o === "left" || o === "right" ? d && t > r : !d && u > r;
|
|
398
422
|
};
|
|
399
|
-
function
|
|
423
|
+
function nt(e = () => {
|
|
400
424
|
}) {
|
|
401
|
-
const
|
|
425
|
+
const o = X(e);
|
|
402
426
|
De(() => {
|
|
403
|
-
let
|
|
404
|
-
return
|
|
405
|
-
window.cancelAnimationFrame(
|
|
427
|
+
let r = 0, t = 0;
|
|
428
|
+
return r = window.requestAnimationFrame(() => t = window.requestAnimationFrame(o)), () => {
|
|
429
|
+
window.cancelAnimationFrame(r), window.cancelAnimationFrame(t);
|
|
406
430
|
};
|
|
407
|
-
}, [
|
|
431
|
+
}, [o]);
|
|
408
432
|
}
|
|
409
|
-
function
|
|
433
|
+
function st(e) {
|
|
410
434
|
return e.nodeType === e.ELEMENT_NODE;
|
|
411
435
|
}
|
|
412
|
-
function
|
|
413
|
-
const
|
|
436
|
+
function at(e) {
|
|
437
|
+
const o = [], r = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
414
438
|
acceptNode: (t) => {
|
|
415
|
-
const
|
|
416
|
-
return t.disabled || t.hidden ||
|
|
439
|
+
const u = t.tagName === "INPUT" && t.type === "hidden";
|
|
440
|
+
return t.disabled || t.hidden || u ? NodeFilter.FILTER_SKIP : t.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
417
441
|
}
|
|
418
442
|
});
|
|
419
|
-
for (;
|
|
420
|
-
return
|
|
443
|
+
for (; r.nextNode(); ) o.push(r.currentNode);
|
|
444
|
+
return o;
|
|
421
445
|
}
|
|
422
446
|
function q(e) {
|
|
423
|
-
const
|
|
424
|
-
return e.some((
|
|
447
|
+
const o = document.activeElement;
|
|
448
|
+
return e.some((r) => r === o ? !0 : (r.focus(), document.activeElement !== o));
|
|
425
449
|
}
|
|
426
|
-
var
|
|
427
|
-
const
|
|
450
|
+
var it = ue, ct = de, ut = pe, lt = me, dt = we, ft = ve;
|
|
451
|
+
const Nt = ({
|
|
428
452
|
title: e,
|
|
429
|
-
duration:
|
|
430
|
-
titleClassName:
|
|
453
|
+
duration: o = 5e3,
|
|
454
|
+
titleClassName: r,
|
|
431
455
|
descriptionClassName: t,
|
|
432
|
-
description:
|
|
456
|
+
description: u,
|
|
433
457
|
children: d,
|
|
434
|
-
theme:
|
|
435
|
-
showCloseButton:
|
|
458
|
+
theme: f,
|
|
459
|
+
showCloseButton: w = !0,
|
|
436
460
|
closeButtonClassName: v,
|
|
437
|
-
className:
|
|
461
|
+
className: c,
|
|
438
462
|
open: E = !1,
|
|
439
|
-
setOpen:
|
|
463
|
+
setOpen: T,
|
|
464
|
+
variant: N
|
|
440
465
|
}) => {
|
|
441
|
-
const
|
|
442
|
-
be(() => () => clearTimeout(
|
|
443
|
-
const b =
|
|
444
|
-
|
|
445
|
-
}, [
|
|
446
|
-
return /* @__PURE__ */ A(
|
|
447
|
-
/* @__PURE__ */ i(B, { onClick:
|
|
466
|
+
const R = xe(0);
|
|
467
|
+
be(() => () => clearTimeout(R.current), []);
|
|
468
|
+
const b = re(() => ne(e) ? /* @__PURE__ */ i(B, { className: r, children: e }) : e, [e, r]), l = re(() => ne(u) ? /* @__PURE__ */ i(B, { className: t, children: u }) : u, [u, t]), s = ge(() => {
|
|
469
|
+
T(!1), R.current = window.setTimeout(() => T(!0), 100);
|
|
470
|
+
}, [T]);
|
|
471
|
+
return /* @__PURE__ */ A(it, { swipeDirection: "right", duration: o, children: [
|
|
472
|
+
/* @__PURE__ */ i(B, { onClick: s, children: d }),
|
|
448
473
|
/* @__PURE__ */ A(
|
|
449
|
-
|
|
474
|
+
ut,
|
|
450
475
|
{
|
|
451
|
-
className: j(Ke({ className:
|
|
452
|
-
"data-theme":
|
|
476
|
+
className: j(Ke({ variant: N, className: c })),
|
|
477
|
+
"data-theme": f,
|
|
453
478
|
open: E,
|
|
454
|
-
onOpenChange:
|
|
479
|
+
onOpenChange: T,
|
|
455
480
|
children: [
|
|
456
|
-
/* @__PURE__ */
|
|
457
|
-
|
|
458
|
-
|
|
481
|
+
/* @__PURE__ */ A("div", { className: "flex gap-2 items-center flex-1", children: [
|
|
482
|
+
/* @__PURE__ */ i(lt, { asChild: !0, className: r, children: b }),
|
|
483
|
+
l && /* @__PURE__ */ i(dt, { asChild: !0, children: l })
|
|
484
|
+
] }),
|
|
485
|
+
w && /* @__PURE__ */ i(ft, { asChild: !0, altText: "Close the toast", children: /* @__PURE__ */ A("button", { type: "button", className: "absolute right-1.5 top-1.5", children: [
|
|
459
486
|
/* @__PURE__ */ i(
|
|
460
487
|
We,
|
|
461
488
|
{
|
|
@@ -471,9 +498,9 @@ const gt = ({
|
|
|
471
498
|
]
|
|
472
499
|
}
|
|
473
500
|
),
|
|
474
|
-
/* @__PURE__ */ i(
|
|
501
|
+
/* @__PURE__ */ i(ct, { className: j(He()) })
|
|
475
502
|
] });
|
|
476
503
|
};
|
|
477
504
|
export {
|
|
478
|
-
|
|
505
|
+
Nt as Toast
|
|
479
506
|
};
|