@eightshift/ui-components 5.0.0 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Button-BpwTmkAe.js +185 -0
- package/dist/Collection-n5d0zIgb.js +2398 -0
- package/dist/Color-lVhk8V_G.js +2452 -0
- package/dist/ColorSwatch-DntWEAC3.js +64 -0
- package/dist/ComboBox-BJpTEATT.js +1915 -0
- package/dist/Dialog-O9uw63D7.js +2317 -0
- package/dist/FieldError-DHrSdE_Q.js +42 -0
- package/dist/FocusScope-BEPI2m7u.js +831 -0
- package/dist/Form-Cq3fu75_.js +5 -0
- package/dist/Group-DDPhPPTQ.js +48 -0
- package/dist/Heading-ba38ScjJ.js +16 -0
- package/dist/Hidden-rE6uR-lr.js +41 -0
- package/dist/Input-BmDS8Juy.js +133 -0
- package/dist/Label-JS_ob-kh.js +17 -0
- package/dist/List-CZMUbkFU.js +593 -0
- package/dist/ListBox-BTxlCGcc.js +664 -0
- package/dist/NumberFormatter-DA8u1Ot7.js +140 -0
- package/dist/OverlayArrow-5aDgmImj.js +637 -0
- package/dist/RSPContexts-2lR5GG9p.js +14 -0
- package/dist/Select-aab027f3.esm-BKIJGje-.js +2469 -0
- package/dist/Separator-CaTBkETC.js +332 -0
- package/dist/Slider-C-S1oEH9.js +853 -0
- package/dist/Text-BuJgePCv.js +16 -0
- package/dist/VisuallyHidden-BYi0pekx.js +48 -0
- package/dist/_commonjsHelpers-CUmg6egw.js +6 -0
- package/dist/assets/index.css +57 -0
- package/dist/assets/style-admin.css +5908 -0
- package/dist/assets/style-editor.css +5908 -0
- package/dist/assets/style.css +5914 -0
- package/dist/assets/wp-font-enhancements.css +8 -0
- package/dist/assets/wp-ui-enhancements.css +396 -0
- package/dist/components/animated-visibility/animated-visibility.js +105 -0
- package/dist/components/base-control/base-control.js +86 -0
- package/dist/components/breakpoint-preview/breakpoint-preview.js +161 -0
- package/dist/components/button/button.js +387 -0
- package/dist/components/checkbox/checkbox.js +323 -0
- package/dist/components/color-pickers/color-picker.js +272 -0
- package/dist/components/color-pickers/color-swatch.js +59 -0
- package/dist/components/color-pickers/gradient-editor.js +534 -0
- package/dist/components/color-pickers/solid-color-picker.js +1567 -0
- package/dist/components/component-toggle/component-toggle.js +161 -0
- package/dist/components/container-panel/container-panel.js +131 -0
- package/dist/components/draggable/draggable-context.js +5 -0
- package/dist/components/draggable/draggable-handle.js +46 -0
- package/dist/components/draggable/draggable.js +7320 -0
- package/dist/components/draggable-list/draggable-list-context.js +5 -0
- package/dist/components/draggable-list/draggable-list-item.js +77 -0
- package/dist/components/draggable-list/draggable-list.js +151 -0
- package/dist/components/expandable/expandable.js +342 -0
- package/dist/components/index.js +137 -0
- package/dist/components/input-field/input-field.js +231 -0
- package/dist/components/item-collection/item-collection.js +59 -0
- package/dist/components/layout/hstack.js +30 -0
- package/dist/components/layout/vstack.js +30 -0
- package/dist/components/link-input/link-input.js +284 -0
- package/dist/components/matrix-align/matrix-align.js +134 -0
- package/dist/components/menu/menu.js +285 -0
- package/dist/components/modal/modal.js +305 -0
- package/dist/components/notice/notice.js +123 -0
- package/dist/components/number-picker/number-picker.js +292 -0
- package/dist/components/option-select/option-select.js +264 -0
- package/dist/components/options-panel/options-panel.js +158 -0
- package/dist/components/placeholders/file-placeholder.js +42 -0
- package/dist/components/placeholders/image-placeholder.js +88 -0
- package/dist/components/placeholders/media-placeholder.js +63 -0
- package/dist/components/popover/popover.js +207 -0
- package/dist/components/radio/radio.js +582 -0
- package/dist/components/repeater/repeater-context.js +5 -0
- package/dist/components/repeater/repeater-item.js +119 -0
- package/dist/components/repeater/repeater.js +280 -0
- package/dist/components/responsive/mini-responsive.js +498 -0
- package/dist/components/responsive/responsive-legacy.js +343 -0
- package/dist/components/responsive/responsive.js +583 -0
- package/dist/components/responsive-preview/responsive-preview.js +123 -0
- package/dist/components/rich-label/rich-label.js +66 -0
- package/dist/components/select/async-multi-select.js +157 -0
- package/dist/components/select/async-single-select.js +137 -0
- package/dist/components/select/custom-select-default-components.js +38 -0
- package/dist/components/select/multi-select-components.js +8 -0
- package/dist/components/select/multi-select.js +151 -0
- package/dist/components/select/react-select-component-wrappers.js +90 -0
- package/dist/components/select/shared.js +26 -0
- package/dist/components/select/single-select.js +131 -0
- package/dist/components/select/styles.js +49 -0
- package/dist/components/select/v2/async-select.js +297 -0
- package/dist/components/select/v2/shared.js +24 -0
- package/dist/components/select/v2/single-select.js +1004 -0
- package/dist/components/slider/column-config-slider.js +210 -0
- package/dist/components/slider/slider.js +345 -0
- package/dist/components/slider/utils.js +94 -0
- package/dist/components/spacer/spacer.js +97 -0
- package/dist/components/tabs/tabs.js +703 -0
- package/dist/components/toggle/switch.js +156 -0
- package/dist/components/toggle/toggle.js +64 -0
- package/dist/components/toggle-button/toggle-button.js +343 -0
- package/dist/components/tooltip/tooltip.js +527 -0
- package/dist/context-BbYZoHvX.js +92 -0
- package/dist/default-i18n-CT_oS1Fy.js +922 -0
- package/dist/filterDOMProps-EDDcM64A.js +28 -0
- package/dist/icons/block-icon.js +42 -0
- package/dist/icons/generic-color-swatch.js +113 -0
- package/dist/icons/icons.js +30495 -0
- package/dist/icons/index.js +11 -0
- package/dist/icons/jsx-svg.js +50 -0
- package/dist/index-641ee5b8.esm-BPU8rMZr.js +3137 -0
- package/dist/index-BljRBEr_.js +44 -0
- package/dist/index-CFozsmNS.js +28321 -0
- package/dist/index.js +139 -0
- package/dist/lite-DVmmD_-j.js +7 -0
- package/dist/modifiers.esm-BuJQPI1X.js +31 -0
- package/dist/multi-select-components-Sp-JEFEX.js +3744 -0
- package/dist/number-GajL10e1.js +36 -0
- package/dist/react-jsx-parser.min-DZCiis5V.js +11753 -0
- package/dist/react-select-async.esm-D937XTWW.js +107 -0
- package/dist/react-select.esm-Ciai3aKf.js +15 -0
- package/dist/style-admin.js +1 -0
- package/dist/style-editor.js +1 -0
- package/dist/style.js +1 -0
- package/dist/textSelection-8DpK8fJl.js +46 -0
- package/dist/useButton-Bt3BffJm.js +50 -0
- package/dist/useEvent-ICdlokG-.js +23 -0
- package/dist/useFocusRing-Bv0UJQl8.js +107 -0
- package/dist/useFormReset-D2YaWRIA.js +22 -0
- package/dist/useFormValidation-Dy0PXJg5.js +224 -0
- package/dist/useHover-C2SkI1Fn.js +895 -0
- package/dist/useLabel-BPCd5c7-.js +27 -0
- package/dist/useLabels-B7-lUnAF.js +23 -0
- package/dist/useListState-DkyH7elT.js +168 -0
- package/dist/useLocalizedStringFormatter-C9GO0IDB.js +121 -0
- package/dist/useNumberField-CU1_u8ze.js +1215 -0
- package/dist/useNumberFormatter-CZ9QUnRt.js +13 -0
- package/dist/usePress-BrJylgPR.js +688 -0
- package/dist/useSingleSelectListState-C4sorv2p.js +38 -0
- package/dist/useToggle-CDa3YAZI.js +59 -0
- package/dist/useToggleState-ibcBUHnB.js +19 -0
- package/dist/utilities/array-helpers.js +56 -0
- package/dist/utilities/debounce-throttle.js +123 -0
- package/dist/utilities/es-dash.js +382 -0
- package/dist/utilities/index.js +27 -0
- package/dist/utilities/text-helpers.js +136 -0
- package/dist/utils-CZt7LCbO.js +403 -0
- package/dist/wp/wp-font-enhancements.js +1 -0
- package/dist/wp/wp-ui-enhancements.js +1 -0
- package/package.json +24 -24
|
@@ -0,0 +1,637 @@
|
|
|
1
|
+
import { k as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, a as $64fa3d84918910a7$export$29f1550f4b0d4415, b as $64fa3d84918910a7$export$4d86445c2cf5e3 } from "./utils-CZt7LCbO.js";
|
|
2
|
+
import { r as reactDomExports } from "./index-CFozsmNS.js";
|
|
3
|
+
import React__default, { useEffect, useState, useCallback, useRef, useContext, createContext, forwardRef } from "react";
|
|
4
|
+
import { C as $c87311424ea30a05$export$78551043582a6a98, b as $458b0a5536c1a7cf$export$40bfa8c7b0832715 } from "./useHover-C2SkI1Fn.js";
|
|
5
|
+
import { a as $9446cca9a3875146$export$7d15b64cf5a3a4c4 } from "./number-GajL10e1.js";
|
|
6
|
+
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "./context-BbYZoHvX.js";
|
|
7
|
+
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "./filterDOMProps-EDDcM64A.js";
|
|
8
|
+
function $9daab02d461809db$var$hasResizeObserver() {
|
|
9
|
+
return typeof window.ResizeObserver !== "undefined";
|
|
10
|
+
}
|
|
11
|
+
function $9daab02d461809db$export$683480f191c0e3ea(options) {
|
|
12
|
+
const { ref, box, onResize } = options;
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
let element = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
15
|
+
if (!element) return;
|
|
16
|
+
if (!$9daab02d461809db$var$hasResizeObserver()) {
|
|
17
|
+
window.addEventListener("resize", onResize, false);
|
|
18
|
+
return () => {
|
|
19
|
+
window.removeEventListener("resize", onResize, false);
|
|
20
|
+
};
|
|
21
|
+
} else {
|
|
22
|
+
const resizeObserverInstance = new window.ResizeObserver((entries) => {
|
|
23
|
+
if (!entries.length) return;
|
|
24
|
+
onResize();
|
|
25
|
+
});
|
|
26
|
+
resizeObserverInstance.observe(element, {
|
|
27
|
+
box
|
|
28
|
+
});
|
|
29
|
+
return () => {
|
|
30
|
+
if (element) resizeObserverInstance.unobserve(element);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}, [
|
|
34
|
+
onResize,
|
|
35
|
+
ref,
|
|
36
|
+
box
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
function $d3f049242431219c$export$6d3443f2c48bfc20(ref, isReady = true) {
|
|
40
|
+
let [isEntering, setEntering] = useState(true);
|
|
41
|
+
let isAnimationReady = isEntering && isReady;
|
|
42
|
+
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
43
|
+
if (isAnimationReady && ref.current && "getAnimations" in ref.current) {
|
|
44
|
+
for (let animation of ref.current.getAnimations()) if (animation instanceof CSSTransition) animation.cancel();
|
|
45
|
+
}
|
|
46
|
+
}, [
|
|
47
|
+
ref,
|
|
48
|
+
isAnimationReady
|
|
49
|
+
]);
|
|
50
|
+
$d3f049242431219c$var$useAnimation(ref, isAnimationReady, useCallback(() => setEntering(false), []));
|
|
51
|
+
return isAnimationReady;
|
|
52
|
+
}
|
|
53
|
+
function $d3f049242431219c$export$45fda7c47f93fd48(ref, isOpen) {
|
|
54
|
+
let [exitState, setExitState] = useState(isOpen ? "open" : "closed");
|
|
55
|
+
switch (exitState) {
|
|
56
|
+
case "open":
|
|
57
|
+
if (!isOpen) setExitState("exiting");
|
|
58
|
+
break;
|
|
59
|
+
case "closed":
|
|
60
|
+
case "exiting":
|
|
61
|
+
if (isOpen) setExitState("open");
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
let isExiting = exitState === "exiting";
|
|
65
|
+
$d3f049242431219c$var$useAnimation(ref, isExiting, useCallback(() => {
|
|
66
|
+
setExitState((state) => state === "exiting" ? "closed" : state);
|
|
67
|
+
}, []));
|
|
68
|
+
return isExiting;
|
|
69
|
+
}
|
|
70
|
+
function $d3f049242431219c$var$useAnimation(ref, isActive, onEnd) {
|
|
71
|
+
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
72
|
+
if (isActive && ref.current) {
|
|
73
|
+
if (!("getAnimations" in ref.current)) {
|
|
74
|
+
onEnd();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
let animations = ref.current.getAnimations();
|
|
78
|
+
if (animations.length === 0) {
|
|
79
|
+
onEnd();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
let canceled = false;
|
|
83
|
+
Promise.all(animations.map((a) => a.finished)).then(() => {
|
|
84
|
+
if (!canceled) reactDomExports.flushSync(() => {
|
|
85
|
+
onEnd();
|
|
86
|
+
});
|
|
87
|
+
}).catch(() => {
|
|
88
|
+
});
|
|
89
|
+
return () => {
|
|
90
|
+
canceled = true;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}, [
|
|
94
|
+
ref,
|
|
95
|
+
isActive,
|
|
96
|
+
onEnd
|
|
97
|
+
]);
|
|
98
|
+
}
|
|
99
|
+
const $edcf132a9284368a$var$AXIS = {
|
|
100
|
+
top: "top",
|
|
101
|
+
bottom: "top",
|
|
102
|
+
left: "left",
|
|
103
|
+
right: "left"
|
|
104
|
+
};
|
|
105
|
+
const $edcf132a9284368a$var$FLIPPED_DIRECTION = {
|
|
106
|
+
top: "bottom",
|
|
107
|
+
bottom: "top",
|
|
108
|
+
left: "right",
|
|
109
|
+
right: "left"
|
|
110
|
+
};
|
|
111
|
+
const $edcf132a9284368a$var$CROSS_AXIS = {
|
|
112
|
+
top: "left",
|
|
113
|
+
left: "top"
|
|
114
|
+
};
|
|
115
|
+
const $edcf132a9284368a$var$AXIS_SIZE = {
|
|
116
|
+
top: "height",
|
|
117
|
+
left: "width"
|
|
118
|
+
};
|
|
119
|
+
const $edcf132a9284368a$var$TOTAL_SIZE = {
|
|
120
|
+
width: "totalWidth",
|
|
121
|
+
height: "totalHeight"
|
|
122
|
+
};
|
|
123
|
+
const $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE = {};
|
|
124
|
+
let $edcf132a9284368a$var$visualViewport = typeof document !== "undefined" ? window.visualViewport : null;
|
|
125
|
+
function $edcf132a9284368a$var$getContainerDimensions(containerNode) {
|
|
126
|
+
let width = 0, height = 0, totalWidth = 0, totalHeight = 0, top = 0, left = 0;
|
|
127
|
+
let scroll = {};
|
|
128
|
+
var _visualViewport_scale;
|
|
129
|
+
let isPinchZoomedIn = ((_visualViewport_scale = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.scale) !== null && _visualViewport_scale !== void 0 ? _visualViewport_scale : 1) > 1;
|
|
130
|
+
if (containerNode.tagName === "BODY") {
|
|
131
|
+
let documentElement = document.documentElement;
|
|
132
|
+
totalWidth = documentElement.clientWidth;
|
|
133
|
+
totalHeight = documentElement.clientHeight;
|
|
134
|
+
var _visualViewport_width;
|
|
135
|
+
width = (_visualViewport_width = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.width) !== null && _visualViewport_width !== void 0 ? _visualViewport_width : totalWidth;
|
|
136
|
+
var _visualViewport_height;
|
|
137
|
+
height = (_visualViewport_height = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.height) !== null && _visualViewport_height !== void 0 ? _visualViewport_height : totalHeight;
|
|
138
|
+
scroll.top = documentElement.scrollTop || containerNode.scrollTop;
|
|
139
|
+
scroll.left = documentElement.scrollLeft || containerNode.scrollLeft;
|
|
140
|
+
if ($edcf132a9284368a$var$visualViewport) {
|
|
141
|
+
top = $edcf132a9284368a$var$visualViewport.offsetTop;
|
|
142
|
+
left = $edcf132a9284368a$var$visualViewport.offsetLeft;
|
|
143
|
+
}
|
|
144
|
+
} else {
|
|
145
|
+
({ width, height, top, left } = $edcf132a9284368a$var$getOffset(containerNode));
|
|
146
|
+
scroll.top = containerNode.scrollTop;
|
|
147
|
+
scroll.left = containerNode.scrollLeft;
|
|
148
|
+
totalWidth = width;
|
|
149
|
+
totalHeight = height;
|
|
150
|
+
}
|
|
151
|
+
if ($c87311424ea30a05$export$78551043582a6a98() && (containerNode.tagName === "BODY" || containerNode.tagName === "HTML") && isPinchZoomedIn) {
|
|
152
|
+
scroll.top = 0;
|
|
153
|
+
scroll.left = 0;
|
|
154
|
+
var _visualViewport_pageTop;
|
|
155
|
+
top = (_visualViewport_pageTop = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.pageTop) !== null && _visualViewport_pageTop !== void 0 ? _visualViewport_pageTop : 0;
|
|
156
|
+
var _visualViewport_pageLeft;
|
|
157
|
+
left = (_visualViewport_pageLeft = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.pageLeft) !== null && _visualViewport_pageLeft !== void 0 ? _visualViewport_pageLeft : 0;
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
width,
|
|
161
|
+
height,
|
|
162
|
+
totalWidth,
|
|
163
|
+
totalHeight,
|
|
164
|
+
scroll,
|
|
165
|
+
top,
|
|
166
|
+
left
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function $edcf132a9284368a$var$getScroll(node) {
|
|
170
|
+
return {
|
|
171
|
+
top: node.scrollTop,
|
|
172
|
+
left: node.scrollLeft,
|
|
173
|
+
width: node.scrollWidth,
|
|
174
|
+
height: node.scrollHeight
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function $edcf132a9284368a$var$getDelta(axis, offset, size, boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary) {
|
|
178
|
+
var _containerDimensions_scroll_axis;
|
|
179
|
+
let containerScroll = (_containerDimensions_scroll_axis = containerDimensions.scroll[axis]) !== null && _containerDimensions_scroll_axis !== void 0 ? _containerDimensions_scroll_axis : 0;
|
|
180
|
+
let boundarySize = boundaryDimensions[$edcf132a9284368a$var$AXIS_SIZE[axis]];
|
|
181
|
+
let boundaryStartEdge = boundaryDimensions.scroll[$edcf132a9284368a$var$AXIS[axis]] + padding;
|
|
182
|
+
let boundaryEndEdge = boundarySize + boundaryDimensions.scroll[$edcf132a9284368a$var$AXIS[axis]] - padding;
|
|
183
|
+
let startEdgeOffset = offset - containerScroll + containerOffsetWithBoundary[axis] - boundaryDimensions[$edcf132a9284368a$var$AXIS[axis]];
|
|
184
|
+
let endEdgeOffset = offset - containerScroll + size + containerOffsetWithBoundary[axis] - boundaryDimensions[$edcf132a9284368a$var$AXIS[axis]];
|
|
185
|
+
if (startEdgeOffset < boundaryStartEdge) return boundaryStartEdge - startEdgeOffset;
|
|
186
|
+
else if (endEdgeOffset > boundaryEndEdge) return Math.max(boundaryEndEdge - endEdgeOffset, boundaryStartEdge - startEdgeOffset);
|
|
187
|
+
else return 0;
|
|
188
|
+
}
|
|
189
|
+
function $edcf132a9284368a$var$getMargins(node) {
|
|
190
|
+
let style = window.getComputedStyle(node);
|
|
191
|
+
return {
|
|
192
|
+
top: parseInt(style.marginTop, 10) || 0,
|
|
193
|
+
bottom: parseInt(style.marginBottom, 10) || 0,
|
|
194
|
+
left: parseInt(style.marginLeft, 10) || 0,
|
|
195
|
+
right: parseInt(style.marginRight, 10) || 0
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
function $edcf132a9284368a$var$parsePlacement(input) {
|
|
199
|
+
if ($edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input]) return $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input];
|
|
200
|
+
let [placement, crossPlacement] = input.split(" ");
|
|
201
|
+
let axis = $edcf132a9284368a$var$AXIS[placement] || "right";
|
|
202
|
+
let crossAxis = $edcf132a9284368a$var$CROSS_AXIS[axis];
|
|
203
|
+
if (!$edcf132a9284368a$var$AXIS[crossPlacement]) crossPlacement = "center";
|
|
204
|
+
let size = $edcf132a9284368a$var$AXIS_SIZE[axis];
|
|
205
|
+
let crossSize = $edcf132a9284368a$var$AXIS_SIZE[crossAxis];
|
|
206
|
+
$edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input] = {
|
|
207
|
+
placement,
|
|
208
|
+
crossPlacement,
|
|
209
|
+
axis,
|
|
210
|
+
crossAxis,
|
|
211
|
+
size,
|
|
212
|
+
crossSize
|
|
213
|
+
};
|
|
214
|
+
return $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input];
|
|
215
|
+
}
|
|
216
|
+
function $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset) {
|
|
217
|
+
let { placement, crossPlacement, axis, crossAxis, size, crossSize } = placementInfo;
|
|
218
|
+
let position = {};
|
|
219
|
+
var _childOffset_crossAxis;
|
|
220
|
+
position[crossAxis] = (_childOffset_crossAxis = childOffset[crossAxis]) !== null && _childOffset_crossAxis !== void 0 ? _childOffset_crossAxis : 0;
|
|
221
|
+
var _childOffset_crossSize, _overlaySize_crossSize, _childOffset_crossSize1, _overlaySize_crossSize1;
|
|
222
|
+
if (crossPlacement === "center")
|
|
223
|
+
position[crossAxis] += (((_childOffset_crossSize = childOffset[crossSize]) !== null && _childOffset_crossSize !== void 0 ? _childOffset_crossSize : 0) - ((_overlaySize_crossSize = overlaySize[crossSize]) !== null && _overlaySize_crossSize !== void 0 ? _overlaySize_crossSize : 0)) / 2;
|
|
224
|
+
else if (crossPlacement !== crossAxis)
|
|
225
|
+
position[crossAxis] += ((_childOffset_crossSize1 = childOffset[crossSize]) !== null && _childOffset_crossSize1 !== void 0 ? _childOffset_crossSize1 : 0) - ((_overlaySize_crossSize1 = overlaySize[crossSize]) !== null && _overlaySize_crossSize1 !== void 0 ? _overlaySize_crossSize1 : 0);
|
|
226
|
+
position[crossAxis] += crossOffset;
|
|
227
|
+
const minPosition = childOffset[crossAxis] - overlaySize[crossSize] + arrowSize + arrowBoundaryOffset;
|
|
228
|
+
const maxPosition = childOffset[crossAxis] + childOffset[crossSize] - arrowSize - arrowBoundaryOffset;
|
|
229
|
+
position[crossAxis] = $9446cca9a3875146$export$7d15b64cf5a3a4c4(position[crossAxis], minPosition, maxPosition);
|
|
230
|
+
if (placement === axis) {
|
|
231
|
+
const containerHeight = isContainerPositioned ? containerOffsetWithBoundary[size] : boundaryDimensions[$edcf132a9284368a$var$TOTAL_SIZE[size]];
|
|
232
|
+
position[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] = Math.floor(containerHeight - childOffset[axis] + offset);
|
|
233
|
+
} else position[axis] = Math.floor(childOffset[axis] + childOffset[size] + offset);
|
|
234
|
+
return position;
|
|
235
|
+
}
|
|
236
|
+
function $edcf132a9284368a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlayHeight, heightGrowthDirection) {
|
|
237
|
+
const containerHeight = isContainerPositioned ? containerOffsetWithBoundary.height : boundaryDimensions[$edcf132a9284368a$var$TOTAL_SIZE.height];
|
|
238
|
+
var _position_bottom;
|
|
239
|
+
let overlayTop = position.top != null ? containerOffsetWithBoundary.top + position.top : containerOffsetWithBoundary.top + (containerHeight - ((_position_bottom = position.bottom) !== null && _position_bottom !== void 0 ? _position_bottom : 0) - overlayHeight);
|
|
240
|
+
var _boundaryDimensions_scroll_top, _margins_top, _margins_bottom, _boundaryDimensions_scroll_top1, _margins_top1, _margins_bottom1;
|
|
241
|
+
let maxHeight = heightGrowthDirection !== "top" ? (
|
|
242
|
+
// We want the distance between the top of the overlay to the bottom of the boundary
|
|
243
|
+
Math.max(0, boundaryDimensions.height + boundaryDimensions.top + ((_boundaryDimensions_scroll_top = boundaryDimensions.scroll.top) !== null && _boundaryDimensions_scroll_top !== void 0 ? _boundaryDimensions_scroll_top : 0) - overlayTop - (((_margins_top = margins.top) !== null && _margins_top !== void 0 ? _margins_top : 0) + ((_margins_bottom = margins.bottom) !== null && _margins_bottom !== void 0 ? _margins_bottom : 0) + padding))
|
|
244
|
+
) : Math.max(0, overlayTop + overlayHeight - (boundaryDimensions.top + ((_boundaryDimensions_scroll_top1 = boundaryDimensions.scroll.top) !== null && _boundaryDimensions_scroll_top1 !== void 0 ? _boundaryDimensions_scroll_top1 : 0)) - (((_margins_top1 = margins.top) !== null && _margins_top1 !== void 0 ? _margins_top1 : 0) + ((_margins_bottom1 = margins.bottom) !== null && _margins_bottom1 !== void 0 ? _margins_bottom1 : 0) + padding));
|
|
245
|
+
return Math.min(boundaryDimensions.height - padding * 2, maxHeight);
|
|
246
|
+
}
|
|
247
|
+
function $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding, placementInfo) {
|
|
248
|
+
let { placement, axis, size } = placementInfo;
|
|
249
|
+
var _boundaryDimensions_scroll_axis, _margins_axis;
|
|
250
|
+
if (placement === axis) return Math.max(0, childOffset[axis] - boundaryDimensions[axis] - ((_boundaryDimensions_scroll_axis = boundaryDimensions.scroll[axis]) !== null && _boundaryDimensions_scroll_axis !== void 0 ? _boundaryDimensions_scroll_axis : 0) + containerOffsetWithBoundary[axis] - ((_margins_axis = margins[axis]) !== null && _margins_axis !== void 0 ? _margins_axis : 0) - margins[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] - padding);
|
|
251
|
+
var _margins_axis1;
|
|
252
|
+
return Math.max(0, boundaryDimensions[size] + boundaryDimensions[axis] + boundaryDimensions.scroll[axis] - containerOffsetWithBoundary[axis] - childOffset[axis] - childOffset[size] - ((_margins_axis1 = margins[axis]) !== null && _margins_axis1 !== void 0 ? _margins_axis1 : 0) - margins[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] - padding);
|
|
253
|
+
}
|
|
254
|
+
function $edcf132a9284368a$export$6839422d1f33cee9(placementInput, childOffset, overlaySize, scrollSize, margins, padding, flip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, userSetMaxHeight, arrowSize, arrowBoundaryOffset) {
|
|
255
|
+
let placementInfo = $edcf132a9284368a$var$parsePlacement(placementInput);
|
|
256
|
+
let { size, crossAxis, crossSize, placement, crossPlacement } = placementInfo;
|
|
257
|
+
let position = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
|
|
258
|
+
let normalizedOffset = offset;
|
|
259
|
+
let space = $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, placementInfo);
|
|
260
|
+
if (flip && scrollSize[size] > space) {
|
|
261
|
+
let flippedPlacementInfo = $edcf132a9284368a$var$parsePlacement(`${$edcf132a9284368a$var$FLIPPED_DIRECTION[placement]} ${crossPlacement}`);
|
|
262
|
+
let flippedPosition = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, flippedPlacementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
|
|
263
|
+
let flippedSpace = $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, flippedPlacementInfo);
|
|
264
|
+
if (flippedSpace > space) {
|
|
265
|
+
placementInfo = flippedPlacementInfo;
|
|
266
|
+
position = flippedPosition;
|
|
267
|
+
normalizedOffset = offset;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
let heightGrowthDirection = "bottom";
|
|
271
|
+
if (placementInfo.axis === "top") {
|
|
272
|
+
if (placementInfo.placement === "top") heightGrowthDirection = "top";
|
|
273
|
+
else if (placementInfo.placement === "bottom") heightGrowthDirection = "bottom";
|
|
274
|
+
} else if (placementInfo.crossAxis === "top") {
|
|
275
|
+
if (placementInfo.crossPlacement === "top") heightGrowthDirection = "bottom";
|
|
276
|
+
else if (placementInfo.crossPlacement === "bottom") heightGrowthDirection = "top";
|
|
277
|
+
}
|
|
278
|
+
let delta = $edcf132a9284368a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
|
|
279
|
+
position[crossAxis] += delta;
|
|
280
|
+
let maxHeight = $edcf132a9284368a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlaySize.height, heightGrowthDirection);
|
|
281
|
+
if (userSetMaxHeight && userSetMaxHeight < maxHeight) maxHeight = userSetMaxHeight;
|
|
282
|
+
overlaySize.height = Math.min(overlaySize.height, maxHeight);
|
|
283
|
+
position = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, normalizedOffset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
|
|
284
|
+
delta = $edcf132a9284368a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
|
|
285
|
+
position[crossAxis] += delta;
|
|
286
|
+
let arrowPosition = {};
|
|
287
|
+
let preferredArrowPosition = childOffset[crossAxis] + 0.5 * childOffset[crossSize] - position[crossAxis] - margins[$edcf132a9284368a$var$AXIS[crossAxis]];
|
|
288
|
+
const arrowMinPosition = arrowSize / 2 + arrowBoundaryOffset;
|
|
289
|
+
var _margins_left, _margins_right, _margins_top, _margins_bottom;
|
|
290
|
+
const overlayMargin = $edcf132a9284368a$var$AXIS[crossAxis] === "left" ? ((_margins_left = margins.left) !== null && _margins_left !== void 0 ? _margins_left : 0) + ((_margins_right = margins.right) !== null && _margins_right !== void 0 ? _margins_right : 0) : ((_margins_top = margins.top) !== null && _margins_top !== void 0 ? _margins_top : 0) + ((_margins_bottom = margins.bottom) !== null && _margins_bottom !== void 0 ? _margins_bottom : 0);
|
|
291
|
+
const arrowMaxPosition = overlaySize[crossSize] - overlayMargin - arrowSize / 2 - arrowBoundaryOffset;
|
|
292
|
+
const arrowOverlappingChildMinEdge = childOffset[crossAxis] + arrowSize / 2 - (position[crossAxis] + margins[$edcf132a9284368a$var$AXIS[crossAxis]]);
|
|
293
|
+
const arrowOverlappingChildMaxEdge = childOffset[crossAxis] + childOffset[crossSize] - arrowSize / 2 - (position[crossAxis] + margins[$edcf132a9284368a$var$AXIS[crossAxis]]);
|
|
294
|
+
const arrowPositionOverlappingChild = $9446cca9a3875146$export$7d15b64cf5a3a4c4(preferredArrowPosition, arrowOverlappingChildMinEdge, arrowOverlappingChildMaxEdge);
|
|
295
|
+
arrowPosition[crossAxis] = $9446cca9a3875146$export$7d15b64cf5a3a4c4(arrowPositionOverlappingChild, arrowMinPosition, arrowMaxPosition);
|
|
296
|
+
return {
|
|
297
|
+
position,
|
|
298
|
+
maxHeight,
|
|
299
|
+
arrowOffsetLeft: arrowPosition.left,
|
|
300
|
+
arrowOffsetTop: arrowPosition.top,
|
|
301
|
+
placement: placementInfo.placement
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
function $edcf132a9284368a$export$b3ceb0cbf1056d98(opts) {
|
|
305
|
+
let { placement, targetNode, overlayNode, scrollNode, padding, shouldFlip, boundaryElement, offset, crossOffset, maxHeight, arrowSize = 0, arrowBoundaryOffset = 0 } = opts;
|
|
306
|
+
let container = overlayNode instanceof HTMLElement ? $edcf132a9284368a$var$getContainingBlock(overlayNode) : document.documentElement;
|
|
307
|
+
let isViewportContainer = container === document.documentElement;
|
|
308
|
+
const containerPositionStyle = window.getComputedStyle(container).position;
|
|
309
|
+
let isContainerPositioned = !!containerPositionStyle && containerPositionStyle !== "static";
|
|
310
|
+
let childOffset = isViewportContainer ? $edcf132a9284368a$var$getOffset(targetNode) : $edcf132a9284368a$var$getPosition(targetNode, container);
|
|
311
|
+
if (!isViewportContainer) {
|
|
312
|
+
let { marginTop, marginLeft } = window.getComputedStyle(targetNode);
|
|
313
|
+
childOffset.top += parseInt(marginTop, 10) || 0;
|
|
314
|
+
childOffset.left += parseInt(marginLeft, 10) || 0;
|
|
315
|
+
}
|
|
316
|
+
let overlaySize = $edcf132a9284368a$var$getOffset(overlayNode);
|
|
317
|
+
let margins = $edcf132a9284368a$var$getMargins(overlayNode);
|
|
318
|
+
var _margins_left, _margins_right;
|
|
319
|
+
overlaySize.width += ((_margins_left = margins.left) !== null && _margins_left !== void 0 ? _margins_left : 0) + ((_margins_right = margins.right) !== null && _margins_right !== void 0 ? _margins_right : 0);
|
|
320
|
+
var _margins_top, _margins_bottom;
|
|
321
|
+
overlaySize.height += ((_margins_top = margins.top) !== null && _margins_top !== void 0 ? _margins_top : 0) + ((_margins_bottom = margins.bottom) !== null && _margins_bottom !== void 0 ? _margins_bottom : 0);
|
|
322
|
+
let scrollSize = $edcf132a9284368a$var$getScroll(scrollNode);
|
|
323
|
+
let boundaryDimensions = $edcf132a9284368a$var$getContainerDimensions(boundaryElement);
|
|
324
|
+
let containerDimensions = $edcf132a9284368a$var$getContainerDimensions(container);
|
|
325
|
+
let containerOffsetWithBoundary = boundaryElement.tagName === "BODY" ? $edcf132a9284368a$var$getOffset(container) : $edcf132a9284368a$var$getPosition(container, boundaryElement);
|
|
326
|
+
if (container.tagName === "HTML" && boundaryElement.tagName === "BODY") {
|
|
327
|
+
containerDimensions.scroll.top = 0;
|
|
328
|
+
containerDimensions.scroll.left = 0;
|
|
329
|
+
}
|
|
330
|
+
return $edcf132a9284368a$export$6839422d1f33cee9(placement, childOffset, overlaySize, scrollSize, margins, padding, shouldFlip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, maxHeight, arrowSize, arrowBoundaryOffset);
|
|
331
|
+
}
|
|
332
|
+
function $edcf132a9284368a$var$getOffset(node) {
|
|
333
|
+
let { top, left, width, height } = node.getBoundingClientRect();
|
|
334
|
+
let { scrollTop, scrollLeft, clientTop, clientLeft } = document.documentElement;
|
|
335
|
+
return {
|
|
336
|
+
top: top + scrollTop - clientTop,
|
|
337
|
+
left: left + scrollLeft - clientLeft,
|
|
338
|
+
width,
|
|
339
|
+
height
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
function $edcf132a9284368a$var$getPosition(node, parent) {
|
|
343
|
+
let style = window.getComputedStyle(node);
|
|
344
|
+
let offset;
|
|
345
|
+
if (style.position === "fixed") {
|
|
346
|
+
let { top, left, width, height } = node.getBoundingClientRect();
|
|
347
|
+
offset = {
|
|
348
|
+
top,
|
|
349
|
+
left,
|
|
350
|
+
width,
|
|
351
|
+
height
|
|
352
|
+
};
|
|
353
|
+
} else {
|
|
354
|
+
offset = $edcf132a9284368a$var$getOffset(node);
|
|
355
|
+
let parentOffset = $edcf132a9284368a$var$getOffset(parent);
|
|
356
|
+
let parentStyle = window.getComputedStyle(parent);
|
|
357
|
+
parentOffset.top += (parseInt(parentStyle.borderTopWidth, 10) || 0) - parent.scrollTop;
|
|
358
|
+
parentOffset.left += (parseInt(parentStyle.borderLeftWidth, 10) || 0) - parent.scrollLeft;
|
|
359
|
+
offset.top -= parentOffset.top;
|
|
360
|
+
offset.left -= parentOffset.left;
|
|
361
|
+
}
|
|
362
|
+
offset.top -= parseInt(style.marginTop, 10) || 0;
|
|
363
|
+
offset.left -= parseInt(style.marginLeft, 10) || 0;
|
|
364
|
+
return offset;
|
|
365
|
+
}
|
|
366
|
+
function $edcf132a9284368a$var$getContainingBlock(node) {
|
|
367
|
+
let offsetParent = node.offsetParent;
|
|
368
|
+
if (offsetParent && offsetParent === document.body && window.getComputedStyle(offsetParent).position === "static" && !$edcf132a9284368a$var$isContainingBlock(offsetParent)) offsetParent = document.documentElement;
|
|
369
|
+
if (offsetParent == null) {
|
|
370
|
+
offsetParent = node.parentElement;
|
|
371
|
+
while (offsetParent && !$edcf132a9284368a$var$isContainingBlock(offsetParent)) offsetParent = offsetParent.parentElement;
|
|
372
|
+
}
|
|
373
|
+
return offsetParent || document.documentElement;
|
|
374
|
+
}
|
|
375
|
+
function $edcf132a9284368a$var$isContainingBlock(node) {
|
|
376
|
+
let style = window.getComputedStyle(node);
|
|
377
|
+
return style.transform !== "none" || /transform|perspective/.test(style.willChange) || style.filter !== "none" || style.contain === "paint" || "backdropFilter" in style && style.backdropFilter !== "none" || "WebkitBackdropFilter" in style && style.WebkitBackdropFilter !== "none";
|
|
378
|
+
}
|
|
379
|
+
const $dd149f63282afbbf$export$f6211563215e3b37 = /* @__PURE__ */ new WeakMap();
|
|
380
|
+
function $dd149f63282afbbf$export$18fc8428861184da(opts) {
|
|
381
|
+
let { triggerRef, isOpen, onClose } = opts;
|
|
382
|
+
useEffect(() => {
|
|
383
|
+
if (!isOpen || onClose === null) return;
|
|
384
|
+
let onScroll = (e) => {
|
|
385
|
+
let target = e.target;
|
|
386
|
+
if (!triggerRef.current || target instanceof Node && !target.contains(triggerRef.current)) return;
|
|
387
|
+
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) return;
|
|
388
|
+
let onCloseHandler = onClose || $dd149f63282afbbf$export$f6211563215e3b37.get(triggerRef.current);
|
|
389
|
+
if (onCloseHandler) onCloseHandler();
|
|
390
|
+
};
|
|
391
|
+
window.addEventListener("scroll", onScroll, true);
|
|
392
|
+
return () => {
|
|
393
|
+
window.removeEventListener("scroll", onScroll, true);
|
|
394
|
+
};
|
|
395
|
+
}, [
|
|
396
|
+
isOpen,
|
|
397
|
+
onClose,
|
|
398
|
+
triggerRef
|
|
399
|
+
]);
|
|
400
|
+
}
|
|
401
|
+
let $2a41e45df1593e64$var$visualViewport = typeof document !== "undefined" ? window.visualViewport : null;
|
|
402
|
+
function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
|
|
403
|
+
let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
|
|
404
|
+
let { arrowSize = 0, targetRef, overlayRef, scrollRef = overlayRef, placement = "bottom", containerPadding = 12, shouldFlip = true, boundaryElement = typeof document !== "undefined" ? document.body : null, offset = 0, crossOffset = 0, shouldUpdatePosition = true, isOpen = true, onClose, maxHeight, arrowBoundaryOffset = 0 } = props;
|
|
405
|
+
let [position, setPosition] = useState(null);
|
|
406
|
+
let deps = [
|
|
407
|
+
shouldUpdatePosition,
|
|
408
|
+
placement,
|
|
409
|
+
overlayRef.current,
|
|
410
|
+
targetRef.current,
|
|
411
|
+
scrollRef.current,
|
|
412
|
+
containerPadding,
|
|
413
|
+
shouldFlip,
|
|
414
|
+
boundaryElement,
|
|
415
|
+
offset,
|
|
416
|
+
crossOffset,
|
|
417
|
+
isOpen,
|
|
418
|
+
direction,
|
|
419
|
+
maxHeight,
|
|
420
|
+
arrowBoundaryOffset,
|
|
421
|
+
arrowSize
|
|
422
|
+
];
|
|
423
|
+
let lastScale = useRef($2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.scale);
|
|
424
|
+
useEffect(() => {
|
|
425
|
+
if (isOpen) lastScale.current = $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.scale;
|
|
426
|
+
}, [
|
|
427
|
+
isOpen
|
|
428
|
+
]);
|
|
429
|
+
let updatePosition = useCallback(() => {
|
|
430
|
+
if (shouldUpdatePosition === false || !isOpen || !overlayRef.current || !targetRef.current || !boundaryElement) return;
|
|
431
|
+
if (($2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.scale) !== lastScale.current) return;
|
|
432
|
+
let anchor = null;
|
|
433
|
+
if (scrollRef.current && scrollRef.current.contains(document.activeElement)) {
|
|
434
|
+
var _document_activeElement;
|
|
435
|
+
let anchorRect = (_document_activeElement = document.activeElement) === null || _document_activeElement === void 0 ? void 0 : _document_activeElement.getBoundingClientRect();
|
|
436
|
+
let scrollRect = scrollRef.current.getBoundingClientRect();
|
|
437
|
+
var _anchorRect_top;
|
|
438
|
+
anchor = {
|
|
439
|
+
type: "top",
|
|
440
|
+
offset: ((_anchorRect_top = anchorRect === null || anchorRect === void 0 ? void 0 : anchorRect.top) !== null && _anchorRect_top !== void 0 ? _anchorRect_top : 0) - scrollRect.top
|
|
441
|
+
};
|
|
442
|
+
if (anchor.offset > scrollRect.height / 2) {
|
|
443
|
+
anchor.type = "bottom";
|
|
444
|
+
var _anchorRect_bottom;
|
|
445
|
+
anchor.offset = ((_anchorRect_bottom = anchorRect === null || anchorRect === void 0 ? void 0 : anchorRect.bottom) !== null && _anchorRect_bottom !== void 0 ? _anchorRect_bottom : 0) - scrollRect.bottom;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
let overlay = overlayRef.current;
|
|
449
|
+
if (!maxHeight && overlayRef.current) {
|
|
450
|
+
var _window_visualViewport;
|
|
451
|
+
overlay.style.top = "0px";
|
|
452
|
+
overlay.style.bottom = "";
|
|
453
|
+
var _window_visualViewport_height;
|
|
454
|
+
overlay.style.maxHeight = ((_window_visualViewport_height = (_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.height) !== null && _window_visualViewport_height !== void 0 ? _window_visualViewport_height : window.innerHeight) + "px";
|
|
455
|
+
}
|
|
456
|
+
let position2 = $edcf132a9284368a$export$b3ceb0cbf1056d98({
|
|
457
|
+
placement: $2a41e45df1593e64$var$translateRTL(placement, direction),
|
|
458
|
+
overlayNode: overlayRef.current,
|
|
459
|
+
targetNode: targetRef.current,
|
|
460
|
+
scrollNode: scrollRef.current || overlayRef.current,
|
|
461
|
+
padding: containerPadding,
|
|
462
|
+
shouldFlip,
|
|
463
|
+
boundaryElement,
|
|
464
|
+
offset,
|
|
465
|
+
crossOffset,
|
|
466
|
+
maxHeight,
|
|
467
|
+
arrowSize,
|
|
468
|
+
arrowBoundaryOffset
|
|
469
|
+
});
|
|
470
|
+
if (!position2.position) return;
|
|
471
|
+
overlay.style.top = "";
|
|
472
|
+
overlay.style.bottom = "";
|
|
473
|
+
overlay.style.left = "";
|
|
474
|
+
overlay.style.right = "";
|
|
475
|
+
Object.keys(position2.position).forEach((key) => overlay.style[key] = position2.position[key] + "px");
|
|
476
|
+
overlay.style.maxHeight = position2.maxHeight != null ? position2.maxHeight + "px" : "";
|
|
477
|
+
if (anchor && document.activeElement && scrollRef.current) {
|
|
478
|
+
let anchorRect = document.activeElement.getBoundingClientRect();
|
|
479
|
+
let scrollRect = scrollRef.current.getBoundingClientRect();
|
|
480
|
+
let newOffset = anchorRect[anchor.type] - scrollRect[anchor.type];
|
|
481
|
+
scrollRef.current.scrollTop += newOffset - anchor.offset;
|
|
482
|
+
}
|
|
483
|
+
setPosition(position2);
|
|
484
|
+
}, deps);
|
|
485
|
+
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(updatePosition, deps);
|
|
486
|
+
$2a41e45df1593e64$var$useResize(updatePosition);
|
|
487
|
+
$9daab02d461809db$export$683480f191c0e3ea({
|
|
488
|
+
ref: overlayRef,
|
|
489
|
+
onResize: updatePosition
|
|
490
|
+
});
|
|
491
|
+
$9daab02d461809db$export$683480f191c0e3ea({
|
|
492
|
+
ref: targetRef,
|
|
493
|
+
onResize: updatePosition
|
|
494
|
+
});
|
|
495
|
+
let isResizing = useRef(false);
|
|
496
|
+
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
497
|
+
let timeout;
|
|
498
|
+
let onResize = () => {
|
|
499
|
+
isResizing.current = true;
|
|
500
|
+
clearTimeout(timeout);
|
|
501
|
+
timeout = setTimeout(() => {
|
|
502
|
+
isResizing.current = false;
|
|
503
|
+
}, 500);
|
|
504
|
+
updatePosition();
|
|
505
|
+
};
|
|
506
|
+
let onScroll = () => {
|
|
507
|
+
if (isResizing.current) onResize();
|
|
508
|
+
};
|
|
509
|
+
$2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.addEventListener("resize", onResize);
|
|
510
|
+
$2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.addEventListener("scroll", onScroll);
|
|
511
|
+
return () => {
|
|
512
|
+
$2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.removeEventListener("resize", onResize);
|
|
513
|
+
$2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.removeEventListener("scroll", onScroll);
|
|
514
|
+
};
|
|
515
|
+
}, [
|
|
516
|
+
updatePosition
|
|
517
|
+
]);
|
|
518
|
+
let close = useCallback(() => {
|
|
519
|
+
if (!isResizing.current) onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
520
|
+
}, [
|
|
521
|
+
onClose,
|
|
522
|
+
isResizing
|
|
523
|
+
]);
|
|
524
|
+
$dd149f63282afbbf$export$18fc8428861184da({
|
|
525
|
+
triggerRef: targetRef,
|
|
526
|
+
isOpen,
|
|
527
|
+
onClose: onClose && close
|
|
528
|
+
});
|
|
529
|
+
var _position_maxHeight, _position_placement;
|
|
530
|
+
return {
|
|
531
|
+
overlayProps: {
|
|
532
|
+
style: {
|
|
533
|
+
position: "absolute",
|
|
534
|
+
zIndex: 1e5,
|
|
535
|
+
...position === null || position === void 0 ? void 0 : position.position,
|
|
536
|
+
maxHeight: (_position_maxHeight = position === null || position === void 0 ? void 0 : position.maxHeight) !== null && _position_maxHeight !== void 0 ? _position_maxHeight : "100vh"
|
|
537
|
+
}
|
|
538
|
+
},
|
|
539
|
+
placement: (_position_placement = position === null || position === void 0 ? void 0 : position.placement) !== null && _position_placement !== void 0 ? _position_placement : null,
|
|
540
|
+
arrowProps: {
|
|
541
|
+
"aria-hidden": "true",
|
|
542
|
+
role: "presentation",
|
|
543
|
+
style: {
|
|
544
|
+
left: position === null || position === void 0 ? void 0 : position.arrowOffsetLeft,
|
|
545
|
+
top: position === null || position === void 0 ? void 0 : position.arrowOffsetTop
|
|
546
|
+
}
|
|
547
|
+
},
|
|
548
|
+
updatePosition
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
function $2a41e45df1593e64$var$useResize(onResize) {
|
|
552
|
+
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
553
|
+
window.addEventListener("resize", onResize, false);
|
|
554
|
+
return () => {
|
|
555
|
+
window.removeEventListener("resize", onResize, false);
|
|
556
|
+
};
|
|
557
|
+
}, [
|
|
558
|
+
onResize
|
|
559
|
+
]);
|
|
560
|
+
}
|
|
561
|
+
function $2a41e45df1593e64$var$translateRTL(position, direction) {
|
|
562
|
+
if (direction === "rtl") return position.replace("start", "right").replace("end", "left");
|
|
563
|
+
return position.replace("start", "left").replace("end", "right");
|
|
564
|
+
}
|
|
565
|
+
const $96b38030c423d352$export$60d741e20e0aa309 = /* @__PURE__ */ createContext({});
|
|
566
|
+
function $96b38030c423d352$export$9fc1347d4195ccb3() {
|
|
567
|
+
var _useContext;
|
|
568
|
+
return (_useContext = useContext($96b38030c423d352$export$60d741e20e0aa309)) !== null && _useContext !== void 0 ? _useContext : {};
|
|
569
|
+
}
|
|
570
|
+
function $fc909762b330b746$export$61c6a8c84e605fb6(props) {
|
|
571
|
+
let [isOpen, setOpen] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(props.isOpen, props.defaultOpen || false, props.onOpenChange);
|
|
572
|
+
const open = useCallback(() => {
|
|
573
|
+
setOpen(true);
|
|
574
|
+
}, [
|
|
575
|
+
setOpen
|
|
576
|
+
]);
|
|
577
|
+
const close = useCallback(() => {
|
|
578
|
+
setOpen(false);
|
|
579
|
+
}, [
|
|
580
|
+
setOpen
|
|
581
|
+
]);
|
|
582
|
+
const toggle = useCallback(() => {
|
|
583
|
+
setOpen(!isOpen);
|
|
584
|
+
}, [
|
|
585
|
+
setOpen,
|
|
586
|
+
isOpen
|
|
587
|
+
]);
|
|
588
|
+
return {
|
|
589
|
+
isOpen,
|
|
590
|
+
setOpen,
|
|
591
|
+
open,
|
|
592
|
+
close,
|
|
593
|
+
toggle
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
const $44f671af83e7d9e0$export$2de4954e8ae13b9f = /* @__PURE__ */ createContext({
|
|
597
|
+
placement: "bottom"
|
|
598
|
+
});
|
|
599
|
+
const $44f671af83e7d9e0$export$746d02f47f4d381 = /* @__PURE__ */ forwardRef(function OverlayArrow(props, ref) {
|
|
600
|
+
[props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $44f671af83e7d9e0$export$2de4954e8ae13b9f);
|
|
601
|
+
let placement = props.placement;
|
|
602
|
+
let style = {
|
|
603
|
+
position: "absolute",
|
|
604
|
+
transform: placement === "top" || placement === "bottom" ? "translateX(-50%)" : "translateY(-50%)"
|
|
605
|
+
};
|
|
606
|
+
if (placement != null) style[placement] = "100%";
|
|
607
|
+
let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
|
|
608
|
+
...props,
|
|
609
|
+
defaultClassName: "react-aria-OverlayArrow",
|
|
610
|
+
values: {
|
|
611
|
+
placement
|
|
612
|
+
}
|
|
613
|
+
});
|
|
614
|
+
if (renderProps.style) Object.keys(renderProps.style).forEach((key) => renderProps.style[key] === void 0 && delete renderProps.style[key]);
|
|
615
|
+
let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
|
|
616
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
617
|
+
...DOMProps,
|
|
618
|
+
...renderProps,
|
|
619
|
+
style: {
|
|
620
|
+
...style,
|
|
621
|
+
...renderProps.style
|
|
622
|
+
},
|
|
623
|
+
ref,
|
|
624
|
+
"data-placement": placement
|
|
625
|
+
});
|
|
626
|
+
});
|
|
627
|
+
export {
|
|
628
|
+
$fc909762b330b746$export$61c6a8c84e605fb6 as $,
|
|
629
|
+
$d3f049242431219c$export$45fda7c47f93fd48 as a,
|
|
630
|
+
$d3f049242431219c$export$6d3443f2c48bfc20 as b,
|
|
631
|
+
$96b38030c423d352$export$9fc1347d4195ccb3 as c,
|
|
632
|
+
$2a41e45df1593e64$export$d39e1813b3bdd0e1 as d,
|
|
633
|
+
$44f671af83e7d9e0$export$2de4954e8ae13b9f as e,
|
|
634
|
+
$44f671af83e7d9e0$export$746d02f47f4d381 as f,
|
|
635
|
+
$9daab02d461809db$export$683480f191c0e3ea as g,
|
|
636
|
+
$dd149f63282afbbf$export$f6211563215e3b37 as h
|
|
637
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
const $4e85f108e88277b8$export$b085522c77523c51 = createContext(null);
|
|
3
|
+
const $4e85f108e88277b8$export$ebe63fadcdce34ed = createContext(null);
|
|
4
|
+
const $4e85f108e88277b8$export$44644b8a16031b5b = createContext(null);
|
|
5
|
+
const $4e85f108e88277b8$export$717b2c0a523a0b53 = createContext(null);
|
|
6
|
+
createContext(null);
|
|
7
|
+
const $4e85f108e88277b8$export$d688439359537581 = createContext({});
|
|
8
|
+
export {
|
|
9
|
+
$4e85f108e88277b8$export$d688439359537581 as $,
|
|
10
|
+
$4e85f108e88277b8$export$b085522c77523c51 as a,
|
|
11
|
+
$4e85f108e88277b8$export$ebe63fadcdce34ed as b,
|
|
12
|
+
$4e85f108e88277b8$export$44644b8a16031b5b as c,
|
|
13
|
+
$4e85f108e88277b8$export$717b2c0a523a0b53 as d
|
|
14
|
+
};
|