@ariakit/react 0.4.25 → 0.4.27
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/CHANGELOG.md +31 -0
- package/cjs/__chunks/2HXQHKBC.cjs +59 -0
- package/cjs/__chunks/2MDC3Z3V.cjs +43 -0
- package/cjs/__chunks/334WKW6I.cjs +19 -0
- package/cjs/__chunks/34UJGLOZ.cjs +236 -0
- package/cjs/__chunks/3FIXGHZ2.cjs +59 -0
- package/cjs/__chunks/4RKQMGBK.cjs +1179 -0
- package/cjs/__chunks/5NTEPQ2U.cjs +148 -0
- package/cjs/__chunks/66G6K4UR.cjs +1 -0
- package/cjs/__chunks/6GNM57O7.cjs +1 -0
- package/cjs/__chunks/7M4GY5DS.cjs +255 -0
- package/cjs/__chunks/7MXJT4IN.cjs +17 -0
- package/cjs/__chunks/7POA4244.cjs +184 -0
- package/cjs/__chunks/ASOIXRUN.cjs +305 -0
- package/cjs/__chunks/C4NVIV6V.cjs +455 -0
- package/cjs/__chunks/CR6AS7WL.cjs +1 -0
- package/cjs/__chunks/D4HCGWOU.cjs +464 -0
- package/cjs/__chunks/DVWS2XPY.cjs +107 -0
- package/cjs/__chunks/DWSXHZYM.cjs +20 -0
- package/cjs/__chunks/E6EV2Q5P.cjs +1 -0
- package/cjs/__chunks/FELYQPO5.cjs +1025 -0
- package/cjs/__chunks/FHQ5DVYQ.cjs +34 -0
- package/cjs/__chunks/FIPBE5IX.cjs +23 -0
- package/cjs/__chunks/FVIS5BFZ.cjs +41 -0
- package/cjs/__chunks/GUB6WHB6.cjs +51 -0
- package/cjs/__chunks/GUY4MKX2.cjs +56 -0
- package/cjs/__chunks/IF5DZKAR.cjs +1 -0
- package/cjs/__chunks/IFZV5LA3.cjs +94 -0
- package/cjs/__chunks/IHVFJGGN.cjs +32 -0
- package/cjs/__chunks/L2IFVMDU.cjs +96 -0
- package/cjs/__chunks/LCX235VJ.cjs +53 -0
- package/cjs/__chunks/LMCBLO3G.cjs +42 -0
- package/cjs/__chunks/LS5VO6AA.cjs +44 -0
- package/cjs/__chunks/LVHC4DSB.cjs +117 -0
- package/cjs/__chunks/MN5TONXW.cjs +123 -0
- package/cjs/__chunks/N3DLR7OL.cjs +34 -0
- package/cjs/__chunks/NFZWL7LE.cjs +24 -0
- package/cjs/__chunks/NG34QRI6.cjs +264 -0
- package/cjs/__chunks/NIOJG7C4.cjs +1 -0
- package/cjs/__chunks/NMUCJYMR.cjs +496 -0
- package/cjs/__chunks/OOFUBC32.cjs +109 -0
- package/cjs/__chunks/OQRQJNBU.cjs +1 -0
- package/cjs/__chunks/PDPE2VAZ.cjs +1035 -0
- package/cjs/__chunks/PTE2IJM5.cjs +143 -0
- package/cjs/__chunks/PU63IQFD.cjs +447 -0
- package/cjs/__chunks/PZXRBFZF.cjs +38 -0
- package/cjs/__chunks/QAUJZR6Y.cjs +996 -0
- package/cjs/__chunks/QYDAT3QF.cjs +1 -0
- package/cjs/__chunks/QYLMYWKV.cjs +1 -0
- package/cjs/__chunks/RGH2H3WL.cjs +34 -0
- package/cjs/__chunks/RLKC7JVT.cjs +19 -0
- package/cjs/__chunks/RR46KI45.cjs +17 -0
- package/cjs/__chunks/RVXPEX7O.cjs +150 -0
- package/cjs/__chunks/RXZPZPJX.cjs +95 -0
- package/cjs/__chunks/SIF7IN4L.cjs +62 -0
- package/cjs/__chunks/SQ72MZ63.cjs +294 -0
- package/cjs/__chunks/SXAPGTJ4.cjs +23 -0
- package/cjs/__chunks/TLUFYZC7.cjs +37 -0
- package/cjs/__chunks/TSBEWPNT.cjs +1922 -0
- package/cjs/__chunks/U2UYQT45.cjs +1 -0
- package/cjs/__chunks/UUEFM3TG.cjs +75 -0
- package/cjs/__chunks/UV7CXZEM.cjs +36 -0
- package/cjs/__chunks/VXDLN5CP.cjs +234 -0
- package/cjs/__chunks/VXUZM542.cjs +789 -0
- package/cjs/__chunks/W27WRDUB.cjs +1 -0
- package/cjs/__chunks/X4U3XKYQ.cjs +7 -0
- package/cjs/__chunks/XH4GE3VE.cjs +29 -0
- package/cjs/__chunks/XPQIHUQ7.cjs +172 -0
- package/cjs/__chunks/YEXJT4IL.cjs +55 -0
- package/cjs/__chunks/Z5PDS46M.cjs +975 -0
- package/cjs/__chunks/ZNW2LLWJ.cjs +108 -0
- package/cjs/__chunks/ZYPARRXG.cjs +19 -0
- package/cjs/button.cjs +7 -3
- package/cjs/button.d.cts +2 -2
- package/cjs/button.d.ts +2 -2
- package/cjs/checkbox.cjs +11 -2
- package/cjs/checkbox.d.cts +9 -9
- package/cjs/checkbox.d.ts +9 -9
- package/cjs/collection.cjs +8 -2
- package/cjs/collection.d.cts +9 -9
- package/cjs/collection.d.ts +9 -9
- package/cjs/combobox.cjs +33 -2
- package/cjs/combobox.d.cts +33 -33
- package/cjs/combobox.d.ts +33 -33
- package/cjs/command.cjs +6 -3
- package/cjs/command.d.cts +2 -2
- package/cjs/command.d.ts +2 -2
- package/cjs/composite.cjs +24 -2
- package/cjs/composite.d.cts +21 -21
- package/cjs/composite.d.ts +21 -21
- package/cjs/dialog.cjs +24 -2
- package/cjs/dialog.d.cts +15 -15
- package/cjs/dialog.d.ts +15 -15
- package/cjs/disclosure.cjs +11 -2
- package/cjs/disclosure.d.cts +9 -9
- package/cjs/disclosure.d.ts +9 -9
- package/cjs/focus-trap.cjs +6 -2
- package/cjs/focus-trap.d.cts +4 -4
- package/cjs/focus-trap.d.ts +4 -4
- package/cjs/focusable.cjs +5 -3
- package/cjs/focusable.d.cts +2 -2
- package/cjs/focusable.d.ts +2 -2
- package/cjs/form.cjs +15 -2
- package/cjs/form.d.cts +37 -37
- package/cjs/form.d.ts +37 -37
- package/cjs/group.cjs +5 -3
- package/cjs/group.d.cts +4 -4
- package/cjs/group.d.ts +4 -4
- package/cjs/heading.cjs +7 -3
- package/cjs/heading.d.cts +4 -4
- package/cjs/heading.d.ts +4 -4
- package/cjs/hovercard.cjs +28 -2
- package/cjs/hovercard.d.cts +19 -19
- package/cjs/hovercard.d.ts +19 -19
- package/cjs/index.cjs +103 -28
- package/cjs/menu.cjs +44 -2
- package/cjs/menu.d.cts +41 -41
- package/cjs/menu.d.ts +41 -41
- package/cjs/menubar.cjs +10 -3
- package/cjs/menubar.d.cts +7 -7
- package/cjs/menubar.d.ts +7 -7
- package/cjs/popover.cjs +33 -2
- package/cjs/popover.d.cts +21 -21
- package/cjs/popover.d.ts +21 -21
- package/cjs/portal.cjs +7 -3
- package/cjs/portal.d.cts +3 -3
- package/cjs/portal.d.ts +3 -3
- package/cjs/radio.cjs +13 -2
- package/cjs/radio.d.cts +9 -9
- package/cjs/radio.d.ts +9 -9
- package/cjs/role.cjs +5 -3
- package/cjs/role.d.cts +2 -2
- package/cjs/role.d.ts +2 -2
- package/cjs/select.cjs +39 -2
- package/cjs/select.d.cts +33 -33
- package/cjs/select.d.ts +33 -33
- package/cjs/separator.cjs +5 -3
- package/cjs/separator.d.cts +2 -2
- package/cjs/separator.d.ts +2 -2
- package/cjs/store.cjs +5 -3
- package/cjs/store.d.cts +1 -1
- package/cjs/store.d.ts +1 -1
- package/cjs/tab.cjs +15 -2
- package/cjs/tab.d.cts +11 -11
- package/cjs/tab.d.ts +11 -11
- package/cjs/toolbar.cjs +13 -2
- package/cjs/toolbar.d.cts +15 -15
- package/cjs/toolbar.d.ts +15 -15
- package/cjs/tooltip.cjs +16 -2
- package/cjs/tooltip.d.cts +11 -11
- package/cjs/tooltip.d.ts +11 -11
- package/cjs/visually-hidden.cjs +5 -3
- package/cjs/visually-hidden.d.cts +2 -2
- package/cjs/visually-hidden.d.ts +2 -2
- package/esm/__chunks/2RKMXQTW.js +10 -0
- package/esm/__chunks/3Y4V2DTP.js +8 -0
- package/esm/__chunks/5FGJT4YF.js +10 -0
- package/esm/__chunks/ASWYYI35.js +26 -0
- package/esm/__chunks/BCX2X2B5.js +40 -0
- package/esm/__chunks/BLUBZ7NO.js +28 -0
- package/esm/__chunks/CKEWLSMJ.js +8 -0
- package/esm/__chunks/CSCX5ZBZ.js +40 -0
- package/esm/__chunks/CTJDBGJU.js +18 -0
- package/esm/__chunks/DAO5N24L.js +16 -0
- package/esm/__chunks/E3G6CWS6.js +16 -0
- package/esm/__chunks/IVVNCX6W.js +16 -0
- package/esm/__chunks/LQB76ROL.js +16 -0
- package/esm/__chunks/MALDUIAO.js +28 -0
- package/esm/__chunks/MP5ILXF3.js +14 -0
- package/esm/__chunks/O3FPWSHV.js +10 -0
- package/esm/__chunks/OKEWM6H4.js +10 -0
- package/esm/__chunks/QL3WKMBE.js +8 -0
- package/esm/__chunks/RD2DI27Y.js +44 -0
- package/esm/__chunks/SB7MN4B3.js +22 -0
- package/esm/__chunks/UA4GRLAL.js +52 -0
- package/esm/__chunks/UBB5N3OM.js +22 -0
- package/esm/__chunks/WC6KFHZH.js +8 -0
- package/esm/__chunks/WFREFNZD.js +8 -0
- package/esm/__chunks/WH35KJXV.js +8 -0
- package/esm/__chunks/WQKZESWL.js +18 -0
- package/esm/__chunks/YAS6EMRP.js +8 -0
- package/esm/button.d.ts +2 -2
- package/esm/button.js +1 -1
- package/esm/checkbox.d.ts +9 -9
- package/esm/checkbox.js +1 -1
- package/esm/collection.d.ts +9 -9
- package/esm/collection.js +1 -1
- package/esm/combobox.d.ts +33 -33
- package/esm/combobox.js +1 -1
- package/esm/command.d.ts +2 -2
- package/esm/command.js +1 -1
- package/esm/composite.d.ts +21 -21
- package/esm/composite.js +1 -1
- package/esm/dialog.d.ts +15 -15
- package/esm/dialog.js +1 -1
- package/esm/disclosure.d.ts +9 -9
- package/esm/disclosure.js +1 -1
- package/esm/focus-trap.d.ts +4 -4
- package/esm/focus-trap.js +1 -1
- package/esm/focusable.d.ts +2 -2
- package/esm/focusable.js +1 -1
- package/esm/form.d.ts +37 -37
- package/esm/form.js +1 -1
- package/esm/group.d.ts +4 -4
- package/esm/group.js +1 -1
- package/esm/heading.d.ts +4 -4
- package/esm/heading.js +1 -1
- package/esm/hovercard.d.ts +19 -19
- package/esm/hovercard.js +1 -1
- package/esm/index.js +27 -27
- package/esm/menu.d.ts +41 -41
- package/esm/menu.js +1 -1
- package/esm/menubar.d.ts +7 -7
- package/esm/menubar.js +1 -1
- package/esm/popover.d.ts +21 -21
- package/esm/popover.js +1 -1
- package/esm/portal.d.ts +3 -3
- package/esm/portal.js +1 -1
- package/esm/radio.d.ts +9 -9
- package/esm/radio.js +1 -1
- package/esm/role.d.ts +2 -2
- package/esm/role.js +1 -1
- package/esm/select.d.ts +33 -33
- package/esm/select.js +1 -1
- package/esm/separator.d.ts +2 -2
- package/esm/separator.js +1 -1
- package/esm/store.d.ts +1 -1
- package/esm/store.js +1 -1
- package/esm/tab.d.ts +11 -11
- package/esm/tab.js +1 -1
- package/esm/toolbar.d.ts +15 -15
- package/esm/toolbar.js +1 -1
- package/esm/tooltip.d.ts +11 -11
- package/esm/tooltip.js +1 -1
- package/esm/visually-hidden.d.ts +2 -2
- package/esm/visually-hidden.js +1 -1
- package/package.json +2 -2
- package/src/button.ts +5 -0
- package/src/checkbox.ts +19 -0
- package/src/collection.ts +19 -0
- package/src/combobox.ts +76 -0
- package/src/command.ts +5 -0
- package/src/composite.ts +49 -0
- package/src/dialog.ts +34 -0
- package/src/disclosure.ts +19 -0
- package/src/focus-trap.ts +11 -0
- package/src/focusable.ts +5 -0
- package/src/form.ts +90 -0
- package/src/group.ts +10 -0
- package/src/heading.ts +7 -0
- package/src/hovercard.ts +44 -0
- package/src/index.ts +27 -0
- package/src/menu.ts +100 -0
- package/src/menubar.ts +14 -0
- package/src/popover.ts +49 -0
- package/src/portal.ts +6 -0
- package/src/radio.ts +19 -0
- package/src/role.ts +5 -0
- package/src/select.ts +76 -0
- package/src/separator.ts +5 -0
- package/src/store.ts +1 -0
- package/src/tab.ts +21 -0
- package/src/toolbar.ts +34 -0
- package/src/tooltip.ts +24 -0
- package/src/visually-hidden.ts +5 -0
- package/cjs/__chunks/24MX6KII.cjs +0 -14
- package/cjs/__chunks/2IFRJ7YS.cjs +0 -6
- package/cjs/__chunks/32YVOHOP.cjs +0 -50
- package/cjs/__chunks/4BAIAF3U.cjs +0 -14
- package/cjs/__chunks/4J2CIZDN.cjs +0 -14
- package/cjs/__chunks/4TTUYQMJ.cjs +0 -20
- package/cjs/__chunks/6QAXTQNM.cjs +0 -16
- package/cjs/__chunks/6WNPYLAU.cjs +0 -6
- package/cjs/__chunks/A2CP2RQF.cjs +0 -24
- package/cjs/__chunks/AEV4Y6LH.cjs +0 -8
- package/cjs/__chunks/APHGV4DJ.cjs +0 -6
- package/cjs/__chunks/B34XK6WF.cjs +0 -8
- package/cjs/__chunks/BFD7ZBIV.cjs +0 -26
- package/cjs/__chunks/CZIDOP5N.cjs +0 -38
- package/cjs/__chunks/ETUDK33Z.cjs +0 -26
- package/cjs/__chunks/GJC4LCYO.cjs +0 -16
- package/cjs/__chunks/KGVA5X7R.cjs +0 -38
- package/cjs/__chunks/LAX4QA6C.cjs +0 -42
- package/cjs/__chunks/MDOKA7B5.cjs +0 -6
- package/cjs/__chunks/Q2GGGIV7.cjs +0 -6
- package/cjs/__chunks/QKCQWENM.cjs +0 -6
- package/cjs/__chunks/QPSUJCLN.cjs +0 -12
- package/cjs/__chunks/TDX6HS73.cjs +0 -8
- package/cjs/__chunks/UPMOBIQ3.cjs +0 -20
- package/cjs/__chunks/W6XMZ4GT.cjs +0 -14
- package/cjs/__chunks/WXEUE6MJ.cjs +0 -6
- package/cjs/__chunks/XTZIX6PF.cjs +0 -8
- package/esm/__chunks/3IMSX6M3.js +0 -8
- package/esm/__chunks/4H6IIOQF.js +0 -22
- package/esm/__chunks/5OF2JM6T.js +0 -16
- package/esm/__chunks/6FL2IFMJ.js +0 -16
- package/esm/__chunks/6N4GEF7O.js +0 -18
- package/esm/__chunks/6OHDLPN7.js +0 -8
- package/esm/__chunks/7FQAKYJR.js +0 -26
- package/esm/__chunks/AJMZU3YP.js +0 -28
- package/esm/__chunks/DZPSY7QT.js +0 -22
- package/esm/__chunks/H2GJECQG.js +0 -8
- package/esm/__chunks/JBAWBCWC.js +0 -8
- package/esm/__chunks/LI3X5M2M.js +0 -8
- package/esm/__chunks/NV5BVS3O.js +0 -8
- package/esm/__chunks/PGIWSRTG.js +0 -28
- package/esm/__chunks/PRYHFEBA.js +0 -10
- package/esm/__chunks/UTW5KHW6.js +0 -16
- package/esm/__chunks/VGHCPDMA.js +0 -8
- package/esm/__chunks/VHD2YK6B.js +0 -18
- package/esm/__chunks/WA3BE3AY.js +0 -10
- package/esm/__chunks/XHSNLTYJ.js +0 -10
- package/esm/__chunks/XIMRDTWX.js +0 -14
- package/esm/__chunks/YQF2RGHD.js +0 -44
- package/esm/__chunks/ZDPYYVJP.js +0 -40
- package/esm/__chunks/ZFJPKQV6.js +0 -52
- package/esm/__chunks/ZL4AJIDL.js +0 -10
- package/esm/__chunks/ZQSDMYJA.js +0 -16
- package/esm/__chunks/ZVIXWGHS.js +0 -40
|
@@ -0,0 +1,1922 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _FIPBE5IXcjs = require('./FIPBE5IX.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _PDPE2VAZcjs = require('./PDPE2VAZ.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _D4HCGWOUcjs = require('./D4HCGWOU.cjs');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
var _QAUJZR6Ycjs = require('./QAUJZR6Y.cjs');
|
|
32
|
+
|
|
33
|
+
// ../ariakit-react-components/dist/popover/popover.js
|
|
34
|
+
var _react = require('react');
|
|
35
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
36
|
+
|
|
37
|
+
// ../../node_modules/.pnpm/@floating-ui+utils@0.2.11/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
|
|
38
|
+
var min = Math.min;
|
|
39
|
+
var max = Math.max;
|
|
40
|
+
var round = Math.round;
|
|
41
|
+
var floor = Math.floor;
|
|
42
|
+
var createCoords = (v) => ({
|
|
43
|
+
x: v,
|
|
44
|
+
y: v
|
|
45
|
+
});
|
|
46
|
+
var oppositeSideMap = {
|
|
47
|
+
left: "right",
|
|
48
|
+
right: "left",
|
|
49
|
+
bottom: "top",
|
|
50
|
+
top: "bottom"
|
|
51
|
+
};
|
|
52
|
+
function clamp(start, value, end) {
|
|
53
|
+
return max(start, min(value, end));
|
|
54
|
+
}
|
|
55
|
+
function evaluate(value, param) {
|
|
56
|
+
return typeof value === "function" ? value(param) : value;
|
|
57
|
+
}
|
|
58
|
+
function getSide(placement) {
|
|
59
|
+
return placement.split("-")[0];
|
|
60
|
+
}
|
|
61
|
+
function getAlignment(placement) {
|
|
62
|
+
return placement.split("-")[1];
|
|
63
|
+
}
|
|
64
|
+
function getOppositeAxis(axis) {
|
|
65
|
+
return axis === "x" ? "y" : "x";
|
|
66
|
+
}
|
|
67
|
+
function getAxisLength(axis) {
|
|
68
|
+
return axis === "y" ? "height" : "width";
|
|
69
|
+
}
|
|
70
|
+
function getSideAxis(placement) {
|
|
71
|
+
const firstChar = placement[0];
|
|
72
|
+
return firstChar === "t" || firstChar === "b" ? "y" : "x";
|
|
73
|
+
}
|
|
74
|
+
function getAlignmentAxis(placement) {
|
|
75
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
76
|
+
}
|
|
77
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
78
|
+
if (rtl === void 0) {
|
|
79
|
+
rtl = false;
|
|
80
|
+
}
|
|
81
|
+
const alignment = getAlignment(placement);
|
|
82
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
83
|
+
const length = getAxisLength(alignmentAxis);
|
|
84
|
+
let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
|
|
85
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
86
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
87
|
+
}
|
|
88
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
89
|
+
}
|
|
90
|
+
function getExpandedPlacements(placement) {
|
|
91
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
92
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
93
|
+
}
|
|
94
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
95
|
+
return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
|
|
96
|
+
}
|
|
97
|
+
var lrPlacement = ["left", "right"];
|
|
98
|
+
var rlPlacement = ["right", "left"];
|
|
99
|
+
var tbPlacement = ["top", "bottom"];
|
|
100
|
+
var btPlacement = ["bottom", "top"];
|
|
101
|
+
function getSideList(side, isStart, rtl) {
|
|
102
|
+
switch (side) {
|
|
103
|
+
case "top":
|
|
104
|
+
case "bottom":
|
|
105
|
+
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
106
|
+
return isStart ? lrPlacement : rlPlacement;
|
|
107
|
+
case "left":
|
|
108
|
+
case "right":
|
|
109
|
+
return isStart ? tbPlacement : btPlacement;
|
|
110
|
+
default:
|
|
111
|
+
return [];
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
115
|
+
const alignment = getAlignment(placement);
|
|
116
|
+
let list = getSideList(getSide(placement), direction === "start", rtl);
|
|
117
|
+
if (alignment) {
|
|
118
|
+
list = list.map((side) => side + "-" + alignment);
|
|
119
|
+
if (flipAlignment) {
|
|
120
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return list;
|
|
124
|
+
}
|
|
125
|
+
function getOppositePlacement(placement) {
|
|
126
|
+
const side = getSide(placement);
|
|
127
|
+
return oppositeSideMap[side] + placement.slice(side.length);
|
|
128
|
+
}
|
|
129
|
+
function expandPaddingObject(padding) {
|
|
130
|
+
return {
|
|
131
|
+
top: 0,
|
|
132
|
+
right: 0,
|
|
133
|
+
bottom: 0,
|
|
134
|
+
left: 0,
|
|
135
|
+
...padding
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function getPaddingObject(padding) {
|
|
139
|
+
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
|
140
|
+
top: padding,
|
|
141
|
+
right: padding,
|
|
142
|
+
bottom: padding,
|
|
143
|
+
left: padding
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function rectToClientRect(rect) {
|
|
147
|
+
const {
|
|
148
|
+
x,
|
|
149
|
+
y,
|
|
150
|
+
width,
|
|
151
|
+
height
|
|
152
|
+
} = rect;
|
|
153
|
+
return {
|
|
154
|
+
width,
|
|
155
|
+
height,
|
|
156
|
+
top: y,
|
|
157
|
+
left: x,
|
|
158
|
+
right: x + width,
|
|
159
|
+
bottom: y + height,
|
|
160
|
+
x,
|
|
161
|
+
y
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// ../../node_modules/.pnpm/@floating-ui+core@1.7.5/node_modules/@floating-ui/core/dist/floating-ui.core.mjs
|
|
166
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
167
|
+
let {
|
|
168
|
+
reference,
|
|
169
|
+
floating
|
|
170
|
+
} = _ref;
|
|
171
|
+
const sideAxis = getSideAxis(placement);
|
|
172
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
173
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
174
|
+
const side = getSide(placement);
|
|
175
|
+
const isVertical = sideAxis === "y";
|
|
176
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
177
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
178
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
179
|
+
let coords;
|
|
180
|
+
switch (side) {
|
|
181
|
+
case "top":
|
|
182
|
+
coords = {
|
|
183
|
+
x: commonX,
|
|
184
|
+
y: reference.y - floating.height
|
|
185
|
+
};
|
|
186
|
+
break;
|
|
187
|
+
case "bottom":
|
|
188
|
+
coords = {
|
|
189
|
+
x: commonX,
|
|
190
|
+
y: reference.y + reference.height
|
|
191
|
+
};
|
|
192
|
+
break;
|
|
193
|
+
case "right":
|
|
194
|
+
coords = {
|
|
195
|
+
x: reference.x + reference.width,
|
|
196
|
+
y: commonY
|
|
197
|
+
};
|
|
198
|
+
break;
|
|
199
|
+
case "left":
|
|
200
|
+
coords = {
|
|
201
|
+
x: reference.x - floating.width,
|
|
202
|
+
y: commonY
|
|
203
|
+
};
|
|
204
|
+
break;
|
|
205
|
+
default:
|
|
206
|
+
coords = {
|
|
207
|
+
x: reference.x,
|
|
208
|
+
y: reference.y
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
switch (getAlignment(placement)) {
|
|
212
|
+
case "start":
|
|
213
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
214
|
+
break;
|
|
215
|
+
case "end":
|
|
216
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
return coords;
|
|
220
|
+
}
|
|
221
|
+
async function detectOverflow(state, options) {
|
|
222
|
+
var _await$platform$isEle;
|
|
223
|
+
if (options === void 0) {
|
|
224
|
+
options = {};
|
|
225
|
+
}
|
|
226
|
+
const {
|
|
227
|
+
x,
|
|
228
|
+
y,
|
|
229
|
+
platform: platform2,
|
|
230
|
+
rects,
|
|
231
|
+
elements,
|
|
232
|
+
strategy
|
|
233
|
+
} = state;
|
|
234
|
+
const {
|
|
235
|
+
boundary = "clippingAncestors",
|
|
236
|
+
rootBoundary = "viewport",
|
|
237
|
+
elementContext = "floating",
|
|
238
|
+
altBoundary = false,
|
|
239
|
+
padding = 0
|
|
240
|
+
} = evaluate(options, state);
|
|
241
|
+
const paddingObject = getPaddingObject(padding);
|
|
242
|
+
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
243
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
244
|
+
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
|
|
245
|
+
element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
|
|
246
|
+
boundary,
|
|
247
|
+
rootBoundary,
|
|
248
|
+
strategy
|
|
249
|
+
}));
|
|
250
|
+
const rect = elementContext === "floating" ? {
|
|
251
|
+
x,
|
|
252
|
+
y,
|
|
253
|
+
width: rects.floating.width,
|
|
254
|
+
height: rects.floating.height
|
|
255
|
+
} : rects.reference;
|
|
256
|
+
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
257
|
+
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
258
|
+
x: 1,
|
|
259
|
+
y: 1
|
|
260
|
+
} : {
|
|
261
|
+
x: 1,
|
|
262
|
+
y: 1
|
|
263
|
+
};
|
|
264
|
+
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
265
|
+
elements,
|
|
266
|
+
rect,
|
|
267
|
+
offsetParent,
|
|
268
|
+
strategy
|
|
269
|
+
}) : rect);
|
|
270
|
+
return {
|
|
271
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
272
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
273
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
274
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
var MAX_RESET_COUNT = 50;
|
|
278
|
+
var computePosition = async (reference, floating, config) => {
|
|
279
|
+
const {
|
|
280
|
+
placement = "bottom",
|
|
281
|
+
strategy = "absolute",
|
|
282
|
+
middleware = [],
|
|
283
|
+
platform: platform2
|
|
284
|
+
} = config;
|
|
285
|
+
const platformWithDetectOverflow = platform2.detectOverflow ? platform2 : {
|
|
286
|
+
...platform2,
|
|
287
|
+
detectOverflow
|
|
288
|
+
};
|
|
289
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
|
|
290
|
+
let rects = await platform2.getElementRects({
|
|
291
|
+
reference,
|
|
292
|
+
floating,
|
|
293
|
+
strategy
|
|
294
|
+
});
|
|
295
|
+
let {
|
|
296
|
+
x,
|
|
297
|
+
y
|
|
298
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
299
|
+
let statefulPlacement = placement;
|
|
300
|
+
let resetCount = 0;
|
|
301
|
+
const middlewareData = {};
|
|
302
|
+
for (let i = 0; i < middleware.length; i++) {
|
|
303
|
+
const currentMiddleware = middleware[i];
|
|
304
|
+
if (!currentMiddleware) {
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
const {
|
|
308
|
+
name,
|
|
309
|
+
fn
|
|
310
|
+
} = currentMiddleware;
|
|
311
|
+
const {
|
|
312
|
+
x: nextX,
|
|
313
|
+
y: nextY,
|
|
314
|
+
data,
|
|
315
|
+
reset
|
|
316
|
+
} = await fn({
|
|
317
|
+
x,
|
|
318
|
+
y,
|
|
319
|
+
initialPlacement: placement,
|
|
320
|
+
placement: statefulPlacement,
|
|
321
|
+
strategy,
|
|
322
|
+
middlewareData,
|
|
323
|
+
rects,
|
|
324
|
+
platform: platformWithDetectOverflow,
|
|
325
|
+
elements: {
|
|
326
|
+
reference,
|
|
327
|
+
floating
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
x = nextX != null ? nextX : x;
|
|
331
|
+
y = nextY != null ? nextY : y;
|
|
332
|
+
middlewareData[name] = {
|
|
333
|
+
...middlewareData[name],
|
|
334
|
+
...data
|
|
335
|
+
};
|
|
336
|
+
if (reset && resetCount < MAX_RESET_COUNT) {
|
|
337
|
+
resetCount++;
|
|
338
|
+
if (typeof reset === "object") {
|
|
339
|
+
if (reset.placement) {
|
|
340
|
+
statefulPlacement = reset.placement;
|
|
341
|
+
}
|
|
342
|
+
if (reset.rects) {
|
|
343
|
+
rects = reset.rects === true ? await platform2.getElementRects({
|
|
344
|
+
reference,
|
|
345
|
+
floating,
|
|
346
|
+
strategy
|
|
347
|
+
}) : reset.rects;
|
|
348
|
+
}
|
|
349
|
+
({
|
|
350
|
+
x,
|
|
351
|
+
y
|
|
352
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
353
|
+
}
|
|
354
|
+
i = -1;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return {
|
|
358
|
+
x,
|
|
359
|
+
y,
|
|
360
|
+
placement: statefulPlacement,
|
|
361
|
+
strategy,
|
|
362
|
+
middlewareData
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
var arrow = (options) => ({
|
|
366
|
+
name: "arrow",
|
|
367
|
+
options,
|
|
368
|
+
async fn(state) {
|
|
369
|
+
const {
|
|
370
|
+
x,
|
|
371
|
+
y,
|
|
372
|
+
placement,
|
|
373
|
+
rects,
|
|
374
|
+
platform: platform2,
|
|
375
|
+
elements,
|
|
376
|
+
middlewareData
|
|
377
|
+
} = state;
|
|
378
|
+
const {
|
|
379
|
+
element,
|
|
380
|
+
padding = 0
|
|
381
|
+
} = evaluate(options, state) || {};
|
|
382
|
+
if (element == null) {
|
|
383
|
+
return {};
|
|
384
|
+
}
|
|
385
|
+
const paddingObject = getPaddingObject(padding);
|
|
386
|
+
const coords = {
|
|
387
|
+
x,
|
|
388
|
+
y
|
|
389
|
+
};
|
|
390
|
+
const axis = getAlignmentAxis(placement);
|
|
391
|
+
const length = getAxisLength(axis);
|
|
392
|
+
const arrowDimensions = await platform2.getDimensions(element);
|
|
393
|
+
const isYAxis = axis === "y";
|
|
394
|
+
const minProp = isYAxis ? "top" : "left";
|
|
395
|
+
const maxProp = isYAxis ? "bottom" : "right";
|
|
396
|
+
const clientProp = isYAxis ? "clientHeight" : "clientWidth";
|
|
397
|
+
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
|
398
|
+
const startDiff = coords[axis] - rects.reference[axis];
|
|
399
|
+
const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
|
|
400
|
+
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
|
|
401
|
+
if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) {
|
|
402
|
+
clientSize = elements.floating[clientProp] || rects.floating[length];
|
|
403
|
+
}
|
|
404
|
+
const centerToReference = endDiff / 2 - startDiff / 2;
|
|
405
|
+
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
|
|
406
|
+
const minPadding = min(paddingObject[minProp], largestPossiblePadding);
|
|
407
|
+
const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
|
|
408
|
+
const min$1 = minPadding;
|
|
409
|
+
const max2 = clientSize - arrowDimensions[length] - maxPadding;
|
|
410
|
+
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
411
|
+
const offset3 = clamp(min$1, center, max2);
|
|
412
|
+
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset3 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
413
|
+
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
|
|
414
|
+
return {
|
|
415
|
+
[axis]: coords[axis] + alignmentOffset,
|
|
416
|
+
data: {
|
|
417
|
+
[axis]: offset3,
|
|
418
|
+
centerOffset: center - offset3 - alignmentOffset,
|
|
419
|
+
...shouldAddOffset && {
|
|
420
|
+
alignmentOffset
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
reset: shouldAddOffset
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
var flip = function(options) {
|
|
428
|
+
if (options === void 0) {
|
|
429
|
+
options = {};
|
|
430
|
+
}
|
|
431
|
+
return {
|
|
432
|
+
name: "flip",
|
|
433
|
+
options,
|
|
434
|
+
async fn(state) {
|
|
435
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
436
|
+
const {
|
|
437
|
+
placement,
|
|
438
|
+
middlewareData,
|
|
439
|
+
rects,
|
|
440
|
+
initialPlacement,
|
|
441
|
+
platform: platform2,
|
|
442
|
+
elements
|
|
443
|
+
} = state;
|
|
444
|
+
const {
|
|
445
|
+
mainAxis: checkMainAxis = true,
|
|
446
|
+
crossAxis: checkCrossAxis = true,
|
|
447
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
448
|
+
fallbackStrategy = "bestFit",
|
|
449
|
+
fallbackAxisSideDirection = "none",
|
|
450
|
+
flipAlignment = true,
|
|
451
|
+
...detectOverflowOptions
|
|
452
|
+
} = evaluate(options, state);
|
|
453
|
+
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
454
|
+
return {};
|
|
455
|
+
}
|
|
456
|
+
const side = getSide(placement);
|
|
457
|
+
const initialSideAxis = getSideAxis(initialPlacement);
|
|
458
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
459
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
460
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
461
|
+
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
|
|
462
|
+
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
463
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
464
|
+
}
|
|
465
|
+
const placements2 = [initialPlacement, ...fallbackPlacements];
|
|
466
|
+
const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
|
|
467
|
+
const overflows = [];
|
|
468
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
469
|
+
if (checkMainAxis) {
|
|
470
|
+
overflows.push(overflow[side]);
|
|
471
|
+
}
|
|
472
|
+
if (checkCrossAxis) {
|
|
473
|
+
const sides2 = getAlignmentSides(placement, rects, rtl);
|
|
474
|
+
overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
|
|
475
|
+
}
|
|
476
|
+
overflowsData = [...overflowsData, {
|
|
477
|
+
placement,
|
|
478
|
+
overflows
|
|
479
|
+
}];
|
|
480
|
+
if (!overflows.every((side2) => side2 <= 0)) {
|
|
481
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
482
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
483
|
+
const nextPlacement = placements2[nextIndex];
|
|
484
|
+
if (nextPlacement) {
|
|
485
|
+
const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
|
|
486
|
+
if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
|
|
487
|
+
// overflows the main axis.
|
|
488
|
+
overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
|
|
489
|
+
return {
|
|
490
|
+
data: {
|
|
491
|
+
index: nextIndex,
|
|
492
|
+
overflows: overflowsData
|
|
493
|
+
},
|
|
494
|
+
reset: {
|
|
495
|
+
placement: nextPlacement
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
501
|
+
if (!resetPlacement) {
|
|
502
|
+
switch (fallbackStrategy) {
|
|
503
|
+
case "bestFit": {
|
|
504
|
+
var _overflowsData$filter2;
|
|
505
|
+
const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
|
|
506
|
+
if (hasFallbackAxisSideDirection) {
|
|
507
|
+
const currentSideAxis = getSideAxis(d.placement);
|
|
508
|
+
return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
|
|
509
|
+
// reading directions favoring greater width.
|
|
510
|
+
currentSideAxis === "y";
|
|
511
|
+
}
|
|
512
|
+
return true;
|
|
513
|
+
}).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
514
|
+
if (placement2) {
|
|
515
|
+
resetPlacement = placement2;
|
|
516
|
+
}
|
|
517
|
+
break;
|
|
518
|
+
}
|
|
519
|
+
case "initialPlacement":
|
|
520
|
+
resetPlacement = initialPlacement;
|
|
521
|
+
break;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
if (placement !== resetPlacement) {
|
|
525
|
+
return {
|
|
526
|
+
reset: {
|
|
527
|
+
placement: resetPlacement
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
return {};
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
};
|
|
536
|
+
var originSides = /* @__PURE__ */ new Set(["left", "top"]);
|
|
537
|
+
async function convertValueToCoords(state, options) {
|
|
538
|
+
const {
|
|
539
|
+
placement,
|
|
540
|
+
platform: platform2,
|
|
541
|
+
elements
|
|
542
|
+
} = state;
|
|
543
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
544
|
+
const side = getSide(placement);
|
|
545
|
+
const alignment = getAlignment(placement);
|
|
546
|
+
const isVertical = getSideAxis(placement) === "y";
|
|
547
|
+
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
548
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
549
|
+
const rawValue = evaluate(options, state);
|
|
550
|
+
let {
|
|
551
|
+
mainAxis,
|
|
552
|
+
crossAxis,
|
|
553
|
+
alignmentAxis
|
|
554
|
+
} = typeof rawValue === "number" ? {
|
|
555
|
+
mainAxis: rawValue,
|
|
556
|
+
crossAxis: 0,
|
|
557
|
+
alignmentAxis: null
|
|
558
|
+
} : {
|
|
559
|
+
mainAxis: rawValue.mainAxis || 0,
|
|
560
|
+
crossAxis: rawValue.crossAxis || 0,
|
|
561
|
+
alignmentAxis: rawValue.alignmentAxis
|
|
562
|
+
};
|
|
563
|
+
if (alignment && typeof alignmentAxis === "number") {
|
|
564
|
+
crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
|
|
565
|
+
}
|
|
566
|
+
return isVertical ? {
|
|
567
|
+
x: crossAxis * crossAxisMulti,
|
|
568
|
+
y: mainAxis * mainAxisMulti
|
|
569
|
+
} : {
|
|
570
|
+
x: mainAxis * mainAxisMulti,
|
|
571
|
+
y: crossAxis * crossAxisMulti
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
var offset = function(options) {
|
|
575
|
+
if (options === void 0) {
|
|
576
|
+
options = 0;
|
|
577
|
+
}
|
|
578
|
+
return {
|
|
579
|
+
name: "offset",
|
|
580
|
+
options,
|
|
581
|
+
async fn(state) {
|
|
582
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
583
|
+
const {
|
|
584
|
+
x,
|
|
585
|
+
y,
|
|
586
|
+
placement,
|
|
587
|
+
middlewareData
|
|
588
|
+
} = state;
|
|
589
|
+
const diffCoords = await convertValueToCoords(state, options);
|
|
590
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
591
|
+
return {};
|
|
592
|
+
}
|
|
593
|
+
return {
|
|
594
|
+
x: x + diffCoords.x,
|
|
595
|
+
y: y + diffCoords.y,
|
|
596
|
+
data: {
|
|
597
|
+
...diffCoords,
|
|
598
|
+
placement
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
};
|
|
604
|
+
var shift = function(options) {
|
|
605
|
+
if (options === void 0) {
|
|
606
|
+
options = {};
|
|
607
|
+
}
|
|
608
|
+
return {
|
|
609
|
+
name: "shift",
|
|
610
|
+
options,
|
|
611
|
+
async fn(state) {
|
|
612
|
+
const {
|
|
613
|
+
x,
|
|
614
|
+
y,
|
|
615
|
+
placement,
|
|
616
|
+
platform: platform2
|
|
617
|
+
} = state;
|
|
618
|
+
const {
|
|
619
|
+
mainAxis: checkMainAxis = true,
|
|
620
|
+
crossAxis: checkCrossAxis = false,
|
|
621
|
+
limiter = {
|
|
622
|
+
fn: (_ref) => {
|
|
623
|
+
let {
|
|
624
|
+
x: x2,
|
|
625
|
+
y: y2
|
|
626
|
+
} = _ref;
|
|
627
|
+
return {
|
|
628
|
+
x: x2,
|
|
629
|
+
y: y2
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
},
|
|
633
|
+
...detectOverflowOptions
|
|
634
|
+
} = evaluate(options, state);
|
|
635
|
+
const coords = {
|
|
636
|
+
x,
|
|
637
|
+
y
|
|
638
|
+
};
|
|
639
|
+
const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
|
|
640
|
+
const crossAxis = getSideAxis(getSide(placement));
|
|
641
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
642
|
+
let mainAxisCoord = coords[mainAxis];
|
|
643
|
+
let crossAxisCoord = coords[crossAxis];
|
|
644
|
+
if (checkMainAxis) {
|
|
645
|
+
const minSide = mainAxis === "y" ? "top" : "left";
|
|
646
|
+
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
647
|
+
const min2 = mainAxisCoord + overflow[minSide];
|
|
648
|
+
const max2 = mainAxisCoord - overflow[maxSide];
|
|
649
|
+
mainAxisCoord = clamp(min2, mainAxisCoord, max2);
|
|
650
|
+
}
|
|
651
|
+
if (checkCrossAxis) {
|
|
652
|
+
const minSide = crossAxis === "y" ? "top" : "left";
|
|
653
|
+
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
654
|
+
const min2 = crossAxisCoord + overflow[minSide];
|
|
655
|
+
const max2 = crossAxisCoord - overflow[maxSide];
|
|
656
|
+
crossAxisCoord = clamp(min2, crossAxisCoord, max2);
|
|
657
|
+
}
|
|
658
|
+
const limitedCoords = limiter.fn({
|
|
659
|
+
...state,
|
|
660
|
+
[mainAxis]: mainAxisCoord,
|
|
661
|
+
[crossAxis]: crossAxisCoord
|
|
662
|
+
});
|
|
663
|
+
return {
|
|
664
|
+
...limitedCoords,
|
|
665
|
+
data: {
|
|
666
|
+
x: limitedCoords.x - x,
|
|
667
|
+
y: limitedCoords.y - y,
|
|
668
|
+
enabled: {
|
|
669
|
+
[mainAxis]: checkMainAxis,
|
|
670
|
+
[crossAxis]: checkCrossAxis
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
};
|
|
677
|
+
var limitShift = function(options) {
|
|
678
|
+
if (options === void 0) {
|
|
679
|
+
options = {};
|
|
680
|
+
}
|
|
681
|
+
return {
|
|
682
|
+
options,
|
|
683
|
+
fn(state) {
|
|
684
|
+
const {
|
|
685
|
+
x,
|
|
686
|
+
y,
|
|
687
|
+
placement,
|
|
688
|
+
rects,
|
|
689
|
+
middlewareData
|
|
690
|
+
} = state;
|
|
691
|
+
const {
|
|
692
|
+
offset: offset3 = 0,
|
|
693
|
+
mainAxis: checkMainAxis = true,
|
|
694
|
+
crossAxis: checkCrossAxis = true
|
|
695
|
+
} = evaluate(options, state);
|
|
696
|
+
const coords = {
|
|
697
|
+
x,
|
|
698
|
+
y
|
|
699
|
+
};
|
|
700
|
+
const crossAxis = getSideAxis(placement);
|
|
701
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
702
|
+
let mainAxisCoord = coords[mainAxis];
|
|
703
|
+
let crossAxisCoord = coords[crossAxis];
|
|
704
|
+
const rawOffset = evaluate(offset3, state);
|
|
705
|
+
const computedOffset = typeof rawOffset === "number" ? {
|
|
706
|
+
mainAxis: rawOffset,
|
|
707
|
+
crossAxis: 0
|
|
708
|
+
} : {
|
|
709
|
+
mainAxis: 0,
|
|
710
|
+
crossAxis: 0,
|
|
711
|
+
...rawOffset
|
|
712
|
+
};
|
|
713
|
+
if (checkMainAxis) {
|
|
714
|
+
const len = mainAxis === "y" ? "height" : "width";
|
|
715
|
+
const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
|
|
716
|
+
const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
|
|
717
|
+
if (mainAxisCoord < limitMin) {
|
|
718
|
+
mainAxisCoord = limitMin;
|
|
719
|
+
} else if (mainAxisCoord > limitMax) {
|
|
720
|
+
mainAxisCoord = limitMax;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
if (checkCrossAxis) {
|
|
724
|
+
var _middlewareData$offse, _middlewareData$offse2;
|
|
725
|
+
const len = mainAxis === "y" ? "width" : "height";
|
|
726
|
+
const isOriginSide = originSides.has(getSide(placement));
|
|
727
|
+
const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
|
|
728
|
+
const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
|
|
729
|
+
if (crossAxisCoord < limitMin) {
|
|
730
|
+
crossAxisCoord = limitMin;
|
|
731
|
+
} else if (crossAxisCoord > limitMax) {
|
|
732
|
+
crossAxisCoord = limitMax;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
return {
|
|
736
|
+
[mainAxis]: mainAxisCoord,
|
|
737
|
+
[crossAxis]: crossAxisCoord
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
};
|
|
741
|
+
};
|
|
742
|
+
var size = function(options) {
|
|
743
|
+
if (options === void 0) {
|
|
744
|
+
options = {};
|
|
745
|
+
}
|
|
746
|
+
return {
|
|
747
|
+
name: "size",
|
|
748
|
+
options,
|
|
749
|
+
async fn(state) {
|
|
750
|
+
var _state$middlewareData, _state$middlewareData2;
|
|
751
|
+
const {
|
|
752
|
+
placement,
|
|
753
|
+
rects,
|
|
754
|
+
platform: platform2,
|
|
755
|
+
elements
|
|
756
|
+
} = state;
|
|
757
|
+
const {
|
|
758
|
+
apply = () => {
|
|
759
|
+
},
|
|
760
|
+
...detectOverflowOptions
|
|
761
|
+
} = evaluate(options, state);
|
|
762
|
+
const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
|
|
763
|
+
const side = getSide(placement);
|
|
764
|
+
const alignment = getAlignment(placement);
|
|
765
|
+
const isYAxis = getSideAxis(placement) === "y";
|
|
766
|
+
const {
|
|
767
|
+
width,
|
|
768
|
+
height
|
|
769
|
+
} = rects.floating;
|
|
770
|
+
let heightSide;
|
|
771
|
+
let widthSide;
|
|
772
|
+
if (side === "top" || side === "bottom") {
|
|
773
|
+
heightSide = side;
|
|
774
|
+
widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
|
|
775
|
+
} else {
|
|
776
|
+
widthSide = side;
|
|
777
|
+
heightSide = alignment === "end" ? "top" : "bottom";
|
|
778
|
+
}
|
|
779
|
+
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
780
|
+
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
781
|
+
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
|
|
782
|
+
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
|
|
783
|
+
const noShift = !state.middlewareData.shift;
|
|
784
|
+
let availableHeight = overflowAvailableHeight;
|
|
785
|
+
let availableWidth = overflowAvailableWidth;
|
|
786
|
+
if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
|
|
787
|
+
availableWidth = maximumClippingWidth;
|
|
788
|
+
}
|
|
789
|
+
if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
|
|
790
|
+
availableHeight = maximumClippingHeight;
|
|
791
|
+
}
|
|
792
|
+
if (noShift && !alignment) {
|
|
793
|
+
const xMin = max(overflow.left, 0);
|
|
794
|
+
const xMax = max(overflow.right, 0);
|
|
795
|
+
const yMin = max(overflow.top, 0);
|
|
796
|
+
const yMax = max(overflow.bottom, 0);
|
|
797
|
+
if (isYAxis) {
|
|
798
|
+
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
799
|
+
} else {
|
|
800
|
+
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
await apply({
|
|
804
|
+
...state,
|
|
805
|
+
availableWidth,
|
|
806
|
+
availableHeight
|
|
807
|
+
});
|
|
808
|
+
const nextDimensions = await platform2.getDimensions(elements.floating);
|
|
809
|
+
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
810
|
+
return {
|
|
811
|
+
reset: {
|
|
812
|
+
rects: true
|
|
813
|
+
}
|
|
814
|
+
};
|
|
815
|
+
}
|
|
816
|
+
return {};
|
|
817
|
+
}
|
|
818
|
+
};
|
|
819
|
+
};
|
|
820
|
+
|
|
821
|
+
// ../../node_modules/.pnpm/@floating-ui+utils@0.2.11/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
|
|
822
|
+
function hasWindow() {
|
|
823
|
+
return typeof window !== "undefined";
|
|
824
|
+
}
|
|
825
|
+
function getNodeName(node) {
|
|
826
|
+
if (isNode(node)) {
|
|
827
|
+
return (node.nodeName || "").toLowerCase();
|
|
828
|
+
}
|
|
829
|
+
return "#document";
|
|
830
|
+
}
|
|
831
|
+
function getWindow(node) {
|
|
832
|
+
var _node$ownerDocument;
|
|
833
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
834
|
+
}
|
|
835
|
+
function getDocumentElement(node) {
|
|
836
|
+
var _ref;
|
|
837
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
838
|
+
}
|
|
839
|
+
function isNode(value) {
|
|
840
|
+
if (!hasWindow()) {
|
|
841
|
+
return false;
|
|
842
|
+
}
|
|
843
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
844
|
+
}
|
|
845
|
+
function isElement(value) {
|
|
846
|
+
if (!hasWindow()) {
|
|
847
|
+
return false;
|
|
848
|
+
}
|
|
849
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
850
|
+
}
|
|
851
|
+
function isHTMLElement(value) {
|
|
852
|
+
if (!hasWindow()) {
|
|
853
|
+
return false;
|
|
854
|
+
}
|
|
855
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
856
|
+
}
|
|
857
|
+
function isShadowRoot(value) {
|
|
858
|
+
if (!hasWindow() || typeof ShadowRoot === "undefined") {
|
|
859
|
+
return false;
|
|
860
|
+
}
|
|
861
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
862
|
+
}
|
|
863
|
+
function isOverflowElement(element) {
|
|
864
|
+
const {
|
|
865
|
+
overflow,
|
|
866
|
+
overflowX,
|
|
867
|
+
overflowY,
|
|
868
|
+
display
|
|
869
|
+
} = getComputedStyle2(element);
|
|
870
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
|
|
871
|
+
}
|
|
872
|
+
function isTableElement(element) {
|
|
873
|
+
return /^(table|td|th)$/.test(getNodeName(element));
|
|
874
|
+
}
|
|
875
|
+
function isTopLayer(element) {
|
|
876
|
+
try {
|
|
877
|
+
if (element.matches(":popover-open")) {
|
|
878
|
+
return true;
|
|
879
|
+
}
|
|
880
|
+
} catch (_e) {
|
|
881
|
+
}
|
|
882
|
+
try {
|
|
883
|
+
return element.matches(":modal");
|
|
884
|
+
} catch (_e) {
|
|
885
|
+
return false;
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
var willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
|
889
|
+
var containRe = /paint|layout|strict|content/;
|
|
890
|
+
var isNotNone = (value) => !!value && value !== "none";
|
|
891
|
+
var isWebKitValue;
|
|
892
|
+
function isContainingBlock(elementOrCss) {
|
|
893
|
+
const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
|
|
894
|
+
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || "");
|
|
895
|
+
}
|
|
896
|
+
function getContainingBlock(element) {
|
|
897
|
+
let currentNode = getParentNode(element);
|
|
898
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
899
|
+
if (isContainingBlock(currentNode)) {
|
|
900
|
+
return currentNode;
|
|
901
|
+
} else if (isTopLayer(currentNode)) {
|
|
902
|
+
return null;
|
|
903
|
+
}
|
|
904
|
+
currentNode = getParentNode(currentNode);
|
|
905
|
+
}
|
|
906
|
+
return null;
|
|
907
|
+
}
|
|
908
|
+
function isWebKit() {
|
|
909
|
+
if (isWebKitValue == null) {
|
|
910
|
+
isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
|
|
911
|
+
}
|
|
912
|
+
return isWebKitValue;
|
|
913
|
+
}
|
|
914
|
+
function isLastTraversableNode(node) {
|
|
915
|
+
return /^(html|body|#document)$/.test(getNodeName(node));
|
|
916
|
+
}
|
|
917
|
+
function getComputedStyle2(element) {
|
|
918
|
+
return getWindow(element).getComputedStyle(element);
|
|
919
|
+
}
|
|
920
|
+
function getNodeScroll(element) {
|
|
921
|
+
if (isElement(element)) {
|
|
922
|
+
return {
|
|
923
|
+
scrollLeft: element.scrollLeft,
|
|
924
|
+
scrollTop: element.scrollTop
|
|
925
|
+
};
|
|
926
|
+
}
|
|
927
|
+
return {
|
|
928
|
+
scrollLeft: element.scrollX,
|
|
929
|
+
scrollTop: element.scrollY
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
function getParentNode(node) {
|
|
933
|
+
if (getNodeName(node) === "html") {
|
|
934
|
+
return node;
|
|
935
|
+
}
|
|
936
|
+
const result = (
|
|
937
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
938
|
+
node.assignedSlot || // DOM Element detected.
|
|
939
|
+
node.parentNode || // ShadowRoot detected.
|
|
940
|
+
isShadowRoot(node) && node.host || // Fallback.
|
|
941
|
+
getDocumentElement(node)
|
|
942
|
+
);
|
|
943
|
+
return isShadowRoot(result) ? result.host : result;
|
|
944
|
+
}
|
|
945
|
+
function getNearestOverflowAncestor(node) {
|
|
946
|
+
const parentNode = getParentNode(node);
|
|
947
|
+
if (isLastTraversableNode(parentNode)) {
|
|
948
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
949
|
+
}
|
|
950
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
951
|
+
return parentNode;
|
|
952
|
+
}
|
|
953
|
+
return getNearestOverflowAncestor(parentNode);
|
|
954
|
+
}
|
|
955
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
956
|
+
var _node$ownerDocument2;
|
|
957
|
+
if (list === void 0) {
|
|
958
|
+
list = [];
|
|
959
|
+
}
|
|
960
|
+
if (traverseIframes === void 0) {
|
|
961
|
+
traverseIframes = true;
|
|
962
|
+
}
|
|
963
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
964
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
965
|
+
const win = getWindow(scrollableAncestor);
|
|
966
|
+
if (isBody) {
|
|
967
|
+
const frameElement = getFrameElement(win);
|
|
968
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
969
|
+
} else {
|
|
970
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
function getFrameElement(win) {
|
|
974
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
// ../../node_modules/.pnpm/@floating-ui+dom@1.7.6/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
|
|
978
|
+
function getCssDimensions(element) {
|
|
979
|
+
const css = getComputedStyle2(element);
|
|
980
|
+
let width = parseFloat(css.width) || 0;
|
|
981
|
+
let height = parseFloat(css.height) || 0;
|
|
982
|
+
const hasOffset = isHTMLElement(element);
|
|
983
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
984
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
985
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
986
|
+
if (shouldFallback) {
|
|
987
|
+
width = offsetWidth;
|
|
988
|
+
height = offsetHeight;
|
|
989
|
+
}
|
|
990
|
+
return {
|
|
991
|
+
width,
|
|
992
|
+
height,
|
|
993
|
+
$: shouldFallback
|
|
994
|
+
};
|
|
995
|
+
}
|
|
996
|
+
function unwrapElement(element) {
|
|
997
|
+
return !isElement(element) ? element.contextElement : element;
|
|
998
|
+
}
|
|
999
|
+
function getScale(element) {
|
|
1000
|
+
const domElement = unwrapElement(element);
|
|
1001
|
+
if (!isHTMLElement(domElement)) {
|
|
1002
|
+
return createCoords(1);
|
|
1003
|
+
}
|
|
1004
|
+
const rect = domElement.getBoundingClientRect();
|
|
1005
|
+
const {
|
|
1006
|
+
width,
|
|
1007
|
+
height,
|
|
1008
|
+
$
|
|
1009
|
+
} = getCssDimensions(domElement);
|
|
1010
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
1011
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
1012
|
+
if (!x || !Number.isFinite(x)) {
|
|
1013
|
+
x = 1;
|
|
1014
|
+
}
|
|
1015
|
+
if (!y || !Number.isFinite(y)) {
|
|
1016
|
+
y = 1;
|
|
1017
|
+
}
|
|
1018
|
+
return {
|
|
1019
|
+
x,
|
|
1020
|
+
y
|
|
1021
|
+
};
|
|
1022
|
+
}
|
|
1023
|
+
var noOffsets = /* @__PURE__ */ createCoords(0);
|
|
1024
|
+
function getVisualOffsets(element) {
|
|
1025
|
+
const win = getWindow(element);
|
|
1026
|
+
if (!isWebKit() || !win.visualViewport) {
|
|
1027
|
+
return noOffsets;
|
|
1028
|
+
}
|
|
1029
|
+
return {
|
|
1030
|
+
x: win.visualViewport.offsetLeft,
|
|
1031
|
+
y: win.visualViewport.offsetTop
|
|
1032
|
+
};
|
|
1033
|
+
}
|
|
1034
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
1035
|
+
if (isFixed === void 0) {
|
|
1036
|
+
isFixed = false;
|
|
1037
|
+
}
|
|
1038
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
1039
|
+
return false;
|
|
1040
|
+
}
|
|
1041
|
+
return isFixed;
|
|
1042
|
+
}
|
|
1043
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
1044
|
+
if (includeScale === void 0) {
|
|
1045
|
+
includeScale = false;
|
|
1046
|
+
}
|
|
1047
|
+
if (isFixedStrategy === void 0) {
|
|
1048
|
+
isFixedStrategy = false;
|
|
1049
|
+
}
|
|
1050
|
+
const clientRect = element.getBoundingClientRect();
|
|
1051
|
+
const domElement = unwrapElement(element);
|
|
1052
|
+
let scale = createCoords(1);
|
|
1053
|
+
if (includeScale) {
|
|
1054
|
+
if (offsetParent) {
|
|
1055
|
+
if (isElement(offsetParent)) {
|
|
1056
|
+
scale = getScale(offsetParent);
|
|
1057
|
+
}
|
|
1058
|
+
} else {
|
|
1059
|
+
scale = getScale(element);
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
1063
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
1064
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
1065
|
+
let width = clientRect.width / scale.x;
|
|
1066
|
+
let height = clientRect.height / scale.y;
|
|
1067
|
+
if (domElement) {
|
|
1068
|
+
const win = getWindow(domElement);
|
|
1069
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
1070
|
+
let currentWin = win;
|
|
1071
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
1072
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
1073
|
+
const iframeScale = getScale(currentIFrame);
|
|
1074
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
1075
|
+
const css = getComputedStyle2(currentIFrame);
|
|
1076
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
1077
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
1078
|
+
x *= iframeScale.x;
|
|
1079
|
+
y *= iframeScale.y;
|
|
1080
|
+
width *= iframeScale.x;
|
|
1081
|
+
height *= iframeScale.y;
|
|
1082
|
+
x += left;
|
|
1083
|
+
y += top;
|
|
1084
|
+
currentWin = getWindow(currentIFrame);
|
|
1085
|
+
currentIFrame = getFrameElement(currentWin);
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
return rectToClientRect({
|
|
1089
|
+
width,
|
|
1090
|
+
height,
|
|
1091
|
+
x,
|
|
1092
|
+
y
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
function getWindowScrollBarX(element, rect) {
|
|
1096
|
+
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
1097
|
+
if (!rect) {
|
|
1098
|
+
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
1099
|
+
}
|
|
1100
|
+
return rect.left + leftScroll;
|
|
1101
|
+
}
|
|
1102
|
+
function getHTMLOffset(documentElement, scroll) {
|
|
1103
|
+
const htmlRect = documentElement.getBoundingClientRect();
|
|
1104
|
+
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
|
1105
|
+
const y = htmlRect.top + scroll.scrollTop;
|
|
1106
|
+
return {
|
|
1107
|
+
x,
|
|
1108
|
+
y
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1111
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
1112
|
+
let {
|
|
1113
|
+
elements,
|
|
1114
|
+
rect,
|
|
1115
|
+
offsetParent,
|
|
1116
|
+
strategy
|
|
1117
|
+
} = _ref;
|
|
1118
|
+
const isFixed = strategy === "fixed";
|
|
1119
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
1120
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
1121
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
1122
|
+
return rect;
|
|
1123
|
+
}
|
|
1124
|
+
let scroll = {
|
|
1125
|
+
scrollLeft: 0,
|
|
1126
|
+
scrollTop: 0
|
|
1127
|
+
};
|
|
1128
|
+
let scale = createCoords(1);
|
|
1129
|
+
const offsets = createCoords(0);
|
|
1130
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1131
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1132
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
1133
|
+
scroll = getNodeScroll(offsetParent);
|
|
1134
|
+
}
|
|
1135
|
+
if (isOffsetParentAnElement) {
|
|
1136
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
1137
|
+
scale = getScale(offsetParent);
|
|
1138
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1139
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
1143
|
+
return {
|
|
1144
|
+
width: rect.width * scale.x,
|
|
1145
|
+
height: rect.height * scale.y,
|
|
1146
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
1147
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
1148
|
+
};
|
|
1149
|
+
}
|
|
1150
|
+
function getClientRects(element) {
|
|
1151
|
+
return Array.from(element.getClientRects());
|
|
1152
|
+
}
|
|
1153
|
+
function getDocumentRect(element) {
|
|
1154
|
+
const html = getDocumentElement(element);
|
|
1155
|
+
const scroll = getNodeScroll(element);
|
|
1156
|
+
const body = element.ownerDocument.body;
|
|
1157
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
1158
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
1159
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
1160
|
+
const y = -scroll.scrollTop;
|
|
1161
|
+
if (getComputedStyle2(body).direction === "rtl") {
|
|
1162
|
+
x += max(html.clientWidth, body.clientWidth) - width;
|
|
1163
|
+
}
|
|
1164
|
+
return {
|
|
1165
|
+
width,
|
|
1166
|
+
height,
|
|
1167
|
+
x,
|
|
1168
|
+
y
|
|
1169
|
+
};
|
|
1170
|
+
}
|
|
1171
|
+
var SCROLLBAR_MAX = 25;
|
|
1172
|
+
function getViewportRect(element, strategy) {
|
|
1173
|
+
const win = getWindow(element);
|
|
1174
|
+
const html = getDocumentElement(element);
|
|
1175
|
+
const visualViewport = win.visualViewport;
|
|
1176
|
+
let width = html.clientWidth;
|
|
1177
|
+
let height = html.clientHeight;
|
|
1178
|
+
let x = 0;
|
|
1179
|
+
let y = 0;
|
|
1180
|
+
if (visualViewport) {
|
|
1181
|
+
width = visualViewport.width;
|
|
1182
|
+
height = visualViewport.height;
|
|
1183
|
+
const visualViewportBased = isWebKit();
|
|
1184
|
+
if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
|
|
1185
|
+
x = visualViewport.offsetLeft;
|
|
1186
|
+
y = visualViewport.offsetTop;
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
const windowScrollbarX = getWindowScrollBarX(html);
|
|
1190
|
+
if (windowScrollbarX <= 0) {
|
|
1191
|
+
const doc = html.ownerDocument;
|
|
1192
|
+
const body = doc.body;
|
|
1193
|
+
const bodyStyles = getComputedStyle(body);
|
|
1194
|
+
const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
1195
|
+
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
1196
|
+
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
|
1197
|
+
width -= clippingStableScrollbarWidth;
|
|
1198
|
+
}
|
|
1199
|
+
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
|
1200
|
+
width += windowScrollbarX;
|
|
1201
|
+
}
|
|
1202
|
+
return {
|
|
1203
|
+
width,
|
|
1204
|
+
height,
|
|
1205
|
+
x,
|
|
1206
|
+
y
|
|
1207
|
+
};
|
|
1208
|
+
}
|
|
1209
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
1210
|
+
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
|
1211
|
+
const top = clientRect.top + element.clientTop;
|
|
1212
|
+
const left = clientRect.left + element.clientLeft;
|
|
1213
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
1214
|
+
const width = element.clientWidth * scale.x;
|
|
1215
|
+
const height = element.clientHeight * scale.y;
|
|
1216
|
+
const x = left * scale.x;
|
|
1217
|
+
const y = top * scale.y;
|
|
1218
|
+
return {
|
|
1219
|
+
width,
|
|
1220
|
+
height,
|
|
1221
|
+
x,
|
|
1222
|
+
y
|
|
1223
|
+
};
|
|
1224
|
+
}
|
|
1225
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
1226
|
+
let rect;
|
|
1227
|
+
if (clippingAncestor === "viewport") {
|
|
1228
|
+
rect = getViewportRect(element, strategy);
|
|
1229
|
+
} else if (clippingAncestor === "document") {
|
|
1230
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
1231
|
+
} else if (isElement(clippingAncestor)) {
|
|
1232
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
1233
|
+
} else {
|
|
1234
|
+
const visualOffsets = getVisualOffsets(element);
|
|
1235
|
+
rect = {
|
|
1236
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
1237
|
+
y: clippingAncestor.y - visualOffsets.y,
|
|
1238
|
+
width: clippingAncestor.width,
|
|
1239
|
+
height: clippingAncestor.height
|
|
1240
|
+
};
|
|
1241
|
+
}
|
|
1242
|
+
return rectToClientRect(rect);
|
|
1243
|
+
}
|
|
1244
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
1245
|
+
const parentNode = getParentNode(element);
|
|
1246
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
1247
|
+
return false;
|
|
1248
|
+
}
|
|
1249
|
+
return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
|
|
1250
|
+
}
|
|
1251
|
+
function getClippingElementAncestors(element, cache) {
|
|
1252
|
+
const cachedResult = cache.get(element);
|
|
1253
|
+
if (cachedResult) {
|
|
1254
|
+
return cachedResult;
|
|
1255
|
+
}
|
|
1256
|
+
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
|
1257
|
+
let currentContainingBlockComputedStyle = null;
|
|
1258
|
+
const elementIsFixed = getComputedStyle2(element).position === "fixed";
|
|
1259
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
1260
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1261
|
+
const computedStyle = getComputedStyle2(currentNode);
|
|
1262
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
1263
|
+
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
|
|
1264
|
+
currentContainingBlockComputedStyle = null;
|
|
1265
|
+
}
|
|
1266
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
1267
|
+
if (shouldDropCurrentNode) {
|
|
1268
|
+
result = result.filter((ancestor) => ancestor !== currentNode);
|
|
1269
|
+
} else {
|
|
1270
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
1271
|
+
}
|
|
1272
|
+
currentNode = getParentNode(currentNode);
|
|
1273
|
+
}
|
|
1274
|
+
cache.set(element, result);
|
|
1275
|
+
return result;
|
|
1276
|
+
}
|
|
1277
|
+
function getClippingRect(_ref) {
|
|
1278
|
+
let {
|
|
1279
|
+
element,
|
|
1280
|
+
boundary,
|
|
1281
|
+
rootBoundary,
|
|
1282
|
+
strategy
|
|
1283
|
+
} = _ref;
|
|
1284
|
+
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
1285
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
1286
|
+
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
|
|
1287
|
+
let top = firstRect.top;
|
|
1288
|
+
let right = firstRect.right;
|
|
1289
|
+
let bottom = firstRect.bottom;
|
|
1290
|
+
let left = firstRect.left;
|
|
1291
|
+
for (let i = 1; i < clippingAncestors.length; i++) {
|
|
1292
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
|
|
1293
|
+
top = max(rect.top, top);
|
|
1294
|
+
right = min(rect.right, right);
|
|
1295
|
+
bottom = min(rect.bottom, bottom);
|
|
1296
|
+
left = max(rect.left, left);
|
|
1297
|
+
}
|
|
1298
|
+
return {
|
|
1299
|
+
width: right - left,
|
|
1300
|
+
height: bottom - top,
|
|
1301
|
+
x: left,
|
|
1302
|
+
y: top
|
|
1303
|
+
};
|
|
1304
|
+
}
|
|
1305
|
+
function getDimensions(element) {
|
|
1306
|
+
const {
|
|
1307
|
+
width,
|
|
1308
|
+
height
|
|
1309
|
+
} = getCssDimensions(element);
|
|
1310
|
+
return {
|
|
1311
|
+
width,
|
|
1312
|
+
height
|
|
1313
|
+
};
|
|
1314
|
+
}
|
|
1315
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
1316
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1317
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
1318
|
+
const isFixed = strategy === "fixed";
|
|
1319
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
1320
|
+
let scroll = {
|
|
1321
|
+
scrollLeft: 0,
|
|
1322
|
+
scrollTop: 0
|
|
1323
|
+
};
|
|
1324
|
+
const offsets = createCoords(0);
|
|
1325
|
+
function setLeftRTLScrollbarOffset() {
|
|
1326
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
1327
|
+
}
|
|
1328
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1329
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
1330
|
+
scroll = getNodeScroll(offsetParent);
|
|
1331
|
+
}
|
|
1332
|
+
if (isOffsetParentAnElement) {
|
|
1333
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
1334
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1335
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1336
|
+
} else if (documentElement) {
|
|
1337
|
+
setLeftRTLScrollbarOffset();
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
|
1341
|
+
setLeftRTLScrollbarOffset();
|
|
1342
|
+
}
|
|
1343
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
1344
|
+
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
1345
|
+
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
1346
|
+
return {
|
|
1347
|
+
x,
|
|
1348
|
+
y,
|
|
1349
|
+
width: rect.width,
|
|
1350
|
+
height: rect.height
|
|
1351
|
+
};
|
|
1352
|
+
}
|
|
1353
|
+
function isStaticPositioned(element) {
|
|
1354
|
+
return getComputedStyle2(element).position === "static";
|
|
1355
|
+
}
|
|
1356
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
1357
|
+
if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
|
|
1358
|
+
return null;
|
|
1359
|
+
}
|
|
1360
|
+
if (polyfill) {
|
|
1361
|
+
return polyfill(element);
|
|
1362
|
+
}
|
|
1363
|
+
let rawOffsetParent = element.offsetParent;
|
|
1364
|
+
if (getDocumentElement(element) === rawOffsetParent) {
|
|
1365
|
+
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
1366
|
+
}
|
|
1367
|
+
return rawOffsetParent;
|
|
1368
|
+
}
|
|
1369
|
+
function getOffsetParent(element, polyfill) {
|
|
1370
|
+
const win = getWindow(element);
|
|
1371
|
+
if (isTopLayer(element)) {
|
|
1372
|
+
return win;
|
|
1373
|
+
}
|
|
1374
|
+
if (!isHTMLElement(element)) {
|
|
1375
|
+
let svgOffsetParent = getParentNode(element);
|
|
1376
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
1377
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
1378
|
+
return svgOffsetParent;
|
|
1379
|
+
}
|
|
1380
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
1381
|
+
}
|
|
1382
|
+
return win;
|
|
1383
|
+
}
|
|
1384
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
1385
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
1386
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
1387
|
+
}
|
|
1388
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
1389
|
+
return win;
|
|
1390
|
+
}
|
|
1391
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
1392
|
+
}
|
|
1393
|
+
var getElementRects = async function(data) {
|
|
1394
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
1395
|
+
const getDimensionsFn = this.getDimensions;
|
|
1396
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
1397
|
+
return {
|
|
1398
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
1399
|
+
floating: {
|
|
1400
|
+
x: 0,
|
|
1401
|
+
y: 0,
|
|
1402
|
+
width: floatingDimensions.width,
|
|
1403
|
+
height: floatingDimensions.height
|
|
1404
|
+
}
|
|
1405
|
+
};
|
|
1406
|
+
};
|
|
1407
|
+
function isRTL(element) {
|
|
1408
|
+
return getComputedStyle2(element).direction === "rtl";
|
|
1409
|
+
}
|
|
1410
|
+
var platform = {
|
|
1411
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
1412
|
+
getDocumentElement,
|
|
1413
|
+
getClippingRect,
|
|
1414
|
+
getOffsetParent,
|
|
1415
|
+
getElementRects,
|
|
1416
|
+
getClientRects,
|
|
1417
|
+
getDimensions,
|
|
1418
|
+
getScale,
|
|
1419
|
+
isElement,
|
|
1420
|
+
isRTL
|
|
1421
|
+
};
|
|
1422
|
+
function rectsAreEqual(a, b) {
|
|
1423
|
+
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
1424
|
+
}
|
|
1425
|
+
function observeMove(element, onMove) {
|
|
1426
|
+
let io = null;
|
|
1427
|
+
let timeoutId;
|
|
1428
|
+
const root = getDocumentElement(element);
|
|
1429
|
+
function cleanup() {
|
|
1430
|
+
var _io;
|
|
1431
|
+
clearTimeout(timeoutId);
|
|
1432
|
+
(_io = io) == null || _io.disconnect();
|
|
1433
|
+
io = null;
|
|
1434
|
+
}
|
|
1435
|
+
function refresh(skip, threshold) {
|
|
1436
|
+
if (skip === void 0) {
|
|
1437
|
+
skip = false;
|
|
1438
|
+
}
|
|
1439
|
+
if (threshold === void 0) {
|
|
1440
|
+
threshold = 1;
|
|
1441
|
+
}
|
|
1442
|
+
cleanup();
|
|
1443
|
+
const elementRectForRootMargin = element.getBoundingClientRect();
|
|
1444
|
+
const {
|
|
1445
|
+
left,
|
|
1446
|
+
top,
|
|
1447
|
+
width,
|
|
1448
|
+
height
|
|
1449
|
+
} = elementRectForRootMargin;
|
|
1450
|
+
if (!skip) {
|
|
1451
|
+
onMove();
|
|
1452
|
+
}
|
|
1453
|
+
if (!width || !height) {
|
|
1454
|
+
return;
|
|
1455
|
+
}
|
|
1456
|
+
const insetTop = floor(top);
|
|
1457
|
+
const insetRight = floor(root.clientWidth - (left + width));
|
|
1458
|
+
const insetBottom = floor(root.clientHeight - (top + height));
|
|
1459
|
+
const insetLeft = floor(left);
|
|
1460
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
1461
|
+
const options = {
|
|
1462
|
+
rootMargin,
|
|
1463
|
+
threshold: max(0, min(1, threshold)) || 1
|
|
1464
|
+
};
|
|
1465
|
+
let isFirstUpdate = true;
|
|
1466
|
+
function handleObserve(entries) {
|
|
1467
|
+
const ratio = entries[0].intersectionRatio;
|
|
1468
|
+
if (ratio !== threshold) {
|
|
1469
|
+
if (!isFirstUpdate) {
|
|
1470
|
+
return refresh();
|
|
1471
|
+
}
|
|
1472
|
+
if (!ratio) {
|
|
1473
|
+
timeoutId = setTimeout(() => {
|
|
1474
|
+
refresh(false, 1e-7);
|
|
1475
|
+
}, 1e3);
|
|
1476
|
+
} else {
|
|
1477
|
+
refresh(false, ratio);
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
|
1481
|
+
refresh();
|
|
1482
|
+
}
|
|
1483
|
+
isFirstUpdate = false;
|
|
1484
|
+
}
|
|
1485
|
+
try {
|
|
1486
|
+
io = new IntersectionObserver(handleObserve, {
|
|
1487
|
+
...options,
|
|
1488
|
+
// Handle <iframe>s
|
|
1489
|
+
root: root.ownerDocument
|
|
1490
|
+
});
|
|
1491
|
+
} catch (_e) {
|
|
1492
|
+
io = new IntersectionObserver(handleObserve, options);
|
|
1493
|
+
}
|
|
1494
|
+
io.observe(element);
|
|
1495
|
+
}
|
|
1496
|
+
refresh(true);
|
|
1497
|
+
return cleanup;
|
|
1498
|
+
}
|
|
1499
|
+
function autoUpdate(reference, floating, update, options) {
|
|
1500
|
+
if (options === void 0) {
|
|
1501
|
+
options = {};
|
|
1502
|
+
}
|
|
1503
|
+
const {
|
|
1504
|
+
ancestorScroll = true,
|
|
1505
|
+
ancestorResize = true,
|
|
1506
|
+
elementResize = typeof ResizeObserver === "function",
|
|
1507
|
+
layoutShift = typeof IntersectionObserver === "function",
|
|
1508
|
+
animationFrame = false
|
|
1509
|
+
} = options;
|
|
1510
|
+
const referenceEl = unwrapElement(reference);
|
|
1511
|
+
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
|
|
1512
|
+
ancestors.forEach((ancestor) => {
|
|
1513
|
+
ancestorScroll && ancestor.addEventListener("scroll", update, {
|
|
1514
|
+
passive: true
|
|
1515
|
+
});
|
|
1516
|
+
ancestorResize && ancestor.addEventListener("resize", update);
|
|
1517
|
+
});
|
|
1518
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
1519
|
+
let reobserveFrame = -1;
|
|
1520
|
+
let resizeObserver = null;
|
|
1521
|
+
if (elementResize) {
|
|
1522
|
+
resizeObserver = new ResizeObserver((_ref) => {
|
|
1523
|
+
let [firstEntry] = _ref;
|
|
1524
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
|
|
1525
|
+
resizeObserver.unobserve(floating);
|
|
1526
|
+
cancelAnimationFrame(reobserveFrame);
|
|
1527
|
+
reobserveFrame = requestAnimationFrame(() => {
|
|
1528
|
+
var _resizeObserver;
|
|
1529
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
1530
|
+
});
|
|
1531
|
+
}
|
|
1532
|
+
update();
|
|
1533
|
+
});
|
|
1534
|
+
if (referenceEl && !animationFrame) {
|
|
1535
|
+
resizeObserver.observe(referenceEl);
|
|
1536
|
+
}
|
|
1537
|
+
if (floating) {
|
|
1538
|
+
resizeObserver.observe(floating);
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
let frameId;
|
|
1542
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
1543
|
+
if (animationFrame) {
|
|
1544
|
+
frameLoop();
|
|
1545
|
+
}
|
|
1546
|
+
function frameLoop() {
|
|
1547
|
+
const nextRefRect = getBoundingClientRect(reference);
|
|
1548
|
+
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
|
1549
|
+
update();
|
|
1550
|
+
}
|
|
1551
|
+
prevRefRect = nextRefRect;
|
|
1552
|
+
frameId = requestAnimationFrame(frameLoop);
|
|
1553
|
+
}
|
|
1554
|
+
update();
|
|
1555
|
+
return () => {
|
|
1556
|
+
var _resizeObserver2;
|
|
1557
|
+
ancestors.forEach((ancestor) => {
|
|
1558
|
+
ancestorScroll && ancestor.removeEventListener("scroll", update);
|
|
1559
|
+
ancestorResize && ancestor.removeEventListener("resize", update);
|
|
1560
|
+
});
|
|
1561
|
+
cleanupIo == null || cleanupIo();
|
|
1562
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
1563
|
+
resizeObserver = null;
|
|
1564
|
+
if (animationFrame) {
|
|
1565
|
+
cancelAnimationFrame(frameId);
|
|
1566
|
+
}
|
|
1567
|
+
};
|
|
1568
|
+
}
|
|
1569
|
+
var offset2 = offset;
|
|
1570
|
+
var shift2 = shift;
|
|
1571
|
+
var flip2 = flip;
|
|
1572
|
+
var size2 = size;
|
|
1573
|
+
var arrow2 = arrow;
|
|
1574
|
+
var limitShift2 = limitShift;
|
|
1575
|
+
var computePosition2 = (reference, floating, options) => {
|
|
1576
|
+
const cache = /* @__PURE__ */ new Map();
|
|
1577
|
+
const mergedOptions = {
|
|
1578
|
+
platform,
|
|
1579
|
+
...options
|
|
1580
|
+
};
|
|
1581
|
+
const platformWithCache = {
|
|
1582
|
+
...mergedOptions.platform,
|
|
1583
|
+
_c: cache
|
|
1584
|
+
};
|
|
1585
|
+
return computePosition(reference, floating, {
|
|
1586
|
+
...mergedOptions,
|
|
1587
|
+
platform: platformWithCache
|
|
1588
|
+
});
|
|
1589
|
+
};
|
|
1590
|
+
|
|
1591
|
+
// ../ariakit-react-components/dist/popover/popover.js
|
|
1592
|
+
var TagName = "div";
|
|
1593
|
+
function createDOMRect(x = 0, y = 0, width = 0, height = 0) {
|
|
1594
|
+
if (typeof DOMRect === "function") return new DOMRect(x, y, width, height);
|
|
1595
|
+
const rect = {
|
|
1596
|
+
x,
|
|
1597
|
+
y,
|
|
1598
|
+
width,
|
|
1599
|
+
height,
|
|
1600
|
+
top: y,
|
|
1601
|
+
right: x + width,
|
|
1602
|
+
bottom: y + height,
|
|
1603
|
+
left: x
|
|
1604
|
+
};
|
|
1605
|
+
return {
|
|
1606
|
+
...rect,
|
|
1607
|
+
toJSON: () => rect
|
|
1608
|
+
};
|
|
1609
|
+
}
|
|
1610
|
+
function getDOMRect(anchorRect) {
|
|
1611
|
+
if (!anchorRect) return createDOMRect();
|
|
1612
|
+
const { x, y, width, height } = anchorRect;
|
|
1613
|
+
return createDOMRect(x, y, width, height);
|
|
1614
|
+
}
|
|
1615
|
+
function getAnchorElement(anchorElement, getAnchorRect) {
|
|
1616
|
+
return {
|
|
1617
|
+
contextElement: anchorElement || void 0,
|
|
1618
|
+
getBoundingClientRect: () => {
|
|
1619
|
+
const anchor = anchorElement;
|
|
1620
|
+
const anchorRect = getAnchorRect == null ? void 0 : getAnchorRect(anchor);
|
|
1621
|
+
if (anchorRect || !anchor) return getDOMRect(anchorRect);
|
|
1622
|
+
return anchor.getBoundingClientRect();
|
|
1623
|
+
}
|
|
1624
|
+
};
|
|
1625
|
+
}
|
|
1626
|
+
function isValidPlacement(flip3) {
|
|
1627
|
+
return /^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(flip3);
|
|
1628
|
+
}
|
|
1629
|
+
function roundByDPR(value) {
|
|
1630
|
+
const dpr = window.devicePixelRatio || 1;
|
|
1631
|
+
return Math.round(value * dpr) / dpr;
|
|
1632
|
+
}
|
|
1633
|
+
function getOffsetMiddleware(arrowElement, props) {
|
|
1634
|
+
return offset2(({ placement }) => {
|
|
1635
|
+
var _a;
|
|
1636
|
+
const arrowOffset = ((arrowElement == null ? void 0 : arrowElement.clientHeight) || 0) / 2;
|
|
1637
|
+
const finalGutter = typeof props.gutter === "number" ? props.gutter + arrowOffset : (_a = props.gutter) != null ? _a : arrowOffset;
|
|
1638
|
+
return {
|
|
1639
|
+
crossAxis: !!!placement.split("-")[1] ? props.shift : void 0,
|
|
1640
|
+
mainAxis: finalGutter,
|
|
1641
|
+
alignmentAxis: props.shift
|
|
1642
|
+
};
|
|
1643
|
+
});
|
|
1644
|
+
}
|
|
1645
|
+
function getFlipMiddleware(props) {
|
|
1646
|
+
if (props.flip === false) return;
|
|
1647
|
+
const fallbackPlacements = typeof props.flip === "string" ? props.flip.split(" ") : void 0;
|
|
1648
|
+
_QAUJZR6Ycjs.invariant.call(void 0, !fallbackPlacements || fallbackPlacements.every(isValidPlacement), "`flip` expects a spaced-delimited list of placements");
|
|
1649
|
+
return flip2({
|
|
1650
|
+
padding: props.overflowPadding,
|
|
1651
|
+
fallbackPlacements
|
|
1652
|
+
});
|
|
1653
|
+
}
|
|
1654
|
+
function getShiftMiddleware(props) {
|
|
1655
|
+
if (!props.slide && !props.overlap) return;
|
|
1656
|
+
return shift2({
|
|
1657
|
+
mainAxis: props.slide,
|
|
1658
|
+
crossAxis: props.overlap,
|
|
1659
|
+
padding: props.overflowPadding,
|
|
1660
|
+
limiter: limitShift2()
|
|
1661
|
+
});
|
|
1662
|
+
}
|
|
1663
|
+
function getSizeMiddleware(props) {
|
|
1664
|
+
return size2({
|
|
1665
|
+
padding: props.overflowPadding,
|
|
1666
|
+
apply({ elements, availableWidth, availableHeight, rects }) {
|
|
1667
|
+
const wrapper = elements.floating;
|
|
1668
|
+
const referenceWidth = Math.round(rects.reference.width);
|
|
1669
|
+
availableWidth = Math.floor(availableWidth);
|
|
1670
|
+
availableHeight = Math.floor(availableHeight);
|
|
1671
|
+
wrapper.style.setProperty("--popover-anchor-width", `${referenceWidth}px`);
|
|
1672
|
+
wrapper.style.setProperty("--popover-available-width", `${availableWidth}px`);
|
|
1673
|
+
wrapper.style.setProperty("--popover-available-height", `${availableHeight}px`);
|
|
1674
|
+
if (props.sameWidth) wrapper.style.width = `${referenceWidth}px`;
|
|
1675
|
+
if (props.fitViewport) {
|
|
1676
|
+
wrapper.style.maxWidth = `${availableWidth}px`;
|
|
1677
|
+
wrapper.style.maxHeight = `${availableHeight}px`;
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
});
|
|
1681
|
+
}
|
|
1682
|
+
function getArrowMiddleware(arrowElement, props) {
|
|
1683
|
+
if (!arrowElement) return;
|
|
1684
|
+
return arrow2({
|
|
1685
|
+
element: arrowElement,
|
|
1686
|
+
padding: props.arrowPadding
|
|
1687
|
+
});
|
|
1688
|
+
}
|
|
1689
|
+
var usePopover = _QAUJZR6Ycjs.createHook.call(void 0, function usePopover2({ store, modal = false, portal = modal, preserveTabOrder = true, autoFocusOnShow = true, wrapperProps, fixed = false, flip: flip3 = true, shift: shift3 = 0, slide = true, overlap = false, sameWidth = false, fitViewport = false, gutter, arrowPadding = 4, overflowPadding = 8, getAnchorRect, updatePosition, ...props }) {
|
|
1690
|
+
const context = _FIPBE5IXcjs.usePopoverProviderContext.call(void 0, );
|
|
1691
|
+
store = store || context;
|
|
1692
|
+
_QAUJZR6Ycjs.invariant.call(void 0, store, "Popover must receive a `store` prop or be wrapped in a PopoverProvider component.");
|
|
1693
|
+
const arrowElement = _D4HCGWOUcjs.useStoreState.call(void 0, store, "arrowElement");
|
|
1694
|
+
const anchorElement = _D4HCGWOUcjs.useStoreState.call(void 0, store, "anchorElement");
|
|
1695
|
+
const disclosureElement = _D4HCGWOUcjs.useStoreState.call(void 0, store, "disclosureElement");
|
|
1696
|
+
const popoverElement = _D4HCGWOUcjs.useStoreState.call(void 0, store, "popoverElement");
|
|
1697
|
+
const contentElement = _D4HCGWOUcjs.useStoreState.call(void 0, store, "contentElement");
|
|
1698
|
+
const placement = _D4HCGWOUcjs.useStoreState.call(void 0, store, "placement");
|
|
1699
|
+
const mounted = _D4HCGWOUcjs.useStoreState.call(void 0, store, "mounted");
|
|
1700
|
+
const rendered = _D4HCGWOUcjs.useStoreState.call(void 0, store, "rendered");
|
|
1701
|
+
const defaultArrowElementRef = _react.useRef.call(void 0, null);
|
|
1702
|
+
const [positioned, setPositioned] = _react.useState.call(void 0, false);
|
|
1703
|
+
const { portalRef, domReady } = _QAUJZR6Ycjs.usePortalRef.call(void 0, portal, props.portalRef);
|
|
1704
|
+
const getAnchorRectProp = _QAUJZR6Ycjs.useEvent.call(void 0, getAnchorRect);
|
|
1705
|
+
const updatePositionProp = _QAUJZR6Ycjs.useEvent.call(void 0, updatePosition);
|
|
1706
|
+
const hasCustomUpdatePosition = !!updatePosition;
|
|
1707
|
+
_QAUJZR6Ycjs.useSafeLayoutEffect.call(void 0, () => {
|
|
1708
|
+
if (!(popoverElement == null ? void 0 : popoverElement.isConnected)) return;
|
|
1709
|
+
popoverElement.style.setProperty("--popover-overflow-padding", `${overflowPadding}px`);
|
|
1710
|
+
const anchor = getAnchorElement(anchorElement, getAnchorRectProp);
|
|
1711
|
+
const updatePosition2 = async () => {
|
|
1712
|
+
if (!mounted) return;
|
|
1713
|
+
if (!arrowElement) defaultArrowElementRef.current = defaultArrowElementRef.current || document.createElement("div");
|
|
1714
|
+
const arrow3 = arrowElement || defaultArrowElementRef.current;
|
|
1715
|
+
const middleware = [
|
|
1716
|
+
getOffsetMiddleware(arrow3, {
|
|
1717
|
+
gutter,
|
|
1718
|
+
shift: shift3
|
|
1719
|
+
}),
|
|
1720
|
+
getFlipMiddleware({
|
|
1721
|
+
flip: flip3,
|
|
1722
|
+
overflowPadding
|
|
1723
|
+
}),
|
|
1724
|
+
getShiftMiddleware({
|
|
1725
|
+
slide,
|
|
1726
|
+
shift: shift3,
|
|
1727
|
+
overlap,
|
|
1728
|
+
overflowPadding
|
|
1729
|
+
}),
|
|
1730
|
+
getArrowMiddleware(arrow3, { arrowPadding }),
|
|
1731
|
+
getSizeMiddleware({
|
|
1732
|
+
sameWidth,
|
|
1733
|
+
fitViewport,
|
|
1734
|
+
overflowPadding
|
|
1735
|
+
})
|
|
1736
|
+
];
|
|
1737
|
+
const pos = await computePosition2(anchor, popoverElement, {
|
|
1738
|
+
placement,
|
|
1739
|
+
strategy: fixed ? "fixed" : "absolute",
|
|
1740
|
+
middleware
|
|
1741
|
+
});
|
|
1742
|
+
store == null ? void 0 : store.setState("currentPlacement", pos.placement);
|
|
1743
|
+
setPositioned(true);
|
|
1744
|
+
const x = roundByDPR(pos.x);
|
|
1745
|
+
const y = roundByDPR(pos.y);
|
|
1746
|
+
Object.assign(popoverElement.style, {
|
|
1747
|
+
top: "0",
|
|
1748
|
+
left: "0",
|
|
1749
|
+
transform: `translate3d(${x}px,${y}px,0)`
|
|
1750
|
+
});
|
|
1751
|
+
if (arrow3 && pos.middlewareData.arrow) {
|
|
1752
|
+
const { x: arrowX, y: arrowY } = pos.middlewareData.arrow;
|
|
1753
|
+
const side = pos.placement.split("-")[0];
|
|
1754
|
+
const centerX = arrow3.clientWidth / 2;
|
|
1755
|
+
const centerY = arrow3.clientHeight / 2;
|
|
1756
|
+
const originX = arrowX != null ? arrowX + centerX : -centerX;
|
|
1757
|
+
const originY = arrowY != null ? arrowY + centerY : -centerY;
|
|
1758
|
+
popoverElement.style.setProperty("--popover-transform-origin", {
|
|
1759
|
+
top: `${originX}px calc(100% + ${centerY}px)`,
|
|
1760
|
+
bottom: `${originX}px ${-centerY}px`,
|
|
1761
|
+
left: `calc(100% + ${centerX}px) ${originY}px`,
|
|
1762
|
+
right: `${-centerX}px ${originY}px`
|
|
1763
|
+
}[side]);
|
|
1764
|
+
Object.assign(arrow3.style, {
|
|
1765
|
+
left: arrowX != null ? `${arrowX}px` : "",
|
|
1766
|
+
top: arrowY != null ? `${arrowY}px` : "",
|
|
1767
|
+
[side]: "100%"
|
|
1768
|
+
});
|
|
1769
|
+
}
|
|
1770
|
+
};
|
|
1771
|
+
const update = async () => {
|
|
1772
|
+
if (hasCustomUpdatePosition) {
|
|
1773
|
+
await updatePositionProp({ updatePosition: updatePosition2 });
|
|
1774
|
+
setPositioned(true);
|
|
1775
|
+
} else await updatePosition2();
|
|
1776
|
+
};
|
|
1777
|
+
const cancelAutoUpdate = autoUpdate(anchor, popoverElement, update, { elementResize: typeof ResizeObserver === "function" });
|
|
1778
|
+
return () => {
|
|
1779
|
+
setPositioned(false);
|
|
1780
|
+
cancelAutoUpdate();
|
|
1781
|
+
};
|
|
1782
|
+
}, [
|
|
1783
|
+
store,
|
|
1784
|
+
rendered,
|
|
1785
|
+
popoverElement,
|
|
1786
|
+
arrowElement,
|
|
1787
|
+
anchorElement,
|
|
1788
|
+
popoverElement,
|
|
1789
|
+
placement,
|
|
1790
|
+
mounted,
|
|
1791
|
+
domReady,
|
|
1792
|
+
fixed,
|
|
1793
|
+
flip3,
|
|
1794
|
+
shift3,
|
|
1795
|
+
slide,
|
|
1796
|
+
overlap,
|
|
1797
|
+
sameWidth,
|
|
1798
|
+
fitViewport,
|
|
1799
|
+
gutter,
|
|
1800
|
+
arrowPadding,
|
|
1801
|
+
overflowPadding,
|
|
1802
|
+
getAnchorRectProp,
|
|
1803
|
+
hasCustomUpdatePosition,
|
|
1804
|
+
updatePositionProp
|
|
1805
|
+
]);
|
|
1806
|
+
_QAUJZR6Ycjs.useSafeLayoutEffect.call(void 0, () => {
|
|
1807
|
+
if (!mounted) return;
|
|
1808
|
+
if (!domReady) return;
|
|
1809
|
+
if (!(popoverElement == null ? void 0 : popoverElement.isConnected)) return;
|
|
1810
|
+
if (!(contentElement == null ? void 0 : contentElement.isConnected)) return;
|
|
1811
|
+
const applyZIndex = () => {
|
|
1812
|
+
popoverElement.style.zIndex = getComputedStyle(contentElement).zIndex;
|
|
1813
|
+
};
|
|
1814
|
+
applyZIndex();
|
|
1815
|
+
let raf = requestAnimationFrame(() => {
|
|
1816
|
+
raf = requestAnimationFrame(applyZIndex);
|
|
1817
|
+
});
|
|
1818
|
+
return () => cancelAnimationFrame(raf);
|
|
1819
|
+
}, [
|
|
1820
|
+
mounted,
|
|
1821
|
+
domReady,
|
|
1822
|
+
popoverElement,
|
|
1823
|
+
contentElement
|
|
1824
|
+
]);
|
|
1825
|
+
const position = fixed ? "fixed" : "absolute";
|
|
1826
|
+
props = _QAUJZR6Ycjs.useWrapElement.call(void 0, props, (element) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
|
|
1827
|
+
...wrapperProps,
|
|
1828
|
+
style: {
|
|
1829
|
+
position,
|
|
1830
|
+
top: 0,
|
|
1831
|
+
left: 0,
|
|
1832
|
+
width: "max-content",
|
|
1833
|
+
...wrapperProps == null ? void 0 : wrapperProps.style
|
|
1834
|
+
},
|
|
1835
|
+
ref: store == null ? void 0 : store.setPopoverElement,
|
|
1836
|
+
children: element
|
|
1837
|
+
}), [
|
|
1838
|
+
store,
|
|
1839
|
+
position,
|
|
1840
|
+
wrapperProps
|
|
1841
|
+
]);
|
|
1842
|
+
props = _QAUJZR6Ycjs.useWrapElement.call(void 0, props, (element) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FIPBE5IXcjs.PopoverScopedContextProvider, {
|
|
1843
|
+
value: store,
|
|
1844
|
+
children: element
|
|
1845
|
+
}), [store]);
|
|
1846
|
+
props = {
|
|
1847
|
+
"data-placing": !positioned || void 0,
|
|
1848
|
+
...props,
|
|
1849
|
+
style: {
|
|
1850
|
+
position: "relative",
|
|
1851
|
+
...props.style
|
|
1852
|
+
}
|
|
1853
|
+
};
|
|
1854
|
+
props = _PDPE2VAZcjs.useDialog.call(void 0, {
|
|
1855
|
+
store,
|
|
1856
|
+
modal,
|
|
1857
|
+
portal,
|
|
1858
|
+
preserveTabOrder,
|
|
1859
|
+
preserveTabOrderAnchor: disclosureElement || anchorElement,
|
|
1860
|
+
autoFocusOnShow: positioned && autoFocusOnShow,
|
|
1861
|
+
...props,
|
|
1862
|
+
portalRef
|
|
1863
|
+
});
|
|
1864
|
+
return props;
|
|
1865
|
+
});
|
|
1866
|
+
var Popover = _PDPE2VAZcjs.createDialogComponent.call(void 0, _QAUJZR6Ycjs.forwardRef.call(void 0, function Popover2(props) {
|
|
1867
|
+
return _QAUJZR6Ycjs.createElement.call(void 0, TagName, usePopover(props));
|
|
1868
|
+
}), _FIPBE5IXcjs.usePopoverProviderContext);
|
|
1869
|
+
|
|
1870
|
+
// ../ariakit-components/dist/popover/popover-store.js
|
|
1871
|
+
function createPopoverStore({ popover: otherPopover, ...props } = {}) {
|
|
1872
|
+
const store = _D4HCGWOUcjs.mergeStore.call(void 0, props.store, _D4HCGWOUcjs.omit.call(void 0, otherPopover, [
|
|
1873
|
+
"arrowElement",
|
|
1874
|
+
"anchorElement",
|
|
1875
|
+
"contentElement",
|
|
1876
|
+
"popoverElement",
|
|
1877
|
+
"disclosureElement"
|
|
1878
|
+
]));
|
|
1879
|
+
_D4HCGWOUcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
1880
|
+
const syncState = store == null ? void 0 : store.getState();
|
|
1881
|
+
const dialog = _PDPE2VAZcjs.createDialogStore.call(void 0, {
|
|
1882
|
+
...props,
|
|
1883
|
+
store
|
|
1884
|
+
});
|
|
1885
|
+
const placement = _QAUJZR6Ycjs.defaultValue.call(void 0, props.placement, syncState == null ? void 0 : syncState.placement, "bottom");
|
|
1886
|
+
const popover = _D4HCGWOUcjs.createStore.call(void 0, {
|
|
1887
|
+
...dialog.getState(),
|
|
1888
|
+
placement,
|
|
1889
|
+
currentPlacement: placement,
|
|
1890
|
+
anchorElement: _QAUJZR6Ycjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.anchorElement, null),
|
|
1891
|
+
popoverElement: _QAUJZR6Ycjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.popoverElement, null),
|
|
1892
|
+
arrowElement: _QAUJZR6Ycjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.arrowElement, null),
|
|
1893
|
+
rendered: /* @__PURE__ */ Symbol("rendered")
|
|
1894
|
+
}, dialog, store);
|
|
1895
|
+
return {
|
|
1896
|
+
...dialog,
|
|
1897
|
+
...popover,
|
|
1898
|
+
setAnchorElement: (element) => popover.setState("anchorElement", element),
|
|
1899
|
+
setPopoverElement: (element) => popover.setState("popoverElement", element),
|
|
1900
|
+
setArrowElement: (element) => popover.setState("arrowElement", element),
|
|
1901
|
+
render: () => popover.setState("rendered", /* @__PURE__ */ Symbol("rendered"))
|
|
1902
|
+
};
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
// ../ariakit-react-components/dist/popover/popover-store.js
|
|
1906
|
+
function usePopoverStoreProps(store, update, props) {
|
|
1907
|
+
_QAUJZR6Ycjs.useUpdateEffect.call(void 0, update, [props.popover]);
|
|
1908
|
+
_D4HCGWOUcjs.useStoreProps.call(void 0, store, props, "placement");
|
|
1909
|
+
return _PDPE2VAZcjs.useDialogStoreProps.call(void 0, store, update, props);
|
|
1910
|
+
}
|
|
1911
|
+
function usePopoverStore(props = {}) {
|
|
1912
|
+
const [store, update] = _D4HCGWOUcjs.useStore.call(void 0, createPopoverStore, props);
|
|
1913
|
+
return usePopoverStoreProps(store, update, props);
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
|
|
1917
|
+
|
|
1918
|
+
|
|
1919
|
+
|
|
1920
|
+
|
|
1921
|
+
|
|
1922
|
+
exports.usePopover = usePopover; exports.Popover = Popover; exports.createPopoverStore = createPopoverStore; exports.usePopoverStoreProps = usePopoverStoreProps; exports.usePopoverStore = usePopoverStore;
|