@wix/editor-react-components 1.2775.0 → 1.2777.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/dist/site/components/AudioPlayer/component.js +5 -4
- package/dist/site/components/Breadcrumbs/component.js +1 -1
- package/dist/site/components/Button/component.js +1 -1
- package/dist/site/components/Checkbox/component.js +1 -1
- package/dist/site/components/CheckboxGroup/component.js +1 -1
- package/dist/site/components/CollapsibleText/component.js +1 -1
- package/dist/site/components/DatePicker/component.js +622 -7
- package/dist/site/components/Lottie/component.js +1 -1
- package/dist/site/components/Menu/component.js +1 -1
- package/dist/site/components/RadioButtons/component.js +1 -1
- package/dist/site/components/Slideshow/component.js +1 -1
- package/dist/site/components/TextBox/component.js +1 -1
- package/dist/site/components/TextInput/component.js +3 -2
- package/dist/site/components/TextMarquee/component.js +6 -6
- package/dist/site/components/TimePicker/TimePicker.types.d.ts +14 -39
- package/dist/site/components/TimePicker/component.js +81 -547
- package/dist/site/components/TimePicker/component.preview.d.ts +7 -2
- package/dist/site/components/TimePicker/components/TimePickerField.d.ts +1 -2
- package/dist/site/components/TimePicker/constants.d.ts +35 -68
- package/dist/site/components/TimePicker/css.css +17 -169
- package/dist/site/components/TimePicker/hooks/useTimePickerValue.d.ts +3 -5
- package/dist/site/components/TimePicker/manifest.js +246 -152
- package/dist/site/components/TimePicker/timePickerUtils.d.ts +8 -8
- package/dist/site/components/chunks/Button.js +466 -1055
- package/dist/site/components/chunks/Button2.js +284 -471
- package/dist/site/components/chunks/DateField.js +51 -673
- package/dist/site/components/chunks/Group.js +46 -160
- package/dist/site/components/chunks/I18nProvider.js +1 -1
- package/dist/site/components/chunks/Input.js +2 -2
- package/dist/site/components/chunks/constants2.js +40 -70
- package/dist/site/components/chunks/filterDOMProps.js +13 -13
- package/dist/site/components/chunks/useFocusable.js +70 -0
- package/dist/site/components/chunks/usePress.js +825 -0
- package/package.json +2 -2
- package/dist/site/components/TimePicker/hooks/useTimeConstraints.d.ts +0 -8
- package/dist/site/components/chunks/VisuallyHidden.js +0 -47
- package/dist/site/components/chunks/{RequiredIndicator.js → useValidatedField.js} +19 -19
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import React__default, { createContext, useEffect, useMemo, useRef,
|
|
3
|
+
import React__default, { createContext, useEffect, useState, useCallback, useMemo, useRef, useContext, forwardRef } from "react";
|
|
4
4
|
import { c as clsx } from "../chunks/clsx.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { $ as $ea3928288112382f$export$439d29a4e110a164, a as $240e9101ba2842f5$export$7d15b64cf5a3a4c4, b as $d2b4bc8c273e7be6$export$24d547caef80ccd1, c as $ea3928288112382f$export$a966af930f325cab, d as $d2b4bc8c273e7be6$export$353f5b6fc5456de1 } from "../chunks/Button2.js";
|
|
6
|
+
import { l as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, $ as $8e9d2fae0ecb9001$export$457c3d6518dd4c6f, k as $c7eafbbe1ea5834e$export$535bd6ca7f90a273, b as $64fa3d84918910a7$export$29f1550f4b0d4415, f as $64fa3d84918910a7$export$4d86445c2cf5e3, g as $65484d02dcb7eb3e$export$457c3d6518dd4c6f, h as $64fa3d84918910a7$export$2881499e37b75b9a, c as $64fa3d84918910a7$export$fabf2dc03a41866e, m as $f39a9eba43920ace$export$b5d7cc18bb8d2b59, n as $3ef42575df84b30b$export$9d1611c77c2fe928, o as $64fa3d84918910a7$export$c62b8e45d58ddad9, d as $64fa3d84918910a7$export$9d4c57ee4c6ffdd8, e as $64fa3d84918910a7$export$ef03459518577ad4 } from "../chunks/filterDOMProps.js";
|
|
7
7
|
import { c as $191c9b6d48a0a4e2$export$294aa081a6c6f55d, j as $fd2148440a13ec26$export$a763b9476acd3eb, b as $fd2148440a13ec26$export$fc1a364ae1f3ff10, g as $514c0188e459b4c0$export$9afb8bc826b033ea, e as $d3e0e05bdfcf66bd$export$c24727297075ec6a, h as $ee014567cb39d3f0$export$ff05c3ac10437e03, $ as $514c0188e459b4c0$export$5f1af8db9871e1d6, a as $ee014567cb39d3f0$export$f551688fc98f2e09 } from "../chunks/Input.js";
|
|
8
|
-
import {
|
|
8
|
+
import { d as $60f33508b4cd9d3b$export$85fd5fdf27bacc79, e as $ad063034c8620db8$export$ea39ec197993aef0, f as $ad063034c8620db8$export$a5a3b454ada2268e, g as $ad063034c8620db8$export$a2258d9c4118825c, h as $a46cf152bb926da5$export$a9b970dcc4ae71a9, i as $9c268ab73a5d55e5$export$722debc0e56fea39, j as $ad063034c8620db8$export$91b62ebf2ba703ee, k as $ad063034c8620db8$export$629b0a497aa65267, l as $121970af65029459$export$f8aeda7b10753fa1, m as $51a3e22a5186a962$export$c826860796309d1b, n as $3578607fe3d4b096$export$cfa2225e87938781, o as $ad063034c8620db8$export$42c81a444fbfb5d4, p as $ad063034c8620db8$export$d0bdf45af03a6ea3, q as $ad063034c8620db8$export$ccc1b2479e7dd654, r as $654b97e09f2a30c1$export$4d0f8be8b12a7ef6, s as $6a440d0e2d99dd46$export$4a931266a3838b86, t as $535772f9d2c1f38d$export$c5251b9e124bf29, u as $7541913c0284d84b$export$300019f83c56d282, v as $0014db39426443c5$exports, w as $535772f9d2c1f38d$export$20e40289641fbbb6, x as $535772f9d2c1f38d$export$1258395f99bf9cbf, y as $901761b40e390936$export$2bb74740c4e19def, z as $ad063034c8620db8$export$a75f2bff57811055, A as $d07e34cce18680fd$export$93522d1a439f3617, B as $ad063034c8620db8$export$5c333a116e949cdd, C as $ad063034c8620db8$export$f91e89d3d0406102, D as $12a3c853105e5a70$export$ad991b66133851cf, E as $d07e34cce18680fd$export$b4a036af3fc0b032, F as $ad063034c8620db8$export$dbc69fd56b53d5e, G as $ad063034c8620db8$export$2061056d06d7cdf7, H as $ad063034c8620db8$export$ef8b6d9133084f4e, I as $93635573935797de$export$80ee6245ec4f29ec, J as $8b141f2f71e88f85$export$2440da353cedad43, K as $8b141f2f71e88f85$export$f18627323ab57ac0, L as $8b141f2f71e88f85$export$7e319ea407e63bc0, M as $8b141f2f71e88f85$export$c5221a78ef73c5e9, N as $d07e34cce18680fd$export$b21e0b124e224484, O as $84102b64e5ca022f$export$dd0bbc9b26defe37, P as $ad063034c8620db8$export$a18c89cbd24170ff, Q as $58246871e4652552$export$588937bcd60ade55, R as $58246871e4652552$export$6b862160d295c8e, S as $40825cdb76e74f70$export$7b3e670c86da5fe8, a as $40825cdb76e74f70$export$7edc06cf1783b30f, b as $40825cdb76e74f70$export$336ab7fa954c4b5f } from "../chunks/DateField.js";
|
|
9
9
|
import { $ as $cf2482eff2eeeec2$export$f12b703ca79dfbb1 } from "../chunks/useLocalizedStringFormatter.js";
|
|
10
|
-
import {
|
|
10
|
+
import { t as $fe16bffc7a557bf0$export$7f54fc3180508a52, E as $390e54f620492c70$export$b4cc09c592e8fdb8, y as $e8ac3c3f5d4bae7f$export$d6875122194c7b44, d as $bbaa08b3cd72f041$export$9d1611c77c2fe928, K as $1969ac565cfec8d0$export$de79e2c695e052f3, s as $8f5a2122b0992be3$export$630ff653c5ada6a9, j as $23f2114a1b82827e$export$cd4e5573fbe2b576, e as $23f2114a1b82827e$export$e58f029f0fbfdb29, p as $d447af545b77c9f1$export$f21a1ffae260145a, h as $6a20a7989e6c817a$export$98658e8c59125e6a, i as $23f2114a1b82827e$export$4282f70798064fe0, k as $d447af545b77c9f1$export$b204af158042fbac, x as $390e54f620492c70$export$f680877a34711e37, w as $2c9edc598a03d523$export$420e68273165f4ec, o as $c4867b2f328c2698$export$e5c5a5f917a5871c, Q as $23f2114a1b82827e$export$b4f377a2b6254582, n as $f192c2f16961cbe0$export$80f3e147d781571c, u as $2add3ce32c6007eb$export$fedb369cb70207f1, O as $a4e76a5424781910$export$e08e3b67e392101e, R as $2add3ce32c6007eb$export$78551043582a6a98, b as $3e6197669829fe11$export$40bfa8c7b0832715, B as $e969f22b6713ca4a$export$ae780daf29e6d456, A as $0c4a58759813079a$export$4e328f61c538687f, g as $a049562f99e7db0e$export$f9c6924e160136d1, f as $01b77f81d0f07f68$export$75b6ee27786ba447, $ as $a049562f99e7db0e$export$eb2fcfdbd7ba97d4, a as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../chunks/Group.js";
|
|
11
|
+
import { a as $d27d541f9569d26d$export$45712eceda6fad21, b as $24f9a20f226ad820$export$5165eccb35aaadb5, c as $2b2d34ff061957fb$export$2b85b721e524d74b } from "../chunks/usePress.js";
|
|
11
12
|
import { a as $2eb8e6d23f3d0cb0$export$43bb16f9c6d9e3f7, $ as $2eb8e6d23f3d0cb0$export$a54013f0d02a8f82 } from "../chunks/I18nProvider.js";
|
|
12
|
-
import
|
|
13
|
-
import __rspack_external_react_dom_7136dc57__default from "react-dom";
|
|
13
|
+
import __rspack_external_react_dom_7136dc57__default, { flushSync } from "react-dom";
|
|
14
14
|
import { useService } from "@wix/services-manager-react";
|
|
15
15
|
import { E as EnvironmentDefinition } from "../chunks/index2.js";
|
|
16
16
|
import { T as TranslationsDefinition } from "../chunks/index4.js";
|
|
@@ -229,6 +229,66 @@ function $6a7db85432448f7f$export$60278871457622de(event) {
|
|
|
229
229
|
if ($c87311424ea30a05$export$a11b0059900ceec8() && event.pointerType) return event.type === "click" && event.buttons === 1;
|
|
230
230
|
return event.detail === 0 && !event.pointerType;
|
|
231
231
|
}
|
|
232
|
+
function $d3f049242431219c$export$6d3443f2c48bfc20(ref, isReady = true) {
|
|
233
|
+
let [isEntering, setEntering] = useState(true);
|
|
234
|
+
let isAnimationReady = isEntering && isReady;
|
|
235
|
+
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
236
|
+
if (isAnimationReady && ref.current && "getAnimations" in ref.current) {
|
|
237
|
+
for (let animation of ref.current.getAnimations()) if (animation instanceof CSSTransition) animation.cancel();
|
|
238
|
+
}
|
|
239
|
+
}, [
|
|
240
|
+
ref,
|
|
241
|
+
isAnimationReady
|
|
242
|
+
]);
|
|
243
|
+
$d3f049242431219c$var$useAnimation(ref, isAnimationReady, useCallback(() => setEntering(false), []));
|
|
244
|
+
return isAnimationReady;
|
|
245
|
+
}
|
|
246
|
+
function $d3f049242431219c$export$45fda7c47f93fd48(ref, isOpen) {
|
|
247
|
+
let [exitState, setExitState] = useState(isOpen ? "open" : "closed");
|
|
248
|
+
switch (exitState) {
|
|
249
|
+
case "open":
|
|
250
|
+
if (!isOpen) setExitState("exiting");
|
|
251
|
+
break;
|
|
252
|
+
case "closed":
|
|
253
|
+
case "exiting":
|
|
254
|
+
if (isOpen) setExitState("open");
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
let isExiting = exitState === "exiting";
|
|
258
|
+
$d3f049242431219c$var$useAnimation(ref, isExiting, useCallback(() => {
|
|
259
|
+
setExitState((state) => state === "exiting" ? "closed" : state);
|
|
260
|
+
}, []));
|
|
261
|
+
return isExiting;
|
|
262
|
+
}
|
|
263
|
+
function $d3f049242431219c$var$useAnimation(ref, isActive, onEnd) {
|
|
264
|
+
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
265
|
+
if (isActive && ref.current) {
|
|
266
|
+
if (!("getAnimations" in ref.current)) {
|
|
267
|
+
onEnd();
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
let animations = ref.current.getAnimations();
|
|
271
|
+
if (animations.length === 0) {
|
|
272
|
+
onEnd();
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
let canceled = false;
|
|
276
|
+
Promise.all(animations.map((a) => a.finished)).then(() => {
|
|
277
|
+
if (!canceled) flushSync(() => {
|
|
278
|
+
onEnd();
|
|
279
|
+
});
|
|
280
|
+
}).catch(() => {
|
|
281
|
+
});
|
|
282
|
+
return () => {
|
|
283
|
+
canceled = true;
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
}, [
|
|
287
|
+
ref,
|
|
288
|
+
isActive,
|
|
289
|
+
onEnd
|
|
290
|
+
]);
|
|
291
|
+
}
|
|
232
292
|
let $8a9cb279dc87e130$export$fda7da73ab5d4c48 = false;
|
|
233
293
|
let $507fabe10e71c6fb$var$currentModality = null;
|
|
234
294
|
let $507fabe10e71c6fb$var$changeHandlers = /* @__PURE__ */ new Set();
|
|
@@ -1599,6 +1659,28 @@ function $58196c8d6a1f38fc$export$1020fa7f77e17884(element) {
|
|
|
1599
1659
|
};
|
|
1600
1660
|
}
|
|
1601
1661
|
}
|
|
1662
|
+
const $22e2f5f6490788e8$export$f6211563215e3b37 = /* @__PURE__ */ new WeakMap();
|
|
1663
|
+
function $22e2f5f6490788e8$export$18fc8428861184da(opts) {
|
|
1664
|
+
let { triggerRef, isOpen, onClose } = opts;
|
|
1665
|
+
useEffect(() => {
|
|
1666
|
+
if (!isOpen || onClose === null) return;
|
|
1667
|
+
let onScroll = (e) => {
|
|
1668
|
+
let target = $23f2114a1b82827e$export$e58f029f0fbfdb29(e);
|
|
1669
|
+
if (!triggerRef.current || target instanceof Node && !$23f2114a1b82827e$export$4282f70798064fe0(target, triggerRef.current)) return;
|
|
1670
|
+
if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) return;
|
|
1671
|
+
let onCloseHandler = onClose || $22e2f5f6490788e8$export$f6211563215e3b37.get(triggerRef.current);
|
|
1672
|
+
if (onCloseHandler) onCloseHandler();
|
|
1673
|
+
};
|
|
1674
|
+
window.addEventListener("scroll", onScroll, true);
|
|
1675
|
+
return () => {
|
|
1676
|
+
window.removeEventListener("scroll", onScroll, true);
|
|
1677
|
+
};
|
|
1678
|
+
}, [
|
|
1679
|
+
isOpen,
|
|
1680
|
+
onClose,
|
|
1681
|
+
triggerRef
|
|
1682
|
+
]);
|
|
1683
|
+
}
|
|
1602
1684
|
function $parcel$interopDefault$1(a) {
|
|
1603
1685
|
return a && a.__esModule ? a.default : a;
|
|
1604
1686
|
}
|
|
@@ -1744,6 +1826,10 @@ function $0d47b37c475c5231$export$cf75428e0b9ed1ea({ children }) {
|
|
|
1744
1826
|
value: context
|
|
1745
1827
|
}, children);
|
|
1746
1828
|
}
|
|
1829
|
+
const $72abaeab4d80592f$export$60d741e20e0aa309 = /* @__PURE__ */ createContext({});
|
|
1830
|
+
function $72abaeab4d80592f$export$9fc1347d4195ccb3() {
|
|
1831
|
+
return useContext($72abaeab4d80592f$export$60d741e20e0aa309) ?? {};
|
|
1832
|
+
}
|
|
1747
1833
|
const $d7a937236970dc7f$export$a2200b96afd16271 = /* @__PURE__ */ React__default.createContext(null);
|
|
1748
1834
|
function $d7a937236970dc7f$export$c6fdb837b070b4ff(props) {
|
|
1749
1835
|
let isSSR = $c7eafbbe1ea5834e$export$535bd6ca7f90a273();
|
|
@@ -1905,6 +1991,37 @@ function $e260d131964da0f9$var$isValidEvent(event, ref) {
|
|
|
1905
1991
|
if (!ref.current) return false;
|
|
1906
1992
|
return !event.composedPath().includes(ref.current);
|
|
1907
1993
|
}
|
|
1994
|
+
function $970072cf4b13fde3$var$hasResizeObserver() {
|
|
1995
|
+
return typeof window.ResizeObserver !== "undefined";
|
|
1996
|
+
}
|
|
1997
|
+
function $970072cf4b13fde3$export$683480f191c0e3ea(options) {
|
|
1998
|
+
const { ref, box, onResize } = options;
|
|
1999
|
+
let onResizeEvent = $fe16bffc7a557bf0$export$7f54fc3180508a52(onResize);
|
|
2000
|
+
useEffect(() => {
|
|
2001
|
+
let element = ref == null ? void 0 : ref.current;
|
|
2002
|
+
if (!element) return;
|
|
2003
|
+
if (!$970072cf4b13fde3$var$hasResizeObserver()) {
|
|
2004
|
+
window.addEventListener("resize", onResizeEvent, false);
|
|
2005
|
+
return () => {
|
|
2006
|
+
window.removeEventListener("resize", onResizeEvent, false);
|
|
2007
|
+
};
|
|
2008
|
+
} else {
|
|
2009
|
+
const resizeObserverInstance = new window.ResizeObserver((entries) => {
|
|
2010
|
+
if (!entries.length) return;
|
|
2011
|
+
onResizeEvent();
|
|
2012
|
+
});
|
|
2013
|
+
resizeObserverInstance.observe(element, {
|
|
2014
|
+
box
|
|
2015
|
+
});
|
|
2016
|
+
return () => {
|
|
2017
|
+
if (element) resizeObserverInstance.unobserve(element);
|
|
2018
|
+
};
|
|
2019
|
+
}
|
|
2020
|
+
}, [
|
|
2021
|
+
ref,
|
|
2022
|
+
box
|
|
2023
|
+
]);
|
|
2024
|
+
}
|
|
1908
2025
|
var $e5024b484f7c3e21$exports = {};
|
|
1909
2026
|
$e5024b484f7c3e21$exports = {
|
|
1910
2027
|
"dismiss": `تجاهل`
|
|
@@ -2297,6 +2414,475 @@ function $0644e3663365bfe5$var$scrollIntoView(target) {
|
|
|
2297
2414
|
nextTarget = scrollable.parentElement;
|
|
2298
2415
|
}
|
|
2299
2416
|
}
|
|
2417
|
+
const $954926fb6168ae2a$var$AXIS = {
|
|
2418
|
+
top: "top",
|
|
2419
|
+
bottom: "top",
|
|
2420
|
+
left: "left",
|
|
2421
|
+
right: "left"
|
|
2422
|
+
};
|
|
2423
|
+
const $954926fb6168ae2a$var$FLIPPED_DIRECTION = {
|
|
2424
|
+
top: "bottom",
|
|
2425
|
+
bottom: "top",
|
|
2426
|
+
left: "right",
|
|
2427
|
+
right: "left"
|
|
2428
|
+
};
|
|
2429
|
+
const $954926fb6168ae2a$var$CROSS_AXIS = {
|
|
2430
|
+
top: "left",
|
|
2431
|
+
left: "top"
|
|
2432
|
+
};
|
|
2433
|
+
const $954926fb6168ae2a$var$AXIS_SIZE = {
|
|
2434
|
+
top: "height",
|
|
2435
|
+
left: "width"
|
|
2436
|
+
};
|
|
2437
|
+
const $954926fb6168ae2a$var$TOTAL_SIZE = {
|
|
2438
|
+
width: "totalWidth",
|
|
2439
|
+
height: "totalHeight"
|
|
2440
|
+
};
|
|
2441
|
+
const $954926fb6168ae2a$var$PARSED_PLACEMENT_CACHE = {};
|
|
2442
|
+
let $954926fb6168ae2a$var$getVisualViewport = () => typeof document !== "undefined" ? window.visualViewport : null;
|
|
2443
|
+
function $954926fb6168ae2a$var$getContainerDimensions(containerNode, visualViewport) {
|
|
2444
|
+
let width = 0, height = 0, totalWidth = 0, totalHeight = 0, top = 0, left = 0;
|
|
2445
|
+
let scroll = {};
|
|
2446
|
+
let isPinchZoomedIn = ((visualViewport == null ? void 0 : visualViewport.scale) ?? 1) > 1;
|
|
2447
|
+
if (containerNode.tagName === "BODY" || containerNode.tagName === "HTML") {
|
|
2448
|
+
let documentElement = document.documentElement;
|
|
2449
|
+
totalWidth = documentElement.clientWidth;
|
|
2450
|
+
totalHeight = documentElement.clientHeight;
|
|
2451
|
+
width = (visualViewport == null ? void 0 : visualViewport.width) ?? totalWidth;
|
|
2452
|
+
height = (visualViewport == null ? void 0 : visualViewport.height) ?? totalHeight;
|
|
2453
|
+
scroll.top = documentElement.scrollTop || containerNode.scrollTop;
|
|
2454
|
+
scroll.left = documentElement.scrollLeft || containerNode.scrollLeft;
|
|
2455
|
+
if (visualViewport) {
|
|
2456
|
+
top = visualViewport.offsetTop;
|
|
2457
|
+
left = visualViewport.offsetLeft;
|
|
2458
|
+
}
|
|
2459
|
+
} else {
|
|
2460
|
+
({ width, height, top, left } = $954926fb6168ae2a$var$getOffset(containerNode, false));
|
|
2461
|
+
scroll.top = containerNode.scrollTop;
|
|
2462
|
+
scroll.left = containerNode.scrollLeft;
|
|
2463
|
+
totalWidth = width;
|
|
2464
|
+
totalHeight = height;
|
|
2465
|
+
}
|
|
2466
|
+
if ($2add3ce32c6007eb$export$78551043582a6a98() && (containerNode.tagName === "BODY" || containerNode.tagName === "HTML") && isPinchZoomedIn) {
|
|
2467
|
+
scroll.top = 0;
|
|
2468
|
+
scroll.left = 0;
|
|
2469
|
+
top = (visualViewport == null ? void 0 : visualViewport.pageTop) ?? 0;
|
|
2470
|
+
left = (visualViewport == null ? void 0 : visualViewport.pageLeft) ?? 0;
|
|
2471
|
+
}
|
|
2472
|
+
return {
|
|
2473
|
+
width,
|
|
2474
|
+
height,
|
|
2475
|
+
totalWidth,
|
|
2476
|
+
totalHeight,
|
|
2477
|
+
scroll,
|
|
2478
|
+
top,
|
|
2479
|
+
left
|
|
2480
|
+
};
|
|
2481
|
+
}
|
|
2482
|
+
function $954926fb6168ae2a$var$getScroll(node) {
|
|
2483
|
+
return {
|
|
2484
|
+
top: node.scrollTop,
|
|
2485
|
+
left: node.scrollLeft,
|
|
2486
|
+
width: node.scrollWidth,
|
|
2487
|
+
height: node.scrollHeight
|
|
2488
|
+
};
|
|
2489
|
+
}
|
|
2490
|
+
function $954926fb6168ae2a$var$getDelta(axis, offset, size, boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary) {
|
|
2491
|
+
let containerScroll = containerDimensions.scroll[axis] ?? 0;
|
|
2492
|
+
let boundarySize = boundaryDimensions[$954926fb6168ae2a$var$AXIS_SIZE[axis]];
|
|
2493
|
+
let boundaryStartEdge = containerOffsetWithBoundary[axis] + boundaryDimensions.scroll[$954926fb6168ae2a$var$AXIS[axis]] + padding;
|
|
2494
|
+
let boundaryEndEdge = containerOffsetWithBoundary[axis] + boundaryDimensions.scroll[$954926fb6168ae2a$var$AXIS[axis]] + boundarySize - padding;
|
|
2495
|
+
let startEdgeOffset = offset - containerScroll + boundaryDimensions.scroll[$954926fb6168ae2a$var$AXIS[axis]] + containerOffsetWithBoundary[axis] - boundaryDimensions[$954926fb6168ae2a$var$AXIS[axis]];
|
|
2496
|
+
let endEdgeOffset = offset - containerScroll + size + boundaryDimensions.scroll[$954926fb6168ae2a$var$AXIS[axis]] + containerOffsetWithBoundary[axis] - boundaryDimensions[$954926fb6168ae2a$var$AXIS[axis]];
|
|
2497
|
+
if (startEdgeOffset < boundaryStartEdge) return boundaryStartEdge - startEdgeOffset;
|
|
2498
|
+
else if (endEdgeOffset > boundaryEndEdge) return Math.max(boundaryEndEdge - endEdgeOffset, boundaryStartEdge - startEdgeOffset);
|
|
2499
|
+
else return 0;
|
|
2500
|
+
}
|
|
2501
|
+
function $954926fb6168ae2a$var$getMargins(node) {
|
|
2502
|
+
let style = window.getComputedStyle(node);
|
|
2503
|
+
return {
|
|
2504
|
+
top: parseInt(style.marginTop, 10) || 0,
|
|
2505
|
+
bottom: parseInt(style.marginBottom, 10) || 0,
|
|
2506
|
+
left: parseInt(style.marginLeft, 10) || 0,
|
|
2507
|
+
right: parseInt(style.marginRight, 10) || 0
|
|
2508
|
+
};
|
|
2509
|
+
}
|
|
2510
|
+
function $954926fb6168ae2a$var$parsePlacement(input) {
|
|
2511
|
+
if ($954926fb6168ae2a$var$PARSED_PLACEMENT_CACHE[input]) return $954926fb6168ae2a$var$PARSED_PLACEMENT_CACHE[input];
|
|
2512
|
+
let [placement, crossPlacement] = input.split(" ");
|
|
2513
|
+
let axis = $954926fb6168ae2a$var$AXIS[placement] || "right";
|
|
2514
|
+
let crossAxis = $954926fb6168ae2a$var$CROSS_AXIS[axis];
|
|
2515
|
+
if (!$954926fb6168ae2a$var$AXIS[crossPlacement]) crossPlacement = "center";
|
|
2516
|
+
let size = $954926fb6168ae2a$var$AXIS_SIZE[axis];
|
|
2517
|
+
let crossSize = $954926fb6168ae2a$var$AXIS_SIZE[crossAxis];
|
|
2518
|
+
$954926fb6168ae2a$var$PARSED_PLACEMENT_CACHE[input] = {
|
|
2519
|
+
placement,
|
|
2520
|
+
crossPlacement,
|
|
2521
|
+
axis,
|
|
2522
|
+
crossAxis,
|
|
2523
|
+
size,
|
|
2524
|
+
crossSize
|
|
2525
|
+
};
|
|
2526
|
+
return $954926fb6168ae2a$var$PARSED_PLACEMENT_CACHE[input];
|
|
2527
|
+
}
|
|
2528
|
+
function $954926fb6168ae2a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset, containerDimensions) {
|
|
2529
|
+
let { placement, crossPlacement, axis, crossAxis, size, crossSize } = placementInfo;
|
|
2530
|
+
let position = {};
|
|
2531
|
+
position[crossAxis] = childOffset[crossAxis] ?? 0;
|
|
2532
|
+
if (crossPlacement === "center")
|
|
2533
|
+
position[crossAxis] += ((childOffset[crossSize] ?? 0) - (overlaySize[crossSize] ?? 0)) / 2;
|
|
2534
|
+
else if (crossPlacement !== crossAxis)
|
|
2535
|
+
position[crossAxis] += (childOffset[crossSize] ?? 0) - (overlaySize[crossSize] ?? 0);
|
|
2536
|
+
position[crossAxis] += crossOffset;
|
|
2537
|
+
const minPosition = childOffset[crossAxis] - overlaySize[crossSize] + arrowSize + arrowBoundaryOffset;
|
|
2538
|
+
const maxPosition = childOffset[crossAxis] + childOffset[crossSize] - arrowSize - arrowBoundaryOffset;
|
|
2539
|
+
position[crossAxis] = $240e9101ba2842f5$export$7d15b64cf5a3a4c4(position[crossAxis], minPosition, maxPosition);
|
|
2540
|
+
if (placement === axis) {
|
|
2541
|
+
let containerHeight = isContainerPositioned ? containerDimensions[size] : containerDimensions[$954926fb6168ae2a$var$TOTAL_SIZE[size]];
|
|
2542
|
+
position[$954926fb6168ae2a$var$FLIPPED_DIRECTION[axis]] = Math.floor(containerHeight - childOffset[axis] + offset);
|
|
2543
|
+
} else position[axis] = Math.floor(childOffset[axis] + childOffset[size] + offset);
|
|
2544
|
+
return position;
|
|
2545
|
+
}
|
|
2546
|
+
function $954926fb6168ae2a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlayHeight, heightGrowthDirection, containerDimensions, isContainerDescendentOfBoundary, visualViewport) {
|
|
2547
|
+
let overlayTop = (position.top != null ? position.top : containerDimensions[$954926fb6168ae2a$var$TOTAL_SIZE.height] - (position.bottom ?? 0) - overlayHeight) - (containerDimensions.scroll.top ?? 0);
|
|
2548
|
+
let boundaryToContainerTransformOffset = isContainerDescendentOfBoundary ? containerOffsetWithBoundary.top : 0;
|
|
2549
|
+
let boundingRect = {
|
|
2550
|
+
// This should be boundary top in container coord system vs viewport top in container coord system
|
|
2551
|
+
// For the viewport top, there are several cases
|
|
2552
|
+
// 1. pinchzoom case where we want the viewports offset top as top here
|
|
2553
|
+
// 2. case where container is offset from the boundary and is contained by the boundary. In this case the top we want here is NOT 0, we want to take boundary's top even though is is a negative number OR the visual viewport, whichever is more restrictive
|
|
2554
|
+
top: Math.max(boundaryDimensions.top + boundaryToContainerTransformOffset, ((visualViewport == null ? void 0 : visualViewport.offsetTop) ?? boundaryDimensions.top) + boundaryToContainerTransformOffset),
|
|
2555
|
+
bottom: Math.min(boundaryDimensions.top + boundaryDimensions.height + boundaryToContainerTransformOffset, ((visualViewport == null ? void 0 : visualViewport.offsetTop) ?? 0) + ((visualViewport == null ? void 0 : visualViewport.height) ?? 0))
|
|
2556
|
+
};
|
|
2557
|
+
let maxHeight = heightGrowthDirection !== "top" ? (
|
|
2558
|
+
// We want the distance between the top of the overlay to the bottom of the boundary
|
|
2559
|
+
Math.max(0, boundingRect.bottom - overlayTop - ((margins.top ?? 0) + (margins.bottom ?? 0) + padding))
|
|
2560
|
+
) : Math.max(0, overlayTop + overlayHeight - boundingRect.top - ((margins.top ?? 0) + (margins.bottom ?? 0) + padding));
|
|
2561
|
+
return maxHeight;
|
|
2562
|
+
}
|
|
2563
|
+
function $954926fb6168ae2a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding, placementInfo, containerDimensions, isContainerDescendentOfBoundary) {
|
|
2564
|
+
let { placement, axis, size } = placementInfo;
|
|
2565
|
+
if (placement === axis) return Math.max(0, childOffset[axis] - (containerDimensions.scroll[axis] ?? 0) - (boundaryDimensions[axis] + (isContainerDescendentOfBoundary ? containerOffsetWithBoundary[axis] : 0)) - (margins[axis] ?? 0) - margins[$954926fb6168ae2a$var$FLIPPED_DIRECTION[axis]] - padding);
|
|
2566
|
+
return Math.max(0, boundaryDimensions[size] + boundaryDimensions[axis] + (isContainerDescendentOfBoundary ? containerOffsetWithBoundary[axis] : 0) - childOffset[axis] - childOffset[size] + (containerDimensions.scroll[axis] ?? 0) - (margins[axis] ?? 0) - margins[$954926fb6168ae2a$var$FLIPPED_DIRECTION[axis]] - padding);
|
|
2567
|
+
}
|
|
2568
|
+
function $954926fb6168ae2a$export$6839422d1f33cee9(placementInput, childOffset, overlaySize, scrollSize, margins, padding, flip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, userSetMaxHeight, arrowSize, arrowBoundaryOffset, isContainerDescendentOfBoundary, visualViewport) {
|
|
2569
|
+
let placementInfo = $954926fb6168ae2a$var$parsePlacement(placementInput);
|
|
2570
|
+
let { size, crossAxis, crossSize, placement, crossPlacement } = placementInfo;
|
|
2571
|
+
let position = $954926fb6168ae2a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset, containerDimensions);
|
|
2572
|
+
let normalizedOffset = offset;
|
|
2573
|
+
let space = $954926fb6168ae2a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, placementInfo, containerDimensions, isContainerDescendentOfBoundary);
|
|
2574
|
+
if (flip && overlaySize[size] > space) {
|
|
2575
|
+
let flippedPlacementInfo = $954926fb6168ae2a$var$parsePlacement(`${$954926fb6168ae2a$var$FLIPPED_DIRECTION[placement]} ${crossPlacement}`);
|
|
2576
|
+
let flippedPosition = $954926fb6168ae2a$var$computePosition(childOffset, boundaryDimensions, overlaySize, flippedPlacementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset, containerDimensions);
|
|
2577
|
+
let flippedSpace = $954926fb6168ae2a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, flippedPlacementInfo, containerDimensions, isContainerDescendentOfBoundary);
|
|
2578
|
+
if (flippedSpace > space) {
|
|
2579
|
+
placementInfo = flippedPlacementInfo;
|
|
2580
|
+
position = flippedPosition;
|
|
2581
|
+
normalizedOffset = offset;
|
|
2582
|
+
}
|
|
2583
|
+
}
|
|
2584
|
+
let heightGrowthDirection = "bottom";
|
|
2585
|
+
if (placementInfo.axis === "top") {
|
|
2586
|
+
if (placementInfo.placement === "top") heightGrowthDirection = "top";
|
|
2587
|
+
else if (placementInfo.placement === "bottom") heightGrowthDirection = "bottom";
|
|
2588
|
+
} else if (placementInfo.crossAxis === "top") {
|
|
2589
|
+
if (placementInfo.crossPlacement === "top") heightGrowthDirection = "bottom";
|
|
2590
|
+
else if (placementInfo.crossPlacement === "bottom") heightGrowthDirection = "top";
|
|
2591
|
+
}
|
|
2592
|
+
let delta = $954926fb6168ae2a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
|
|
2593
|
+
position[crossAxis] += delta;
|
|
2594
|
+
let maxHeight = $954926fb6168ae2a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlaySize.height, heightGrowthDirection, containerDimensions, isContainerDescendentOfBoundary, visualViewport);
|
|
2595
|
+
if (userSetMaxHeight && userSetMaxHeight < maxHeight) maxHeight = userSetMaxHeight;
|
|
2596
|
+
overlaySize.height = Math.min(overlaySize.height, maxHeight);
|
|
2597
|
+
position = $954926fb6168ae2a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, normalizedOffset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset, containerDimensions);
|
|
2598
|
+
delta = $954926fb6168ae2a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
|
|
2599
|
+
position[crossAxis] += delta;
|
|
2600
|
+
let arrowPosition = {};
|
|
2601
|
+
let origin = childOffset[crossAxis] - position[crossAxis] - margins[$954926fb6168ae2a$var$AXIS[crossAxis]];
|
|
2602
|
+
let preferredArrowPosition = origin + 0.5 * childOffset[crossSize];
|
|
2603
|
+
const arrowMinPosition = arrowSize / 2 + arrowBoundaryOffset;
|
|
2604
|
+
const overlayMargin = $954926fb6168ae2a$var$AXIS[crossAxis] === "left" ? (margins.left ?? 0) + (margins.right ?? 0) : (margins.top ?? 0) + (margins.bottom ?? 0);
|
|
2605
|
+
const arrowMaxPosition = overlaySize[crossSize] - overlayMargin - arrowSize / 2 - arrowBoundaryOffset;
|
|
2606
|
+
const arrowOverlappingChildMinEdge = childOffset[crossAxis] + arrowSize / 2 - (position[crossAxis] + margins[$954926fb6168ae2a$var$AXIS[crossAxis]]);
|
|
2607
|
+
const arrowOverlappingChildMaxEdge = childOffset[crossAxis] + childOffset[crossSize] - arrowSize / 2 - (position[crossAxis] + margins[$954926fb6168ae2a$var$AXIS[crossAxis]]);
|
|
2608
|
+
const arrowPositionOverlappingChild = $240e9101ba2842f5$export$7d15b64cf5a3a4c4(preferredArrowPosition, arrowOverlappingChildMinEdge, arrowOverlappingChildMaxEdge);
|
|
2609
|
+
arrowPosition[crossAxis] = $240e9101ba2842f5$export$7d15b64cf5a3a4c4(arrowPositionOverlappingChild, arrowMinPosition, arrowMaxPosition);
|
|
2610
|
+
({ placement, crossPlacement } = placementInfo);
|
|
2611
|
+
if (arrowSize) origin = arrowPosition[crossAxis];
|
|
2612
|
+
else if (crossPlacement === "right") origin += childOffset[crossSize];
|
|
2613
|
+
else if (crossPlacement === "center") origin += childOffset[crossSize] / 2;
|
|
2614
|
+
let crossOrigin = placement === "left" || placement === "top" ? overlaySize[size] : 0;
|
|
2615
|
+
let triggerAnchorPoint = {
|
|
2616
|
+
x: placement === "top" || placement === "bottom" ? origin : crossOrigin,
|
|
2617
|
+
y: placement === "left" || placement === "right" ? origin : crossOrigin
|
|
2618
|
+
};
|
|
2619
|
+
return {
|
|
2620
|
+
position,
|
|
2621
|
+
maxHeight,
|
|
2622
|
+
arrowOffsetLeft: arrowPosition.left,
|
|
2623
|
+
arrowOffsetTop: arrowPosition.top,
|
|
2624
|
+
placement,
|
|
2625
|
+
triggerAnchorPoint
|
|
2626
|
+
};
|
|
2627
|
+
}
|
|
2628
|
+
function $954926fb6168ae2a$export$b3ceb0cbf1056d98(opts) {
|
|
2629
|
+
let { placement, targetNode, overlayNode, scrollNode, padding, shouldFlip, boundaryElement, offset, crossOffset, maxHeight, arrowSize = 0, arrowBoundaryOffset = 0 } = opts;
|
|
2630
|
+
let visualViewport = $954926fb6168ae2a$var$getVisualViewport();
|
|
2631
|
+
let container = overlayNode instanceof HTMLElement ? $954926fb6168ae2a$var$getContainingBlock(overlayNode) : document.documentElement;
|
|
2632
|
+
let isViewportContainer = container === document.documentElement;
|
|
2633
|
+
const containerPositionStyle = window.getComputedStyle(container).position;
|
|
2634
|
+
let isContainerPositioned = !!containerPositionStyle && containerPositionStyle !== "static";
|
|
2635
|
+
let childOffset = isViewportContainer ? $954926fb6168ae2a$var$getOffset(targetNode, false) : $954926fb6168ae2a$var$getPosition(targetNode, container, false);
|
|
2636
|
+
if (!isViewportContainer) {
|
|
2637
|
+
let { marginTop, marginLeft } = window.getComputedStyle(targetNode);
|
|
2638
|
+
childOffset.top += parseInt(marginTop, 10) || 0;
|
|
2639
|
+
childOffset.left += parseInt(marginLeft, 10) || 0;
|
|
2640
|
+
}
|
|
2641
|
+
let overlaySize = $954926fb6168ae2a$var$getOffset(overlayNode, true);
|
|
2642
|
+
let margins = $954926fb6168ae2a$var$getMargins(overlayNode);
|
|
2643
|
+
overlaySize.width += (margins.left ?? 0) + (margins.right ?? 0);
|
|
2644
|
+
overlaySize.height += (margins.top ?? 0) + (margins.bottom ?? 0);
|
|
2645
|
+
let scrollSize = $954926fb6168ae2a$var$getScroll(scrollNode);
|
|
2646
|
+
let boundaryDimensions = $954926fb6168ae2a$var$getContainerDimensions(boundaryElement, visualViewport);
|
|
2647
|
+
let containerDimensions = $954926fb6168ae2a$var$getContainerDimensions(container, visualViewport);
|
|
2648
|
+
let containerOffsetWithBoundary;
|
|
2649
|
+
if ((boundaryElement.tagName === "BODY" || boundaryElement.tagName === "HTML") && !isViewportContainer) {
|
|
2650
|
+
let containerRect = $954926fb6168ae2a$export$4b834cebd9e5cebe(container, false);
|
|
2651
|
+
containerOffsetWithBoundary = {
|
|
2652
|
+
top: -(containerRect.top - boundaryDimensions.top),
|
|
2653
|
+
left: -(containerRect.left - boundaryDimensions.left),
|
|
2654
|
+
width: 0,
|
|
2655
|
+
height: 0
|
|
2656
|
+
};
|
|
2657
|
+
} else if ((boundaryElement.tagName === "BODY" || boundaryElement.tagName === "HTML") && isViewportContainer)
|
|
2658
|
+
containerOffsetWithBoundary = {
|
|
2659
|
+
top: 0,
|
|
2660
|
+
left: 0,
|
|
2661
|
+
width: 0,
|
|
2662
|
+
height: 0
|
|
2663
|
+
};
|
|
2664
|
+
else
|
|
2665
|
+
containerOffsetWithBoundary = $954926fb6168ae2a$var$getPosition(boundaryElement, container, false);
|
|
2666
|
+
let isContainerDescendentOfBoundary = $23f2114a1b82827e$export$4282f70798064fe0(boundaryElement, container);
|
|
2667
|
+
return $954926fb6168ae2a$export$6839422d1f33cee9(placement, childOffset, overlaySize, scrollSize, margins, padding, shouldFlip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, maxHeight, arrowSize, arrowBoundaryOffset, isContainerDescendentOfBoundary, visualViewport);
|
|
2668
|
+
}
|
|
2669
|
+
function $954926fb6168ae2a$export$4b834cebd9e5cebe(node, ignoreScale) {
|
|
2670
|
+
let { top, left, width, height } = node.getBoundingClientRect();
|
|
2671
|
+
if (ignoreScale && node instanceof node.ownerDocument.defaultView.HTMLElement) {
|
|
2672
|
+
width = node.offsetWidth;
|
|
2673
|
+
height = node.offsetHeight;
|
|
2674
|
+
}
|
|
2675
|
+
return {
|
|
2676
|
+
top,
|
|
2677
|
+
left,
|
|
2678
|
+
width,
|
|
2679
|
+
height
|
|
2680
|
+
};
|
|
2681
|
+
}
|
|
2682
|
+
function $954926fb6168ae2a$var$getOffset(node, ignoreScale) {
|
|
2683
|
+
let { top, left, width, height } = $954926fb6168ae2a$export$4b834cebd9e5cebe(node, ignoreScale);
|
|
2684
|
+
let { scrollTop, scrollLeft, clientTop, clientLeft } = document.documentElement;
|
|
2685
|
+
return {
|
|
2686
|
+
top: top + scrollTop - clientTop,
|
|
2687
|
+
left: left + scrollLeft - clientLeft,
|
|
2688
|
+
width,
|
|
2689
|
+
height
|
|
2690
|
+
};
|
|
2691
|
+
}
|
|
2692
|
+
function $954926fb6168ae2a$var$getPosition(node, parent, ignoreScale) {
|
|
2693
|
+
let style = window.getComputedStyle(node);
|
|
2694
|
+
let offset;
|
|
2695
|
+
if (style.position === "fixed") offset = $954926fb6168ae2a$export$4b834cebd9e5cebe(node, ignoreScale);
|
|
2696
|
+
else {
|
|
2697
|
+
offset = $954926fb6168ae2a$var$getOffset(node, ignoreScale);
|
|
2698
|
+
let parentOffset = $954926fb6168ae2a$var$getOffset(parent, ignoreScale);
|
|
2699
|
+
let parentStyle = window.getComputedStyle(parent);
|
|
2700
|
+
parentOffset.top += (parseInt(parentStyle.borderTopWidth, 10) || 0) - parent.scrollTop;
|
|
2701
|
+
parentOffset.left += (parseInt(parentStyle.borderLeftWidth, 10) || 0) - parent.scrollLeft;
|
|
2702
|
+
offset.top -= parentOffset.top;
|
|
2703
|
+
offset.left -= parentOffset.left;
|
|
2704
|
+
}
|
|
2705
|
+
offset.top -= parseInt(style.marginTop, 10) || 0;
|
|
2706
|
+
offset.left -= parseInt(style.marginLeft, 10) || 0;
|
|
2707
|
+
return offset;
|
|
2708
|
+
}
|
|
2709
|
+
function $954926fb6168ae2a$var$getContainingBlock(node) {
|
|
2710
|
+
let offsetParent = node.offsetParent;
|
|
2711
|
+
if (offsetParent && offsetParent === document.body && window.getComputedStyle(offsetParent).position === "static" && !$954926fb6168ae2a$var$isContainingBlock(offsetParent)) offsetParent = document.documentElement;
|
|
2712
|
+
if (offsetParent == null) {
|
|
2713
|
+
offsetParent = node.parentElement;
|
|
2714
|
+
while (offsetParent && !$954926fb6168ae2a$var$isContainingBlock(offsetParent)) offsetParent = offsetParent.parentElement;
|
|
2715
|
+
}
|
|
2716
|
+
return offsetParent || document.documentElement;
|
|
2717
|
+
}
|
|
2718
|
+
function $954926fb6168ae2a$var$isContainingBlock(node) {
|
|
2719
|
+
let style = window.getComputedStyle(node);
|
|
2720
|
+
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";
|
|
2721
|
+
}
|
|
2722
|
+
let $b3526bc71400be8d$var$visualViewport = typeof document !== "undefined" ? window.visualViewport : null;
|
|
2723
|
+
function $b3526bc71400be8d$export$d39e1813b3bdd0e1(props) {
|
|
2724
|
+
let { direction } = $2eb8e6d23f3d0cb0$export$43bb16f9c6d9e3f7();
|
|
2725
|
+
let { arrowSize, targetRef, overlayRef, arrowRef, 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;
|
|
2726
|
+
let [position, setPosition] = useState(null);
|
|
2727
|
+
let deps = [
|
|
2728
|
+
shouldUpdatePosition,
|
|
2729
|
+
placement,
|
|
2730
|
+
overlayRef.current,
|
|
2731
|
+
targetRef.current,
|
|
2732
|
+
arrowRef == null ? void 0 : arrowRef.current,
|
|
2733
|
+
scrollRef.current,
|
|
2734
|
+
containerPadding,
|
|
2735
|
+
shouldFlip,
|
|
2736
|
+
boundaryElement,
|
|
2737
|
+
offset,
|
|
2738
|
+
crossOffset,
|
|
2739
|
+
isOpen,
|
|
2740
|
+
direction,
|
|
2741
|
+
maxHeight,
|
|
2742
|
+
arrowBoundaryOffset,
|
|
2743
|
+
arrowSize
|
|
2744
|
+
];
|
|
2745
|
+
let lastScale = useRef($b3526bc71400be8d$var$visualViewport == null ? void 0 : $b3526bc71400be8d$var$visualViewport.scale);
|
|
2746
|
+
useEffect(() => {
|
|
2747
|
+
if (isOpen) lastScale.current = $b3526bc71400be8d$var$visualViewport == null ? void 0 : $b3526bc71400be8d$var$visualViewport.scale;
|
|
2748
|
+
}, [
|
|
2749
|
+
isOpen
|
|
2750
|
+
]);
|
|
2751
|
+
let updatePosition = useCallback(() => {
|
|
2752
|
+
var _a, _b;
|
|
2753
|
+
if (shouldUpdatePosition === false || !isOpen || !overlayRef.current || !targetRef.current || !boundaryElement) return;
|
|
2754
|
+
if (($b3526bc71400be8d$var$visualViewport == null ? void 0 : $b3526bc71400be8d$var$visualViewport.scale) !== lastScale.current) return;
|
|
2755
|
+
let anchor = null;
|
|
2756
|
+
if (scrollRef.current && $23f2114a1b82827e$export$b4f377a2b6254582(scrollRef.current)) {
|
|
2757
|
+
let anchorRect = (_a = $23f2114a1b82827e$export$cd4e5573fbe2b576()) == null ? void 0 : _a.getBoundingClientRect();
|
|
2758
|
+
let scrollRect = scrollRef.current.getBoundingClientRect();
|
|
2759
|
+
anchor = {
|
|
2760
|
+
type: "top",
|
|
2761
|
+
offset: ((anchorRect == null ? void 0 : anchorRect.top) ?? 0) - scrollRect.top
|
|
2762
|
+
};
|
|
2763
|
+
if (anchor.offset > scrollRect.height / 2) {
|
|
2764
|
+
anchor.type = "bottom";
|
|
2765
|
+
anchor.offset = ((anchorRect == null ? void 0 : anchorRect.bottom) ?? 0) - scrollRect.bottom;
|
|
2766
|
+
}
|
|
2767
|
+
}
|
|
2768
|
+
let overlay = overlayRef.current;
|
|
2769
|
+
if (!maxHeight && overlayRef.current) {
|
|
2770
|
+
overlay.style.top = "0px";
|
|
2771
|
+
overlay.style.bottom = "";
|
|
2772
|
+
overlay.style.maxHeight = (((_b = window.visualViewport) == null ? void 0 : _b.height) ?? window.innerHeight) + "px";
|
|
2773
|
+
}
|
|
2774
|
+
let position2 = $954926fb6168ae2a$export$b3ceb0cbf1056d98({
|
|
2775
|
+
placement: $b3526bc71400be8d$var$translateRTL(placement, direction),
|
|
2776
|
+
overlayNode: overlayRef.current,
|
|
2777
|
+
targetNode: targetRef.current,
|
|
2778
|
+
scrollNode: scrollRef.current || overlayRef.current,
|
|
2779
|
+
padding: containerPadding,
|
|
2780
|
+
shouldFlip,
|
|
2781
|
+
boundaryElement,
|
|
2782
|
+
offset,
|
|
2783
|
+
crossOffset,
|
|
2784
|
+
maxHeight,
|
|
2785
|
+
arrowSize: arrowSize ?? ((arrowRef == null ? void 0 : arrowRef.current) ? $954926fb6168ae2a$export$4b834cebd9e5cebe(arrowRef.current, true).width : 0),
|
|
2786
|
+
arrowBoundaryOffset
|
|
2787
|
+
});
|
|
2788
|
+
if (!position2.position) return;
|
|
2789
|
+
overlay.style.top = "";
|
|
2790
|
+
overlay.style.bottom = "";
|
|
2791
|
+
overlay.style.left = "";
|
|
2792
|
+
overlay.style.right = "";
|
|
2793
|
+
Object.keys(position2.position).forEach((key) => overlay.style[key] = position2.position[key] + "px");
|
|
2794
|
+
overlay.style.maxHeight = position2.maxHeight != null ? position2.maxHeight + "px" : "";
|
|
2795
|
+
let activeElement = $23f2114a1b82827e$export$cd4e5573fbe2b576();
|
|
2796
|
+
if (anchor && activeElement && scrollRef.current) {
|
|
2797
|
+
let anchorRect = activeElement.getBoundingClientRect();
|
|
2798
|
+
let scrollRect = scrollRef.current.getBoundingClientRect();
|
|
2799
|
+
let newOffset = anchorRect[anchor.type] - scrollRect[anchor.type];
|
|
2800
|
+
scrollRef.current.scrollTop += newOffset - anchor.offset;
|
|
2801
|
+
}
|
|
2802
|
+
setPosition(position2);
|
|
2803
|
+
}, deps);
|
|
2804
|
+
$c4867b2f328c2698$export$e5c5a5f917a5871c(updatePosition, deps);
|
|
2805
|
+
$b3526bc71400be8d$var$useResize(updatePosition);
|
|
2806
|
+
$970072cf4b13fde3$export$683480f191c0e3ea({
|
|
2807
|
+
ref: overlayRef,
|
|
2808
|
+
onResize: updatePosition
|
|
2809
|
+
});
|
|
2810
|
+
$970072cf4b13fde3$export$683480f191c0e3ea({
|
|
2811
|
+
ref: targetRef,
|
|
2812
|
+
onResize: updatePosition
|
|
2813
|
+
});
|
|
2814
|
+
let isResizing = useRef(false);
|
|
2815
|
+
$c4867b2f328c2698$export$e5c5a5f917a5871c(() => {
|
|
2816
|
+
let timeout;
|
|
2817
|
+
let onResize = () => {
|
|
2818
|
+
isResizing.current = true;
|
|
2819
|
+
clearTimeout(timeout);
|
|
2820
|
+
timeout = setTimeout(() => {
|
|
2821
|
+
isResizing.current = false;
|
|
2822
|
+
}, 500);
|
|
2823
|
+
updatePosition();
|
|
2824
|
+
};
|
|
2825
|
+
let onScroll = () => {
|
|
2826
|
+
if (isResizing.current) onResize();
|
|
2827
|
+
};
|
|
2828
|
+
$b3526bc71400be8d$var$visualViewport == null ? void 0 : $b3526bc71400be8d$var$visualViewport.addEventListener("resize", onResize);
|
|
2829
|
+
$b3526bc71400be8d$var$visualViewport == null ? void 0 : $b3526bc71400be8d$var$visualViewport.addEventListener("scroll", onScroll);
|
|
2830
|
+
return () => {
|
|
2831
|
+
$b3526bc71400be8d$var$visualViewport == null ? void 0 : $b3526bc71400be8d$var$visualViewport.removeEventListener("resize", onResize);
|
|
2832
|
+
$b3526bc71400be8d$var$visualViewport == null ? void 0 : $b3526bc71400be8d$var$visualViewport.removeEventListener("scroll", onScroll);
|
|
2833
|
+
};
|
|
2834
|
+
}, [
|
|
2835
|
+
updatePosition
|
|
2836
|
+
]);
|
|
2837
|
+
let close = useCallback(() => {
|
|
2838
|
+
if (!isResizing.current) onClose == null ? void 0 : onClose();
|
|
2839
|
+
}, [
|
|
2840
|
+
onClose,
|
|
2841
|
+
isResizing
|
|
2842
|
+
]);
|
|
2843
|
+
$22e2f5f6490788e8$export$18fc8428861184da({
|
|
2844
|
+
triggerRef: targetRef,
|
|
2845
|
+
isOpen,
|
|
2846
|
+
onClose: onClose && close
|
|
2847
|
+
});
|
|
2848
|
+
return {
|
|
2849
|
+
overlayProps: {
|
|
2850
|
+
style: {
|
|
2851
|
+
position: position ? "absolute" : "fixed",
|
|
2852
|
+
top: !position ? 0 : void 0,
|
|
2853
|
+
left: !position ? 0 : void 0,
|
|
2854
|
+
zIndex: 1e5,
|
|
2855
|
+
...position == null ? void 0 : position.position,
|
|
2856
|
+
maxHeight: (position == null ? void 0 : position.maxHeight) ?? "100vh"
|
|
2857
|
+
}
|
|
2858
|
+
},
|
|
2859
|
+
placement: (position == null ? void 0 : position.placement) ?? null,
|
|
2860
|
+
triggerAnchorPoint: (position == null ? void 0 : position.triggerAnchorPoint) ?? null,
|
|
2861
|
+
arrowProps: {
|
|
2862
|
+
"aria-hidden": "true",
|
|
2863
|
+
role: "presentation",
|
|
2864
|
+
style: {
|
|
2865
|
+
left: position == null ? void 0 : position.arrowOffsetLeft,
|
|
2866
|
+
top: position == null ? void 0 : position.arrowOffsetTop
|
|
2867
|
+
}
|
|
2868
|
+
},
|
|
2869
|
+
updatePosition
|
|
2870
|
+
};
|
|
2871
|
+
}
|
|
2872
|
+
function $b3526bc71400be8d$var$useResize(onResize) {
|
|
2873
|
+
$c4867b2f328c2698$export$e5c5a5f917a5871c(() => {
|
|
2874
|
+
window.addEventListener("resize", onResize, false);
|
|
2875
|
+
return () => {
|
|
2876
|
+
window.removeEventListener("resize", onResize, false);
|
|
2877
|
+
};
|
|
2878
|
+
}, [
|
|
2879
|
+
onResize
|
|
2880
|
+
]);
|
|
2881
|
+
}
|
|
2882
|
+
function $b3526bc71400be8d$var$translateRTL(position, direction) {
|
|
2883
|
+
if (direction === "rtl") return position.replace("start", "right").replace("end", "left");
|
|
2884
|
+
return position.replace("start", "left").replace("end", "right");
|
|
2885
|
+
}
|
|
2300
2886
|
function $f8a024fbad3a5a2e$export$542a6fd13ac93354(props, state) {
|
|
2301
2887
|
let { triggerRef, popoverRef, groupRef, isNonModal, isKeyboardDismissDisabled, shouldCloseOnInteractOutside, ...otherProps } = props;
|
|
2302
2888
|
let isSubmenu = otherProps["trigger"] === "SubmenuTrigger";
|
|
@@ -2660,6 +3246,32 @@ function $ea0ea6e62ae0d7ca$var$unitDuration(duration) {
|
|
|
2660
3246
|
for (let key in duration) unit[key] = 1;
|
|
2661
3247
|
return unit;
|
|
2662
3248
|
}
|
|
3249
|
+
function $f11fb0bcf1b2687a$export$61c6a8c84e605fb6(props) {
|
|
3250
|
+
let [isOpen, setOpen] = $3e6197669829fe11$export$40bfa8c7b0832715(props.isOpen, props.defaultOpen || false, props.onOpenChange);
|
|
3251
|
+
const open = useCallback(() => {
|
|
3252
|
+
setOpen(true);
|
|
3253
|
+
}, [
|
|
3254
|
+
setOpen
|
|
3255
|
+
]);
|
|
3256
|
+
const close = useCallback(() => {
|
|
3257
|
+
setOpen(false);
|
|
3258
|
+
}, [
|
|
3259
|
+
setOpen
|
|
3260
|
+
]);
|
|
3261
|
+
const toggle = useCallback(() => {
|
|
3262
|
+
setOpen(!isOpen);
|
|
3263
|
+
}, [
|
|
3264
|
+
setOpen,
|
|
3265
|
+
isOpen
|
|
3266
|
+
]);
|
|
3267
|
+
return {
|
|
3268
|
+
isOpen,
|
|
3269
|
+
setOpen,
|
|
3270
|
+
open,
|
|
3271
|
+
close,
|
|
3272
|
+
toggle
|
|
3273
|
+
};
|
|
3274
|
+
}
|
|
2663
3275
|
function $28aae683a942e141$export$87194bb378cc3ac2(props) {
|
|
2664
3276
|
let overlayState = $f11fb0bcf1b2687a$export$61c6a8c84e605fb6(props);
|
|
2665
3277
|
let [value, setValue] = $3e6197669829fe11$export$40bfa8c7b0832715(props.value, props.defaultValue || null, props.onChange);
|
|
@@ -2994,6 +3606,9 @@ const $dfd62f934fc76fed$export$5d847498420df57b = /* @__PURE__ */ forwardRef(fun
|
|
|
2994
3606
|
ref: buttonRef
|
|
2995
3607
|
}));
|
|
2996
3608
|
});
|
|
3609
|
+
const $44f671af83e7d9e0$export$2de4954e8ae13b9f = /* @__PURE__ */ createContext({
|
|
3610
|
+
placement: "bottom"
|
|
3611
|
+
});
|
|
2997
3612
|
const $07b14b47974efb58$export$9b9a0cd73afb7ca4 = /* @__PURE__ */ createContext(null);
|
|
2998
3613
|
const $07b14b47974efb58$var$PopoverGroupContext = /* @__PURE__ */ createContext(null);
|
|
2999
3614
|
const $07b14b47974efb58$export$5b6b19405a83ff9d = /* @__PURE__ */ forwardRef(function Popover(props, ref) {
|