zudoku 0.3.0-dev.55 → 0.3.0-dev.57
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/app/demo.js +6 -1
- package/dist/app/demo.js.map +1 -1
- package/dist/app/entry.client.d.ts +1 -1
- package/dist/app/entry.client.js +1 -1
- package/dist/app/entry.client.js.map +1 -1
- package/dist/app/entry.server.d.ts +1 -1
- package/dist/app/entry.server.js +1 -1
- package/dist/app/entry.server.js.map +1 -1
- package/dist/app/main.d.ts +1 -1
- package/dist/app/main.js +9 -2
- package/dist/app/main.js.map +1 -1
- package/dist/app/standalone.js +6 -1
- package/dist/app/standalone.js.map +1 -1
- package/dist/config/validators/validate.d.ts +77 -17
- package/dist/config/validators/validate.js +7 -1
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/lib/components/DeveloperHint.d.ts +5 -0
- package/dist/lib/components/DeveloperHint.js +10 -0
- package/dist/lib/components/DeveloperHint.js.map +1 -0
- package/dist/lib/components/Header.js +1 -1
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/components/NotFoundPage.js +2 -2
- package/dist/lib/components/NotFoundPage.js.map +1 -1
- package/dist/lib/components/navigation/SideNavigationCategory.js +2 -2
- package/dist/lib/components/navigation/SideNavigationCategory.js.map +1 -1
- package/dist/lib/core/DevPortalContext.d.ts +8 -1
- package/dist/lib/core/DevPortalContext.js.map +1 -1
- package/dist/lib/oas/graphql/index.js +5 -3
- package/dist/lib/oas/graphql/index.js.map +1 -1
- package/dist/lib/plugins/api-keys/ProtectedRoute.d.ts +1 -0
- package/dist/lib/plugins/api-keys/ProtectedRoute.js +14 -0
- package/dist/lib/plugins/api-keys/ProtectedRoute.js.map +1 -0
- package/dist/lib/plugins/api-keys/index.js +2 -12
- package/dist/lib/plugins/api-keys/index.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +4 -3
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/StaggeredRender.d.ts +5 -0
- package/dist/lib/plugins/openapi/StaggeredRender.js +13 -0
- package/dist/lib/plugins/openapi/StaggeredRender.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +3 -3
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js.map +1 -1
- package/dist/vite/plugin-custom-css.js +2 -3
- package/dist/vite/plugin-custom-css.js.map +1 -1
- package/lib/AnchorLink-GNsUeGSX.js +705 -0
- package/lib/{AnchorLink-BaXHjhF-.js.map → AnchorLink-GNsUeGSX.js.map} +1 -1
- package/lib/Button-DpHMZvVs.js +4571 -0
- package/lib/Button-DpHMZvVs.js.map +1 -0
- package/lib/DevPortalProvider-Do9oJqme.js +1081 -0
- package/lib/{DevPortalProvider-GjdO0Xr-.js.map → DevPortalProvider-Do9oJqme.js.map} +1 -1
- package/lib/Markdown-DtLFdxD1.js +15031 -0
- package/lib/Markdown-DtLFdxD1.js.map +1 -0
- package/lib/MdxPage-CbwYRKf5.js +190 -0
- package/lib/{MdxPage-Dlujuj-J.js.map → MdxPage-CbwYRKf5.js.map} +1 -1
- package/lib/OperationList-DypxLtSC.js +5578 -0
- package/lib/OperationList-DypxLtSC.js.map +1 -0
- package/lib/Route-C1LyvITr.js +13 -0
- package/lib/{Route-CR6TEwVC.js.map → Route-C1LyvITr.js.map} +1 -1
- package/lib/Spinner-Bhbs5aPI.js +182 -0
- package/lib/Spinner-Bhbs5aPI.js.map +1 -0
- package/lib/_commonjsHelpers-BVfed4GL.js +29 -0
- package/lib/_commonjsHelpers-BVfed4GL.js.map +1 -0
- package/lib/assets/index-BPdJm2ty.js +4765 -0
- package/lib/assets/{index-CpIig0AX.js.map → index-BPdJm2ty.js.map} +1 -1
- package/lib/assets/worker-BWwCA-wk.js +14900 -0
- package/lib/assets/{worker-B5k2aBV9.js.map → worker-BWwCA-wk.js.map} +1 -1
- package/lib/context-_fYfJFgk.js +14 -0
- package/lib/{context-BoN_3uxi.js.map → context-_fYfJFgk.js.map} +1 -1
- package/lib/hook-Biq3zYel.js +92 -0
- package/lib/hook-Biq3zYel.js.map +1 -0
- package/lib/{index-Dih8IAqw.js → index-Bg82-bqR.js} +83 -103
- package/lib/{index-Dih8IAqw.js.map → index-Bg82-bqR.js.map} +1 -1
- package/lib/index-gsAuUwQh.js +418 -0
- package/lib/index-gsAuUwQh.js.map +1 -0
- package/lib/index-pI9JkN46.js +4765 -0
- package/lib/{index-Bn03IPZt.js.map → index-pI9JkN46.js.map} +1 -1
- package/lib/jsx-runtime-CJZJivg2.js +1526 -0
- package/lib/{jsx-runtime-DvZ6OKMM.js.map → jsx-runtime-CJZJivg2.js.map} +1 -1
- package/lib/prism-bash.min-DadFsM4Z.js +7 -0
- package/lib/{prism-bash.min-BtBk0onv.js.map → prism-bash.min-DadFsM4Z.js.map} +1 -1
- package/lib/prism-csharp.min-Yizuc34Y.js +35 -0
- package/lib/{prism-csharp.min-Cv7D49bv.js.map → prism-csharp.min-Yizuc34Y.js.map} +1 -1
- package/lib/prism-java.min-d5iT_mOd.js +7 -0
- package/lib/{prism-java.min-tNK-JX6x.js.map → prism-java.min-d5iT_mOd.js.map} +1 -1
- package/lib/prism-json.min-B1GJqK1k.js +2 -0
- package/lib/{prism-json.min-Cdtv-CME.js.map → prism-json.min-B1GJqK1k.js.map} +1 -1
- package/lib/prism-markup-templating-DZrrEs0A.js +62 -0
- package/lib/{prism-markup-templating-iotg2sCU.js.map → prism-markup-templating-DZrrEs0A.js.map} +1 -1
- package/lib/prism-objectivec.min-BXSWqpJJ.js +2 -0
- package/lib/{prism-objectivec.min-CY4WGixz.js.map → prism-objectivec.min-BXSWqpJJ.js.map} +1 -1
- package/lib/prism-php.min-o7FpoMP_.js +11 -0
- package/lib/{prism-php.min-T6sIVgED.js.map → prism-php.min-o7FpoMP_.js.map} +1 -1
- package/lib/prism-ruby.min-C7LwcKyz.js +10 -0
- package/lib/{prism-ruby.min-B-2KAa4y.js.map → prism-ruby.min-C7LwcKyz.js.map} +1 -1
- package/lib/router-CBw2vqJE.js +2973 -0
- package/lib/{router-ButO1QyY.js.map → router-CBw2vqJE.js.map} +1 -1
- package/lib/slugify-CiPVjteN.js +28 -0
- package/lib/{slugify-CmS97Vy8.js.map → slugify-CiPVjteN.js.map} +1 -1
- package/lib/state-DKdaQzvh.js +288 -0
- package/lib/{state-CmGfNKhR.js.map → state-DKdaQzvh.js.map} +1 -1
- package/lib/urql-DMlBWUKL.js +1592 -0
- package/lib/{urql-DtVKPBx_.js.map → urql-DMlBWUKL.js.map} +1 -1
- package/lib/util-_jwUlTBU.js +41 -0
- package/lib/{util-B5KX4h4M.js.map → util-_jwUlTBU.js.map} +1 -1
- package/lib/zudoku.auth-auth0.js +18 -24
- package/lib/zudoku.auth-auth0.js.map +1 -1
- package/lib/zudoku.auth-clerk.js +34 -43
- package/lib/zudoku.auth-clerk.js.map +1 -1
- package/lib/zudoku.auth-openid.js +734 -1121
- package/lib/zudoku.auth-openid.js.map +1 -1
- package/lib/zudoku.components.js +830 -1076
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.openapi-worker.js +9689 -13781
- package/lib/zudoku.openapi-worker.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +171 -208
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-markdown.js +33 -41
- package/lib/zudoku.plugin-markdown.js.map +1 -1
- package/lib/zudoku.plugin-openapi.js +6 -6
- package/lib/zudoku.plugin-redirect.js +8 -10
- package/lib/zudoku.plugin-redirect.js.map +1 -1
- package/package.json +2 -2
- package/src/app/demo.tsx +6 -1
- package/src/app/entry.client.tsx +1 -1
- package/src/app/entry.server.tsx +1 -1
- package/src/app/main.tsx +11 -2
- package/src/app/standalone.tsx +6 -1
- package/src/lib/components/DeveloperHint.tsx +25 -0
- package/src/lib/components/Header.tsx +6 -1
- package/src/lib/components/NotFoundPage.tsx +8 -14
- package/src/lib/components/navigation/SideNavigationCategory.tsx +3 -3
- package/src/lib/core/DevPortalContext.ts +8 -1
- package/src/lib/oas/graphql/index.ts +7 -3
- package/src/lib/plugins/api-keys/ProtectedRoute.tsx +29 -0
- package/src/lib/plugins/api-keys/index.tsx +2 -21
- package/src/lib/plugins/openapi/OperationList.tsx +14 -14
- package/src/lib/plugins/openapi/StaggeredRender.tsx +17 -0
- package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +3 -5
- package/lib/AnchorLink-BaXHjhF-.js +0 -989
- package/lib/Combination-BfufJFkX.js +0 -1365
- package/lib/Combination-BfufJFkX.js.map +0 -1
- package/lib/DevPortalProvider-GjdO0Xr-.js +0 -1610
- package/lib/Markdown-B8nPVql1.js +0 -19708
- package/lib/Markdown-B8nPVql1.js.map +0 -1
- package/lib/MdxPage-Dlujuj-J.js +0 -223
- package/lib/OperationList-krPgt6sE.js +0 -8041
- package/lib/OperationList-krPgt6sE.js.map +0 -1
- package/lib/Playground-DOHxca0P.js +0 -539
- package/lib/Playground-DOHxca0P.js.map +0 -1
- package/lib/Route-CR6TEwVC.js +0 -13
- package/lib/Select-Boi_pe3L.js +0 -5298
- package/lib/Select-Boi_pe3L.js.map +0 -1
- package/lib/Spinner-oU0QJmi_.js +0 -16
- package/lib/Spinner-oU0QJmi_.js.map +0 -1
- package/lib/_commonjsHelpers-BxmBWJD2.js +0 -34
- package/lib/_commonjsHelpers-BxmBWJD2.js.map +0 -1
- package/lib/assets/index-CpIig0AX.js +0 -6341
- package/lib/assets/worker-B5k2aBV9.js +0 -18921
- package/lib/context-BoN_3uxi.js +0 -17
- package/lib/hook-CIuFuyBT.js +0 -90
- package/lib/hook-CIuFuyBT.js.map +0 -1
- package/lib/index-BL1P4Gqq.js +0 -280
- package/lib/index-BL1P4Gqq.js.map +0 -1
- package/lib/index-Bn03IPZt.js +0 -6341
- package/lib/index-FprhHF51.js +0 -253
- package/lib/index-FprhHF51.js.map +0 -1
- package/lib/jsx-runtime-DvZ6OKMM.js +0 -2110
- package/lib/mutation-DWY9x2Uc.js +0 -250
- package/lib/mutation-DWY9x2Uc.js.map +0 -1
- package/lib/prism-bash.min-BtBk0onv.js +0 -7
- package/lib/prism-csharp.min-Cv7D49bv.js +0 -30
- package/lib/prism-java.min-tNK-JX6x.js +0 -7
- package/lib/prism-json.min-Cdtv-CME.js +0 -2
- package/lib/prism-markup-templating-iotg2sCU.js +0 -94
- package/lib/prism-objectivec.min-CY4WGixz.js +0 -2
- package/lib/prism-php.min-T6sIVgED.js +0 -11
- package/lib/prism-ruby.min-B-2KAa4y.js +0 -8
- package/lib/router-ButO1QyY.js +0 -4062
- package/lib/slugify-CmS97Vy8.js +0 -50
- package/lib/state-CmGfNKhR.js +0 -436
- package/lib/urql-DtVKPBx_.js +0 -2567
- package/lib/util-B5KX4h4M.js +0 -55
|
@@ -1,1365 +0,0 @@
|
|
|
1
|
-
import { j as jsxRuntimeExports } from "./jsx-runtime-DvZ6OKMM.js";
|
|
2
|
-
import { S as Slot, c as createContextScope, u as useComposedRefs, b as useCallbackRef$1, P as Primitive, d as composeEventHandlers, h as dispatchDiscreteCustomEvent, g as useLayoutEffect2 } from "./index-BL1P4Gqq.js";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import React__default, { useState } from "react";
|
|
5
|
-
import { f as cva, e as cn } from "./Markdown-B8nPVql1.js";
|
|
6
|
-
import ReactDOM__default from "react-dom";
|
|
7
|
-
const buttonVariants = cva(
|
|
8
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
9
|
-
{
|
|
10
|
-
variants: {
|
|
11
|
-
variant: {
|
|
12
|
-
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
13
|
-
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
|
14
|
-
outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
15
|
-
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
16
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
17
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
18
|
-
},
|
|
19
|
-
size: {
|
|
20
|
-
default: "h-9 px-4 py-2",
|
|
21
|
-
sm: "h-8 rounded-md px-3 text-xs",
|
|
22
|
-
lg: "h-10 rounded-md px-8",
|
|
23
|
-
icon: "h-9 w-9"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
defaultVariants: {
|
|
27
|
-
variant: "default",
|
|
28
|
-
size: "default"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
const Button = React.forwardRef(
|
|
33
|
-
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
34
|
-
const Comp = asChild ? Slot : "button";
|
|
35
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
36
|
-
Comp,
|
|
37
|
-
{
|
|
38
|
-
className: cn(buttonVariants({ variant, size, className })),
|
|
39
|
-
ref,
|
|
40
|
-
...props
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
|
-
Button.displayName = "Button";
|
|
46
|
-
function createCollection(name) {
|
|
47
|
-
const PROVIDER_NAME = name + "CollectionProvider";
|
|
48
|
-
const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);
|
|
49
|
-
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
|
|
50
|
-
PROVIDER_NAME,
|
|
51
|
-
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
52
|
-
);
|
|
53
|
-
const CollectionProvider = (props) => {
|
|
54
|
-
const { scope, children } = props;
|
|
55
|
-
const ref = React__default.useRef(null);
|
|
56
|
-
const itemMap = React__default.useRef(/* @__PURE__ */ new Map()).current;
|
|
57
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
58
|
-
};
|
|
59
|
-
CollectionProvider.displayName = PROVIDER_NAME;
|
|
60
|
-
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
61
|
-
const CollectionSlot = React__default.forwardRef(
|
|
62
|
-
(props, forwardedRef) => {
|
|
63
|
-
const { scope, children } = props;
|
|
64
|
-
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
65
|
-
const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
|
|
66
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Slot, { ref: composedRefs, children });
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
70
|
-
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
71
|
-
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
72
|
-
const CollectionItemSlot = React__default.forwardRef(
|
|
73
|
-
(props, forwardedRef) => {
|
|
74
|
-
const { scope, children, ...itemData } = props;
|
|
75
|
-
const ref = React__default.useRef(null);
|
|
76
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
77
|
-
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
78
|
-
React__default.useEffect(() => {
|
|
79
|
-
context.itemMap.set(ref, { ref, ...itemData });
|
|
80
|
-
return () => void context.itemMap.delete(ref);
|
|
81
|
-
});
|
|
82
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Slot, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
|
|
83
|
-
}
|
|
84
|
-
);
|
|
85
|
-
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
86
|
-
function useCollection(scope) {
|
|
87
|
-
const context = useCollectionContext(name + "CollectionConsumer", scope);
|
|
88
|
-
const getItems = React__default.useCallback(() => {
|
|
89
|
-
const collectionNode = context.collectionRef.current;
|
|
90
|
-
if (!collectionNode) return [];
|
|
91
|
-
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
92
|
-
const items = Array.from(context.itemMap.values());
|
|
93
|
-
const orderedItems = items.sort(
|
|
94
|
-
(a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
|
|
95
|
-
);
|
|
96
|
-
return orderedItems;
|
|
97
|
-
}, [context.collectionRef, context.itemMap]);
|
|
98
|
-
return getItems;
|
|
99
|
-
}
|
|
100
|
-
return [
|
|
101
|
-
{ Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
|
|
102
|
-
useCollection,
|
|
103
|
-
createCollectionScope
|
|
104
|
-
];
|
|
105
|
-
}
|
|
106
|
-
var DirectionContext = React.createContext(void 0);
|
|
107
|
-
function useDirection(localDir) {
|
|
108
|
-
const globalDir = React.useContext(DirectionContext);
|
|
109
|
-
return localDir || globalDir || "ltr";
|
|
110
|
-
}
|
|
111
|
-
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
112
|
-
const onEscapeKeyDown = useCallbackRef$1(onEscapeKeyDownProp);
|
|
113
|
-
React.useEffect(() => {
|
|
114
|
-
const handleKeyDown = (event) => {
|
|
115
|
-
if (event.key === "Escape") {
|
|
116
|
-
onEscapeKeyDown(event);
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
120
|
-
return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
121
|
-
}, [onEscapeKeyDown, ownerDocument]);
|
|
122
|
-
}
|
|
123
|
-
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
124
|
-
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
125
|
-
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
126
|
-
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
127
|
-
var originalBodyPointerEvents;
|
|
128
|
-
var DismissableLayerContext = React.createContext({
|
|
129
|
-
layers: /* @__PURE__ */ new Set(),
|
|
130
|
-
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
131
|
-
branches: /* @__PURE__ */ new Set()
|
|
132
|
-
});
|
|
133
|
-
var DismissableLayer = React.forwardRef(
|
|
134
|
-
(props, forwardedRef) => {
|
|
135
|
-
const {
|
|
136
|
-
disableOutsidePointerEvents = false,
|
|
137
|
-
onEscapeKeyDown,
|
|
138
|
-
onPointerDownOutside,
|
|
139
|
-
onFocusOutside,
|
|
140
|
-
onInteractOutside,
|
|
141
|
-
onDismiss,
|
|
142
|
-
...layerProps
|
|
143
|
-
} = props;
|
|
144
|
-
const context = React.useContext(DismissableLayerContext);
|
|
145
|
-
const [node, setNode] = React.useState(null);
|
|
146
|
-
const ownerDocument = (node == null ? void 0 : node.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document);
|
|
147
|
-
const [, force] = React.useState({});
|
|
148
|
-
const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
|
|
149
|
-
const layers = Array.from(context.layers);
|
|
150
|
-
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
|
151
|
-
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
|
152
|
-
const index = node ? layers.indexOf(node) : -1;
|
|
153
|
-
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
154
|
-
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
155
|
-
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
156
|
-
const target = event.target;
|
|
157
|
-
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
158
|
-
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
159
|
-
onPointerDownOutside == null ? void 0 : onPointerDownOutside(event);
|
|
160
|
-
onInteractOutside == null ? void 0 : onInteractOutside(event);
|
|
161
|
-
if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
|
|
162
|
-
}, ownerDocument);
|
|
163
|
-
const focusOutside = useFocusOutside((event) => {
|
|
164
|
-
const target = event.target;
|
|
165
|
-
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
166
|
-
if (isFocusInBranch) return;
|
|
167
|
-
onFocusOutside == null ? void 0 : onFocusOutside(event);
|
|
168
|
-
onInteractOutside == null ? void 0 : onInteractOutside(event);
|
|
169
|
-
if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
|
|
170
|
-
}, ownerDocument);
|
|
171
|
-
useEscapeKeydown((event) => {
|
|
172
|
-
const isHighestLayer = index === context.layers.size - 1;
|
|
173
|
-
if (!isHighestLayer) return;
|
|
174
|
-
onEscapeKeyDown == null ? void 0 : onEscapeKeyDown(event);
|
|
175
|
-
if (!event.defaultPrevented && onDismiss) {
|
|
176
|
-
event.preventDefault();
|
|
177
|
-
onDismiss();
|
|
178
|
-
}
|
|
179
|
-
}, ownerDocument);
|
|
180
|
-
React.useEffect(() => {
|
|
181
|
-
if (!node) return;
|
|
182
|
-
if (disableOutsidePointerEvents) {
|
|
183
|
-
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
184
|
-
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
185
|
-
ownerDocument.body.style.pointerEvents = "none";
|
|
186
|
-
}
|
|
187
|
-
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
188
|
-
}
|
|
189
|
-
context.layers.add(node);
|
|
190
|
-
dispatchUpdate();
|
|
191
|
-
return () => {
|
|
192
|
-
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
193
|
-
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
197
|
-
React.useEffect(() => {
|
|
198
|
-
return () => {
|
|
199
|
-
if (!node) return;
|
|
200
|
-
context.layers.delete(node);
|
|
201
|
-
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
202
|
-
dispatchUpdate();
|
|
203
|
-
};
|
|
204
|
-
}, [node, context]);
|
|
205
|
-
React.useEffect(() => {
|
|
206
|
-
const handleUpdate = () => force({});
|
|
207
|
-
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
208
|
-
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
209
|
-
}, []);
|
|
210
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
211
|
-
Primitive.div,
|
|
212
|
-
{
|
|
213
|
-
...layerProps,
|
|
214
|
-
ref: composedRefs,
|
|
215
|
-
style: {
|
|
216
|
-
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
217
|
-
...props.style
|
|
218
|
-
},
|
|
219
|
-
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
220
|
-
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
221
|
-
onPointerDownCapture: composeEventHandlers(
|
|
222
|
-
props.onPointerDownCapture,
|
|
223
|
-
pointerDownOutside.onPointerDownCapture
|
|
224
|
-
)
|
|
225
|
-
}
|
|
226
|
-
);
|
|
227
|
-
}
|
|
228
|
-
);
|
|
229
|
-
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
230
|
-
var BRANCH_NAME = "DismissableLayerBranch";
|
|
231
|
-
var DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {
|
|
232
|
-
const context = React.useContext(DismissableLayerContext);
|
|
233
|
-
const ref = React.useRef(null);
|
|
234
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
235
|
-
React.useEffect(() => {
|
|
236
|
-
const node = ref.current;
|
|
237
|
-
if (node) {
|
|
238
|
-
context.branches.add(node);
|
|
239
|
-
return () => {
|
|
240
|
-
context.branches.delete(node);
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
}, [context.branches]);
|
|
244
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
245
|
-
});
|
|
246
|
-
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
247
|
-
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
248
|
-
const handlePointerDownOutside = useCallbackRef$1(onPointerDownOutside);
|
|
249
|
-
const isPointerInsideReactTreeRef = React.useRef(false);
|
|
250
|
-
const handleClickRef = React.useRef(() => {
|
|
251
|
-
});
|
|
252
|
-
React.useEffect(() => {
|
|
253
|
-
const handlePointerDown = (event) => {
|
|
254
|
-
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
255
|
-
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
256
|
-
handleAndDispatchCustomEvent(
|
|
257
|
-
POINTER_DOWN_OUTSIDE,
|
|
258
|
-
handlePointerDownOutside,
|
|
259
|
-
eventDetail,
|
|
260
|
-
{ discrete: true }
|
|
261
|
-
);
|
|
262
|
-
};
|
|
263
|
-
const eventDetail = { originalEvent: event };
|
|
264
|
-
if (event.pointerType === "touch") {
|
|
265
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
266
|
-
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
267
|
-
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
268
|
-
} else {
|
|
269
|
-
handleAndDispatchPointerDownOutsideEvent2();
|
|
270
|
-
}
|
|
271
|
-
} else {
|
|
272
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
273
|
-
}
|
|
274
|
-
isPointerInsideReactTreeRef.current = false;
|
|
275
|
-
};
|
|
276
|
-
const timerId = window.setTimeout(() => {
|
|
277
|
-
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
278
|
-
}, 0);
|
|
279
|
-
return () => {
|
|
280
|
-
window.clearTimeout(timerId);
|
|
281
|
-
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
282
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
283
|
-
};
|
|
284
|
-
}, [ownerDocument, handlePointerDownOutside]);
|
|
285
|
-
return {
|
|
286
|
-
// ensures we check React component tree (not just DOM tree)
|
|
287
|
-
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
function useFocusOutside(onFocusOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
291
|
-
const handleFocusOutside = useCallbackRef$1(onFocusOutside);
|
|
292
|
-
const isFocusInsideReactTreeRef = React.useRef(false);
|
|
293
|
-
React.useEffect(() => {
|
|
294
|
-
const handleFocus = (event) => {
|
|
295
|
-
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
296
|
-
const eventDetail = { originalEvent: event };
|
|
297
|
-
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
298
|
-
discrete: false
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
ownerDocument.addEventListener("focusin", handleFocus);
|
|
303
|
-
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
|
304
|
-
}, [ownerDocument, handleFocusOutside]);
|
|
305
|
-
return {
|
|
306
|
-
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
|
|
307
|
-
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
function dispatchUpdate() {
|
|
311
|
-
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
312
|
-
document.dispatchEvent(event);
|
|
313
|
-
}
|
|
314
|
-
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
315
|
-
const target = detail.originalEvent.target;
|
|
316
|
-
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
317
|
-
if (handler) target.addEventListener(name, handler, { once: true });
|
|
318
|
-
if (discrete) {
|
|
319
|
-
dispatchDiscreteCustomEvent(target, event);
|
|
320
|
-
} else {
|
|
321
|
-
target.dispatchEvent(event);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
var count = 0;
|
|
325
|
-
function useFocusGuards() {
|
|
326
|
-
React.useEffect(() => {
|
|
327
|
-
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
|
|
328
|
-
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
|
|
329
|
-
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
|
|
330
|
-
count++;
|
|
331
|
-
return () => {
|
|
332
|
-
if (count === 1) {
|
|
333
|
-
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
|
|
334
|
-
}
|
|
335
|
-
count--;
|
|
336
|
-
};
|
|
337
|
-
}, []);
|
|
338
|
-
}
|
|
339
|
-
function createFocusGuard() {
|
|
340
|
-
const element = document.createElement("span");
|
|
341
|
-
element.setAttribute("data-radix-focus-guard", "");
|
|
342
|
-
element.tabIndex = 0;
|
|
343
|
-
element.style.cssText = "outline: none; opacity: 0; position: fixed; pointer-events: none";
|
|
344
|
-
return element;
|
|
345
|
-
}
|
|
346
|
-
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
347
|
-
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
348
|
-
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
349
|
-
var FOCUS_SCOPE_NAME = "FocusScope";
|
|
350
|
-
var FocusScope = React.forwardRef((props, forwardedRef) => {
|
|
351
|
-
const {
|
|
352
|
-
loop = false,
|
|
353
|
-
trapped = false,
|
|
354
|
-
onMountAutoFocus: onMountAutoFocusProp,
|
|
355
|
-
onUnmountAutoFocus: onUnmountAutoFocusProp,
|
|
356
|
-
...scopeProps
|
|
357
|
-
} = props;
|
|
358
|
-
const [container, setContainer] = React.useState(null);
|
|
359
|
-
const onMountAutoFocus = useCallbackRef$1(onMountAutoFocusProp);
|
|
360
|
-
const onUnmountAutoFocus = useCallbackRef$1(onUnmountAutoFocusProp);
|
|
361
|
-
const lastFocusedElementRef = React.useRef(null);
|
|
362
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
|
|
363
|
-
const focusScope = React.useRef({
|
|
364
|
-
paused: false,
|
|
365
|
-
pause() {
|
|
366
|
-
this.paused = true;
|
|
367
|
-
},
|
|
368
|
-
resume() {
|
|
369
|
-
this.paused = false;
|
|
370
|
-
}
|
|
371
|
-
}).current;
|
|
372
|
-
React.useEffect(() => {
|
|
373
|
-
if (trapped) {
|
|
374
|
-
let handleFocusIn2 = function(event) {
|
|
375
|
-
if (focusScope.paused || !container) return;
|
|
376
|
-
const target = event.target;
|
|
377
|
-
if (container.contains(target)) {
|
|
378
|
-
lastFocusedElementRef.current = target;
|
|
379
|
-
} else {
|
|
380
|
-
focus(lastFocusedElementRef.current, { select: true });
|
|
381
|
-
}
|
|
382
|
-
}, handleFocusOut2 = function(event) {
|
|
383
|
-
if (focusScope.paused || !container) return;
|
|
384
|
-
const relatedTarget = event.relatedTarget;
|
|
385
|
-
if (relatedTarget === null) return;
|
|
386
|
-
if (!container.contains(relatedTarget)) {
|
|
387
|
-
focus(lastFocusedElementRef.current, { select: true });
|
|
388
|
-
}
|
|
389
|
-
}, handleMutations2 = function(mutations) {
|
|
390
|
-
const focusedElement = document.activeElement;
|
|
391
|
-
if (focusedElement !== document.body) return;
|
|
392
|
-
for (const mutation of mutations) {
|
|
393
|
-
if (mutation.removedNodes.length > 0) focus(container);
|
|
394
|
-
}
|
|
395
|
-
};
|
|
396
|
-
document.addEventListener("focusin", handleFocusIn2);
|
|
397
|
-
document.addEventListener("focusout", handleFocusOut2);
|
|
398
|
-
const mutationObserver = new MutationObserver(handleMutations2);
|
|
399
|
-
if (container) mutationObserver.observe(container, { childList: true, subtree: true });
|
|
400
|
-
return () => {
|
|
401
|
-
document.removeEventListener("focusin", handleFocusIn2);
|
|
402
|
-
document.removeEventListener("focusout", handleFocusOut2);
|
|
403
|
-
mutationObserver.disconnect();
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
|
-
}, [trapped, container, focusScope.paused]);
|
|
407
|
-
React.useEffect(() => {
|
|
408
|
-
if (container) {
|
|
409
|
-
focusScopesStack.add(focusScope);
|
|
410
|
-
const previouslyFocusedElement = document.activeElement;
|
|
411
|
-
const hasFocusedCandidate = container.contains(previouslyFocusedElement);
|
|
412
|
-
if (!hasFocusedCandidate) {
|
|
413
|
-
const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
|
|
414
|
-
container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
415
|
-
container.dispatchEvent(mountEvent);
|
|
416
|
-
if (!mountEvent.defaultPrevented) {
|
|
417
|
-
focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
|
|
418
|
-
if (document.activeElement === previouslyFocusedElement) {
|
|
419
|
-
focus(container);
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
return () => {
|
|
424
|
-
container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
425
|
-
setTimeout(() => {
|
|
426
|
-
const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
|
|
427
|
-
container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
428
|
-
container.dispatchEvent(unmountEvent);
|
|
429
|
-
if (!unmountEvent.defaultPrevented) {
|
|
430
|
-
focus(previouslyFocusedElement ?? document.body, { select: true });
|
|
431
|
-
}
|
|
432
|
-
container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
433
|
-
focusScopesStack.remove(focusScope);
|
|
434
|
-
}, 0);
|
|
435
|
-
};
|
|
436
|
-
}
|
|
437
|
-
}, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
|
|
438
|
-
const handleKeyDown = React.useCallback(
|
|
439
|
-
(event) => {
|
|
440
|
-
if (!loop && !trapped) return;
|
|
441
|
-
if (focusScope.paused) return;
|
|
442
|
-
const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
443
|
-
const focusedElement = document.activeElement;
|
|
444
|
-
if (isTabKey && focusedElement) {
|
|
445
|
-
const container2 = event.currentTarget;
|
|
446
|
-
const [first, last] = getTabbableEdges(container2);
|
|
447
|
-
const hasTabbableElementsInside = first && last;
|
|
448
|
-
if (!hasTabbableElementsInside) {
|
|
449
|
-
if (focusedElement === container2) event.preventDefault();
|
|
450
|
-
} else {
|
|
451
|
-
if (!event.shiftKey && focusedElement === last) {
|
|
452
|
-
event.preventDefault();
|
|
453
|
-
if (loop) focus(first, { select: true });
|
|
454
|
-
} else if (event.shiftKey && focusedElement === first) {
|
|
455
|
-
event.preventDefault();
|
|
456
|
-
if (loop) focus(last, { select: true });
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
},
|
|
461
|
-
[loop, trapped, focusScope.paused]
|
|
462
|
-
);
|
|
463
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
464
|
-
});
|
|
465
|
-
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
466
|
-
function focusFirst(candidates, { select = false } = {}) {
|
|
467
|
-
const previouslyFocusedElement = document.activeElement;
|
|
468
|
-
for (const candidate of candidates) {
|
|
469
|
-
focus(candidate, { select });
|
|
470
|
-
if (document.activeElement !== previouslyFocusedElement) return;
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
function getTabbableEdges(container) {
|
|
474
|
-
const candidates = getTabbableCandidates(container);
|
|
475
|
-
const first = findVisible(candidates, container);
|
|
476
|
-
const last = findVisible(candidates.reverse(), container);
|
|
477
|
-
return [first, last];
|
|
478
|
-
}
|
|
479
|
-
function getTabbableCandidates(container) {
|
|
480
|
-
const nodes = [];
|
|
481
|
-
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
482
|
-
acceptNode: (node) => {
|
|
483
|
-
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
484
|
-
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
|
|
485
|
-
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
486
|
-
}
|
|
487
|
-
});
|
|
488
|
-
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
489
|
-
return nodes;
|
|
490
|
-
}
|
|
491
|
-
function findVisible(elements, container) {
|
|
492
|
-
for (const element of elements) {
|
|
493
|
-
if (!isHidden(element, { upTo: container })) return element;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
function isHidden(node, { upTo }) {
|
|
497
|
-
if (getComputedStyle(node).visibility === "hidden") return true;
|
|
498
|
-
while (node) {
|
|
499
|
-
if (upTo !== void 0 && node === upTo) return false;
|
|
500
|
-
if (getComputedStyle(node).display === "none") return true;
|
|
501
|
-
node = node.parentElement;
|
|
502
|
-
}
|
|
503
|
-
return false;
|
|
504
|
-
}
|
|
505
|
-
function isSelectableInput(element) {
|
|
506
|
-
return element instanceof HTMLInputElement && "select" in element;
|
|
507
|
-
}
|
|
508
|
-
function focus(element, { select = false } = {}) {
|
|
509
|
-
if (element && element.focus) {
|
|
510
|
-
const previouslyFocusedElement = document.activeElement;
|
|
511
|
-
element.focus({ preventScroll: true });
|
|
512
|
-
if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
|
|
513
|
-
element.select();
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
var focusScopesStack = createFocusScopesStack();
|
|
517
|
-
function createFocusScopesStack() {
|
|
518
|
-
let stack = [];
|
|
519
|
-
return {
|
|
520
|
-
add(focusScope) {
|
|
521
|
-
const activeFocusScope = stack[0];
|
|
522
|
-
if (focusScope !== activeFocusScope) {
|
|
523
|
-
activeFocusScope == null ? void 0 : activeFocusScope.pause();
|
|
524
|
-
}
|
|
525
|
-
stack = arrayRemove(stack, focusScope);
|
|
526
|
-
stack.unshift(focusScope);
|
|
527
|
-
},
|
|
528
|
-
remove(focusScope) {
|
|
529
|
-
var _a;
|
|
530
|
-
stack = arrayRemove(stack, focusScope);
|
|
531
|
-
(_a = stack[0]) == null ? void 0 : _a.resume();
|
|
532
|
-
}
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
|
-
function arrayRemove(array, item) {
|
|
536
|
-
const updatedArray = [...array];
|
|
537
|
-
const index = updatedArray.indexOf(item);
|
|
538
|
-
if (index !== -1) {
|
|
539
|
-
updatedArray.splice(index, 1);
|
|
540
|
-
}
|
|
541
|
-
return updatedArray;
|
|
542
|
-
}
|
|
543
|
-
function removeLinks(items) {
|
|
544
|
-
return items.filter((item) => item.tagName !== "A");
|
|
545
|
-
}
|
|
546
|
-
var PORTAL_NAME = "Portal";
|
|
547
|
-
var Portal = React.forwardRef((props, forwardedRef) => {
|
|
548
|
-
var _a;
|
|
549
|
-
const { container: containerProp, ...portalProps } = props;
|
|
550
|
-
const [mounted, setMounted] = React.useState(false);
|
|
551
|
-
useLayoutEffect2(() => setMounted(true), []);
|
|
552
|
-
const container = containerProp || mounted && ((_a = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : _a.body);
|
|
553
|
-
return container ? ReactDOM__default.createPortal(/* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
554
|
-
});
|
|
555
|
-
Portal.displayName = PORTAL_NAME;
|
|
556
|
-
var NAME = "VisuallyHidden";
|
|
557
|
-
var VisuallyHidden = React.forwardRef(
|
|
558
|
-
(props, forwardedRef) => {
|
|
559
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
560
|
-
Primitive.span,
|
|
561
|
-
{
|
|
562
|
-
...props,
|
|
563
|
-
ref: forwardedRef,
|
|
564
|
-
style: {
|
|
565
|
-
// See: https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
|
|
566
|
-
position: "absolute",
|
|
567
|
-
border: 0,
|
|
568
|
-
width: 1,
|
|
569
|
-
height: 1,
|
|
570
|
-
padding: 0,
|
|
571
|
-
margin: -1,
|
|
572
|
-
overflow: "hidden",
|
|
573
|
-
clip: "rect(0, 0, 0, 0)",
|
|
574
|
-
whiteSpace: "nowrap",
|
|
575
|
-
wordWrap: "normal",
|
|
576
|
-
...props.style
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
);
|
|
580
|
-
}
|
|
581
|
-
);
|
|
582
|
-
VisuallyHidden.displayName = NAME;
|
|
583
|
-
var getDefaultParent = function(originalTarget) {
|
|
584
|
-
if (typeof document === "undefined") {
|
|
585
|
-
return null;
|
|
586
|
-
}
|
|
587
|
-
var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
|
|
588
|
-
return sampleTarget.ownerDocument.body;
|
|
589
|
-
};
|
|
590
|
-
var counterMap = /* @__PURE__ */ new WeakMap();
|
|
591
|
-
var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
592
|
-
var markerMap = {};
|
|
593
|
-
var lockCount = 0;
|
|
594
|
-
var unwrapHost = function(node) {
|
|
595
|
-
return node && (node.host || unwrapHost(node.parentNode));
|
|
596
|
-
};
|
|
597
|
-
var correctTargets = function(parent, targets) {
|
|
598
|
-
return targets.map(function(target) {
|
|
599
|
-
if (parent.contains(target)) {
|
|
600
|
-
return target;
|
|
601
|
-
}
|
|
602
|
-
var correctedTarget = unwrapHost(target);
|
|
603
|
-
if (correctedTarget && parent.contains(correctedTarget)) {
|
|
604
|
-
return correctedTarget;
|
|
605
|
-
}
|
|
606
|
-
console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
|
|
607
|
-
return null;
|
|
608
|
-
}).filter(function(x) {
|
|
609
|
-
return Boolean(x);
|
|
610
|
-
});
|
|
611
|
-
};
|
|
612
|
-
var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
|
|
613
|
-
var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
614
|
-
if (!markerMap[markerName]) {
|
|
615
|
-
markerMap[markerName] = /* @__PURE__ */ new WeakMap();
|
|
616
|
-
}
|
|
617
|
-
var markerCounter = markerMap[markerName];
|
|
618
|
-
var hiddenNodes = [];
|
|
619
|
-
var elementsToKeep = /* @__PURE__ */ new Set();
|
|
620
|
-
var elementsToStop = new Set(targets);
|
|
621
|
-
var keep = function(el) {
|
|
622
|
-
if (!el || elementsToKeep.has(el)) {
|
|
623
|
-
return;
|
|
624
|
-
}
|
|
625
|
-
elementsToKeep.add(el);
|
|
626
|
-
keep(el.parentNode);
|
|
627
|
-
};
|
|
628
|
-
targets.forEach(keep);
|
|
629
|
-
var deep = function(parent) {
|
|
630
|
-
if (!parent || elementsToStop.has(parent)) {
|
|
631
|
-
return;
|
|
632
|
-
}
|
|
633
|
-
Array.prototype.forEach.call(parent.children, function(node) {
|
|
634
|
-
if (elementsToKeep.has(node)) {
|
|
635
|
-
deep(node);
|
|
636
|
-
} else {
|
|
637
|
-
try {
|
|
638
|
-
var attr = node.getAttribute(controlAttribute);
|
|
639
|
-
var alreadyHidden = attr !== null && attr !== "false";
|
|
640
|
-
var counterValue = (counterMap.get(node) || 0) + 1;
|
|
641
|
-
var markerValue = (markerCounter.get(node) || 0) + 1;
|
|
642
|
-
counterMap.set(node, counterValue);
|
|
643
|
-
markerCounter.set(node, markerValue);
|
|
644
|
-
hiddenNodes.push(node);
|
|
645
|
-
if (counterValue === 1 && alreadyHidden) {
|
|
646
|
-
uncontrolledNodes.set(node, true);
|
|
647
|
-
}
|
|
648
|
-
if (markerValue === 1) {
|
|
649
|
-
node.setAttribute(markerName, "true");
|
|
650
|
-
}
|
|
651
|
-
if (!alreadyHidden) {
|
|
652
|
-
node.setAttribute(controlAttribute, "true");
|
|
653
|
-
}
|
|
654
|
-
} catch (e) {
|
|
655
|
-
console.error("aria-hidden: cannot operate on ", node, e);
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
});
|
|
659
|
-
};
|
|
660
|
-
deep(parentNode);
|
|
661
|
-
elementsToKeep.clear();
|
|
662
|
-
lockCount++;
|
|
663
|
-
return function() {
|
|
664
|
-
hiddenNodes.forEach(function(node) {
|
|
665
|
-
var counterValue = counterMap.get(node) - 1;
|
|
666
|
-
var markerValue = markerCounter.get(node) - 1;
|
|
667
|
-
counterMap.set(node, counterValue);
|
|
668
|
-
markerCounter.set(node, markerValue);
|
|
669
|
-
if (!counterValue) {
|
|
670
|
-
if (!uncontrolledNodes.has(node)) {
|
|
671
|
-
node.removeAttribute(controlAttribute);
|
|
672
|
-
}
|
|
673
|
-
uncontrolledNodes.delete(node);
|
|
674
|
-
}
|
|
675
|
-
if (!markerValue) {
|
|
676
|
-
node.removeAttribute(markerName);
|
|
677
|
-
}
|
|
678
|
-
});
|
|
679
|
-
lockCount--;
|
|
680
|
-
if (!lockCount) {
|
|
681
|
-
counterMap = /* @__PURE__ */ new WeakMap();
|
|
682
|
-
counterMap = /* @__PURE__ */ new WeakMap();
|
|
683
|
-
uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
684
|
-
markerMap = {};
|
|
685
|
-
}
|
|
686
|
-
};
|
|
687
|
-
};
|
|
688
|
-
var hideOthers = function(originalTarget, parentNode, markerName) {
|
|
689
|
-
if (markerName === void 0) {
|
|
690
|
-
markerName = "data-aria-hidden";
|
|
691
|
-
}
|
|
692
|
-
var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
693
|
-
var activeParentNode = getDefaultParent(originalTarget);
|
|
694
|
-
if (!activeParentNode) {
|
|
695
|
-
return function() {
|
|
696
|
-
return null;
|
|
697
|
-
};
|
|
698
|
-
}
|
|
699
|
-
targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live]")));
|
|
700
|
-
return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
|
|
701
|
-
};
|
|
702
|
-
var __assign = function() {
|
|
703
|
-
__assign = Object.assign || function __assign2(t) {
|
|
704
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
705
|
-
s = arguments[i];
|
|
706
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
707
|
-
}
|
|
708
|
-
return t;
|
|
709
|
-
};
|
|
710
|
-
return __assign.apply(this, arguments);
|
|
711
|
-
};
|
|
712
|
-
function __rest(s, e) {
|
|
713
|
-
var t = {};
|
|
714
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
715
|
-
t[p] = s[p];
|
|
716
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
717
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
718
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
719
|
-
t[p[i]] = s[p[i]];
|
|
720
|
-
}
|
|
721
|
-
return t;
|
|
722
|
-
}
|
|
723
|
-
function __spreadArray(to, from, pack) {
|
|
724
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
725
|
-
if (ar || !(i in from)) {
|
|
726
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
727
|
-
ar[i] = from[i];
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
731
|
-
}
|
|
732
|
-
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
733
|
-
var e = new Error(message);
|
|
734
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
735
|
-
};
|
|
736
|
-
var zeroRightClassName = "right-scroll-bar-position";
|
|
737
|
-
var fullWidthClassName = "width-before-scroll-bar";
|
|
738
|
-
var noScrollbarsClassName = "with-scroll-bars-hidden";
|
|
739
|
-
var removedBarSizeVariable = "--removed-body-scroll-bar-size";
|
|
740
|
-
function assignRef(ref, value) {
|
|
741
|
-
if (typeof ref === "function") {
|
|
742
|
-
ref(value);
|
|
743
|
-
} else if (ref) {
|
|
744
|
-
ref.current = value;
|
|
745
|
-
}
|
|
746
|
-
return ref;
|
|
747
|
-
}
|
|
748
|
-
function useCallbackRef(initialValue, callback) {
|
|
749
|
-
var ref = useState(function() {
|
|
750
|
-
return {
|
|
751
|
-
// value
|
|
752
|
-
value: initialValue,
|
|
753
|
-
// last callback
|
|
754
|
-
callback,
|
|
755
|
-
// "memoized" public interface
|
|
756
|
-
facade: {
|
|
757
|
-
get current() {
|
|
758
|
-
return ref.value;
|
|
759
|
-
},
|
|
760
|
-
set current(value) {
|
|
761
|
-
var last = ref.value;
|
|
762
|
-
if (last !== value) {
|
|
763
|
-
ref.value = value;
|
|
764
|
-
ref.callback(value, last);
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
};
|
|
769
|
-
})[0];
|
|
770
|
-
ref.callback = callback;
|
|
771
|
-
return ref.facade;
|
|
772
|
-
}
|
|
773
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
774
|
-
var currentValues = /* @__PURE__ */ new WeakMap();
|
|
775
|
-
function useMergeRefs(refs, defaultValue) {
|
|
776
|
-
var callbackRef = useCallbackRef(null, function(newValue) {
|
|
777
|
-
return refs.forEach(function(ref) {
|
|
778
|
-
return assignRef(ref, newValue);
|
|
779
|
-
});
|
|
780
|
-
});
|
|
781
|
-
useIsomorphicLayoutEffect(function() {
|
|
782
|
-
var oldValue = currentValues.get(callbackRef);
|
|
783
|
-
if (oldValue) {
|
|
784
|
-
var prevRefs_1 = new Set(oldValue);
|
|
785
|
-
var nextRefs_1 = new Set(refs);
|
|
786
|
-
var current_1 = callbackRef.current;
|
|
787
|
-
prevRefs_1.forEach(function(ref) {
|
|
788
|
-
if (!nextRefs_1.has(ref)) {
|
|
789
|
-
assignRef(ref, null);
|
|
790
|
-
}
|
|
791
|
-
});
|
|
792
|
-
nextRefs_1.forEach(function(ref) {
|
|
793
|
-
if (!prevRefs_1.has(ref)) {
|
|
794
|
-
assignRef(ref, current_1);
|
|
795
|
-
}
|
|
796
|
-
});
|
|
797
|
-
}
|
|
798
|
-
currentValues.set(callbackRef, refs);
|
|
799
|
-
}, [refs]);
|
|
800
|
-
return callbackRef;
|
|
801
|
-
}
|
|
802
|
-
function ItoI(a) {
|
|
803
|
-
return a;
|
|
804
|
-
}
|
|
805
|
-
function innerCreateMedium(defaults, middleware) {
|
|
806
|
-
if (middleware === void 0) {
|
|
807
|
-
middleware = ItoI;
|
|
808
|
-
}
|
|
809
|
-
var buffer = [];
|
|
810
|
-
var assigned = false;
|
|
811
|
-
var medium = {
|
|
812
|
-
read: function() {
|
|
813
|
-
if (assigned) {
|
|
814
|
-
throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
|
|
815
|
-
}
|
|
816
|
-
if (buffer.length) {
|
|
817
|
-
return buffer[buffer.length - 1];
|
|
818
|
-
}
|
|
819
|
-
return defaults;
|
|
820
|
-
},
|
|
821
|
-
useMedium: function(data) {
|
|
822
|
-
var item = middleware(data, assigned);
|
|
823
|
-
buffer.push(item);
|
|
824
|
-
return function() {
|
|
825
|
-
buffer = buffer.filter(function(x) {
|
|
826
|
-
return x !== item;
|
|
827
|
-
});
|
|
828
|
-
};
|
|
829
|
-
},
|
|
830
|
-
assignSyncMedium: function(cb) {
|
|
831
|
-
assigned = true;
|
|
832
|
-
while (buffer.length) {
|
|
833
|
-
var cbs = buffer;
|
|
834
|
-
buffer = [];
|
|
835
|
-
cbs.forEach(cb);
|
|
836
|
-
}
|
|
837
|
-
buffer = {
|
|
838
|
-
push: function(x) {
|
|
839
|
-
return cb(x);
|
|
840
|
-
},
|
|
841
|
-
filter: function() {
|
|
842
|
-
return buffer;
|
|
843
|
-
}
|
|
844
|
-
};
|
|
845
|
-
},
|
|
846
|
-
assignMedium: function(cb) {
|
|
847
|
-
assigned = true;
|
|
848
|
-
var pendingQueue = [];
|
|
849
|
-
if (buffer.length) {
|
|
850
|
-
var cbs = buffer;
|
|
851
|
-
buffer = [];
|
|
852
|
-
cbs.forEach(cb);
|
|
853
|
-
pendingQueue = buffer;
|
|
854
|
-
}
|
|
855
|
-
var executeQueue = function() {
|
|
856
|
-
var cbs2 = pendingQueue;
|
|
857
|
-
pendingQueue = [];
|
|
858
|
-
cbs2.forEach(cb);
|
|
859
|
-
};
|
|
860
|
-
var cycle = function() {
|
|
861
|
-
return Promise.resolve().then(executeQueue);
|
|
862
|
-
};
|
|
863
|
-
cycle();
|
|
864
|
-
buffer = {
|
|
865
|
-
push: function(x) {
|
|
866
|
-
pendingQueue.push(x);
|
|
867
|
-
cycle();
|
|
868
|
-
},
|
|
869
|
-
filter: function(filter) {
|
|
870
|
-
pendingQueue = pendingQueue.filter(filter);
|
|
871
|
-
return buffer;
|
|
872
|
-
}
|
|
873
|
-
};
|
|
874
|
-
}
|
|
875
|
-
};
|
|
876
|
-
return medium;
|
|
877
|
-
}
|
|
878
|
-
function createSidecarMedium(options) {
|
|
879
|
-
if (options === void 0) {
|
|
880
|
-
options = {};
|
|
881
|
-
}
|
|
882
|
-
var medium = innerCreateMedium(null);
|
|
883
|
-
medium.options = __assign({ async: true, ssr: false }, options);
|
|
884
|
-
return medium;
|
|
885
|
-
}
|
|
886
|
-
var SideCar$1 = function(_a) {
|
|
887
|
-
var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
|
|
888
|
-
if (!sideCar) {
|
|
889
|
-
throw new Error("Sidecar: please provide `sideCar` property to import the right car");
|
|
890
|
-
}
|
|
891
|
-
var Target = sideCar.read();
|
|
892
|
-
if (!Target) {
|
|
893
|
-
throw new Error("Sidecar medium not found");
|
|
894
|
-
}
|
|
895
|
-
return React.createElement(Target, __assign({}, rest));
|
|
896
|
-
};
|
|
897
|
-
SideCar$1.isSideCarExport = true;
|
|
898
|
-
function exportSidecar(medium, exported) {
|
|
899
|
-
medium.useMedium(exported);
|
|
900
|
-
return SideCar$1;
|
|
901
|
-
}
|
|
902
|
-
var effectCar = createSidecarMedium();
|
|
903
|
-
var nothing = function() {
|
|
904
|
-
return;
|
|
905
|
-
};
|
|
906
|
-
var RemoveScroll = React.forwardRef(function(props, parentRef) {
|
|
907
|
-
var ref = React.useRef(null);
|
|
908
|
-
var _a = React.useState({
|
|
909
|
-
onScrollCapture: nothing,
|
|
910
|
-
onWheelCapture: nothing,
|
|
911
|
-
onTouchMoveCapture: nothing
|
|
912
|
-
}), callbacks = _a[0], setCallbacks = _a[1];
|
|
913
|
-
var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? "div" : _b, gapMode = props.gapMode, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
|
|
914
|
-
var SideCar2 = sideCar;
|
|
915
|
-
var containerRef = useMergeRefs([ref, parentRef]);
|
|
916
|
-
var containerProps = __assign(__assign({}, rest), callbacks);
|
|
917
|
-
return React.createElement(
|
|
918
|
-
React.Fragment,
|
|
919
|
-
null,
|
|
920
|
-
enabled && React.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
|
|
921
|
-
forwardProps ? React.cloneElement(React.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
|
|
922
|
-
);
|
|
923
|
-
});
|
|
924
|
-
RemoveScroll.defaultProps = {
|
|
925
|
-
enabled: true,
|
|
926
|
-
removeScrollBar: true,
|
|
927
|
-
inert: false
|
|
928
|
-
};
|
|
929
|
-
RemoveScroll.classNames = {
|
|
930
|
-
fullWidth: fullWidthClassName,
|
|
931
|
-
zeroRight: zeroRightClassName
|
|
932
|
-
};
|
|
933
|
-
var getNonce = function() {
|
|
934
|
-
if (typeof __webpack_nonce__ !== "undefined") {
|
|
935
|
-
return __webpack_nonce__;
|
|
936
|
-
}
|
|
937
|
-
return void 0;
|
|
938
|
-
};
|
|
939
|
-
function makeStyleTag() {
|
|
940
|
-
if (!document)
|
|
941
|
-
return null;
|
|
942
|
-
var tag = document.createElement("style");
|
|
943
|
-
tag.type = "text/css";
|
|
944
|
-
var nonce = getNonce();
|
|
945
|
-
if (nonce) {
|
|
946
|
-
tag.setAttribute("nonce", nonce);
|
|
947
|
-
}
|
|
948
|
-
return tag;
|
|
949
|
-
}
|
|
950
|
-
function injectStyles(tag, css) {
|
|
951
|
-
if (tag.styleSheet) {
|
|
952
|
-
tag.styleSheet.cssText = css;
|
|
953
|
-
} else {
|
|
954
|
-
tag.appendChild(document.createTextNode(css));
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
function insertStyleTag(tag) {
|
|
958
|
-
var head = document.head || document.getElementsByTagName("head")[0];
|
|
959
|
-
head.appendChild(tag);
|
|
960
|
-
}
|
|
961
|
-
var stylesheetSingleton = function() {
|
|
962
|
-
var counter = 0;
|
|
963
|
-
var stylesheet = null;
|
|
964
|
-
return {
|
|
965
|
-
add: function(style) {
|
|
966
|
-
if (counter == 0) {
|
|
967
|
-
if (stylesheet = makeStyleTag()) {
|
|
968
|
-
injectStyles(stylesheet, style);
|
|
969
|
-
insertStyleTag(stylesheet);
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
counter++;
|
|
973
|
-
},
|
|
974
|
-
remove: function() {
|
|
975
|
-
counter--;
|
|
976
|
-
if (!counter && stylesheet) {
|
|
977
|
-
stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
|
|
978
|
-
stylesheet = null;
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
};
|
|
982
|
-
};
|
|
983
|
-
var styleHookSingleton = function() {
|
|
984
|
-
var sheet = stylesheetSingleton();
|
|
985
|
-
return function(styles, isDynamic) {
|
|
986
|
-
React.useEffect(function() {
|
|
987
|
-
sheet.add(styles);
|
|
988
|
-
return function() {
|
|
989
|
-
sheet.remove();
|
|
990
|
-
};
|
|
991
|
-
}, [styles && isDynamic]);
|
|
992
|
-
};
|
|
993
|
-
};
|
|
994
|
-
var styleSingleton = function() {
|
|
995
|
-
var useStyle = styleHookSingleton();
|
|
996
|
-
var Sheet = function(_a) {
|
|
997
|
-
var styles = _a.styles, dynamic = _a.dynamic;
|
|
998
|
-
useStyle(styles, dynamic);
|
|
999
|
-
return null;
|
|
1000
|
-
};
|
|
1001
|
-
return Sheet;
|
|
1002
|
-
};
|
|
1003
|
-
var zeroGap = {
|
|
1004
|
-
left: 0,
|
|
1005
|
-
top: 0,
|
|
1006
|
-
right: 0,
|
|
1007
|
-
gap: 0
|
|
1008
|
-
};
|
|
1009
|
-
var parse = function(x) {
|
|
1010
|
-
return parseInt(x || "", 10) || 0;
|
|
1011
|
-
};
|
|
1012
|
-
var getOffset = function(gapMode) {
|
|
1013
|
-
var cs = window.getComputedStyle(document.body);
|
|
1014
|
-
var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
|
|
1015
|
-
var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
|
|
1016
|
-
var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
|
|
1017
|
-
return [parse(left), parse(top), parse(right)];
|
|
1018
|
-
};
|
|
1019
|
-
var getGapWidth = function(gapMode) {
|
|
1020
|
-
if (gapMode === void 0) {
|
|
1021
|
-
gapMode = "margin";
|
|
1022
|
-
}
|
|
1023
|
-
if (typeof window === "undefined") {
|
|
1024
|
-
return zeroGap;
|
|
1025
|
-
}
|
|
1026
|
-
var offsets = getOffset(gapMode);
|
|
1027
|
-
var documentWidth = document.documentElement.clientWidth;
|
|
1028
|
-
var windowWidth = window.innerWidth;
|
|
1029
|
-
return {
|
|
1030
|
-
left: offsets[0],
|
|
1031
|
-
top: offsets[1],
|
|
1032
|
-
right: offsets[2],
|
|
1033
|
-
gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
|
|
1034
|
-
};
|
|
1035
|
-
};
|
|
1036
|
-
var Style = styleSingleton();
|
|
1037
|
-
var lockAttribute = "data-scroll-locked";
|
|
1038
|
-
var getStyles = function(_a, allowRelative, gapMode, important) {
|
|
1039
|
-
var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
|
|
1040
|
-
if (gapMode === void 0) {
|
|
1041
|
-
gapMode = "margin";
|
|
1042
|
-
}
|
|
1043
|
-
return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body[").concat(lockAttribute, "] {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
|
|
1044
|
-
allowRelative && "position: relative ".concat(important, ";"),
|
|
1045
|
-
gapMode === "margin" && "\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
|
|
1046
|
-
gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
|
|
1047
|
-
].filter(Boolean).join(""), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body[").concat(lockAttribute, "] {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
|
|
1048
|
-
};
|
|
1049
|
-
var getCurrentUseCounter = function() {
|
|
1050
|
-
var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
|
|
1051
|
-
return isFinite(counter) ? counter : 0;
|
|
1052
|
-
};
|
|
1053
|
-
var useLockAttribute = function() {
|
|
1054
|
-
React.useEffect(function() {
|
|
1055
|
-
document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
|
|
1056
|
-
return function() {
|
|
1057
|
-
var newCounter = getCurrentUseCounter() - 1;
|
|
1058
|
-
if (newCounter <= 0) {
|
|
1059
|
-
document.body.removeAttribute(lockAttribute);
|
|
1060
|
-
} else {
|
|
1061
|
-
document.body.setAttribute(lockAttribute, newCounter.toString());
|
|
1062
|
-
}
|
|
1063
|
-
};
|
|
1064
|
-
}, []);
|
|
1065
|
-
};
|
|
1066
|
-
var RemoveScrollBar = function(_a) {
|
|
1067
|
-
var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
|
|
1068
|
-
useLockAttribute();
|
|
1069
|
-
var gap = React.useMemo(function() {
|
|
1070
|
-
return getGapWidth(gapMode);
|
|
1071
|
-
}, [gapMode]);
|
|
1072
|
-
return React.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
|
|
1073
|
-
};
|
|
1074
|
-
var passiveSupported = false;
|
|
1075
|
-
if (typeof window !== "undefined") {
|
|
1076
|
-
try {
|
|
1077
|
-
var options = Object.defineProperty({}, "passive", {
|
|
1078
|
-
get: function() {
|
|
1079
|
-
passiveSupported = true;
|
|
1080
|
-
return true;
|
|
1081
|
-
}
|
|
1082
|
-
});
|
|
1083
|
-
window.addEventListener("test", options, options);
|
|
1084
|
-
window.removeEventListener("test", options, options);
|
|
1085
|
-
} catch (err) {
|
|
1086
|
-
passiveSupported = false;
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
var nonPassive = passiveSupported ? { passive: false } : false;
|
|
1090
|
-
var alwaysContainsScroll = function(node) {
|
|
1091
|
-
return node.tagName === "TEXTAREA";
|
|
1092
|
-
};
|
|
1093
|
-
var elementCanBeScrolled = function(node, overflow) {
|
|
1094
|
-
var styles = window.getComputedStyle(node);
|
|
1095
|
-
return (
|
|
1096
|
-
// not-not-scrollable
|
|
1097
|
-
styles[overflow] !== "hidden" && // contains scroll inside self
|
|
1098
|
-
!(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
|
|
1099
|
-
);
|
|
1100
|
-
};
|
|
1101
|
-
var elementCouldBeVScrolled = function(node) {
|
|
1102
|
-
return elementCanBeScrolled(node, "overflowY");
|
|
1103
|
-
};
|
|
1104
|
-
var elementCouldBeHScrolled = function(node) {
|
|
1105
|
-
return elementCanBeScrolled(node, "overflowX");
|
|
1106
|
-
};
|
|
1107
|
-
var locationCouldBeScrolled = function(axis, node) {
|
|
1108
|
-
var ownerDocument = node.ownerDocument;
|
|
1109
|
-
var current = node;
|
|
1110
|
-
do {
|
|
1111
|
-
if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
|
|
1112
|
-
current = current.host;
|
|
1113
|
-
}
|
|
1114
|
-
var isScrollable = elementCouldBeScrolled(axis, current);
|
|
1115
|
-
if (isScrollable) {
|
|
1116
|
-
var _a = getScrollVariables(axis, current), s = _a[1], d = _a[2];
|
|
1117
|
-
if (s > d) {
|
|
1118
|
-
return true;
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
current = current.parentNode;
|
|
1122
|
-
} while (current && current !== ownerDocument.body);
|
|
1123
|
-
return false;
|
|
1124
|
-
};
|
|
1125
|
-
var getVScrollVariables = function(_a) {
|
|
1126
|
-
var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
|
|
1127
|
-
return [
|
|
1128
|
-
scrollTop,
|
|
1129
|
-
scrollHeight,
|
|
1130
|
-
clientHeight
|
|
1131
|
-
];
|
|
1132
|
-
};
|
|
1133
|
-
var getHScrollVariables = function(_a) {
|
|
1134
|
-
var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
|
|
1135
|
-
return [
|
|
1136
|
-
scrollLeft,
|
|
1137
|
-
scrollWidth,
|
|
1138
|
-
clientWidth
|
|
1139
|
-
];
|
|
1140
|
-
};
|
|
1141
|
-
var elementCouldBeScrolled = function(axis, node) {
|
|
1142
|
-
return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
|
|
1143
|
-
};
|
|
1144
|
-
var getScrollVariables = function(axis, node) {
|
|
1145
|
-
return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
|
|
1146
|
-
};
|
|
1147
|
-
var getDirectionFactor = function(axis, direction) {
|
|
1148
|
-
return axis === "h" && direction === "rtl" ? -1 : 1;
|
|
1149
|
-
};
|
|
1150
|
-
var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
1151
|
-
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
|
|
1152
|
-
var delta = directionFactor * sourceDelta;
|
|
1153
|
-
var target = event.target;
|
|
1154
|
-
var targetInLock = endTarget.contains(target);
|
|
1155
|
-
var shouldCancelScroll = false;
|
|
1156
|
-
var isDeltaPositive = delta > 0;
|
|
1157
|
-
var availableScroll = 0;
|
|
1158
|
-
var availableScrollTop = 0;
|
|
1159
|
-
do {
|
|
1160
|
-
var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
|
|
1161
|
-
var elementScroll = scroll_1 - capacity - directionFactor * position;
|
|
1162
|
-
if (position || elementScroll) {
|
|
1163
|
-
if (elementCouldBeScrolled(axis, target)) {
|
|
1164
|
-
availableScroll += elementScroll;
|
|
1165
|
-
availableScrollTop += position;
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
if (target instanceof ShadowRoot) {
|
|
1169
|
-
target = target.host;
|
|
1170
|
-
} else {
|
|
1171
|
-
target = target.parentNode;
|
|
1172
|
-
}
|
|
1173
|
-
} while (
|
|
1174
|
-
// portaled content
|
|
1175
|
-
!targetInLock && target !== document.body || // self content
|
|
1176
|
-
targetInLock && (endTarget.contains(target) || endTarget === target)
|
|
1177
|
-
);
|
|
1178
|
-
if (isDeltaPositive && (Math.abs(availableScroll) < 1 || !noOverscroll)) {
|
|
1179
|
-
shouldCancelScroll = true;
|
|
1180
|
-
} else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || !noOverscroll)) {
|
|
1181
|
-
shouldCancelScroll = true;
|
|
1182
|
-
}
|
|
1183
|
-
return shouldCancelScroll;
|
|
1184
|
-
};
|
|
1185
|
-
var getTouchXY = function(event) {
|
|
1186
|
-
return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
|
|
1187
|
-
};
|
|
1188
|
-
var getDeltaXY = function(event) {
|
|
1189
|
-
return [event.deltaX, event.deltaY];
|
|
1190
|
-
};
|
|
1191
|
-
var extractRef = function(ref) {
|
|
1192
|
-
return ref && "current" in ref ? ref.current : ref;
|
|
1193
|
-
};
|
|
1194
|
-
var deltaCompare = function(x, y) {
|
|
1195
|
-
return x[0] === y[0] && x[1] === y[1];
|
|
1196
|
-
};
|
|
1197
|
-
var generateStyle = function(id) {
|
|
1198
|
-
return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n");
|
|
1199
|
-
};
|
|
1200
|
-
var idCounter = 0;
|
|
1201
|
-
var lockStack = [];
|
|
1202
|
-
function RemoveScrollSideCar(props) {
|
|
1203
|
-
var shouldPreventQueue = React.useRef([]);
|
|
1204
|
-
var touchStartRef = React.useRef([0, 0]);
|
|
1205
|
-
var activeAxis = React.useRef();
|
|
1206
|
-
var id = React.useState(idCounter++)[0];
|
|
1207
|
-
var Style2 = React.useState(styleSingleton)[0];
|
|
1208
|
-
var lastProps = React.useRef(props);
|
|
1209
|
-
React.useEffect(function() {
|
|
1210
|
-
lastProps.current = props;
|
|
1211
|
-
}, [props]);
|
|
1212
|
-
React.useEffect(function() {
|
|
1213
|
-
if (props.inert) {
|
|
1214
|
-
document.body.classList.add("block-interactivity-".concat(id));
|
|
1215
|
-
var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
|
|
1216
|
-
allow_1.forEach(function(el) {
|
|
1217
|
-
return el.classList.add("allow-interactivity-".concat(id));
|
|
1218
|
-
});
|
|
1219
|
-
return function() {
|
|
1220
|
-
document.body.classList.remove("block-interactivity-".concat(id));
|
|
1221
|
-
allow_1.forEach(function(el) {
|
|
1222
|
-
return el.classList.remove("allow-interactivity-".concat(id));
|
|
1223
|
-
});
|
|
1224
|
-
};
|
|
1225
|
-
}
|
|
1226
|
-
return;
|
|
1227
|
-
}, [props.inert, props.lockRef.current, props.shards]);
|
|
1228
|
-
var shouldCancelEvent = React.useCallback(function(event, parent) {
|
|
1229
|
-
if ("touches" in event && event.touches.length === 2) {
|
|
1230
|
-
return !lastProps.current.allowPinchZoom;
|
|
1231
|
-
}
|
|
1232
|
-
var touch = getTouchXY(event);
|
|
1233
|
-
var touchStart = touchStartRef.current;
|
|
1234
|
-
var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0];
|
|
1235
|
-
var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1];
|
|
1236
|
-
var currentAxis;
|
|
1237
|
-
var target = event.target;
|
|
1238
|
-
var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v";
|
|
1239
|
-
if ("touches" in event && moveDirection === "h" && target.type === "range") {
|
|
1240
|
-
return false;
|
|
1241
|
-
}
|
|
1242
|
-
var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
1243
|
-
if (!canBeScrolledInMainDirection) {
|
|
1244
|
-
return true;
|
|
1245
|
-
}
|
|
1246
|
-
if (canBeScrolledInMainDirection) {
|
|
1247
|
-
currentAxis = moveDirection;
|
|
1248
|
-
} else {
|
|
1249
|
-
currentAxis = moveDirection === "v" ? "h" : "v";
|
|
1250
|
-
canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
1251
|
-
}
|
|
1252
|
-
if (!canBeScrolledInMainDirection) {
|
|
1253
|
-
return false;
|
|
1254
|
-
}
|
|
1255
|
-
if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) {
|
|
1256
|
-
activeAxis.current = currentAxis;
|
|
1257
|
-
}
|
|
1258
|
-
if (!currentAxis) {
|
|
1259
|
-
return true;
|
|
1260
|
-
}
|
|
1261
|
-
var cancelingAxis = activeAxis.current || currentAxis;
|
|
1262
|
-
return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY, true);
|
|
1263
|
-
}, []);
|
|
1264
|
-
var shouldPrevent = React.useCallback(function(_event) {
|
|
1265
|
-
var event = _event;
|
|
1266
|
-
if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) {
|
|
1267
|
-
return;
|
|
1268
|
-
}
|
|
1269
|
-
var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event);
|
|
1270
|
-
var sourceEvent = shouldPreventQueue.current.filter(function(e) {
|
|
1271
|
-
return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta);
|
|
1272
|
-
})[0];
|
|
1273
|
-
if (sourceEvent && sourceEvent.should) {
|
|
1274
|
-
if (event.cancelable) {
|
|
1275
|
-
event.preventDefault();
|
|
1276
|
-
}
|
|
1277
|
-
return;
|
|
1278
|
-
}
|
|
1279
|
-
if (!sourceEvent) {
|
|
1280
|
-
var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function(node) {
|
|
1281
|
-
return node.contains(event.target);
|
|
1282
|
-
});
|
|
1283
|
-
var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
|
|
1284
|
-
if (shouldStop) {
|
|
1285
|
-
if (event.cancelable) {
|
|
1286
|
-
event.preventDefault();
|
|
1287
|
-
}
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
}, []);
|
|
1291
|
-
var shouldCancel = React.useCallback(function(name, delta, target, should) {
|
|
1292
|
-
var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
|
|
1293
|
-
shouldPreventQueue.current.push(event);
|
|
1294
|
-
setTimeout(function() {
|
|
1295
|
-
shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) {
|
|
1296
|
-
return e !== event;
|
|
1297
|
-
});
|
|
1298
|
-
}, 1);
|
|
1299
|
-
}, []);
|
|
1300
|
-
var scrollTouchStart = React.useCallback(function(event) {
|
|
1301
|
-
touchStartRef.current = getTouchXY(event);
|
|
1302
|
-
activeAxis.current = void 0;
|
|
1303
|
-
}, []);
|
|
1304
|
-
var scrollWheel = React.useCallback(function(event) {
|
|
1305
|
-
shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
1306
|
-
}, []);
|
|
1307
|
-
var scrollTouchMove = React.useCallback(function(event) {
|
|
1308
|
-
shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
1309
|
-
}, []);
|
|
1310
|
-
React.useEffect(function() {
|
|
1311
|
-
lockStack.push(Style2);
|
|
1312
|
-
props.setCallbacks({
|
|
1313
|
-
onScrollCapture: scrollWheel,
|
|
1314
|
-
onWheelCapture: scrollWheel,
|
|
1315
|
-
onTouchMoveCapture: scrollTouchMove
|
|
1316
|
-
});
|
|
1317
|
-
document.addEventListener("wheel", shouldPrevent, nonPassive);
|
|
1318
|
-
document.addEventListener("touchmove", shouldPrevent, nonPassive);
|
|
1319
|
-
document.addEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
1320
|
-
return function() {
|
|
1321
|
-
lockStack = lockStack.filter(function(inst) {
|
|
1322
|
-
return inst !== Style2;
|
|
1323
|
-
});
|
|
1324
|
-
document.removeEventListener("wheel", shouldPrevent, nonPassive);
|
|
1325
|
-
document.removeEventListener("touchmove", shouldPrevent, nonPassive);
|
|
1326
|
-
document.removeEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
1327
|
-
};
|
|
1328
|
-
}, []);
|
|
1329
|
-
var removeScrollBar = props.removeScrollBar, inert = props.inert;
|
|
1330
|
-
return React.createElement(
|
|
1331
|
-
React.Fragment,
|
|
1332
|
-
null,
|
|
1333
|
-
inert ? React.createElement(Style2, { styles: generateStyle(id) }) : null,
|
|
1334
|
-
removeScrollBar ? React.createElement(RemoveScrollBar, { gapMode: props.gapMode }) : null
|
|
1335
|
-
);
|
|
1336
|
-
}
|
|
1337
|
-
function getOutermostShadowParent(node) {
|
|
1338
|
-
var shadowParent = null;
|
|
1339
|
-
while (node !== null) {
|
|
1340
|
-
if (node instanceof ShadowRoot) {
|
|
1341
|
-
shadowParent = node.host;
|
|
1342
|
-
node = node.host;
|
|
1343
|
-
}
|
|
1344
|
-
node = node.parentNode;
|
|
1345
|
-
}
|
|
1346
|
-
return shadowParent;
|
|
1347
|
-
}
|
|
1348
|
-
const SideCar = exportSidecar(effectCar, RemoveScrollSideCar);
|
|
1349
|
-
var ReactRemoveScroll = React.forwardRef(function(props, ref) {
|
|
1350
|
-
return React.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: SideCar }));
|
|
1351
|
-
});
|
|
1352
|
-
ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
1353
|
-
export {
|
|
1354
|
-
Button as B,
|
|
1355
|
-
DismissableLayer as D,
|
|
1356
|
-
FocusScope as F,
|
|
1357
|
-
Portal as P,
|
|
1358
|
-
ReactRemoveScroll as R,
|
|
1359
|
-
VisuallyHidden as V,
|
|
1360
|
-
useFocusGuards as a,
|
|
1361
|
-
createCollection as c,
|
|
1362
|
-
hideOthers as h,
|
|
1363
|
-
useDirection as u
|
|
1364
|
-
};
|
|
1365
|
-
//# sourceMappingURL=Combination-BfufJFkX.js.map
|