@worldcoin/mini-apps-ui-kit-react 0.0.8 → 1.0.0-canary.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/README.md +8 -17
- package/dist/components/AlertDialog/AlertDialog.js +94 -0
- package/dist/components/AlertDialog/index.d.ts +1 -0
- package/dist/components/AlertDialog/index.js +13 -0
- package/dist/components/AlertDialog/types.d.ts +172 -0
- package/dist/components/AlertDialog/types.js +1 -0
- package/dist/components/AlertDialog/use-alert-dialog.d.ts +6 -0
- package/dist/components/AlertDialog/use-alert-dialog.js +11 -0
- package/dist/components/BottomBar/BottomBar.d.ts +13 -0
- package/dist/components/BottomBar/BottomBar.js +21 -0
- package/dist/components/BottomBar/index.d.ts +1 -0
- package/dist/components/BottomBar/index.js +4 -0
- package/dist/components/BulletList/BulletList.d.ts +10 -0
- package/dist/components/BulletList/BulletList.js +11 -0
- package/dist/components/BulletList/index.d.ts +1 -0
- package/dist/components/BulletList/index.js +4 -0
- package/dist/components/BulletListItem/BulletListItem.d.ts +7 -0
- package/dist/components/BulletListItem/BulletListItem.js +23 -0
- package/dist/components/BulletListItem/index.d.ts +1 -0
- package/dist/components/BulletListItem/index.js +4 -0
- package/dist/components/BulletPoint/BulletPoint.d.ts +6 -0
- package/dist/components/BulletPoint/BulletPoint.js +22 -0
- package/dist/components/BulletPoint/index.d.ts +1 -0
- package/dist/components/BulletPoint/index.js +1 -0
- package/dist/components/Button/Button.d.ts +10 -22
- package/dist/components/Button/Button.js +40 -72
- package/dist/components/Checkbox/Checkbox.d.ts +24 -4
- package/dist/components/Checkbox/Checkbox.js +5 -5
- package/dist/components/Chip/Chip.d.ts +2 -1
- package/dist/components/Chip/Chip.js +14 -8
- package/dist/components/ClearButton/Clear.js +14 -14
- package/dist/components/ClearButton/ClearButton.js +11 -11
- package/dist/components/ColorPicker/ColorPicker.js +14 -14
- package/dist/components/CountryDrawer/CountryDrawer.d.ts +12 -0
- package/dist/components/CountryDrawer/CountryDrawer.js +63 -0
- package/dist/components/CountryDrawer/index.d.ts +1 -0
- package/dist/components/CountryDrawer/index.js +4 -0
- package/dist/components/CountryDrawer/useCountryFiltering.d.ts +7 -0
- package/dist/components/CountryDrawer/useCountryFiltering.js +9 -0
- package/dist/components/CountryDrawer/useCountryGrouping.d.ts +13 -0
- package/dist/components/CountryDrawer/useCountryGrouping.js +17 -0
- package/dist/components/Drawer/Drawer.d.ts +28 -6
- package/dist/components/Drawer/Drawer.js +67 -28
- package/dist/components/Drawer/index.js +6 -4
- package/dist/components/Drawer/types.d.ts +167 -0
- package/dist/components/Drawer/types.js +1 -0
- package/dist/components/Drawer/use-drawer.d.ts +8 -0
- package/dist/components/Drawer/use-drawer.js +11 -0
- package/dist/components/Flag/LazyFlag.js +1 -1
- package/dist/components/Flag/flag-components/eu.d.ts +3 -0
- package/dist/components/Flag/flag-components/eu.js +83 -0
- package/dist/components/Flag/flag-components/index.d.ts +1 -0
- package/dist/components/Flag/flag-components/index.js +56 -54
- package/dist/components/Form/Form.js +2 -2
- package/dist/components/Icons/ArrowDown.js +26 -0
- package/dist/components/Icons/Eye.d.ts +8 -0
- package/dist/components/Icons/Eye.js +40 -0
- package/dist/components/Icons/EyeClosed.d.ts +8 -0
- package/dist/components/Icons/EyeClosed.js +60 -0
- package/dist/components/Icons/Fail.d.ts +8 -0
- package/dist/components/Icons/Fail.js +82 -0
- package/dist/components/Icons/MagicWand.d.ts +8 -0
- package/dist/components/Icons/MagicWand.js +60 -0
- package/dist/components/Icons/Magnifier.d.ts +1 -1
- package/dist/components/Icons/Magnifier.js +20 -11
- package/dist/components/Icons/Success.d.ts +8 -0
- package/dist/components/Icons/Success.js +82 -0
- package/dist/components/Icons/Tick.js +6 -7
- package/dist/components/Icons/XMark.d.ts +8 -0
- package/dist/components/Icons/XMark.js +27 -0
- package/dist/components/Input/Input.d.ts +26 -2
- package/dist/components/Input/Input.js +116 -51
- package/dist/components/ListItem/ListItem.d.ts +17 -6
- package/dist/components/ListItem/ListItem.js +29 -22
- package/dist/components/Marble/Marble.d.ts +2 -0
- package/dist/components/Marble/Marble.js +23 -0
- package/dist/components/Marble/index.d.ts +1 -0
- package/dist/components/Marble/index.js +4 -0
- package/dist/components/NumberPad/Delete.d.ts +1 -8
- package/dist/components/NumberPad/Delete.js +9 -10
- package/dist/components/NumberPad/NumberPad.js +30 -24
- package/dist/components/OTPField/OTPField.js +8 -8
- package/dist/components/PasswordField/PasswordField.d.ts +13 -0
- package/dist/components/PasswordField/PasswordField.js +45 -0
- package/dist/components/PasswordField/index.d.ts +1 -0
- package/dist/components/PasswordField/index.js +4 -0
- package/dist/components/PasteButton/PasteButton.d.ts +1 -1
- package/dist/components/PasteButton/PasteButton.js +21 -17
- package/dist/components/PhoneField/CountryListItem.d.ts +3 -4
- package/dist/components/PhoneField/CountryListItem.js +21 -25
- package/dist/components/PhoneField/CountrySelectorButton.d.ts +3 -4
- package/dist/components/PhoneField/CountrySelectorButton.js +17 -17
- package/dist/components/PhoneField/GroupedCountryList.d.ts +14 -0
- package/dist/components/PhoneField/GroupedCountryList.js +30 -0
- package/dist/components/PhoneField/PhoneField.d.ts +3 -14
- package/dist/components/PhoneField/PhoneField.js +71 -197
- package/dist/components/PhoneField/constants.js +4 -4
- package/dist/components/Pill/Pill.js +7 -7
- package/dist/components/Progress/Progress.d.ts +14 -0
- package/dist/components/Progress/Progress.js +31 -0
- package/dist/components/Progress/index.d.ts +1 -0
- package/dist/components/Progress/index.js +4 -0
- package/dist/components/RadioGroup/RadioGroupItem.js +1 -1
- package/dist/components/SearchField/SearchField.d.ts +6 -1
- package/dist/components/SearchField/SearchField.js +39 -35
- package/dist/components/Select/Select.js +46 -76
- package/dist/components/{Button → Spinner}/Spinner.d.ts +2 -2
- package/dist/components/Spinner/Spinner.js +36 -0
- package/dist/components/Spinner/index.d.ts +1 -0
- package/dist/components/Spinner/index.js +4 -0
- package/dist/components/Switch/Switch.js +1 -1
- package/dist/components/Tabs/Tabs.d.ts +11 -0
- package/dist/components/Tabs/Tabs.js +58 -0
- package/dist/components/Tabs/index.d.ts +2 -0
- package/dist/components/Tabs/index.js +5 -0
- package/dist/components/Tabs/types.d.ts +53 -0
- package/dist/components/Tabs/types.js +1 -0
- package/dist/components/TextArea/TextArea.d.ts +25 -0
- package/dist/components/TextArea/TextArea.js +54 -0
- package/dist/components/TextArea/index.d.ts +1 -0
- package/dist/components/TextArea/index.js +4 -0
- package/dist/components/Toast/Toast.d.ts +9 -0
- package/dist/components/Toast/Toast.js +51 -0
- package/dist/components/Toast/Toaster.d.ts +3 -0
- package/dist/components/Toast/Toaster.js +14 -0
- package/dist/components/Toast/index.d.ts +3 -0
- package/dist/components/Toast/index.js +12 -0
- package/dist/components/Toast/use-toast.d.ts +51 -0
- package/dist/components/Toast/use-toast.js +101 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +5 -0
- package/dist/components/ToggleGroup/ToggleGroup.js +28 -0
- package/dist/components/ToggleGroup/index.d.ts +1 -0
- package/dist/components/ToggleGroup/index.js +5 -0
- package/dist/components/ToggleGroup/types.d.ts +101 -0
- package/dist/components/ToggleGroup/types.js +1 -0
- package/dist/components/Token/Token.d.ts +4 -0
- package/dist/components/Token/Token.js +12 -7
- package/dist/components/Token/icons/btc.d.ts +2 -2
- package/dist/components/Token/icons/btc.js +13 -58
- package/dist/components/Token/icons/dai.d.ts +3 -0
- package/dist/components/Token/icons/dai.js +27 -0
- package/dist/components/Token/icons/eth.d.ts +2 -2
- package/dist/components/Token/icons/eth.js +11 -58
- package/dist/components/Token/icons/index.d.ts +2 -0
- package/dist/components/Token/icons/index.js +8 -4
- package/dist/components/Token/icons/types.d.ts +7 -0
- package/dist/components/Token/icons/types.js +1 -0
- package/dist/components/Token/icons/usdc.d.ts +2 -2
- package/dist/components/Token/icons/usdc.js +16 -56
- package/dist/components/Token/icons/usdt.d.ts +3 -0
- package/dist/components/Token/icons/usdt.js +27 -0
- package/dist/components/Token/icons/utils.d.ts +9 -0
- package/dist/components/Token/icons/utils.js +11 -0
- package/dist/components/Token/icons/wld.d.ts +2 -2
- package/dist/components/Token/icons/wld.js +10 -41
- package/dist/components/TopBar/TopBar.d.ts +11 -0
- package/dist/components/TopBar/TopBar.js +23 -0
- package/dist/components/TopBar/index.d.ts +1 -0
- package/dist/components/TopBar/index.js +4 -0
- package/dist/components/Typography/Typography.d.ts +12 -8
- package/dist/components/Typography/Typography.js +72 -60
- package/dist/components/WalletAddressField/WalletAddressField.d.ts +23 -0
- package/dist/components/WalletAddressField/WalletAddressField.js +81 -0
- package/dist/components/WalletAddressField/index.d.ts +1 -0
- package/dist/components/WalletAddressField/index.js +4 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +91 -45
- package/dist/lib/constants/dropdownStyles.d.ts +1 -1
- package/dist/lib/constants/dropdownStyles.js +2 -2
- package/dist/node_modules/.pnpm/@radix-ui_react-collection@1.1.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@1_tagbd57u5fsqga6qdjecsll7fm/node_modules/@radix-ui/react-collection/dist/index.js +49 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-dismissable-layer@1.1.5_@types_react-dom@18.3.5_@types_react@18.3.18__@types__nitdfoqpcbroetgllwgz3is5ai/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +131 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-portal@1.1.4_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@18.3._ulc3jfxcmrz2rfz7bui53djdtu/node_modules/@radix-ui/react-portal/dist/index.js +17 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-primitive@2.0.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@18_sejcxqoscaweil2bvgwwavaoha/node_modules/@radix-ui/react-primitive/dist/index.js +35 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-progress@1.1.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@18._wpsg2ubedou6txnsnvgmus4txq/node_modules/@radix-ui/react-progress/dist/index.js +86 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-roving-focus@1.1.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react_ki7uy4u3diz5446cqygvbjwuge/node_modules/@radix-ui/react-roving-focus/dist/index.js +181 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-slot@1.1.2_@types_react@18.3.18_react@18.3.1/node_modules/@radix-ui/react-slot/dist/index.js +44 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-toast@1.2.6_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@18.3.1_mux33mveszkw5z6iia6acnivvy/node_modules/@radix-ui/react-toast/dist/index.js +448 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-toggle-group@1.1.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react_3smwloudr6a3igss4kifyxcwju/node_modules/@radix-ui/react-toggle-group/dist/index.js +137 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-toggle@1.1.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@18.3._yiv2ptaqcv244n5f7zfldmgupm/node_modules/@radix-ui/react-toggle/dist/index.js +31 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-visually-hidden@1.1.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_re_omyrydx3gc2oidaiqb4gsovieq/node_modules/@radix-ui/react-visually-hidden/dist/index.js +30 -0
- package/dist/tailwind/index.d.ts +41 -25
- package/dist/tailwind/index.js +128 -85
- package/package.json +73 -1
- package/public/fonts/TWKLausanne-350.woff +0 -0
- package/public/fonts/TWKLausanne-350Italic.woff +0 -0
- package/public/fonts/TWKLausanne-500.woff +0 -0
- package/public/fonts/TWKLausanne-500Italic.woff +0 -0
- package/public/fonts/TWKLausanne-600.woff +0 -0
- package/public/fonts/TWKLausanne-600Italic.woff +0 -0
- package/public/globals.css +1 -1
- package/public/images/marbles/marble1.png +0 -0
- package/public/images/marbles/marble2.png +0 -0
- package/public/images/marbles/marble3.svg +36 -0
- package/dist/components/Button/Spinner.js +0 -36
- package/dist/components/PhoneField/ArrowDown.js +0 -27
- package/dist/components/Select/ArrowDown.d.ts +0 -2
- package/dist/components/Select/ArrowDown.js +0 -27
- /package/dist/components/{PhoneField → Icons}/ArrowDown.d.ts +0 -0
@@ -0,0 +1,181 @@
|
|
1
|
+
"use client";
|
2
|
+
import * as s from "react";
|
3
|
+
import { composeEventHandlers as p } from "../../../../../@radix-ui_primitive@1.1.1/node_modules/@radix-ui/primitive/dist/index.js";
|
4
|
+
import { createCollection as V } from "../../../../../@radix-ui_react-collection@1.1.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@1_tagbd57u5fsqga6qdjecsll7fm/node_modules/@radix-ui/react-collection/dist/index.js";
|
5
|
+
import { useComposedRefs as j } from "../../../../../@radix-ui_react-compose-refs@1.1.1_@types_react@18.3.18_react@18.3.1/node_modules/@radix-ui/react-compose-refs/dist/index.js";
|
6
|
+
import { createContextScope as z } from "../../../../../@radix-ui_react-context@1.1.1_@types_react@18.3.18_react@18.3.1/node_modules/@radix-ui/react-context/dist/index.js";
|
7
|
+
import { useId as q } from "../../../../../@radix-ui_react-id@1.1.0_@types_react@18.3.18_react@18.3.1/node_modules/@radix-ui/react-id/dist/index.js";
|
8
|
+
import { Primitive as x } from "../../../../../@radix-ui_react-primitive@2.0.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@18_sejcxqoscaweil2bvgwwavaoha/node_modules/@radix-ui/react-primitive/dist/index.js";
|
9
|
+
import { useCallbackRef as J } from "../../../../../@radix-ui_react-use-callback-ref@1.1.0_@types_react@18.3.18_react@18.3.1/node_modules/@radix-ui/react-use-callback-ref/dist/index.js";
|
10
|
+
import { useControllableState as Q } from "../../../../../@radix-ui_react-use-controllable-state@1.1.0_@types_react@18.3.18_react@18.3.1/node_modules/@radix-ui/react-use-controllable-state/dist/index.js";
|
11
|
+
import { useDirection as W } from "../../../../../@radix-ui_react-direction@1.1.0_@types_react@18.3.18_react@18.3.1/node_modules/@radix-ui/react-direction/dist/index.js";
|
12
|
+
import { jsx as d } from "react/jsx-runtime";
|
13
|
+
var h = "rovingFocusGroup.onEntryFocus", X = { bubbles: !1, cancelable: !0 }, b = "RovingFocusGroup", [y, G, Z] = V(b), [$, Fe] = z(
|
14
|
+
b,
|
15
|
+
[Z]
|
16
|
+
), [ee, oe] = $(b), N = s.forwardRef(
|
17
|
+
(e, r) => /* @__PURE__ */ d(y.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ d(y.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ d(te, { ...e, ref: r }) }) })
|
18
|
+
);
|
19
|
+
N.displayName = b;
|
20
|
+
var te = s.forwardRef((e, r) => {
|
21
|
+
const {
|
22
|
+
__scopeRovingFocusGroup: c,
|
23
|
+
orientation: o,
|
24
|
+
loop: F = !1,
|
25
|
+
dir: g,
|
26
|
+
currentTabStopId: R,
|
27
|
+
defaultCurrentTabStopId: E,
|
28
|
+
onCurrentTabStopIdChange: m,
|
29
|
+
onEntryFocus: u,
|
30
|
+
preventScrollOnEntryFocus: w = !1,
|
31
|
+
...C
|
32
|
+
} = e, v = s.useRef(null), I = j(r, v), t = W(g), [l = null, T] = Q({
|
33
|
+
prop: R,
|
34
|
+
defaultProp: E,
|
35
|
+
onChange: m
|
36
|
+
}), [a, i] = s.useState(!1), S = J(u), k = G(c), A = s.useRef(!1), [L, D] = s.useState(0);
|
37
|
+
return s.useEffect(() => {
|
38
|
+
const n = v.current;
|
39
|
+
if (n)
|
40
|
+
return n.addEventListener(h, S), () => n.removeEventListener(h, S);
|
41
|
+
}, [S]), /* @__PURE__ */ d(
|
42
|
+
ee,
|
43
|
+
{
|
44
|
+
scope: c,
|
45
|
+
orientation: o,
|
46
|
+
dir: t,
|
47
|
+
loop: F,
|
48
|
+
currentTabStopId: l,
|
49
|
+
onItemFocus: s.useCallback(
|
50
|
+
(n) => T(n),
|
51
|
+
[T]
|
52
|
+
),
|
53
|
+
onItemShiftTab: s.useCallback(() => i(!0), []),
|
54
|
+
onFocusableItemAdd: s.useCallback(
|
55
|
+
() => D((n) => n + 1),
|
56
|
+
[]
|
57
|
+
),
|
58
|
+
onFocusableItemRemove: s.useCallback(
|
59
|
+
() => D((n) => n - 1),
|
60
|
+
[]
|
61
|
+
),
|
62
|
+
children: /* @__PURE__ */ d(
|
63
|
+
x.div,
|
64
|
+
{
|
65
|
+
tabIndex: a || L === 0 ? -1 : 0,
|
66
|
+
"data-orientation": o,
|
67
|
+
...C,
|
68
|
+
ref: I,
|
69
|
+
style: { outline: "none", ...e.style },
|
70
|
+
onMouseDown: p(e.onMouseDown, () => {
|
71
|
+
A.current = !0;
|
72
|
+
}),
|
73
|
+
onFocus: p(e.onFocus, (n) => {
|
74
|
+
const U = !A.current;
|
75
|
+
if (n.target === n.currentTarget && U && !a) {
|
76
|
+
const P = new CustomEvent(h, X);
|
77
|
+
if (n.currentTarget.dispatchEvent(P), !P.defaultPrevented) {
|
78
|
+
const _ = k().filter((f) => f.focusable), B = _.find((f) => f.active), Y = _.find((f) => f.id === l), H = [B, Y, ..._].filter(
|
79
|
+
Boolean
|
80
|
+
).map((f) => f.ref.current);
|
81
|
+
M(H, w);
|
82
|
+
}
|
83
|
+
}
|
84
|
+
A.current = !1;
|
85
|
+
}),
|
86
|
+
onBlur: p(e.onBlur, () => i(!1))
|
87
|
+
}
|
88
|
+
)
|
89
|
+
}
|
90
|
+
);
|
91
|
+
}), O = "RovingFocusGroupItem", K = s.forwardRef(
|
92
|
+
(e, r) => {
|
93
|
+
const {
|
94
|
+
__scopeRovingFocusGroup: c,
|
95
|
+
focusable: o = !0,
|
96
|
+
active: F = !1,
|
97
|
+
tabStopId: g,
|
98
|
+
...R
|
99
|
+
} = e, E = q(), m = g || E, u = oe(O, c), w = u.currentTabStopId === m, C = G(c), { onFocusableItemAdd: v, onFocusableItemRemove: I } = u;
|
100
|
+
return s.useEffect(() => {
|
101
|
+
if (o)
|
102
|
+
return v(), () => I();
|
103
|
+
}, [o, v, I]), /* @__PURE__ */ d(
|
104
|
+
y.ItemSlot,
|
105
|
+
{
|
106
|
+
scope: c,
|
107
|
+
id: m,
|
108
|
+
focusable: o,
|
109
|
+
active: F,
|
110
|
+
children: /* @__PURE__ */ d(
|
111
|
+
x.span,
|
112
|
+
{
|
113
|
+
tabIndex: w ? 0 : -1,
|
114
|
+
"data-orientation": u.orientation,
|
115
|
+
...R,
|
116
|
+
ref: r,
|
117
|
+
onMouseDown: p(e.onMouseDown, (t) => {
|
118
|
+
o ? u.onItemFocus(m) : t.preventDefault();
|
119
|
+
}),
|
120
|
+
onFocus: p(e.onFocus, () => u.onItemFocus(m)),
|
121
|
+
onKeyDown: p(e.onKeyDown, (t) => {
|
122
|
+
if (t.key === "Tab" && t.shiftKey) {
|
123
|
+
u.onItemShiftTab();
|
124
|
+
return;
|
125
|
+
}
|
126
|
+
if (t.target !== t.currentTarget) return;
|
127
|
+
const l = se(t, u.orientation, u.dir);
|
128
|
+
if (l !== void 0) {
|
129
|
+
if (t.metaKey || t.ctrlKey || t.altKey || t.shiftKey) return;
|
130
|
+
t.preventDefault();
|
131
|
+
let a = C().filter((i) => i.focusable).map((i) => i.ref.current);
|
132
|
+
if (l === "last") a.reverse();
|
133
|
+
else if (l === "prev" || l === "next") {
|
134
|
+
l === "prev" && a.reverse();
|
135
|
+
const i = a.indexOf(t.currentTarget);
|
136
|
+
a = u.loop ? ce(a, i + 1) : a.slice(i + 1);
|
137
|
+
}
|
138
|
+
setTimeout(() => M(a));
|
139
|
+
}
|
140
|
+
})
|
141
|
+
}
|
142
|
+
)
|
143
|
+
}
|
144
|
+
);
|
145
|
+
}
|
146
|
+
);
|
147
|
+
K.displayName = O;
|
148
|
+
var re = {
|
149
|
+
ArrowLeft: "prev",
|
150
|
+
ArrowUp: "prev",
|
151
|
+
ArrowRight: "next",
|
152
|
+
ArrowDown: "next",
|
153
|
+
PageUp: "first",
|
154
|
+
Home: "first",
|
155
|
+
PageDown: "last",
|
156
|
+
End: "last"
|
157
|
+
};
|
158
|
+
function ne(e, r) {
|
159
|
+
return r !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
|
160
|
+
}
|
161
|
+
function se(e, r, c) {
|
162
|
+
const o = ne(e.key, c);
|
163
|
+
if (!(r === "vertical" && ["ArrowLeft", "ArrowRight"].includes(o)) && !(r === "horizontal" && ["ArrowUp", "ArrowDown"].includes(o)))
|
164
|
+
return re[o];
|
165
|
+
}
|
166
|
+
function M(e, r = !1) {
|
167
|
+
const c = document.activeElement;
|
168
|
+
for (const o of e)
|
169
|
+
if (o === c || (o.focus({ preventScroll: r }), document.activeElement !== c)) return;
|
170
|
+
}
|
171
|
+
function ce(e, r) {
|
172
|
+
return e.map((c, o) => e[(r + o) % e.length]);
|
173
|
+
}
|
174
|
+
var ge = N, Re = K;
|
175
|
+
export {
|
176
|
+
Re as Item,
|
177
|
+
ge as Root,
|
178
|
+
N as RovingFocusGroup,
|
179
|
+
K as RovingFocusGroupItem,
|
180
|
+
Fe as createRovingFocusGroupScope
|
181
|
+
};
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import * as l from "react";
|
2
|
+
import { composeRefs as u } from "../../../../../@radix-ui_react-compose-refs@1.1.1_@types_react@18.3.18_react@18.3.1/node_modules/@radix-ui/react-compose-refs/dist/index.js";
|
3
|
+
import { jsx as c, Fragment as d } from "react/jsx-runtime";
|
4
|
+
var m = l.forwardRef((r, n) => {
|
5
|
+
const { children: e, ...t } = r, o = l.Children.toArray(e), i = o.find(y);
|
6
|
+
if (i) {
|
7
|
+
const s = i.props.children, a = o.map((p) => p === i ? l.Children.count(s) > 1 ? l.Children.only(null) : l.isValidElement(s) ? s.props.children : null : p);
|
8
|
+
return /* @__PURE__ */ c(f, { ...t, ref: n, children: l.isValidElement(s) ? l.cloneElement(s, void 0, a) : null });
|
9
|
+
}
|
10
|
+
return /* @__PURE__ */ c(f, { ...t, ref: n, children: e });
|
11
|
+
});
|
12
|
+
m.displayName = "Slot";
|
13
|
+
var f = l.forwardRef((r, n) => {
|
14
|
+
const { children: e, ...t } = r;
|
15
|
+
if (l.isValidElement(e)) {
|
16
|
+
const o = C(e), i = h(t, e.props);
|
17
|
+
return e.type !== l.Fragment && (i.ref = n ? u(n, o) : o), l.cloneElement(e, i);
|
18
|
+
}
|
19
|
+
return l.Children.count(e) > 1 ? l.Children.only(null) : null;
|
20
|
+
});
|
21
|
+
f.displayName = "SlotClone";
|
22
|
+
var g = ({ children: r }) => /* @__PURE__ */ c(d, { children: r });
|
23
|
+
function y(r) {
|
24
|
+
return l.isValidElement(r) && r.type === g;
|
25
|
+
}
|
26
|
+
function h(r, n) {
|
27
|
+
const e = { ...n };
|
28
|
+
for (const t in n) {
|
29
|
+
const o = r[t], i = n[t];
|
30
|
+
/^on[A-Z]/.test(t) ? o && i ? e[t] = (...a) => {
|
31
|
+
i(...a), o(...a);
|
32
|
+
} : o && (e[t] = o) : t === "style" ? e[t] = { ...o, ...i } : t === "className" && (e[t] = [o, i].filter(Boolean).join(" "));
|
33
|
+
}
|
34
|
+
return { ...r, ...e };
|
35
|
+
}
|
36
|
+
function C(r) {
|
37
|
+
var t, o;
|
38
|
+
let n = (t = Object.getOwnPropertyDescriptor(r.props, "ref")) == null ? void 0 : t.get, e = n && "isReactWarning" in n && n.isReactWarning;
|
39
|
+
return e ? r.ref : (n = (o = Object.getOwnPropertyDescriptor(r, "ref")) == null ? void 0 : o.get, e = n && "isReactWarning" in n && n.isReactWarning, e ? r.props.ref : r.props.ref || r.ref);
|
40
|
+
}
|
41
|
+
export {
|
42
|
+
m as Slot,
|
43
|
+
g as Slottable
|
44
|
+
};
|
@@ -0,0 +1,448 @@
|
|
1
|
+
"use client";
|
2
|
+
import * as n from "react";
|
3
|
+
import * as we from "react-dom";
|
4
|
+
import { composeEventHandlers as R } from "../../../../../@radix-ui_primitive@1.1.1/node_modules/@radix-ui/primitive/dist/index.js";
|
5
|
+
import { useComposedRefs as te } from "../../../../../@radix-ui_react-compose-refs@1.1.1_@types_react@18.3.18_react@18.3.1/node_modules/@radix-ui/react-compose-refs/dist/index.js";
|
6
|
+
import { createCollection as Ee } from "../../../../../@radix-ui_react-collection@1.1.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@1_tagbd57u5fsqga6qdjecsll7fm/node_modules/@radix-ui/react-collection/dist/index.js";
|
7
|
+
import { createContextScope as ye } from "../../../../../@radix-ui_react-context@1.1.1_@types_react@18.3.18_react@18.3.1/node_modules/@radix-ui/react-context/dist/index.js";
|
8
|
+
import { Branch as Pe, Root as Ce } from "../../../../../@radix-ui_react-dismissable-layer@1.1.5_@types_react-dom@18.3.5_@types_react@18.3.18__@types__nitdfoqpcbroetgllwgz3is5ai/node_modules/@radix-ui/react-dismissable-layer/dist/index.js";
|
9
|
+
import { Portal as xe } from "../../../../../@radix-ui_react-portal@1.1.4_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@18.3._ulc3jfxcmrz2rfz7bui53djdtu/node_modules/@radix-ui/react-portal/dist/index.js";
|
10
|
+
import { Presence as he } from "../../../../../@radix-ui_react-presence@1.1.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@18._pqwkltkxenlrsgmgun6icjiigu/node_modules/@radix-ui/react-presence/dist/index.js";
|
11
|
+
import { Primitive as D, dispatchDiscreteCustomEvent as Re } from "../../../../../@radix-ui_react-primitive@2.0.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@18_sejcxqoscaweil2bvgwwavaoha/node_modules/@radix-ui/react-primitive/dist/index.js";
|
12
|
+
import { useCallbackRef as W } from "../../../../../@radix-ui_react-use-callback-ref@1.1.0_@types_react@18.3.18_react@18.3.1/node_modules/@radix-ui/react-use-callback-ref/dist/index.js";
|
13
|
+
import { useControllableState as be } from "../../../../../@radix-ui_react-use-controllable-state@1.1.0_@types_react@18.3.18_react@18.3.1/node_modules/@radix-ui/react-use-controllable-state/dist/index.js";
|
14
|
+
import { useLayoutEffect as ge } from "../../../../../@radix-ui_react-use-layout-effect@1.1.0_@types_react@18.3.18_react@18.3.1/node_modules/@radix-ui/react-use-layout-effect/dist/index.js";
|
15
|
+
import { VisuallyHidden as oe } from "../../../../../@radix-ui_react-visually-hidden@1.1.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_re_omyrydx3gc2oidaiqb4gsovieq/node_modules/@radix-ui/react-visually-hidden/dist/index.js";
|
16
|
+
import { jsxs as G, jsx as l, Fragment as re } from "react/jsx-runtime";
|
17
|
+
var J = "ToastProvider", [Q, Se, Ie] = Ee("Toast"), [ne, at] = ye("Toast", [Ie]), [Fe, U] = ne(J), se = (e) => {
|
18
|
+
const {
|
19
|
+
__scopeToast: o,
|
20
|
+
label: r = "Notification",
|
21
|
+
duration: t = 5e3,
|
22
|
+
swipeDirection: c = "right",
|
23
|
+
swipeThreshold: d = 50,
|
24
|
+
children: p
|
25
|
+
} = e, [T, v] = n.useState(null), [s, h] = n.useState(0), y = n.useRef(!1), N = n.useRef(!1);
|
26
|
+
return r.trim() || console.error(
|
27
|
+
`Invalid prop \`label\` supplied to \`${J}\`. Expected non-empty \`string\`.`
|
28
|
+
), /* @__PURE__ */ l(Q.Provider, { scope: o, children: /* @__PURE__ */ l(
|
29
|
+
Fe,
|
30
|
+
{
|
31
|
+
scope: o,
|
32
|
+
label: r,
|
33
|
+
duration: t,
|
34
|
+
swipeDirection: c,
|
35
|
+
swipeThreshold: d,
|
36
|
+
toastCount: s,
|
37
|
+
viewport: T,
|
38
|
+
onViewportChange: v,
|
39
|
+
onToastAdd: n.useCallback(() => h((g) => g + 1), []),
|
40
|
+
onToastRemove: n.useCallback(() => h((g) => g - 1), []),
|
41
|
+
isFocusedToastEscapeKeyDownRef: y,
|
42
|
+
isClosePausedRef: N,
|
43
|
+
children: p
|
44
|
+
}
|
45
|
+
) });
|
46
|
+
};
|
47
|
+
se.displayName = J;
|
48
|
+
var ae = "ToastViewport", _e = ["F8"], j = "toast.viewportPause", q = "toast.viewportResume", ie = n.forwardRef(
|
49
|
+
(e, o) => {
|
50
|
+
const {
|
51
|
+
__scopeToast: r,
|
52
|
+
hotkey: t = _e,
|
53
|
+
label: c = "Notifications ({hotkey})",
|
54
|
+
...d
|
55
|
+
} = e, p = U(ae, r), T = Se(r), v = n.useRef(null), s = n.useRef(null), h = n.useRef(null), y = n.useRef(null), N = te(o, y, p.onViewportChange), g = t.join("+").replace(/Key/g, "").replace(/Digit/g, ""), S = p.toastCount > 0;
|
56
|
+
n.useEffect(() => {
|
57
|
+
const i = (P) => {
|
58
|
+
var m;
|
59
|
+
t.length !== 0 && t.every((w) => P[w] || P.code === w) && ((m = y.current) == null || m.focus());
|
60
|
+
};
|
61
|
+
return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
|
62
|
+
}, [t]), n.useEffect(() => {
|
63
|
+
const i = v.current, P = y.current;
|
64
|
+
if (S && i && P) {
|
65
|
+
const f = () => {
|
66
|
+
if (!p.isClosePausedRef.current) {
|
67
|
+
const C = new CustomEvent(j);
|
68
|
+
P.dispatchEvent(C), p.isClosePausedRef.current = !0;
|
69
|
+
}
|
70
|
+
}, m = () => {
|
71
|
+
if (p.isClosePausedRef.current) {
|
72
|
+
const C = new CustomEvent(q);
|
73
|
+
P.dispatchEvent(C), p.isClosePausedRef.current = !1;
|
74
|
+
}
|
75
|
+
}, w = (C) => {
|
76
|
+
!i.contains(C.relatedTarget) && m();
|
77
|
+
}, E = () => {
|
78
|
+
i.contains(document.activeElement) || m();
|
79
|
+
};
|
80
|
+
return i.addEventListener("focusin", f), i.addEventListener("focusout", w), i.addEventListener("pointermove", f), i.addEventListener("pointerleave", E), window.addEventListener("blur", f), window.addEventListener("focus", m), () => {
|
81
|
+
i.removeEventListener("focusin", f), i.removeEventListener("focusout", w), i.removeEventListener("pointermove", f), i.removeEventListener("pointerleave", E), window.removeEventListener("blur", f), window.removeEventListener("focus", m);
|
82
|
+
};
|
83
|
+
}
|
84
|
+
}, [S, p.isClosePausedRef]);
|
85
|
+
const u = n.useCallback(
|
86
|
+
({ tabbingDirection: i }) => {
|
87
|
+
const f = T().map((m) => {
|
88
|
+
const w = m.ref.current, E = [w, ...Be(w)];
|
89
|
+
return i === "forwards" ? E : E.reverse();
|
90
|
+
});
|
91
|
+
return (i === "forwards" ? f.reverse() : f).flat();
|
92
|
+
},
|
93
|
+
[T]
|
94
|
+
);
|
95
|
+
return n.useEffect(() => {
|
96
|
+
const i = y.current;
|
97
|
+
if (i) {
|
98
|
+
const P = (f) => {
|
99
|
+
var E, C, I;
|
100
|
+
const m = f.altKey || f.ctrlKey || f.metaKey;
|
101
|
+
if (f.key === "Tab" && !m) {
|
102
|
+
const L = document.activeElement, _ = f.shiftKey;
|
103
|
+
if (f.target === i && _) {
|
104
|
+
(E = s.current) == null || E.focus();
|
105
|
+
return;
|
106
|
+
}
|
107
|
+
const F = u({ tabbingDirection: _ ? "backwards" : "forwards" }), k = F.findIndex((a) => a === L);
|
108
|
+
B(F.slice(k + 1)) ? f.preventDefault() : _ ? (C = s.current) == null || C.focus() : (I = h.current) == null || I.focus();
|
109
|
+
}
|
110
|
+
};
|
111
|
+
return i.addEventListener("keydown", P), () => i.removeEventListener("keydown", P);
|
112
|
+
}
|
113
|
+
}, [T, u]), /* @__PURE__ */ G(
|
114
|
+
Pe,
|
115
|
+
{
|
116
|
+
ref: v,
|
117
|
+
role: "region",
|
118
|
+
"aria-label": c.replace("{hotkey}", g),
|
119
|
+
tabIndex: -1,
|
120
|
+
style: { pointerEvents: S ? void 0 : "none" },
|
121
|
+
children: [
|
122
|
+
S && /* @__PURE__ */ l(
|
123
|
+
z,
|
124
|
+
{
|
125
|
+
ref: s,
|
126
|
+
onFocusFromOutsideViewport: () => {
|
127
|
+
const i = u({
|
128
|
+
tabbingDirection: "forwards"
|
129
|
+
});
|
130
|
+
B(i);
|
131
|
+
}
|
132
|
+
}
|
133
|
+
),
|
134
|
+
/* @__PURE__ */ l(Q.Slot, { scope: r, children: /* @__PURE__ */ l(D.ol, { tabIndex: -1, ...d, ref: N }) }),
|
135
|
+
S && /* @__PURE__ */ l(
|
136
|
+
z,
|
137
|
+
{
|
138
|
+
ref: h,
|
139
|
+
onFocusFromOutsideViewport: () => {
|
140
|
+
const i = u({
|
141
|
+
tabbingDirection: "backwards"
|
142
|
+
});
|
143
|
+
B(i);
|
144
|
+
}
|
145
|
+
}
|
146
|
+
)
|
147
|
+
]
|
148
|
+
}
|
149
|
+
);
|
150
|
+
}
|
151
|
+
);
|
152
|
+
ie.displayName = ae;
|
153
|
+
var ce = "ToastFocusProxy", z = n.forwardRef(
|
154
|
+
(e, o) => {
|
155
|
+
const { __scopeToast: r, onFocusFromOutsideViewport: t, ...c } = e, d = U(ce, r);
|
156
|
+
return /* @__PURE__ */ l(
|
157
|
+
oe,
|
158
|
+
{
|
159
|
+
"aria-hidden": !0,
|
160
|
+
tabIndex: 0,
|
161
|
+
...c,
|
162
|
+
ref: o,
|
163
|
+
style: { position: "fixed" },
|
164
|
+
onFocus: (p) => {
|
165
|
+
var s;
|
166
|
+
const T = p.relatedTarget;
|
167
|
+
!((s = d.viewport) != null && s.contains(T)) && t();
|
168
|
+
}
|
169
|
+
}
|
170
|
+
);
|
171
|
+
}
|
172
|
+
);
|
173
|
+
z.displayName = ce;
|
174
|
+
var X = "Toast", Ae = "toast.swipeStart", De = "toast.swipeMove", Ne = "toast.swipeCancel", Le = "toast.swipeEnd", ue = n.forwardRef(
|
175
|
+
(e, o) => {
|
176
|
+
const { forceMount: r, open: t, defaultOpen: c, onOpenChange: d, ...p } = e, [T = !0, v] = be({
|
177
|
+
prop: t,
|
178
|
+
defaultProp: c,
|
179
|
+
onChange: d
|
180
|
+
});
|
181
|
+
return /* @__PURE__ */ l(he, { present: r || T, children: /* @__PURE__ */ l(
|
182
|
+
ke,
|
183
|
+
{
|
184
|
+
open: T,
|
185
|
+
...p,
|
186
|
+
ref: o,
|
187
|
+
onClose: () => v(!1),
|
188
|
+
onPause: W(e.onPause),
|
189
|
+
onResume: W(e.onResume),
|
190
|
+
onSwipeStart: R(e.onSwipeStart, (s) => {
|
191
|
+
s.currentTarget.setAttribute("data-swipe", "start");
|
192
|
+
}),
|
193
|
+
onSwipeMove: R(e.onSwipeMove, (s) => {
|
194
|
+
const { x: h, y } = s.detail.delta;
|
195
|
+
s.currentTarget.setAttribute("data-swipe", "move"), s.currentTarget.style.setProperty("--radix-toast-swipe-move-x", `${h}px`), s.currentTarget.style.setProperty("--radix-toast-swipe-move-y", `${y}px`);
|
196
|
+
}),
|
197
|
+
onSwipeCancel: R(e.onSwipeCancel, (s) => {
|
198
|
+
s.currentTarget.setAttribute("data-swipe", "cancel"), s.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), s.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), s.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"), s.currentTarget.style.removeProperty("--radix-toast-swipe-end-y");
|
199
|
+
}),
|
200
|
+
onSwipeEnd: R(e.onSwipeEnd, (s) => {
|
201
|
+
const { x: h, y } = s.detail.delta;
|
202
|
+
s.currentTarget.setAttribute("data-swipe", "end"), s.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), s.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), s.currentTarget.style.setProperty("--radix-toast-swipe-end-x", `${h}px`), s.currentTarget.style.setProperty("--radix-toast-swipe-end-y", `${y}px`), v(!1);
|
203
|
+
})
|
204
|
+
}
|
205
|
+
) });
|
206
|
+
}
|
207
|
+
);
|
208
|
+
ue.displayName = X;
|
209
|
+
var [Me, Oe] = ne(X, {
|
210
|
+
onClose() {
|
211
|
+
}
|
212
|
+
}), ke = n.forwardRef(
|
213
|
+
(e, o) => {
|
214
|
+
const {
|
215
|
+
__scopeToast: r,
|
216
|
+
type: t = "foreground",
|
217
|
+
duration: c,
|
218
|
+
open: d,
|
219
|
+
onClose: p,
|
220
|
+
onEscapeKeyDown: T,
|
221
|
+
onPause: v,
|
222
|
+
onResume: s,
|
223
|
+
onSwipeStart: h,
|
224
|
+
onSwipeMove: y,
|
225
|
+
onSwipeCancel: N,
|
226
|
+
onSwipeEnd: g,
|
227
|
+
...S
|
228
|
+
} = e, u = U(X, r), [i, P] = n.useState(null), f = te(o, (a) => P(a)), m = n.useRef(null), w = n.useRef(null), E = c || u.duration, C = n.useRef(0), I = n.useRef(E), L = n.useRef(0), { onToastAdd: _, onToastRemove: Y } = u, A = W(() => {
|
229
|
+
var x;
|
230
|
+
(i == null ? void 0 : i.contains(document.activeElement)) && ((x = u.viewport) == null || x.focus()), p();
|
231
|
+
}), F = n.useCallback(
|
232
|
+
(a) => {
|
233
|
+
!a || a === 1 / 0 || (window.clearTimeout(L.current), C.current = (/* @__PURE__ */ new Date()).getTime(), L.current = window.setTimeout(A, a));
|
234
|
+
},
|
235
|
+
[A]
|
236
|
+
);
|
237
|
+
n.useEffect(() => {
|
238
|
+
const a = u.viewport;
|
239
|
+
if (a) {
|
240
|
+
const x = () => {
|
241
|
+
F(I.current), s == null || s();
|
242
|
+
}, b = () => {
|
243
|
+
const M = (/* @__PURE__ */ new Date()).getTime() - C.current;
|
244
|
+
I.current = I.current - M, window.clearTimeout(L.current), v == null || v();
|
245
|
+
};
|
246
|
+
return a.addEventListener(j, b), a.addEventListener(q, x), () => {
|
247
|
+
a.removeEventListener(j, b), a.removeEventListener(q, x);
|
248
|
+
};
|
249
|
+
}
|
250
|
+
}, [u.viewport, E, v, s, F]), n.useEffect(() => {
|
251
|
+
d && !u.isClosePausedRef.current && F(E);
|
252
|
+
}, [d, E, u.isClosePausedRef, F]), n.useEffect(() => (_(), () => Y()), [_, Y]);
|
253
|
+
const k = n.useMemo(() => i ? me(i) : null, [i]);
|
254
|
+
return u.viewport ? /* @__PURE__ */ G(re, { children: [
|
255
|
+
k && /* @__PURE__ */ l(
|
256
|
+
Ve,
|
257
|
+
{
|
258
|
+
__scopeToast: r,
|
259
|
+
role: "status",
|
260
|
+
"aria-live": t === "foreground" ? "assertive" : "polite",
|
261
|
+
"aria-atomic": !0,
|
262
|
+
children: k
|
263
|
+
}
|
264
|
+
),
|
265
|
+
/* @__PURE__ */ l(Me, { scope: r, onClose: A, children: we.createPortal(
|
266
|
+
/* @__PURE__ */ l(Q.ItemSlot, { scope: r, children: /* @__PURE__ */ l(
|
267
|
+
Ce,
|
268
|
+
{
|
269
|
+
asChild: !0,
|
270
|
+
onEscapeKeyDown: R(T, () => {
|
271
|
+
u.isFocusedToastEscapeKeyDownRef.current || A(), u.isFocusedToastEscapeKeyDownRef.current = !1;
|
272
|
+
}),
|
273
|
+
children: /* @__PURE__ */ l(
|
274
|
+
D.li,
|
275
|
+
{
|
276
|
+
role: "status",
|
277
|
+
"aria-live": "off",
|
278
|
+
"aria-atomic": !0,
|
279
|
+
tabIndex: 0,
|
280
|
+
"data-state": d ? "open" : "closed",
|
281
|
+
"data-swipe-direction": u.swipeDirection,
|
282
|
+
...S,
|
283
|
+
ref: f,
|
284
|
+
style: { userSelect: "none", touchAction: "none", ...e.style },
|
285
|
+
onKeyDown: R(e.onKeyDown, (a) => {
|
286
|
+
a.key === "Escape" && (T == null || T(a.nativeEvent), a.nativeEvent.defaultPrevented || (u.isFocusedToastEscapeKeyDownRef.current = !0, A()));
|
287
|
+
}),
|
288
|
+
onPointerDown: R(e.onPointerDown, (a) => {
|
289
|
+
a.button === 0 && (m.current = { x: a.clientX, y: a.clientY });
|
290
|
+
}),
|
291
|
+
onPointerMove: R(e.onPointerMove, (a) => {
|
292
|
+
if (!m.current) return;
|
293
|
+
const x = a.clientX - m.current.x, b = a.clientY - m.current.y, M = !!w.current, O = ["left", "right"].includes(u.swipeDirection), V = ["left", "up"].includes(u.swipeDirection) ? Math.min : Math.max, Te = O ? V(0, x) : 0, ve = O ? 0 : V(0, b), $ = a.pointerType === "touch" ? 10 : 2, K = { x: Te, y: ve }, Z = { originalEvent: a, delta: K };
|
294
|
+
M ? (w.current = K, H(De, y, Z, {
|
295
|
+
discrete: !1
|
296
|
+
})) : ee(K, u.swipeDirection, $) ? (w.current = K, H(Ae, h, Z, {
|
297
|
+
discrete: !1
|
298
|
+
}), a.target.setPointerCapture(a.pointerId)) : (Math.abs(x) > $ || Math.abs(b) > $) && (m.current = null);
|
299
|
+
}),
|
300
|
+
onPointerUp: R(e.onPointerUp, (a) => {
|
301
|
+
const x = w.current, b = a.target;
|
302
|
+
if (b.hasPointerCapture(a.pointerId) && b.releasePointerCapture(a.pointerId), w.current = null, m.current = null, x) {
|
303
|
+
const M = a.currentTarget, O = { originalEvent: a, delta: x };
|
304
|
+
ee(x, u.swipeDirection, u.swipeThreshold) ? H(Le, g, O, {
|
305
|
+
discrete: !0
|
306
|
+
}) : H(
|
307
|
+
Ne,
|
308
|
+
N,
|
309
|
+
O,
|
310
|
+
{
|
311
|
+
discrete: !0
|
312
|
+
}
|
313
|
+
), M.addEventListener("click", (V) => V.preventDefault(), {
|
314
|
+
once: !0
|
315
|
+
});
|
316
|
+
}
|
317
|
+
})
|
318
|
+
}
|
319
|
+
)
|
320
|
+
}
|
321
|
+
) }),
|
322
|
+
u.viewport
|
323
|
+
) })
|
324
|
+
] }) : null;
|
325
|
+
}
|
326
|
+
), Ve = (e) => {
|
327
|
+
const { __scopeToast: o, children: r, ...t } = e, c = U(X, o), [d, p] = n.useState(!1), [T, v] = n.useState(!1);
|
328
|
+
return Ye(() => p(!0)), n.useEffect(() => {
|
329
|
+
const s = window.setTimeout(() => v(!0), 1e3);
|
330
|
+
return () => window.clearTimeout(s);
|
331
|
+
}, []), T ? null : /* @__PURE__ */ l(xe, { asChild: !0, children: /* @__PURE__ */ l(oe, { ...t, children: d && /* @__PURE__ */ G(re, { children: [
|
332
|
+
c.label,
|
333
|
+
" ",
|
334
|
+
r
|
335
|
+
] }) }) });
|
336
|
+
}, Ke = "ToastTitle", He = n.forwardRef(
|
337
|
+
(e, o) => {
|
338
|
+
const { __scopeToast: r, ...t } = e;
|
339
|
+
return /* @__PURE__ */ l(D.div, { ...t, ref: o });
|
340
|
+
}
|
341
|
+
);
|
342
|
+
He.displayName = Ke;
|
343
|
+
var We = "ToastDescription", Ue = n.forwardRef(
|
344
|
+
(e, o) => {
|
345
|
+
const { __scopeToast: r, ...t } = e;
|
346
|
+
return /* @__PURE__ */ l(D.div, { ...t, ref: o });
|
347
|
+
}
|
348
|
+
);
|
349
|
+
Ue.displayName = We;
|
350
|
+
var le = "ToastAction", Xe = n.forwardRef(
|
351
|
+
(e, o) => {
|
352
|
+
const { altText: r, ...t } = e;
|
353
|
+
return r.trim() ? /* @__PURE__ */ l(fe, { altText: r, asChild: !0, children: /* @__PURE__ */ l(pe, { ...t, ref: o }) }) : (console.error(
|
354
|
+
`Invalid prop \`altText\` supplied to \`${le}\`. Expected non-empty \`string\`.`
|
355
|
+
), null);
|
356
|
+
}
|
357
|
+
);
|
358
|
+
Xe.displayName = le;
|
359
|
+
var de = "ToastClose", pe = n.forwardRef(
|
360
|
+
(e, o) => {
|
361
|
+
const { __scopeToast: r, ...t } = e, c = Oe(de, r);
|
362
|
+
return /* @__PURE__ */ l(fe, { asChild: !0, children: /* @__PURE__ */ l(
|
363
|
+
D.button,
|
364
|
+
{
|
365
|
+
type: "button",
|
366
|
+
...t,
|
367
|
+
ref: o,
|
368
|
+
onClick: R(e.onClick, c.onClose)
|
369
|
+
}
|
370
|
+
) });
|
371
|
+
}
|
372
|
+
);
|
373
|
+
pe.displayName = de;
|
374
|
+
var fe = n.forwardRef((e, o) => {
|
375
|
+
const { __scopeToast: r, altText: t, ...c } = e;
|
376
|
+
return /* @__PURE__ */ l(
|
377
|
+
D.div,
|
378
|
+
{
|
379
|
+
"data-radix-toast-announce-exclude": "",
|
380
|
+
"data-radix-toast-announce-alt": t || void 0,
|
381
|
+
...c,
|
382
|
+
ref: o
|
383
|
+
}
|
384
|
+
);
|
385
|
+
});
|
386
|
+
function me(e) {
|
387
|
+
const o = [];
|
388
|
+
return Array.from(e.childNodes).forEach((t) => {
|
389
|
+
if (t.nodeType === t.TEXT_NODE && t.textContent && o.push(t.textContent), $e(t)) {
|
390
|
+
const c = t.ariaHidden || t.hidden || t.style.display === "none", d = t.dataset.radixToastAnnounceExclude === "";
|
391
|
+
if (!c)
|
392
|
+
if (d) {
|
393
|
+
const p = t.dataset.radixToastAnnounceAlt;
|
394
|
+
p && o.push(p);
|
395
|
+
} else
|
396
|
+
o.push(...me(t));
|
397
|
+
}
|
398
|
+
}), o;
|
399
|
+
}
|
400
|
+
function H(e, o, r, { discrete: t }) {
|
401
|
+
const c = r.originalEvent.currentTarget, d = new CustomEvent(e, { bubbles: !0, cancelable: !0, detail: r });
|
402
|
+
o && c.addEventListener(e, o, { once: !0 }), t ? Re(c, d) : c.dispatchEvent(d);
|
403
|
+
}
|
404
|
+
var ee = (e, o, r = 0) => {
|
405
|
+
const t = Math.abs(e.x), c = Math.abs(e.y), d = t > c;
|
406
|
+
return o === "left" || o === "right" ? d && t > r : !d && c > r;
|
407
|
+
};
|
408
|
+
function Ye(e = () => {
|
409
|
+
}) {
|
410
|
+
const o = W(e);
|
411
|
+
ge(() => {
|
412
|
+
let r = 0, t = 0;
|
413
|
+
return r = window.requestAnimationFrame(() => t = window.requestAnimationFrame(o)), () => {
|
414
|
+
window.cancelAnimationFrame(r), window.cancelAnimationFrame(t);
|
415
|
+
};
|
416
|
+
}, [o]);
|
417
|
+
}
|
418
|
+
function $e(e) {
|
419
|
+
return e.nodeType === e.ELEMENT_NODE;
|
420
|
+
}
|
421
|
+
function Be(e) {
|
422
|
+
const o = [], r = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
423
|
+
acceptNode: (t) => {
|
424
|
+
const c = t.tagName === "INPUT" && t.type === "hidden";
|
425
|
+
return t.disabled || t.hidden || c ? NodeFilter.FILTER_SKIP : t.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
426
|
+
}
|
427
|
+
});
|
428
|
+
for (; r.nextNode(); ) o.push(r.currentNode);
|
429
|
+
return o;
|
430
|
+
}
|
431
|
+
function B(e) {
|
432
|
+
const o = document.activeElement;
|
433
|
+
return e.some((r) => r === o ? !0 : (r.focus(), document.activeElement !== o));
|
434
|
+
}
|
435
|
+
var it = se, ct = ie, ut = ue;
|
436
|
+
export {
|
437
|
+
it as Provider,
|
438
|
+
ut as Root,
|
439
|
+
ue as Toast,
|
440
|
+
Xe as ToastAction,
|
441
|
+
pe as ToastClose,
|
442
|
+
Ue as ToastDescription,
|
443
|
+
se as ToastProvider,
|
444
|
+
He as ToastTitle,
|
445
|
+
ie as ToastViewport,
|
446
|
+
ct as Viewport,
|
447
|
+
at as createToastScope
|
448
|
+
};
|