pdyform 2.0.2 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -74
- package/package.json +9 -3
- package/packages/core/dist/chunk-6F4PWJZI.js +0 -0
- package/packages/core/dist/chunk-KA6QUMVR.js +158 -0
- package/packages/core/dist/chunk-REHKL5VH.js +76 -0
- package/packages/core/dist/formState.cjs +132 -78
- package/packages/core/dist/formState.d.cts +14 -10
- package/packages/core/dist/formState.d.ts +14 -10
- package/packages/core/dist/formState.js +4 -12
- package/packages/core/dist/index.cjs +138 -78
- package/packages/core/dist/index.d.cts +4 -3
- package/packages/core/dist/index.d.ts +4 -3
- package/packages/core/dist/index.js +11 -12
- package/packages/core/dist/types.d.cts +17 -5
- package/packages/core/dist/types.d.ts +17 -5
- package/packages/core/dist/types.js +1 -0
- package/packages/core/dist/utils.cjs +78 -19
- package/packages/core/dist/utils.d.cts +17 -5
- package/packages/core/dist/utils.d.ts +17 -5
- package/packages/core/dist/utils.js +7 -1
- package/packages/react/dist/index.cjs +1 -461
- package/packages/react/dist/index.d.cts +33 -2
- package/packages/react/dist/index.d.ts +33 -2
- package/packages/react/dist/index.js +1 -411
- package/packages/vue/dist/index.d.ts +51 -39
- package/packages/vue/dist/index.js +1 -28
- package/packages/vue/dist/index.mjs +630 -6527
- package/eslint.config.mjs +0 -53
- package/example/README.md +0 -36
- package/example/react-demo/index.html +0 -12
- package/example/react-demo/node_modules/.bin/browserslist +0 -17
- package/example/react-demo/node_modules/.bin/tsc +0 -17
- package/example/react-demo/node_modules/.bin/tsserver +0 -17
- package/example/react-demo/node_modules/.bin/vite +0 -17
- package/example/react-demo/node_modules/.vite/deps/@radix-ui_react-checkbox.js +0 -300
- package/example/react-demo/node_modules/.vite/deps/@radix-ui_react-checkbox.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/@radix-ui_react-label.js +0 -194
- package/example/react-demo/node_modules/.vite/deps/@radix-ui_react-label.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/@radix-ui_react-radio-group.js +0 -530
- package/example/react-demo/node_modules/.vite/deps/@radix-ui_react-radio-group.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/@radix-ui_react-select.js +0 -4808
- package/example/react-demo/node_modules/.vite/deps/@radix-ui_react-select.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/_metadata.json +0 -115
- package/example/react-demo/node_modules/.vite/deps/chunk-3D5PZ6F6.js +0 -49
- package/example/react-demo/node_modules/.vite/deps/chunk-3D5PZ6F6.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/chunk-5Q2RBQLA.js +0 -127
- package/example/react-demo/node_modules/.vite/deps/chunk-5Q2RBQLA.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/chunk-G3PMV62Z.js +0 -36
- package/example/react-demo/node_modules/.vite/deps/chunk-G3PMV62Z.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/chunk-GX7YZ5KV.js +0 -370
- package/example/react-demo/node_modules/.vite/deps/chunk-GX7YZ5KV.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/chunk-PUFJGYAC.js +0 -928
- package/example/react-demo/node_modules/.vite/deps/chunk-PUFJGYAC.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/chunk-SIU35MPB.js +0 -21
- package/example/react-demo/node_modules/.vite/deps/chunk-SIU35MPB.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/chunk-TOMGVNQP.js +0 -1906
- package/example/react-demo/node_modules/.vite/deps/chunk-TOMGVNQP.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/chunk-YYN6DZAU.js +0 -21628
- package/example/react-demo/node_modules/.vite/deps/chunk-YYN6DZAU.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/chunk-ZE5VSJFE.js +0 -144
- package/example/react-demo/node_modules/.vite/deps/chunk-ZE5VSJFE.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/class-variance-authority.js +0 -51
- package/example/react-demo/node_modules/.vite/deps/class-variance-authority.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/clsx.js +0 -10
- package/example/react-demo/node_modules/.vite/deps/clsx.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/lucide-react.js +0 -29725
- package/example/react-demo/node_modules/.vite/deps/lucide-react.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/package.json +0 -3
- package/example/react-demo/node_modules/.vite/deps/react-dom.js +0 -7
- package/example/react-demo/node_modules/.vite/deps/react-dom.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/react-dom_client.js +0 -39
- package/example/react-demo/node_modules/.vite/deps/react-dom_client.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/react.js +0 -6
- package/example/react-demo/node_modules/.vite/deps/react.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/react_jsx-dev-runtime.js +0 -913
- package/example/react-demo/node_modules/.vite/deps/react_jsx-dev-runtime.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/react_jsx-runtime.js +0 -7
- package/example/react-demo/node_modules/.vite/deps/react_jsx-runtime.js.map +0 -7
- package/example/react-demo/node_modules/.vite/deps/tailwind-merge.js +0 -2534
- package/example/react-demo/node_modules/.vite/deps/tailwind-merge.js.map +0 -7
- package/example/react-demo/package.json +0 -23
- package/example/react-demo/postcss.config.mjs +0 -6
- package/example/react-demo/src/App.tsx +0 -64
- package/example/react-demo/src/main.tsx +0 -10
- package/example/react-demo/src/styles.css +0 -102
- package/example/react-demo/tailwind.config.mjs +0 -50
- package/example/react-demo/tsconfig.json +0 -16
- package/example/react-demo/vite.config.ts +0 -14
- package/example/shared/defaultSchema.ts +0 -68
- package/example/vue-demo/index.html +0 -12
- package/example/vue-demo/node_modules/.bin/tsc +0 -17
- package/example/vue-demo/node_modules/.bin/tsserver +0 -17
- package/example/vue-demo/node_modules/.bin/vite +0 -17
- package/example/vue-demo/node_modules/.vite/deps/_metadata.json +0 -46
- package/example/vue-demo/node_modules/.vite/deps/chunk-PZ5AY32C.js +0 -10
- package/example/vue-demo/node_modules/.vite/deps/chunk-PZ5AY32C.js.map +0 -7
- package/example/vue-demo/node_modules/.vite/deps/chunk-TCXBSQ4M.js +0 -12877
- package/example/vue-demo/node_modules/.vite/deps/chunk-TCXBSQ4M.js.map +0 -7
- package/example/vue-demo/node_modules/.vite/deps/clsx.js +0 -22
- package/example/vue-demo/node_modules/.vite/deps/clsx.js.map +0 -7
- package/example/vue-demo/node_modules/.vite/deps/lucide-vue-next.js +0 -29720
- package/example/vue-demo/node_modules/.vite/deps/lucide-vue-next.js.map +0 -7
- package/example/vue-demo/node_modules/.vite/deps/package.json +0 -3
- package/example/vue-demo/node_modules/.vite/deps/radix-vue.js +0 -24321
- package/example/vue-demo/node_modules/.vite/deps/radix-vue.js.map +0 -7
- package/example/vue-demo/node_modules/.vite/deps/tailwind-merge.js +0 -2534
- package/example/vue-demo/node_modules/.vite/deps/tailwind-merge.js.map +0 -7
- package/example/vue-demo/node_modules/.vite/deps/vue.js +0 -348
- package/example/vue-demo/node_modules/.vite/deps/vue.js.map +0 -7
- package/example/vue-demo/package.json +0 -20
- package/example/vue-demo/postcss.config.mjs +0 -6
- package/example/vue-demo/src/App.vue +0 -61
- package/example/vue-demo/src/env.d.ts +0 -1
- package/example/vue-demo/src/main.ts +0 -5
- package/example/vue-demo/src/style.css +0 -102
- package/example/vue-demo/tailwind.config.mjs +0 -50
- package/example/vue-demo/tsconfig.json +0 -15
- package/example/vue-demo/vite.config.ts +0 -14
- package/packages/core/dist/chunk-TP3IHKWV.js +0 -69
- package/packages/core/dist/chunk-WEDHXOHH.js +0 -102
- package/packages/core/node_modules/.bin/api-extractor +0 -17
- package/packages/core/node_modules/.bin/esbuild +0 -14
- package/packages/core/node_modules/.bin/jiti +0 -17
- package/packages/core/node_modules/.bin/tsc +0 -17
- package/packages/core/node_modules/.bin/tsserver +0 -17
- package/packages/core/node_modules/.bin/tsup +0 -17
- package/packages/core/node_modules/.bin/tsup-node +0 -17
- package/packages/core/node_modules/.bin/vitest +0 -17
- package/packages/core/node_modules/.vite/vitest/results.json +0 -1
- package/packages/core/package.json +0 -37
- package/packages/core/src/formState.ts +0 -79
- package/packages/core/src/index.ts +0 -3
- package/packages/core/src/types.ts +0 -42
- package/packages/core/src/utils.ts +0 -104
- package/packages/core/test/formState.test.ts +0 -71
- package/packages/core/test/utils.test.ts +0 -178
- package/packages/core/tsconfig.json +0 -15
- package/packages/core/tsup.config.ts +0 -9
- package/packages/react/node_modules/.bin/api-extractor +0 -17
- package/packages/react/node_modules/.bin/browserslist +0 -17
- package/packages/react/node_modules/.bin/esbuild +0 -14
- package/packages/react/node_modules/.bin/jiti +0 -17
- package/packages/react/node_modules/.bin/tsc +0 -17
- package/packages/react/node_modules/.bin/tsserver +0 -17
- package/packages/react/node_modules/.bin/tsup +0 -17
- package/packages/react/node_modules/.bin/tsup-node +0 -17
- package/packages/react/node_modules/.bin/vite +0 -17
- package/packages/react/node_modules/.bin/vitest +0 -17
- package/packages/react/node_modules/.vite/vitest/results.json +0 -1
- package/packages/react/package.json +0 -57
- package/packages/react/postcss.config.mjs +0 -6
- package/packages/react/src/DynamicForm.tsx +0 -69
- package/packages/react/src/FormFieldRenderer.tsx +0 -50
- package/packages/react/src/components/Checkbox.tsx +0 -28
- package/packages/react/src/components/CheckboxRenderer.tsx +0 -37
- package/packages/react/src/components/Input.tsx +0 -24
- package/packages/react/src/components/InputRenderer.tsx +0 -25
- package/packages/react/src/components/Label.tsx +0 -24
- package/packages/react/src/components/RadioGroup.tsx +0 -42
- package/packages/react/src/components/RadioRenderer.tsx +0 -29
- package/packages/react/src/components/Select.tsx +0 -93
- package/packages/react/src/components/SelectRenderer.tsx +0 -27
- package/packages/react/src/components/Textarea.tsx +0 -23
- package/packages/react/src/components/TextareaRenderer.tsx +0 -17
- package/packages/react/src/components/index.ts +0 -55
- package/packages/react/src/components/types.ts +0 -17
- package/packages/react/src/index.tsx +0 -3
- package/packages/react/src/utils.ts +0 -7
- package/packages/react/tailwind.config.mjs +0 -10
- package/packages/react/test/DynamicForm.test.tsx +0 -25
- package/packages/react/test/FormFieldRenderer.test.tsx +0 -127
- package/packages/react/tsconfig.json +0 -15
- package/packages/react/vitest.config.ts +0 -16
- package/packages/vue/node_modules/.bin/rollup +0 -17
- package/packages/vue/node_modules/.bin/tsc +0 -17
- package/packages/vue/node_modules/.bin/tsserver +0 -17
- package/packages/vue/node_modules/.bin/vite +0 -17
- package/packages/vue/node_modules/.bin/vitest +0 -17
- package/packages/vue/node_modules/.bin/vue-tsc +0 -17
- package/packages/vue/node_modules/.vite/vitest/results.json +0 -1
- package/packages/vue/node_modules/.vue-global-types/vue_3.5_0_0_0.d.ts +0 -118
- package/packages/vue/node_modules/.vue-global-types/vue_3.5_false.d.ts +0 -128
- package/packages/vue/package.json +0 -53
- package/packages/vue/postcss.config.mjs +0 -6
- package/packages/vue/src/DynamicForm.vue +0 -63
- package/packages/vue/src/FormFieldRenderer.vue +0 -70
- package/packages/vue/src/components/Checkbox.vue +0 -28
- package/packages/vue/src/components/CheckboxRenderer.vue +0 -35
- package/packages/vue/src/components/Input.vue +0 -21
- package/packages/vue/src/components/InputRenderer.vue +0 -24
- package/packages/vue/src/components/Label.vue +0 -21
- package/packages/vue/src/components/RadioGroup.vue +0 -30
- package/packages/vue/src/components/RadioGroupItem.vue +0 -26
- package/packages/vue/src/components/RadioRenderer.vue +0 -24
- package/packages/vue/src/components/Select.vue +0 -40
- package/packages/vue/src/components/SelectContent.vue +0 -38
- package/packages/vue/src/components/SelectItem.vue +0 -43
- package/packages/vue/src/components/SelectRenderer.vue +0 -30
- package/packages/vue/src/components/SelectTrigger.vue +0 -27
- package/packages/vue/src/components/Textarea.vue +0 -19
- package/packages/vue/src/components/TextareaRenderer.vue +0 -18
- package/packages/vue/src/components/index.ts +0 -24
- package/packages/vue/src/env.d.ts +0 -7
- package/packages/vue/src/fieldComponentMap.ts +0 -34
- package/packages/vue/src/index.ts +0 -4
- package/packages/vue/src/utils.ts +0 -6
- package/packages/vue/tailwind.config.mjs +0 -10
- package/packages/vue/test/DynamicForm.test.ts +0 -19
- package/packages/vue/test/FormFieldRenderer.test.ts +0 -133
- package/packages/vue/tsconfig.json +0 -16
- package/packages/vue/vite.config.ts +0 -29
- package/packages/vue/vitest.config.ts +0 -16
- package/pnpm-workspace.yaml +0 -4
- package/tsconfig.json +0 -21
- package/turbo.json +0 -25
|
@@ -1,4808 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
createCollection,
|
|
4
|
-
useCallbackRef,
|
|
5
|
-
useDirection,
|
|
6
|
-
useId
|
|
7
|
-
} from "./chunk-5Q2RBQLA.js";
|
|
8
|
-
import {
|
|
9
|
-
Primitive,
|
|
10
|
-
composeEventHandlers,
|
|
11
|
-
createContextScope,
|
|
12
|
-
createSlot,
|
|
13
|
-
dispatchDiscreteCustomEvent,
|
|
14
|
-
useControllableState,
|
|
15
|
-
useLayoutEffect2,
|
|
16
|
-
usePrevious,
|
|
17
|
-
useSize
|
|
18
|
-
} from "./chunk-GX7YZ5KV.js";
|
|
19
|
-
import {
|
|
20
|
-
useComposedRefs
|
|
21
|
-
} from "./chunk-3D5PZ6F6.js";
|
|
22
|
-
import {
|
|
23
|
-
require_react_dom
|
|
24
|
-
} from "./chunk-YYN6DZAU.js";
|
|
25
|
-
import {
|
|
26
|
-
require_jsx_runtime
|
|
27
|
-
} from "./chunk-PUFJGYAC.js";
|
|
28
|
-
import {
|
|
29
|
-
require_react
|
|
30
|
-
} from "./chunk-TOMGVNQP.js";
|
|
31
|
-
import {
|
|
32
|
-
__toESM
|
|
33
|
-
} from "./chunk-G3PMV62Z.js";
|
|
34
|
-
|
|
35
|
-
// ../../node_modules/.pnpm/@radix-ui+react-select@2.2.6_@types+react-dom@18.3.7_@types+react@18.3.28__@types+react@18.3._w7c5ofadsrsxh4bgf3womst7bq/node_modules/@radix-ui/react-select/dist/index.mjs
|
|
36
|
-
var React19 = __toESM(require_react(), 1);
|
|
37
|
-
var ReactDOM3 = __toESM(require_react_dom(), 1);
|
|
38
|
-
|
|
39
|
-
// ../../node_modules/.pnpm/@radix-ui+number@1.1.1/node_modules/@radix-ui/number/dist/index.mjs
|
|
40
|
-
function clamp(value, [min2, max2]) {
|
|
41
|
-
return Math.min(max2, Math.max(min2, value));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// ../../node_modules/.pnpm/@radix-ui+react-dismissable-layer@1.1.11_@types+react-dom@18.3.7_@types+react@18.3.28__@types_5r3ijs5anntdc77t4ssdlrvsta/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
|
|
45
|
-
var React2 = __toESM(require_react(), 1);
|
|
46
|
-
|
|
47
|
-
// ../../node_modules/.pnpm/@radix-ui+react-use-escape-keydown@1.1.1_@types+react@18.3.28_react@18.3.1/node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs
|
|
48
|
-
var React = __toESM(require_react(), 1);
|
|
49
|
-
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
50
|
-
const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
|
|
51
|
-
React.useEffect(() => {
|
|
52
|
-
const handleKeyDown = (event) => {
|
|
53
|
-
if (event.key === "Escape") {
|
|
54
|
-
onEscapeKeyDown(event);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
58
|
-
return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
59
|
-
}, [onEscapeKeyDown, ownerDocument]);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// ../../node_modules/.pnpm/@radix-ui+react-dismissable-layer@1.1.11_@types+react-dom@18.3.7_@types+react@18.3.28__@types_5r3ijs5anntdc77t4ssdlrvsta/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
|
|
63
|
-
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
|
|
64
|
-
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
65
|
-
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
66
|
-
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
67
|
-
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
68
|
-
var originalBodyPointerEvents;
|
|
69
|
-
var DismissableLayerContext = React2.createContext({
|
|
70
|
-
layers: /* @__PURE__ */ new Set(),
|
|
71
|
-
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
72
|
-
branches: /* @__PURE__ */ new Set()
|
|
73
|
-
});
|
|
74
|
-
var DismissableLayer = React2.forwardRef(
|
|
75
|
-
(props, forwardedRef) => {
|
|
76
|
-
const {
|
|
77
|
-
disableOutsidePointerEvents = false,
|
|
78
|
-
onEscapeKeyDown,
|
|
79
|
-
onPointerDownOutside,
|
|
80
|
-
onFocusOutside,
|
|
81
|
-
onInteractOutside,
|
|
82
|
-
onDismiss,
|
|
83
|
-
...layerProps
|
|
84
|
-
} = props;
|
|
85
|
-
const context = React2.useContext(DismissableLayerContext);
|
|
86
|
-
const [node, setNode] = React2.useState(null);
|
|
87
|
-
const ownerDocument = (node == null ? void 0 : node.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document);
|
|
88
|
-
const [, force] = React2.useState({});
|
|
89
|
-
const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
|
|
90
|
-
const layers = Array.from(context.layers);
|
|
91
|
-
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
|
92
|
-
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
|
93
|
-
const index2 = node ? layers.indexOf(node) : -1;
|
|
94
|
-
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
95
|
-
const isPointerEventsEnabled = index2 >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
96
|
-
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
97
|
-
const target = event.target;
|
|
98
|
-
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
99
|
-
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
100
|
-
onPointerDownOutside == null ? void 0 : onPointerDownOutside(event);
|
|
101
|
-
onInteractOutside == null ? void 0 : onInteractOutside(event);
|
|
102
|
-
if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
|
|
103
|
-
}, ownerDocument);
|
|
104
|
-
const focusOutside = useFocusOutside((event) => {
|
|
105
|
-
const target = event.target;
|
|
106
|
-
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
107
|
-
if (isFocusInBranch) return;
|
|
108
|
-
onFocusOutside == null ? void 0 : onFocusOutside(event);
|
|
109
|
-
onInteractOutside == null ? void 0 : onInteractOutside(event);
|
|
110
|
-
if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
|
|
111
|
-
}, ownerDocument);
|
|
112
|
-
useEscapeKeydown((event) => {
|
|
113
|
-
const isHighestLayer = index2 === context.layers.size - 1;
|
|
114
|
-
if (!isHighestLayer) return;
|
|
115
|
-
onEscapeKeyDown == null ? void 0 : onEscapeKeyDown(event);
|
|
116
|
-
if (!event.defaultPrevented && onDismiss) {
|
|
117
|
-
event.preventDefault();
|
|
118
|
-
onDismiss();
|
|
119
|
-
}
|
|
120
|
-
}, ownerDocument);
|
|
121
|
-
React2.useEffect(() => {
|
|
122
|
-
if (!node) return;
|
|
123
|
-
if (disableOutsidePointerEvents) {
|
|
124
|
-
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
125
|
-
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
126
|
-
ownerDocument.body.style.pointerEvents = "none";
|
|
127
|
-
}
|
|
128
|
-
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
129
|
-
}
|
|
130
|
-
context.layers.add(node);
|
|
131
|
-
dispatchUpdate();
|
|
132
|
-
return () => {
|
|
133
|
-
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
134
|
-
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
138
|
-
React2.useEffect(() => {
|
|
139
|
-
return () => {
|
|
140
|
-
if (!node) return;
|
|
141
|
-
context.layers.delete(node);
|
|
142
|
-
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
143
|
-
dispatchUpdate();
|
|
144
|
-
};
|
|
145
|
-
}, [node, context]);
|
|
146
|
-
React2.useEffect(() => {
|
|
147
|
-
const handleUpdate = () => force({});
|
|
148
|
-
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
149
|
-
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
150
|
-
}, []);
|
|
151
|
-
return (0, import_jsx_runtime.jsx)(
|
|
152
|
-
Primitive.div,
|
|
153
|
-
{
|
|
154
|
-
...layerProps,
|
|
155
|
-
ref: composedRefs,
|
|
156
|
-
style: {
|
|
157
|
-
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
158
|
-
...props.style
|
|
159
|
-
},
|
|
160
|
-
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
161
|
-
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
162
|
-
onPointerDownCapture: composeEventHandlers(
|
|
163
|
-
props.onPointerDownCapture,
|
|
164
|
-
pointerDownOutside.onPointerDownCapture
|
|
165
|
-
)
|
|
166
|
-
}
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
);
|
|
170
|
-
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
171
|
-
var BRANCH_NAME = "DismissableLayerBranch";
|
|
172
|
-
var DismissableLayerBranch = React2.forwardRef((props, forwardedRef) => {
|
|
173
|
-
const context = React2.useContext(DismissableLayerContext);
|
|
174
|
-
const ref = React2.useRef(null);
|
|
175
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
176
|
-
React2.useEffect(() => {
|
|
177
|
-
const node = ref.current;
|
|
178
|
-
if (node) {
|
|
179
|
-
context.branches.add(node);
|
|
180
|
-
return () => {
|
|
181
|
-
context.branches.delete(node);
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
}, [context.branches]);
|
|
185
|
-
return (0, import_jsx_runtime.jsx)(Primitive.div, { ...props, ref: composedRefs });
|
|
186
|
-
});
|
|
187
|
-
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
188
|
-
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
189
|
-
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
190
|
-
const isPointerInsideReactTreeRef = React2.useRef(false);
|
|
191
|
-
const handleClickRef = React2.useRef(() => {
|
|
192
|
-
});
|
|
193
|
-
React2.useEffect(() => {
|
|
194
|
-
const handlePointerDown = (event) => {
|
|
195
|
-
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
196
|
-
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
197
|
-
handleAndDispatchCustomEvent(
|
|
198
|
-
POINTER_DOWN_OUTSIDE,
|
|
199
|
-
handlePointerDownOutside,
|
|
200
|
-
eventDetail,
|
|
201
|
-
{ discrete: true }
|
|
202
|
-
);
|
|
203
|
-
};
|
|
204
|
-
var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;
|
|
205
|
-
const eventDetail = { originalEvent: event };
|
|
206
|
-
if (event.pointerType === "touch") {
|
|
207
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
208
|
-
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
209
|
-
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
210
|
-
} else {
|
|
211
|
-
handleAndDispatchPointerDownOutsideEvent2();
|
|
212
|
-
}
|
|
213
|
-
} else {
|
|
214
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
215
|
-
}
|
|
216
|
-
isPointerInsideReactTreeRef.current = false;
|
|
217
|
-
};
|
|
218
|
-
const timerId = window.setTimeout(() => {
|
|
219
|
-
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
220
|
-
}, 0);
|
|
221
|
-
return () => {
|
|
222
|
-
window.clearTimeout(timerId);
|
|
223
|
-
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
224
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
225
|
-
};
|
|
226
|
-
}, [ownerDocument, handlePointerDownOutside]);
|
|
227
|
-
return {
|
|
228
|
-
// ensures we check React component tree (not just DOM tree)
|
|
229
|
-
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
function useFocusOutside(onFocusOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
233
|
-
const handleFocusOutside = useCallbackRef(onFocusOutside);
|
|
234
|
-
const isFocusInsideReactTreeRef = React2.useRef(false);
|
|
235
|
-
React2.useEffect(() => {
|
|
236
|
-
const handleFocus = (event) => {
|
|
237
|
-
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
238
|
-
const eventDetail = { originalEvent: event };
|
|
239
|
-
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
240
|
-
discrete: false
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
ownerDocument.addEventListener("focusin", handleFocus);
|
|
245
|
-
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
|
246
|
-
}, [ownerDocument, handleFocusOutside]);
|
|
247
|
-
return {
|
|
248
|
-
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
|
|
249
|
-
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
function dispatchUpdate() {
|
|
253
|
-
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
254
|
-
document.dispatchEvent(event);
|
|
255
|
-
}
|
|
256
|
-
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
257
|
-
const target = detail.originalEvent.target;
|
|
258
|
-
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
259
|
-
if (handler) target.addEventListener(name, handler, { once: true });
|
|
260
|
-
if (discrete) {
|
|
261
|
-
dispatchDiscreteCustomEvent(target, event);
|
|
262
|
-
} else {
|
|
263
|
-
target.dispatchEvent(event);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
// ../../node_modules/.pnpm/@radix-ui+react-focus-guards@1.1.3_@types+react@18.3.28_react@18.3.1/node_modules/@radix-ui/react-focus-guards/dist/index.mjs
|
|
268
|
-
var React3 = __toESM(require_react(), 1);
|
|
269
|
-
var count = 0;
|
|
270
|
-
function useFocusGuards() {
|
|
271
|
-
React3.useEffect(() => {
|
|
272
|
-
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
|
|
273
|
-
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
|
|
274
|
-
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
|
|
275
|
-
count++;
|
|
276
|
-
return () => {
|
|
277
|
-
if (count === 1) {
|
|
278
|
-
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
|
|
279
|
-
}
|
|
280
|
-
count--;
|
|
281
|
-
};
|
|
282
|
-
}, []);
|
|
283
|
-
}
|
|
284
|
-
function createFocusGuard() {
|
|
285
|
-
const element = document.createElement("span");
|
|
286
|
-
element.setAttribute("data-radix-focus-guard", "");
|
|
287
|
-
element.tabIndex = 0;
|
|
288
|
-
element.style.outline = "none";
|
|
289
|
-
element.style.opacity = "0";
|
|
290
|
-
element.style.position = "fixed";
|
|
291
|
-
element.style.pointerEvents = "none";
|
|
292
|
-
return element;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// ../../node_modules/.pnpm/@radix-ui+react-focus-scope@1.1.7_@types+react-dom@18.3.7_@types+react@18.3.28__@types+react@_rmxv7pcoevwqhznywfxboa7m4e/node_modules/@radix-ui/react-focus-scope/dist/index.mjs
|
|
296
|
-
var React4 = __toESM(require_react(), 1);
|
|
297
|
-
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
|
|
298
|
-
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
299
|
-
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
300
|
-
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
301
|
-
var FOCUS_SCOPE_NAME = "FocusScope";
|
|
302
|
-
var FocusScope = React4.forwardRef((props, forwardedRef) => {
|
|
303
|
-
const {
|
|
304
|
-
loop = false,
|
|
305
|
-
trapped = false,
|
|
306
|
-
onMountAutoFocus: onMountAutoFocusProp,
|
|
307
|
-
onUnmountAutoFocus: onUnmountAutoFocusProp,
|
|
308
|
-
...scopeProps
|
|
309
|
-
} = props;
|
|
310
|
-
const [container, setContainer] = React4.useState(null);
|
|
311
|
-
const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp);
|
|
312
|
-
const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp);
|
|
313
|
-
const lastFocusedElementRef = React4.useRef(null);
|
|
314
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
|
|
315
|
-
const focusScope = React4.useRef({
|
|
316
|
-
paused: false,
|
|
317
|
-
pause() {
|
|
318
|
-
this.paused = true;
|
|
319
|
-
},
|
|
320
|
-
resume() {
|
|
321
|
-
this.paused = false;
|
|
322
|
-
}
|
|
323
|
-
}).current;
|
|
324
|
-
React4.useEffect(() => {
|
|
325
|
-
if (trapped) {
|
|
326
|
-
let handleFocusIn2 = function(event) {
|
|
327
|
-
if (focusScope.paused || !container) return;
|
|
328
|
-
const target = event.target;
|
|
329
|
-
if (container.contains(target)) {
|
|
330
|
-
lastFocusedElementRef.current = target;
|
|
331
|
-
} else {
|
|
332
|
-
focus(lastFocusedElementRef.current, { select: true });
|
|
333
|
-
}
|
|
334
|
-
}, handleFocusOut2 = function(event) {
|
|
335
|
-
if (focusScope.paused || !container) return;
|
|
336
|
-
const relatedTarget = event.relatedTarget;
|
|
337
|
-
if (relatedTarget === null) return;
|
|
338
|
-
if (!container.contains(relatedTarget)) {
|
|
339
|
-
focus(lastFocusedElementRef.current, { select: true });
|
|
340
|
-
}
|
|
341
|
-
}, handleMutations2 = function(mutations) {
|
|
342
|
-
const focusedElement = document.activeElement;
|
|
343
|
-
if (focusedElement !== document.body) return;
|
|
344
|
-
for (const mutation of mutations) {
|
|
345
|
-
if (mutation.removedNodes.length > 0) focus(container);
|
|
346
|
-
}
|
|
347
|
-
};
|
|
348
|
-
var handleFocusIn = handleFocusIn2, handleFocusOut = handleFocusOut2, handleMutations = handleMutations2;
|
|
349
|
-
document.addEventListener("focusin", handleFocusIn2);
|
|
350
|
-
document.addEventListener("focusout", handleFocusOut2);
|
|
351
|
-
const mutationObserver = new MutationObserver(handleMutations2);
|
|
352
|
-
if (container) mutationObserver.observe(container, { childList: true, subtree: true });
|
|
353
|
-
return () => {
|
|
354
|
-
document.removeEventListener("focusin", handleFocusIn2);
|
|
355
|
-
document.removeEventListener("focusout", handleFocusOut2);
|
|
356
|
-
mutationObserver.disconnect();
|
|
357
|
-
};
|
|
358
|
-
}
|
|
359
|
-
}, [trapped, container, focusScope.paused]);
|
|
360
|
-
React4.useEffect(() => {
|
|
361
|
-
if (container) {
|
|
362
|
-
focusScopesStack.add(focusScope);
|
|
363
|
-
const previouslyFocusedElement = document.activeElement;
|
|
364
|
-
const hasFocusedCandidate = container.contains(previouslyFocusedElement);
|
|
365
|
-
if (!hasFocusedCandidate) {
|
|
366
|
-
const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
|
|
367
|
-
container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
368
|
-
container.dispatchEvent(mountEvent);
|
|
369
|
-
if (!mountEvent.defaultPrevented) {
|
|
370
|
-
focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
|
|
371
|
-
if (document.activeElement === previouslyFocusedElement) {
|
|
372
|
-
focus(container);
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
return () => {
|
|
377
|
-
container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
378
|
-
setTimeout(() => {
|
|
379
|
-
const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
|
|
380
|
-
container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
381
|
-
container.dispatchEvent(unmountEvent);
|
|
382
|
-
if (!unmountEvent.defaultPrevented) {
|
|
383
|
-
focus(previouslyFocusedElement ?? document.body, { select: true });
|
|
384
|
-
}
|
|
385
|
-
container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
386
|
-
focusScopesStack.remove(focusScope);
|
|
387
|
-
}, 0);
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
}, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
|
|
391
|
-
const handleKeyDown = React4.useCallback(
|
|
392
|
-
(event) => {
|
|
393
|
-
if (!loop && !trapped) return;
|
|
394
|
-
if (focusScope.paused) return;
|
|
395
|
-
const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
396
|
-
const focusedElement = document.activeElement;
|
|
397
|
-
if (isTabKey && focusedElement) {
|
|
398
|
-
const container2 = event.currentTarget;
|
|
399
|
-
const [first, last] = getTabbableEdges(container2);
|
|
400
|
-
const hasTabbableElementsInside = first && last;
|
|
401
|
-
if (!hasTabbableElementsInside) {
|
|
402
|
-
if (focusedElement === container2) event.preventDefault();
|
|
403
|
-
} else {
|
|
404
|
-
if (!event.shiftKey && focusedElement === last) {
|
|
405
|
-
event.preventDefault();
|
|
406
|
-
if (loop) focus(first, { select: true });
|
|
407
|
-
} else if (event.shiftKey && focusedElement === first) {
|
|
408
|
-
event.preventDefault();
|
|
409
|
-
if (loop) focus(last, { select: true });
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
},
|
|
414
|
-
[loop, trapped, focusScope.paused]
|
|
415
|
-
);
|
|
416
|
-
return (0, import_jsx_runtime2.jsx)(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
417
|
-
});
|
|
418
|
-
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
419
|
-
function focusFirst(candidates, { select = false } = {}) {
|
|
420
|
-
const previouslyFocusedElement = document.activeElement;
|
|
421
|
-
for (const candidate of candidates) {
|
|
422
|
-
focus(candidate, { select });
|
|
423
|
-
if (document.activeElement !== previouslyFocusedElement) return;
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
function getTabbableEdges(container) {
|
|
427
|
-
const candidates = getTabbableCandidates(container);
|
|
428
|
-
const first = findVisible(candidates, container);
|
|
429
|
-
const last = findVisible(candidates.reverse(), container);
|
|
430
|
-
return [first, last];
|
|
431
|
-
}
|
|
432
|
-
function getTabbableCandidates(container) {
|
|
433
|
-
const nodes = [];
|
|
434
|
-
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
435
|
-
acceptNode: (node) => {
|
|
436
|
-
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
437
|
-
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
|
|
438
|
-
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
439
|
-
}
|
|
440
|
-
});
|
|
441
|
-
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
442
|
-
return nodes;
|
|
443
|
-
}
|
|
444
|
-
function findVisible(elements, container) {
|
|
445
|
-
for (const element of elements) {
|
|
446
|
-
if (!isHidden(element, { upTo: container })) return element;
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
function isHidden(node, { upTo }) {
|
|
450
|
-
if (getComputedStyle(node).visibility === "hidden") return true;
|
|
451
|
-
while (node) {
|
|
452
|
-
if (upTo !== void 0 && node === upTo) return false;
|
|
453
|
-
if (getComputedStyle(node).display === "none") return true;
|
|
454
|
-
node = node.parentElement;
|
|
455
|
-
}
|
|
456
|
-
return false;
|
|
457
|
-
}
|
|
458
|
-
function isSelectableInput(element) {
|
|
459
|
-
return element instanceof HTMLInputElement && "select" in element;
|
|
460
|
-
}
|
|
461
|
-
function focus(element, { select = false } = {}) {
|
|
462
|
-
if (element && element.focus) {
|
|
463
|
-
const previouslyFocusedElement = document.activeElement;
|
|
464
|
-
element.focus({ preventScroll: true });
|
|
465
|
-
if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
|
|
466
|
-
element.select();
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
var focusScopesStack = createFocusScopesStack();
|
|
470
|
-
function createFocusScopesStack() {
|
|
471
|
-
let stack = [];
|
|
472
|
-
return {
|
|
473
|
-
add(focusScope) {
|
|
474
|
-
const activeFocusScope = stack[0];
|
|
475
|
-
if (focusScope !== activeFocusScope) {
|
|
476
|
-
activeFocusScope == null ? void 0 : activeFocusScope.pause();
|
|
477
|
-
}
|
|
478
|
-
stack = arrayRemove(stack, focusScope);
|
|
479
|
-
stack.unshift(focusScope);
|
|
480
|
-
},
|
|
481
|
-
remove(focusScope) {
|
|
482
|
-
var _a;
|
|
483
|
-
stack = arrayRemove(stack, focusScope);
|
|
484
|
-
(_a = stack[0]) == null ? void 0 : _a.resume();
|
|
485
|
-
}
|
|
486
|
-
};
|
|
487
|
-
}
|
|
488
|
-
function arrayRemove(array, item) {
|
|
489
|
-
const updatedArray = [...array];
|
|
490
|
-
const index2 = updatedArray.indexOf(item);
|
|
491
|
-
if (index2 !== -1) {
|
|
492
|
-
updatedArray.splice(index2, 1);
|
|
493
|
-
}
|
|
494
|
-
return updatedArray;
|
|
495
|
-
}
|
|
496
|
-
function removeLinks(items) {
|
|
497
|
-
return items.filter((item) => item.tagName !== "A");
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
// ../../node_modules/.pnpm/@radix-ui+react-popper@1.2.8_@types+react-dom@18.3.7_@types+react@18.3.28__@types+react@18.3._77iomgpzr7j45nth4ka2sx4zcq/node_modules/@radix-ui/react-popper/dist/index.mjs
|
|
501
|
-
var React7 = __toESM(require_react(), 1);
|
|
502
|
-
|
|
503
|
-
// ../../node_modules/.pnpm/@floating-ui+utils@0.2.11/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
|
|
504
|
-
var sides = ["top", "right", "bottom", "left"];
|
|
505
|
-
var alignments = ["start", "end"];
|
|
506
|
-
var placements = sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
|
|
507
|
-
var min = Math.min;
|
|
508
|
-
var max = Math.max;
|
|
509
|
-
var round = Math.round;
|
|
510
|
-
var floor = Math.floor;
|
|
511
|
-
var createCoords = (v) => ({
|
|
512
|
-
x: v,
|
|
513
|
-
y: v
|
|
514
|
-
});
|
|
515
|
-
var oppositeSideMap = {
|
|
516
|
-
left: "right",
|
|
517
|
-
right: "left",
|
|
518
|
-
bottom: "top",
|
|
519
|
-
top: "bottom"
|
|
520
|
-
};
|
|
521
|
-
function clamp2(start, value, end) {
|
|
522
|
-
return max(start, min(value, end));
|
|
523
|
-
}
|
|
524
|
-
function evaluate(value, param) {
|
|
525
|
-
return typeof value === "function" ? value(param) : value;
|
|
526
|
-
}
|
|
527
|
-
function getSide(placement) {
|
|
528
|
-
return placement.split("-")[0];
|
|
529
|
-
}
|
|
530
|
-
function getAlignment(placement) {
|
|
531
|
-
return placement.split("-")[1];
|
|
532
|
-
}
|
|
533
|
-
function getOppositeAxis(axis) {
|
|
534
|
-
return axis === "x" ? "y" : "x";
|
|
535
|
-
}
|
|
536
|
-
function getAxisLength(axis) {
|
|
537
|
-
return axis === "y" ? "height" : "width";
|
|
538
|
-
}
|
|
539
|
-
function getSideAxis(placement) {
|
|
540
|
-
const firstChar = placement[0];
|
|
541
|
-
return firstChar === "t" || firstChar === "b" ? "y" : "x";
|
|
542
|
-
}
|
|
543
|
-
function getAlignmentAxis(placement) {
|
|
544
|
-
return getOppositeAxis(getSideAxis(placement));
|
|
545
|
-
}
|
|
546
|
-
function getAlignmentSides(placement, rects, rtl) {
|
|
547
|
-
if (rtl === void 0) {
|
|
548
|
-
rtl = false;
|
|
549
|
-
}
|
|
550
|
-
const alignment = getAlignment(placement);
|
|
551
|
-
const alignmentAxis = getAlignmentAxis(placement);
|
|
552
|
-
const length = getAxisLength(alignmentAxis);
|
|
553
|
-
let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
|
|
554
|
-
if (rects.reference[length] > rects.floating[length]) {
|
|
555
|
-
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
556
|
-
}
|
|
557
|
-
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
558
|
-
}
|
|
559
|
-
function getExpandedPlacements(placement) {
|
|
560
|
-
const oppositePlacement = getOppositePlacement(placement);
|
|
561
|
-
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
562
|
-
}
|
|
563
|
-
function getOppositeAlignmentPlacement(placement) {
|
|
564
|
-
return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
|
|
565
|
-
}
|
|
566
|
-
var lrPlacement = ["left", "right"];
|
|
567
|
-
var rlPlacement = ["right", "left"];
|
|
568
|
-
var tbPlacement = ["top", "bottom"];
|
|
569
|
-
var btPlacement = ["bottom", "top"];
|
|
570
|
-
function getSideList(side, isStart, rtl) {
|
|
571
|
-
switch (side) {
|
|
572
|
-
case "top":
|
|
573
|
-
case "bottom":
|
|
574
|
-
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
575
|
-
return isStart ? lrPlacement : rlPlacement;
|
|
576
|
-
case "left":
|
|
577
|
-
case "right":
|
|
578
|
-
return isStart ? tbPlacement : btPlacement;
|
|
579
|
-
default:
|
|
580
|
-
return [];
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
584
|
-
const alignment = getAlignment(placement);
|
|
585
|
-
let list = getSideList(getSide(placement), direction === "start", rtl);
|
|
586
|
-
if (alignment) {
|
|
587
|
-
list = list.map((side) => side + "-" + alignment);
|
|
588
|
-
if (flipAlignment) {
|
|
589
|
-
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
return list;
|
|
593
|
-
}
|
|
594
|
-
function getOppositePlacement(placement) {
|
|
595
|
-
const side = getSide(placement);
|
|
596
|
-
return oppositeSideMap[side] + placement.slice(side.length);
|
|
597
|
-
}
|
|
598
|
-
function expandPaddingObject(padding) {
|
|
599
|
-
return {
|
|
600
|
-
top: 0,
|
|
601
|
-
right: 0,
|
|
602
|
-
bottom: 0,
|
|
603
|
-
left: 0,
|
|
604
|
-
...padding
|
|
605
|
-
};
|
|
606
|
-
}
|
|
607
|
-
function getPaddingObject(padding) {
|
|
608
|
-
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
|
609
|
-
top: padding,
|
|
610
|
-
right: padding,
|
|
611
|
-
bottom: padding,
|
|
612
|
-
left: padding
|
|
613
|
-
};
|
|
614
|
-
}
|
|
615
|
-
function rectToClientRect(rect) {
|
|
616
|
-
const {
|
|
617
|
-
x,
|
|
618
|
-
y,
|
|
619
|
-
width,
|
|
620
|
-
height
|
|
621
|
-
} = rect;
|
|
622
|
-
return {
|
|
623
|
-
width,
|
|
624
|
-
height,
|
|
625
|
-
top: y,
|
|
626
|
-
left: x,
|
|
627
|
-
right: x + width,
|
|
628
|
-
bottom: y + height,
|
|
629
|
-
x,
|
|
630
|
-
y
|
|
631
|
-
};
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
// ../../node_modules/.pnpm/@floating-ui+core@1.7.5/node_modules/@floating-ui/core/dist/floating-ui.core.mjs
|
|
635
|
-
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
636
|
-
let {
|
|
637
|
-
reference,
|
|
638
|
-
floating
|
|
639
|
-
} = _ref;
|
|
640
|
-
const sideAxis = getSideAxis(placement);
|
|
641
|
-
const alignmentAxis = getAlignmentAxis(placement);
|
|
642
|
-
const alignLength = getAxisLength(alignmentAxis);
|
|
643
|
-
const side = getSide(placement);
|
|
644
|
-
const isVertical = sideAxis === "y";
|
|
645
|
-
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
646
|
-
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
647
|
-
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
648
|
-
let coords;
|
|
649
|
-
switch (side) {
|
|
650
|
-
case "top":
|
|
651
|
-
coords = {
|
|
652
|
-
x: commonX,
|
|
653
|
-
y: reference.y - floating.height
|
|
654
|
-
};
|
|
655
|
-
break;
|
|
656
|
-
case "bottom":
|
|
657
|
-
coords = {
|
|
658
|
-
x: commonX,
|
|
659
|
-
y: reference.y + reference.height
|
|
660
|
-
};
|
|
661
|
-
break;
|
|
662
|
-
case "right":
|
|
663
|
-
coords = {
|
|
664
|
-
x: reference.x + reference.width,
|
|
665
|
-
y: commonY
|
|
666
|
-
};
|
|
667
|
-
break;
|
|
668
|
-
case "left":
|
|
669
|
-
coords = {
|
|
670
|
-
x: reference.x - floating.width,
|
|
671
|
-
y: commonY
|
|
672
|
-
};
|
|
673
|
-
break;
|
|
674
|
-
default:
|
|
675
|
-
coords = {
|
|
676
|
-
x: reference.x,
|
|
677
|
-
y: reference.y
|
|
678
|
-
};
|
|
679
|
-
}
|
|
680
|
-
switch (getAlignment(placement)) {
|
|
681
|
-
case "start":
|
|
682
|
-
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
683
|
-
break;
|
|
684
|
-
case "end":
|
|
685
|
-
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
686
|
-
break;
|
|
687
|
-
}
|
|
688
|
-
return coords;
|
|
689
|
-
}
|
|
690
|
-
async function detectOverflow(state, options) {
|
|
691
|
-
var _await$platform$isEle;
|
|
692
|
-
if (options === void 0) {
|
|
693
|
-
options = {};
|
|
694
|
-
}
|
|
695
|
-
const {
|
|
696
|
-
x,
|
|
697
|
-
y,
|
|
698
|
-
platform: platform2,
|
|
699
|
-
rects,
|
|
700
|
-
elements,
|
|
701
|
-
strategy
|
|
702
|
-
} = state;
|
|
703
|
-
const {
|
|
704
|
-
boundary = "clippingAncestors",
|
|
705
|
-
rootBoundary = "viewport",
|
|
706
|
-
elementContext = "floating",
|
|
707
|
-
altBoundary = false,
|
|
708
|
-
padding = 0
|
|
709
|
-
} = evaluate(options, state);
|
|
710
|
-
const paddingObject = getPaddingObject(padding);
|
|
711
|
-
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
712
|
-
const element = elements[altBoundary ? altContext : elementContext];
|
|
713
|
-
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
|
|
714
|
-
element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
|
|
715
|
-
boundary,
|
|
716
|
-
rootBoundary,
|
|
717
|
-
strategy
|
|
718
|
-
}));
|
|
719
|
-
const rect = elementContext === "floating" ? {
|
|
720
|
-
x,
|
|
721
|
-
y,
|
|
722
|
-
width: rects.floating.width,
|
|
723
|
-
height: rects.floating.height
|
|
724
|
-
} : rects.reference;
|
|
725
|
-
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
726
|
-
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
727
|
-
x: 1,
|
|
728
|
-
y: 1
|
|
729
|
-
} : {
|
|
730
|
-
x: 1,
|
|
731
|
-
y: 1
|
|
732
|
-
};
|
|
733
|
-
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
734
|
-
elements,
|
|
735
|
-
rect,
|
|
736
|
-
offsetParent,
|
|
737
|
-
strategy
|
|
738
|
-
}) : rect);
|
|
739
|
-
return {
|
|
740
|
-
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
741
|
-
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
742
|
-
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
743
|
-
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
744
|
-
};
|
|
745
|
-
}
|
|
746
|
-
var MAX_RESET_COUNT = 50;
|
|
747
|
-
var computePosition = async (reference, floating, config) => {
|
|
748
|
-
const {
|
|
749
|
-
placement = "bottom",
|
|
750
|
-
strategy = "absolute",
|
|
751
|
-
middleware = [],
|
|
752
|
-
platform: platform2
|
|
753
|
-
} = config;
|
|
754
|
-
const platformWithDetectOverflow = platform2.detectOverflow ? platform2 : {
|
|
755
|
-
...platform2,
|
|
756
|
-
detectOverflow
|
|
757
|
-
};
|
|
758
|
-
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
|
|
759
|
-
let rects = await platform2.getElementRects({
|
|
760
|
-
reference,
|
|
761
|
-
floating,
|
|
762
|
-
strategy
|
|
763
|
-
});
|
|
764
|
-
let {
|
|
765
|
-
x,
|
|
766
|
-
y
|
|
767
|
-
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
768
|
-
let statefulPlacement = placement;
|
|
769
|
-
let resetCount = 0;
|
|
770
|
-
const middlewareData = {};
|
|
771
|
-
for (let i = 0; i < middleware.length; i++) {
|
|
772
|
-
const currentMiddleware = middleware[i];
|
|
773
|
-
if (!currentMiddleware) {
|
|
774
|
-
continue;
|
|
775
|
-
}
|
|
776
|
-
const {
|
|
777
|
-
name,
|
|
778
|
-
fn
|
|
779
|
-
} = currentMiddleware;
|
|
780
|
-
const {
|
|
781
|
-
x: nextX,
|
|
782
|
-
y: nextY,
|
|
783
|
-
data,
|
|
784
|
-
reset
|
|
785
|
-
} = await fn({
|
|
786
|
-
x,
|
|
787
|
-
y,
|
|
788
|
-
initialPlacement: placement,
|
|
789
|
-
placement: statefulPlacement,
|
|
790
|
-
strategy,
|
|
791
|
-
middlewareData,
|
|
792
|
-
rects,
|
|
793
|
-
platform: platformWithDetectOverflow,
|
|
794
|
-
elements: {
|
|
795
|
-
reference,
|
|
796
|
-
floating
|
|
797
|
-
}
|
|
798
|
-
});
|
|
799
|
-
x = nextX != null ? nextX : x;
|
|
800
|
-
y = nextY != null ? nextY : y;
|
|
801
|
-
middlewareData[name] = {
|
|
802
|
-
...middlewareData[name],
|
|
803
|
-
...data
|
|
804
|
-
};
|
|
805
|
-
if (reset && resetCount < MAX_RESET_COUNT) {
|
|
806
|
-
resetCount++;
|
|
807
|
-
if (typeof reset === "object") {
|
|
808
|
-
if (reset.placement) {
|
|
809
|
-
statefulPlacement = reset.placement;
|
|
810
|
-
}
|
|
811
|
-
if (reset.rects) {
|
|
812
|
-
rects = reset.rects === true ? await platform2.getElementRects({
|
|
813
|
-
reference,
|
|
814
|
-
floating,
|
|
815
|
-
strategy
|
|
816
|
-
}) : reset.rects;
|
|
817
|
-
}
|
|
818
|
-
({
|
|
819
|
-
x,
|
|
820
|
-
y
|
|
821
|
-
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
822
|
-
}
|
|
823
|
-
i = -1;
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
return {
|
|
827
|
-
x,
|
|
828
|
-
y,
|
|
829
|
-
placement: statefulPlacement,
|
|
830
|
-
strategy,
|
|
831
|
-
middlewareData
|
|
832
|
-
};
|
|
833
|
-
};
|
|
834
|
-
var arrow = (options) => ({
|
|
835
|
-
name: "arrow",
|
|
836
|
-
options,
|
|
837
|
-
async fn(state) {
|
|
838
|
-
const {
|
|
839
|
-
x,
|
|
840
|
-
y,
|
|
841
|
-
placement,
|
|
842
|
-
rects,
|
|
843
|
-
platform: platform2,
|
|
844
|
-
elements,
|
|
845
|
-
middlewareData
|
|
846
|
-
} = state;
|
|
847
|
-
const {
|
|
848
|
-
element,
|
|
849
|
-
padding = 0
|
|
850
|
-
} = evaluate(options, state) || {};
|
|
851
|
-
if (element == null) {
|
|
852
|
-
return {};
|
|
853
|
-
}
|
|
854
|
-
const paddingObject = getPaddingObject(padding);
|
|
855
|
-
const coords = {
|
|
856
|
-
x,
|
|
857
|
-
y
|
|
858
|
-
};
|
|
859
|
-
const axis = getAlignmentAxis(placement);
|
|
860
|
-
const length = getAxisLength(axis);
|
|
861
|
-
const arrowDimensions = await platform2.getDimensions(element);
|
|
862
|
-
const isYAxis = axis === "y";
|
|
863
|
-
const minProp = isYAxis ? "top" : "left";
|
|
864
|
-
const maxProp = isYAxis ? "bottom" : "right";
|
|
865
|
-
const clientProp = isYAxis ? "clientHeight" : "clientWidth";
|
|
866
|
-
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
|
867
|
-
const startDiff = coords[axis] - rects.reference[axis];
|
|
868
|
-
const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
|
|
869
|
-
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
|
|
870
|
-
if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) {
|
|
871
|
-
clientSize = elements.floating[clientProp] || rects.floating[length];
|
|
872
|
-
}
|
|
873
|
-
const centerToReference = endDiff / 2 - startDiff / 2;
|
|
874
|
-
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
|
|
875
|
-
const minPadding = min(paddingObject[minProp], largestPossiblePadding);
|
|
876
|
-
const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
|
|
877
|
-
const min$1 = minPadding;
|
|
878
|
-
const max2 = clientSize - arrowDimensions[length] - maxPadding;
|
|
879
|
-
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
880
|
-
const offset4 = clamp2(min$1, center, max2);
|
|
881
|
-
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
882
|
-
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
|
|
883
|
-
return {
|
|
884
|
-
[axis]: coords[axis] + alignmentOffset,
|
|
885
|
-
data: {
|
|
886
|
-
[axis]: offset4,
|
|
887
|
-
centerOffset: center - offset4 - alignmentOffset,
|
|
888
|
-
...shouldAddOffset && {
|
|
889
|
-
alignmentOffset
|
|
890
|
-
}
|
|
891
|
-
},
|
|
892
|
-
reset: shouldAddOffset
|
|
893
|
-
};
|
|
894
|
-
}
|
|
895
|
-
});
|
|
896
|
-
var flip = function(options) {
|
|
897
|
-
if (options === void 0) {
|
|
898
|
-
options = {};
|
|
899
|
-
}
|
|
900
|
-
return {
|
|
901
|
-
name: "flip",
|
|
902
|
-
options,
|
|
903
|
-
async fn(state) {
|
|
904
|
-
var _middlewareData$arrow, _middlewareData$flip;
|
|
905
|
-
const {
|
|
906
|
-
placement,
|
|
907
|
-
middlewareData,
|
|
908
|
-
rects,
|
|
909
|
-
initialPlacement,
|
|
910
|
-
platform: platform2,
|
|
911
|
-
elements
|
|
912
|
-
} = state;
|
|
913
|
-
const {
|
|
914
|
-
mainAxis: checkMainAxis = true,
|
|
915
|
-
crossAxis: checkCrossAxis = true,
|
|
916
|
-
fallbackPlacements: specifiedFallbackPlacements,
|
|
917
|
-
fallbackStrategy = "bestFit",
|
|
918
|
-
fallbackAxisSideDirection = "none",
|
|
919
|
-
flipAlignment = true,
|
|
920
|
-
...detectOverflowOptions
|
|
921
|
-
} = evaluate(options, state);
|
|
922
|
-
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
923
|
-
return {};
|
|
924
|
-
}
|
|
925
|
-
const side = getSide(placement);
|
|
926
|
-
const initialSideAxis = getSideAxis(initialPlacement);
|
|
927
|
-
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
928
|
-
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
929
|
-
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
930
|
-
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
|
|
931
|
-
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
932
|
-
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
933
|
-
}
|
|
934
|
-
const placements2 = [initialPlacement, ...fallbackPlacements];
|
|
935
|
-
const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
|
|
936
|
-
const overflows = [];
|
|
937
|
-
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
938
|
-
if (checkMainAxis) {
|
|
939
|
-
overflows.push(overflow[side]);
|
|
940
|
-
}
|
|
941
|
-
if (checkCrossAxis) {
|
|
942
|
-
const sides2 = getAlignmentSides(placement, rects, rtl);
|
|
943
|
-
overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
|
|
944
|
-
}
|
|
945
|
-
overflowsData = [...overflowsData, {
|
|
946
|
-
placement,
|
|
947
|
-
overflows
|
|
948
|
-
}];
|
|
949
|
-
if (!overflows.every((side2) => side2 <= 0)) {
|
|
950
|
-
var _middlewareData$flip2, _overflowsData$filter;
|
|
951
|
-
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
952
|
-
const nextPlacement = placements2[nextIndex];
|
|
953
|
-
if (nextPlacement) {
|
|
954
|
-
const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
|
|
955
|
-
if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
|
|
956
|
-
// overflows the main axis.
|
|
957
|
-
overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
|
|
958
|
-
return {
|
|
959
|
-
data: {
|
|
960
|
-
index: nextIndex,
|
|
961
|
-
overflows: overflowsData
|
|
962
|
-
},
|
|
963
|
-
reset: {
|
|
964
|
-
placement: nextPlacement
|
|
965
|
-
}
|
|
966
|
-
};
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
970
|
-
if (!resetPlacement) {
|
|
971
|
-
switch (fallbackStrategy) {
|
|
972
|
-
case "bestFit": {
|
|
973
|
-
var _overflowsData$filter2;
|
|
974
|
-
const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
|
|
975
|
-
if (hasFallbackAxisSideDirection) {
|
|
976
|
-
const currentSideAxis = getSideAxis(d.placement);
|
|
977
|
-
return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
|
|
978
|
-
// reading directions favoring greater width.
|
|
979
|
-
currentSideAxis === "y";
|
|
980
|
-
}
|
|
981
|
-
return true;
|
|
982
|
-
}).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
983
|
-
if (placement2) {
|
|
984
|
-
resetPlacement = placement2;
|
|
985
|
-
}
|
|
986
|
-
break;
|
|
987
|
-
}
|
|
988
|
-
case "initialPlacement":
|
|
989
|
-
resetPlacement = initialPlacement;
|
|
990
|
-
break;
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
if (placement !== resetPlacement) {
|
|
994
|
-
return {
|
|
995
|
-
reset: {
|
|
996
|
-
placement: resetPlacement
|
|
997
|
-
}
|
|
998
|
-
};
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
return {};
|
|
1002
|
-
}
|
|
1003
|
-
};
|
|
1004
|
-
};
|
|
1005
|
-
function getSideOffsets(overflow, rect) {
|
|
1006
|
-
return {
|
|
1007
|
-
top: overflow.top - rect.height,
|
|
1008
|
-
right: overflow.right - rect.width,
|
|
1009
|
-
bottom: overflow.bottom - rect.height,
|
|
1010
|
-
left: overflow.left - rect.width
|
|
1011
|
-
};
|
|
1012
|
-
}
|
|
1013
|
-
function isAnySideFullyClipped(overflow) {
|
|
1014
|
-
return sides.some((side) => overflow[side] >= 0);
|
|
1015
|
-
}
|
|
1016
|
-
var hide = function(options) {
|
|
1017
|
-
if (options === void 0) {
|
|
1018
|
-
options = {};
|
|
1019
|
-
}
|
|
1020
|
-
return {
|
|
1021
|
-
name: "hide",
|
|
1022
|
-
options,
|
|
1023
|
-
async fn(state) {
|
|
1024
|
-
const {
|
|
1025
|
-
rects,
|
|
1026
|
-
platform: platform2
|
|
1027
|
-
} = state;
|
|
1028
|
-
const {
|
|
1029
|
-
strategy = "referenceHidden",
|
|
1030
|
-
...detectOverflowOptions
|
|
1031
|
-
} = evaluate(options, state);
|
|
1032
|
-
switch (strategy) {
|
|
1033
|
-
case "referenceHidden": {
|
|
1034
|
-
const overflow = await platform2.detectOverflow(state, {
|
|
1035
|
-
...detectOverflowOptions,
|
|
1036
|
-
elementContext: "reference"
|
|
1037
|
-
});
|
|
1038
|
-
const offsets = getSideOffsets(overflow, rects.reference);
|
|
1039
|
-
return {
|
|
1040
|
-
data: {
|
|
1041
|
-
referenceHiddenOffsets: offsets,
|
|
1042
|
-
referenceHidden: isAnySideFullyClipped(offsets)
|
|
1043
|
-
}
|
|
1044
|
-
};
|
|
1045
|
-
}
|
|
1046
|
-
case "escaped": {
|
|
1047
|
-
const overflow = await platform2.detectOverflow(state, {
|
|
1048
|
-
...detectOverflowOptions,
|
|
1049
|
-
altBoundary: true
|
|
1050
|
-
});
|
|
1051
|
-
const offsets = getSideOffsets(overflow, rects.floating);
|
|
1052
|
-
return {
|
|
1053
|
-
data: {
|
|
1054
|
-
escapedOffsets: offsets,
|
|
1055
|
-
escaped: isAnySideFullyClipped(offsets)
|
|
1056
|
-
}
|
|
1057
|
-
};
|
|
1058
|
-
}
|
|
1059
|
-
default: {
|
|
1060
|
-
return {};
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
};
|
|
1065
|
-
};
|
|
1066
|
-
var originSides = /* @__PURE__ */ new Set(["left", "top"]);
|
|
1067
|
-
async function convertValueToCoords(state, options) {
|
|
1068
|
-
const {
|
|
1069
|
-
placement,
|
|
1070
|
-
platform: platform2,
|
|
1071
|
-
elements
|
|
1072
|
-
} = state;
|
|
1073
|
-
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
1074
|
-
const side = getSide(placement);
|
|
1075
|
-
const alignment = getAlignment(placement);
|
|
1076
|
-
const isVertical = getSideAxis(placement) === "y";
|
|
1077
|
-
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
1078
|
-
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
1079
|
-
const rawValue = evaluate(options, state);
|
|
1080
|
-
let {
|
|
1081
|
-
mainAxis,
|
|
1082
|
-
crossAxis,
|
|
1083
|
-
alignmentAxis
|
|
1084
|
-
} = typeof rawValue === "number" ? {
|
|
1085
|
-
mainAxis: rawValue,
|
|
1086
|
-
crossAxis: 0,
|
|
1087
|
-
alignmentAxis: null
|
|
1088
|
-
} : {
|
|
1089
|
-
mainAxis: rawValue.mainAxis || 0,
|
|
1090
|
-
crossAxis: rawValue.crossAxis || 0,
|
|
1091
|
-
alignmentAxis: rawValue.alignmentAxis
|
|
1092
|
-
};
|
|
1093
|
-
if (alignment && typeof alignmentAxis === "number") {
|
|
1094
|
-
crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
|
|
1095
|
-
}
|
|
1096
|
-
return isVertical ? {
|
|
1097
|
-
x: crossAxis * crossAxisMulti,
|
|
1098
|
-
y: mainAxis * mainAxisMulti
|
|
1099
|
-
} : {
|
|
1100
|
-
x: mainAxis * mainAxisMulti,
|
|
1101
|
-
y: crossAxis * crossAxisMulti
|
|
1102
|
-
};
|
|
1103
|
-
}
|
|
1104
|
-
var offset = function(options) {
|
|
1105
|
-
if (options === void 0) {
|
|
1106
|
-
options = 0;
|
|
1107
|
-
}
|
|
1108
|
-
return {
|
|
1109
|
-
name: "offset",
|
|
1110
|
-
options,
|
|
1111
|
-
async fn(state) {
|
|
1112
|
-
var _middlewareData$offse, _middlewareData$arrow;
|
|
1113
|
-
const {
|
|
1114
|
-
x,
|
|
1115
|
-
y,
|
|
1116
|
-
placement,
|
|
1117
|
-
middlewareData
|
|
1118
|
-
} = state;
|
|
1119
|
-
const diffCoords = await convertValueToCoords(state, options);
|
|
1120
|
-
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
1121
|
-
return {};
|
|
1122
|
-
}
|
|
1123
|
-
return {
|
|
1124
|
-
x: x + diffCoords.x,
|
|
1125
|
-
y: y + diffCoords.y,
|
|
1126
|
-
data: {
|
|
1127
|
-
...diffCoords,
|
|
1128
|
-
placement
|
|
1129
|
-
}
|
|
1130
|
-
};
|
|
1131
|
-
}
|
|
1132
|
-
};
|
|
1133
|
-
};
|
|
1134
|
-
var shift = function(options) {
|
|
1135
|
-
if (options === void 0) {
|
|
1136
|
-
options = {};
|
|
1137
|
-
}
|
|
1138
|
-
return {
|
|
1139
|
-
name: "shift",
|
|
1140
|
-
options,
|
|
1141
|
-
async fn(state) {
|
|
1142
|
-
const {
|
|
1143
|
-
x,
|
|
1144
|
-
y,
|
|
1145
|
-
placement,
|
|
1146
|
-
platform: platform2
|
|
1147
|
-
} = state;
|
|
1148
|
-
const {
|
|
1149
|
-
mainAxis: checkMainAxis = true,
|
|
1150
|
-
crossAxis: checkCrossAxis = false,
|
|
1151
|
-
limiter = {
|
|
1152
|
-
fn: (_ref) => {
|
|
1153
|
-
let {
|
|
1154
|
-
x: x2,
|
|
1155
|
-
y: y2
|
|
1156
|
-
} = _ref;
|
|
1157
|
-
return {
|
|
1158
|
-
x: x2,
|
|
1159
|
-
y: y2
|
|
1160
|
-
};
|
|
1161
|
-
}
|
|
1162
|
-
},
|
|
1163
|
-
...detectOverflowOptions
|
|
1164
|
-
} = evaluate(options, state);
|
|
1165
|
-
const coords = {
|
|
1166
|
-
x,
|
|
1167
|
-
y
|
|
1168
|
-
};
|
|
1169
|
-
const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
|
|
1170
|
-
const crossAxis = getSideAxis(getSide(placement));
|
|
1171
|
-
const mainAxis = getOppositeAxis(crossAxis);
|
|
1172
|
-
let mainAxisCoord = coords[mainAxis];
|
|
1173
|
-
let crossAxisCoord = coords[crossAxis];
|
|
1174
|
-
if (checkMainAxis) {
|
|
1175
|
-
const minSide = mainAxis === "y" ? "top" : "left";
|
|
1176
|
-
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
1177
|
-
const min2 = mainAxisCoord + overflow[minSide];
|
|
1178
|
-
const max2 = mainAxisCoord - overflow[maxSide];
|
|
1179
|
-
mainAxisCoord = clamp2(min2, mainAxisCoord, max2);
|
|
1180
|
-
}
|
|
1181
|
-
if (checkCrossAxis) {
|
|
1182
|
-
const minSide = crossAxis === "y" ? "top" : "left";
|
|
1183
|
-
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
1184
|
-
const min2 = crossAxisCoord + overflow[minSide];
|
|
1185
|
-
const max2 = crossAxisCoord - overflow[maxSide];
|
|
1186
|
-
crossAxisCoord = clamp2(min2, crossAxisCoord, max2);
|
|
1187
|
-
}
|
|
1188
|
-
const limitedCoords = limiter.fn({
|
|
1189
|
-
...state,
|
|
1190
|
-
[mainAxis]: mainAxisCoord,
|
|
1191
|
-
[crossAxis]: crossAxisCoord
|
|
1192
|
-
});
|
|
1193
|
-
return {
|
|
1194
|
-
...limitedCoords,
|
|
1195
|
-
data: {
|
|
1196
|
-
x: limitedCoords.x - x,
|
|
1197
|
-
y: limitedCoords.y - y,
|
|
1198
|
-
enabled: {
|
|
1199
|
-
[mainAxis]: checkMainAxis,
|
|
1200
|
-
[crossAxis]: checkCrossAxis
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
};
|
|
1204
|
-
}
|
|
1205
|
-
};
|
|
1206
|
-
};
|
|
1207
|
-
var limitShift = function(options) {
|
|
1208
|
-
if (options === void 0) {
|
|
1209
|
-
options = {};
|
|
1210
|
-
}
|
|
1211
|
-
return {
|
|
1212
|
-
options,
|
|
1213
|
-
fn(state) {
|
|
1214
|
-
const {
|
|
1215
|
-
x,
|
|
1216
|
-
y,
|
|
1217
|
-
placement,
|
|
1218
|
-
rects,
|
|
1219
|
-
middlewareData
|
|
1220
|
-
} = state;
|
|
1221
|
-
const {
|
|
1222
|
-
offset: offset4 = 0,
|
|
1223
|
-
mainAxis: checkMainAxis = true,
|
|
1224
|
-
crossAxis: checkCrossAxis = true
|
|
1225
|
-
} = evaluate(options, state);
|
|
1226
|
-
const coords = {
|
|
1227
|
-
x,
|
|
1228
|
-
y
|
|
1229
|
-
};
|
|
1230
|
-
const crossAxis = getSideAxis(placement);
|
|
1231
|
-
const mainAxis = getOppositeAxis(crossAxis);
|
|
1232
|
-
let mainAxisCoord = coords[mainAxis];
|
|
1233
|
-
let crossAxisCoord = coords[crossAxis];
|
|
1234
|
-
const rawOffset = evaluate(offset4, state);
|
|
1235
|
-
const computedOffset = typeof rawOffset === "number" ? {
|
|
1236
|
-
mainAxis: rawOffset,
|
|
1237
|
-
crossAxis: 0
|
|
1238
|
-
} : {
|
|
1239
|
-
mainAxis: 0,
|
|
1240
|
-
crossAxis: 0,
|
|
1241
|
-
...rawOffset
|
|
1242
|
-
};
|
|
1243
|
-
if (checkMainAxis) {
|
|
1244
|
-
const len = mainAxis === "y" ? "height" : "width";
|
|
1245
|
-
const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
|
|
1246
|
-
const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
|
|
1247
|
-
if (mainAxisCoord < limitMin) {
|
|
1248
|
-
mainAxisCoord = limitMin;
|
|
1249
|
-
} else if (mainAxisCoord > limitMax) {
|
|
1250
|
-
mainAxisCoord = limitMax;
|
|
1251
|
-
}
|
|
1252
|
-
}
|
|
1253
|
-
if (checkCrossAxis) {
|
|
1254
|
-
var _middlewareData$offse, _middlewareData$offse2;
|
|
1255
|
-
const len = mainAxis === "y" ? "width" : "height";
|
|
1256
|
-
const isOriginSide = originSides.has(getSide(placement));
|
|
1257
|
-
const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
|
|
1258
|
-
const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
|
|
1259
|
-
if (crossAxisCoord < limitMin) {
|
|
1260
|
-
crossAxisCoord = limitMin;
|
|
1261
|
-
} else if (crossAxisCoord > limitMax) {
|
|
1262
|
-
crossAxisCoord = limitMax;
|
|
1263
|
-
}
|
|
1264
|
-
}
|
|
1265
|
-
return {
|
|
1266
|
-
[mainAxis]: mainAxisCoord,
|
|
1267
|
-
[crossAxis]: crossAxisCoord
|
|
1268
|
-
};
|
|
1269
|
-
}
|
|
1270
|
-
};
|
|
1271
|
-
};
|
|
1272
|
-
var size = function(options) {
|
|
1273
|
-
if (options === void 0) {
|
|
1274
|
-
options = {};
|
|
1275
|
-
}
|
|
1276
|
-
return {
|
|
1277
|
-
name: "size",
|
|
1278
|
-
options,
|
|
1279
|
-
async fn(state) {
|
|
1280
|
-
var _state$middlewareData, _state$middlewareData2;
|
|
1281
|
-
const {
|
|
1282
|
-
placement,
|
|
1283
|
-
rects,
|
|
1284
|
-
platform: platform2,
|
|
1285
|
-
elements
|
|
1286
|
-
} = state;
|
|
1287
|
-
const {
|
|
1288
|
-
apply = () => {
|
|
1289
|
-
},
|
|
1290
|
-
...detectOverflowOptions
|
|
1291
|
-
} = evaluate(options, state);
|
|
1292
|
-
const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
|
|
1293
|
-
const side = getSide(placement);
|
|
1294
|
-
const alignment = getAlignment(placement);
|
|
1295
|
-
const isYAxis = getSideAxis(placement) === "y";
|
|
1296
|
-
const {
|
|
1297
|
-
width,
|
|
1298
|
-
height
|
|
1299
|
-
} = rects.floating;
|
|
1300
|
-
let heightSide;
|
|
1301
|
-
let widthSide;
|
|
1302
|
-
if (side === "top" || side === "bottom") {
|
|
1303
|
-
heightSide = side;
|
|
1304
|
-
widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
|
|
1305
|
-
} else {
|
|
1306
|
-
widthSide = side;
|
|
1307
|
-
heightSide = alignment === "end" ? "top" : "bottom";
|
|
1308
|
-
}
|
|
1309
|
-
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
1310
|
-
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
1311
|
-
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
|
|
1312
|
-
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
|
|
1313
|
-
const noShift = !state.middlewareData.shift;
|
|
1314
|
-
let availableHeight = overflowAvailableHeight;
|
|
1315
|
-
let availableWidth = overflowAvailableWidth;
|
|
1316
|
-
if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
|
|
1317
|
-
availableWidth = maximumClippingWidth;
|
|
1318
|
-
}
|
|
1319
|
-
if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
|
|
1320
|
-
availableHeight = maximumClippingHeight;
|
|
1321
|
-
}
|
|
1322
|
-
if (noShift && !alignment) {
|
|
1323
|
-
const xMin = max(overflow.left, 0);
|
|
1324
|
-
const xMax = max(overflow.right, 0);
|
|
1325
|
-
const yMin = max(overflow.top, 0);
|
|
1326
|
-
const yMax = max(overflow.bottom, 0);
|
|
1327
|
-
if (isYAxis) {
|
|
1328
|
-
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
1329
|
-
} else {
|
|
1330
|
-
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
await apply({
|
|
1334
|
-
...state,
|
|
1335
|
-
availableWidth,
|
|
1336
|
-
availableHeight
|
|
1337
|
-
});
|
|
1338
|
-
const nextDimensions = await platform2.getDimensions(elements.floating);
|
|
1339
|
-
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
1340
|
-
return {
|
|
1341
|
-
reset: {
|
|
1342
|
-
rects: true
|
|
1343
|
-
}
|
|
1344
|
-
};
|
|
1345
|
-
}
|
|
1346
|
-
return {};
|
|
1347
|
-
}
|
|
1348
|
-
};
|
|
1349
|
-
};
|
|
1350
|
-
|
|
1351
|
-
// ../../node_modules/.pnpm/@floating-ui+utils@0.2.11/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
|
|
1352
|
-
function hasWindow() {
|
|
1353
|
-
return typeof window !== "undefined";
|
|
1354
|
-
}
|
|
1355
|
-
function getNodeName(node) {
|
|
1356
|
-
if (isNode(node)) {
|
|
1357
|
-
return (node.nodeName || "").toLowerCase();
|
|
1358
|
-
}
|
|
1359
|
-
return "#document";
|
|
1360
|
-
}
|
|
1361
|
-
function getWindow(node) {
|
|
1362
|
-
var _node$ownerDocument;
|
|
1363
|
-
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
1364
|
-
}
|
|
1365
|
-
function getDocumentElement(node) {
|
|
1366
|
-
var _ref;
|
|
1367
|
-
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
1368
|
-
}
|
|
1369
|
-
function isNode(value) {
|
|
1370
|
-
if (!hasWindow()) {
|
|
1371
|
-
return false;
|
|
1372
|
-
}
|
|
1373
|
-
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
1374
|
-
}
|
|
1375
|
-
function isElement(value) {
|
|
1376
|
-
if (!hasWindow()) {
|
|
1377
|
-
return false;
|
|
1378
|
-
}
|
|
1379
|
-
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
1380
|
-
}
|
|
1381
|
-
function isHTMLElement(value) {
|
|
1382
|
-
if (!hasWindow()) {
|
|
1383
|
-
return false;
|
|
1384
|
-
}
|
|
1385
|
-
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
1386
|
-
}
|
|
1387
|
-
function isShadowRoot(value) {
|
|
1388
|
-
if (!hasWindow() || typeof ShadowRoot === "undefined") {
|
|
1389
|
-
return false;
|
|
1390
|
-
}
|
|
1391
|
-
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
1392
|
-
}
|
|
1393
|
-
function isOverflowElement(element) {
|
|
1394
|
-
const {
|
|
1395
|
-
overflow,
|
|
1396
|
-
overflowX,
|
|
1397
|
-
overflowY,
|
|
1398
|
-
display
|
|
1399
|
-
} = getComputedStyle2(element);
|
|
1400
|
-
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
|
|
1401
|
-
}
|
|
1402
|
-
function isTableElement(element) {
|
|
1403
|
-
return /^(table|td|th)$/.test(getNodeName(element));
|
|
1404
|
-
}
|
|
1405
|
-
function isTopLayer(element) {
|
|
1406
|
-
try {
|
|
1407
|
-
if (element.matches(":popover-open")) {
|
|
1408
|
-
return true;
|
|
1409
|
-
}
|
|
1410
|
-
} catch (_e) {
|
|
1411
|
-
}
|
|
1412
|
-
try {
|
|
1413
|
-
return element.matches(":modal");
|
|
1414
|
-
} catch (_e) {
|
|
1415
|
-
return false;
|
|
1416
|
-
}
|
|
1417
|
-
}
|
|
1418
|
-
var willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
|
1419
|
-
var containRe = /paint|layout|strict|content/;
|
|
1420
|
-
var isNotNone = (value) => !!value && value !== "none";
|
|
1421
|
-
var isWebKitValue;
|
|
1422
|
-
function isContainingBlock(elementOrCss) {
|
|
1423
|
-
const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
|
|
1424
|
-
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || "");
|
|
1425
|
-
}
|
|
1426
|
-
function getContainingBlock(element) {
|
|
1427
|
-
let currentNode = getParentNode(element);
|
|
1428
|
-
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1429
|
-
if (isContainingBlock(currentNode)) {
|
|
1430
|
-
return currentNode;
|
|
1431
|
-
} else if (isTopLayer(currentNode)) {
|
|
1432
|
-
return null;
|
|
1433
|
-
}
|
|
1434
|
-
currentNode = getParentNode(currentNode);
|
|
1435
|
-
}
|
|
1436
|
-
return null;
|
|
1437
|
-
}
|
|
1438
|
-
function isWebKit() {
|
|
1439
|
-
if (isWebKitValue == null) {
|
|
1440
|
-
isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
|
|
1441
|
-
}
|
|
1442
|
-
return isWebKitValue;
|
|
1443
|
-
}
|
|
1444
|
-
function isLastTraversableNode(node) {
|
|
1445
|
-
return /^(html|body|#document)$/.test(getNodeName(node));
|
|
1446
|
-
}
|
|
1447
|
-
function getComputedStyle2(element) {
|
|
1448
|
-
return getWindow(element).getComputedStyle(element);
|
|
1449
|
-
}
|
|
1450
|
-
function getNodeScroll(element) {
|
|
1451
|
-
if (isElement(element)) {
|
|
1452
|
-
return {
|
|
1453
|
-
scrollLeft: element.scrollLeft,
|
|
1454
|
-
scrollTop: element.scrollTop
|
|
1455
|
-
};
|
|
1456
|
-
}
|
|
1457
|
-
return {
|
|
1458
|
-
scrollLeft: element.scrollX,
|
|
1459
|
-
scrollTop: element.scrollY
|
|
1460
|
-
};
|
|
1461
|
-
}
|
|
1462
|
-
function getParentNode(node) {
|
|
1463
|
-
if (getNodeName(node) === "html") {
|
|
1464
|
-
return node;
|
|
1465
|
-
}
|
|
1466
|
-
const result = (
|
|
1467
|
-
// Step into the shadow DOM of the parent of a slotted node.
|
|
1468
|
-
node.assignedSlot || // DOM Element detected.
|
|
1469
|
-
node.parentNode || // ShadowRoot detected.
|
|
1470
|
-
isShadowRoot(node) && node.host || // Fallback.
|
|
1471
|
-
getDocumentElement(node)
|
|
1472
|
-
);
|
|
1473
|
-
return isShadowRoot(result) ? result.host : result;
|
|
1474
|
-
}
|
|
1475
|
-
function getNearestOverflowAncestor(node) {
|
|
1476
|
-
const parentNode = getParentNode(node);
|
|
1477
|
-
if (isLastTraversableNode(parentNode)) {
|
|
1478
|
-
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
1479
|
-
}
|
|
1480
|
-
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
1481
|
-
return parentNode;
|
|
1482
|
-
}
|
|
1483
|
-
return getNearestOverflowAncestor(parentNode);
|
|
1484
|
-
}
|
|
1485
|
-
function getOverflowAncestors(node, list, traverseIframes) {
|
|
1486
|
-
var _node$ownerDocument2;
|
|
1487
|
-
if (list === void 0) {
|
|
1488
|
-
list = [];
|
|
1489
|
-
}
|
|
1490
|
-
if (traverseIframes === void 0) {
|
|
1491
|
-
traverseIframes = true;
|
|
1492
|
-
}
|
|
1493
|
-
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
1494
|
-
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
1495
|
-
const win = getWindow(scrollableAncestor);
|
|
1496
|
-
if (isBody) {
|
|
1497
|
-
const frameElement = getFrameElement(win);
|
|
1498
|
-
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
1499
|
-
} else {
|
|
1500
|
-
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
1501
|
-
}
|
|
1502
|
-
}
|
|
1503
|
-
function getFrameElement(win) {
|
|
1504
|
-
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
1505
|
-
}
|
|
1506
|
-
|
|
1507
|
-
// ../../node_modules/.pnpm/@floating-ui+dom@1.7.6/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
|
|
1508
|
-
function getCssDimensions(element) {
|
|
1509
|
-
const css = getComputedStyle2(element);
|
|
1510
|
-
let width = parseFloat(css.width) || 0;
|
|
1511
|
-
let height = parseFloat(css.height) || 0;
|
|
1512
|
-
const hasOffset = isHTMLElement(element);
|
|
1513
|
-
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
1514
|
-
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
1515
|
-
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
1516
|
-
if (shouldFallback) {
|
|
1517
|
-
width = offsetWidth;
|
|
1518
|
-
height = offsetHeight;
|
|
1519
|
-
}
|
|
1520
|
-
return {
|
|
1521
|
-
width,
|
|
1522
|
-
height,
|
|
1523
|
-
$: shouldFallback
|
|
1524
|
-
};
|
|
1525
|
-
}
|
|
1526
|
-
function unwrapElement(element) {
|
|
1527
|
-
return !isElement(element) ? element.contextElement : element;
|
|
1528
|
-
}
|
|
1529
|
-
function getScale(element) {
|
|
1530
|
-
const domElement = unwrapElement(element);
|
|
1531
|
-
if (!isHTMLElement(domElement)) {
|
|
1532
|
-
return createCoords(1);
|
|
1533
|
-
}
|
|
1534
|
-
const rect = domElement.getBoundingClientRect();
|
|
1535
|
-
const {
|
|
1536
|
-
width,
|
|
1537
|
-
height,
|
|
1538
|
-
$
|
|
1539
|
-
} = getCssDimensions(domElement);
|
|
1540
|
-
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
1541
|
-
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
1542
|
-
if (!x || !Number.isFinite(x)) {
|
|
1543
|
-
x = 1;
|
|
1544
|
-
}
|
|
1545
|
-
if (!y || !Number.isFinite(y)) {
|
|
1546
|
-
y = 1;
|
|
1547
|
-
}
|
|
1548
|
-
return {
|
|
1549
|
-
x,
|
|
1550
|
-
y
|
|
1551
|
-
};
|
|
1552
|
-
}
|
|
1553
|
-
var noOffsets = createCoords(0);
|
|
1554
|
-
function getVisualOffsets(element) {
|
|
1555
|
-
const win = getWindow(element);
|
|
1556
|
-
if (!isWebKit() || !win.visualViewport) {
|
|
1557
|
-
return noOffsets;
|
|
1558
|
-
}
|
|
1559
|
-
return {
|
|
1560
|
-
x: win.visualViewport.offsetLeft,
|
|
1561
|
-
y: win.visualViewport.offsetTop
|
|
1562
|
-
};
|
|
1563
|
-
}
|
|
1564
|
-
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
1565
|
-
if (isFixed === void 0) {
|
|
1566
|
-
isFixed = false;
|
|
1567
|
-
}
|
|
1568
|
-
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
1569
|
-
return false;
|
|
1570
|
-
}
|
|
1571
|
-
return isFixed;
|
|
1572
|
-
}
|
|
1573
|
-
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
1574
|
-
if (includeScale === void 0) {
|
|
1575
|
-
includeScale = false;
|
|
1576
|
-
}
|
|
1577
|
-
if (isFixedStrategy === void 0) {
|
|
1578
|
-
isFixedStrategy = false;
|
|
1579
|
-
}
|
|
1580
|
-
const clientRect = element.getBoundingClientRect();
|
|
1581
|
-
const domElement = unwrapElement(element);
|
|
1582
|
-
let scale = createCoords(1);
|
|
1583
|
-
if (includeScale) {
|
|
1584
|
-
if (offsetParent) {
|
|
1585
|
-
if (isElement(offsetParent)) {
|
|
1586
|
-
scale = getScale(offsetParent);
|
|
1587
|
-
}
|
|
1588
|
-
} else {
|
|
1589
|
-
scale = getScale(element);
|
|
1590
|
-
}
|
|
1591
|
-
}
|
|
1592
|
-
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
1593
|
-
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
1594
|
-
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
1595
|
-
let width = clientRect.width / scale.x;
|
|
1596
|
-
let height = clientRect.height / scale.y;
|
|
1597
|
-
if (domElement) {
|
|
1598
|
-
const win = getWindow(domElement);
|
|
1599
|
-
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
1600
|
-
let currentWin = win;
|
|
1601
|
-
let currentIFrame = getFrameElement(currentWin);
|
|
1602
|
-
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
1603
|
-
const iframeScale = getScale(currentIFrame);
|
|
1604
|
-
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
1605
|
-
const css = getComputedStyle2(currentIFrame);
|
|
1606
|
-
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
1607
|
-
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
1608
|
-
x *= iframeScale.x;
|
|
1609
|
-
y *= iframeScale.y;
|
|
1610
|
-
width *= iframeScale.x;
|
|
1611
|
-
height *= iframeScale.y;
|
|
1612
|
-
x += left;
|
|
1613
|
-
y += top;
|
|
1614
|
-
currentWin = getWindow(currentIFrame);
|
|
1615
|
-
currentIFrame = getFrameElement(currentWin);
|
|
1616
|
-
}
|
|
1617
|
-
}
|
|
1618
|
-
return rectToClientRect({
|
|
1619
|
-
width,
|
|
1620
|
-
height,
|
|
1621
|
-
x,
|
|
1622
|
-
y
|
|
1623
|
-
});
|
|
1624
|
-
}
|
|
1625
|
-
function getWindowScrollBarX(element, rect) {
|
|
1626
|
-
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
1627
|
-
if (!rect) {
|
|
1628
|
-
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
1629
|
-
}
|
|
1630
|
-
return rect.left + leftScroll;
|
|
1631
|
-
}
|
|
1632
|
-
function getHTMLOffset(documentElement, scroll) {
|
|
1633
|
-
const htmlRect = documentElement.getBoundingClientRect();
|
|
1634
|
-
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
|
1635
|
-
const y = htmlRect.top + scroll.scrollTop;
|
|
1636
|
-
return {
|
|
1637
|
-
x,
|
|
1638
|
-
y
|
|
1639
|
-
};
|
|
1640
|
-
}
|
|
1641
|
-
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
1642
|
-
let {
|
|
1643
|
-
elements,
|
|
1644
|
-
rect,
|
|
1645
|
-
offsetParent,
|
|
1646
|
-
strategy
|
|
1647
|
-
} = _ref;
|
|
1648
|
-
const isFixed = strategy === "fixed";
|
|
1649
|
-
const documentElement = getDocumentElement(offsetParent);
|
|
1650
|
-
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
1651
|
-
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
1652
|
-
return rect;
|
|
1653
|
-
}
|
|
1654
|
-
let scroll = {
|
|
1655
|
-
scrollLeft: 0,
|
|
1656
|
-
scrollTop: 0
|
|
1657
|
-
};
|
|
1658
|
-
let scale = createCoords(1);
|
|
1659
|
-
const offsets = createCoords(0);
|
|
1660
|
-
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1661
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1662
|
-
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
1663
|
-
scroll = getNodeScroll(offsetParent);
|
|
1664
|
-
}
|
|
1665
|
-
if (isOffsetParentAnElement) {
|
|
1666
|
-
const offsetRect = getBoundingClientRect(offsetParent);
|
|
1667
|
-
scale = getScale(offsetParent);
|
|
1668
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1669
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1670
|
-
}
|
|
1671
|
-
}
|
|
1672
|
-
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
1673
|
-
return {
|
|
1674
|
-
width: rect.width * scale.x,
|
|
1675
|
-
height: rect.height * scale.y,
|
|
1676
|
-
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
1677
|
-
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
1678
|
-
};
|
|
1679
|
-
}
|
|
1680
|
-
function getClientRects(element) {
|
|
1681
|
-
return Array.from(element.getClientRects());
|
|
1682
|
-
}
|
|
1683
|
-
function getDocumentRect(element) {
|
|
1684
|
-
const html = getDocumentElement(element);
|
|
1685
|
-
const scroll = getNodeScroll(element);
|
|
1686
|
-
const body = element.ownerDocument.body;
|
|
1687
|
-
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
1688
|
-
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
1689
|
-
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
1690
|
-
const y = -scroll.scrollTop;
|
|
1691
|
-
if (getComputedStyle2(body).direction === "rtl") {
|
|
1692
|
-
x += max(html.clientWidth, body.clientWidth) - width;
|
|
1693
|
-
}
|
|
1694
|
-
return {
|
|
1695
|
-
width,
|
|
1696
|
-
height,
|
|
1697
|
-
x,
|
|
1698
|
-
y
|
|
1699
|
-
};
|
|
1700
|
-
}
|
|
1701
|
-
var SCROLLBAR_MAX = 25;
|
|
1702
|
-
function getViewportRect(element, strategy) {
|
|
1703
|
-
const win = getWindow(element);
|
|
1704
|
-
const html = getDocumentElement(element);
|
|
1705
|
-
const visualViewport = win.visualViewport;
|
|
1706
|
-
let width = html.clientWidth;
|
|
1707
|
-
let height = html.clientHeight;
|
|
1708
|
-
let x = 0;
|
|
1709
|
-
let y = 0;
|
|
1710
|
-
if (visualViewport) {
|
|
1711
|
-
width = visualViewport.width;
|
|
1712
|
-
height = visualViewport.height;
|
|
1713
|
-
const visualViewportBased = isWebKit();
|
|
1714
|
-
if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
|
|
1715
|
-
x = visualViewport.offsetLeft;
|
|
1716
|
-
y = visualViewport.offsetTop;
|
|
1717
|
-
}
|
|
1718
|
-
}
|
|
1719
|
-
const windowScrollbarX = getWindowScrollBarX(html);
|
|
1720
|
-
if (windowScrollbarX <= 0) {
|
|
1721
|
-
const doc = html.ownerDocument;
|
|
1722
|
-
const body = doc.body;
|
|
1723
|
-
const bodyStyles = getComputedStyle(body);
|
|
1724
|
-
const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
1725
|
-
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
1726
|
-
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
|
1727
|
-
width -= clippingStableScrollbarWidth;
|
|
1728
|
-
}
|
|
1729
|
-
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
|
1730
|
-
width += windowScrollbarX;
|
|
1731
|
-
}
|
|
1732
|
-
return {
|
|
1733
|
-
width,
|
|
1734
|
-
height,
|
|
1735
|
-
x,
|
|
1736
|
-
y
|
|
1737
|
-
};
|
|
1738
|
-
}
|
|
1739
|
-
function getInnerBoundingClientRect(element, strategy) {
|
|
1740
|
-
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
|
1741
|
-
const top = clientRect.top + element.clientTop;
|
|
1742
|
-
const left = clientRect.left + element.clientLeft;
|
|
1743
|
-
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
1744
|
-
const width = element.clientWidth * scale.x;
|
|
1745
|
-
const height = element.clientHeight * scale.y;
|
|
1746
|
-
const x = left * scale.x;
|
|
1747
|
-
const y = top * scale.y;
|
|
1748
|
-
return {
|
|
1749
|
-
width,
|
|
1750
|
-
height,
|
|
1751
|
-
x,
|
|
1752
|
-
y
|
|
1753
|
-
};
|
|
1754
|
-
}
|
|
1755
|
-
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
1756
|
-
let rect;
|
|
1757
|
-
if (clippingAncestor === "viewport") {
|
|
1758
|
-
rect = getViewportRect(element, strategy);
|
|
1759
|
-
} else if (clippingAncestor === "document") {
|
|
1760
|
-
rect = getDocumentRect(getDocumentElement(element));
|
|
1761
|
-
} else if (isElement(clippingAncestor)) {
|
|
1762
|
-
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
1763
|
-
} else {
|
|
1764
|
-
const visualOffsets = getVisualOffsets(element);
|
|
1765
|
-
rect = {
|
|
1766
|
-
x: clippingAncestor.x - visualOffsets.x,
|
|
1767
|
-
y: clippingAncestor.y - visualOffsets.y,
|
|
1768
|
-
width: clippingAncestor.width,
|
|
1769
|
-
height: clippingAncestor.height
|
|
1770
|
-
};
|
|
1771
|
-
}
|
|
1772
|
-
return rectToClientRect(rect);
|
|
1773
|
-
}
|
|
1774
|
-
function hasFixedPositionAncestor(element, stopNode) {
|
|
1775
|
-
const parentNode = getParentNode(element);
|
|
1776
|
-
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
1777
|
-
return false;
|
|
1778
|
-
}
|
|
1779
|
-
return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
|
|
1780
|
-
}
|
|
1781
|
-
function getClippingElementAncestors(element, cache) {
|
|
1782
|
-
const cachedResult = cache.get(element);
|
|
1783
|
-
if (cachedResult) {
|
|
1784
|
-
return cachedResult;
|
|
1785
|
-
}
|
|
1786
|
-
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
|
1787
|
-
let currentContainingBlockComputedStyle = null;
|
|
1788
|
-
const elementIsFixed = getComputedStyle2(element).position === "fixed";
|
|
1789
|
-
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
1790
|
-
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1791
|
-
const computedStyle = getComputedStyle2(currentNode);
|
|
1792
|
-
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
1793
|
-
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
|
|
1794
|
-
currentContainingBlockComputedStyle = null;
|
|
1795
|
-
}
|
|
1796
|
-
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
1797
|
-
if (shouldDropCurrentNode) {
|
|
1798
|
-
result = result.filter((ancestor) => ancestor !== currentNode);
|
|
1799
|
-
} else {
|
|
1800
|
-
currentContainingBlockComputedStyle = computedStyle;
|
|
1801
|
-
}
|
|
1802
|
-
currentNode = getParentNode(currentNode);
|
|
1803
|
-
}
|
|
1804
|
-
cache.set(element, result);
|
|
1805
|
-
return result;
|
|
1806
|
-
}
|
|
1807
|
-
function getClippingRect(_ref) {
|
|
1808
|
-
let {
|
|
1809
|
-
element,
|
|
1810
|
-
boundary,
|
|
1811
|
-
rootBoundary,
|
|
1812
|
-
strategy
|
|
1813
|
-
} = _ref;
|
|
1814
|
-
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
1815
|
-
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
1816
|
-
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
|
|
1817
|
-
let top = firstRect.top;
|
|
1818
|
-
let right = firstRect.right;
|
|
1819
|
-
let bottom = firstRect.bottom;
|
|
1820
|
-
let left = firstRect.left;
|
|
1821
|
-
for (let i = 1; i < clippingAncestors.length; i++) {
|
|
1822
|
-
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
|
|
1823
|
-
top = max(rect.top, top);
|
|
1824
|
-
right = min(rect.right, right);
|
|
1825
|
-
bottom = min(rect.bottom, bottom);
|
|
1826
|
-
left = max(rect.left, left);
|
|
1827
|
-
}
|
|
1828
|
-
return {
|
|
1829
|
-
width: right - left,
|
|
1830
|
-
height: bottom - top,
|
|
1831
|
-
x: left,
|
|
1832
|
-
y: top
|
|
1833
|
-
};
|
|
1834
|
-
}
|
|
1835
|
-
function getDimensions(element) {
|
|
1836
|
-
const {
|
|
1837
|
-
width,
|
|
1838
|
-
height
|
|
1839
|
-
} = getCssDimensions(element);
|
|
1840
|
-
return {
|
|
1841
|
-
width,
|
|
1842
|
-
height
|
|
1843
|
-
};
|
|
1844
|
-
}
|
|
1845
|
-
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
1846
|
-
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1847
|
-
const documentElement = getDocumentElement(offsetParent);
|
|
1848
|
-
const isFixed = strategy === "fixed";
|
|
1849
|
-
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
1850
|
-
let scroll = {
|
|
1851
|
-
scrollLeft: 0,
|
|
1852
|
-
scrollTop: 0
|
|
1853
|
-
};
|
|
1854
|
-
const offsets = createCoords(0);
|
|
1855
|
-
function setLeftRTLScrollbarOffset() {
|
|
1856
|
-
offsets.x = getWindowScrollBarX(documentElement);
|
|
1857
|
-
}
|
|
1858
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1859
|
-
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
1860
|
-
scroll = getNodeScroll(offsetParent);
|
|
1861
|
-
}
|
|
1862
|
-
if (isOffsetParentAnElement) {
|
|
1863
|
-
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
1864
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1865
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1866
|
-
} else if (documentElement) {
|
|
1867
|
-
setLeftRTLScrollbarOffset();
|
|
1868
|
-
}
|
|
1869
|
-
}
|
|
1870
|
-
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
|
1871
|
-
setLeftRTLScrollbarOffset();
|
|
1872
|
-
}
|
|
1873
|
-
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
1874
|
-
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
1875
|
-
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
1876
|
-
return {
|
|
1877
|
-
x,
|
|
1878
|
-
y,
|
|
1879
|
-
width: rect.width,
|
|
1880
|
-
height: rect.height
|
|
1881
|
-
};
|
|
1882
|
-
}
|
|
1883
|
-
function isStaticPositioned(element) {
|
|
1884
|
-
return getComputedStyle2(element).position === "static";
|
|
1885
|
-
}
|
|
1886
|
-
function getTrueOffsetParent(element, polyfill) {
|
|
1887
|
-
if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
|
|
1888
|
-
return null;
|
|
1889
|
-
}
|
|
1890
|
-
if (polyfill) {
|
|
1891
|
-
return polyfill(element);
|
|
1892
|
-
}
|
|
1893
|
-
let rawOffsetParent = element.offsetParent;
|
|
1894
|
-
if (getDocumentElement(element) === rawOffsetParent) {
|
|
1895
|
-
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
1896
|
-
}
|
|
1897
|
-
return rawOffsetParent;
|
|
1898
|
-
}
|
|
1899
|
-
function getOffsetParent(element, polyfill) {
|
|
1900
|
-
const win = getWindow(element);
|
|
1901
|
-
if (isTopLayer(element)) {
|
|
1902
|
-
return win;
|
|
1903
|
-
}
|
|
1904
|
-
if (!isHTMLElement(element)) {
|
|
1905
|
-
let svgOffsetParent = getParentNode(element);
|
|
1906
|
-
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
1907
|
-
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
1908
|
-
return svgOffsetParent;
|
|
1909
|
-
}
|
|
1910
|
-
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
1911
|
-
}
|
|
1912
|
-
return win;
|
|
1913
|
-
}
|
|
1914
|
-
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
1915
|
-
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
1916
|
-
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
1917
|
-
}
|
|
1918
|
-
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
1919
|
-
return win;
|
|
1920
|
-
}
|
|
1921
|
-
return offsetParent || getContainingBlock(element) || win;
|
|
1922
|
-
}
|
|
1923
|
-
var getElementRects = async function(data) {
|
|
1924
|
-
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
1925
|
-
const getDimensionsFn = this.getDimensions;
|
|
1926
|
-
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
1927
|
-
return {
|
|
1928
|
-
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
1929
|
-
floating: {
|
|
1930
|
-
x: 0,
|
|
1931
|
-
y: 0,
|
|
1932
|
-
width: floatingDimensions.width,
|
|
1933
|
-
height: floatingDimensions.height
|
|
1934
|
-
}
|
|
1935
|
-
};
|
|
1936
|
-
};
|
|
1937
|
-
function isRTL(element) {
|
|
1938
|
-
return getComputedStyle2(element).direction === "rtl";
|
|
1939
|
-
}
|
|
1940
|
-
var platform = {
|
|
1941
|
-
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
1942
|
-
getDocumentElement,
|
|
1943
|
-
getClippingRect,
|
|
1944
|
-
getOffsetParent,
|
|
1945
|
-
getElementRects,
|
|
1946
|
-
getClientRects,
|
|
1947
|
-
getDimensions,
|
|
1948
|
-
getScale,
|
|
1949
|
-
isElement,
|
|
1950
|
-
isRTL
|
|
1951
|
-
};
|
|
1952
|
-
function rectsAreEqual(a, b) {
|
|
1953
|
-
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
1954
|
-
}
|
|
1955
|
-
function observeMove(element, onMove) {
|
|
1956
|
-
let io = null;
|
|
1957
|
-
let timeoutId;
|
|
1958
|
-
const root = getDocumentElement(element);
|
|
1959
|
-
function cleanup() {
|
|
1960
|
-
var _io;
|
|
1961
|
-
clearTimeout(timeoutId);
|
|
1962
|
-
(_io = io) == null || _io.disconnect();
|
|
1963
|
-
io = null;
|
|
1964
|
-
}
|
|
1965
|
-
function refresh(skip, threshold) {
|
|
1966
|
-
if (skip === void 0) {
|
|
1967
|
-
skip = false;
|
|
1968
|
-
}
|
|
1969
|
-
if (threshold === void 0) {
|
|
1970
|
-
threshold = 1;
|
|
1971
|
-
}
|
|
1972
|
-
cleanup();
|
|
1973
|
-
const elementRectForRootMargin = element.getBoundingClientRect();
|
|
1974
|
-
const {
|
|
1975
|
-
left,
|
|
1976
|
-
top,
|
|
1977
|
-
width,
|
|
1978
|
-
height
|
|
1979
|
-
} = elementRectForRootMargin;
|
|
1980
|
-
if (!skip) {
|
|
1981
|
-
onMove();
|
|
1982
|
-
}
|
|
1983
|
-
if (!width || !height) {
|
|
1984
|
-
return;
|
|
1985
|
-
}
|
|
1986
|
-
const insetTop = floor(top);
|
|
1987
|
-
const insetRight = floor(root.clientWidth - (left + width));
|
|
1988
|
-
const insetBottom = floor(root.clientHeight - (top + height));
|
|
1989
|
-
const insetLeft = floor(left);
|
|
1990
|
-
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
1991
|
-
const options = {
|
|
1992
|
-
rootMargin,
|
|
1993
|
-
threshold: max(0, min(1, threshold)) || 1
|
|
1994
|
-
};
|
|
1995
|
-
let isFirstUpdate = true;
|
|
1996
|
-
function handleObserve(entries) {
|
|
1997
|
-
const ratio = entries[0].intersectionRatio;
|
|
1998
|
-
if (ratio !== threshold) {
|
|
1999
|
-
if (!isFirstUpdate) {
|
|
2000
|
-
return refresh();
|
|
2001
|
-
}
|
|
2002
|
-
if (!ratio) {
|
|
2003
|
-
timeoutId = setTimeout(() => {
|
|
2004
|
-
refresh(false, 1e-7);
|
|
2005
|
-
}, 1e3);
|
|
2006
|
-
} else {
|
|
2007
|
-
refresh(false, ratio);
|
|
2008
|
-
}
|
|
2009
|
-
}
|
|
2010
|
-
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
|
2011
|
-
refresh();
|
|
2012
|
-
}
|
|
2013
|
-
isFirstUpdate = false;
|
|
2014
|
-
}
|
|
2015
|
-
try {
|
|
2016
|
-
io = new IntersectionObserver(handleObserve, {
|
|
2017
|
-
...options,
|
|
2018
|
-
// Handle <iframe>s
|
|
2019
|
-
root: root.ownerDocument
|
|
2020
|
-
});
|
|
2021
|
-
} catch (_e) {
|
|
2022
|
-
io = new IntersectionObserver(handleObserve, options);
|
|
2023
|
-
}
|
|
2024
|
-
io.observe(element);
|
|
2025
|
-
}
|
|
2026
|
-
refresh(true);
|
|
2027
|
-
return cleanup;
|
|
2028
|
-
}
|
|
2029
|
-
function autoUpdate(reference, floating, update, options) {
|
|
2030
|
-
if (options === void 0) {
|
|
2031
|
-
options = {};
|
|
2032
|
-
}
|
|
2033
|
-
const {
|
|
2034
|
-
ancestorScroll = true,
|
|
2035
|
-
ancestorResize = true,
|
|
2036
|
-
elementResize = typeof ResizeObserver === "function",
|
|
2037
|
-
layoutShift = typeof IntersectionObserver === "function",
|
|
2038
|
-
animationFrame = false
|
|
2039
|
-
} = options;
|
|
2040
|
-
const referenceEl = unwrapElement(reference);
|
|
2041
|
-
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
|
|
2042
|
-
ancestors.forEach((ancestor) => {
|
|
2043
|
-
ancestorScroll && ancestor.addEventListener("scroll", update, {
|
|
2044
|
-
passive: true
|
|
2045
|
-
});
|
|
2046
|
-
ancestorResize && ancestor.addEventListener("resize", update);
|
|
2047
|
-
});
|
|
2048
|
-
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
2049
|
-
let reobserveFrame = -1;
|
|
2050
|
-
let resizeObserver = null;
|
|
2051
|
-
if (elementResize) {
|
|
2052
|
-
resizeObserver = new ResizeObserver((_ref) => {
|
|
2053
|
-
let [firstEntry] = _ref;
|
|
2054
|
-
if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
|
|
2055
|
-
resizeObserver.unobserve(floating);
|
|
2056
|
-
cancelAnimationFrame(reobserveFrame);
|
|
2057
|
-
reobserveFrame = requestAnimationFrame(() => {
|
|
2058
|
-
var _resizeObserver;
|
|
2059
|
-
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
2060
|
-
});
|
|
2061
|
-
}
|
|
2062
|
-
update();
|
|
2063
|
-
});
|
|
2064
|
-
if (referenceEl && !animationFrame) {
|
|
2065
|
-
resizeObserver.observe(referenceEl);
|
|
2066
|
-
}
|
|
2067
|
-
if (floating) {
|
|
2068
|
-
resizeObserver.observe(floating);
|
|
2069
|
-
}
|
|
2070
|
-
}
|
|
2071
|
-
let frameId;
|
|
2072
|
-
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
2073
|
-
if (animationFrame) {
|
|
2074
|
-
frameLoop();
|
|
2075
|
-
}
|
|
2076
|
-
function frameLoop() {
|
|
2077
|
-
const nextRefRect = getBoundingClientRect(reference);
|
|
2078
|
-
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
|
2079
|
-
update();
|
|
2080
|
-
}
|
|
2081
|
-
prevRefRect = nextRefRect;
|
|
2082
|
-
frameId = requestAnimationFrame(frameLoop);
|
|
2083
|
-
}
|
|
2084
|
-
update();
|
|
2085
|
-
return () => {
|
|
2086
|
-
var _resizeObserver2;
|
|
2087
|
-
ancestors.forEach((ancestor) => {
|
|
2088
|
-
ancestorScroll && ancestor.removeEventListener("scroll", update);
|
|
2089
|
-
ancestorResize && ancestor.removeEventListener("resize", update);
|
|
2090
|
-
});
|
|
2091
|
-
cleanupIo == null || cleanupIo();
|
|
2092
|
-
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
2093
|
-
resizeObserver = null;
|
|
2094
|
-
if (animationFrame) {
|
|
2095
|
-
cancelAnimationFrame(frameId);
|
|
2096
|
-
}
|
|
2097
|
-
};
|
|
2098
|
-
}
|
|
2099
|
-
var offset2 = offset;
|
|
2100
|
-
var shift2 = shift;
|
|
2101
|
-
var flip2 = flip;
|
|
2102
|
-
var size2 = size;
|
|
2103
|
-
var hide2 = hide;
|
|
2104
|
-
var arrow2 = arrow;
|
|
2105
|
-
var limitShift2 = limitShift;
|
|
2106
|
-
var computePosition2 = (reference, floating, options) => {
|
|
2107
|
-
const cache = /* @__PURE__ */ new Map();
|
|
2108
|
-
const mergedOptions = {
|
|
2109
|
-
platform,
|
|
2110
|
-
...options
|
|
2111
|
-
};
|
|
2112
|
-
const platformWithCache = {
|
|
2113
|
-
...mergedOptions.platform,
|
|
2114
|
-
_c: cache
|
|
2115
|
-
};
|
|
2116
|
-
return computePosition(reference, floating, {
|
|
2117
|
-
...mergedOptions,
|
|
2118
|
-
platform: platformWithCache
|
|
2119
|
-
});
|
|
2120
|
-
};
|
|
2121
|
-
|
|
2122
|
-
// ../../node_modules/.pnpm/@floating-ui+react-dom@2.1.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs
|
|
2123
|
-
var React5 = __toESM(require_react(), 1);
|
|
2124
|
-
var import_react = __toESM(require_react(), 1);
|
|
2125
|
-
var ReactDOM = __toESM(require_react_dom(), 1);
|
|
2126
|
-
var isClient = typeof document !== "undefined";
|
|
2127
|
-
var noop = function noop2() {
|
|
2128
|
-
};
|
|
2129
|
-
var index = isClient ? import_react.useLayoutEffect : noop;
|
|
2130
|
-
function deepEqual(a, b) {
|
|
2131
|
-
if (a === b) {
|
|
2132
|
-
return true;
|
|
2133
|
-
}
|
|
2134
|
-
if (typeof a !== typeof b) {
|
|
2135
|
-
return false;
|
|
2136
|
-
}
|
|
2137
|
-
if (typeof a === "function" && a.toString() === b.toString()) {
|
|
2138
|
-
return true;
|
|
2139
|
-
}
|
|
2140
|
-
let length;
|
|
2141
|
-
let i;
|
|
2142
|
-
let keys;
|
|
2143
|
-
if (a && b && typeof a === "object") {
|
|
2144
|
-
if (Array.isArray(a)) {
|
|
2145
|
-
length = a.length;
|
|
2146
|
-
if (length !== b.length) return false;
|
|
2147
|
-
for (i = length; i-- !== 0; ) {
|
|
2148
|
-
if (!deepEqual(a[i], b[i])) {
|
|
2149
|
-
return false;
|
|
2150
|
-
}
|
|
2151
|
-
}
|
|
2152
|
-
return true;
|
|
2153
|
-
}
|
|
2154
|
-
keys = Object.keys(a);
|
|
2155
|
-
length = keys.length;
|
|
2156
|
-
if (length !== Object.keys(b).length) {
|
|
2157
|
-
return false;
|
|
2158
|
-
}
|
|
2159
|
-
for (i = length; i-- !== 0; ) {
|
|
2160
|
-
if (!{}.hasOwnProperty.call(b, keys[i])) {
|
|
2161
|
-
return false;
|
|
2162
|
-
}
|
|
2163
|
-
}
|
|
2164
|
-
for (i = length; i-- !== 0; ) {
|
|
2165
|
-
const key = keys[i];
|
|
2166
|
-
if (key === "_owner" && a.$$typeof) {
|
|
2167
|
-
continue;
|
|
2168
|
-
}
|
|
2169
|
-
if (!deepEqual(a[key], b[key])) {
|
|
2170
|
-
return false;
|
|
2171
|
-
}
|
|
2172
|
-
}
|
|
2173
|
-
return true;
|
|
2174
|
-
}
|
|
2175
|
-
return a !== a && b !== b;
|
|
2176
|
-
}
|
|
2177
|
-
function getDPR(element) {
|
|
2178
|
-
if (typeof window === "undefined") {
|
|
2179
|
-
return 1;
|
|
2180
|
-
}
|
|
2181
|
-
const win = element.ownerDocument.defaultView || window;
|
|
2182
|
-
return win.devicePixelRatio || 1;
|
|
2183
|
-
}
|
|
2184
|
-
function roundByDPR(element, value) {
|
|
2185
|
-
const dpr = getDPR(element);
|
|
2186
|
-
return Math.round(value * dpr) / dpr;
|
|
2187
|
-
}
|
|
2188
|
-
function useLatestRef(value) {
|
|
2189
|
-
const ref = React5.useRef(value);
|
|
2190
|
-
index(() => {
|
|
2191
|
-
ref.current = value;
|
|
2192
|
-
});
|
|
2193
|
-
return ref;
|
|
2194
|
-
}
|
|
2195
|
-
function useFloating(options) {
|
|
2196
|
-
if (options === void 0) {
|
|
2197
|
-
options = {};
|
|
2198
|
-
}
|
|
2199
|
-
const {
|
|
2200
|
-
placement = "bottom",
|
|
2201
|
-
strategy = "absolute",
|
|
2202
|
-
middleware = [],
|
|
2203
|
-
platform: platform2,
|
|
2204
|
-
elements: {
|
|
2205
|
-
reference: externalReference,
|
|
2206
|
-
floating: externalFloating
|
|
2207
|
-
} = {},
|
|
2208
|
-
transform = true,
|
|
2209
|
-
whileElementsMounted,
|
|
2210
|
-
open
|
|
2211
|
-
} = options;
|
|
2212
|
-
const [data, setData] = React5.useState({
|
|
2213
|
-
x: 0,
|
|
2214
|
-
y: 0,
|
|
2215
|
-
strategy,
|
|
2216
|
-
placement,
|
|
2217
|
-
middlewareData: {},
|
|
2218
|
-
isPositioned: false
|
|
2219
|
-
});
|
|
2220
|
-
const [latestMiddleware, setLatestMiddleware] = React5.useState(middleware);
|
|
2221
|
-
if (!deepEqual(latestMiddleware, middleware)) {
|
|
2222
|
-
setLatestMiddleware(middleware);
|
|
2223
|
-
}
|
|
2224
|
-
const [_reference, _setReference] = React5.useState(null);
|
|
2225
|
-
const [_floating, _setFloating] = React5.useState(null);
|
|
2226
|
-
const setReference = React5.useCallback((node) => {
|
|
2227
|
-
if (node !== referenceRef.current) {
|
|
2228
|
-
referenceRef.current = node;
|
|
2229
|
-
_setReference(node);
|
|
2230
|
-
}
|
|
2231
|
-
}, []);
|
|
2232
|
-
const setFloating = React5.useCallback((node) => {
|
|
2233
|
-
if (node !== floatingRef.current) {
|
|
2234
|
-
floatingRef.current = node;
|
|
2235
|
-
_setFloating(node);
|
|
2236
|
-
}
|
|
2237
|
-
}, []);
|
|
2238
|
-
const referenceEl = externalReference || _reference;
|
|
2239
|
-
const floatingEl = externalFloating || _floating;
|
|
2240
|
-
const referenceRef = React5.useRef(null);
|
|
2241
|
-
const floatingRef = React5.useRef(null);
|
|
2242
|
-
const dataRef = React5.useRef(data);
|
|
2243
|
-
const hasWhileElementsMounted = whileElementsMounted != null;
|
|
2244
|
-
const whileElementsMountedRef = useLatestRef(whileElementsMounted);
|
|
2245
|
-
const platformRef = useLatestRef(platform2);
|
|
2246
|
-
const openRef = useLatestRef(open);
|
|
2247
|
-
const update = React5.useCallback(() => {
|
|
2248
|
-
if (!referenceRef.current || !floatingRef.current) {
|
|
2249
|
-
return;
|
|
2250
|
-
}
|
|
2251
|
-
const config = {
|
|
2252
|
-
placement,
|
|
2253
|
-
strategy,
|
|
2254
|
-
middleware: latestMiddleware
|
|
2255
|
-
};
|
|
2256
|
-
if (platformRef.current) {
|
|
2257
|
-
config.platform = platformRef.current;
|
|
2258
|
-
}
|
|
2259
|
-
computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => {
|
|
2260
|
-
const fullData = {
|
|
2261
|
-
...data2,
|
|
2262
|
-
// The floating element's position may be recomputed while it's closed
|
|
2263
|
-
// but still mounted (such as when transitioning out). To ensure
|
|
2264
|
-
// `isPositioned` will be `false` initially on the next open, avoid
|
|
2265
|
-
// setting it to `true` when `open === false` (must be specified).
|
|
2266
|
-
isPositioned: openRef.current !== false
|
|
2267
|
-
};
|
|
2268
|
-
if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
|
|
2269
|
-
dataRef.current = fullData;
|
|
2270
|
-
ReactDOM.flushSync(() => {
|
|
2271
|
-
setData(fullData);
|
|
2272
|
-
});
|
|
2273
|
-
}
|
|
2274
|
-
});
|
|
2275
|
-
}, [latestMiddleware, placement, strategy, platformRef, openRef]);
|
|
2276
|
-
index(() => {
|
|
2277
|
-
if (open === false && dataRef.current.isPositioned) {
|
|
2278
|
-
dataRef.current.isPositioned = false;
|
|
2279
|
-
setData((data2) => ({
|
|
2280
|
-
...data2,
|
|
2281
|
-
isPositioned: false
|
|
2282
|
-
}));
|
|
2283
|
-
}
|
|
2284
|
-
}, [open]);
|
|
2285
|
-
const isMountedRef = React5.useRef(false);
|
|
2286
|
-
index(() => {
|
|
2287
|
-
isMountedRef.current = true;
|
|
2288
|
-
return () => {
|
|
2289
|
-
isMountedRef.current = false;
|
|
2290
|
-
};
|
|
2291
|
-
}, []);
|
|
2292
|
-
index(() => {
|
|
2293
|
-
if (referenceEl) referenceRef.current = referenceEl;
|
|
2294
|
-
if (floatingEl) floatingRef.current = floatingEl;
|
|
2295
|
-
if (referenceEl && floatingEl) {
|
|
2296
|
-
if (whileElementsMountedRef.current) {
|
|
2297
|
-
return whileElementsMountedRef.current(referenceEl, floatingEl, update);
|
|
2298
|
-
}
|
|
2299
|
-
update();
|
|
2300
|
-
}
|
|
2301
|
-
}, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
|
|
2302
|
-
const refs = React5.useMemo(() => ({
|
|
2303
|
-
reference: referenceRef,
|
|
2304
|
-
floating: floatingRef,
|
|
2305
|
-
setReference,
|
|
2306
|
-
setFloating
|
|
2307
|
-
}), [setReference, setFloating]);
|
|
2308
|
-
const elements = React5.useMemo(() => ({
|
|
2309
|
-
reference: referenceEl,
|
|
2310
|
-
floating: floatingEl
|
|
2311
|
-
}), [referenceEl, floatingEl]);
|
|
2312
|
-
const floatingStyles = React5.useMemo(() => {
|
|
2313
|
-
const initialStyles = {
|
|
2314
|
-
position: strategy,
|
|
2315
|
-
left: 0,
|
|
2316
|
-
top: 0
|
|
2317
|
-
};
|
|
2318
|
-
if (!elements.floating) {
|
|
2319
|
-
return initialStyles;
|
|
2320
|
-
}
|
|
2321
|
-
const x = roundByDPR(elements.floating, data.x);
|
|
2322
|
-
const y = roundByDPR(elements.floating, data.y);
|
|
2323
|
-
if (transform) {
|
|
2324
|
-
return {
|
|
2325
|
-
...initialStyles,
|
|
2326
|
-
transform: "translate(" + x + "px, " + y + "px)",
|
|
2327
|
-
...getDPR(elements.floating) >= 1.5 && {
|
|
2328
|
-
willChange: "transform"
|
|
2329
|
-
}
|
|
2330
|
-
};
|
|
2331
|
-
}
|
|
2332
|
-
return {
|
|
2333
|
-
position: strategy,
|
|
2334
|
-
left: x,
|
|
2335
|
-
top: y
|
|
2336
|
-
};
|
|
2337
|
-
}, [strategy, transform, elements.floating, data.x, data.y]);
|
|
2338
|
-
return React5.useMemo(() => ({
|
|
2339
|
-
...data,
|
|
2340
|
-
update,
|
|
2341
|
-
refs,
|
|
2342
|
-
elements,
|
|
2343
|
-
floatingStyles
|
|
2344
|
-
}), [data, update, refs, elements, floatingStyles]);
|
|
2345
|
-
}
|
|
2346
|
-
var arrow$1 = (options) => {
|
|
2347
|
-
function isRef(value) {
|
|
2348
|
-
return {}.hasOwnProperty.call(value, "current");
|
|
2349
|
-
}
|
|
2350
|
-
return {
|
|
2351
|
-
name: "arrow",
|
|
2352
|
-
options,
|
|
2353
|
-
fn(state) {
|
|
2354
|
-
const {
|
|
2355
|
-
element,
|
|
2356
|
-
padding
|
|
2357
|
-
} = typeof options === "function" ? options(state) : options;
|
|
2358
|
-
if (element && isRef(element)) {
|
|
2359
|
-
if (element.current != null) {
|
|
2360
|
-
return arrow2({
|
|
2361
|
-
element: element.current,
|
|
2362
|
-
padding
|
|
2363
|
-
}).fn(state);
|
|
2364
|
-
}
|
|
2365
|
-
return {};
|
|
2366
|
-
}
|
|
2367
|
-
if (element) {
|
|
2368
|
-
return arrow2({
|
|
2369
|
-
element,
|
|
2370
|
-
padding
|
|
2371
|
-
}).fn(state);
|
|
2372
|
-
}
|
|
2373
|
-
return {};
|
|
2374
|
-
}
|
|
2375
|
-
};
|
|
2376
|
-
};
|
|
2377
|
-
var offset3 = (options, deps) => {
|
|
2378
|
-
const result = offset2(options);
|
|
2379
|
-
return {
|
|
2380
|
-
name: result.name,
|
|
2381
|
-
fn: result.fn,
|
|
2382
|
-
options: [options, deps]
|
|
2383
|
-
};
|
|
2384
|
-
};
|
|
2385
|
-
var shift3 = (options, deps) => {
|
|
2386
|
-
const result = shift2(options);
|
|
2387
|
-
return {
|
|
2388
|
-
name: result.name,
|
|
2389
|
-
fn: result.fn,
|
|
2390
|
-
options: [options, deps]
|
|
2391
|
-
};
|
|
2392
|
-
};
|
|
2393
|
-
var limitShift3 = (options, deps) => {
|
|
2394
|
-
const result = limitShift2(options);
|
|
2395
|
-
return {
|
|
2396
|
-
fn: result.fn,
|
|
2397
|
-
options: [options, deps]
|
|
2398
|
-
};
|
|
2399
|
-
};
|
|
2400
|
-
var flip3 = (options, deps) => {
|
|
2401
|
-
const result = flip2(options);
|
|
2402
|
-
return {
|
|
2403
|
-
name: result.name,
|
|
2404
|
-
fn: result.fn,
|
|
2405
|
-
options: [options, deps]
|
|
2406
|
-
};
|
|
2407
|
-
};
|
|
2408
|
-
var size3 = (options, deps) => {
|
|
2409
|
-
const result = size2(options);
|
|
2410
|
-
return {
|
|
2411
|
-
name: result.name,
|
|
2412
|
-
fn: result.fn,
|
|
2413
|
-
options: [options, deps]
|
|
2414
|
-
};
|
|
2415
|
-
};
|
|
2416
|
-
var hide3 = (options, deps) => {
|
|
2417
|
-
const result = hide2(options);
|
|
2418
|
-
return {
|
|
2419
|
-
name: result.name,
|
|
2420
|
-
fn: result.fn,
|
|
2421
|
-
options: [options, deps]
|
|
2422
|
-
};
|
|
2423
|
-
};
|
|
2424
|
-
var arrow3 = (options, deps) => {
|
|
2425
|
-
const result = arrow$1(options);
|
|
2426
|
-
return {
|
|
2427
|
-
name: result.name,
|
|
2428
|
-
fn: result.fn,
|
|
2429
|
-
options: [options, deps]
|
|
2430
|
-
};
|
|
2431
|
-
};
|
|
2432
|
-
|
|
2433
|
-
// ../../node_modules/.pnpm/@radix-ui+react-arrow@1.1.7_@types+react-dom@18.3.7_@types+react@18.3.28__@types+react@18.3.2_lbj66q6qwe355si73ctvb4taje/node_modules/@radix-ui/react-arrow/dist/index.mjs
|
|
2434
|
-
var React6 = __toESM(require_react(), 1);
|
|
2435
|
-
var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
|
|
2436
|
-
var NAME = "Arrow";
|
|
2437
|
-
var Arrow = React6.forwardRef((props, forwardedRef) => {
|
|
2438
|
-
const { children, width = 10, height = 5, ...arrowProps } = props;
|
|
2439
|
-
return (0, import_jsx_runtime3.jsx)(
|
|
2440
|
-
Primitive.svg,
|
|
2441
|
-
{
|
|
2442
|
-
...arrowProps,
|
|
2443
|
-
ref: forwardedRef,
|
|
2444
|
-
width,
|
|
2445
|
-
height,
|
|
2446
|
-
viewBox: "0 0 30 10",
|
|
2447
|
-
preserveAspectRatio: "none",
|
|
2448
|
-
children: props.asChild ? children : (0, import_jsx_runtime3.jsx)("polygon", { points: "0,0 30,0 15,10" })
|
|
2449
|
-
}
|
|
2450
|
-
);
|
|
2451
|
-
});
|
|
2452
|
-
Arrow.displayName = NAME;
|
|
2453
|
-
var Root = Arrow;
|
|
2454
|
-
|
|
2455
|
-
// ../../node_modules/.pnpm/@radix-ui+react-popper@1.2.8_@types+react-dom@18.3.7_@types+react@18.3.28__@types+react@18.3._77iomgpzr7j45nth4ka2sx4zcq/node_modules/@radix-ui/react-popper/dist/index.mjs
|
|
2456
|
-
var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
|
|
2457
|
-
var POPPER_NAME = "Popper";
|
|
2458
|
-
var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
2459
|
-
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
2460
|
-
var Popper = (props) => {
|
|
2461
|
-
const { __scopePopper, children } = props;
|
|
2462
|
-
const [anchor, setAnchor] = React7.useState(null);
|
|
2463
|
-
return (0, import_jsx_runtime4.jsx)(PopperProvider, { scope: __scopePopper, anchor, onAnchorChange: setAnchor, children });
|
|
2464
|
-
};
|
|
2465
|
-
Popper.displayName = POPPER_NAME;
|
|
2466
|
-
var ANCHOR_NAME = "PopperAnchor";
|
|
2467
|
-
var PopperAnchor = React7.forwardRef(
|
|
2468
|
-
(props, forwardedRef) => {
|
|
2469
|
-
const { __scopePopper, virtualRef, ...anchorProps } = props;
|
|
2470
|
-
const context = usePopperContext(ANCHOR_NAME, __scopePopper);
|
|
2471
|
-
const ref = React7.useRef(null);
|
|
2472
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
2473
|
-
const anchorRef = React7.useRef(null);
|
|
2474
|
-
React7.useEffect(() => {
|
|
2475
|
-
const previousAnchor = anchorRef.current;
|
|
2476
|
-
anchorRef.current = (virtualRef == null ? void 0 : virtualRef.current) || ref.current;
|
|
2477
|
-
if (previousAnchor !== anchorRef.current) {
|
|
2478
|
-
context.onAnchorChange(anchorRef.current);
|
|
2479
|
-
}
|
|
2480
|
-
});
|
|
2481
|
-
return virtualRef ? null : (0, import_jsx_runtime4.jsx)(Primitive.div, { ...anchorProps, ref: composedRefs });
|
|
2482
|
-
}
|
|
2483
|
-
);
|
|
2484
|
-
PopperAnchor.displayName = ANCHOR_NAME;
|
|
2485
|
-
var CONTENT_NAME = "PopperContent";
|
|
2486
|
-
var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME);
|
|
2487
|
-
var PopperContent = React7.forwardRef(
|
|
2488
|
-
(props, forwardedRef) => {
|
|
2489
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2490
|
-
const {
|
|
2491
|
-
__scopePopper,
|
|
2492
|
-
side = "bottom",
|
|
2493
|
-
sideOffset = 0,
|
|
2494
|
-
align = "center",
|
|
2495
|
-
alignOffset = 0,
|
|
2496
|
-
arrowPadding = 0,
|
|
2497
|
-
avoidCollisions = true,
|
|
2498
|
-
collisionBoundary = [],
|
|
2499
|
-
collisionPadding: collisionPaddingProp = 0,
|
|
2500
|
-
sticky = "partial",
|
|
2501
|
-
hideWhenDetached = false,
|
|
2502
|
-
updatePositionStrategy = "optimized",
|
|
2503
|
-
onPlaced,
|
|
2504
|
-
...contentProps
|
|
2505
|
-
} = props;
|
|
2506
|
-
const context = usePopperContext(CONTENT_NAME, __scopePopper);
|
|
2507
|
-
const [content, setContent] = React7.useState(null);
|
|
2508
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
|
|
2509
|
-
const [arrow4, setArrow] = React7.useState(null);
|
|
2510
|
-
const arrowSize = useSize(arrow4);
|
|
2511
|
-
const arrowWidth = (arrowSize == null ? void 0 : arrowSize.width) ?? 0;
|
|
2512
|
-
const arrowHeight = (arrowSize == null ? void 0 : arrowSize.height) ?? 0;
|
|
2513
|
-
const desiredPlacement = side + (align !== "center" ? "-" + align : "");
|
|
2514
|
-
const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };
|
|
2515
|
-
const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];
|
|
2516
|
-
const hasExplicitBoundaries = boundary.length > 0;
|
|
2517
|
-
const detectOverflowOptions = {
|
|
2518
|
-
padding: collisionPadding,
|
|
2519
|
-
boundary: boundary.filter(isNotNull),
|
|
2520
|
-
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
2521
|
-
altBoundary: hasExplicitBoundaries
|
|
2522
|
-
};
|
|
2523
|
-
const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({
|
|
2524
|
-
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
2525
|
-
strategy: "fixed",
|
|
2526
|
-
placement: desiredPlacement,
|
|
2527
|
-
whileElementsMounted: (...args) => {
|
|
2528
|
-
const cleanup = autoUpdate(...args, {
|
|
2529
|
-
animationFrame: updatePositionStrategy === "always"
|
|
2530
|
-
});
|
|
2531
|
-
return cleanup;
|
|
2532
|
-
},
|
|
2533
|
-
elements: {
|
|
2534
|
-
reference: context.anchor
|
|
2535
|
-
},
|
|
2536
|
-
middleware: [
|
|
2537
|
-
offset3({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),
|
|
2538
|
-
avoidCollisions && shift3({
|
|
2539
|
-
mainAxis: true,
|
|
2540
|
-
crossAxis: false,
|
|
2541
|
-
limiter: sticky === "partial" ? limitShift3() : void 0,
|
|
2542
|
-
...detectOverflowOptions
|
|
2543
|
-
}),
|
|
2544
|
-
avoidCollisions && flip3({ ...detectOverflowOptions }),
|
|
2545
|
-
size3({
|
|
2546
|
-
...detectOverflowOptions,
|
|
2547
|
-
apply: ({ elements, rects, availableWidth, availableHeight }) => {
|
|
2548
|
-
const { width: anchorWidth, height: anchorHeight } = rects.reference;
|
|
2549
|
-
const contentStyle = elements.floating.style;
|
|
2550
|
-
contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`);
|
|
2551
|
-
contentStyle.setProperty("--radix-popper-available-height", `${availableHeight}px`);
|
|
2552
|
-
contentStyle.setProperty("--radix-popper-anchor-width", `${anchorWidth}px`);
|
|
2553
|
-
contentStyle.setProperty("--radix-popper-anchor-height", `${anchorHeight}px`);
|
|
2554
|
-
}
|
|
2555
|
-
}),
|
|
2556
|
-
arrow4 && arrow3({ element: arrow4, padding: arrowPadding }),
|
|
2557
|
-
transformOrigin({ arrowWidth, arrowHeight }),
|
|
2558
|
-
hideWhenDetached && hide3({ strategy: "referenceHidden", ...detectOverflowOptions })
|
|
2559
|
-
]
|
|
2560
|
-
});
|
|
2561
|
-
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
2562
|
-
const handlePlaced = useCallbackRef(onPlaced);
|
|
2563
|
-
useLayoutEffect2(() => {
|
|
2564
|
-
if (isPositioned) {
|
|
2565
|
-
handlePlaced == null ? void 0 : handlePlaced();
|
|
2566
|
-
}
|
|
2567
|
-
}, [isPositioned, handlePlaced]);
|
|
2568
|
-
const arrowX = (_a = middlewareData.arrow) == null ? void 0 : _a.x;
|
|
2569
|
-
const arrowY = (_b = middlewareData.arrow) == null ? void 0 : _b.y;
|
|
2570
|
-
const cannotCenterArrow = ((_c = middlewareData.arrow) == null ? void 0 : _c.centerOffset) !== 0;
|
|
2571
|
-
const [contentZIndex, setContentZIndex] = React7.useState();
|
|
2572
|
-
useLayoutEffect2(() => {
|
|
2573
|
-
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
2574
|
-
}, [content]);
|
|
2575
|
-
return (0, import_jsx_runtime4.jsx)(
|
|
2576
|
-
"div",
|
|
2577
|
-
{
|
|
2578
|
-
ref: refs.setFloating,
|
|
2579
|
-
"data-radix-popper-content-wrapper": "",
|
|
2580
|
-
style: {
|
|
2581
|
-
...floatingStyles,
|
|
2582
|
-
transform: isPositioned ? floatingStyles.transform : "translate(0, -200%)",
|
|
2583
|
-
// keep off the page when measuring
|
|
2584
|
-
minWidth: "max-content",
|
|
2585
|
-
zIndex: contentZIndex,
|
|
2586
|
-
["--radix-popper-transform-origin"]: [
|
|
2587
|
-
(_d = middlewareData.transformOrigin) == null ? void 0 : _d.x,
|
|
2588
|
-
(_e = middlewareData.transformOrigin) == null ? void 0 : _e.y
|
|
2589
|
-
].join(" "),
|
|
2590
|
-
// hide the content if using the hide middleware and should be hidden
|
|
2591
|
-
// set visibility to hidden and disable pointer events so the UI behaves
|
|
2592
|
-
// as if the PopperContent isn't there at all
|
|
2593
|
-
...((_f = middlewareData.hide) == null ? void 0 : _f.referenceHidden) && {
|
|
2594
|
-
visibility: "hidden",
|
|
2595
|
-
pointerEvents: "none"
|
|
2596
|
-
}
|
|
2597
|
-
},
|
|
2598
|
-
dir: props.dir,
|
|
2599
|
-
children: (0, import_jsx_runtime4.jsx)(
|
|
2600
|
-
PopperContentProvider,
|
|
2601
|
-
{
|
|
2602
|
-
scope: __scopePopper,
|
|
2603
|
-
placedSide,
|
|
2604
|
-
onArrowChange: setArrow,
|
|
2605
|
-
arrowX,
|
|
2606
|
-
arrowY,
|
|
2607
|
-
shouldHideArrow: cannotCenterArrow,
|
|
2608
|
-
children: (0, import_jsx_runtime4.jsx)(
|
|
2609
|
-
Primitive.div,
|
|
2610
|
-
{
|
|
2611
|
-
"data-side": placedSide,
|
|
2612
|
-
"data-align": placedAlign,
|
|
2613
|
-
...contentProps,
|
|
2614
|
-
ref: composedRefs,
|
|
2615
|
-
style: {
|
|
2616
|
-
...contentProps.style,
|
|
2617
|
-
// if the PopperContent hasn't been placed yet (not all measurements done)
|
|
2618
|
-
// we prevent animations so that users's animation don't kick in too early referring wrong sides
|
|
2619
|
-
animation: !isPositioned ? "none" : void 0
|
|
2620
|
-
}
|
|
2621
|
-
}
|
|
2622
|
-
)
|
|
2623
|
-
}
|
|
2624
|
-
)
|
|
2625
|
-
}
|
|
2626
|
-
);
|
|
2627
|
-
}
|
|
2628
|
-
);
|
|
2629
|
-
PopperContent.displayName = CONTENT_NAME;
|
|
2630
|
-
var ARROW_NAME = "PopperArrow";
|
|
2631
|
-
var OPPOSITE_SIDE = {
|
|
2632
|
-
top: "bottom",
|
|
2633
|
-
right: "left",
|
|
2634
|
-
bottom: "top",
|
|
2635
|
-
left: "right"
|
|
2636
|
-
};
|
|
2637
|
-
var PopperArrow = React7.forwardRef(function PopperArrow2(props, forwardedRef) {
|
|
2638
|
-
const { __scopePopper, ...arrowProps } = props;
|
|
2639
|
-
const contentContext = useContentContext(ARROW_NAME, __scopePopper);
|
|
2640
|
-
const baseSide = OPPOSITE_SIDE[contentContext.placedSide];
|
|
2641
|
-
return (
|
|
2642
|
-
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
2643
|
-
// doesn't report size as we'd expect on SVG elements.
|
|
2644
|
-
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
2645
|
-
(0, import_jsx_runtime4.jsx)(
|
|
2646
|
-
"span",
|
|
2647
|
-
{
|
|
2648
|
-
ref: contentContext.onArrowChange,
|
|
2649
|
-
style: {
|
|
2650
|
-
position: "absolute",
|
|
2651
|
-
left: contentContext.arrowX,
|
|
2652
|
-
top: contentContext.arrowY,
|
|
2653
|
-
[baseSide]: 0,
|
|
2654
|
-
transformOrigin: {
|
|
2655
|
-
top: "",
|
|
2656
|
-
right: "0 0",
|
|
2657
|
-
bottom: "center 0",
|
|
2658
|
-
left: "100% 0"
|
|
2659
|
-
}[contentContext.placedSide],
|
|
2660
|
-
transform: {
|
|
2661
|
-
top: "translateY(100%)",
|
|
2662
|
-
right: "translateY(50%) rotate(90deg) translateX(-50%)",
|
|
2663
|
-
bottom: `rotate(180deg)`,
|
|
2664
|
-
left: "translateY(50%) rotate(-90deg) translateX(50%)"
|
|
2665
|
-
}[contentContext.placedSide],
|
|
2666
|
-
visibility: contentContext.shouldHideArrow ? "hidden" : void 0
|
|
2667
|
-
},
|
|
2668
|
-
children: (0, import_jsx_runtime4.jsx)(
|
|
2669
|
-
Root,
|
|
2670
|
-
{
|
|
2671
|
-
...arrowProps,
|
|
2672
|
-
ref: forwardedRef,
|
|
2673
|
-
style: {
|
|
2674
|
-
...arrowProps.style,
|
|
2675
|
-
// ensures the element can be measured correctly (mostly for if SVG)
|
|
2676
|
-
display: "block"
|
|
2677
|
-
}
|
|
2678
|
-
}
|
|
2679
|
-
)
|
|
2680
|
-
}
|
|
2681
|
-
)
|
|
2682
|
-
);
|
|
2683
|
-
});
|
|
2684
|
-
PopperArrow.displayName = ARROW_NAME;
|
|
2685
|
-
function isNotNull(value) {
|
|
2686
|
-
return value !== null;
|
|
2687
|
-
}
|
|
2688
|
-
var transformOrigin = (options) => ({
|
|
2689
|
-
name: "transformOrigin",
|
|
2690
|
-
options,
|
|
2691
|
-
fn(data) {
|
|
2692
|
-
var _a, _b, _c;
|
|
2693
|
-
const { placement, rects, middlewareData } = data;
|
|
2694
|
-
const cannotCenterArrow = ((_a = middlewareData.arrow) == null ? void 0 : _a.centerOffset) !== 0;
|
|
2695
|
-
const isArrowHidden = cannotCenterArrow;
|
|
2696
|
-
const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
|
|
2697
|
-
const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
|
|
2698
|
-
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
2699
|
-
const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign];
|
|
2700
|
-
const arrowXCenter = (((_b = middlewareData.arrow) == null ? void 0 : _b.x) ?? 0) + arrowWidth / 2;
|
|
2701
|
-
const arrowYCenter = (((_c = middlewareData.arrow) == null ? void 0 : _c.y) ?? 0) + arrowHeight / 2;
|
|
2702
|
-
let x = "";
|
|
2703
|
-
let y = "";
|
|
2704
|
-
if (placedSide === "bottom") {
|
|
2705
|
-
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
2706
|
-
y = `${-arrowHeight}px`;
|
|
2707
|
-
} else if (placedSide === "top") {
|
|
2708
|
-
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
2709
|
-
y = `${rects.floating.height + arrowHeight}px`;
|
|
2710
|
-
} else if (placedSide === "right") {
|
|
2711
|
-
x = `${-arrowHeight}px`;
|
|
2712
|
-
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
2713
|
-
} else if (placedSide === "left") {
|
|
2714
|
-
x = `${rects.floating.width + arrowHeight}px`;
|
|
2715
|
-
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
2716
|
-
}
|
|
2717
|
-
return { data: { x, y } };
|
|
2718
|
-
}
|
|
2719
|
-
});
|
|
2720
|
-
function getSideAndAlignFromPlacement(placement) {
|
|
2721
|
-
const [side, align = "center"] = placement.split("-");
|
|
2722
|
-
return [side, align];
|
|
2723
|
-
}
|
|
2724
|
-
var Root2 = Popper;
|
|
2725
|
-
var Anchor = PopperAnchor;
|
|
2726
|
-
var Content = PopperContent;
|
|
2727
|
-
var Arrow2 = PopperArrow;
|
|
2728
|
-
|
|
2729
|
-
// ../../node_modules/.pnpm/@radix-ui+react-portal@1.1.9_@types+react-dom@18.3.7_@types+react@18.3.28__@types+react@18.3._si5gqg2qtur3gbt6ibkxlv37vi/node_modules/@radix-ui/react-portal/dist/index.mjs
|
|
2730
|
-
var React8 = __toESM(require_react(), 1);
|
|
2731
|
-
var import_react_dom2 = __toESM(require_react_dom(), 1);
|
|
2732
|
-
var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
|
|
2733
|
-
var PORTAL_NAME = "Portal";
|
|
2734
|
-
var Portal = React8.forwardRef((props, forwardedRef) => {
|
|
2735
|
-
var _a;
|
|
2736
|
-
const { container: containerProp, ...portalProps } = props;
|
|
2737
|
-
const [mounted, setMounted] = React8.useState(false);
|
|
2738
|
-
useLayoutEffect2(() => setMounted(true), []);
|
|
2739
|
-
const container = containerProp || mounted && ((_a = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : _a.body);
|
|
2740
|
-
return container ? import_react_dom2.default.createPortal((0, import_jsx_runtime5.jsx)(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
2741
|
-
});
|
|
2742
|
-
Portal.displayName = PORTAL_NAME;
|
|
2743
|
-
|
|
2744
|
-
// ../../node_modules/.pnpm/@radix-ui+react-visually-hidden@1.2.3_@types+react-dom@18.3.7_@types+react@18.3.28__@types+re_2l3id5fph3ijb3jwgep3hs3nwy/node_modules/@radix-ui/react-visually-hidden/dist/index.mjs
|
|
2745
|
-
var React9 = __toESM(require_react(), 1);
|
|
2746
|
-
var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
|
|
2747
|
-
var VISUALLY_HIDDEN_STYLES = Object.freeze({
|
|
2748
|
-
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
2749
|
-
position: "absolute",
|
|
2750
|
-
border: 0,
|
|
2751
|
-
width: 1,
|
|
2752
|
-
height: 1,
|
|
2753
|
-
padding: 0,
|
|
2754
|
-
margin: -1,
|
|
2755
|
-
overflow: "hidden",
|
|
2756
|
-
clip: "rect(0, 0, 0, 0)",
|
|
2757
|
-
whiteSpace: "nowrap",
|
|
2758
|
-
wordWrap: "normal"
|
|
2759
|
-
});
|
|
2760
|
-
var NAME2 = "VisuallyHidden";
|
|
2761
|
-
var VisuallyHidden = React9.forwardRef(
|
|
2762
|
-
(props, forwardedRef) => {
|
|
2763
|
-
return (0, import_jsx_runtime6.jsx)(
|
|
2764
|
-
Primitive.span,
|
|
2765
|
-
{
|
|
2766
|
-
...props,
|
|
2767
|
-
ref: forwardedRef,
|
|
2768
|
-
style: { ...VISUALLY_HIDDEN_STYLES, ...props.style }
|
|
2769
|
-
}
|
|
2770
|
-
);
|
|
2771
|
-
}
|
|
2772
|
-
);
|
|
2773
|
-
VisuallyHidden.displayName = NAME2;
|
|
2774
|
-
|
|
2775
|
-
// ../../node_modules/.pnpm/aria-hidden@1.2.6/node_modules/aria-hidden/dist/es2015/index.js
|
|
2776
|
-
var getDefaultParent = function(originalTarget) {
|
|
2777
|
-
if (typeof document === "undefined") {
|
|
2778
|
-
return null;
|
|
2779
|
-
}
|
|
2780
|
-
var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
|
|
2781
|
-
return sampleTarget.ownerDocument.body;
|
|
2782
|
-
};
|
|
2783
|
-
var counterMap = /* @__PURE__ */ new WeakMap();
|
|
2784
|
-
var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
2785
|
-
var markerMap = {};
|
|
2786
|
-
var lockCount = 0;
|
|
2787
|
-
var unwrapHost = function(node) {
|
|
2788
|
-
return node && (node.host || unwrapHost(node.parentNode));
|
|
2789
|
-
};
|
|
2790
|
-
var correctTargets = function(parent, targets) {
|
|
2791
|
-
return targets.map(function(target) {
|
|
2792
|
-
if (parent.contains(target)) {
|
|
2793
|
-
return target;
|
|
2794
|
-
}
|
|
2795
|
-
var correctedTarget = unwrapHost(target);
|
|
2796
|
-
if (correctedTarget && parent.contains(correctedTarget)) {
|
|
2797
|
-
return correctedTarget;
|
|
2798
|
-
}
|
|
2799
|
-
console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
|
|
2800
|
-
return null;
|
|
2801
|
-
}).filter(function(x) {
|
|
2802
|
-
return Boolean(x);
|
|
2803
|
-
});
|
|
2804
|
-
};
|
|
2805
|
-
var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
|
|
2806
|
-
var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
2807
|
-
if (!markerMap[markerName]) {
|
|
2808
|
-
markerMap[markerName] = /* @__PURE__ */ new WeakMap();
|
|
2809
|
-
}
|
|
2810
|
-
var markerCounter = markerMap[markerName];
|
|
2811
|
-
var hiddenNodes = [];
|
|
2812
|
-
var elementsToKeep = /* @__PURE__ */ new Set();
|
|
2813
|
-
var elementsToStop = new Set(targets);
|
|
2814
|
-
var keep = function(el) {
|
|
2815
|
-
if (!el || elementsToKeep.has(el)) {
|
|
2816
|
-
return;
|
|
2817
|
-
}
|
|
2818
|
-
elementsToKeep.add(el);
|
|
2819
|
-
keep(el.parentNode);
|
|
2820
|
-
};
|
|
2821
|
-
targets.forEach(keep);
|
|
2822
|
-
var deep = function(parent) {
|
|
2823
|
-
if (!parent || elementsToStop.has(parent)) {
|
|
2824
|
-
return;
|
|
2825
|
-
}
|
|
2826
|
-
Array.prototype.forEach.call(parent.children, function(node) {
|
|
2827
|
-
if (elementsToKeep.has(node)) {
|
|
2828
|
-
deep(node);
|
|
2829
|
-
} else {
|
|
2830
|
-
try {
|
|
2831
|
-
var attr = node.getAttribute(controlAttribute);
|
|
2832
|
-
var alreadyHidden = attr !== null && attr !== "false";
|
|
2833
|
-
var counterValue = (counterMap.get(node) || 0) + 1;
|
|
2834
|
-
var markerValue = (markerCounter.get(node) || 0) + 1;
|
|
2835
|
-
counterMap.set(node, counterValue);
|
|
2836
|
-
markerCounter.set(node, markerValue);
|
|
2837
|
-
hiddenNodes.push(node);
|
|
2838
|
-
if (counterValue === 1 && alreadyHidden) {
|
|
2839
|
-
uncontrolledNodes.set(node, true);
|
|
2840
|
-
}
|
|
2841
|
-
if (markerValue === 1) {
|
|
2842
|
-
node.setAttribute(markerName, "true");
|
|
2843
|
-
}
|
|
2844
|
-
if (!alreadyHidden) {
|
|
2845
|
-
node.setAttribute(controlAttribute, "true");
|
|
2846
|
-
}
|
|
2847
|
-
} catch (e) {
|
|
2848
|
-
console.error("aria-hidden: cannot operate on ", node, e);
|
|
2849
|
-
}
|
|
2850
|
-
}
|
|
2851
|
-
});
|
|
2852
|
-
};
|
|
2853
|
-
deep(parentNode);
|
|
2854
|
-
elementsToKeep.clear();
|
|
2855
|
-
lockCount++;
|
|
2856
|
-
return function() {
|
|
2857
|
-
hiddenNodes.forEach(function(node) {
|
|
2858
|
-
var counterValue = counterMap.get(node) - 1;
|
|
2859
|
-
var markerValue = markerCounter.get(node) - 1;
|
|
2860
|
-
counterMap.set(node, counterValue);
|
|
2861
|
-
markerCounter.set(node, markerValue);
|
|
2862
|
-
if (!counterValue) {
|
|
2863
|
-
if (!uncontrolledNodes.has(node)) {
|
|
2864
|
-
node.removeAttribute(controlAttribute);
|
|
2865
|
-
}
|
|
2866
|
-
uncontrolledNodes.delete(node);
|
|
2867
|
-
}
|
|
2868
|
-
if (!markerValue) {
|
|
2869
|
-
node.removeAttribute(markerName);
|
|
2870
|
-
}
|
|
2871
|
-
});
|
|
2872
|
-
lockCount--;
|
|
2873
|
-
if (!lockCount) {
|
|
2874
|
-
counterMap = /* @__PURE__ */ new WeakMap();
|
|
2875
|
-
counterMap = /* @__PURE__ */ new WeakMap();
|
|
2876
|
-
uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
2877
|
-
markerMap = {};
|
|
2878
|
-
}
|
|
2879
|
-
};
|
|
2880
|
-
};
|
|
2881
|
-
var hideOthers = function(originalTarget, parentNode, markerName) {
|
|
2882
|
-
if (markerName === void 0) {
|
|
2883
|
-
markerName = "data-aria-hidden";
|
|
2884
|
-
}
|
|
2885
|
-
var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
2886
|
-
var activeParentNode = parentNode || getDefaultParent(originalTarget);
|
|
2887
|
-
if (!activeParentNode) {
|
|
2888
|
-
return function() {
|
|
2889
|
-
return null;
|
|
2890
|
-
};
|
|
2891
|
-
}
|
|
2892
|
-
targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live], script")));
|
|
2893
|
-
return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
|
|
2894
|
-
};
|
|
2895
|
-
|
|
2896
|
-
// ../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
|
|
2897
|
-
var __assign = function() {
|
|
2898
|
-
__assign = Object.assign || function __assign2(t) {
|
|
2899
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
2900
|
-
s = arguments[i];
|
|
2901
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
2902
|
-
}
|
|
2903
|
-
return t;
|
|
2904
|
-
};
|
|
2905
|
-
return __assign.apply(this, arguments);
|
|
2906
|
-
};
|
|
2907
|
-
function __rest(s, e) {
|
|
2908
|
-
var t = {};
|
|
2909
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
2910
|
-
t[p] = s[p];
|
|
2911
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
2912
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2913
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
2914
|
-
t[p[i]] = s[p[i]];
|
|
2915
|
-
}
|
|
2916
|
-
return t;
|
|
2917
|
-
}
|
|
2918
|
-
function __spreadArray(to, from, pack) {
|
|
2919
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
2920
|
-
if (ar || !(i in from)) {
|
|
2921
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
2922
|
-
ar[i] = from[i];
|
|
2923
|
-
}
|
|
2924
|
-
}
|
|
2925
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
2926
|
-
}
|
|
2927
|
-
|
|
2928
|
-
// ../../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@18.3.28_react@18.3.1/node_modules/react-remove-scroll/dist/es2015/Combination.js
|
|
2929
|
-
var React18 = __toESM(require_react());
|
|
2930
|
-
|
|
2931
|
-
// ../../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@18.3.28_react@18.3.1/node_modules/react-remove-scroll/dist/es2015/UI.js
|
|
2932
|
-
var React14 = __toESM(require_react());
|
|
2933
|
-
|
|
2934
|
-
// ../../node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types+react@18.3.28_react@18.3.1/node_modules/react-remove-scroll-bar/dist/es2015/constants.js
|
|
2935
|
-
var zeroRightClassName = "right-scroll-bar-position";
|
|
2936
|
-
var fullWidthClassName = "width-before-scroll-bar";
|
|
2937
|
-
var noScrollbarsClassName = "with-scroll-bars-hidden";
|
|
2938
|
-
var removedBarSizeVariable = "--removed-body-scroll-bar-size";
|
|
2939
|
-
|
|
2940
|
-
// ../../node_modules/.pnpm/use-callback-ref@1.3.3_@types+react@18.3.28_react@18.3.1/node_modules/use-callback-ref/dist/es2015/assignRef.js
|
|
2941
|
-
function assignRef(ref, value) {
|
|
2942
|
-
if (typeof ref === "function") {
|
|
2943
|
-
ref(value);
|
|
2944
|
-
} else if (ref) {
|
|
2945
|
-
ref.current = value;
|
|
2946
|
-
}
|
|
2947
|
-
return ref;
|
|
2948
|
-
}
|
|
2949
|
-
|
|
2950
|
-
// ../../node_modules/.pnpm/use-callback-ref@1.3.3_@types+react@18.3.28_react@18.3.1/node_modules/use-callback-ref/dist/es2015/useRef.js
|
|
2951
|
-
var import_react2 = __toESM(require_react());
|
|
2952
|
-
function useCallbackRef2(initialValue, callback) {
|
|
2953
|
-
var ref = (0, import_react2.useState)(function() {
|
|
2954
|
-
return {
|
|
2955
|
-
// value
|
|
2956
|
-
value: initialValue,
|
|
2957
|
-
// last callback
|
|
2958
|
-
callback,
|
|
2959
|
-
// "memoized" public interface
|
|
2960
|
-
facade: {
|
|
2961
|
-
get current() {
|
|
2962
|
-
return ref.value;
|
|
2963
|
-
},
|
|
2964
|
-
set current(value) {
|
|
2965
|
-
var last = ref.value;
|
|
2966
|
-
if (last !== value) {
|
|
2967
|
-
ref.value = value;
|
|
2968
|
-
ref.callback(value, last);
|
|
2969
|
-
}
|
|
2970
|
-
}
|
|
2971
|
-
}
|
|
2972
|
-
};
|
|
2973
|
-
})[0];
|
|
2974
|
-
ref.callback = callback;
|
|
2975
|
-
return ref.facade;
|
|
2976
|
-
}
|
|
2977
|
-
|
|
2978
|
-
// ../../node_modules/.pnpm/use-callback-ref@1.3.3_@types+react@18.3.28_react@18.3.1/node_modules/use-callback-ref/dist/es2015/useMergeRef.js
|
|
2979
|
-
var React10 = __toESM(require_react());
|
|
2980
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React10.useLayoutEffect : React10.useEffect;
|
|
2981
|
-
var currentValues = /* @__PURE__ */ new WeakMap();
|
|
2982
|
-
function useMergeRefs(refs, defaultValue) {
|
|
2983
|
-
var callbackRef = useCallbackRef2(defaultValue || null, function(newValue) {
|
|
2984
|
-
return refs.forEach(function(ref) {
|
|
2985
|
-
return assignRef(ref, newValue);
|
|
2986
|
-
});
|
|
2987
|
-
});
|
|
2988
|
-
useIsomorphicLayoutEffect(function() {
|
|
2989
|
-
var oldValue = currentValues.get(callbackRef);
|
|
2990
|
-
if (oldValue) {
|
|
2991
|
-
var prevRefs_1 = new Set(oldValue);
|
|
2992
|
-
var nextRefs_1 = new Set(refs);
|
|
2993
|
-
var current_1 = callbackRef.current;
|
|
2994
|
-
prevRefs_1.forEach(function(ref) {
|
|
2995
|
-
if (!nextRefs_1.has(ref)) {
|
|
2996
|
-
assignRef(ref, null);
|
|
2997
|
-
}
|
|
2998
|
-
});
|
|
2999
|
-
nextRefs_1.forEach(function(ref) {
|
|
3000
|
-
if (!prevRefs_1.has(ref)) {
|
|
3001
|
-
assignRef(ref, current_1);
|
|
3002
|
-
}
|
|
3003
|
-
});
|
|
3004
|
-
}
|
|
3005
|
-
currentValues.set(callbackRef, refs);
|
|
3006
|
-
}, [refs]);
|
|
3007
|
-
return callbackRef;
|
|
3008
|
-
}
|
|
3009
|
-
|
|
3010
|
-
// ../../node_modules/.pnpm/use-sidecar@1.1.3_@types+react@18.3.28_react@18.3.1/node_modules/use-sidecar/dist/es2015/hoc.js
|
|
3011
|
-
var React11 = __toESM(require_react());
|
|
3012
|
-
|
|
3013
|
-
// ../../node_modules/.pnpm/use-sidecar@1.1.3_@types+react@18.3.28_react@18.3.1/node_modules/use-sidecar/dist/es2015/hook.js
|
|
3014
|
-
var import_react3 = __toESM(require_react());
|
|
3015
|
-
|
|
3016
|
-
// ../../node_modules/.pnpm/use-sidecar@1.1.3_@types+react@18.3.28_react@18.3.1/node_modules/use-sidecar/dist/es2015/medium.js
|
|
3017
|
-
function ItoI(a) {
|
|
3018
|
-
return a;
|
|
3019
|
-
}
|
|
3020
|
-
function innerCreateMedium(defaults, middleware) {
|
|
3021
|
-
if (middleware === void 0) {
|
|
3022
|
-
middleware = ItoI;
|
|
3023
|
-
}
|
|
3024
|
-
var buffer = [];
|
|
3025
|
-
var assigned = false;
|
|
3026
|
-
var medium = {
|
|
3027
|
-
read: function() {
|
|
3028
|
-
if (assigned) {
|
|
3029
|
-
throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
|
|
3030
|
-
}
|
|
3031
|
-
if (buffer.length) {
|
|
3032
|
-
return buffer[buffer.length - 1];
|
|
3033
|
-
}
|
|
3034
|
-
return defaults;
|
|
3035
|
-
},
|
|
3036
|
-
useMedium: function(data) {
|
|
3037
|
-
var item = middleware(data, assigned);
|
|
3038
|
-
buffer.push(item);
|
|
3039
|
-
return function() {
|
|
3040
|
-
buffer = buffer.filter(function(x) {
|
|
3041
|
-
return x !== item;
|
|
3042
|
-
});
|
|
3043
|
-
};
|
|
3044
|
-
},
|
|
3045
|
-
assignSyncMedium: function(cb) {
|
|
3046
|
-
assigned = true;
|
|
3047
|
-
while (buffer.length) {
|
|
3048
|
-
var cbs = buffer;
|
|
3049
|
-
buffer = [];
|
|
3050
|
-
cbs.forEach(cb);
|
|
3051
|
-
}
|
|
3052
|
-
buffer = {
|
|
3053
|
-
push: function(x) {
|
|
3054
|
-
return cb(x);
|
|
3055
|
-
},
|
|
3056
|
-
filter: function() {
|
|
3057
|
-
return buffer;
|
|
3058
|
-
}
|
|
3059
|
-
};
|
|
3060
|
-
},
|
|
3061
|
-
assignMedium: function(cb) {
|
|
3062
|
-
assigned = true;
|
|
3063
|
-
var pendingQueue = [];
|
|
3064
|
-
if (buffer.length) {
|
|
3065
|
-
var cbs = buffer;
|
|
3066
|
-
buffer = [];
|
|
3067
|
-
cbs.forEach(cb);
|
|
3068
|
-
pendingQueue = buffer;
|
|
3069
|
-
}
|
|
3070
|
-
var executeQueue = function() {
|
|
3071
|
-
var cbs2 = pendingQueue;
|
|
3072
|
-
pendingQueue = [];
|
|
3073
|
-
cbs2.forEach(cb);
|
|
3074
|
-
};
|
|
3075
|
-
var cycle = function() {
|
|
3076
|
-
return Promise.resolve().then(executeQueue);
|
|
3077
|
-
};
|
|
3078
|
-
cycle();
|
|
3079
|
-
buffer = {
|
|
3080
|
-
push: function(x) {
|
|
3081
|
-
pendingQueue.push(x);
|
|
3082
|
-
cycle();
|
|
3083
|
-
},
|
|
3084
|
-
filter: function(filter) {
|
|
3085
|
-
pendingQueue = pendingQueue.filter(filter);
|
|
3086
|
-
return buffer;
|
|
3087
|
-
}
|
|
3088
|
-
};
|
|
3089
|
-
}
|
|
3090
|
-
};
|
|
3091
|
-
return medium;
|
|
3092
|
-
}
|
|
3093
|
-
function createSidecarMedium(options) {
|
|
3094
|
-
if (options === void 0) {
|
|
3095
|
-
options = {};
|
|
3096
|
-
}
|
|
3097
|
-
var medium = innerCreateMedium(null);
|
|
3098
|
-
medium.options = __assign({ async: true, ssr: false }, options);
|
|
3099
|
-
return medium;
|
|
3100
|
-
}
|
|
3101
|
-
|
|
3102
|
-
// ../../node_modules/.pnpm/use-sidecar@1.1.3_@types+react@18.3.28_react@18.3.1/node_modules/use-sidecar/dist/es2015/renderProp.js
|
|
3103
|
-
var React12 = __toESM(require_react());
|
|
3104
|
-
var import_react4 = __toESM(require_react());
|
|
3105
|
-
|
|
3106
|
-
// ../../node_modules/.pnpm/use-sidecar@1.1.3_@types+react@18.3.28_react@18.3.1/node_modules/use-sidecar/dist/es2015/exports.js
|
|
3107
|
-
var React13 = __toESM(require_react());
|
|
3108
|
-
var SideCar = function(_a) {
|
|
3109
|
-
var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
|
|
3110
|
-
if (!sideCar) {
|
|
3111
|
-
throw new Error("Sidecar: please provide `sideCar` property to import the right car");
|
|
3112
|
-
}
|
|
3113
|
-
var Target = sideCar.read();
|
|
3114
|
-
if (!Target) {
|
|
3115
|
-
throw new Error("Sidecar medium not found");
|
|
3116
|
-
}
|
|
3117
|
-
return React13.createElement(Target, __assign({}, rest));
|
|
3118
|
-
};
|
|
3119
|
-
SideCar.isSideCarExport = true;
|
|
3120
|
-
function exportSidecar(medium, exported) {
|
|
3121
|
-
medium.useMedium(exported);
|
|
3122
|
-
return SideCar;
|
|
3123
|
-
}
|
|
3124
|
-
|
|
3125
|
-
// ../../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@18.3.28_react@18.3.1/node_modules/react-remove-scroll/dist/es2015/medium.js
|
|
3126
|
-
var effectCar = createSidecarMedium();
|
|
3127
|
-
|
|
3128
|
-
// ../../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@18.3.28_react@18.3.1/node_modules/react-remove-scroll/dist/es2015/UI.js
|
|
3129
|
-
var nothing = function() {
|
|
3130
|
-
return;
|
|
3131
|
-
};
|
|
3132
|
-
var RemoveScroll = React14.forwardRef(function(props, parentRef) {
|
|
3133
|
-
var ref = React14.useRef(null);
|
|
3134
|
-
var _a = React14.useState({
|
|
3135
|
-
onScrollCapture: nothing,
|
|
3136
|
-
onWheelCapture: nothing,
|
|
3137
|
-
onTouchMoveCapture: nothing
|
|
3138
|
-
}), callbacks = _a[0], setCallbacks = _a[1];
|
|
3139
|
-
var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noRelative = props.noRelative, 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", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
|
|
3140
|
-
var SideCar2 = sideCar;
|
|
3141
|
-
var containerRef = useMergeRefs([ref, parentRef]);
|
|
3142
|
-
var containerProps = __assign(__assign({}, rest), callbacks);
|
|
3143
|
-
return React14.createElement(
|
|
3144
|
-
React14.Fragment,
|
|
3145
|
-
null,
|
|
3146
|
-
enabled && React14.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noRelative, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
|
|
3147
|
-
forwardProps ? React14.cloneElement(React14.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React14.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
|
|
3148
|
-
);
|
|
3149
|
-
});
|
|
3150
|
-
RemoveScroll.defaultProps = {
|
|
3151
|
-
enabled: true,
|
|
3152
|
-
removeScrollBar: true,
|
|
3153
|
-
inert: false
|
|
3154
|
-
};
|
|
3155
|
-
RemoveScroll.classNames = {
|
|
3156
|
-
fullWidth: fullWidthClassName,
|
|
3157
|
-
zeroRight: zeroRightClassName
|
|
3158
|
-
};
|
|
3159
|
-
|
|
3160
|
-
// ../../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@18.3.28_react@18.3.1/node_modules/react-remove-scroll/dist/es2015/SideEffect.js
|
|
3161
|
-
var React17 = __toESM(require_react());
|
|
3162
|
-
|
|
3163
|
-
// ../../node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types+react@18.3.28_react@18.3.1/node_modules/react-remove-scroll-bar/dist/es2015/component.js
|
|
3164
|
-
var React16 = __toESM(require_react());
|
|
3165
|
-
|
|
3166
|
-
// ../../node_modules/.pnpm/react-style-singleton@2.2.3_@types+react@18.3.28_react@18.3.1/node_modules/react-style-singleton/dist/es2015/hook.js
|
|
3167
|
-
var React15 = __toESM(require_react());
|
|
3168
|
-
|
|
3169
|
-
// ../../node_modules/.pnpm/get-nonce@1.0.1/node_modules/get-nonce/dist/es2015/index.js
|
|
3170
|
-
var currentNonce;
|
|
3171
|
-
var getNonce = function() {
|
|
3172
|
-
if (currentNonce) {
|
|
3173
|
-
return currentNonce;
|
|
3174
|
-
}
|
|
3175
|
-
if (typeof __webpack_nonce__ !== "undefined") {
|
|
3176
|
-
return __webpack_nonce__;
|
|
3177
|
-
}
|
|
3178
|
-
return void 0;
|
|
3179
|
-
};
|
|
3180
|
-
|
|
3181
|
-
// ../../node_modules/.pnpm/react-style-singleton@2.2.3_@types+react@18.3.28_react@18.3.1/node_modules/react-style-singleton/dist/es2015/singleton.js
|
|
3182
|
-
function makeStyleTag() {
|
|
3183
|
-
if (!document)
|
|
3184
|
-
return null;
|
|
3185
|
-
var tag = document.createElement("style");
|
|
3186
|
-
tag.type = "text/css";
|
|
3187
|
-
var nonce = getNonce();
|
|
3188
|
-
if (nonce) {
|
|
3189
|
-
tag.setAttribute("nonce", nonce);
|
|
3190
|
-
}
|
|
3191
|
-
return tag;
|
|
3192
|
-
}
|
|
3193
|
-
function injectStyles(tag, css) {
|
|
3194
|
-
if (tag.styleSheet) {
|
|
3195
|
-
tag.styleSheet.cssText = css;
|
|
3196
|
-
} else {
|
|
3197
|
-
tag.appendChild(document.createTextNode(css));
|
|
3198
|
-
}
|
|
3199
|
-
}
|
|
3200
|
-
function insertStyleTag(tag) {
|
|
3201
|
-
var head = document.head || document.getElementsByTagName("head")[0];
|
|
3202
|
-
head.appendChild(tag);
|
|
3203
|
-
}
|
|
3204
|
-
var stylesheetSingleton = function() {
|
|
3205
|
-
var counter = 0;
|
|
3206
|
-
var stylesheet = null;
|
|
3207
|
-
return {
|
|
3208
|
-
add: function(style) {
|
|
3209
|
-
if (counter == 0) {
|
|
3210
|
-
if (stylesheet = makeStyleTag()) {
|
|
3211
|
-
injectStyles(stylesheet, style);
|
|
3212
|
-
insertStyleTag(stylesheet);
|
|
3213
|
-
}
|
|
3214
|
-
}
|
|
3215
|
-
counter++;
|
|
3216
|
-
},
|
|
3217
|
-
remove: function() {
|
|
3218
|
-
counter--;
|
|
3219
|
-
if (!counter && stylesheet) {
|
|
3220
|
-
stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
|
|
3221
|
-
stylesheet = null;
|
|
3222
|
-
}
|
|
3223
|
-
}
|
|
3224
|
-
};
|
|
3225
|
-
};
|
|
3226
|
-
|
|
3227
|
-
// ../../node_modules/.pnpm/react-style-singleton@2.2.3_@types+react@18.3.28_react@18.3.1/node_modules/react-style-singleton/dist/es2015/hook.js
|
|
3228
|
-
var styleHookSingleton = function() {
|
|
3229
|
-
var sheet = stylesheetSingleton();
|
|
3230
|
-
return function(styles, isDynamic) {
|
|
3231
|
-
React15.useEffect(function() {
|
|
3232
|
-
sheet.add(styles);
|
|
3233
|
-
return function() {
|
|
3234
|
-
sheet.remove();
|
|
3235
|
-
};
|
|
3236
|
-
}, [styles && isDynamic]);
|
|
3237
|
-
};
|
|
3238
|
-
};
|
|
3239
|
-
|
|
3240
|
-
// ../../node_modules/.pnpm/react-style-singleton@2.2.3_@types+react@18.3.28_react@18.3.1/node_modules/react-style-singleton/dist/es2015/component.js
|
|
3241
|
-
var styleSingleton = function() {
|
|
3242
|
-
var useStyle = styleHookSingleton();
|
|
3243
|
-
var Sheet = function(_a) {
|
|
3244
|
-
var styles = _a.styles, dynamic = _a.dynamic;
|
|
3245
|
-
useStyle(styles, dynamic);
|
|
3246
|
-
return null;
|
|
3247
|
-
};
|
|
3248
|
-
return Sheet;
|
|
3249
|
-
};
|
|
3250
|
-
|
|
3251
|
-
// ../../node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types+react@18.3.28_react@18.3.1/node_modules/react-remove-scroll-bar/dist/es2015/utils.js
|
|
3252
|
-
var zeroGap = {
|
|
3253
|
-
left: 0,
|
|
3254
|
-
top: 0,
|
|
3255
|
-
right: 0,
|
|
3256
|
-
gap: 0
|
|
3257
|
-
};
|
|
3258
|
-
var parse = function(x) {
|
|
3259
|
-
return parseInt(x || "", 10) || 0;
|
|
3260
|
-
};
|
|
3261
|
-
var getOffset = function(gapMode) {
|
|
3262
|
-
var cs = window.getComputedStyle(document.body);
|
|
3263
|
-
var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
|
|
3264
|
-
var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
|
|
3265
|
-
var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
|
|
3266
|
-
return [parse(left), parse(top), parse(right)];
|
|
3267
|
-
};
|
|
3268
|
-
var getGapWidth = function(gapMode) {
|
|
3269
|
-
if (gapMode === void 0) {
|
|
3270
|
-
gapMode = "margin";
|
|
3271
|
-
}
|
|
3272
|
-
if (typeof window === "undefined") {
|
|
3273
|
-
return zeroGap;
|
|
3274
|
-
}
|
|
3275
|
-
var offsets = getOffset(gapMode);
|
|
3276
|
-
var documentWidth = document.documentElement.clientWidth;
|
|
3277
|
-
var windowWidth = window.innerWidth;
|
|
3278
|
-
return {
|
|
3279
|
-
left: offsets[0],
|
|
3280
|
-
top: offsets[1],
|
|
3281
|
-
right: offsets[2],
|
|
3282
|
-
gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
|
|
3283
|
-
};
|
|
3284
|
-
};
|
|
3285
|
-
|
|
3286
|
-
// ../../node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types+react@18.3.28_react@18.3.1/node_modules/react-remove-scroll-bar/dist/es2015/component.js
|
|
3287
|
-
var Style = styleSingleton();
|
|
3288
|
-
var lockAttribute = "data-scroll-locked";
|
|
3289
|
-
var getStyles = function(_a, allowRelative, gapMode, important) {
|
|
3290
|
-
var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
|
|
3291
|
-
if (gapMode === void 0) {
|
|
3292
|
-
gapMode = "margin";
|
|
3293
|
-
}
|
|
3294
|
-
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([
|
|
3295
|
-
allowRelative && "position: relative ".concat(important, ";"),
|
|
3296
|
-
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 "),
|
|
3297
|
-
gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
|
|
3298
|
-
].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");
|
|
3299
|
-
};
|
|
3300
|
-
var getCurrentUseCounter = function() {
|
|
3301
|
-
var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
|
|
3302
|
-
return isFinite(counter) ? counter : 0;
|
|
3303
|
-
};
|
|
3304
|
-
var useLockAttribute = function() {
|
|
3305
|
-
React16.useEffect(function() {
|
|
3306
|
-
document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
|
|
3307
|
-
return function() {
|
|
3308
|
-
var newCounter = getCurrentUseCounter() - 1;
|
|
3309
|
-
if (newCounter <= 0) {
|
|
3310
|
-
document.body.removeAttribute(lockAttribute);
|
|
3311
|
-
} else {
|
|
3312
|
-
document.body.setAttribute(lockAttribute, newCounter.toString());
|
|
3313
|
-
}
|
|
3314
|
-
};
|
|
3315
|
-
}, []);
|
|
3316
|
-
};
|
|
3317
|
-
var RemoveScrollBar = function(_a) {
|
|
3318
|
-
var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
|
|
3319
|
-
useLockAttribute();
|
|
3320
|
-
var gap = React16.useMemo(function() {
|
|
3321
|
-
return getGapWidth(gapMode);
|
|
3322
|
-
}, [gapMode]);
|
|
3323
|
-
return React16.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
|
|
3324
|
-
};
|
|
3325
|
-
|
|
3326
|
-
// ../../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@18.3.28_react@18.3.1/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js
|
|
3327
|
-
var passiveSupported = false;
|
|
3328
|
-
if (typeof window !== "undefined") {
|
|
3329
|
-
try {
|
|
3330
|
-
options = Object.defineProperty({}, "passive", {
|
|
3331
|
-
get: function() {
|
|
3332
|
-
passiveSupported = true;
|
|
3333
|
-
return true;
|
|
3334
|
-
}
|
|
3335
|
-
});
|
|
3336
|
-
window.addEventListener("test", options, options);
|
|
3337
|
-
window.removeEventListener("test", options, options);
|
|
3338
|
-
} catch (err) {
|
|
3339
|
-
passiveSupported = false;
|
|
3340
|
-
}
|
|
3341
|
-
}
|
|
3342
|
-
var options;
|
|
3343
|
-
var nonPassive = passiveSupported ? { passive: false } : false;
|
|
3344
|
-
|
|
3345
|
-
// ../../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@18.3.28_react@18.3.1/node_modules/react-remove-scroll/dist/es2015/handleScroll.js
|
|
3346
|
-
var alwaysContainsScroll = function(node) {
|
|
3347
|
-
return node.tagName === "TEXTAREA";
|
|
3348
|
-
};
|
|
3349
|
-
var elementCanBeScrolled = function(node, overflow) {
|
|
3350
|
-
if (!(node instanceof Element)) {
|
|
3351
|
-
return false;
|
|
3352
|
-
}
|
|
3353
|
-
var styles = window.getComputedStyle(node);
|
|
3354
|
-
return (
|
|
3355
|
-
// not-not-scrollable
|
|
3356
|
-
styles[overflow] !== "hidden" && // contains scroll inside self
|
|
3357
|
-
!(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
|
|
3358
|
-
);
|
|
3359
|
-
};
|
|
3360
|
-
var elementCouldBeVScrolled = function(node) {
|
|
3361
|
-
return elementCanBeScrolled(node, "overflowY");
|
|
3362
|
-
};
|
|
3363
|
-
var elementCouldBeHScrolled = function(node) {
|
|
3364
|
-
return elementCanBeScrolled(node, "overflowX");
|
|
3365
|
-
};
|
|
3366
|
-
var locationCouldBeScrolled = function(axis, node) {
|
|
3367
|
-
var ownerDocument = node.ownerDocument;
|
|
3368
|
-
var current = node;
|
|
3369
|
-
do {
|
|
3370
|
-
if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
|
|
3371
|
-
current = current.host;
|
|
3372
|
-
}
|
|
3373
|
-
var isScrollable = elementCouldBeScrolled(axis, current);
|
|
3374
|
-
if (isScrollable) {
|
|
3375
|
-
var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
|
|
3376
|
-
if (scrollHeight > clientHeight) {
|
|
3377
|
-
return true;
|
|
3378
|
-
}
|
|
3379
|
-
}
|
|
3380
|
-
current = current.parentNode;
|
|
3381
|
-
} while (current && current !== ownerDocument.body);
|
|
3382
|
-
return false;
|
|
3383
|
-
};
|
|
3384
|
-
var getVScrollVariables = function(_a) {
|
|
3385
|
-
var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
|
|
3386
|
-
return [
|
|
3387
|
-
scrollTop,
|
|
3388
|
-
scrollHeight,
|
|
3389
|
-
clientHeight
|
|
3390
|
-
];
|
|
3391
|
-
};
|
|
3392
|
-
var getHScrollVariables = function(_a) {
|
|
3393
|
-
var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
|
|
3394
|
-
return [
|
|
3395
|
-
scrollLeft,
|
|
3396
|
-
scrollWidth,
|
|
3397
|
-
clientWidth
|
|
3398
|
-
];
|
|
3399
|
-
};
|
|
3400
|
-
var elementCouldBeScrolled = function(axis, node) {
|
|
3401
|
-
return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
|
|
3402
|
-
};
|
|
3403
|
-
var getScrollVariables = function(axis, node) {
|
|
3404
|
-
return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
|
|
3405
|
-
};
|
|
3406
|
-
var getDirectionFactor = function(axis, direction) {
|
|
3407
|
-
return axis === "h" && direction === "rtl" ? -1 : 1;
|
|
3408
|
-
};
|
|
3409
|
-
var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
3410
|
-
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
|
|
3411
|
-
var delta = directionFactor * sourceDelta;
|
|
3412
|
-
var target = event.target;
|
|
3413
|
-
var targetInLock = endTarget.contains(target);
|
|
3414
|
-
var shouldCancelScroll = false;
|
|
3415
|
-
var isDeltaPositive = delta > 0;
|
|
3416
|
-
var availableScroll = 0;
|
|
3417
|
-
var availableScrollTop = 0;
|
|
3418
|
-
do {
|
|
3419
|
-
if (!target) {
|
|
3420
|
-
break;
|
|
3421
|
-
}
|
|
3422
|
-
var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
|
|
3423
|
-
var elementScroll = scroll_1 - capacity - directionFactor * position;
|
|
3424
|
-
if (position || elementScroll) {
|
|
3425
|
-
if (elementCouldBeScrolled(axis, target)) {
|
|
3426
|
-
availableScroll += elementScroll;
|
|
3427
|
-
availableScrollTop += position;
|
|
3428
|
-
}
|
|
3429
|
-
}
|
|
3430
|
-
var parent_1 = target.parentNode;
|
|
3431
|
-
target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
|
|
3432
|
-
} while (
|
|
3433
|
-
// portaled content
|
|
3434
|
-
!targetInLock && target !== document.body || // self content
|
|
3435
|
-
targetInLock && (endTarget.contains(target) || endTarget === target)
|
|
3436
|
-
);
|
|
3437
|
-
if (isDeltaPositive && (noOverscroll && Math.abs(availableScroll) < 1 || !noOverscroll && delta > availableScroll)) {
|
|
3438
|
-
shouldCancelScroll = true;
|
|
3439
|
-
} else if (!isDeltaPositive && (noOverscroll && Math.abs(availableScrollTop) < 1 || !noOverscroll && -delta > availableScrollTop)) {
|
|
3440
|
-
shouldCancelScroll = true;
|
|
3441
|
-
}
|
|
3442
|
-
return shouldCancelScroll;
|
|
3443
|
-
};
|
|
3444
|
-
|
|
3445
|
-
// ../../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@18.3.28_react@18.3.1/node_modules/react-remove-scroll/dist/es2015/SideEffect.js
|
|
3446
|
-
var getTouchXY = function(event) {
|
|
3447
|
-
return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
|
|
3448
|
-
};
|
|
3449
|
-
var getDeltaXY = function(event) {
|
|
3450
|
-
return [event.deltaX, event.deltaY];
|
|
3451
|
-
};
|
|
3452
|
-
var extractRef = function(ref) {
|
|
3453
|
-
return ref && "current" in ref ? ref.current : ref;
|
|
3454
|
-
};
|
|
3455
|
-
var deltaCompare = function(x, y) {
|
|
3456
|
-
return x[0] === y[0] && x[1] === y[1];
|
|
3457
|
-
};
|
|
3458
|
-
var generateStyle = function(id) {
|
|
3459
|
-
return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n");
|
|
3460
|
-
};
|
|
3461
|
-
var idCounter = 0;
|
|
3462
|
-
var lockStack = [];
|
|
3463
|
-
function RemoveScrollSideCar(props) {
|
|
3464
|
-
var shouldPreventQueue = React17.useRef([]);
|
|
3465
|
-
var touchStartRef = React17.useRef([0, 0]);
|
|
3466
|
-
var activeAxis = React17.useRef();
|
|
3467
|
-
var id = React17.useState(idCounter++)[0];
|
|
3468
|
-
var Style2 = React17.useState(styleSingleton)[0];
|
|
3469
|
-
var lastProps = React17.useRef(props);
|
|
3470
|
-
React17.useEffect(function() {
|
|
3471
|
-
lastProps.current = props;
|
|
3472
|
-
}, [props]);
|
|
3473
|
-
React17.useEffect(function() {
|
|
3474
|
-
if (props.inert) {
|
|
3475
|
-
document.body.classList.add("block-interactivity-".concat(id));
|
|
3476
|
-
var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
|
|
3477
|
-
allow_1.forEach(function(el) {
|
|
3478
|
-
return el.classList.add("allow-interactivity-".concat(id));
|
|
3479
|
-
});
|
|
3480
|
-
return function() {
|
|
3481
|
-
document.body.classList.remove("block-interactivity-".concat(id));
|
|
3482
|
-
allow_1.forEach(function(el) {
|
|
3483
|
-
return el.classList.remove("allow-interactivity-".concat(id));
|
|
3484
|
-
});
|
|
3485
|
-
};
|
|
3486
|
-
}
|
|
3487
|
-
return;
|
|
3488
|
-
}, [props.inert, props.lockRef.current, props.shards]);
|
|
3489
|
-
var shouldCancelEvent = React17.useCallback(function(event, parent) {
|
|
3490
|
-
if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) {
|
|
3491
|
-
return !lastProps.current.allowPinchZoom;
|
|
3492
|
-
}
|
|
3493
|
-
var touch = getTouchXY(event);
|
|
3494
|
-
var touchStart = touchStartRef.current;
|
|
3495
|
-
var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0];
|
|
3496
|
-
var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1];
|
|
3497
|
-
var currentAxis;
|
|
3498
|
-
var target = event.target;
|
|
3499
|
-
var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v";
|
|
3500
|
-
if ("touches" in event && moveDirection === "h" && target.type === "range") {
|
|
3501
|
-
return false;
|
|
3502
|
-
}
|
|
3503
|
-
var selection = window.getSelection();
|
|
3504
|
-
var anchorNode = selection && selection.anchorNode;
|
|
3505
|
-
var isTouchingSelection = anchorNode ? anchorNode === target || anchorNode.contains(target) : false;
|
|
3506
|
-
if (isTouchingSelection) {
|
|
3507
|
-
return false;
|
|
3508
|
-
}
|
|
3509
|
-
var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
3510
|
-
if (!canBeScrolledInMainDirection) {
|
|
3511
|
-
return true;
|
|
3512
|
-
}
|
|
3513
|
-
if (canBeScrolledInMainDirection) {
|
|
3514
|
-
currentAxis = moveDirection;
|
|
3515
|
-
} else {
|
|
3516
|
-
currentAxis = moveDirection === "v" ? "h" : "v";
|
|
3517
|
-
canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
3518
|
-
}
|
|
3519
|
-
if (!canBeScrolledInMainDirection) {
|
|
3520
|
-
return false;
|
|
3521
|
-
}
|
|
3522
|
-
if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) {
|
|
3523
|
-
activeAxis.current = currentAxis;
|
|
3524
|
-
}
|
|
3525
|
-
if (!currentAxis) {
|
|
3526
|
-
return true;
|
|
3527
|
-
}
|
|
3528
|
-
var cancelingAxis = activeAxis.current || currentAxis;
|
|
3529
|
-
return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY, true);
|
|
3530
|
-
}, []);
|
|
3531
|
-
var shouldPrevent = React17.useCallback(function(_event) {
|
|
3532
|
-
var event = _event;
|
|
3533
|
-
if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) {
|
|
3534
|
-
return;
|
|
3535
|
-
}
|
|
3536
|
-
var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event);
|
|
3537
|
-
var sourceEvent = shouldPreventQueue.current.filter(function(e) {
|
|
3538
|
-
return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta);
|
|
3539
|
-
})[0];
|
|
3540
|
-
if (sourceEvent && sourceEvent.should) {
|
|
3541
|
-
if (event.cancelable) {
|
|
3542
|
-
event.preventDefault();
|
|
3543
|
-
}
|
|
3544
|
-
return;
|
|
3545
|
-
}
|
|
3546
|
-
if (!sourceEvent) {
|
|
3547
|
-
var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function(node) {
|
|
3548
|
-
return node.contains(event.target);
|
|
3549
|
-
});
|
|
3550
|
-
var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
|
|
3551
|
-
if (shouldStop) {
|
|
3552
|
-
if (event.cancelable) {
|
|
3553
|
-
event.preventDefault();
|
|
3554
|
-
}
|
|
3555
|
-
}
|
|
3556
|
-
}
|
|
3557
|
-
}, []);
|
|
3558
|
-
var shouldCancel = React17.useCallback(function(name, delta, target, should) {
|
|
3559
|
-
var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
|
|
3560
|
-
shouldPreventQueue.current.push(event);
|
|
3561
|
-
setTimeout(function() {
|
|
3562
|
-
shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) {
|
|
3563
|
-
return e !== event;
|
|
3564
|
-
});
|
|
3565
|
-
}, 1);
|
|
3566
|
-
}, []);
|
|
3567
|
-
var scrollTouchStart = React17.useCallback(function(event) {
|
|
3568
|
-
touchStartRef.current = getTouchXY(event);
|
|
3569
|
-
activeAxis.current = void 0;
|
|
3570
|
-
}, []);
|
|
3571
|
-
var scrollWheel = React17.useCallback(function(event) {
|
|
3572
|
-
shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
3573
|
-
}, []);
|
|
3574
|
-
var scrollTouchMove = React17.useCallback(function(event) {
|
|
3575
|
-
shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
3576
|
-
}, []);
|
|
3577
|
-
React17.useEffect(function() {
|
|
3578
|
-
lockStack.push(Style2);
|
|
3579
|
-
props.setCallbacks({
|
|
3580
|
-
onScrollCapture: scrollWheel,
|
|
3581
|
-
onWheelCapture: scrollWheel,
|
|
3582
|
-
onTouchMoveCapture: scrollTouchMove
|
|
3583
|
-
});
|
|
3584
|
-
document.addEventListener("wheel", shouldPrevent, nonPassive);
|
|
3585
|
-
document.addEventListener("touchmove", shouldPrevent, nonPassive);
|
|
3586
|
-
document.addEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
3587
|
-
return function() {
|
|
3588
|
-
lockStack = lockStack.filter(function(inst) {
|
|
3589
|
-
return inst !== Style2;
|
|
3590
|
-
});
|
|
3591
|
-
document.removeEventListener("wheel", shouldPrevent, nonPassive);
|
|
3592
|
-
document.removeEventListener("touchmove", shouldPrevent, nonPassive);
|
|
3593
|
-
document.removeEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
3594
|
-
};
|
|
3595
|
-
}, []);
|
|
3596
|
-
var removeScrollBar = props.removeScrollBar, inert = props.inert;
|
|
3597
|
-
return React17.createElement(
|
|
3598
|
-
React17.Fragment,
|
|
3599
|
-
null,
|
|
3600
|
-
inert ? React17.createElement(Style2, { styles: generateStyle(id) }) : null,
|
|
3601
|
-
removeScrollBar ? React17.createElement(RemoveScrollBar, { noRelative: props.noRelative, gapMode: props.gapMode }) : null
|
|
3602
|
-
);
|
|
3603
|
-
}
|
|
3604
|
-
function getOutermostShadowParent(node) {
|
|
3605
|
-
var shadowParent = null;
|
|
3606
|
-
while (node !== null) {
|
|
3607
|
-
if (node instanceof ShadowRoot) {
|
|
3608
|
-
shadowParent = node.host;
|
|
3609
|
-
node = node.host;
|
|
3610
|
-
}
|
|
3611
|
-
node = node.parentNode;
|
|
3612
|
-
}
|
|
3613
|
-
return shadowParent;
|
|
3614
|
-
}
|
|
3615
|
-
|
|
3616
|
-
// ../../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@18.3.28_react@18.3.1/node_modules/react-remove-scroll/dist/es2015/sidecar.js
|
|
3617
|
-
var sidecar_default = exportSidecar(effectCar, RemoveScrollSideCar);
|
|
3618
|
-
|
|
3619
|
-
// ../../node_modules/.pnpm/react-remove-scroll@2.7.2_@types+react@18.3.28_react@18.3.1/node_modules/react-remove-scroll/dist/es2015/Combination.js
|
|
3620
|
-
var ReactRemoveScroll = React18.forwardRef(function(props, ref) {
|
|
3621
|
-
return React18.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: sidecar_default }));
|
|
3622
|
-
});
|
|
3623
|
-
ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
3624
|
-
var Combination_default = ReactRemoveScroll;
|
|
3625
|
-
|
|
3626
|
-
// ../../node_modules/.pnpm/@radix-ui+react-select@2.2.6_@types+react-dom@18.3.7_@types+react@18.3.28__@types+react@18.3._w7c5ofadsrsxh4bgf3womst7bq/node_modules/@radix-ui/react-select/dist/index.mjs
|
|
3627
|
-
var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
|
|
3628
|
-
var OPEN_KEYS = [" ", "Enter", "ArrowUp", "ArrowDown"];
|
|
3629
|
-
var SELECTION_KEYS = [" ", "Enter"];
|
|
3630
|
-
var SELECT_NAME = "Select";
|
|
3631
|
-
var [Collection, useCollection, createCollectionScope] = createCollection(SELECT_NAME);
|
|
3632
|
-
var [createSelectContext, createSelectScope] = createContextScope(SELECT_NAME, [
|
|
3633
|
-
createCollectionScope,
|
|
3634
|
-
createPopperScope
|
|
3635
|
-
]);
|
|
3636
|
-
var usePopperScope = createPopperScope();
|
|
3637
|
-
var [SelectProvider, useSelectContext] = createSelectContext(SELECT_NAME);
|
|
3638
|
-
var [SelectNativeOptionsProvider, useSelectNativeOptionsContext] = createSelectContext(SELECT_NAME);
|
|
3639
|
-
var Select = (props) => {
|
|
3640
|
-
const {
|
|
3641
|
-
__scopeSelect,
|
|
3642
|
-
children,
|
|
3643
|
-
open: openProp,
|
|
3644
|
-
defaultOpen,
|
|
3645
|
-
onOpenChange,
|
|
3646
|
-
value: valueProp,
|
|
3647
|
-
defaultValue,
|
|
3648
|
-
onValueChange,
|
|
3649
|
-
dir,
|
|
3650
|
-
name,
|
|
3651
|
-
autoComplete,
|
|
3652
|
-
disabled,
|
|
3653
|
-
required,
|
|
3654
|
-
form
|
|
3655
|
-
} = props;
|
|
3656
|
-
const popperScope = usePopperScope(__scopeSelect);
|
|
3657
|
-
const [trigger, setTrigger] = React19.useState(null);
|
|
3658
|
-
const [valueNode, setValueNode] = React19.useState(null);
|
|
3659
|
-
const [valueNodeHasChildren, setValueNodeHasChildren] = React19.useState(false);
|
|
3660
|
-
const direction = useDirection(dir);
|
|
3661
|
-
const [open, setOpen] = useControllableState({
|
|
3662
|
-
prop: openProp,
|
|
3663
|
-
defaultProp: defaultOpen ?? false,
|
|
3664
|
-
onChange: onOpenChange,
|
|
3665
|
-
caller: SELECT_NAME
|
|
3666
|
-
});
|
|
3667
|
-
const [value, setValue] = useControllableState({
|
|
3668
|
-
prop: valueProp,
|
|
3669
|
-
defaultProp: defaultValue,
|
|
3670
|
-
onChange: onValueChange,
|
|
3671
|
-
caller: SELECT_NAME
|
|
3672
|
-
});
|
|
3673
|
-
const triggerPointerDownPosRef = React19.useRef(null);
|
|
3674
|
-
const isFormControl = trigger ? form || !!trigger.closest("form") : true;
|
|
3675
|
-
const [nativeOptionsSet, setNativeOptionsSet] = React19.useState(/* @__PURE__ */ new Set());
|
|
3676
|
-
const nativeSelectKey = Array.from(nativeOptionsSet).map((option) => option.props.value).join(";");
|
|
3677
|
-
return (0, import_jsx_runtime7.jsx)(Root2, { ...popperScope, children: (0, import_jsx_runtime7.jsxs)(
|
|
3678
|
-
SelectProvider,
|
|
3679
|
-
{
|
|
3680
|
-
required,
|
|
3681
|
-
scope: __scopeSelect,
|
|
3682
|
-
trigger,
|
|
3683
|
-
onTriggerChange: setTrigger,
|
|
3684
|
-
valueNode,
|
|
3685
|
-
onValueNodeChange: setValueNode,
|
|
3686
|
-
valueNodeHasChildren,
|
|
3687
|
-
onValueNodeHasChildrenChange: setValueNodeHasChildren,
|
|
3688
|
-
contentId: useId(),
|
|
3689
|
-
value,
|
|
3690
|
-
onValueChange: setValue,
|
|
3691
|
-
open,
|
|
3692
|
-
onOpenChange: setOpen,
|
|
3693
|
-
dir: direction,
|
|
3694
|
-
triggerPointerDownPosRef,
|
|
3695
|
-
disabled,
|
|
3696
|
-
children: [
|
|
3697
|
-
(0, import_jsx_runtime7.jsx)(Collection.Provider, { scope: __scopeSelect, children: (0, import_jsx_runtime7.jsx)(
|
|
3698
|
-
SelectNativeOptionsProvider,
|
|
3699
|
-
{
|
|
3700
|
-
scope: props.__scopeSelect,
|
|
3701
|
-
onNativeOptionAdd: React19.useCallback((option) => {
|
|
3702
|
-
setNativeOptionsSet((prev) => new Set(prev).add(option));
|
|
3703
|
-
}, []),
|
|
3704
|
-
onNativeOptionRemove: React19.useCallback((option) => {
|
|
3705
|
-
setNativeOptionsSet((prev) => {
|
|
3706
|
-
const optionsSet = new Set(prev);
|
|
3707
|
-
optionsSet.delete(option);
|
|
3708
|
-
return optionsSet;
|
|
3709
|
-
});
|
|
3710
|
-
}, []),
|
|
3711
|
-
children
|
|
3712
|
-
}
|
|
3713
|
-
) }),
|
|
3714
|
-
isFormControl ? (0, import_jsx_runtime7.jsxs)(
|
|
3715
|
-
SelectBubbleInput,
|
|
3716
|
-
{
|
|
3717
|
-
"aria-hidden": true,
|
|
3718
|
-
required,
|
|
3719
|
-
tabIndex: -1,
|
|
3720
|
-
name,
|
|
3721
|
-
autoComplete,
|
|
3722
|
-
value,
|
|
3723
|
-
onChange: (event) => setValue(event.target.value),
|
|
3724
|
-
disabled,
|
|
3725
|
-
form,
|
|
3726
|
-
children: [
|
|
3727
|
-
value === void 0 ? (0, import_jsx_runtime7.jsx)("option", { value: "" }) : null,
|
|
3728
|
-
Array.from(nativeOptionsSet)
|
|
3729
|
-
]
|
|
3730
|
-
},
|
|
3731
|
-
nativeSelectKey
|
|
3732
|
-
) : null
|
|
3733
|
-
]
|
|
3734
|
-
}
|
|
3735
|
-
) });
|
|
3736
|
-
};
|
|
3737
|
-
Select.displayName = SELECT_NAME;
|
|
3738
|
-
var TRIGGER_NAME = "SelectTrigger";
|
|
3739
|
-
var SelectTrigger = React19.forwardRef(
|
|
3740
|
-
(props, forwardedRef) => {
|
|
3741
|
-
const { __scopeSelect, disabled = false, ...triggerProps } = props;
|
|
3742
|
-
const popperScope = usePopperScope(__scopeSelect);
|
|
3743
|
-
const context = useSelectContext(TRIGGER_NAME, __scopeSelect);
|
|
3744
|
-
const isDisabled = context.disabled || disabled;
|
|
3745
|
-
const composedRefs = useComposedRefs(forwardedRef, context.onTriggerChange);
|
|
3746
|
-
const getItems = useCollection(__scopeSelect);
|
|
3747
|
-
const pointerTypeRef = React19.useRef("touch");
|
|
3748
|
-
const [searchRef, handleTypeaheadSearch, resetTypeahead] = useTypeaheadSearch((search) => {
|
|
3749
|
-
const enabledItems = getItems().filter((item) => !item.disabled);
|
|
3750
|
-
const currentItem = enabledItems.find((item) => item.value === context.value);
|
|
3751
|
-
const nextItem = findNextItem(enabledItems, search, currentItem);
|
|
3752
|
-
if (nextItem !== void 0) {
|
|
3753
|
-
context.onValueChange(nextItem.value);
|
|
3754
|
-
}
|
|
3755
|
-
});
|
|
3756
|
-
const handleOpen = (pointerEvent) => {
|
|
3757
|
-
if (!isDisabled) {
|
|
3758
|
-
context.onOpenChange(true);
|
|
3759
|
-
resetTypeahead();
|
|
3760
|
-
}
|
|
3761
|
-
if (pointerEvent) {
|
|
3762
|
-
context.triggerPointerDownPosRef.current = {
|
|
3763
|
-
x: Math.round(pointerEvent.pageX),
|
|
3764
|
-
y: Math.round(pointerEvent.pageY)
|
|
3765
|
-
};
|
|
3766
|
-
}
|
|
3767
|
-
};
|
|
3768
|
-
return (0, import_jsx_runtime7.jsx)(Anchor, { asChild: true, ...popperScope, children: (0, import_jsx_runtime7.jsx)(
|
|
3769
|
-
Primitive.button,
|
|
3770
|
-
{
|
|
3771
|
-
type: "button",
|
|
3772
|
-
role: "combobox",
|
|
3773
|
-
"aria-controls": context.contentId,
|
|
3774
|
-
"aria-expanded": context.open,
|
|
3775
|
-
"aria-required": context.required,
|
|
3776
|
-
"aria-autocomplete": "none",
|
|
3777
|
-
dir: context.dir,
|
|
3778
|
-
"data-state": context.open ? "open" : "closed",
|
|
3779
|
-
disabled: isDisabled,
|
|
3780
|
-
"data-disabled": isDisabled ? "" : void 0,
|
|
3781
|
-
"data-placeholder": shouldShowPlaceholder(context.value) ? "" : void 0,
|
|
3782
|
-
...triggerProps,
|
|
3783
|
-
ref: composedRefs,
|
|
3784
|
-
onClick: composeEventHandlers(triggerProps.onClick, (event) => {
|
|
3785
|
-
event.currentTarget.focus();
|
|
3786
|
-
if (pointerTypeRef.current !== "mouse") {
|
|
3787
|
-
handleOpen(event);
|
|
3788
|
-
}
|
|
3789
|
-
}),
|
|
3790
|
-
onPointerDown: composeEventHandlers(triggerProps.onPointerDown, (event) => {
|
|
3791
|
-
pointerTypeRef.current = event.pointerType;
|
|
3792
|
-
const target = event.target;
|
|
3793
|
-
if (target.hasPointerCapture(event.pointerId)) {
|
|
3794
|
-
target.releasePointerCapture(event.pointerId);
|
|
3795
|
-
}
|
|
3796
|
-
if (event.button === 0 && event.ctrlKey === false && event.pointerType === "mouse") {
|
|
3797
|
-
handleOpen(event);
|
|
3798
|
-
event.preventDefault();
|
|
3799
|
-
}
|
|
3800
|
-
}),
|
|
3801
|
-
onKeyDown: composeEventHandlers(triggerProps.onKeyDown, (event) => {
|
|
3802
|
-
const isTypingAhead = searchRef.current !== "";
|
|
3803
|
-
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
3804
|
-
if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);
|
|
3805
|
-
if (isTypingAhead && event.key === " ") return;
|
|
3806
|
-
if (OPEN_KEYS.includes(event.key)) {
|
|
3807
|
-
handleOpen();
|
|
3808
|
-
event.preventDefault();
|
|
3809
|
-
}
|
|
3810
|
-
})
|
|
3811
|
-
}
|
|
3812
|
-
) });
|
|
3813
|
-
}
|
|
3814
|
-
);
|
|
3815
|
-
SelectTrigger.displayName = TRIGGER_NAME;
|
|
3816
|
-
var VALUE_NAME = "SelectValue";
|
|
3817
|
-
var SelectValue = React19.forwardRef(
|
|
3818
|
-
(props, forwardedRef) => {
|
|
3819
|
-
const { __scopeSelect, className, style, children, placeholder = "", ...valueProps } = props;
|
|
3820
|
-
const context = useSelectContext(VALUE_NAME, __scopeSelect);
|
|
3821
|
-
const { onValueNodeHasChildrenChange } = context;
|
|
3822
|
-
const hasChildren = children !== void 0;
|
|
3823
|
-
const composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange);
|
|
3824
|
-
useLayoutEffect2(() => {
|
|
3825
|
-
onValueNodeHasChildrenChange(hasChildren);
|
|
3826
|
-
}, [onValueNodeHasChildrenChange, hasChildren]);
|
|
3827
|
-
return (0, import_jsx_runtime7.jsx)(
|
|
3828
|
-
Primitive.span,
|
|
3829
|
-
{
|
|
3830
|
-
...valueProps,
|
|
3831
|
-
ref: composedRefs,
|
|
3832
|
-
style: { pointerEvents: "none" },
|
|
3833
|
-
children: shouldShowPlaceholder(context.value) ? (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: placeholder }) : children
|
|
3834
|
-
}
|
|
3835
|
-
);
|
|
3836
|
-
}
|
|
3837
|
-
);
|
|
3838
|
-
SelectValue.displayName = VALUE_NAME;
|
|
3839
|
-
var ICON_NAME = "SelectIcon";
|
|
3840
|
-
var SelectIcon = React19.forwardRef(
|
|
3841
|
-
(props, forwardedRef) => {
|
|
3842
|
-
const { __scopeSelect, children, ...iconProps } = props;
|
|
3843
|
-
return (0, import_jsx_runtime7.jsx)(Primitive.span, { "aria-hidden": true, ...iconProps, ref: forwardedRef, children: children || "▼" });
|
|
3844
|
-
}
|
|
3845
|
-
);
|
|
3846
|
-
SelectIcon.displayName = ICON_NAME;
|
|
3847
|
-
var PORTAL_NAME2 = "SelectPortal";
|
|
3848
|
-
var SelectPortal = (props) => {
|
|
3849
|
-
return (0, import_jsx_runtime7.jsx)(Portal, { asChild: true, ...props });
|
|
3850
|
-
};
|
|
3851
|
-
SelectPortal.displayName = PORTAL_NAME2;
|
|
3852
|
-
var CONTENT_NAME2 = "SelectContent";
|
|
3853
|
-
var SelectContent = React19.forwardRef(
|
|
3854
|
-
(props, forwardedRef) => {
|
|
3855
|
-
const context = useSelectContext(CONTENT_NAME2, props.__scopeSelect);
|
|
3856
|
-
const [fragment, setFragment] = React19.useState();
|
|
3857
|
-
useLayoutEffect2(() => {
|
|
3858
|
-
setFragment(new DocumentFragment());
|
|
3859
|
-
}, []);
|
|
3860
|
-
if (!context.open) {
|
|
3861
|
-
const frag = fragment;
|
|
3862
|
-
return frag ? ReactDOM3.createPortal(
|
|
3863
|
-
(0, import_jsx_runtime7.jsx)(SelectContentProvider, { scope: props.__scopeSelect, children: (0, import_jsx_runtime7.jsx)(Collection.Slot, { scope: props.__scopeSelect, children: (0, import_jsx_runtime7.jsx)("div", { children: props.children }) }) }),
|
|
3864
|
-
frag
|
|
3865
|
-
) : null;
|
|
3866
|
-
}
|
|
3867
|
-
return (0, import_jsx_runtime7.jsx)(SelectContentImpl, { ...props, ref: forwardedRef });
|
|
3868
|
-
}
|
|
3869
|
-
);
|
|
3870
|
-
SelectContent.displayName = CONTENT_NAME2;
|
|
3871
|
-
var CONTENT_MARGIN = 10;
|
|
3872
|
-
var [SelectContentProvider, useSelectContentContext] = createSelectContext(CONTENT_NAME2);
|
|
3873
|
-
var CONTENT_IMPL_NAME = "SelectContentImpl";
|
|
3874
|
-
var Slot = createSlot("SelectContent.RemoveScroll");
|
|
3875
|
-
var SelectContentImpl = React19.forwardRef(
|
|
3876
|
-
(props, forwardedRef) => {
|
|
3877
|
-
const {
|
|
3878
|
-
__scopeSelect,
|
|
3879
|
-
position = "item-aligned",
|
|
3880
|
-
onCloseAutoFocus,
|
|
3881
|
-
onEscapeKeyDown,
|
|
3882
|
-
onPointerDownOutside,
|
|
3883
|
-
//
|
|
3884
|
-
// PopperContent props
|
|
3885
|
-
side,
|
|
3886
|
-
sideOffset,
|
|
3887
|
-
align,
|
|
3888
|
-
alignOffset,
|
|
3889
|
-
arrowPadding,
|
|
3890
|
-
collisionBoundary,
|
|
3891
|
-
collisionPadding,
|
|
3892
|
-
sticky,
|
|
3893
|
-
hideWhenDetached,
|
|
3894
|
-
avoidCollisions,
|
|
3895
|
-
//
|
|
3896
|
-
...contentProps
|
|
3897
|
-
} = props;
|
|
3898
|
-
const context = useSelectContext(CONTENT_NAME2, __scopeSelect);
|
|
3899
|
-
const [content, setContent] = React19.useState(null);
|
|
3900
|
-
const [viewport, setViewport] = React19.useState(null);
|
|
3901
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
|
|
3902
|
-
const [selectedItem, setSelectedItem] = React19.useState(null);
|
|
3903
|
-
const [selectedItemText, setSelectedItemText] = React19.useState(
|
|
3904
|
-
null
|
|
3905
|
-
);
|
|
3906
|
-
const getItems = useCollection(__scopeSelect);
|
|
3907
|
-
const [isPositioned, setIsPositioned] = React19.useState(false);
|
|
3908
|
-
const firstValidItemFoundRef = React19.useRef(false);
|
|
3909
|
-
React19.useEffect(() => {
|
|
3910
|
-
if (content) return hideOthers(content);
|
|
3911
|
-
}, [content]);
|
|
3912
|
-
useFocusGuards();
|
|
3913
|
-
const focusFirst2 = React19.useCallback(
|
|
3914
|
-
(candidates) => {
|
|
3915
|
-
const [firstItem, ...restItems] = getItems().map((item) => item.ref.current);
|
|
3916
|
-
const [lastItem] = restItems.slice(-1);
|
|
3917
|
-
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
3918
|
-
for (const candidate of candidates) {
|
|
3919
|
-
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
3920
|
-
candidate == null ? void 0 : candidate.scrollIntoView({ block: "nearest" });
|
|
3921
|
-
if (candidate === firstItem && viewport) viewport.scrollTop = 0;
|
|
3922
|
-
if (candidate === lastItem && viewport) viewport.scrollTop = viewport.scrollHeight;
|
|
3923
|
-
candidate == null ? void 0 : candidate.focus();
|
|
3924
|
-
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
3925
|
-
}
|
|
3926
|
-
},
|
|
3927
|
-
[getItems, viewport]
|
|
3928
|
-
);
|
|
3929
|
-
const focusSelectedItem = React19.useCallback(
|
|
3930
|
-
() => focusFirst2([selectedItem, content]),
|
|
3931
|
-
[focusFirst2, selectedItem, content]
|
|
3932
|
-
);
|
|
3933
|
-
React19.useEffect(() => {
|
|
3934
|
-
if (isPositioned) {
|
|
3935
|
-
focusSelectedItem();
|
|
3936
|
-
}
|
|
3937
|
-
}, [isPositioned, focusSelectedItem]);
|
|
3938
|
-
const { onOpenChange, triggerPointerDownPosRef } = context;
|
|
3939
|
-
React19.useEffect(() => {
|
|
3940
|
-
if (content) {
|
|
3941
|
-
let pointerMoveDelta = { x: 0, y: 0 };
|
|
3942
|
-
const handlePointerMove = (event) => {
|
|
3943
|
-
var _a, _b;
|
|
3944
|
-
pointerMoveDelta = {
|
|
3945
|
-
x: Math.abs(Math.round(event.pageX) - (((_a = triggerPointerDownPosRef.current) == null ? void 0 : _a.x) ?? 0)),
|
|
3946
|
-
y: Math.abs(Math.round(event.pageY) - (((_b = triggerPointerDownPosRef.current) == null ? void 0 : _b.y) ?? 0))
|
|
3947
|
-
};
|
|
3948
|
-
};
|
|
3949
|
-
const handlePointerUp = (event) => {
|
|
3950
|
-
if (pointerMoveDelta.x <= 10 && pointerMoveDelta.y <= 10) {
|
|
3951
|
-
event.preventDefault();
|
|
3952
|
-
} else {
|
|
3953
|
-
if (!content.contains(event.target)) {
|
|
3954
|
-
onOpenChange(false);
|
|
3955
|
-
}
|
|
3956
|
-
}
|
|
3957
|
-
document.removeEventListener("pointermove", handlePointerMove);
|
|
3958
|
-
triggerPointerDownPosRef.current = null;
|
|
3959
|
-
};
|
|
3960
|
-
if (triggerPointerDownPosRef.current !== null) {
|
|
3961
|
-
document.addEventListener("pointermove", handlePointerMove);
|
|
3962
|
-
document.addEventListener("pointerup", handlePointerUp, { capture: true, once: true });
|
|
3963
|
-
}
|
|
3964
|
-
return () => {
|
|
3965
|
-
document.removeEventListener("pointermove", handlePointerMove);
|
|
3966
|
-
document.removeEventListener("pointerup", handlePointerUp, { capture: true });
|
|
3967
|
-
};
|
|
3968
|
-
}
|
|
3969
|
-
}, [content, onOpenChange, triggerPointerDownPosRef]);
|
|
3970
|
-
React19.useEffect(() => {
|
|
3971
|
-
const close = () => onOpenChange(false);
|
|
3972
|
-
window.addEventListener("blur", close);
|
|
3973
|
-
window.addEventListener("resize", close);
|
|
3974
|
-
return () => {
|
|
3975
|
-
window.removeEventListener("blur", close);
|
|
3976
|
-
window.removeEventListener("resize", close);
|
|
3977
|
-
};
|
|
3978
|
-
}, [onOpenChange]);
|
|
3979
|
-
const [searchRef, handleTypeaheadSearch] = useTypeaheadSearch((search) => {
|
|
3980
|
-
const enabledItems = getItems().filter((item) => !item.disabled);
|
|
3981
|
-
const currentItem = enabledItems.find((item) => item.ref.current === document.activeElement);
|
|
3982
|
-
const nextItem = findNextItem(enabledItems, search, currentItem);
|
|
3983
|
-
if (nextItem) {
|
|
3984
|
-
setTimeout(() => nextItem.ref.current.focus());
|
|
3985
|
-
}
|
|
3986
|
-
});
|
|
3987
|
-
const itemRefCallback = React19.useCallback(
|
|
3988
|
-
(node, value, disabled) => {
|
|
3989
|
-
const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;
|
|
3990
|
-
const isSelectedItem = context.value !== void 0 && context.value === value;
|
|
3991
|
-
if (isSelectedItem || isFirstValidItem) {
|
|
3992
|
-
setSelectedItem(node);
|
|
3993
|
-
if (isFirstValidItem) firstValidItemFoundRef.current = true;
|
|
3994
|
-
}
|
|
3995
|
-
},
|
|
3996
|
-
[context.value]
|
|
3997
|
-
);
|
|
3998
|
-
const handleItemLeave = React19.useCallback(() => content == null ? void 0 : content.focus(), [content]);
|
|
3999
|
-
const itemTextRefCallback = React19.useCallback(
|
|
4000
|
-
(node, value, disabled) => {
|
|
4001
|
-
const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;
|
|
4002
|
-
const isSelectedItem = context.value !== void 0 && context.value === value;
|
|
4003
|
-
if (isSelectedItem || isFirstValidItem) {
|
|
4004
|
-
setSelectedItemText(node);
|
|
4005
|
-
}
|
|
4006
|
-
},
|
|
4007
|
-
[context.value]
|
|
4008
|
-
);
|
|
4009
|
-
const SelectPosition = position === "popper" ? SelectPopperPosition : SelectItemAlignedPosition;
|
|
4010
|
-
const popperContentProps = SelectPosition === SelectPopperPosition ? {
|
|
4011
|
-
side,
|
|
4012
|
-
sideOffset,
|
|
4013
|
-
align,
|
|
4014
|
-
alignOffset,
|
|
4015
|
-
arrowPadding,
|
|
4016
|
-
collisionBoundary,
|
|
4017
|
-
collisionPadding,
|
|
4018
|
-
sticky,
|
|
4019
|
-
hideWhenDetached,
|
|
4020
|
-
avoidCollisions
|
|
4021
|
-
} : {};
|
|
4022
|
-
return (0, import_jsx_runtime7.jsx)(
|
|
4023
|
-
SelectContentProvider,
|
|
4024
|
-
{
|
|
4025
|
-
scope: __scopeSelect,
|
|
4026
|
-
content,
|
|
4027
|
-
viewport,
|
|
4028
|
-
onViewportChange: setViewport,
|
|
4029
|
-
itemRefCallback,
|
|
4030
|
-
selectedItem,
|
|
4031
|
-
onItemLeave: handleItemLeave,
|
|
4032
|
-
itemTextRefCallback,
|
|
4033
|
-
focusSelectedItem,
|
|
4034
|
-
selectedItemText,
|
|
4035
|
-
position,
|
|
4036
|
-
isPositioned,
|
|
4037
|
-
searchRef,
|
|
4038
|
-
children: (0, import_jsx_runtime7.jsx)(Combination_default, { as: Slot, allowPinchZoom: true, children: (0, import_jsx_runtime7.jsx)(
|
|
4039
|
-
FocusScope,
|
|
4040
|
-
{
|
|
4041
|
-
asChild: true,
|
|
4042
|
-
trapped: context.open,
|
|
4043
|
-
onMountAutoFocus: (event) => {
|
|
4044
|
-
event.preventDefault();
|
|
4045
|
-
},
|
|
4046
|
-
onUnmountAutoFocus: composeEventHandlers(onCloseAutoFocus, (event) => {
|
|
4047
|
-
var _a;
|
|
4048
|
-
(_a = context.trigger) == null ? void 0 : _a.focus({ preventScroll: true });
|
|
4049
|
-
event.preventDefault();
|
|
4050
|
-
}),
|
|
4051
|
-
children: (0, import_jsx_runtime7.jsx)(
|
|
4052
|
-
DismissableLayer,
|
|
4053
|
-
{
|
|
4054
|
-
asChild: true,
|
|
4055
|
-
disableOutsidePointerEvents: true,
|
|
4056
|
-
onEscapeKeyDown,
|
|
4057
|
-
onPointerDownOutside,
|
|
4058
|
-
onFocusOutside: (event) => event.preventDefault(),
|
|
4059
|
-
onDismiss: () => context.onOpenChange(false),
|
|
4060
|
-
children: (0, import_jsx_runtime7.jsx)(
|
|
4061
|
-
SelectPosition,
|
|
4062
|
-
{
|
|
4063
|
-
role: "listbox",
|
|
4064
|
-
id: context.contentId,
|
|
4065
|
-
"data-state": context.open ? "open" : "closed",
|
|
4066
|
-
dir: context.dir,
|
|
4067
|
-
onContextMenu: (event) => event.preventDefault(),
|
|
4068
|
-
...contentProps,
|
|
4069
|
-
...popperContentProps,
|
|
4070
|
-
onPlaced: () => setIsPositioned(true),
|
|
4071
|
-
ref: composedRefs,
|
|
4072
|
-
style: {
|
|
4073
|
-
// flex layout so we can place the scroll buttons properly
|
|
4074
|
-
display: "flex",
|
|
4075
|
-
flexDirection: "column",
|
|
4076
|
-
// reset the outline by default as the content MAY get focused
|
|
4077
|
-
outline: "none",
|
|
4078
|
-
...contentProps.style
|
|
4079
|
-
},
|
|
4080
|
-
onKeyDown: composeEventHandlers(contentProps.onKeyDown, (event) => {
|
|
4081
|
-
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
4082
|
-
if (event.key === "Tab") event.preventDefault();
|
|
4083
|
-
if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);
|
|
4084
|
-
if (["ArrowUp", "ArrowDown", "Home", "End"].includes(event.key)) {
|
|
4085
|
-
const items = getItems().filter((item) => !item.disabled);
|
|
4086
|
-
let candidateNodes = items.map((item) => item.ref.current);
|
|
4087
|
-
if (["ArrowUp", "End"].includes(event.key)) {
|
|
4088
|
-
candidateNodes = candidateNodes.slice().reverse();
|
|
4089
|
-
}
|
|
4090
|
-
if (["ArrowUp", "ArrowDown"].includes(event.key)) {
|
|
4091
|
-
const currentElement = event.target;
|
|
4092
|
-
const currentIndex = candidateNodes.indexOf(currentElement);
|
|
4093
|
-
candidateNodes = candidateNodes.slice(currentIndex + 1);
|
|
4094
|
-
}
|
|
4095
|
-
setTimeout(() => focusFirst2(candidateNodes));
|
|
4096
|
-
event.preventDefault();
|
|
4097
|
-
}
|
|
4098
|
-
})
|
|
4099
|
-
}
|
|
4100
|
-
)
|
|
4101
|
-
}
|
|
4102
|
-
)
|
|
4103
|
-
}
|
|
4104
|
-
) })
|
|
4105
|
-
}
|
|
4106
|
-
);
|
|
4107
|
-
}
|
|
4108
|
-
);
|
|
4109
|
-
SelectContentImpl.displayName = CONTENT_IMPL_NAME;
|
|
4110
|
-
var ITEM_ALIGNED_POSITION_NAME = "SelectItemAlignedPosition";
|
|
4111
|
-
var SelectItemAlignedPosition = React19.forwardRef((props, forwardedRef) => {
|
|
4112
|
-
const { __scopeSelect, onPlaced, ...popperProps } = props;
|
|
4113
|
-
const context = useSelectContext(CONTENT_NAME2, __scopeSelect);
|
|
4114
|
-
const contentContext = useSelectContentContext(CONTENT_NAME2, __scopeSelect);
|
|
4115
|
-
const [contentWrapper, setContentWrapper] = React19.useState(null);
|
|
4116
|
-
const [content, setContent] = React19.useState(null);
|
|
4117
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
|
|
4118
|
-
const getItems = useCollection(__scopeSelect);
|
|
4119
|
-
const shouldExpandOnScrollRef = React19.useRef(false);
|
|
4120
|
-
const shouldRepositionRef = React19.useRef(true);
|
|
4121
|
-
const { viewport, selectedItem, selectedItemText, focusSelectedItem } = contentContext;
|
|
4122
|
-
const position = React19.useCallback(() => {
|
|
4123
|
-
if (context.trigger && context.valueNode && contentWrapper && content && viewport && selectedItem && selectedItemText) {
|
|
4124
|
-
const triggerRect = context.trigger.getBoundingClientRect();
|
|
4125
|
-
const contentRect = content.getBoundingClientRect();
|
|
4126
|
-
const valueNodeRect = context.valueNode.getBoundingClientRect();
|
|
4127
|
-
const itemTextRect = selectedItemText.getBoundingClientRect();
|
|
4128
|
-
if (context.dir !== "rtl") {
|
|
4129
|
-
const itemTextOffset = itemTextRect.left - contentRect.left;
|
|
4130
|
-
const left = valueNodeRect.left - itemTextOffset;
|
|
4131
|
-
const leftDelta = triggerRect.left - left;
|
|
4132
|
-
const minContentWidth = triggerRect.width + leftDelta;
|
|
4133
|
-
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
4134
|
-
const rightEdge = window.innerWidth - CONTENT_MARGIN;
|
|
4135
|
-
const clampedLeft = clamp(left, [
|
|
4136
|
-
CONTENT_MARGIN,
|
|
4137
|
-
// Prevents the content from going off the starting edge of the
|
|
4138
|
-
// viewport. It may still go off the ending edge, but this can be
|
|
4139
|
-
// controlled by the user since they may want to manage overflow in a
|
|
4140
|
-
// specific way.
|
|
4141
|
-
// https://github.com/radix-ui/primitives/issues/2049
|
|
4142
|
-
Math.max(CONTENT_MARGIN, rightEdge - contentWidth)
|
|
4143
|
-
]);
|
|
4144
|
-
contentWrapper.style.minWidth = minContentWidth + "px";
|
|
4145
|
-
contentWrapper.style.left = clampedLeft + "px";
|
|
4146
|
-
} else {
|
|
4147
|
-
const itemTextOffset = contentRect.right - itemTextRect.right;
|
|
4148
|
-
const right = window.innerWidth - valueNodeRect.right - itemTextOffset;
|
|
4149
|
-
const rightDelta = window.innerWidth - triggerRect.right - right;
|
|
4150
|
-
const minContentWidth = triggerRect.width + rightDelta;
|
|
4151
|
-
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
4152
|
-
const leftEdge = window.innerWidth - CONTENT_MARGIN;
|
|
4153
|
-
const clampedRight = clamp(right, [
|
|
4154
|
-
CONTENT_MARGIN,
|
|
4155
|
-
Math.max(CONTENT_MARGIN, leftEdge - contentWidth)
|
|
4156
|
-
]);
|
|
4157
|
-
contentWrapper.style.minWidth = minContentWidth + "px";
|
|
4158
|
-
contentWrapper.style.right = clampedRight + "px";
|
|
4159
|
-
}
|
|
4160
|
-
const items = getItems();
|
|
4161
|
-
const availableHeight = window.innerHeight - CONTENT_MARGIN * 2;
|
|
4162
|
-
const itemsHeight = viewport.scrollHeight;
|
|
4163
|
-
const contentStyles = window.getComputedStyle(content);
|
|
4164
|
-
const contentBorderTopWidth = parseInt(contentStyles.borderTopWidth, 10);
|
|
4165
|
-
const contentPaddingTop = parseInt(contentStyles.paddingTop, 10);
|
|
4166
|
-
const contentBorderBottomWidth = parseInt(contentStyles.borderBottomWidth, 10);
|
|
4167
|
-
const contentPaddingBottom = parseInt(contentStyles.paddingBottom, 10);
|
|
4168
|
-
const fullContentHeight = contentBorderTopWidth + contentPaddingTop + itemsHeight + contentPaddingBottom + contentBorderBottomWidth;
|
|
4169
|
-
const minContentHeight = Math.min(selectedItem.offsetHeight * 5, fullContentHeight);
|
|
4170
|
-
const viewportStyles = window.getComputedStyle(viewport);
|
|
4171
|
-
const viewportPaddingTop = parseInt(viewportStyles.paddingTop, 10);
|
|
4172
|
-
const viewportPaddingBottom = parseInt(viewportStyles.paddingBottom, 10);
|
|
4173
|
-
const topEdgeToTriggerMiddle = triggerRect.top + triggerRect.height / 2 - CONTENT_MARGIN;
|
|
4174
|
-
const triggerMiddleToBottomEdge = availableHeight - topEdgeToTriggerMiddle;
|
|
4175
|
-
const selectedItemHalfHeight = selectedItem.offsetHeight / 2;
|
|
4176
|
-
const itemOffsetMiddle = selectedItem.offsetTop + selectedItemHalfHeight;
|
|
4177
|
-
const contentTopToItemMiddle = contentBorderTopWidth + contentPaddingTop + itemOffsetMiddle;
|
|
4178
|
-
const itemMiddleToContentBottom = fullContentHeight - contentTopToItemMiddle;
|
|
4179
|
-
const willAlignWithoutTopOverflow = contentTopToItemMiddle <= topEdgeToTriggerMiddle;
|
|
4180
|
-
if (willAlignWithoutTopOverflow) {
|
|
4181
|
-
const isLastItem = items.length > 0 && selectedItem === items[items.length - 1].ref.current;
|
|
4182
|
-
contentWrapper.style.bottom = "0px";
|
|
4183
|
-
const viewportOffsetBottom = content.clientHeight - viewport.offsetTop - viewport.offsetHeight;
|
|
4184
|
-
const clampedTriggerMiddleToBottomEdge = Math.max(
|
|
4185
|
-
triggerMiddleToBottomEdge,
|
|
4186
|
-
selectedItemHalfHeight + // viewport might have padding bottom, include it to avoid a scrollable viewport
|
|
4187
|
-
(isLastItem ? viewportPaddingBottom : 0) + viewportOffsetBottom + contentBorderBottomWidth
|
|
4188
|
-
);
|
|
4189
|
-
const height = contentTopToItemMiddle + clampedTriggerMiddleToBottomEdge;
|
|
4190
|
-
contentWrapper.style.height = height + "px";
|
|
4191
|
-
} else {
|
|
4192
|
-
const isFirstItem = items.length > 0 && selectedItem === items[0].ref.current;
|
|
4193
|
-
contentWrapper.style.top = "0px";
|
|
4194
|
-
const clampedTopEdgeToTriggerMiddle = Math.max(
|
|
4195
|
-
topEdgeToTriggerMiddle,
|
|
4196
|
-
contentBorderTopWidth + viewport.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
|
|
4197
|
-
(isFirstItem ? viewportPaddingTop : 0) + selectedItemHalfHeight
|
|
4198
|
-
);
|
|
4199
|
-
const height = clampedTopEdgeToTriggerMiddle + itemMiddleToContentBottom;
|
|
4200
|
-
contentWrapper.style.height = height + "px";
|
|
4201
|
-
viewport.scrollTop = contentTopToItemMiddle - topEdgeToTriggerMiddle + viewport.offsetTop;
|
|
4202
|
-
}
|
|
4203
|
-
contentWrapper.style.margin = `${CONTENT_MARGIN}px 0`;
|
|
4204
|
-
contentWrapper.style.minHeight = minContentHeight + "px";
|
|
4205
|
-
contentWrapper.style.maxHeight = availableHeight + "px";
|
|
4206
|
-
onPlaced == null ? void 0 : onPlaced();
|
|
4207
|
-
requestAnimationFrame(() => shouldExpandOnScrollRef.current = true);
|
|
4208
|
-
}
|
|
4209
|
-
}, [
|
|
4210
|
-
getItems,
|
|
4211
|
-
context.trigger,
|
|
4212
|
-
context.valueNode,
|
|
4213
|
-
contentWrapper,
|
|
4214
|
-
content,
|
|
4215
|
-
viewport,
|
|
4216
|
-
selectedItem,
|
|
4217
|
-
selectedItemText,
|
|
4218
|
-
context.dir,
|
|
4219
|
-
onPlaced
|
|
4220
|
-
]);
|
|
4221
|
-
useLayoutEffect2(() => position(), [position]);
|
|
4222
|
-
const [contentZIndex, setContentZIndex] = React19.useState();
|
|
4223
|
-
useLayoutEffect2(() => {
|
|
4224
|
-
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
4225
|
-
}, [content]);
|
|
4226
|
-
const handleScrollButtonChange = React19.useCallback(
|
|
4227
|
-
(node) => {
|
|
4228
|
-
if (node && shouldRepositionRef.current === true) {
|
|
4229
|
-
position();
|
|
4230
|
-
focusSelectedItem == null ? void 0 : focusSelectedItem();
|
|
4231
|
-
shouldRepositionRef.current = false;
|
|
4232
|
-
}
|
|
4233
|
-
},
|
|
4234
|
-
[position, focusSelectedItem]
|
|
4235
|
-
);
|
|
4236
|
-
return (0, import_jsx_runtime7.jsx)(
|
|
4237
|
-
SelectViewportProvider,
|
|
4238
|
-
{
|
|
4239
|
-
scope: __scopeSelect,
|
|
4240
|
-
contentWrapper,
|
|
4241
|
-
shouldExpandOnScrollRef,
|
|
4242
|
-
onScrollButtonChange: handleScrollButtonChange,
|
|
4243
|
-
children: (0, import_jsx_runtime7.jsx)(
|
|
4244
|
-
"div",
|
|
4245
|
-
{
|
|
4246
|
-
ref: setContentWrapper,
|
|
4247
|
-
style: {
|
|
4248
|
-
display: "flex",
|
|
4249
|
-
flexDirection: "column",
|
|
4250
|
-
position: "fixed",
|
|
4251
|
-
zIndex: contentZIndex
|
|
4252
|
-
},
|
|
4253
|
-
children: (0, import_jsx_runtime7.jsx)(
|
|
4254
|
-
Primitive.div,
|
|
4255
|
-
{
|
|
4256
|
-
...popperProps,
|
|
4257
|
-
ref: composedRefs,
|
|
4258
|
-
style: {
|
|
4259
|
-
// When we get the height of the content, it includes borders. If we were to set
|
|
4260
|
-
// the height without having `boxSizing: 'border-box'` it would be too big.
|
|
4261
|
-
boxSizing: "border-box",
|
|
4262
|
-
// We need to ensure the content doesn't get taller than the wrapper
|
|
4263
|
-
maxHeight: "100%",
|
|
4264
|
-
...popperProps.style
|
|
4265
|
-
}
|
|
4266
|
-
}
|
|
4267
|
-
)
|
|
4268
|
-
}
|
|
4269
|
-
)
|
|
4270
|
-
}
|
|
4271
|
-
);
|
|
4272
|
-
});
|
|
4273
|
-
SelectItemAlignedPosition.displayName = ITEM_ALIGNED_POSITION_NAME;
|
|
4274
|
-
var POPPER_POSITION_NAME = "SelectPopperPosition";
|
|
4275
|
-
var SelectPopperPosition = React19.forwardRef((props, forwardedRef) => {
|
|
4276
|
-
const {
|
|
4277
|
-
__scopeSelect,
|
|
4278
|
-
align = "start",
|
|
4279
|
-
collisionPadding = CONTENT_MARGIN,
|
|
4280
|
-
...popperProps
|
|
4281
|
-
} = props;
|
|
4282
|
-
const popperScope = usePopperScope(__scopeSelect);
|
|
4283
|
-
return (0, import_jsx_runtime7.jsx)(
|
|
4284
|
-
Content,
|
|
4285
|
-
{
|
|
4286
|
-
...popperScope,
|
|
4287
|
-
...popperProps,
|
|
4288
|
-
ref: forwardedRef,
|
|
4289
|
-
align,
|
|
4290
|
-
collisionPadding,
|
|
4291
|
-
style: {
|
|
4292
|
-
// Ensure border-box for floating-ui calculations
|
|
4293
|
-
boxSizing: "border-box",
|
|
4294
|
-
...popperProps.style,
|
|
4295
|
-
// re-namespace exposed content custom properties
|
|
4296
|
-
...{
|
|
4297
|
-
"--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
4298
|
-
"--radix-select-content-available-width": "var(--radix-popper-available-width)",
|
|
4299
|
-
"--radix-select-content-available-height": "var(--radix-popper-available-height)",
|
|
4300
|
-
"--radix-select-trigger-width": "var(--radix-popper-anchor-width)",
|
|
4301
|
-
"--radix-select-trigger-height": "var(--radix-popper-anchor-height)"
|
|
4302
|
-
}
|
|
4303
|
-
}
|
|
4304
|
-
}
|
|
4305
|
-
);
|
|
4306
|
-
});
|
|
4307
|
-
SelectPopperPosition.displayName = POPPER_POSITION_NAME;
|
|
4308
|
-
var [SelectViewportProvider, useSelectViewportContext] = createSelectContext(CONTENT_NAME2, {});
|
|
4309
|
-
var VIEWPORT_NAME = "SelectViewport";
|
|
4310
|
-
var SelectViewport = React19.forwardRef(
|
|
4311
|
-
(props, forwardedRef) => {
|
|
4312
|
-
const { __scopeSelect, nonce, ...viewportProps } = props;
|
|
4313
|
-
const contentContext = useSelectContentContext(VIEWPORT_NAME, __scopeSelect);
|
|
4314
|
-
const viewportContext = useSelectViewportContext(VIEWPORT_NAME, __scopeSelect);
|
|
4315
|
-
const composedRefs = useComposedRefs(forwardedRef, contentContext.onViewportChange);
|
|
4316
|
-
const prevScrollTopRef = React19.useRef(0);
|
|
4317
|
-
return (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
4318
|
-
(0, import_jsx_runtime7.jsx)(
|
|
4319
|
-
"style",
|
|
4320
|
-
{
|
|
4321
|
-
dangerouslySetInnerHTML: {
|
|
4322
|
-
__html: `[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`
|
|
4323
|
-
},
|
|
4324
|
-
nonce
|
|
4325
|
-
}
|
|
4326
|
-
),
|
|
4327
|
-
(0, import_jsx_runtime7.jsx)(Collection.Slot, { scope: __scopeSelect, children: (0, import_jsx_runtime7.jsx)(
|
|
4328
|
-
Primitive.div,
|
|
4329
|
-
{
|
|
4330
|
-
"data-radix-select-viewport": "",
|
|
4331
|
-
role: "presentation",
|
|
4332
|
-
...viewportProps,
|
|
4333
|
-
ref: composedRefs,
|
|
4334
|
-
style: {
|
|
4335
|
-
// we use position: 'relative' here on the `viewport` so that when we call
|
|
4336
|
-
// `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
|
|
4337
|
-
// (independent of the scrollUpButton).
|
|
4338
|
-
position: "relative",
|
|
4339
|
-
flex: 1,
|
|
4340
|
-
// Viewport should only be scrollable in the vertical direction.
|
|
4341
|
-
// This won't work in vertical writing modes, so we'll need to
|
|
4342
|
-
// revisit this if/when that is supported
|
|
4343
|
-
// https://developer.chrome.com/blog/vertical-form-controls
|
|
4344
|
-
overflow: "hidden auto",
|
|
4345
|
-
...viewportProps.style
|
|
4346
|
-
},
|
|
4347
|
-
onScroll: composeEventHandlers(viewportProps.onScroll, (event) => {
|
|
4348
|
-
const viewport = event.currentTarget;
|
|
4349
|
-
const { contentWrapper, shouldExpandOnScrollRef } = viewportContext;
|
|
4350
|
-
if ((shouldExpandOnScrollRef == null ? void 0 : shouldExpandOnScrollRef.current) && contentWrapper) {
|
|
4351
|
-
const scrolledBy = Math.abs(prevScrollTopRef.current - viewport.scrollTop);
|
|
4352
|
-
if (scrolledBy > 0) {
|
|
4353
|
-
const availableHeight = window.innerHeight - CONTENT_MARGIN * 2;
|
|
4354
|
-
const cssMinHeight = parseFloat(contentWrapper.style.minHeight);
|
|
4355
|
-
const cssHeight = parseFloat(contentWrapper.style.height);
|
|
4356
|
-
const prevHeight = Math.max(cssMinHeight, cssHeight);
|
|
4357
|
-
if (prevHeight < availableHeight) {
|
|
4358
|
-
const nextHeight = prevHeight + scrolledBy;
|
|
4359
|
-
const clampedNextHeight = Math.min(availableHeight, nextHeight);
|
|
4360
|
-
const heightDiff = nextHeight - clampedNextHeight;
|
|
4361
|
-
contentWrapper.style.height = clampedNextHeight + "px";
|
|
4362
|
-
if (contentWrapper.style.bottom === "0px") {
|
|
4363
|
-
viewport.scrollTop = heightDiff > 0 ? heightDiff : 0;
|
|
4364
|
-
contentWrapper.style.justifyContent = "flex-end";
|
|
4365
|
-
}
|
|
4366
|
-
}
|
|
4367
|
-
}
|
|
4368
|
-
}
|
|
4369
|
-
prevScrollTopRef.current = viewport.scrollTop;
|
|
4370
|
-
})
|
|
4371
|
-
}
|
|
4372
|
-
) })
|
|
4373
|
-
] });
|
|
4374
|
-
}
|
|
4375
|
-
);
|
|
4376
|
-
SelectViewport.displayName = VIEWPORT_NAME;
|
|
4377
|
-
var GROUP_NAME = "SelectGroup";
|
|
4378
|
-
var [SelectGroupContextProvider, useSelectGroupContext] = createSelectContext(GROUP_NAME);
|
|
4379
|
-
var SelectGroup = React19.forwardRef(
|
|
4380
|
-
(props, forwardedRef) => {
|
|
4381
|
-
const { __scopeSelect, ...groupProps } = props;
|
|
4382
|
-
const groupId = useId();
|
|
4383
|
-
return (0, import_jsx_runtime7.jsx)(SelectGroupContextProvider, { scope: __scopeSelect, id: groupId, children: (0, import_jsx_runtime7.jsx)(Primitive.div, { role: "group", "aria-labelledby": groupId, ...groupProps, ref: forwardedRef }) });
|
|
4384
|
-
}
|
|
4385
|
-
);
|
|
4386
|
-
SelectGroup.displayName = GROUP_NAME;
|
|
4387
|
-
var LABEL_NAME = "SelectLabel";
|
|
4388
|
-
var SelectLabel = React19.forwardRef(
|
|
4389
|
-
(props, forwardedRef) => {
|
|
4390
|
-
const { __scopeSelect, ...labelProps } = props;
|
|
4391
|
-
const groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);
|
|
4392
|
-
return (0, import_jsx_runtime7.jsx)(Primitive.div, { id: groupContext.id, ...labelProps, ref: forwardedRef });
|
|
4393
|
-
}
|
|
4394
|
-
);
|
|
4395
|
-
SelectLabel.displayName = LABEL_NAME;
|
|
4396
|
-
var ITEM_NAME = "SelectItem";
|
|
4397
|
-
var [SelectItemContextProvider, useSelectItemContext] = createSelectContext(ITEM_NAME);
|
|
4398
|
-
var SelectItem = React19.forwardRef(
|
|
4399
|
-
(props, forwardedRef) => {
|
|
4400
|
-
const {
|
|
4401
|
-
__scopeSelect,
|
|
4402
|
-
value,
|
|
4403
|
-
disabled = false,
|
|
4404
|
-
textValue: textValueProp,
|
|
4405
|
-
...itemProps
|
|
4406
|
-
} = props;
|
|
4407
|
-
const context = useSelectContext(ITEM_NAME, __scopeSelect);
|
|
4408
|
-
const contentContext = useSelectContentContext(ITEM_NAME, __scopeSelect);
|
|
4409
|
-
const isSelected = context.value === value;
|
|
4410
|
-
const [textValue, setTextValue] = React19.useState(textValueProp ?? "");
|
|
4411
|
-
const [isFocused, setIsFocused] = React19.useState(false);
|
|
4412
|
-
const composedRefs = useComposedRefs(
|
|
4413
|
-
forwardedRef,
|
|
4414
|
-
(node) => {
|
|
4415
|
-
var _a;
|
|
4416
|
-
return (_a = contentContext.itemRefCallback) == null ? void 0 : _a.call(contentContext, node, value, disabled);
|
|
4417
|
-
}
|
|
4418
|
-
);
|
|
4419
|
-
const textId = useId();
|
|
4420
|
-
const pointerTypeRef = React19.useRef("touch");
|
|
4421
|
-
const handleSelect = () => {
|
|
4422
|
-
if (!disabled) {
|
|
4423
|
-
context.onValueChange(value);
|
|
4424
|
-
context.onOpenChange(false);
|
|
4425
|
-
}
|
|
4426
|
-
};
|
|
4427
|
-
if (value === "") {
|
|
4428
|
-
throw new Error(
|
|
4429
|
-
"A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder."
|
|
4430
|
-
);
|
|
4431
|
-
}
|
|
4432
|
-
return (0, import_jsx_runtime7.jsx)(
|
|
4433
|
-
SelectItemContextProvider,
|
|
4434
|
-
{
|
|
4435
|
-
scope: __scopeSelect,
|
|
4436
|
-
value,
|
|
4437
|
-
disabled,
|
|
4438
|
-
textId,
|
|
4439
|
-
isSelected,
|
|
4440
|
-
onItemTextChange: React19.useCallback((node) => {
|
|
4441
|
-
setTextValue((prevTextValue) => prevTextValue || ((node == null ? void 0 : node.textContent) ?? "").trim());
|
|
4442
|
-
}, []),
|
|
4443
|
-
children: (0, import_jsx_runtime7.jsx)(
|
|
4444
|
-
Collection.ItemSlot,
|
|
4445
|
-
{
|
|
4446
|
-
scope: __scopeSelect,
|
|
4447
|
-
value,
|
|
4448
|
-
disabled,
|
|
4449
|
-
textValue,
|
|
4450
|
-
children: (0, import_jsx_runtime7.jsx)(
|
|
4451
|
-
Primitive.div,
|
|
4452
|
-
{
|
|
4453
|
-
role: "option",
|
|
4454
|
-
"aria-labelledby": textId,
|
|
4455
|
-
"data-highlighted": isFocused ? "" : void 0,
|
|
4456
|
-
"aria-selected": isSelected && isFocused,
|
|
4457
|
-
"data-state": isSelected ? "checked" : "unchecked",
|
|
4458
|
-
"aria-disabled": disabled || void 0,
|
|
4459
|
-
"data-disabled": disabled ? "" : void 0,
|
|
4460
|
-
tabIndex: disabled ? void 0 : -1,
|
|
4461
|
-
...itemProps,
|
|
4462
|
-
ref: composedRefs,
|
|
4463
|
-
onFocus: composeEventHandlers(itemProps.onFocus, () => setIsFocused(true)),
|
|
4464
|
-
onBlur: composeEventHandlers(itemProps.onBlur, () => setIsFocused(false)),
|
|
4465
|
-
onClick: composeEventHandlers(itemProps.onClick, () => {
|
|
4466
|
-
if (pointerTypeRef.current !== "mouse") handleSelect();
|
|
4467
|
-
}),
|
|
4468
|
-
onPointerUp: composeEventHandlers(itemProps.onPointerUp, () => {
|
|
4469
|
-
if (pointerTypeRef.current === "mouse") handleSelect();
|
|
4470
|
-
}),
|
|
4471
|
-
onPointerDown: composeEventHandlers(itemProps.onPointerDown, (event) => {
|
|
4472
|
-
pointerTypeRef.current = event.pointerType;
|
|
4473
|
-
}),
|
|
4474
|
-
onPointerMove: composeEventHandlers(itemProps.onPointerMove, (event) => {
|
|
4475
|
-
var _a;
|
|
4476
|
-
pointerTypeRef.current = event.pointerType;
|
|
4477
|
-
if (disabled) {
|
|
4478
|
-
(_a = contentContext.onItemLeave) == null ? void 0 : _a.call(contentContext);
|
|
4479
|
-
} else if (pointerTypeRef.current === "mouse") {
|
|
4480
|
-
event.currentTarget.focus({ preventScroll: true });
|
|
4481
|
-
}
|
|
4482
|
-
}),
|
|
4483
|
-
onPointerLeave: composeEventHandlers(itemProps.onPointerLeave, (event) => {
|
|
4484
|
-
var _a;
|
|
4485
|
-
if (event.currentTarget === document.activeElement) {
|
|
4486
|
-
(_a = contentContext.onItemLeave) == null ? void 0 : _a.call(contentContext);
|
|
4487
|
-
}
|
|
4488
|
-
}),
|
|
4489
|
-
onKeyDown: composeEventHandlers(itemProps.onKeyDown, (event) => {
|
|
4490
|
-
var _a;
|
|
4491
|
-
const isTypingAhead = ((_a = contentContext.searchRef) == null ? void 0 : _a.current) !== "";
|
|
4492
|
-
if (isTypingAhead && event.key === " ") return;
|
|
4493
|
-
if (SELECTION_KEYS.includes(event.key)) handleSelect();
|
|
4494
|
-
if (event.key === " ") event.preventDefault();
|
|
4495
|
-
})
|
|
4496
|
-
}
|
|
4497
|
-
)
|
|
4498
|
-
}
|
|
4499
|
-
)
|
|
4500
|
-
}
|
|
4501
|
-
);
|
|
4502
|
-
}
|
|
4503
|
-
);
|
|
4504
|
-
SelectItem.displayName = ITEM_NAME;
|
|
4505
|
-
var ITEM_TEXT_NAME = "SelectItemText";
|
|
4506
|
-
var SelectItemText = React19.forwardRef(
|
|
4507
|
-
(props, forwardedRef) => {
|
|
4508
|
-
const { __scopeSelect, className, style, ...itemTextProps } = props;
|
|
4509
|
-
const context = useSelectContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
4510
|
-
const contentContext = useSelectContentContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
4511
|
-
const itemContext = useSelectItemContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
4512
|
-
const nativeOptionsContext = useSelectNativeOptionsContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
4513
|
-
const [itemTextNode, setItemTextNode] = React19.useState(null);
|
|
4514
|
-
const composedRefs = useComposedRefs(
|
|
4515
|
-
forwardedRef,
|
|
4516
|
-
(node) => setItemTextNode(node),
|
|
4517
|
-
itemContext.onItemTextChange,
|
|
4518
|
-
(node) => {
|
|
4519
|
-
var _a;
|
|
4520
|
-
return (_a = contentContext.itemTextRefCallback) == null ? void 0 : _a.call(contentContext, node, itemContext.value, itemContext.disabled);
|
|
4521
|
-
}
|
|
4522
|
-
);
|
|
4523
|
-
const textContent = itemTextNode == null ? void 0 : itemTextNode.textContent;
|
|
4524
|
-
const nativeOption = React19.useMemo(
|
|
4525
|
-
() => (0, import_jsx_runtime7.jsx)("option", { value: itemContext.value, disabled: itemContext.disabled, children: textContent }, itemContext.value),
|
|
4526
|
-
[itemContext.disabled, itemContext.value, textContent]
|
|
4527
|
-
);
|
|
4528
|
-
const { onNativeOptionAdd, onNativeOptionRemove } = nativeOptionsContext;
|
|
4529
|
-
useLayoutEffect2(() => {
|
|
4530
|
-
onNativeOptionAdd(nativeOption);
|
|
4531
|
-
return () => onNativeOptionRemove(nativeOption);
|
|
4532
|
-
}, [onNativeOptionAdd, onNativeOptionRemove, nativeOption]);
|
|
4533
|
-
return (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
4534
|
-
(0, import_jsx_runtime7.jsx)(Primitive.span, { id: itemContext.textId, ...itemTextProps, ref: composedRefs }),
|
|
4535
|
-
itemContext.isSelected && context.valueNode && !context.valueNodeHasChildren ? ReactDOM3.createPortal(itemTextProps.children, context.valueNode) : null
|
|
4536
|
-
] });
|
|
4537
|
-
}
|
|
4538
|
-
);
|
|
4539
|
-
SelectItemText.displayName = ITEM_TEXT_NAME;
|
|
4540
|
-
var ITEM_INDICATOR_NAME = "SelectItemIndicator";
|
|
4541
|
-
var SelectItemIndicator = React19.forwardRef(
|
|
4542
|
-
(props, forwardedRef) => {
|
|
4543
|
-
const { __scopeSelect, ...itemIndicatorProps } = props;
|
|
4544
|
-
const itemContext = useSelectItemContext(ITEM_INDICATOR_NAME, __scopeSelect);
|
|
4545
|
-
return itemContext.isSelected ? (0, import_jsx_runtime7.jsx)(Primitive.span, { "aria-hidden": true, ...itemIndicatorProps, ref: forwardedRef }) : null;
|
|
4546
|
-
}
|
|
4547
|
-
);
|
|
4548
|
-
SelectItemIndicator.displayName = ITEM_INDICATOR_NAME;
|
|
4549
|
-
var SCROLL_UP_BUTTON_NAME = "SelectScrollUpButton";
|
|
4550
|
-
var SelectScrollUpButton = React19.forwardRef((props, forwardedRef) => {
|
|
4551
|
-
const contentContext = useSelectContentContext(SCROLL_UP_BUTTON_NAME, props.__scopeSelect);
|
|
4552
|
-
const viewportContext = useSelectViewportContext(SCROLL_UP_BUTTON_NAME, props.__scopeSelect);
|
|
4553
|
-
const [canScrollUp, setCanScrollUp] = React19.useState(false);
|
|
4554
|
-
const composedRefs = useComposedRefs(forwardedRef, viewportContext.onScrollButtonChange);
|
|
4555
|
-
useLayoutEffect2(() => {
|
|
4556
|
-
if (contentContext.viewport && contentContext.isPositioned) {
|
|
4557
|
-
let handleScroll22 = function() {
|
|
4558
|
-
const canScrollUp2 = viewport.scrollTop > 0;
|
|
4559
|
-
setCanScrollUp(canScrollUp2);
|
|
4560
|
-
};
|
|
4561
|
-
var handleScroll2 = handleScroll22;
|
|
4562
|
-
const viewport = contentContext.viewport;
|
|
4563
|
-
handleScroll22();
|
|
4564
|
-
viewport.addEventListener("scroll", handleScroll22);
|
|
4565
|
-
return () => viewport.removeEventListener("scroll", handleScroll22);
|
|
4566
|
-
}
|
|
4567
|
-
}, [contentContext.viewport, contentContext.isPositioned]);
|
|
4568
|
-
return canScrollUp ? (0, import_jsx_runtime7.jsx)(
|
|
4569
|
-
SelectScrollButtonImpl,
|
|
4570
|
-
{
|
|
4571
|
-
...props,
|
|
4572
|
-
ref: composedRefs,
|
|
4573
|
-
onAutoScroll: () => {
|
|
4574
|
-
const { viewport, selectedItem } = contentContext;
|
|
4575
|
-
if (viewport && selectedItem) {
|
|
4576
|
-
viewport.scrollTop = viewport.scrollTop - selectedItem.offsetHeight;
|
|
4577
|
-
}
|
|
4578
|
-
}
|
|
4579
|
-
}
|
|
4580
|
-
) : null;
|
|
4581
|
-
});
|
|
4582
|
-
SelectScrollUpButton.displayName = SCROLL_UP_BUTTON_NAME;
|
|
4583
|
-
var SCROLL_DOWN_BUTTON_NAME = "SelectScrollDownButton";
|
|
4584
|
-
var SelectScrollDownButton = React19.forwardRef((props, forwardedRef) => {
|
|
4585
|
-
const contentContext = useSelectContentContext(SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
4586
|
-
const viewportContext = useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
4587
|
-
const [canScrollDown, setCanScrollDown] = React19.useState(false);
|
|
4588
|
-
const composedRefs = useComposedRefs(forwardedRef, viewportContext.onScrollButtonChange);
|
|
4589
|
-
useLayoutEffect2(() => {
|
|
4590
|
-
if (contentContext.viewport && contentContext.isPositioned) {
|
|
4591
|
-
let handleScroll22 = function() {
|
|
4592
|
-
const maxScroll = viewport.scrollHeight - viewport.clientHeight;
|
|
4593
|
-
const canScrollDown2 = Math.ceil(viewport.scrollTop) < maxScroll;
|
|
4594
|
-
setCanScrollDown(canScrollDown2);
|
|
4595
|
-
};
|
|
4596
|
-
var handleScroll2 = handleScroll22;
|
|
4597
|
-
const viewport = contentContext.viewport;
|
|
4598
|
-
handleScroll22();
|
|
4599
|
-
viewport.addEventListener("scroll", handleScroll22);
|
|
4600
|
-
return () => viewport.removeEventListener("scroll", handleScroll22);
|
|
4601
|
-
}
|
|
4602
|
-
}, [contentContext.viewport, contentContext.isPositioned]);
|
|
4603
|
-
return canScrollDown ? (0, import_jsx_runtime7.jsx)(
|
|
4604
|
-
SelectScrollButtonImpl,
|
|
4605
|
-
{
|
|
4606
|
-
...props,
|
|
4607
|
-
ref: composedRefs,
|
|
4608
|
-
onAutoScroll: () => {
|
|
4609
|
-
const { viewport, selectedItem } = contentContext;
|
|
4610
|
-
if (viewport && selectedItem) {
|
|
4611
|
-
viewport.scrollTop = viewport.scrollTop + selectedItem.offsetHeight;
|
|
4612
|
-
}
|
|
4613
|
-
}
|
|
4614
|
-
}
|
|
4615
|
-
) : null;
|
|
4616
|
-
});
|
|
4617
|
-
SelectScrollDownButton.displayName = SCROLL_DOWN_BUTTON_NAME;
|
|
4618
|
-
var SelectScrollButtonImpl = React19.forwardRef((props, forwardedRef) => {
|
|
4619
|
-
const { __scopeSelect, onAutoScroll, ...scrollIndicatorProps } = props;
|
|
4620
|
-
const contentContext = useSelectContentContext("SelectScrollButton", __scopeSelect);
|
|
4621
|
-
const autoScrollTimerRef = React19.useRef(null);
|
|
4622
|
-
const getItems = useCollection(__scopeSelect);
|
|
4623
|
-
const clearAutoScrollTimer = React19.useCallback(() => {
|
|
4624
|
-
if (autoScrollTimerRef.current !== null) {
|
|
4625
|
-
window.clearInterval(autoScrollTimerRef.current);
|
|
4626
|
-
autoScrollTimerRef.current = null;
|
|
4627
|
-
}
|
|
4628
|
-
}, []);
|
|
4629
|
-
React19.useEffect(() => {
|
|
4630
|
-
return () => clearAutoScrollTimer();
|
|
4631
|
-
}, [clearAutoScrollTimer]);
|
|
4632
|
-
useLayoutEffect2(() => {
|
|
4633
|
-
var _a;
|
|
4634
|
-
const activeItem = getItems().find((item) => item.ref.current === document.activeElement);
|
|
4635
|
-
(_a = activeItem == null ? void 0 : activeItem.ref.current) == null ? void 0 : _a.scrollIntoView({ block: "nearest" });
|
|
4636
|
-
}, [getItems]);
|
|
4637
|
-
return (0, import_jsx_runtime7.jsx)(
|
|
4638
|
-
Primitive.div,
|
|
4639
|
-
{
|
|
4640
|
-
"aria-hidden": true,
|
|
4641
|
-
...scrollIndicatorProps,
|
|
4642
|
-
ref: forwardedRef,
|
|
4643
|
-
style: { flexShrink: 0, ...scrollIndicatorProps.style },
|
|
4644
|
-
onPointerDown: composeEventHandlers(scrollIndicatorProps.onPointerDown, () => {
|
|
4645
|
-
if (autoScrollTimerRef.current === null) {
|
|
4646
|
-
autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
4647
|
-
}
|
|
4648
|
-
}),
|
|
4649
|
-
onPointerMove: composeEventHandlers(scrollIndicatorProps.onPointerMove, () => {
|
|
4650
|
-
var _a;
|
|
4651
|
-
(_a = contentContext.onItemLeave) == null ? void 0 : _a.call(contentContext);
|
|
4652
|
-
if (autoScrollTimerRef.current === null) {
|
|
4653
|
-
autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
4654
|
-
}
|
|
4655
|
-
}),
|
|
4656
|
-
onPointerLeave: composeEventHandlers(scrollIndicatorProps.onPointerLeave, () => {
|
|
4657
|
-
clearAutoScrollTimer();
|
|
4658
|
-
})
|
|
4659
|
-
}
|
|
4660
|
-
);
|
|
4661
|
-
});
|
|
4662
|
-
var SEPARATOR_NAME = "SelectSeparator";
|
|
4663
|
-
var SelectSeparator = React19.forwardRef(
|
|
4664
|
-
(props, forwardedRef) => {
|
|
4665
|
-
const { __scopeSelect, ...separatorProps } = props;
|
|
4666
|
-
return (0, import_jsx_runtime7.jsx)(Primitive.div, { "aria-hidden": true, ...separatorProps, ref: forwardedRef });
|
|
4667
|
-
}
|
|
4668
|
-
);
|
|
4669
|
-
SelectSeparator.displayName = SEPARATOR_NAME;
|
|
4670
|
-
var ARROW_NAME2 = "SelectArrow";
|
|
4671
|
-
var SelectArrow = React19.forwardRef(
|
|
4672
|
-
(props, forwardedRef) => {
|
|
4673
|
-
const { __scopeSelect, ...arrowProps } = props;
|
|
4674
|
-
const popperScope = usePopperScope(__scopeSelect);
|
|
4675
|
-
const context = useSelectContext(ARROW_NAME2, __scopeSelect);
|
|
4676
|
-
const contentContext = useSelectContentContext(ARROW_NAME2, __scopeSelect);
|
|
4677
|
-
return context.open && contentContext.position === "popper" ? (0, import_jsx_runtime7.jsx)(Arrow2, { ...popperScope, ...arrowProps, ref: forwardedRef }) : null;
|
|
4678
|
-
}
|
|
4679
|
-
);
|
|
4680
|
-
SelectArrow.displayName = ARROW_NAME2;
|
|
4681
|
-
var BUBBLE_INPUT_NAME = "SelectBubbleInput";
|
|
4682
|
-
var SelectBubbleInput = React19.forwardRef(
|
|
4683
|
-
({ __scopeSelect, value, ...props }, forwardedRef) => {
|
|
4684
|
-
const ref = React19.useRef(null);
|
|
4685
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
4686
|
-
const prevValue = usePrevious(value);
|
|
4687
|
-
React19.useEffect(() => {
|
|
4688
|
-
const select = ref.current;
|
|
4689
|
-
if (!select) return;
|
|
4690
|
-
const selectProto = window.HTMLSelectElement.prototype;
|
|
4691
|
-
const descriptor = Object.getOwnPropertyDescriptor(
|
|
4692
|
-
selectProto,
|
|
4693
|
-
"value"
|
|
4694
|
-
);
|
|
4695
|
-
const setValue = descriptor.set;
|
|
4696
|
-
if (prevValue !== value && setValue) {
|
|
4697
|
-
const event = new Event("change", { bubbles: true });
|
|
4698
|
-
setValue.call(select, value);
|
|
4699
|
-
select.dispatchEvent(event);
|
|
4700
|
-
}
|
|
4701
|
-
}, [prevValue, value]);
|
|
4702
|
-
return (0, import_jsx_runtime7.jsx)(
|
|
4703
|
-
Primitive.select,
|
|
4704
|
-
{
|
|
4705
|
-
...props,
|
|
4706
|
-
style: { ...VISUALLY_HIDDEN_STYLES, ...props.style },
|
|
4707
|
-
ref: composedRefs,
|
|
4708
|
-
defaultValue: value
|
|
4709
|
-
}
|
|
4710
|
-
);
|
|
4711
|
-
}
|
|
4712
|
-
);
|
|
4713
|
-
SelectBubbleInput.displayName = BUBBLE_INPUT_NAME;
|
|
4714
|
-
function shouldShowPlaceholder(value) {
|
|
4715
|
-
return value === "" || value === void 0;
|
|
4716
|
-
}
|
|
4717
|
-
function useTypeaheadSearch(onSearchChange) {
|
|
4718
|
-
const handleSearchChange = useCallbackRef(onSearchChange);
|
|
4719
|
-
const searchRef = React19.useRef("");
|
|
4720
|
-
const timerRef = React19.useRef(0);
|
|
4721
|
-
const handleTypeaheadSearch = React19.useCallback(
|
|
4722
|
-
(key) => {
|
|
4723
|
-
const search = searchRef.current + key;
|
|
4724
|
-
handleSearchChange(search);
|
|
4725
|
-
(function updateSearch(value) {
|
|
4726
|
-
searchRef.current = value;
|
|
4727
|
-
window.clearTimeout(timerRef.current);
|
|
4728
|
-
if (value !== "") timerRef.current = window.setTimeout(() => updateSearch(""), 1e3);
|
|
4729
|
-
})(search);
|
|
4730
|
-
},
|
|
4731
|
-
[handleSearchChange]
|
|
4732
|
-
);
|
|
4733
|
-
const resetTypeahead = React19.useCallback(() => {
|
|
4734
|
-
searchRef.current = "";
|
|
4735
|
-
window.clearTimeout(timerRef.current);
|
|
4736
|
-
}, []);
|
|
4737
|
-
React19.useEffect(() => {
|
|
4738
|
-
return () => window.clearTimeout(timerRef.current);
|
|
4739
|
-
}, []);
|
|
4740
|
-
return [searchRef, handleTypeaheadSearch, resetTypeahead];
|
|
4741
|
-
}
|
|
4742
|
-
function findNextItem(items, search, currentItem) {
|
|
4743
|
-
const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);
|
|
4744
|
-
const normalizedSearch = isRepeated ? search[0] : search;
|
|
4745
|
-
const currentItemIndex = currentItem ? items.indexOf(currentItem) : -1;
|
|
4746
|
-
let wrappedItems = wrapArray(items, Math.max(currentItemIndex, 0));
|
|
4747
|
-
const excludeCurrentItem = normalizedSearch.length === 1;
|
|
4748
|
-
if (excludeCurrentItem) wrappedItems = wrappedItems.filter((v) => v !== currentItem);
|
|
4749
|
-
const nextItem = wrappedItems.find(
|
|
4750
|
-
(item) => item.textValue.toLowerCase().startsWith(normalizedSearch.toLowerCase())
|
|
4751
|
-
);
|
|
4752
|
-
return nextItem !== currentItem ? nextItem : void 0;
|
|
4753
|
-
}
|
|
4754
|
-
function wrapArray(array, startIndex) {
|
|
4755
|
-
return array.map((_, index2) => array[(startIndex + index2) % array.length]);
|
|
4756
|
-
}
|
|
4757
|
-
var Root22 = Select;
|
|
4758
|
-
var Trigger = SelectTrigger;
|
|
4759
|
-
var Value = SelectValue;
|
|
4760
|
-
var Icon = SelectIcon;
|
|
4761
|
-
var Portal2 = SelectPortal;
|
|
4762
|
-
var Content2 = SelectContent;
|
|
4763
|
-
var Viewport = SelectViewport;
|
|
4764
|
-
var Group = SelectGroup;
|
|
4765
|
-
var Label = SelectLabel;
|
|
4766
|
-
var Item = SelectItem;
|
|
4767
|
-
var ItemText = SelectItemText;
|
|
4768
|
-
var ItemIndicator = SelectItemIndicator;
|
|
4769
|
-
var ScrollUpButton = SelectScrollUpButton;
|
|
4770
|
-
var ScrollDownButton = SelectScrollDownButton;
|
|
4771
|
-
var Separator = SelectSeparator;
|
|
4772
|
-
var Arrow22 = SelectArrow;
|
|
4773
|
-
export {
|
|
4774
|
-
Arrow22 as Arrow,
|
|
4775
|
-
Content2 as Content,
|
|
4776
|
-
Group,
|
|
4777
|
-
Icon,
|
|
4778
|
-
Item,
|
|
4779
|
-
ItemIndicator,
|
|
4780
|
-
ItemText,
|
|
4781
|
-
Label,
|
|
4782
|
-
Portal2 as Portal,
|
|
4783
|
-
Root22 as Root,
|
|
4784
|
-
ScrollDownButton,
|
|
4785
|
-
ScrollUpButton,
|
|
4786
|
-
Select,
|
|
4787
|
-
SelectArrow,
|
|
4788
|
-
SelectContent,
|
|
4789
|
-
SelectGroup,
|
|
4790
|
-
SelectIcon,
|
|
4791
|
-
SelectItem,
|
|
4792
|
-
SelectItemIndicator,
|
|
4793
|
-
SelectItemText,
|
|
4794
|
-
SelectLabel,
|
|
4795
|
-
SelectPortal,
|
|
4796
|
-
SelectScrollDownButton,
|
|
4797
|
-
SelectScrollUpButton,
|
|
4798
|
-
SelectSeparator,
|
|
4799
|
-
SelectTrigger,
|
|
4800
|
-
SelectValue,
|
|
4801
|
-
SelectViewport,
|
|
4802
|
-
Separator,
|
|
4803
|
-
Trigger,
|
|
4804
|
-
Value,
|
|
4805
|
-
Viewport,
|
|
4806
|
-
createSelectScope
|
|
4807
|
-
};
|
|
4808
|
-
//# sourceMappingURL=@radix-ui_react-select.js.map
|