@gardenfi/garden-book 0.2.3-beta.13 → 0.2.3-beta.14
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/BlogCard/BlogCard.js +60 -0
- package/dist/BottomSheet/BottomSheet.js +17 -0
- package/dist/Button/Button.js +108 -0
- package/dist/Button/ClientOnlyLottie.js +27 -0
- package/dist/{Button.js → Button/spinner.json.js} +30 -170
- package/dist/Checkbox/Checkbox.js +7 -0
- package/dist/Chip/Chip.js +20 -0
- package/dist/ClientOnly/ClientOnly.js +6 -0
- package/dist/Container/Container.js +6 -0
- package/dist/Footer/Footer.js +371 -0
- package/dist/Footer/FooterBackgroundAnimation.js +100 -0
- package/dist/Footer/FooterLink.js +86 -0
- package/dist/GradientScroll/GradientScroll.js +73 -0
- package/dist/Icons/APIIcon/APIIcon.js +37 -0
- package/dist/Icons/AddIcon/AddIcon.js +16 -0
- package/dist/Icons/ArrowDownwardIcon/ArrowDownwardIcon.js +16 -0
- package/dist/Icons/ArrowEastIcon/ArrowEastIcon.js +22 -0
- package/dist/Icons/ArrowInwardIcon/ArrowInwardIcon.js +37 -0
- package/dist/Icons/ArrowLeftIcon/ArrowLeftIcon.js +16 -0
- package/dist/Icons/ArrowNorthEastIcon/ArrowNorthEastIcon.js +16 -0
- package/dist/Icons/ArrowNorthWestIcon/ArrowNorthWestIcon.js +16 -0
- package/dist/Icons/ArrowRightIcon/ArrowRightIcon.js +16 -0
- package/dist/Icons/ArrowSouthEastIcon/ArrowSouthEastIcon.js +16 -0
- package/dist/Icons/ArrowSouthWestIcon/ArrowSouthWestIcon.js +16 -0
- package/dist/Icons/ArrowSyncIcon/ArrowSyncIcon.js +16 -0
- package/dist/Icons/ArrowUpwardIcon/ArrowUpwardIcon.js +16 -0
- package/dist/Icons/BlogIcon/BlogIcon.js +37 -0
- package/dist/Icons/BrandKitIcon/BrandKitIcon.js +37 -0
- package/dist/Icons/CancelIcon/CancelIcon.js +22 -0
- package/dist/Icons/ChainflipIcon/ChainflipIcon.js +103 -0
- package/dist/Icons/CheckCircleIcon/CheckCircleIcon.js +22 -0
- package/dist/Icons/CheckIcon/CheckIcon.js +16 -0
- package/dist/Icons/Checked/Checked.js +37 -0
- package/dist/Icons/ClockIcon/ClockIcon.js +16 -0
- package/dist/Icons/CloseIcon/CloseIcon.js +16 -0
- package/dist/Icons/CodeBlockIcon/CodeBlockIcon.js +22 -0
- package/dist/Icons/CompareArrowsIcon/CompareArrowsIcon.js +22 -0
- package/dist/Icons/ConsoleIcon/ConsoleIcon.js +22 -0
- package/dist/Icons/CopyIcon/CopyIcon.js +16 -0
- package/dist/Icons/CopyrightsIcon/CopyrightsIcon.js +22 -0
- package/dist/Icons/DeleteIcon/DeleteIcon.js +16 -0
- package/dist/Icons/DiscordIcon/DiscordIcon.js +22 -0
- package/dist/Icons/DollarChipIcon/DollarChipIcon.js +37 -0
- package/dist/Icons/DraftIcon/DraftIcon.js +37 -0
- package/dist/Icons/EditIcon/EditIcon.js +16 -0
- package/dist/Icons/EncryptedIcon/EncryptedIcon.js +37 -0
- package/dist/Icons/ExchangeIcon/ExchangeIcon.js +19 -0
- package/dist/Icons/FaqIcon/FaqIcon.js +37 -0
- package/dist/Icons/FeesIcon/FeesIcon.js +22 -0
- package/dist/Icons/FingerprintIcon/FingerprintIcon.js +22 -0
- package/dist/Icons/FolderIcon/FolderIcon.js +37 -0
- package/dist/Icons/GasStationIcon/GasStationIcon.js +22 -0
- package/dist/Icons/GiftBoxIcon/GiftBoxIcon.js +37 -0
- package/dist/Icons/{LanguageIcon → GlobeIcon}/GlobeIcon.d.ts +1 -1
- package/dist/Icons/GlobeIcon/GlobeIcon.js +16 -0
- package/dist/Icons/GlobeIcon/index.d.ts +1 -0
- package/dist/Icons/HorizontalSwap/HorizontalSwap.js +37 -0
- package/dist/Icons/HubIcon/HubIcon.js +16 -0
- package/dist/Icons/InfinityIcon/InfinityIcon.js +22 -0
- package/dist/Icons/InfoIcon/InfoIcon.js +16 -0
- package/dist/Icons/KeyboardDownIcon/KeyboardDownIcon.js +16 -0
- package/dist/Icons/KeyboardLeftIcon/KeyboardLeftIcon.js +16 -0
- package/dist/Icons/KeyboardRightIcon/KeyboardRightIcon.js +16 -0
- package/dist/Icons/KeyboardUpIcon/KeyboardUpIcon.js +16 -0
- package/dist/Icons/LinkIcon/LinkIcon.js +16 -0
- package/dist/Icons/LockIcon/LockIcon.js +16 -0
- package/dist/Icons/LogoutIcon/LogoutIcon.js +16 -0
- package/dist/Icons/MenuIcon/MenuIcon.js +16 -0
- package/dist/Icons/MinusIcon/MinusIcon.js +19 -0
- package/dist/Icons/OpenInFullIcon/OpenInFullIcon.js +16 -0
- package/dist/Icons/OpenInNewIcon/OpenInNewIcon.js +22 -0
- package/dist/Icons/OtterSecIcon/OtterSecIcon.js +31 -0
- package/dist/Icons/PageInfoIcon/PageInfoIcon.js +16 -0
- package/dist/Icons/PasskeyIcon/PasskeyIcon.js +22 -0
- package/dist/Icons/PasskeyIcon/index.d.ts +1 -1
- package/dist/Icons/PlusIcon/PlusIcon.js +19 -0
- package/dist/Icons/RadioCheckedIcon/RadioCheckedIcon.js +16 -0
- package/dist/Icons/RadioUncheckedIcon/RadioUncheckedIcon.js +16 -0
- package/dist/Icons/RaiseHandIcon/RaiseHandIcon.js +37 -0
- package/dist/Icons/ReferralIcon/ReferralIcon.js +16 -0
- package/dist/Icons/RelayLinkIcon/RelayLinkIcon.js +88 -0
- package/dist/Icons/RemoveIcon/RemoveIcon.js +16 -0
- package/dist/Icons/Rotate360Icon/Rotate360Icon.js +37 -0
- package/dist/Icons/RoutingIcon/RoutingIcon.js +37 -0
- package/dist/Icons/RowInfoIcon/RowInfoIcon.js +37 -0
- package/dist/Icons/SDKIcon/SDKIcon.js +37 -0
- package/dist/Icons/SearchIcon/SearchIcon.js +16 -0
- package/dist/Icons/SearchIconThin/SearchIconThin.js +37 -0
- package/dist/Icons/Share/Share.js +22 -0
- package/dist/Icons/StakeIcon/StakeIcon.js +37 -0
- package/dist/Icons/StarIcon/StarIcon.js +16 -0
- package/dist/Icons/SwapHorizontalIcon/SwapHorizontalIcon.js +21 -0
- package/dist/Icons/ThorswapIcon/ThorswapIcon.js +55 -0
- package/dist/Icons/TimerIcon/TimerIcon.js +16 -0
- package/dist/Icons/Unchecked/Unchecked.js +37 -0
- package/dist/Icons/WalletIcon/WalletIcon.js +16 -0
- package/dist/Icons/WalletIconRose/WalletIconRose.js +22 -0
- package/dist/Icons/WarningIcon/WarningIcon.js +37 -0
- package/dist/Icons/XIcon/XIcon.js +22 -0
- package/dist/Icons/XSolidIcon/XSolidIcon.js +22 -0
- package/dist/Icons/ZellicIcon/ZellicIcon.js +101 -0
- package/dist/Icons/index.d.ts +1 -1
- package/dist/InfoBadge/InfoBadge.js +16 -0
- package/dist/Logo/ArbitrumLogo/ArbitrumLogo.js +66 -0
- package/dist/Logo/BTCLogo/BTCLogo.js +32 -0
- package/dist/Logo/Camelot/Camelot.js +73 -0
- package/dist/Logo/CatalogLogo/CatalogLogo.js +44 -0
- package/dist/Logo/Coinbase/Coinbase.js +24 -0
- package/dist/Logo/DLCBTC/DLCBTC.js +68 -0
- package/dist/Logo/Debridge/Debridge.js +103 -0
- package/dist/Logo/Dodo/DODO.js +77 -0
- package/dist/Logo/EthereumLogo/EthereumLogo.js +60 -0
- package/dist/Logo/GMX/GMX.js +49 -0
- package/dist/Logo/GMXLogo/GMXLogo.js +40 -0
- package/dist/Logo/GardenDocs/GardenDocs.js +31 -0
- package/dist/Logo/GardenExplorer/GardenExplorer.js +34 -0
- package/dist/Logo/GardenExplorerAlt/GardenExplorerAlt.js +31 -0
- package/dist/Logo/GardenFullLogo/GardenFullLogo.js +66 -0
- package/dist/{GardenIcon-E0OJI-b-.js → Logo/GardenIcon/GardenIcon.js} +11 -13
- package/dist/Logo/GardenIconOutline/GardenIconOutline.js +43 -0
- package/dist/Logo/GardenLogo/GardenLogo.js +33 -0
- package/dist/Logo/GardenLogoDark/GardenLogoDark.js +83 -0
- package/dist/Logo/GardenLogoLight/GardenLogoLight.js +83 -0
- package/dist/Logo/GardenLogoMarkDark/GardenLogoMarkDark.js +41 -0
- package/dist/Logo/GardenLogoMarkLight/GardenLogoMarkLight.js +41 -0
- package/dist/Logo/GardenLogoText/GardenLogoText.js +59 -0
- package/dist/Logo/GardenStrokeIcon/GardenStrokeIcon.js +43 -0
- package/dist/Logo/NFTIcon/NFTIcon.js +37 -0
- package/dist/Logo/PancakeSwap/PancakeSwap.js +134 -0
- package/dist/Logo/PhantomIcon/PhantomIcon.js +23 -0
- package/dist/Logo/PolygonLogo/PolygonLogo.js +31 -0
- package/dist/Logo/Radiant/Radiant.js +31 -0
- package/dist/Logo/RadiantLogo/RadiantLogo.js +40 -0
- package/dist/Logo/Solv/Solv.js +73 -0
- package/dist/Logo/SwellBTC/SwellBTC.js +31 -0
- package/dist/Logo/TraderJoe/TraderJoe.js +98 -0
- package/dist/Logo/TrailOfBits/TrailOfBits.js +190 -0
- package/dist/Logo/TrustWallet/TrustWallet.js +50 -0
- package/dist/Logo/Vertex/Vertex.js +90 -0
- package/dist/Logo/WalletConnect/WalletConnect.js +22 -0
- package/dist/Modal/Modal.js +66 -0
- package/dist/Opacity/Opacity.d.ts +1 -1
- package/dist/Opacity/Opacity.js +25 -0
- package/dist/QuestCard/QuestCard.js +57 -0
- package/dist/Sidebar/Sidebar.js +41 -0
- package/dist/TokenInfo/TokenInfo.js +44 -0
- package/dist/TokenNetworkLogos/TokenNetworkLogos.js +39 -0
- package/dist/{Typography-DX9XpQWB.js → Typography/Typography.js} +23 -25
- package/dist/animations/RollingText/RollingText.d.ts +12 -0
- package/dist/animations/RollingText/RollingText.js +70 -0
- package/dist/animations/ScaleY/ScaleY.d.ts +12 -0
- package/dist/animations/ScaleY/ScaleY.js +32 -0
- package/dist/animations/Shine/Shine.d.ts +11 -0
- package/dist/animations/Shine/Shine.js +6 -0
- package/dist/animations/index.d.ts +5 -0
- package/dist/assets/blogPlaceholder.svg.js +4 -0
- package/dist/assets/maskRect.svg.js +4 -0
- package/dist/hooks/useClientOnly.d.ts +5 -0
- package/dist/hooks/useClientOnly.js +10 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +287 -0
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +9 -0
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +29 -0
- package/dist/node_modules/@radix-ui/react-context/dist/index.js +70 -0
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +257 -0
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +127 -0
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +17 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +137 -0
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +13 -0
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +16 -0
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +71 -0
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +36 -0
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +50 -0
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +13 -0
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +54 -0
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +14 -0
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +6 -0
- package/dist/node_modules/aria-hidden/dist/es2015/index.js +52 -0
- package/dist/node_modules/vaul/dist/index.js +1038 -0
- package/dist/style.css +1 -17
- package/dist/utils/utils.d.ts +3 -0
- package/dist/utils/utils.js +6 -0
- package/package.json +8 -4
- package/dist/BlogCard.js +0 -820
- package/dist/BlogCard.js.map +0 -1
- package/dist/BottomSheet.js +0 -2801
- package/dist/BottomSheet.js.map +0 -1
- package/dist/Button/spinner.json.d.ts +0 -3
- package/dist/Button.js.map +0 -1
- package/dist/Checkbox.js +0 -9
- package/dist/Checkbox.js.map +0 -1
- package/dist/Chip-DOSAEkS5.js +0 -24
- package/dist/Chip-DOSAEkS5.js.map +0 -1
- package/dist/Chip.js +0 -5
- package/dist/Chip.js.map +0 -1
- package/dist/ClientOnly-CMQEf-Yl.js +0 -13
- package/dist/ClientOnly-CMQEf-Yl.js.map +0 -1
- package/dist/ClientOnly.js +0 -5
- package/dist/ClientOnly.js.map +0 -1
- package/dist/Combination-BN2ESQ8D.js +0 -666
- package/dist/Combination-BN2ESQ8D.js.map +0 -1
- package/dist/Container.js +0 -9
- package/dist/Container.js.map +0 -1
- package/dist/Footer.js +0 -661
- package/dist/Footer.js.map +0 -1
- package/dist/GardenIcon-E0OJI-b-.js.map +0 -1
- package/dist/GradientScroll.js +0 -86
- package/dist/GradientScroll.js.map +0 -1
- package/dist/Icons/LanguageIcon/index.d.ts +0 -1
- package/dist/Icons.js +0 -1936
- package/dist/Icons.js.map +0 -1
- package/dist/InfoBadge.js +0 -19
- package/dist/InfoBadge.js.map +0 -1
- package/dist/KeyboardDownIcon-hh63DdT7.js +0 -19
- package/dist/KeyboardDownIcon-hh63DdT7.js.map +0 -1
- package/dist/Logo.js +0 -2044
- package/dist/Logo.js.map +0 -1
- package/dist/Modal.js +0 -77
- package/dist/Modal.js.map +0 -1
- package/dist/Opacity-DRe3jTZ4.js +0 -29
- package/dist/Opacity-DRe3jTZ4.js.map +0 -1
- package/dist/Opacity.js +0 -5
- package/dist/Opacity.js.map +0 -1
- package/dist/OpenInFullIcon-D2mt0Gjr.js +0 -34
- package/dist/OpenInFullIcon-D2mt0Gjr.js.map +0 -1
- package/dist/QuestCard.js +0 -60
- package/dist/QuestCard.js.map +0 -1
- package/dist/RadioUncheckedIcon-KnzZG6cp.js +0 -34
- package/dist/RadioUncheckedIcon-KnzZG6cp.js.map +0 -1
- package/dist/Sidebar.js +0 -45
- package/dist/Sidebar.js.map +0 -1
- package/dist/TokenInfo.js +0 -47
- package/dist/TokenInfo.js.map +0 -1
- package/dist/TokenNetworkLogos-DZZrRsmI.js +0 -41
- package/dist/TokenNetworkLogos-DZZrRsmI.js.map +0 -1
- package/dist/TokenNetworkLogos.js +0 -5
- package/dist/TokenNetworkLogos.js.map +0 -1
- package/dist/Typography-DX9XpQWB.js.map +0 -1
- package/dist/Typography.js +0 -5
- package/dist/Typography.js.map +0 -1
- package/dist/Unchecked-B7UGXlAZ.js +0 -76
- package/dist/Unchecked-B7UGXlAZ.js.map +0 -1
- package/dist/XIcon-DC822TMq.js +0 -67
- package/dist/XIcon-DC822TMq.js.map +0 -1
- package/dist/fonts/HafferBlack.woff2 +0 -0
- package/dist/fonts/HafferBold.woff2 +0 -0
- package/dist/fonts/HafferHeavy.woff2 +0 -0
- package/dist/fonts/HafferLight.woff2 +0 -0
- package/dist/fonts/HafferMedium.woff2 +0 -0
- package/dist/fonts/HafferRegular.woff2 +0 -0
- package/dist/fonts/HafferSemiBold.woff2 +0 -0
- package/dist/fonts/HafferThin.woff2 +0 -0
- package/dist/index-Ir5YwUO1.js +0 -45
- package/dist/index-Ir5YwUO1.js.map +0 -1
- package/dist/useClientOnly-Bzx92NOa.js +0 -12
- package/dist/useClientOnly-Bzx92NOa.js.map +0 -1
- package/dist/utils-BnsJHiW8.js +0 -2478
- package/dist/utils-BnsJHiW8.js.map +0 -1
- /package/dist/Icons/PasskeyIcon/{Passkey.d.ts → PasskeyIcon.d.ts} +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as u from "react";
|
|
2
|
+
import { jsx as h } from "react/jsx-runtime";
|
|
3
|
+
function w(e, c) {
|
|
4
|
+
const o = u.createContext(c), a = (r) => {
|
|
5
|
+
const { children: t, ...n } = r, s = u.useMemo(() => n, Object.values(n));
|
|
6
|
+
return /* @__PURE__ */ h(o.Provider, { value: s, children: t });
|
|
7
|
+
};
|
|
8
|
+
a.displayName = e + "Provider";
|
|
9
|
+
function i(r) {
|
|
10
|
+
const t = u.useContext(o);
|
|
11
|
+
if (t) return t;
|
|
12
|
+
if (c !== void 0) return c;
|
|
13
|
+
throw new Error(`\`${r}\` must be used within \`${e}\``);
|
|
14
|
+
}
|
|
15
|
+
return [a, i];
|
|
16
|
+
}
|
|
17
|
+
function _(e, c = []) {
|
|
18
|
+
let o = [];
|
|
19
|
+
function a(r, t) {
|
|
20
|
+
const n = u.createContext(t), s = o.length;
|
|
21
|
+
o = [...o, t];
|
|
22
|
+
const p = (d) => {
|
|
23
|
+
var S;
|
|
24
|
+
const { scope: x, children: C, ...m } = d, v = ((S = x == null ? void 0 : x[e]) == null ? void 0 : S[s]) || n, P = u.useMemo(() => m, Object.values(m));
|
|
25
|
+
return /* @__PURE__ */ h(v.Provider, { value: P, children: C });
|
|
26
|
+
};
|
|
27
|
+
p.displayName = r + "Provider";
|
|
28
|
+
function f(d, x) {
|
|
29
|
+
var v;
|
|
30
|
+
const C = ((v = x == null ? void 0 : x[e]) == null ? void 0 : v[s]) || n, m = u.useContext(C);
|
|
31
|
+
if (m) return m;
|
|
32
|
+
if (t !== void 0) return t;
|
|
33
|
+
throw new Error(`\`${d}\` must be used within \`${r}\``);
|
|
34
|
+
}
|
|
35
|
+
return [p, f];
|
|
36
|
+
}
|
|
37
|
+
const i = () => {
|
|
38
|
+
const r = o.map((t) => u.createContext(t));
|
|
39
|
+
return function(n) {
|
|
40
|
+
const s = (n == null ? void 0 : n[e]) || r;
|
|
41
|
+
return u.useMemo(
|
|
42
|
+
() => ({ [`__scope${e}`]: { ...n, [e]: s } }),
|
|
43
|
+
[n, s]
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
return i.scopeName = e, [a, l(i, ...c)];
|
|
48
|
+
}
|
|
49
|
+
function l(...e) {
|
|
50
|
+
const c = e[0];
|
|
51
|
+
if (e.length === 1) return c;
|
|
52
|
+
const o = () => {
|
|
53
|
+
const a = e.map((i) => ({
|
|
54
|
+
useScope: i(),
|
|
55
|
+
scopeName: i.scopeName
|
|
56
|
+
}));
|
|
57
|
+
return function(r) {
|
|
58
|
+
const t = a.reduce((n, { useScope: s, scopeName: p }) => {
|
|
59
|
+
const d = s(r)[`__scope${p}`];
|
|
60
|
+
return { ...n, ...d };
|
|
61
|
+
}, {});
|
|
62
|
+
return u.useMemo(() => ({ [`__scope${c.scopeName}`]: t }), [t]);
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
return o.scopeName = c.scopeName, o;
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
w as createContext,
|
|
69
|
+
_ as createContextScope
|
|
70
|
+
};
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import * as s from "react";
|
|
2
|
+
import { composeEventHandlers as p } from "../../primitive/dist/index.js";
|
|
3
|
+
import { useComposedRefs as _ } from "../../react-compose-refs/dist/index.js";
|
|
4
|
+
import { createContextScope as $, createContext as B } from "../../react-context/dist/index.js";
|
|
5
|
+
import { useId as R } from "../../react-id/dist/index.js";
|
|
6
|
+
import { useControllableState as j } from "../../react-use-controllable-state/dist/index.js";
|
|
7
|
+
import { DismissableLayer as H } from "../../react-dismissable-layer/dist/index.js";
|
|
8
|
+
import { FocusScope as V } from "../../react-focus-scope/dist/index.js";
|
|
9
|
+
import { Portal as q } from "../../react-portal/dist/index.js";
|
|
10
|
+
import { Presence as h } from "../../react-presence/dist/index.js";
|
|
11
|
+
import { Primitive as m } from "../../react-primitive/dist/index.js";
|
|
12
|
+
import { useFocusGuards as K } from "../../react-focus-guards/dist/index.js";
|
|
13
|
+
import { RemoveScroll as U } from "react-remove-scroll";
|
|
14
|
+
import { hideOthers as Y } from "../../../aria-hidden/dist/es2015/index.js";
|
|
15
|
+
import { createSlot as Z } from "../../react-slot/dist/index.js";
|
|
16
|
+
import { jsx as i, jsxs as P, Fragment as O } from "react/jsx-runtime";
|
|
17
|
+
var v = "Dialog", [I] = $(v), [z, u] = I(v), x = (e) => {
|
|
18
|
+
const {
|
|
19
|
+
__scopeDialog: o,
|
|
20
|
+
children: n,
|
|
21
|
+
open: a,
|
|
22
|
+
defaultOpen: r,
|
|
23
|
+
onOpenChange: t,
|
|
24
|
+
modal: c = !0
|
|
25
|
+
} = e, l = s.useRef(null), d = s.useRef(null), [g, C] = j({
|
|
26
|
+
prop: a,
|
|
27
|
+
defaultProp: r ?? !1,
|
|
28
|
+
onChange: t,
|
|
29
|
+
caller: v
|
|
30
|
+
});
|
|
31
|
+
return /* @__PURE__ */ i(
|
|
32
|
+
z,
|
|
33
|
+
{
|
|
34
|
+
scope: o,
|
|
35
|
+
triggerRef: l,
|
|
36
|
+
contentRef: d,
|
|
37
|
+
contentId: R(),
|
|
38
|
+
titleId: R(),
|
|
39
|
+
descriptionId: R(),
|
|
40
|
+
open: g,
|
|
41
|
+
onOpenChange: C,
|
|
42
|
+
onOpenToggle: s.useCallback(() => C((L) => !L), [C]),
|
|
43
|
+
modal: c,
|
|
44
|
+
children: n
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
x.displayName = v;
|
|
49
|
+
var A = "DialogTrigger", J = s.forwardRef(
|
|
50
|
+
(e, o) => {
|
|
51
|
+
const { __scopeDialog: n, ...a } = e, r = u(A, n), t = _(o, r.triggerRef);
|
|
52
|
+
return /* @__PURE__ */ i(
|
|
53
|
+
m.button,
|
|
54
|
+
{
|
|
55
|
+
type: "button",
|
|
56
|
+
"aria-haspopup": "dialog",
|
|
57
|
+
"aria-expanded": r.open,
|
|
58
|
+
"aria-controls": r.contentId,
|
|
59
|
+
"data-state": N(r.open),
|
|
60
|
+
...a,
|
|
61
|
+
ref: t,
|
|
62
|
+
onClick: p(e.onClick, r.onOpenToggle)
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
J.displayName = A;
|
|
68
|
+
var E = "DialogPortal", [Q, b] = I(E, {
|
|
69
|
+
forceMount: void 0
|
|
70
|
+
}), T = (e) => {
|
|
71
|
+
const { __scopeDialog: o, forceMount: n, children: a, container: r } = e, t = u(E, o);
|
|
72
|
+
return /* @__PURE__ */ i(Q, { scope: o, forceMount: n, children: s.Children.map(a, (c) => /* @__PURE__ */ i(h, { present: n || t.open, children: /* @__PURE__ */ i(q, { asChild: !0, container: r, children: c }) })) });
|
|
73
|
+
};
|
|
74
|
+
T.displayName = E;
|
|
75
|
+
var D = "DialogOverlay", M = s.forwardRef(
|
|
76
|
+
(e, o) => {
|
|
77
|
+
const n = b(D, e.__scopeDialog), { forceMount: a = n.forceMount, ...r } = e, t = u(D, e.__scopeDialog);
|
|
78
|
+
return t.modal ? /* @__PURE__ */ i(h, { present: a || t.open, children: /* @__PURE__ */ i(ee, { ...r, ref: o }) }) : null;
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
M.displayName = D;
|
|
82
|
+
var X = Z("DialogOverlay.RemoveScroll"), ee = s.forwardRef(
|
|
83
|
+
(e, o) => {
|
|
84
|
+
const { __scopeDialog: n, ...a } = e, r = u(D, n);
|
|
85
|
+
return (
|
|
86
|
+
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
87
|
+
// ie. when `Overlay` and `Content` are siblings
|
|
88
|
+
/* @__PURE__ */ i(U, { as: X, allowPinchZoom: !0, shards: [r.contentRef], children: /* @__PURE__ */ i(
|
|
89
|
+
m.div,
|
|
90
|
+
{
|
|
91
|
+
"data-state": N(r.open),
|
|
92
|
+
...a,
|
|
93
|
+
ref: o,
|
|
94
|
+
style: { pointerEvents: "auto", ...a.style }
|
|
95
|
+
}
|
|
96
|
+
) })
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
), f = "DialogContent", w = s.forwardRef(
|
|
100
|
+
(e, o) => {
|
|
101
|
+
const n = b(f, e.__scopeDialog), { forceMount: a = n.forceMount, ...r } = e, t = u(f, e.__scopeDialog);
|
|
102
|
+
return /* @__PURE__ */ i(h, { present: a || t.open, children: t.modal ? /* @__PURE__ */ i(te, { ...r, ref: o }) : /* @__PURE__ */ i(oe, { ...r, ref: o }) });
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
w.displayName = f;
|
|
106
|
+
var te = s.forwardRef(
|
|
107
|
+
(e, o) => {
|
|
108
|
+
const n = u(f, e.__scopeDialog), a = s.useRef(null), r = _(o, n.contentRef, a);
|
|
109
|
+
return s.useEffect(() => {
|
|
110
|
+
const t = a.current;
|
|
111
|
+
if (t) return Y(t);
|
|
112
|
+
}, []), /* @__PURE__ */ i(
|
|
113
|
+
F,
|
|
114
|
+
{
|
|
115
|
+
...e,
|
|
116
|
+
ref: r,
|
|
117
|
+
trapFocus: n.open,
|
|
118
|
+
disableOutsidePointerEvents: !0,
|
|
119
|
+
onCloseAutoFocus: p(e.onCloseAutoFocus, (t) => {
|
|
120
|
+
var c;
|
|
121
|
+
t.preventDefault(), (c = n.triggerRef.current) == null || c.focus();
|
|
122
|
+
}),
|
|
123
|
+
onPointerDownOutside: p(e.onPointerDownOutside, (t) => {
|
|
124
|
+
const c = t.detail.originalEvent, l = c.button === 0 && c.ctrlKey === !0;
|
|
125
|
+
(c.button === 2 || l) && t.preventDefault();
|
|
126
|
+
}),
|
|
127
|
+
onFocusOutside: p(
|
|
128
|
+
e.onFocusOutside,
|
|
129
|
+
(t) => t.preventDefault()
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
), oe = s.forwardRef(
|
|
135
|
+
(e, o) => {
|
|
136
|
+
const n = u(f, e.__scopeDialog), a = s.useRef(!1), r = s.useRef(!1);
|
|
137
|
+
return /* @__PURE__ */ i(
|
|
138
|
+
F,
|
|
139
|
+
{
|
|
140
|
+
...e,
|
|
141
|
+
ref: o,
|
|
142
|
+
trapFocus: !1,
|
|
143
|
+
disableOutsidePointerEvents: !1,
|
|
144
|
+
onCloseAutoFocus: (t) => {
|
|
145
|
+
var c, l;
|
|
146
|
+
(c = e.onCloseAutoFocus) == null || c.call(e, t), t.defaultPrevented || (a.current || (l = n.triggerRef.current) == null || l.focus(), t.preventDefault()), a.current = !1, r.current = !1;
|
|
147
|
+
},
|
|
148
|
+
onInteractOutside: (t) => {
|
|
149
|
+
var d, g;
|
|
150
|
+
(d = e.onInteractOutside) == null || d.call(e, t), t.defaultPrevented || (a.current = !0, t.detail.originalEvent.type === "pointerdown" && (r.current = !0));
|
|
151
|
+
const c = t.target;
|
|
152
|
+
((g = n.triggerRef.current) == null ? void 0 : g.contains(c)) && t.preventDefault(), t.detail.originalEvent.type === "focusin" && r.current && t.preventDefault();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
), F = s.forwardRef(
|
|
158
|
+
(e, o) => {
|
|
159
|
+
const { __scopeDialog: n, trapFocus: a, onOpenAutoFocus: r, onCloseAutoFocus: t, ...c } = e, l = u(f, n), d = s.useRef(null), g = _(o, d);
|
|
160
|
+
return K(), /* @__PURE__ */ P(O, { children: [
|
|
161
|
+
/* @__PURE__ */ i(
|
|
162
|
+
V,
|
|
163
|
+
{
|
|
164
|
+
asChild: !0,
|
|
165
|
+
loop: !0,
|
|
166
|
+
trapped: a,
|
|
167
|
+
onMountAutoFocus: r,
|
|
168
|
+
onUnmountAutoFocus: t,
|
|
169
|
+
children: /* @__PURE__ */ i(
|
|
170
|
+
H,
|
|
171
|
+
{
|
|
172
|
+
role: "dialog",
|
|
173
|
+
id: l.contentId,
|
|
174
|
+
"aria-describedby": l.descriptionId,
|
|
175
|
+
"aria-labelledby": l.titleId,
|
|
176
|
+
"data-state": N(l.open),
|
|
177
|
+
...c,
|
|
178
|
+
ref: g,
|
|
179
|
+
onDismiss: () => l.onOpenChange(!1)
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
}
|
|
183
|
+
),
|
|
184
|
+
/* @__PURE__ */ P(O, { children: [
|
|
185
|
+
/* @__PURE__ */ i(ie, { titleId: l.titleId }),
|
|
186
|
+
/* @__PURE__ */ i(ce, { contentRef: d, descriptionId: l.descriptionId })
|
|
187
|
+
] })
|
|
188
|
+
] });
|
|
189
|
+
}
|
|
190
|
+
), y = "DialogTitle", re = s.forwardRef(
|
|
191
|
+
(e, o) => {
|
|
192
|
+
const { __scopeDialog: n, ...a } = e, r = u(y, n);
|
|
193
|
+
return /* @__PURE__ */ i(m.h2, { id: r.titleId, ...a, ref: o });
|
|
194
|
+
}
|
|
195
|
+
);
|
|
196
|
+
re.displayName = y;
|
|
197
|
+
var S = "DialogDescription", ne = s.forwardRef(
|
|
198
|
+
(e, o) => {
|
|
199
|
+
const { __scopeDialog: n, ...a } = e, r = u(S, n);
|
|
200
|
+
return /* @__PURE__ */ i(m.p, { id: r.descriptionId, ...a, ref: o });
|
|
201
|
+
}
|
|
202
|
+
);
|
|
203
|
+
ne.displayName = S;
|
|
204
|
+
var W = "DialogClose", ae = s.forwardRef(
|
|
205
|
+
(e, o) => {
|
|
206
|
+
const { __scopeDialog: n, ...a } = e, r = u(W, n);
|
|
207
|
+
return /* @__PURE__ */ i(
|
|
208
|
+
m.button,
|
|
209
|
+
{
|
|
210
|
+
type: "button",
|
|
211
|
+
...a,
|
|
212
|
+
ref: o,
|
|
213
|
+
onClick: p(e.onClick, () => r.onOpenChange(!1))
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
ae.displayName = W;
|
|
219
|
+
function N(e) {
|
|
220
|
+
return e ? "open" : "closed";
|
|
221
|
+
}
|
|
222
|
+
var k = "DialogTitleWarning", [Ne, G] = B(k, {
|
|
223
|
+
contentName: f,
|
|
224
|
+
titleName: y,
|
|
225
|
+
docsSlug: "dialog"
|
|
226
|
+
}), ie = ({ titleId: e }) => {
|
|
227
|
+
const o = G(k), n = `\`${o.contentName}\` requires a \`${o.titleName}\` for the component to be accessible for screen reader users.
|
|
228
|
+
|
|
229
|
+
If you want to hide the \`${o.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
230
|
+
|
|
231
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${o.docsSlug}`;
|
|
232
|
+
return s.useEffect(() => {
|
|
233
|
+
e && (document.getElementById(e) || console.error(n));
|
|
234
|
+
}, [n, e]), null;
|
|
235
|
+
}, se = "DialogDescriptionWarning", ce = ({ contentRef: e, descriptionId: o }) => {
|
|
236
|
+
const a = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${G(se).contentName}}.`;
|
|
237
|
+
return s.useEffect(() => {
|
|
238
|
+
var t;
|
|
239
|
+
const r = (t = e.current) == null ? void 0 : t.getAttribute("aria-describedby");
|
|
240
|
+
o && r && (document.getElementById(o) || console.warn(a));
|
|
241
|
+
}, [a, e, o]), null;
|
|
242
|
+
}, Pe = x, Oe = T, Ie = M, xe = w;
|
|
243
|
+
export {
|
|
244
|
+
xe as Content,
|
|
245
|
+
x as Dialog,
|
|
246
|
+
ae as DialogClose,
|
|
247
|
+
w as DialogContent,
|
|
248
|
+
ne as DialogDescription,
|
|
249
|
+
M as DialogOverlay,
|
|
250
|
+
T as DialogPortal,
|
|
251
|
+
re as DialogTitle,
|
|
252
|
+
J as DialogTrigger,
|
|
253
|
+
Ie as Overlay,
|
|
254
|
+
Oe as Portal,
|
|
255
|
+
Pe as Root,
|
|
256
|
+
Ne as WarningProvider
|
|
257
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as n from "react";
|
|
2
|
+
import { composeEventHandlers as m } from "../../primitive/dist/index.js";
|
|
3
|
+
import { Primitive as g, dispatchDiscreteCustomEvent as k } from "../../react-primitive/dist/index.js";
|
|
4
|
+
import { useComposedRefs as R } from "../../react-compose-refs/dist/index.js";
|
|
5
|
+
import { useCallbackRef as w } from "../../react-use-callback-ref/dist/index.js";
|
|
6
|
+
import { useEscapeKeydown as U } from "../../react-use-escape-keydown/dist/index.js";
|
|
7
|
+
import { jsx as T } from "react/jsx-runtime";
|
|
8
|
+
var z = "DismissableLayer", y = "dismissableLayer.update", H = "dismissableLayer.pointerDownOutside", M = "dismissableLayer.focusOutside", L, B = n.createContext({
|
|
9
|
+
layers: /* @__PURE__ */ new Set(),
|
|
10
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
11
|
+
branches: /* @__PURE__ */ new Set()
|
|
12
|
+
}), j = n.forwardRef(
|
|
13
|
+
(r, e) => {
|
|
14
|
+
const {
|
|
15
|
+
disableOutsidePointerEvents: i = !1,
|
|
16
|
+
onEscapeKeyDown: o,
|
|
17
|
+
onPointerDownOutside: t,
|
|
18
|
+
onFocusOutside: a,
|
|
19
|
+
onInteractOutside: l,
|
|
20
|
+
onDismiss: d,
|
|
21
|
+
...v
|
|
22
|
+
} = r, c = n.useContext(B), [u, S] = n.useState(null), f = (u == null ? void 0 : u.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, F] = n.useState({}), W = R(e, (s) => S(s)), p = Array.from(c.layers), [A] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), N = p.indexOf(A), b = u ? p.indexOf(u) : -1, I = c.layersWithOutsidePointerEventsDisabled.size > 0, P = b >= N, _ = q((s) => {
|
|
23
|
+
const E = s.target, C = [...c.branches].some((h) => h.contains(E));
|
|
24
|
+
!P || C || (t == null || t(s), l == null || l(s), s.defaultPrevented || d == null || d());
|
|
25
|
+
}, f), D = G((s) => {
|
|
26
|
+
const E = s.target;
|
|
27
|
+
[...c.branches].some((h) => h.contains(E)) || (a == null || a(s), l == null || l(s), s.defaultPrevented || d == null || d());
|
|
28
|
+
}, f);
|
|
29
|
+
return U((s) => {
|
|
30
|
+
b === c.layers.size - 1 && (o == null || o(s), !s.defaultPrevented && d && (s.preventDefault(), d()));
|
|
31
|
+
}, f), n.useEffect(() => {
|
|
32
|
+
if (u)
|
|
33
|
+
return i && (c.layersWithOutsidePointerEventsDisabled.size === 0 && (L = f.body.style.pointerEvents, f.body.style.pointerEvents = "none"), c.layersWithOutsidePointerEventsDisabled.add(u)), c.layers.add(u), O(), () => {
|
|
34
|
+
i && c.layersWithOutsidePointerEventsDisabled.size === 1 && (f.body.style.pointerEvents = L);
|
|
35
|
+
};
|
|
36
|
+
}, [u, f, i, c]), n.useEffect(() => () => {
|
|
37
|
+
u && (c.layers.delete(u), c.layersWithOutsidePointerEventsDisabled.delete(u), O());
|
|
38
|
+
}, [u, c]), n.useEffect(() => {
|
|
39
|
+
const s = () => F({});
|
|
40
|
+
return document.addEventListener(y, s), () => document.removeEventListener(y, s);
|
|
41
|
+
}, []), /* @__PURE__ */ T(
|
|
42
|
+
g.div,
|
|
43
|
+
{
|
|
44
|
+
...v,
|
|
45
|
+
ref: W,
|
|
46
|
+
style: {
|
|
47
|
+
pointerEvents: I ? P ? "auto" : "none" : void 0,
|
|
48
|
+
...r.style
|
|
49
|
+
},
|
|
50
|
+
onFocusCapture: m(r.onFocusCapture, D.onFocusCapture),
|
|
51
|
+
onBlurCapture: m(r.onBlurCapture, D.onBlurCapture),
|
|
52
|
+
onPointerDownCapture: m(
|
|
53
|
+
r.onPointerDownCapture,
|
|
54
|
+
_.onPointerDownCapture
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
j.displayName = z;
|
|
61
|
+
var X = "DismissableLayerBranch", Y = n.forwardRef((r, e) => {
|
|
62
|
+
const i = n.useContext(B), o = n.useRef(null), t = R(e, o);
|
|
63
|
+
return n.useEffect(() => {
|
|
64
|
+
const a = o.current;
|
|
65
|
+
if (a)
|
|
66
|
+
return i.branches.add(a), () => {
|
|
67
|
+
i.branches.delete(a);
|
|
68
|
+
};
|
|
69
|
+
}, [i.branches]), /* @__PURE__ */ T(g.div, { ...r, ref: t });
|
|
70
|
+
});
|
|
71
|
+
Y.displayName = X;
|
|
72
|
+
function q(r, e = globalThis == null ? void 0 : globalThis.document) {
|
|
73
|
+
const i = w(r), o = n.useRef(!1), t = n.useRef(() => {
|
|
74
|
+
});
|
|
75
|
+
return n.useEffect(() => {
|
|
76
|
+
const a = (d) => {
|
|
77
|
+
if (d.target && !o.current) {
|
|
78
|
+
let v = function() {
|
|
79
|
+
x(
|
|
80
|
+
H,
|
|
81
|
+
i,
|
|
82
|
+
c,
|
|
83
|
+
{ discrete: !0 }
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
const c = { originalEvent: d };
|
|
87
|
+
d.pointerType === "touch" ? (e.removeEventListener("click", t.current), t.current = v, e.addEventListener("click", t.current, { once: !0 })) : v();
|
|
88
|
+
} else
|
|
89
|
+
e.removeEventListener("click", t.current);
|
|
90
|
+
o.current = !1;
|
|
91
|
+
}, l = window.setTimeout(() => {
|
|
92
|
+
e.addEventListener("pointerdown", a);
|
|
93
|
+
}, 0);
|
|
94
|
+
return () => {
|
|
95
|
+
window.clearTimeout(l), e.removeEventListener("pointerdown", a), e.removeEventListener("click", t.current);
|
|
96
|
+
};
|
|
97
|
+
}, [e, i]), {
|
|
98
|
+
// ensures we check React component tree (not just DOM tree)
|
|
99
|
+
onPointerDownCapture: () => o.current = !0
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function G(r, e = globalThis == null ? void 0 : globalThis.document) {
|
|
103
|
+
const i = w(r), o = n.useRef(!1);
|
|
104
|
+
return n.useEffect(() => {
|
|
105
|
+
const t = (a) => {
|
|
106
|
+
a.target && !o.current && x(M, i, { originalEvent: a }, {
|
|
107
|
+
discrete: !1
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
return e.addEventListener("focusin", t), () => e.removeEventListener("focusin", t);
|
|
111
|
+
}, [e, i]), {
|
|
112
|
+
onFocusCapture: () => o.current = !0,
|
|
113
|
+
onBlurCapture: () => o.current = !1
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function O() {
|
|
117
|
+
const r = new CustomEvent(y);
|
|
118
|
+
document.dispatchEvent(r);
|
|
119
|
+
}
|
|
120
|
+
function x(r, e, i, { discrete: o }) {
|
|
121
|
+
const t = i.originalEvent.target, a = new CustomEvent(r, { bubbles: !1, cancelable: !0, detail: i });
|
|
122
|
+
e && t.addEventListener(r, e, { once: !0 }), o ? k(t, a) : t.dispatchEvent(a);
|
|
123
|
+
}
|
|
124
|
+
export {
|
|
125
|
+
j as DismissableLayer,
|
|
126
|
+
Y as DismissableLayerBranch
|
|
127
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as r from "react";
|
|
2
|
+
var t = 0;
|
|
3
|
+
function a() {
|
|
4
|
+
r.useEffect(() => {
|
|
5
|
+
const e = document.querySelectorAll("[data-radix-focus-guard]");
|
|
6
|
+
return document.body.insertAdjacentElement("afterbegin", e[0] ?? n()), document.body.insertAdjacentElement("beforeend", e[1] ?? n()), t++, () => {
|
|
7
|
+
t === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((o) => o.remove()), t--;
|
|
8
|
+
};
|
|
9
|
+
}, []);
|
|
10
|
+
}
|
|
11
|
+
function n() {
|
|
12
|
+
const e = document.createElement("span");
|
|
13
|
+
return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.outline = "none", e.style.opacity = "0", e.style.position = "fixed", e.style.pointerEvents = "none", e;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
a as useFocusGuards
|
|
17
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import * as d from "react";
|
|
2
|
+
import { useComposedRefs as R } from "../../react-compose-refs/dist/index.js";
|
|
3
|
+
import { Primitive as M } from "../../react-primitive/dist/index.js";
|
|
4
|
+
import { useCallbackRef as y } from "../../react-use-callback-ref/dist/index.js";
|
|
5
|
+
import { jsx as _ } from "react/jsx-runtime";
|
|
6
|
+
var F = "focusScope.autoFocusOnMount", T = "focusScope.autoFocusOnUnmount", N = { bubbles: !1, cancelable: !0 }, K = "FocusScope", k = d.forwardRef((e, n) => {
|
|
7
|
+
const {
|
|
8
|
+
loop: t = !1,
|
|
9
|
+
trapped: u = !1,
|
|
10
|
+
onMountAutoFocus: p,
|
|
11
|
+
onUnmountAutoFocus: L,
|
|
12
|
+
...g
|
|
13
|
+
} = e, [o, U] = d.useState(null), E = y(p), v = y(L), b = d.useRef(null), A = R(n, (s) => U(s)), a = d.useRef({
|
|
14
|
+
paused: !1,
|
|
15
|
+
pause() {
|
|
16
|
+
this.paused = !0;
|
|
17
|
+
},
|
|
18
|
+
resume() {
|
|
19
|
+
this.paused = !1;
|
|
20
|
+
}
|
|
21
|
+
}).current;
|
|
22
|
+
d.useEffect(() => {
|
|
23
|
+
if (u) {
|
|
24
|
+
let s = function(i) {
|
|
25
|
+
if (a.paused || !o) return;
|
|
26
|
+
const c = i.target;
|
|
27
|
+
o.contains(c) ? b.current = c : f(b.current, { select: !0 });
|
|
28
|
+
}, l = function(i) {
|
|
29
|
+
if (a.paused || !o) return;
|
|
30
|
+
const c = i.relatedTarget;
|
|
31
|
+
c !== null && (o.contains(c) || f(b.current, { select: !0 }));
|
|
32
|
+
}, r = function(i) {
|
|
33
|
+
if (document.activeElement === document.body)
|
|
34
|
+
for (const h of i)
|
|
35
|
+
h.removedNodes.length > 0 && f(o);
|
|
36
|
+
};
|
|
37
|
+
document.addEventListener("focusin", s), document.addEventListener("focusout", l);
|
|
38
|
+
const m = new MutationObserver(r);
|
|
39
|
+
return o && m.observe(o, { childList: !0, subtree: !0 }), () => {
|
|
40
|
+
document.removeEventListener("focusin", s), document.removeEventListener("focusout", l), m.disconnect();
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}, [u, o, a.paused]), d.useEffect(() => {
|
|
44
|
+
if (o) {
|
|
45
|
+
S.add(a);
|
|
46
|
+
const s = document.activeElement;
|
|
47
|
+
if (!o.contains(s)) {
|
|
48
|
+
const r = new CustomEvent(F, N);
|
|
49
|
+
o.addEventListener(F, E), o.dispatchEvent(r), r.defaultPrevented || (w(W(I(o)), { select: !0 }), document.activeElement === s && f(o));
|
|
50
|
+
}
|
|
51
|
+
return () => {
|
|
52
|
+
o.removeEventListener(F, E), setTimeout(() => {
|
|
53
|
+
const r = new CustomEvent(T, N);
|
|
54
|
+
o.addEventListener(T, v), o.dispatchEvent(r), r.defaultPrevented || f(s ?? document.body, { select: !0 }), o.removeEventListener(T, v), S.remove(a);
|
|
55
|
+
}, 0);
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}, [o, E, v, a]);
|
|
59
|
+
const P = d.useCallback(
|
|
60
|
+
(s) => {
|
|
61
|
+
if (!t && !u || a.paused) return;
|
|
62
|
+
const l = s.key === "Tab" && !s.altKey && !s.ctrlKey && !s.metaKey, r = document.activeElement;
|
|
63
|
+
if (l && r) {
|
|
64
|
+
const m = s.currentTarget, [i, c] = x(m);
|
|
65
|
+
i && c ? !s.shiftKey && r === c ? (s.preventDefault(), t && f(i, { select: !0 })) : s.shiftKey && r === i && (s.preventDefault(), t && f(c, { select: !0 })) : r === m && s.preventDefault();
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
[t, u, a.paused]
|
|
69
|
+
);
|
|
70
|
+
return /* @__PURE__ */ _(M.div, { tabIndex: -1, ...g, ref: A, onKeyDown: P });
|
|
71
|
+
});
|
|
72
|
+
k.displayName = K;
|
|
73
|
+
function w(e, { select: n = !1 } = {}) {
|
|
74
|
+
const t = document.activeElement;
|
|
75
|
+
for (const u of e)
|
|
76
|
+
if (f(u, { select: n }), document.activeElement !== t) return;
|
|
77
|
+
}
|
|
78
|
+
function x(e) {
|
|
79
|
+
const n = I(e), t = O(n, e), u = O(n.reverse(), e);
|
|
80
|
+
return [t, u];
|
|
81
|
+
}
|
|
82
|
+
function I(e) {
|
|
83
|
+
const n = [], t = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
84
|
+
acceptNode: (u) => {
|
|
85
|
+
const p = u.tagName === "INPUT" && u.type === "hidden";
|
|
86
|
+
return u.disabled || u.hidden || p ? NodeFilter.FILTER_SKIP : u.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
for (; t.nextNode(); ) n.push(t.currentNode);
|
|
90
|
+
return n;
|
|
91
|
+
}
|
|
92
|
+
function O(e, n) {
|
|
93
|
+
for (const t of e)
|
|
94
|
+
if (!D(t, { upTo: n })) return t;
|
|
95
|
+
}
|
|
96
|
+
function D(e, { upTo: n }) {
|
|
97
|
+
if (getComputedStyle(e).visibility === "hidden") return !0;
|
|
98
|
+
for (; e; ) {
|
|
99
|
+
if (n !== void 0 && e === n) return !1;
|
|
100
|
+
if (getComputedStyle(e).display === "none") return !0;
|
|
101
|
+
e = e.parentElement;
|
|
102
|
+
}
|
|
103
|
+
return !1;
|
|
104
|
+
}
|
|
105
|
+
function H(e) {
|
|
106
|
+
return e instanceof HTMLInputElement && "select" in e;
|
|
107
|
+
}
|
|
108
|
+
function f(e, { select: n = !1 } = {}) {
|
|
109
|
+
if (e && e.focus) {
|
|
110
|
+
const t = document.activeElement;
|
|
111
|
+
e.focus({ preventScroll: !0 }), e !== t && H(e) && n && e.select();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
var S = V();
|
|
115
|
+
function V() {
|
|
116
|
+
let e = [];
|
|
117
|
+
return {
|
|
118
|
+
add(n) {
|
|
119
|
+
const t = e[0];
|
|
120
|
+
n !== t && (t == null || t.pause()), e = C(e, n), e.unshift(n);
|
|
121
|
+
},
|
|
122
|
+
remove(n) {
|
|
123
|
+
var t;
|
|
124
|
+
e = C(e, n), (t = e[0]) == null || t.resume();
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function C(e, n) {
|
|
129
|
+
const t = [...e], u = t.indexOf(n);
|
|
130
|
+
return u !== -1 && t.splice(u, 1), t;
|
|
131
|
+
}
|
|
132
|
+
function W(e) {
|
|
133
|
+
return e.filter((n) => n.tagName !== "A");
|
|
134
|
+
}
|
|
135
|
+
export {
|
|
136
|
+
k as FocusScope
|
|
137
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as o from "react";
|
|
2
|
+
import { useLayoutEffect as a } from "../../react-use-layout-effect/dist/index.js";
|
|
3
|
+
var s = o[" useId ".trim().toString()] || (() => {
|
|
4
|
+
}), f = 0;
|
|
5
|
+
function i(t) {
|
|
6
|
+
const [e, r] = o.useState(s());
|
|
7
|
+
return a(() => {
|
|
8
|
+
r((u) => u ?? String(f++));
|
|
9
|
+
}, [t]), t || (e ? `radix-${e}` : "");
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
i as useId
|
|
13
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as r from "react";
|
|
2
|
+
import s from "react-dom";
|
|
3
|
+
import { Primitive as c } from "../../react-primitive/dist/index.js";
|
|
4
|
+
import { useLayoutEffect as u } from "../../react-use-layout-effect/dist/index.js";
|
|
5
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
6
|
+
var p = "Portal", d = r.forwardRef((e, a) => {
|
|
7
|
+
var o;
|
|
8
|
+
const { container: f, ...i } = e, [m, n] = r.useState(!1);
|
|
9
|
+
u(() => n(!0), []);
|
|
10
|
+
const t = f || m && ((o = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : o.body);
|
|
11
|
+
return t ? s.createPortal(/* @__PURE__ */ l(c.div, { ...i, ref: a }), t) : null;
|
|
12
|
+
});
|
|
13
|
+
d.displayName = p;
|
|
14
|
+
export {
|
|
15
|
+
d as Portal
|
|
16
|
+
};
|