@jobber/components 9.5.3 → 9.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Combobox.d.ts +1 -0
- package/Combobox.js +17 -0
- package/dist/Autocomplete/index.cjs +0 -2
- package/dist/Autocomplete/index.mjs +0 -2
- package/dist/Autocomplete-cjs.js +4 -5
- package/dist/Autocomplete-es.js +1 -2
- package/dist/Card/index.cjs +2 -2
- package/dist/Card/index.mjs +2 -2
- package/dist/Chip/index.cjs +0 -2
- package/dist/Chip/index.mjs +0 -2
- package/dist/Chips/InternalChipDismissible/hooks/index.cjs +0 -2
- package/dist/Chips/InternalChipDismissible/hooks/index.mjs +0 -2
- package/dist/Chips/InternalChipDismissible/index.cjs +0 -2
- package/dist/Chips/InternalChipDismissible/index.mjs +0 -2
- package/dist/Chips/index.cjs +0 -2
- package/dist/Chips/index.mjs +0 -2
- package/dist/Combobox/Combobox.contentSlots.d.ts +5 -0
- package/dist/Combobox/Combobox.context.d.ts +34 -0
- package/dist/Combobox/Combobox.d.ts +69 -0
- package/dist/Combobox/Combobox.footer.d.ts +7 -0
- package/dist/Combobox/Combobox.items.d.ts +25 -0
- package/dist/Combobox/Combobox.responsive.d.ts +54 -0
- package/dist/Combobox/Combobox.selectAll.d.ts +4 -0
- package/dist/Combobox/Combobox.slotFactory.d.ts +7 -0
- package/dist/Combobox/Combobox.testUtils.d.ts +12 -0
- package/dist/Combobox/Combobox.types.d.ts +166 -0
- package/dist/Combobox/index.cjs +35 -0
- package/dist/Combobox/index.d.ts +2 -0
- package/dist/Combobox/index.mjs +29 -0
- package/dist/Combobox-cjs.js +675 -0
- package/dist/Combobox-es.js +673 -0
- package/dist/ComboboxPrimitive-cjs.js +88 -47
- package/dist/ComboboxPrimitive-es.js +39 -23
- package/dist/{ComboboxChipRemove-cjs.js → ComboboxSeparator-cjs.js} +501 -455
- package/dist/{ComboboxChipRemove-es.js → ComboboxSeparator-es.js} +500 -456
- package/dist/ConfirmationModal/index.cjs +0 -2
- package/dist/ConfirmationModal/index.mjs +0 -2
- package/dist/ContentBlock/index.cjs +1 -0
- package/dist/ContentBlock/index.mjs +1 -0
- package/dist/ContentBlock-cjs.js +2 -18
- package/dist/ContentBlock-es.js +1 -17
- package/dist/DataDump/index.cjs +2 -2
- package/dist/DataDump/index.mjs +2 -2
- package/dist/DataList/components/DataListActions/index.cjs +0 -2
- package/dist/DataList/components/DataListActions/index.mjs +0 -2
- package/dist/DataList/components/DataListBulkActions/index.cjs +0 -2
- package/dist/DataList/components/DataListBulkActions/index.mjs +0 -2
- package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +0 -2
- package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +0 -2
- package/dist/DataList/components/DataListFilters/index.cjs +0 -2
- package/dist/DataList/components/DataListFilters/index.mjs +0 -2
- package/dist/DataList/components/DataListHeader/index.cjs +0 -2
- package/dist/DataList/components/DataListHeader/index.mjs +0 -2
- package/dist/DataList/components/DataListItem/index.cjs +0 -2
- package/dist/DataList/components/DataListItem/index.mjs +0 -2
- package/dist/DataList/components/DataListItemActions/index.cjs +0 -2
- package/dist/DataList/components/DataListItemActions/index.mjs +0 -2
- package/dist/DataList/components/DataListItemActionsOverflow/index.cjs +0 -2
- package/dist/DataList/components/DataListItemActionsOverflow/index.mjs +0 -2
- package/dist/DataList/components/DataListItems/index.cjs +0 -2
- package/dist/DataList/components/DataListItems/index.mjs +0 -2
- package/dist/DataList/components/DataListLayout/index.cjs +0 -2
- package/dist/DataList/components/DataListLayout/index.mjs +0 -2
- package/dist/DataList/components/DataListLayoutActions/index.cjs +0 -2
- package/dist/DataList/components/DataListLayoutActions/index.mjs +0 -2
- package/dist/DataList/index.cjs +0 -2
- package/dist/DataList/index.mjs +0 -2
- package/dist/DatePicker/index.cjs +0 -2
- package/dist/DatePicker/index.mjs +0 -2
- package/dist/DatePicker-cjs.js +4 -5
- package/dist/DatePicker-es.js +1 -2
- package/dist/Dialog/index.cjs +2 -2
- package/dist/Dialog/index.mjs +2 -2
- package/dist/DrawerDescription-cjs.js +268 -99
- package/dist/DrawerDescription-es.js +270 -103
- package/dist/DrawerTitle-cjs.js +2 -6
- package/dist/DrawerTitle-es.js +3 -7
- package/dist/FieldDescription-cjs.js +184 -181
- package/dist/FieldDescription-es.js +187 -184
- package/dist/FilterPicker/components/FilterPickerActivator/index.cjs +0 -2
- package/dist/FilterPicker/components/FilterPickerActivator/index.mjs +0 -2
- package/dist/FilterPicker/components/FilterPickerContent/index.cjs +0 -2
- package/dist/FilterPicker/components/FilterPickerContent/index.mjs +0 -2
- package/dist/FilterPicker/components/FilterPickerTrigger/index.cjs +0 -2
- package/dist/FilterPicker/components/FilterPickerTrigger/index.mjs +0 -2
- package/dist/FilterPicker/index.cjs +0 -2
- package/dist/FilterPicker/index.mjs +0 -2
- package/dist/FilterPickerContent-cjs.js +4 -5
- package/dist/FilterPickerContent-es.js +1 -2
- package/dist/FormatFile/index.cjs +0 -2
- package/dist/FormatFile/index.mjs +0 -2
- package/dist/Gallery/index.cjs +0 -2
- package/dist/Gallery/index.mjs +0 -2
- package/dist/InputDate/index.cjs +0 -2
- package/dist/InputDate/index.mjs +0 -2
- package/dist/InputNumber/index.cjs +2 -2
- package/dist/InputNumber/index.mjs +2 -2
- package/dist/InputNumber/types.d.ts +5 -0
- package/dist/InputNumber-cjs.js +2 -2
- package/dist/InputNumber-es.js +2 -2
- package/dist/LightBox/index.cjs +0 -2
- package/dist/LightBox/index.mjs +0 -2
- package/dist/Menu/index.cjs +2 -2
- package/dist/Menu/index.mjs +2 -2
- package/dist/Menu-cjs.js +4 -5
- package/dist/Menu-es.js +1 -2
- package/dist/MenuSubmenuTrigger-cjs.js +206 -164
- package/dist/MenuSubmenuTrigger-es.js +194 -152
- package/dist/Modal/index.cjs +0 -2
- package/dist/Modal/index.mjs +1 -3
- package/dist/NumberFieldInput-cjs.js +187 -308
- package/dist/NumberFieldInput-es.js +187 -308
- package/dist/Page/index.cjs +2 -2
- package/dist/Page/index.mjs +2 -2
- package/dist/Popover/index.cjs +0 -2
- package/dist/Popover/index.mjs +0 -2
- package/dist/Popover-cjs.js +7 -8
- package/dist/Popover-es.js +1 -2
- package/dist/ScrollAreaViewport-cjs.js +747 -1093
- package/dist/ScrollAreaViewport-es.js +734 -1081
- package/dist/Select/index.cjs +2 -2
- package/dist/Select/index.mjs +2 -2
- package/dist/SelectGroupLabel-cjs.js +207 -306
- package/dist/SelectGroupLabel-es.js +203 -302
- package/dist/SelectPrimitive-cjs.js +11 -17
- package/dist/SelectPrimitive-es.js +1 -7
- package/dist/Tooltip/index.cjs +0 -2
- package/dist/Tooltip/index.mjs +0 -2
- package/dist/Tooltip-cjs.js +6 -7
- package/dist/Tooltip-es.js +1 -2
- package/dist/buttonRenderAdapter-cjs.js +2 -1
- package/dist/buttonRenderAdapter-es.js +2 -1
- package/dist/dialogReturnFocus-cjs.js +1 -1
- package/dist/dialogReturnFocus-es.js +2 -2
- package/dist/docs/InputNumber/InputNumber.md +2 -2
- package/dist/docs/SelectPrimitive/SelectPrimitive.md +1 -1
- package/dist/floating-ui.react-cjs.js +2557 -185
- package/dist/floating-ui.react-es.js +2512 -149
- package/dist/getMappedBreakpointWidth-cjs.js +21 -0
- package/dist/getMappedBreakpointWidth-es.js +18 -0
- package/dist/index.cjs +15 -10
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +14 -10
- package/dist/mergeClassName-cjs.js +12 -0
- package/dist/mergeClassName-es.js +10 -0
- package/dist/primitives/BottomSheet/index.cjs +1 -1
- package/dist/primitives/BottomSheet/index.mjs +1 -1
- package/dist/primitives/ComboboxPrimitive/ComboboxPrimitive.d.ts +2 -2
- package/dist/primitives/ComboboxPrimitive/index.cjs +4 -5
- package/dist/primitives/ComboboxPrimitive/index.mjs +4 -5
- package/dist/primitives/SelectPrimitive/index.cjs +1 -2
- package/dist/primitives/SelectPrimitive/index.mjs +1 -2
- package/dist/primitives/index.cjs +3 -3
- package/dist/primitives/index.mjs +3 -3
- package/dist/scrollEdges-cjs.js +1 -11
- package/dist/scrollEdges-es.js +1 -11
- package/dist/scrollable-cjs.js +58 -0
- package/dist/scrollable-es.js +54 -0
- package/dist/styles.css +759 -42
- package/dist/unstyledPrimitives/index.cjs +720 -478
- package/dist/unstyledPrimitives/index.mjs +663 -421
- package/dist/useCompositeListItem-cjs.js +2108 -361
- package/dist/useCompositeListItem-es.js +2076 -331
- package/dist/useLabel-cjs.js +2 -3
- package/dist/useLabel-es.js +2 -3
- package/dist/useRenderElement-cjs.js +9 -7
- package/dist/useRenderElement-es.js +9 -7
- package/dist/useScrollLock-cjs.js +819 -344
- package/dist/useScrollLock-es.js +732 -296
- package/dist/useScrollToActive-cjs.js +4 -5
- package/dist/useScrollToActive-es.js +1 -2
- package/dist/utils/meta/meta.json +43 -1
- package/package.json +8 -3
- package/dist/floating-ui.react-dom-cjs.js +0 -2103
- package/dist/floating-ui.react-dom-es.js +0 -2072
- package/dist/floating-ui.utils-cjs.js +0 -342
- package/dist/floating-ui.utils-es.js +0 -300
|
@@ -1,9 +1,306 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useLayoutEffect } from 'react';
|
|
3
|
-
import { a as isShadowRoot, i as isHTMLElement, f as floor, b as isElement, c as isNode, g as getNodeName, d as isLastTraversableNode, e as getParentNode, h as getComputedStyle$1, j as getOverflowAncestors, k as isWebKit } from './floating-ui.utils-es.js';
|
|
4
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
4
|
import * as ReactDOM from 'react-dom';
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
function hasWindow() {
|
|
7
|
+
return typeof window !== 'undefined';
|
|
8
|
+
}
|
|
9
|
+
function getNodeName(node) {
|
|
10
|
+
if (isNode(node)) {
|
|
11
|
+
return (node.nodeName || '').toLowerCase();
|
|
12
|
+
}
|
|
13
|
+
// Mocked nodes in testing environments may not be instances of Node. By
|
|
14
|
+
// returning `#document` an infinite loop won't occur.
|
|
15
|
+
// https://github.com/floating-ui/floating-ui/issues/2317
|
|
16
|
+
return '#document';
|
|
17
|
+
}
|
|
18
|
+
function getWindow(node) {
|
|
19
|
+
var _node$ownerDocument;
|
|
20
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
21
|
+
}
|
|
22
|
+
function getDocumentElement(node) {
|
|
23
|
+
var _ref;
|
|
24
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
25
|
+
}
|
|
26
|
+
function isNode(value) {
|
|
27
|
+
if (!hasWindow()) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
31
|
+
}
|
|
32
|
+
function isElement(value) {
|
|
33
|
+
if (!hasWindow()) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
37
|
+
}
|
|
38
|
+
function isHTMLElement(value) {
|
|
39
|
+
if (!hasWindow()) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
43
|
+
}
|
|
44
|
+
function isShadowRoot(value) {
|
|
45
|
+
if (!hasWindow() || typeof ShadowRoot === 'undefined') {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
49
|
+
}
|
|
50
|
+
function isOverflowElement(element) {
|
|
51
|
+
const {
|
|
52
|
+
overflow,
|
|
53
|
+
overflowX,
|
|
54
|
+
overflowY,
|
|
55
|
+
display
|
|
56
|
+
} = getComputedStyle$1(element);
|
|
57
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
|
|
58
|
+
}
|
|
59
|
+
function isTableElement(element) {
|
|
60
|
+
return /^(table|td|th)$/.test(getNodeName(element));
|
|
61
|
+
}
|
|
62
|
+
function isTopLayer(element) {
|
|
63
|
+
try {
|
|
64
|
+
if (element.matches(':popover-open')) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
} catch (_e) {
|
|
68
|
+
// no-op
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
return element.matches(':modal');
|
|
72
|
+
} catch (_e) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
|
77
|
+
const containRe = /paint|layout|strict|content/;
|
|
78
|
+
const isNotNone = value => !!value && value !== 'none';
|
|
79
|
+
let isWebKitValue;
|
|
80
|
+
function isContainingBlock(elementOrCss) {
|
|
81
|
+
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
82
|
+
|
|
83
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
84
|
+
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
|
85
|
+
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 || '');
|
|
86
|
+
}
|
|
87
|
+
function getContainingBlock(element) {
|
|
88
|
+
let currentNode = getParentNode(element);
|
|
89
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
90
|
+
if (isContainingBlock(currentNode)) {
|
|
91
|
+
return currentNode;
|
|
92
|
+
} else if (isTopLayer(currentNode)) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
currentNode = getParentNode(currentNode);
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
function isWebKit() {
|
|
100
|
+
if (isWebKitValue == null) {
|
|
101
|
+
isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
|
|
102
|
+
}
|
|
103
|
+
return isWebKitValue;
|
|
104
|
+
}
|
|
105
|
+
function isLastTraversableNode(node) {
|
|
106
|
+
return /^(html|body|#document)$/.test(getNodeName(node));
|
|
107
|
+
}
|
|
108
|
+
function getComputedStyle$1(element) {
|
|
109
|
+
return getWindow(element).getComputedStyle(element);
|
|
110
|
+
}
|
|
111
|
+
function getNodeScroll(element) {
|
|
112
|
+
if (isElement(element)) {
|
|
113
|
+
return {
|
|
114
|
+
scrollLeft: element.scrollLeft,
|
|
115
|
+
scrollTop: element.scrollTop
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
scrollLeft: element.scrollX,
|
|
120
|
+
scrollTop: element.scrollY
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function getParentNode(node) {
|
|
124
|
+
if (getNodeName(node) === 'html') {
|
|
125
|
+
return node;
|
|
126
|
+
}
|
|
127
|
+
const result =
|
|
128
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
129
|
+
node.assignedSlot ||
|
|
130
|
+
// DOM Element detected.
|
|
131
|
+
node.parentNode ||
|
|
132
|
+
// ShadowRoot detected.
|
|
133
|
+
isShadowRoot(node) && node.host ||
|
|
134
|
+
// Fallback.
|
|
135
|
+
getDocumentElement(node);
|
|
136
|
+
return isShadowRoot(result) ? result.host : result;
|
|
137
|
+
}
|
|
138
|
+
function getNearestOverflowAncestor(node) {
|
|
139
|
+
const parentNode = getParentNode(node);
|
|
140
|
+
if (isLastTraversableNode(parentNode)) {
|
|
141
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
142
|
+
}
|
|
143
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
144
|
+
return parentNode;
|
|
145
|
+
}
|
|
146
|
+
return getNearestOverflowAncestor(parentNode);
|
|
147
|
+
}
|
|
148
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
149
|
+
var _node$ownerDocument2;
|
|
150
|
+
if (list === void 0) {
|
|
151
|
+
list = [];
|
|
152
|
+
}
|
|
153
|
+
if (traverseIframes === void 0) {
|
|
154
|
+
traverseIframes = true;
|
|
155
|
+
}
|
|
156
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
157
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
158
|
+
const win = getWindow(scrollableAncestor);
|
|
159
|
+
if (isBody) {
|
|
160
|
+
const frameElement = getFrameElement(win);
|
|
161
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
162
|
+
} else {
|
|
163
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function getFrameElement(win) {
|
|
167
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Custom positioning reference element.
|
|
172
|
+
* @see https://floating-ui.com/docs/virtual-elements
|
|
173
|
+
*/
|
|
174
|
+
|
|
175
|
+
const sides = ['top', 'right', 'bottom', 'left'];
|
|
176
|
+
const alignments = ['start', 'end'];
|
|
177
|
+
const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
|
|
178
|
+
const min = Math.min;
|
|
179
|
+
const max = Math.max;
|
|
180
|
+
const round = Math.round;
|
|
181
|
+
const floor = Math.floor;
|
|
182
|
+
const createCoords = v => ({
|
|
183
|
+
x: v,
|
|
184
|
+
y: v
|
|
185
|
+
});
|
|
186
|
+
const oppositeSideMap = {
|
|
187
|
+
left: 'right',
|
|
188
|
+
right: 'left',
|
|
189
|
+
bottom: 'top',
|
|
190
|
+
top: 'bottom'
|
|
191
|
+
};
|
|
192
|
+
function clamp(start, value, end) {
|
|
193
|
+
return max(start, min(value, end));
|
|
194
|
+
}
|
|
195
|
+
function evaluate(value, param) {
|
|
196
|
+
return typeof value === 'function' ? value(param) : value;
|
|
197
|
+
}
|
|
198
|
+
function getSide(placement) {
|
|
199
|
+
return placement.split('-')[0];
|
|
200
|
+
}
|
|
201
|
+
function getAlignment(placement) {
|
|
202
|
+
return placement.split('-')[1];
|
|
203
|
+
}
|
|
204
|
+
function getOppositeAxis(axis) {
|
|
205
|
+
return axis === 'x' ? 'y' : 'x';
|
|
206
|
+
}
|
|
207
|
+
function getAxisLength(axis) {
|
|
208
|
+
return axis === 'y' ? 'height' : 'width';
|
|
209
|
+
}
|
|
210
|
+
function getSideAxis(placement) {
|
|
211
|
+
const firstChar = placement[0];
|
|
212
|
+
return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';
|
|
213
|
+
}
|
|
214
|
+
function getAlignmentAxis(placement) {
|
|
215
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
216
|
+
}
|
|
217
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
218
|
+
if (rtl === void 0) {
|
|
219
|
+
rtl = false;
|
|
220
|
+
}
|
|
221
|
+
const alignment = getAlignment(placement);
|
|
222
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
223
|
+
const length = getAxisLength(alignmentAxis);
|
|
224
|
+
let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
|
225
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
226
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
227
|
+
}
|
|
228
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
229
|
+
}
|
|
230
|
+
function getExpandedPlacements(placement) {
|
|
231
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
232
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
233
|
+
}
|
|
234
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
235
|
+
return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');
|
|
236
|
+
}
|
|
237
|
+
const lrPlacement = ['left', 'right'];
|
|
238
|
+
const rlPlacement = ['right', 'left'];
|
|
239
|
+
const tbPlacement = ['top', 'bottom'];
|
|
240
|
+
const btPlacement = ['bottom', 'top'];
|
|
241
|
+
function getSideList(side, isStart, rtl) {
|
|
242
|
+
switch (side) {
|
|
243
|
+
case 'top':
|
|
244
|
+
case 'bottom':
|
|
245
|
+
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
246
|
+
return isStart ? lrPlacement : rlPlacement;
|
|
247
|
+
case 'left':
|
|
248
|
+
case 'right':
|
|
249
|
+
return isStart ? tbPlacement : btPlacement;
|
|
250
|
+
default:
|
|
251
|
+
return [];
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
255
|
+
const alignment = getAlignment(placement);
|
|
256
|
+
let list = getSideList(getSide(placement), direction === 'start', rtl);
|
|
257
|
+
if (alignment) {
|
|
258
|
+
list = list.map(side => side + "-" + alignment);
|
|
259
|
+
if (flipAlignment) {
|
|
260
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return list;
|
|
264
|
+
}
|
|
265
|
+
function getOppositePlacement(placement) {
|
|
266
|
+
const side = getSide(placement);
|
|
267
|
+
return oppositeSideMap[side] + placement.slice(side.length);
|
|
268
|
+
}
|
|
269
|
+
function expandPaddingObject(padding) {
|
|
270
|
+
return {
|
|
271
|
+
top: 0,
|
|
272
|
+
right: 0,
|
|
273
|
+
bottom: 0,
|
|
274
|
+
left: 0,
|
|
275
|
+
...padding
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
function getPaddingObject(padding) {
|
|
279
|
+
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
|
|
280
|
+
top: padding,
|
|
281
|
+
right: padding,
|
|
282
|
+
bottom: padding,
|
|
283
|
+
left: padding
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
function rectToClientRect(rect) {
|
|
287
|
+
const {
|
|
288
|
+
x,
|
|
289
|
+
y,
|
|
290
|
+
width,
|
|
291
|
+
height
|
|
292
|
+
} = rect;
|
|
293
|
+
return {
|
|
294
|
+
width,
|
|
295
|
+
height,
|
|
296
|
+
top: y,
|
|
297
|
+
left: x,
|
|
298
|
+
right: x + width,
|
|
299
|
+
bottom: y + height,
|
|
300
|
+
x,
|
|
301
|
+
y
|
|
302
|
+
};
|
|
303
|
+
}
|
|
7
304
|
|
|
8
305
|
/*!
|
|
9
306
|
* tabbable 6.4.0
|
|
@@ -773,19 +1070,19 @@ function isMouseLikePointerType(pointerType, strict) {
|
|
|
773
1070
|
return values.includes(pointerType);
|
|
774
1071
|
}
|
|
775
1072
|
|
|
776
|
-
var isClient = typeof document !== 'undefined';
|
|
1073
|
+
var isClient$1 = typeof document !== 'undefined';
|
|
777
1074
|
|
|
778
|
-
var noop = function noop() {};
|
|
779
|
-
var index = isClient ? useLayoutEffect : noop;
|
|
1075
|
+
var noop$1 = function noop() {};
|
|
1076
|
+
var index$1 = isClient$1 ? useLayoutEffect : noop$1;
|
|
780
1077
|
|
|
781
1078
|
// https://github.com/mui/material-ui/issues/41190#issuecomment-2040873379
|
|
782
1079
|
const SafeReact$1 = {
|
|
783
1080
|
...React
|
|
784
1081
|
};
|
|
785
1082
|
|
|
786
|
-
function useLatestRef(value) {
|
|
1083
|
+
function useLatestRef$1(value) {
|
|
787
1084
|
const ref = React.useRef(value);
|
|
788
|
-
index(() => {
|
|
1085
|
+
index$1(() => {
|
|
789
1086
|
ref.current = value;
|
|
790
1087
|
});
|
|
791
1088
|
return ref;
|
|
@@ -970,131 +1267,2197 @@ function getGridNavigatedIndex(listRef, _ref) {
|
|
|
970
1267
|
return nextIndex;
|
|
971
1268
|
}
|
|
972
1269
|
|
|
973
|
-
/** For each cell index, gets the item index that occupies that cell */
|
|
974
|
-
function createGridCellMap(sizes, cols, dense) {
|
|
975
|
-
const cellMap = [];
|
|
976
|
-
let startIndex = 0;
|
|
977
|
-
sizes.forEach((_ref2, index) => {
|
|
978
|
-
let {
|
|
979
|
-
width,
|
|
980
|
-
height
|
|
981
|
-
} = _ref2;
|
|
982
|
-
if (width > cols) {
|
|
983
|
-
if (process.env.NODE_ENV !== "production") {
|
|
984
|
-
throw new Error("[Floating UI]: Invalid grid - item width at index " + index + " is greater than grid columns");
|
|
1270
|
+
/** For each cell index, gets the item index that occupies that cell */
|
|
1271
|
+
function createGridCellMap(sizes, cols, dense) {
|
|
1272
|
+
const cellMap = [];
|
|
1273
|
+
let startIndex = 0;
|
|
1274
|
+
sizes.forEach((_ref2, index) => {
|
|
1275
|
+
let {
|
|
1276
|
+
width,
|
|
1277
|
+
height
|
|
1278
|
+
} = _ref2;
|
|
1279
|
+
if (width > cols) {
|
|
1280
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1281
|
+
throw new Error("[Floating UI]: Invalid grid - item width at index " + index + " is greater than grid columns");
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
let itemPlaced = false;
|
|
1285
|
+
if (dense) {
|
|
1286
|
+
startIndex = 0;
|
|
1287
|
+
}
|
|
1288
|
+
while (!itemPlaced) {
|
|
1289
|
+
const targetCells = [];
|
|
1290
|
+
for (let i = 0; i < width; i++) {
|
|
1291
|
+
for (let j = 0; j < height; j++) {
|
|
1292
|
+
targetCells.push(startIndex + i + j * cols);
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
if (startIndex % cols + width <= cols && targetCells.every(cell => cellMap[cell] == null)) {
|
|
1296
|
+
targetCells.forEach(cell => {
|
|
1297
|
+
cellMap[cell] = index;
|
|
1298
|
+
});
|
|
1299
|
+
itemPlaced = true;
|
|
1300
|
+
} else {
|
|
1301
|
+
startIndex++;
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
});
|
|
1305
|
+
|
|
1306
|
+
// convert into a non-sparse array
|
|
1307
|
+
return [...cellMap];
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
/** Gets cell index of an item's corner or -1 when index is -1. */
|
|
1311
|
+
function getGridCellIndexOfCorner(index, sizes, cellMap, cols, corner) {
|
|
1312
|
+
if (index === -1) return -1;
|
|
1313
|
+
const firstCellIndex = cellMap.indexOf(index);
|
|
1314
|
+
const sizeItem = sizes[index];
|
|
1315
|
+
switch (corner) {
|
|
1316
|
+
case 'tl':
|
|
1317
|
+
return firstCellIndex;
|
|
1318
|
+
case 'tr':
|
|
1319
|
+
if (!sizeItem) {
|
|
1320
|
+
return firstCellIndex;
|
|
1321
|
+
}
|
|
1322
|
+
return firstCellIndex + sizeItem.width - 1;
|
|
1323
|
+
case 'bl':
|
|
1324
|
+
if (!sizeItem) {
|
|
1325
|
+
return firstCellIndex;
|
|
1326
|
+
}
|
|
1327
|
+
return firstCellIndex + (sizeItem.height - 1) * cols;
|
|
1328
|
+
case 'br':
|
|
1329
|
+
return cellMap.lastIndexOf(index);
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
/** Gets all cell indices that correspond to the specified indices */
|
|
1334
|
+
function getGridCellIndices(indices, cellMap) {
|
|
1335
|
+
return cellMap.flatMap((index, cellIndex) => indices.includes(index) ? [cellIndex] : []);
|
|
1336
|
+
}
|
|
1337
|
+
function isListIndexDisabled(listRef, index, disabledIndices) {
|
|
1338
|
+
if (typeof disabledIndices === 'function') {
|
|
1339
|
+
return disabledIndices(index);
|
|
1340
|
+
} else if (disabledIndices) {
|
|
1341
|
+
return disabledIndices.includes(index);
|
|
1342
|
+
}
|
|
1343
|
+
const element = listRef.current[index];
|
|
1344
|
+
return element == null || element.hasAttribute('disabled') || element.getAttribute('aria-disabled') === 'true';
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
const getTabbableOptions = () => ({
|
|
1348
|
+
getShadowRoot: true,
|
|
1349
|
+
displayCheck:
|
|
1350
|
+
// JSDOM does not support the `tabbable` library. To solve this we can
|
|
1351
|
+
// check if `ResizeObserver` is a real function (not polyfilled), which
|
|
1352
|
+
// determines if the current environment is JSDOM-like.
|
|
1353
|
+
typeof ResizeObserver === 'function' && ResizeObserver.toString().includes('[native code]') ? 'full' : 'none'
|
|
1354
|
+
});
|
|
1355
|
+
function getTabbableIn(container, dir) {
|
|
1356
|
+
const list = tabbable(container, getTabbableOptions());
|
|
1357
|
+
const len = list.length;
|
|
1358
|
+
if (len === 0) return;
|
|
1359
|
+
const active = activeElement(getDocument$1(container));
|
|
1360
|
+
const index = list.indexOf(active);
|
|
1361
|
+
const nextIndex = index === -1 ? dir === 1 ? 0 : len - 1 : index + dir;
|
|
1362
|
+
return list[nextIndex];
|
|
1363
|
+
}
|
|
1364
|
+
function getNextTabbable(referenceElement) {
|
|
1365
|
+
return getTabbableIn(getDocument$1(referenceElement).body, 1) || referenceElement;
|
|
1366
|
+
}
|
|
1367
|
+
function getPreviousTabbable(referenceElement) {
|
|
1368
|
+
return getTabbableIn(getDocument$1(referenceElement).body, -1) || referenceElement;
|
|
1369
|
+
}
|
|
1370
|
+
function isOutsideEvent(event, container) {
|
|
1371
|
+
const containerElement = container || event.currentTarget;
|
|
1372
|
+
const relatedTarget = event.relatedTarget;
|
|
1373
|
+
return !relatedTarget || !contains(containerElement, relatedTarget);
|
|
1374
|
+
}
|
|
1375
|
+
function disableFocusInside(container) {
|
|
1376
|
+
const tabbableElements = tabbable(container, getTabbableOptions());
|
|
1377
|
+
tabbableElements.forEach(element => {
|
|
1378
|
+
element.dataset.tabindex = element.getAttribute('tabindex') || '';
|
|
1379
|
+
element.setAttribute('tabindex', '-1');
|
|
1380
|
+
});
|
|
1381
|
+
}
|
|
1382
|
+
function enableFocusInside(container) {
|
|
1383
|
+
const elements = container.querySelectorAll('[data-tabindex]');
|
|
1384
|
+
elements.forEach(element => {
|
|
1385
|
+
const tabindex = element.dataset.tabindex;
|
|
1386
|
+
delete element.dataset.tabindex;
|
|
1387
|
+
if (tabindex) {
|
|
1388
|
+
element.setAttribute('tabindex', tabindex);
|
|
1389
|
+
} else {
|
|
1390
|
+
element.removeAttribute('tabindex');
|
|
1391
|
+
}
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
1396
|
+
let {
|
|
1397
|
+
reference,
|
|
1398
|
+
floating
|
|
1399
|
+
} = _ref;
|
|
1400
|
+
const sideAxis = getSideAxis(placement);
|
|
1401
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
1402
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
1403
|
+
const side = getSide(placement);
|
|
1404
|
+
const isVertical = sideAxis === 'y';
|
|
1405
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
1406
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
1407
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
1408
|
+
let coords;
|
|
1409
|
+
switch (side) {
|
|
1410
|
+
case 'top':
|
|
1411
|
+
coords = {
|
|
1412
|
+
x: commonX,
|
|
1413
|
+
y: reference.y - floating.height
|
|
1414
|
+
};
|
|
1415
|
+
break;
|
|
1416
|
+
case 'bottom':
|
|
1417
|
+
coords = {
|
|
1418
|
+
x: commonX,
|
|
1419
|
+
y: reference.y + reference.height
|
|
1420
|
+
};
|
|
1421
|
+
break;
|
|
1422
|
+
case 'right':
|
|
1423
|
+
coords = {
|
|
1424
|
+
x: reference.x + reference.width,
|
|
1425
|
+
y: commonY
|
|
1426
|
+
};
|
|
1427
|
+
break;
|
|
1428
|
+
case 'left':
|
|
1429
|
+
coords = {
|
|
1430
|
+
x: reference.x - floating.width,
|
|
1431
|
+
y: commonY
|
|
1432
|
+
};
|
|
1433
|
+
break;
|
|
1434
|
+
default:
|
|
1435
|
+
coords = {
|
|
1436
|
+
x: reference.x,
|
|
1437
|
+
y: reference.y
|
|
1438
|
+
};
|
|
1439
|
+
}
|
|
1440
|
+
switch (getAlignment(placement)) {
|
|
1441
|
+
case 'start':
|
|
1442
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
1443
|
+
break;
|
|
1444
|
+
case 'end':
|
|
1445
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
1446
|
+
break;
|
|
1447
|
+
}
|
|
1448
|
+
return coords;
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
/**
|
|
1452
|
+
* Resolves with an object of overflow side offsets that determine how much the
|
|
1453
|
+
* element is overflowing a given clipping boundary on each side.
|
|
1454
|
+
* - positive = overflowing the boundary by that number of pixels
|
|
1455
|
+
* - negative = how many pixels left before it will overflow
|
|
1456
|
+
* - 0 = lies flush with the boundary
|
|
1457
|
+
* @see https://floating-ui.com/docs/detectOverflow
|
|
1458
|
+
*/
|
|
1459
|
+
async function detectOverflow(state, options) {
|
|
1460
|
+
var _await$platform$isEle;
|
|
1461
|
+
if (options === void 0) {
|
|
1462
|
+
options = {};
|
|
1463
|
+
}
|
|
1464
|
+
const {
|
|
1465
|
+
x,
|
|
1466
|
+
y,
|
|
1467
|
+
platform,
|
|
1468
|
+
rects,
|
|
1469
|
+
elements,
|
|
1470
|
+
strategy
|
|
1471
|
+
} = state;
|
|
1472
|
+
const {
|
|
1473
|
+
boundary = 'clippingAncestors',
|
|
1474
|
+
rootBoundary = 'viewport',
|
|
1475
|
+
elementContext = 'floating',
|
|
1476
|
+
altBoundary = false,
|
|
1477
|
+
padding = 0
|
|
1478
|
+
} = evaluate(options, state);
|
|
1479
|
+
const paddingObject = getPaddingObject(padding);
|
|
1480
|
+
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
1481
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
1482
|
+
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
1483
|
+
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
|
|
1484
|
+
boundary,
|
|
1485
|
+
rootBoundary,
|
|
1486
|
+
strategy
|
|
1487
|
+
}));
|
|
1488
|
+
const rect = elementContext === 'floating' ? {
|
|
1489
|
+
x,
|
|
1490
|
+
y,
|
|
1491
|
+
width: rects.floating.width,
|
|
1492
|
+
height: rects.floating.height
|
|
1493
|
+
} : rects.reference;
|
|
1494
|
+
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
1495
|
+
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
|
|
1496
|
+
x: 1,
|
|
1497
|
+
y: 1
|
|
1498
|
+
} : {
|
|
1499
|
+
x: 1,
|
|
1500
|
+
y: 1
|
|
1501
|
+
};
|
|
1502
|
+
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
1503
|
+
elements,
|
|
1504
|
+
rect,
|
|
1505
|
+
offsetParent,
|
|
1506
|
+
strategy
|
|
1507
|
+
}) : rect);
|
|
1508
|
+
return {
|
|
1509
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
1510
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
1511
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
1512
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
1513
|
+
};
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
// Maximum number of resets that can occur before bailing to avoid infinite reset loops.
|
|
1517
|
+
const MAX_RESET_COUNT = 50;
|
|
1518
|
+
|
|
1519
|
+
/**
|
|
1520
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
1521
|
+
* next to a given reference element.
|
|
1522
|
+
*
|
|
1523
|
+
* This export does not have any `platform` interface logic. You will need to
|
|
1524
|
+
* write one for the platform you are using Floating UI with.
|
|
1525
|
+
*/
|
|
1526
|
+
const computePosition$1 = async (reference, floating, config) => {
|
|
1527
|
+
const {
|
|
1528
|
+
placement = 'bottom',
|
|
1529
|
+
strategy = 'absolute',
|
|
1530
|
+
middleware = [],
|
|
1531
|
+
platform
|
|
1532
|
+
} = config;
|
|
1533
|
+
const platformWithDetectOverflow = platform.detectOverflow ? platform : {
|
|
1534
|
+
...platform,
|
|
1535
|
+
detectOverflow
|
|
1536
|
+
};
|
|
1537
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
1538
|
+
let rects = await platform.getElementRects({
|
|
1539
|
+
reference,
|
|
1540
|
+
floating,
|
|
1541
|
+
strategy
|
|
1542
|
+
});
|
|
1543
|
+
let {
|
|
1544
|
+
x,
|
|
1545
|
+
y
|
|
1546
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
1547
|
+
let statefulPlacement = placement;
|
|
1548
|
+
let resetCount = 0;
|
|
1549
|
+
const middlewareData = {};
|
|
1550
|
+
for (let i = 0; i < middleware.length; i++) {
|
|
1551
|
+
const currentMiddleware = middleware[i];
|
|
1552
|
+
if (!currentMiddleware) {
|
|
1553
|
+
continue;
|
|
1554
|
+
}
|
|
1555
|
+
const {
|
|
1556
|
+
name,
|
|
1557
|
+
fn
|
|
1558
|
+
} = currentMiddleware;
|
|
1559
|
+
const {
|
|
1560
|
+
x: nextX,
|
|
1561
|
+
y: nextY,
|
|
1562
|
+
data,
|
|
1563
|
+
reset
|
|
1564
|
+
} = await fn({
|
|
1565
|
+
x,
|
|
1566
|
+
y,
|
|
1567
|
+
initialPlacement: placement,
|
|
1568
|
+
placement: statefulPlacement,
|
|
1569
|
+
strategy,
|
|
1570
|
+
middlewareData,
|
|
1571
|
+
rects,
|
|
1572
|
+
platform: platformWithDetectOverflow,
|
|
1573
|
+
elements: {
|
|
1574
|
+
reference,
|
|
1575
|
+
floating
|
|
1576
|
+
}
|
|
1577
|
+
});
|
|
1578
|
+
x = nextX != null ? nextX : x;
|
|
1579
|
+
y = nextY != null ? nextY : y;
|
|
1580
|
+
middlewareData[name] = {
|
|
1581
|
+
...middlewareData[name],
|
|
1582
|
+
...data
|
|
1583
|
+
};
|
|
1584
|
+
if (reset && resetCount < MAX_RESET_COUNT) {
|
|
1585
|
+
resetCount++;
|
|
1586
|
+
if (typeof reset === 'object') {
|
|
1587
|
+
if (reset.placement) {
|
|
1588
|
+
statefulPlacement = reset.placement;
|
|
1589
|
+
}
|
|
1590
|
+
if (reset.rects) {
|
|
1591
|
+
rects = reset.rects === true ? await platform.getElementRects({
|
|
1592
|
+
reference,
|
|
1593
|
+
floating,
|
|
1594
|
+
strategy
|
|
1595
|
+
}) : reset.rects;
|
|
1596
|
+
}
|
|
1597
|
+
({
|
|
1598
|
+
x,
|
|
1599
|
+
y
|
|
1600
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
1601
|
+
}
|
|
1602
|
+
i = -1;
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
return {
|
|
1606
|
+
x,
|
|
1607
|
+
y,
|
|
1608
|
+
placement: statefulPlacement,
|
|
1609
|
+
strategy,
|
|
1610
|
+
middlewareData
|
|
1611
|
+
};
|
|
1612
|
+
};
|
|
1613
|
+
|
|
1614
|
+
/**
|
|
1615
|
+
* Provides data to position an inner element of the floating element so that it
|
|
1616
|
+
* appears centered to the reference element.
|
|
1617
|
+
* @see https://floating-ui.com/docs/arrow
|
|
1618
|
+
*/
|
|
1619
|
+
const arrow$3 = options => ({
|
|
1620
|
+
name: 'arrow',
|
|
1621
|
+
options,
|
|
1622
|
+
async fn(state) {
|
|
1623
|
+
const {
|
|
1624
|
+
x,
|
|
1625
|
+
y,
|
|
1626
|
+
placement,
|
|
1627
|
+
rects,
|
|
1628
|
+
platform,
|
|
1629
|
+
elements,
|
|
1630
|
+
middlewareData
|
|
1631
|
+
} = state;
|
|
1632
|
+
// Since `element` is required, we don't Partial<> the type.
|
|
1633
|
+
const {
|
|
1634
|
+
element,
|
|
1635
|
+
padding = 0
|
|
1636
|
+
} = evaluate(options, state) || {};
|
|
1637
|
+
if (element == null) {
|
|
1638
|
+
return {};
|
|
1639
|
+
}
|
|
1640
|
+
const paddingObject = getPaddingObject(padding);
|
|
1641
|
+
const coords = {
|
|
1642
|
+
x,
|
|
1643
|
+
y
|
|
1644
|
+
};
|
|
1645
|
+
const axis = getAlignmentAxis(placement);
|
|
1646
|
+
const length = getAxisLength(axis);
|
|
1647
|
+
const arrowDimensions = await platform.getDimensions(element);
|
|
1648
|
+
const isYAxis = axis === 'y';
|
|
1649
|
+
const minProp = isYAxis ? 'top' : 'left';
|
|
1650
|
+
const maxProp = isYAxis ? 'bottom' : 'right';
|
|
1651
|
+
const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
|
|
1652
|
+
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
|
1653
|
+
const startDiff = coords[axis] - rects.reference[axis];
|
|
1654
|
+
const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
|
|
1655
|
+
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
|
|
1656
|
+
|
|
1657
|
+
// DOM platform can return `window` as the `offsetParent`.
|
|
1658
|
+
if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
|
|
1659
|
+
clientSize = elements.floating[clientProp] || rects.floating[length];
|
|
1660
|
+
}
|
|
1661
|
+
const centerToReference = endDiff / 2 - startDiff / 2;
|
|
1662
|
+
|
|
1663
|
+
// If the padding is large enough that it causes the arrow to no longer be
|
|
1664
|
+
// centered, modify the padding so that it is centered.
|
|
1665
|
+
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
|
|
1666
|
+
const minPadding = min(paddingObject[minProp], largestPossiblePadding);
|
|
1667
|
+
const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
|
|
1668
|
+
|
|
1669
|
+
// Make sure the arrow doesn't overflow the floating element if the center
|
|
1670
|
+
// point is outside the floating element's bounds.
|
|
1671
|
+
const min$1 = minPadding;
|
|
1672
|
+
const max = clientSize - arrowDimensions[length] - maxPadding;
|
|
1673
|
+
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
1674
|
+
const offset = clamp(min$1, center, max);
|
|
1675
|
+
|
|
1676
|
+
// If the reference is small enough that the arrow's padding causes it to
|
|
1677
|
+
// to point to nothing for an aligned placement, adjust the offset of the
|
|
1678
|
+
// floating element itself. To ensure `shift()` continues to take action,
|
|
1679
|
+
// a single reset is performed when this is true.
|
|
1680
|
+
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
1681
|
+
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
|
|
1682
|
+
return {
|
|
1683
|
+
[axis]: coords[axis] + alignmentOffset,
|
|
1684
|
+
data: {
|
|
1685
|
+
[axis]: offset,
|
|
1686
|
+
centerOffset: center - offset - alignmentOffset,
|
|
1687
|
+
...(shouldAddOffset && {
|
|
1688
|
+
alignmentOffset
|
|
1689
|
+
})
|
|
1690
|
+
},
|
|
1691
|
+
reset: shouldAddOffset
|
|
1692
|
+
};
|
|
1693
|
+
}
|
|
1694
|
+
});
|
|
1695
|
+
|
|
1696
|
+
function getPlacementList(alignment, autoAlignment, allowedPlacements) {
|
|
1697
|
+
const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
|
|
1698
|
+
return allowedPlacementsSortedByAlignment.filter(placement => {
|
|
1699
|
+
if (alignment) {
|
|
1700
|
+
return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
|
|
1701
|
+
}
|
|
1702
|
+
return true;
|
|
1703
|
+
});
|
|
1704
|
+
}
|
|
1705
|
+
/**
|
|
1706
|
+
* Optimizes the visibility of the floating element by choosing the placement
|
|
1707
|
+
* that has the most space available automatically, without needing to specify a
|
|
1708
|
+
* preferred placement. Alternative to `flip`.
|
|
1709
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
1710
|
+
*/
|
|
1711
|
+
const autoPlacement$2 = function (options) {
|
|
1712
|
+
if (options === void 0) {
|
|
1713
|
+
options = {};
|
|
1714
|
+
}
|
|
1715
|
+
return {
|
|
1716
|
+
name: 'autoPlacement',
|
|
1717
|
+
options,
|
|
1718
|
+
async fn(state) {
|
|
1719
|
+
var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
|
|
1720
|
+
const {
|
|
1721
|
+
rects,
|
|
1722
|
+
middlewareData,
|
|
1723
|
+
placement,
|
|
1724
|
+
platform,
|
|
1725
|
+
elements
|
|
1726
|
+
} = state;
|
|
1727
|
+
const {
|
|
1728
|
+
crossAxis = false,
|
|
1729
|
+
alignment,
|
|
1730
|
+
allowedPlacements = placements,
|
|
1731
|
+
autoAlignment = true,
|
|
1732
|
+
...detectOverflowOptions
|
|
1733
|
+
} = evaluate(options, state);
|
|
1734
|
+
const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
|
|
1735
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
1736
|
+
const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
|
|
1737
|
+
const currentPlacement = placements$1[currentIndex];
|
|
1738
|
+
if (currentPlacement == null) {
|
|
1739
|
+
return {};
|
|
1740
|
+
}
|
|
1741
|
+
const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
|
|
1742
|
+
|
|
1743
|
+
// Make `computeCoords` start from the right place.
|
|
1744
|
+
if (placement !== currentPlacement) {
|
|
1745
|
+
return {
|
|
1746
|
+
reset: {
|
|
1747
|
+
placement: placements$1[0]
|
|
1748
|
+
}
|
|
1749
|
+
};
|
|
1750
|
+
}
|
|
1751
|
+
const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
|
|
1752
|
+
const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
|
|
1753
|
+
placement: currentPlacement,
|
|
1754
|
+
overflows: currentOverflows
|
|
1755
|
+
}];
|
|
1756
|
+
const nextPlacement = placements$1[currentIndex + 1];
|
|
1757
|
+
|
|
1758
|
+
// There are more placements to check.
|
|
1759
|
+
if (nextPlacement) {
|
|
1760
|
+
return {
|
|
1761
|
+
data: {
|
|
1762
|
+
index: currentIndex + 1,
|
|
1763
|
+
overflows: allOverflows
|
|
1764
|
+
},
|
|
1765
|
+
reset: {
|
|
1766
|
+
placement: nextPlacement
|
|
1767
|
+
}
|
|
1768
|
+
};
|
|
1769
|
+
}
|
|
1770
|
+
const placementsSortedByMostSpace = allOverflows.map(d => {
|
|
1771
|
+
const alignment = getAlignment(d.placement);
|
|
1772
|
+
return [d.placement, alignment && crossAxis ?
|
|
1773
|
+
// Check along the mainAxis and main crossAxis side.
|
|
1774
|
+
d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :
|
|
1775
|
+
// Check only the mainAxis.
|
|
1776
|
+
d.overflows[0], d.overflows];
|
|
1777
|
+
}).sort((a, b) => a[1] - b[1]);
|
|
1778
|
+
const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,
|
|
1779
|
+
// Aligned placements should not check their opposite crossAxis
|
|
1780
|
+
// side.
|
|
1781
|
+
getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));
|
|
1782
|
+
const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
|
|
1783
|
+
if (resetPlacement !== placement) {
|
|
1784
|
+
return {
|
|
1785
|
+
data: {
|
|
1786
|
+
index: currentIndex + 1,
|
|
1787
|
+
overflows: allOverflows
|
|
1788
|
+
},
|
|
1789
|
+
reset: {
|
|
1790
|
+
placement: resetPlacement
|
|
1791
|
+
}
|
|
1792
|
+
};
|
|
1793
|
+
}
|
|
1794
|
+
return {};
|
|
1795
|
+
}
|
|
1796
|
+
};
|
|
1797
|
+
};
|
|
1798
|
+
|
|
1799
|
+
/**
|
|
1800
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
1801
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
1802
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
1803
|
+
* @see https://floating-ui.com/docs/flip
|
|
1804
|
+
*/
|
|
1805
|
+
const flip$2 = function (options) {
|
|
1806
|
+
if (options === void 0) {
|
|
1807
|
+
options = {};
|
|
1808
|
+
}
|
|
1809
|
+
return {
|
|
1810
|
+
name: 'flip',
|
|
1811
|
+
options,
|
|
1812
|
+
async fn(state) {
|
|
1813
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
1814
|
+
const {
|
|
1815
|
+
placement,
|
|
1816
|
+
middlewareData,
|
|
1817
|
+
rects,
|
|
1818
|
+
initialPlacement,
|
|
1819
|
+
platform,
|
|
1820
|
+
elements
|
|
1821
|
+
} = state;
|
|
1822
|
+
const {
|
|
1823
|
+
mainAxis: checkMainAxis = true,
|
|
1824
|
+
crossAxis: checkCrossAxis = true,
|
|
1825
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
1826
|
+
fallbackStrategy = 'bestFit',
|
|
1827
|
+
fallbackAxisSideDirection = 'none',
|
|
1828
|
+
flipAlignment = true,
|
|
1829
|
+
...detectOverflowOptions
|
|
1830
|
+
} = evaluate(options, state);
|
|
1831
|
+
|
|
1832
|
+
// If a reset by the arrow was caused due to an alignment offset being
|
|
1833
|
+
// added, we should skip any logic now since `flip()` has already done its
|
|
1834
|
+
// work.
|
|
1835
|
+
// https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
|
|
1836
|
+
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
1837
|
+
return {};
|
|
1838
|
+
}
|
|
1839
|
+
const side = getSide(placement);
|
|
1840
|
+
const initialSideAxis = getSideAxis(initialPlacement);
|
|
1841
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
1842
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
1843
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
1844
|
+
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
|
|
1845
|
+
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
1846
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
1847
|
+
}
|
|
1848
|
+
const placements = [initialPlacement, ...fallbackPlacements];
|
|
1849
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
1850
|
+
const overflows = [];
|
|
1851
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
1852
|
+
if (checkMainAxis) {
|
|
1853
|
+
overflows.push(overflow[side]);
|
|
1854
|
+
}
|
|
1855
|
+
if (checkCrossAxis) {
|
|
1856
|
+
const sides = getAlignmentSides(placement, rects, rtl);
|
|
1857
|
+
overflows.push(overflow[sides[0]], overflow[sides[1]]);
|
|
1858
|
+
}
|
|
1859
|
+
overflowsData = [...overflowsData, {
|
|
1860
|
+
placement,
|
|
1861
|
+
overflows
|
|
1862
|
+
}];
|
|
1863
|
+
|
|
1864
|
+
// One or more sides is overflowing.
|
|
1865
|
+
if (!overflows.every(side => side <= 0)) {
|
|
1866
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
1867
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
1868
|
+
const nextPlacement = placements[nextIndex];
|
|
1869
|
+
if (nextPlacement) {
|
|
1870
|
+
const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
|
|
1871
|
+
if (!ignoreCrossAxisOverflow ||
|
|
1872
|
+
// We leave the current main axis only if every placement on that axis
|
|
1873
|
+
// overflows the main axis.
|
|
1874
|
+
overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
|
|
1875
|
+
// Try next placement and re-run the lifecycle.
|
|
1876
|
+
return {
|
|
1877
|
+
data: {
|
|
1878
|
+
index: nextIndex,
|
|
1879
|
+
overflows: overflowsData
|
|
1880
|
+
},
|
|
1881
|
+
reset: {
|
|
1882
|
+
placement: nextPlacement
|
|
1883
|
+
}
|
|
1884
|
+
};
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
// First, find the candidates that fit on the mainAxis side of overflow,
|
|
1889
|
+
// then find the placement that fits the best on the main crossAxis side.
|
|
1890
|
+
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;
|
|
1891
|
+
|
|
1892
|
+
// Otherwise fallback.
|
|
1893
|
+
if (!resetPlacement) {
|
|
1894
|
+
switch (fallbackStrategy) {
|
|
1895
|
+
case 'bestFit':
|
|
1896
|
+
{
|
|
1897
|
+
var _overflowsData$filter2;
|
|
1898
|
+
const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
|
|
1899
|
+
if (hasFallbackAxisSideDirection) {
|
|
1900
|
+
const currentSideAxis = getSideAxis(d.placement);
|
|
1901
|
+
return currentSideAxis === initialSideAxis ||
|
|
1902
|
+
// Create a bias to the `y` side axis due to horizontal
|
|
1903
|
+
// reading directions favoring greater width.
|
|
1904
|
+
currentSideAxis === 'y';
|
|
1905
|
+
}
|
|
1906
|
+
return true;
|
|
1907
|
+
}).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
1908
|
+
if (placement) {
|
|
1909
|
+
resetPlacement = placement;
|
|
1910
|
+
}
|
|
1911
|
+
break;
|
|
1912
|
+
}
|
|
1913
|
+
case 'initialPlacement':
|
|
1914
|
+
resetPlacement = initialPlacement;
|
|
1915
|
+
break;
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
if (placement !== resetPlacement) {
|
|
1919
|
+
return {
|
|
1920
|
+
reset: {
|
|
1921
|
+
placement: resetPlacement
|
|
1922
|
+
}
|
|
1923
|
+
};
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
return {};
|
|
1927
|
+
}
|
|
1928
|
+
};
|
|
1929
|
+
};
|
|
1930
|
+
|
|
1931
|
+
function getSideOffsets(overflow, rect) {
|
|
1932
|
+
return {
|
|
1933
|
+
top: overflow.top - rect.height,
|
|
1934
|
+
right: overflow.right - rect.width,
|
|
1935
|
+
bottom: overflow.bottom - rect.height,
|
|
1936
|
+
left: overflow.left - rect.width
|
|
1937
|
+
};
|
|
1938
|
+
}
|
|
1939
|
+
function isAnySideFullyClipped(overflow) {
|
|
1940
|
+
return sides.some(side => overflow[side] >= 0);
|
|
1941
|
+
}
|
|
1942
|
+
/**
|
|
1943
|
+
* Provides data to hide the floating element in applicable situations, such as
|
|
1944
|
+
* when it is not in the same clipping context as the reference element.
|
|
1945
|
+
* @see https://floating-ui.com/docs/hide
|
|
1946
|
+
*/
|
|
1947
|
+
const hide$2 = function (options) {
|
|
1948
|
+
if (options === void 0) {
|
|
1949
|
+
options = {};
|
|
1950
|
+
}
|
|
1951
|
+
return {
|
|
1952
|
+
name: 'hide',
|
|
1953
|
+
options,
|
|
1954
|
+
async fn(state) {
|
|
1955
|
+
const {
|
|
1956
|
+
rects,
|
|
1957
|
+
platform
|
|
1958
|
+
} = state;
|
|
1959
|
+
const {
|
|
1960
|
+
strategy = 'referenceHidden',
|
|
1961
|
+
...detectOverflowOptions
|
|
1962
|
+
} = evaluate(options, state);
|
|
1963
|
+
switch (strategy) {
|
|
1964
|
+
case 'referenceHidden':
|
|
1965
|
+
{
|
|
1966
|
+
const overflow = await platform.detectOverflow(state, {
|
|
1967
|
+
...detectOverflowOptions,
|
|
1968
|
+
elementContext: 'reference'
|
|
1969
|
+
});
|
|
1970
|
+
const offsets = getSideOffsets(overflow, rects.reference);
|
|
1971
|
+
return {
|
|
1972
|
+
data: {
|
|
1973
|
+
referenceHiddenOffsets: offsets,
|
|
1974
|
+
referenceHidden: isAnySideFullyClipped(offsets)
|
|
1975
|
+
}
|
|
1976
|
+
};
|
|
1977
|
+
}
|
|
1978
|
+
case 'escaped':
|
|
1979
|
+
{
|
|
1980
|
+
const overflow = await platform.detectOverflow(state, {
|
|
1981
|
+
...detectOverflowOptions,
|
|
1982
|
+
altBoundary: true
|
|
1983
|
+
});
|
|
1984
|
+
const offsets = getSideOffsets(overflow, rects.floating);
|
|
1985
|
+
return {
|
|
1986
|
+
data: {
|
|
1987
|
+
escapedOffsets: offsets,
|
|
1988
|
+
escaped: isAnySideFullyClipped(offsets)
|
|
1989
|
+
}
|
|
1990
|
+
};
|
|
1991
|
+
}
|
|
1992
|
+
default:
|
|
1993
|
+
{
|
|
1994
|
+
return {};
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
};
|
|
1999
|
+
};
|
|
2000
|
+
|
|
2001
|
+
const originSides = /*#__PURE__*/new Set(['left', 'top']);
|
|
2002
|
+
|
|
2003
|
+
// For type backwards-compatibility, the `OffsetOptions` type was also
|
|
2004
|
+
// Derivable.
|
|
2005
|
+
|
|
2006
|
+
async function convertValueToCoords(state, options) {
|
|
2007
|
+
const {
|
|
2008
|
+
placement,
|
|
2009
|
+
platform,
|
|
2010
|
+
elements
|
|
2011
|
+
} = state;
|
|
2012
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
2013
|
+
const side = getSide(placement);
|
|
2014
|
+
const alignment = getAlignment(placement);
|
|
2015
|
+
const isVertical = getSideAxis(placement) === 'y';
|
|
2016
|
+
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
2017
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
2018
|
+
const rawValue = evaluate(options, state);
|
|
2019
|
+
|
|
2020
|
+
// eslint-disable-next-line prefer-const
|
|
2021
|
+
let {
|
|
2022
|
+
mainAxis,
|
|
2023
|
+
crossAxis,
|
|
2024
|
+
alignmentAxis
|
|
2025
|
+
} = typeof rawValue === 'number' ? {
|
|
2026
|
+
mainAxis: rawValue,
|
|
2027
|
+
crossAxis: 0,
|
|
2028
|
+
alignmentAxis: null
|
|
2029
|
+
} : {
|
|
2030
|
+
mainAxis: rawValue.mainAxis || 0,
|
|
2031
|
+
crossAxis: rawValue.crossAxis || 0,
|
|
2032
|
+
alignmentAxis: rawValue.alignmentAxis
|
|
2033
|
+
};
|
|
2034
|
+
if (alignment && typeof alignmentAxis === 'number') {
|
|
2035
|
+
crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
|
|
2036
|
+
}
|
|
2037
|
+
return isVertical ? {
|
|
2038
|
+
x: crossAxis * crossAxisMulti,
|
|
2039
|
+
y: mainAxis * mainAxisMulti
|
|
2040
|
+
} : {
|
|
2041
|
+
x: mainAxis * mainAxisMulti,
|
|
2042
|
+
y: crossAxis * crossAxisMulti
|
|
2043
|
+
};
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
/**
|
|
2047
|
+
* Modifies the placement by translating the floating element along the
|
|
2048
|
+
* specified axes.
|
|
2049
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
2050
|
+
* object may be passed.
|
|
2051
|
+
* @see https://floating-ui.com/docs/offset
|
|
2052
|
+
*/
|
|
2053
|
+
const offset$2 = function (options) {
|
|
2054
|
+
if (options === void 0) {
|
|
2055
|
+
options = 0;
|
|
2056
|
+
}
|
|
2057
|
+
return {
|
|
2058
|
+
name: 'offset',
|
|
2059
|
+
options,
|
|
2060
|
+
async fn(state) {
|
|
2061
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
2062
|
+
const {
|
|
2063
|
+
x,
|
|
2064
|
+
y,
|
|
2065
|
+
placement,
|
|
2066
|
+
middlewareData
|
|
2067
|
+
} = state;
|
|
2068
|
+
const diffCoords = await convertValueToCoords(state, options);
|
|
2069
|
+
|
|
2070
|
+
// If the placement is the same and the arrow caused an alignment offset
|
|
2071
|
+
// then we don't need to change the positioning coordinates.
|
|
2072
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
2073
|
+
return {};
|
|
2074
|
+
}
|
|
2075
|
+
return {
|
|
2076
|
+
x: x + diffCoords.x,
|
|
2077
|
+
y: y + diffCoords.y,
|
|
2078
|
+
data: {
|
|
2079
|
+
...diffCoords,
|
|
2080
|
+
placement
|
|
2081
|
+
}
|
|
2082
|
+
};
|
|
2083
|
+
}
|
|
2084
|
+
};
|
|
2085
|
+
};
|
|
2086
|
+
|
|
2087
|
+
/**
|
|
2088
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
2089
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
2090
|
+
* @see https://floating-ui.com/docs/shift
|
|
2091
|
+
*/
|
|
2092
|
+
const shift$2 = function (options) {
|
|
2093
|
+
if (options === void 0) {
|
|
2094
|
+
options = {};
|
|
2095
|
+
}
|
|
2096
|
+
return {
|
|
2097
|
+
name: 'shift',
|
|
2098
|
+
options,
|
|
2099
|
+
async fn(state) {
|
|
2100
|
+
const {
|
|
2101
|
+
x,
|
|
2102
|
+
y,
|
|
2103
|
+
placement,
|
|
2104
|
+
platform
|
|
2105
|
+
} = state;
|
|
2106
|
+
const {
|
|
2107
|
+
mainAxis: checkMainAxis = true,
|
|
2108
|
+
crossAxis: checkCrossAxis = false,
|
|
2109
|
+
limiter = {
|
|
2110
|
+
fn: _ref => {
|
|
2111
|
+
let {
|
|
2112
|
+
x,
|
|
2113
|
+
y
|
|
2114
|
+
} = _ref;
|
|
2115
|
+
return {
|
|
2116
|
+
x,
|
|
2117
|
+
y
|
|
2118
|
+
};
|
|
2119
|
+
}
|
|
2120
|
+
},
|
|
2121
|
+
...detectOverflowOptions
|
|
2122
|
+
} = evaluate(options, state);
|
|
2123
|
+
const coords = {
|
|
2124
|
+
x,
|
|
2125
|
+
y
|
|
2126
|
+
};
|
|
2127
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
2128
|
+
const crossAxis = getSideAxis(getSide(placement));
|
|
2129
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
2130
|
+
let mainAxisCoord = coords[mainAxis];
|
|
2131
|
+
let crossAxisCoord = coords[crossAxis];
|
|
2132
|
+
if (checkMainAxis) {
|
|
2133
|
+
const minSide = mainAxis === 'y' ? 'top' : 'left';
|
|
2134
|
+
const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
|
|
2135
|
+
const min = mainAxisCoord + overflow[minSide];
|
|
2136
|
+
const max = mainAxisCoord - overflow[maxSide];
|
|
2137
|
+
mainAxisCoord = clamp(min, mainAxisCoord, max);
|
|
2138
|
+
}
|
|
2139
|
+
if (checkCrossAxis) {
|
|
2140
|
+
const minSide = crossAxis === 'y' ? 'top' : 'left';
|
|
2141
|
+
const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
|
|
2142
|
+
const min = crossAxisCoord + overflow[minSide];
|
|
2143
|
+
const max = crossAxisCoord - overflow[maxSide];
|
|
2144
|
+
crossAxisCoord = clamp(min, crossAxisCoord, max);
|
|
2145
|
+
}
|
|
2146
|
+
const limitedCoords = limiter.fn({
|
|
2147
|
+
...state,
|
|
2148
|
+
[mainAxis]: mainAxisCoord,
|
|
2149
|
+
[crossAxis]: crossAxisCoord
|
|
2150
|
+
});
|
|
2151
|
+
return {
|
|
2152
|
+
...limitedCoords,
|
|
2153
|
+
data: {
|
|
2154
|
+
x: limitedCoords.x - x,
|
|
2155
|
+
y: limitedCoords.y - y,
|
|
2156
|
+
enabled: {
|
|
2157
|
+
[mainAxis]: checkMainAxis,
|
|
2158
|
+
[crossAxis]: checkCrossAxis
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2161
|
+
};
|
|
2162
|
+
}
|
|
2163
|
+
};
|
|
2164
|
+
};
|
|
2165
|
+
/**
|
|
2166
|
+
* Built-in `limiter` that will stop `shift()` at a certain point.
|
|
2167
|
+
*/
|
|
2168
|
+
const limitShift$2 = function (options) {
|
|
2169
|
+
if (options === void 0) {
|
|
2170
|
+
options = {};
|
|
2171
|
+
}
|
|
2172
|
+
return {
|
|
2173
|
+
options,
|
|
2174
|
+
fn(state) {
|
|
2175
|
+
const {
|
|
2176
|
+
x,
|
|
2177
|
+
y,
|
|
2178
|
+
placement,
|
|
2179
|
+
rects,
|
|
2180
|
+
middlewareData
|
|
2181
|
+
} = state;
|
|
2182
|
+
const {
|
|
2183
|
+
offset = 0,
|
|
2184
|
+
mainAxis: checkMainAxis = true,
|
|
2185
|
+
crossAxis: checkCrossAxis = true
|
|
2186
|
+
} = evaluate(options, state);
|
|
2187
|
+
const coords = {
|
|
2188
|
+
x,
|
|
2189
|
+
y
|
|
2190
|
+
};
|
|
2191
|
+
const crossAxis = getSideAxis(placement);
|
|
2192
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
2193
|
+
let mainAxisCoord = coords[mainAxis];
|
|
2194
|
+
let crossAxisCoord = coords[crossAxis];
|
|
2195
|
+
const rawOffset = evaluate(offset, state);
|
|
2196
|
+
const computedOffset = typeof rawOffset === 'number' ? {
|
|
2197
|
+
mainAxis: rawOffset,
|
|
2198
|
+
crossAxis: 0
|
|
2199
|
+
} : {
|
|
2200
|
+
mainAxis: 0,
|
|
2201
|
+
crossAxis: 0,
|
|
2202
|
+
...rawOffset
|
|
2203
|
+
};
|
|
2204
|
+
if (checkMainAxis) {
|
|
2205
|
+
const len = mainAxis === 'y' ? 'height' : 'width';
|
|
2206
|
+
const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
|
|
2207
|
+
const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
|
|
2208
|
+
if (mainAxisCoord < limitMin) {
|
|
2209
|
+
mainAxisCoord = limitMin;
|
|
2210
|
+
} else if (mainAxisCoord > limitMax) {
|
|
2211
|
+
mainAxisCoord = limitMax;
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
if (checkCrossAxis) {
|
|
2215
|
+
var _middlewareData$offse, _middlewareData$offse2;
|
|
2216
|
+
const len = mainAxis === 'y' ? 'width' : 'height';
|
|
2217
|
+
const isOriginSide = originSides.has(getSide(placement));
|
|
2218
|
+
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);
|
|
2219
|
+
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);
|
|
2220
|
+
if (crossAxisCoord < limitMin) {
|
|
2221
|
+
crossAxisCoord = limitMin;
|
|
2222
|
+
} else if (crossAxisCoord > limitMax) {
|
|
2223
|
+
crossAxisCoord = limitMax;
|
|
2224
|
+
}
|
|
2225
|
+
}
|
|
2226
|
+
return {
|
|
2227
|
+
[mainAxis]: mainAxisCoord,
|
|
2228
|
+
[crossAxis]: crossAxisCoord
|
|
2229
|
+
};
|
|
2230
|
+
}
|
|
2231
|
+
};
|
|
2232
|
+
};
|
|
2233
|
+
|
|
2234
|
+
/**
|
|
2235
|
+
* Provides data that allows you to change the size of the floating element —
|
|
2236
|
+
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
2237
|
+
* width of the reference element.
|
|
2238
|
+
* @see https://floating-ui.com/docs/size
|
|
2239
|
+
*/
|
|
2240
|
+
const size$2 = function (options) {
|
|
2241
|
+
if (options === void 0) {
|
|
2242
|
+
options = {};
|
|
2243
|
+
}
|
|
2244
|
+
return {
|
|
2245
|
+
name: 'size',
|
|
2246
|
+
options,
|
|
2247
|
+
async fn(state) {
|
|
2248
|
+
var _state$middlewareData, _state$middlewareData2;
|
|
2249
|
+
const {
|
|
2250
|
+
placement,
|
|
2251
|
+
rects,
|
|
2252
|
+
platform,
|
|
2253
|
+
elements
|
|
2254
|
+
} = state;
|
|
2255
|
+
const {
|
|
2256
|
+
apply = () => {},
|
|
2257
|
+
...detectOverflowOptions
|
|
2258
|
+
} = evaluate(options, state);
|
|
2259
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
2260
|
+
const side = getSide(placement);
|
|
2261
|
+
const alignment = getAlignment(placement);
|
|
2262
|
+
const isYAxis = getSideAxis(placement) === 'y';
|
|
2263
|
+
const {
|
|
2264
|
+
width,
|
|
2265
|
+
height
|
|
2266
|
+
} = rects.floating;
|
|
2267
|
+
let heightSide;
|
|
2268
|
+
let widthSide;
|
|
2269
|
+
if (side === 'top' || side === 'bottom') {
|
|
2270
|
+
heightSide = side;
|
|
2271
|
+
widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
|
|
2272
|
+
} else {
|
|
2273
|
+
widthSide = side;
|
|
2274
|
+
heightSide = alignment === 'end' ? 'top' : 'bottom';
|
|
2275
|
+
}
|
|
2276
|
+
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
2277
|
+
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
2278
|
+
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
|
|
2279
|
+
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
|
|
2280
|
+
const noShift = !state.middlewareData.shift;
|
|
2281
|
+
let availableHeight = overflowAvailableHeight;
|
|
2282
|
+
let availableWidth = overflowAvailableWidth;
|
|
2283
|
+
if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
|
|
2284
|
+
availableWidth = maximumClippingWidth;
|
|
2285
|
+
}
|
|
2286
|
+
if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
|
|
2287
|
+
availableHeight = maximumClippingHeight;
|
|
2288
|
+
}
|
|
2289
|
+
if (noShift && !alignment) {
|
|
2290
|
+
const xMin = max(overflow.left, 0);
|
|
2291
|
+
const xMax = max(overflow.right, 0);
|
|
2292
|
+
const yMin = max(overflow.top, 0);
|
|
2293
|
+
const yMax = max(overflow.bottom, 0);
|
|
2294
|
+
if (isYAxis) {
|
|
2295
|
+
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
2296
|
+
} else {
|
|
2297
|
+
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
2300
|
+
await apply({
|
|
2301
|
+
...state,
|
|
2302
|
+
availableWidth,
|
|
2303
|
+
availableHeight
|
|
2304
|
+
});
|
|
2305
|
+
const nextDimensions = await platform.getDimensions(elements.floating);
|
|
2306
|
+
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
2307
|
+
return {
|
|
2308
|
+
reset: {
|
|
2309
|
+
rects: true
|
|
2310
|
+
}
|
|
2311
|
+
};
|
|
2312
|
+
}
|
|
2313
|
+
return {};
|
|
2314
|
+
}
|
|
2315
|
+
};
|
|
2316
|
+
};
|
|
2317
|
+
|
|
2318
|
+
function getCssDimensions(element) {
|
|
2319
|
+
const css = getComputedStyle$1(element);
|
|
2320
|
+
// In testing environments, the `width` and `height` properties are empty
|
|
2321
|
+
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
2322
|
+
let width = parseFloat(css.width) || 0;
|
|
2323
|
+
let height = parseFloat(css.height) || 0;
|
|
2324
|
+
const hasOffset = isHTMLElement(element);
|
|
2325
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
2326
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
2327
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
2328
|
+
if (shouldFallback) {
|
|
2329
|
+
width = offsetWidth;
|
|
2330
|
+
height = offsetHeight;
|
|
2331
|
+
}
|
|
2332
|
+
return {
|
|
2333
|
+
width,
|
|
2334
|
+
height,
|
|
2335
|
+
$: shouldFallback
|
|
2336
|
+
};
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2339
|
+
function unwrapElement(element) {
|
|
2340
|
+
return !isElement(element) ? element.contextElement : element;
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2343
|
+
function getScale(element) {
|
|
2344
|
+
const domElement = unwrapElement(element);
|
|
2345
|
+
if (!isHTMLElement(domElement)) {
|
|
2346
|
+
return createCoords(1);
|
|
2347
|
+
}
|
|
2348
|
+
const rect = domElement.getBoundingClientRect();
|
|
2349
|
+
const {
|
|
2350
|
+
width,
|
|
2351
|
+
height,
|
|
2352
|
+
$
|
|
2353
|
+
} = getCssDimensions(domElement);
|
|
2354
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
2355
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
2356
|
+
|
|
2357
|
+
// 0, NaN, or Infinity should always fallback to 1.
|
|
2358
|
+
|
|
2359
|
+
if (!x || !Number.isFinite(x)) {
|
|
2360
|
+
x = 1;
|
|
2361
|
+
}
|
|
2362
|
+
if (!y || !Number.isFinite(y)) {
|
|
2363
|
+
y = 1;
|
|
2364
|
+
}
|
|
2365
|
+
return {
|
|
2366
|
+
x,
|
|
2367
|
+
y
|
|
2368
|
+
};
|
|
2369
|
+
}
|
|
2370
|
+
|
|
2371
|
+
const noOffsets = /*#__PURE__*/createCoords(0);
|
|
2372
|
+
function getVisualOffsets(element) {
|
|
2373
|
+
const win = getWindow(element);
|
|
2374
|
+
if (!isWebKit() || !win.visualViewport) {
|
|
2375
|
+
return noOffsets;
|
|
2376
|
+
}
|
|
2377
|
+
return {
|
|
2378
|
+
x: win.visualViewport.offsetLeft,
|
|
2379
|
+
y: win.visualViewport.offsetTop
|
|
2380
|
+
};
|
|
2381
|
+
}
|
|
2382
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
2383
|
+
if (isFixed === void 0) {
|
|
2384
|
+
isFixed = false;
|
|
2385
|
+
}
|
|
2386
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
2387
|
+
return false;
|
|
2388
|
+
}
|
|
2389
|
+
return isFixed;
|
|
2390
|
+
}
|
|
2391
|
+
|
|
2392
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
2393
|
+
if (includeScale === void 0) {
|
|
2394
|
+
includeScale = false;
|
|
2395
|
+
}
|
|
2396
|
+
if (isFixedStrategy === void 0) {
|
|
2397
|
+
isFixedStrategy = false;
|
|
2398
|
+
}
|
|
2399
|
+
const clientRect = element.getBoundingClientRect();
|
|
2400
|
+
const domElement = unwrapElement(element);
|
|
2401
|
+
let scale = createCoords(1);
|
|
2402
|
+
if (includeScale) {
|
|
2403
|
+
if (offsetParent) {
|
|
2404
|
+
if (isElement(offsetParent)) {
|
|
2405
|
+
scale = getScale(offsetParent);
|
|
2406
|
+
}
|
|
2407
|
+
} else {
|
|
2408
|
+
scale = getScale(element);
|
|
2409
|
+
}
|
|
2410
|
+
}
|
|
2411
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
2412
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
2413
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
2414
|
+
let width = clientRect.width / scale.x;
|
|
2415
|
+
let height = clientRect.height / scale.y;
|
|
2416
|
+
if (domElement) {
|
|
2417
|
+
const win = getWindow(domElement);
|
|
2418
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
2419
|
+
let currentWin = win;
|
|
2420
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
2421
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
2422
|
+
const iframeScale = getScale(currentIFrame);
|
|
2423
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
2424
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
2425
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
2426
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
2427
|
+
x *= iframeScale.x;
|
|
2428
|
+
y *= iframeScale.y;
|
|
2429
|
+
width *= iframeScale.x;
|
|
2430
|
+
height *= iframeScale.y;
|
|
2431
|
+
x += left;
|
|
2432
|
+
y += top;
|
|
2433
|
+
currentWin = getWindow(currentIFrame);
|
|
2434
|
+
currentIFrame = getFrameElement(currentWin);
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
return rectToClientRect({
|
|
2438
|
+
width,
|
|
2439
|
+
height,
|
|
2440
|
+
x,
|
|
2441
|
+
y
|
|
2442
|
+
});
|
|
2443
|
+
}
|
|
2444
|
+
|
|
2445
|
+
// If <html> has a CSS width greater than the viewport, then this will be
|
|
2446
|
+
// incorrect for RTL.
|
|
2447
|
+
function getWindowScrollBarX(element, rect) {
|
|
2448
|
+
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
2449
|
+
if (!rect) {
|
|
2450
|
+
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
2451
|
+
}
|
|
2452
|
+
return rect.left + leftScroll;
|
|
2453
|
+
}
|
|
2454
|
+
|
|
2455
|
+
function getHTMLOffset(documentElement, scroll) {
|
|
2456
|
+
const htmlRect = documentElement.getBoundingClientRect();
|
|
2457
|
+
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
|
2458
|
+
const y = htmlRect.top + scroll.scrollTop;
|
|
2459
|
+
return {
|
|
2460
|
+
x,
|
|
2461
|
+
y
|
|
2462
|
+
};
|
|
2463
|
+
}
|
|
2464
|
+
|
|
2465
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
2466
|
+
let {
|
|
2467
|
+
elements,
|
|
2468
|
+
rect,
|
|
2469
|
+
offsetParent,
|
|
2470
|
+
strategy
|
|
2471
|
+
} = _ref;
|
|
2472
|
+
const isFixed = strategy === 'fixed';
|
|
2473
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
2474
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
2475
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
2476
|
+
return rect;
|
|
2477
|
+
}
|
|
2478
|
+
let scroll = {
|
|
2479
|
+
scrollLeft: 0,
|
|
2480
|
+
scrollTop: 0
|
|
2481
|
+
};
|
|
2482
|
+
let scale = createCoords(1);
|
|
2483
|
+
const offsets = createCoords(0);
|
|
2484
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
2485
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
2486
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
2487
|
+
scroll = getNodeScroll(offsetParent);
|
|
2488
|
+
}
|
|
2489
|
+
if (isOffsetParentAnElement) {
|
|
2490
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
2491
|
+
scale = getScale(offsetParent);
|
|
2492
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
2493
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
2497
|
+
return {
|
|
2498
|
+
width: rect.width * scale.x,
|
|
2499
|
+
height: rect.height * scale.y,
|
|
2500
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
2501
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
2502
|
+
};
|
|
2503
|
+
}
|
|
2504
|
+
|
|
2505
|
+
function getClientRects(element) {
|
|
2506
|
+
return Array.from(element.getClientRects());
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
// Gets the entire size of the scrollable document area, even extending outside
|
|
2510
|
+
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
|
2511
|
+
function getDocumentRect(element) {
|
|
2512
|
+
const html = getDocumentElement(element);
|
|
2513
|
+
const scroll = getNodeScroll(element);
|
|
2514
|
+
const body = element.ownerDocument.body;
|
|
2515
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
2516
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
2517
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
2518
|
+
const y = -scroll.scrollTop;
|
|
2519
|
+
if (getComputedStyle$1(body).direction === 'rtl') {
|
|
2520
|
+
x += max(html.clientWidth, body.clientWidth) - width;
|
|
2521
|
+
}
|
|
2522
|
+
return {
|
|
2523
|
+
width,
|
|
2524
|
+
height,
|
|
2525
|
+
x,
|
|
2526
|
+
y
|
|
2527
|
+
};
|
|
2528
|
+
}
|
|
2529
|
+
|
|
2530
|
+
// Safety check: ensure the scrollbar space is reasonable in case this
|
|
2531
|
+
// calculation is affected by unusual styles.
|
|
2532
|
+
// Most scrollbars leave 15-18px of space.
|
|
2533
|
+
const SCROLLBAR_MAX = 25;
|
|
2534
|
+
function getViewportRect(element, strategy) {
|
|
2535
|
+
const win = getWindow(element);
|
|
2536
|
+
const html = getDocumentElement(element);
|
|
2537
|
+
const visualViewport = win.visualViewport;
|
|
2538
|
+
let width = html.clientWidth;
|
|
2539
|
+
let height = html.clientHeight;
|
|
2540
|
+
let x = 0;
|
|
2541
|
+
let y = 0;
|
|
2542
|
+
if (visualViewport) {
|
|
2543
|
+
width = visualViewport.width;
|
|
2544
|
+
height = visualViewport.height;
|
|
2545
|
+
const visualViewportBased = isWebKit();
|
|
2546
|
+
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
|
|
2547
|
+
x = visualViewport.offsetLeft;
|
|
2548
|
+
y = visualViewport.offsetTop;
|
|
2549
|
+
}
|
|
2550
|
+
}
|
|
2551
|
+
const windowScrollbarX = getWindowScrollBarX(html);
|
|
2552
|
+
// <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
|
|
2553
|
+
// visual width of the <html> but this is not considered in the size
|
|
2554
|
+
// of `html.clientWidth`.
|
|
2555
|
+
if (windowScrollbarX <= 0) {
|
|
2556
|
+
const doc = html.ownerDocument;
|
|
2557
|
+
const body = doc.body;
|
|
2558
|
+
const bodyStyles = getComputedStyle(body);
|
|
2559
|
+
const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
2560
|
+
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
2561
|
+
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
|
2562
|
+
width -= clippingStableScrollbarWidth;
|
|
2563
|
+
}
|
|
2564
|
+
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
|
2565
|
+
// If the <body> scrollbar is on the left, the width needs to be extended
|
|
2566
|
+
// by the scrollbar amount so there isn't extra space on the right.
|
|
2567
|
+
width += windowScrollbarX;
|
|
2568
|
+
}
|
|
2569
|
+
return {
|
|
2570
|
+
width,
|
|
2571
|
+
height,
|
|
2572
|
+
x,
|
|
2573
|
+
y
|
|
2574
|
+
};
|
|
2575
|
+
}
|
|
2576
|
+
|
|
2577
|
+
// Returns the inner client rect, subtracting scrollbars if present.
|
|
2578
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
2579
|
+
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
2580
|
+
const top = clientRect.top + element.clientTop;
|
|
2581
|
+
const left = clientRect.left + element.clientLeft;
|
|
2582
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
2583
|
+
const width = element.clientWidth * scale.x;
|
|
2584
|
+
const height = element.clientHeight * scale.y;
|
|
2585
|
+
const x = left * scale.x;
|
|
2586
|
+
const y = top * scale.y;
|
|
2587
|
+
return {
|
|
2588
|
+
width,
|
|
2589
|
+
height,
|
|
2590
|
+
x,
|
|
2591
|
+
y
|
|
2592
|
+
};
|
|
2593
|
+
}
|
|
2594
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
2595
|
+
let rect;
|
|
2596
|
+
if (clippingAncestor === 'viewport') {
|
|
2597
|
+
rect = getViewportRect(element, strategy);
|
|
2598
|
+
} else if (clippingAncestor === 'document') {
|
|
2599
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
2600
|
+
} else if (isElement(clippingAncestor)) {
|
|
2601
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
2602
|
+
} else {
|
|
2603
|
+
const visualOffsets = getVisualOffsets(element);
|
|
2604
|
+
rect = {
|
|
2605
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
2606
|
+
y: clippingAncestor.y - visualOffsets.y,
|
|
2607
|
+
width: clippingAncestor.width,
|
|
2608
|
+
height: clippingAncestor.height
|
|
2609
|
+
};
|
|
2610
|
+
}
|
|
2611
|
+
return rectToClientRect(rect);
|
|
2612
|
+
}
|
|
2613
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
2614
|
+
const parentNode = getParentNode(element);
|
|
2615
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
2616
|
+
return false;
|
|
2617
|
+
}
|
|
2618
|
+
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
2622
|
+
// clipping (or hiding) child elements. This returns all clipping ancestors
|
|
2623
|
+
// of the given element up the tree.
|
|
2624
|
+
function getClippingElementAncestors(element, cache) {
|
|
2625
|
+
const cachedResult = cache.get(element);
|
|
2626
|
+
if (cachedResult) {
|
|
2627
|
+
return cachedResult;
|
|
2628
|
+
}
|
|
2629
|
+
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
2630
|
+
let currentContainingBlockComputedStyle = null;
|
|
2631
|
+
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
2632
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
2633
|
+
|
|
2634
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
2635
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
2636
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
2637
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
2638
|
+
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
2639
|
+
currentContainingBlockComputedStyle = null;
|
|
2640
|
+
}
|
|
2641
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
2642
|
+
if (shouldDropCurrentNode) {
|
|
2643
|
+
// Drop non-containing blocks.
|
|
2644
|
+
result = result.filter(ancestor => ancestor !== currentNode);
|
|
2645
|
+
} else {
|
|
2646
|
+
// Record last containing block for next iteration.
|
|
2647
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
2648
|
+
}
|
|
2649
|
+
currentNode = getParentNode(currentNode);
|
|
2650
|
+
}
|
|
2651
|
+
cache.set(element, result);
|
|
2652
|
+
return result;
|
|
2653
|
+
}
|
|
2654
|
+
|
|
2655
|
+
// Gets the maximum area that the element is visible in due to any number of
|
|
2656
|
+
// clipping ancestors.
|
|
2657
|
+
function getClippingRect(_ref) {
|
|
2658
|
+
let {
|
|
2659
|
+
element,
|
|
2660
|
+
boundary,
|
|
2661
|
+
rootBoundary,
|
|
2662
|
+
strategy
|
|
2663
|
+
} = _ref;
|
|
2664
|
+
const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
2665
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
2666
|
+
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
|
|
2667
|
+
let top = firstRect.top;
|
|
2668
|
+
let right = firstRect.right;
|
|
2669
|
+
let bottom = firstRect.bottom;
|
|
2670
|
+
let left = firstRect.left;
|
|
2671
|
+
for (let i = 1; i < clippingAncestors.length; i++) {
|
|
2672
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
|
|
2673
|
+
top = max(rect.top, top);
|
|
2674
|
+
right = min(rect.right, right);
|
|
2675
|
+
bottom = min(rect.bottom, bottom);
|
|
2676
|
+
left = max(rect.left, left);
|
|
2677
|
+
}
|
|
2678
|
+
return {
|
|
2679
|
+
width: right - left,
|
|
2680
|
+
height: bottom - top,
|
|
2681
|
+
x: left,
|
|
2682
|
+
y: top
|
|
2683
|
+
};
|
|
2684
|
+
}
|
|
2685
|
+
|
|
2686
|
+
function getDimensions(element) {
|
|
2687
|
+
const {
|
|
2688
|
+
width,
|
|
2689
|
+
height
|
|
2690
|
+
} = getCssDimensions(element);
|
|
2691
|
+
return {
|
|
2692
|
+
width,
|
|
2693
|
+
height
|
|
2694
|
+
};
|
|
2695
|
+
}
|
|
2696
|
+
|
|
2697
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
2698
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
2699
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
2700
|
+
const isFixed = strategy === 'fixed';
|
|
2701
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
2702
|
+
let scroll = {
|
|
2703
|
+
scrollLeft: 0,
|
|
2704
|
+
scrollTop: 0
|
|
2705
|
+
};
|
|
2706
|
+
const offsets = createCoords(0);
|
|
2707
|
+
|
|
2708
|
+
// If the <body> scrollbar appears on the left (e.g. RTL systems). Use
|
|
2709
|
+
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
|
|
2710
|
+
function setLeftRTLScrollbarOffset() {
|
|
2711
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
2712
|
+
}
|
|
2713
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
2714
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
2715
|
+
scroll = getNodeScroll(offsetParent);
|
|
2716
|
+
}
|
|
2717
|
+
if (isOffsetParentAnElement) {
|
|
2718
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
2719
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
2720
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
2721
|
+
} else if (documentElement) {
|
|
2722
|
+
setLeftRTLScrollbarOffset();
|
|
2723
|
+
}
|
|
2724
|
+
}
|
|
2725
|
+
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
|
2726
|
+
setLeftRTLScrollbarOffset();
|
|
2727
|
+
}
|
|
2728
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
2729
|
+
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
2730
|
+
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
2731
|
+
return {
|
|
2732
|
+
x,
|
|
2733
|
+
y,
|
|
2734
|
+
width: rect.width,
|
|
2735
|
+
height: rect.height
|
|
2736
|
+
};
|
|
2737
|
+
}
|
|
2738
|
+
|
|
2739
|
+
function isStaticPositioned(element) {
|
|
2740
|
+
return getComputedStyle$1(element).position === 'static';
|
|
2741
|
+
}
|
|
2742
|
+
|
|
2743
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
2744
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
2745
|
+
return null;
|
|
2746
|
+
}
|
|
2747
|
+
if (polyfill) {
|
|
2748
|
+
return polyfill(element);
|
|
2749
|
+
}
|
|
2750
|
+
let rawOffsetParent = element.offsetParent;
|
|
2751
|
+
|
|
2752
|
+
// Firefox returns the <html> element as the offsetParent if it's non-static,
|
|
2753
|
+
// while Chrome and Safari return the <body> element. The <body> element must
|
|
2754
|
+
// be used to perform the correct calculations even if the <html> element is
|
|
2755
|
+
// non-static.
|
|
2756
|
+
if (getDocumentElement(element) === rawOffsetParent) {
|
|
2757
|
+
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
2758
|
+
}
|
|
2759
|
+
return rawOffsetParent;
|
|
2760
|
+
}
|
|
2761
|
+
|
|
2762
|
+
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
2763
|
+
// such as table ancestors and cross browser bugs.
|
|
2764
|
+
function getOffsetParent(element, polyfill) {
|
|
2765
|
+
const win = getWindow(element);
|
|
2766
|
+
if (isTopLayer(element)) {
|
|
2767
|
+
return win;
|
|
2768
|
+
}
|
|
2769
|
+
if (!isHTMLElement(element)) {
|
|
2770
|
+
let svgOffsetParent = getParentNode(element);
|
|
2771
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
2772
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
2773
|
+
return svgOffsetParent;
|
|
2774
|
+
}
|
|
2775
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
2776
|
+
}
|
|
2777
|
+
return win;
|
|
2778
|
+
}
|
|
2779
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
2780
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
2781
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
2782
|
+
}
|
|
2783
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
2784
|
+
return win;
|
|
2785
|
+
}
|
|
2786
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
2787
|
+
}
|
|
2788
|
+
|
|
2789
|
+
const getElementRects = async function (data) {
|
|
2790
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
2791
|
+
const getDimensionsFn = this.getDimensions;
|
|
2792
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
2793
|
+
return {
|
|
2794
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
2795
|
+
floating: {
|
|
2796
|
+
x: 0,
|
|
2797
|
+
y: 0,
|
|
2798
|
+
width: floatingDimensions.width,
|
|
2799
|
+
height: floatingDimensions.height
|
|
2800
|
+
}
|
|
2801
|
+
};
|
|
2802
|
+
};
|
|
2803
|
+
|
|
2804
|
+
function isRTL(element) {
|
|
2805
|
+
return getComputedStyle$1(element).direction === 'rtl';
|
|
2806
|
+
}
|
|
2807
|
+
|
|
2808
|
+
const platform = {
|
|
2809
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
2810
|
+
getDocumentElement,
|
|
2811
|
+
getClippingRect,
|
|
2812
|
+
getOffsetParent,
|
|
2813
|
+
getElementRects,
|
|
2814
|
+
getClientRects,
|
|
2815
|
+
getDimensions,
|
|
2816
|
+
getScale,
|
|
2817
|
+
isElement,
|
|
2818
|
+
isRTL
|
|
2819
|
+
};
|
|
2820
|
+
|
|
2821
|
+
function rectsAreEqual(a, b) {
|
|
2822
|
+
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2825
|
+
// https://samthor.au/2021/observing-dom/
|
|
2826
|
+
function observeMove(element, onMove) {
|
|
2827
|
+
let io = null;
|
|
2828
|
+
let timeoutId;
|
|
2829
|
+
const root = getDocumentElement(element);
|
|
2830
|
+
function cleanup() {
|
|
2831
|
+
var _io;
|
|
2832
|
+
clearTimeout(timeoutId);
|
|
2833
|
+
(_io = io) == null || _io.disconnect();
|
|
2834
|
+
io = null;
|
|
2835
|
+
}
|
|
2836
|
+
function refresh(skip, threshold) {
|
|
2837
|
+
if (skip === void 0) {
|
|
2838
|
+
skip = false;
|
|
2839
|
+
}
|
|
2840
|
+
if (threshold === void 0) {
|
|
2841
|
+
threshold = 1;
|
|
2842
|
+
}
|
|
2843
|
+
cleanup();
|
|
2844
|
+
const elementRectForRootMargin = element.getBoundingClientRect();
|
|
2845
|
+
const {
|
|
2846
|
+
left,
|
|
2847
|
+
top,
|
|
2848
|
+
width,
|
|
2849
|
+
height
|
|
2850
|
+
} = elementRectForRootMargin;
|
|
2851
|
+
if (!skip) {
|
|
2852
|
+
onMove();
|
|
2853
|
+
}
|
|
2854
|
+
if (!width || !height) {
|
|
2855
|
+
return;
|
|
2856
|
+
}
|
|
2857
|
+
const insetTop = floor(top);
|
|
2858
|
+
const insetRight = floor(root.clientWidth - (left + width));
|
|
2859
|
+
const insetBottom = floor(root.clientHeight - (top + height));
|
|
2860
|
+
const insetLeft = floor(left);
|
|
2861
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
2862
|
+
const options = {
|
|
2863
|
+
rootMargin,
|
|
2864
|
+
threshold: max(0, min(1, threshold)) || 1
|
|
2865
|
+
};
|
|
2866
|
+
let isFirstUpdate = true;
|
|
2867
|
+
function handleObserve(entries) {
|
|
2868
|
+
const ratio = entries[0].intersectionRatio;
|
|
2869
|
+
if (ratio !== threshold) {
|
|
2870
|
+
if (!isFirstUpdate) {
|
|
2871
|
+
return refresh();
|
|
2872
|
+
}
|
|
2873
|
+
if (!ratio) {
|
|
2874
|
+
// If the reference is clipped, the ratio is 0. Throttle the refresh
|
|
2875
|
+
// to prevent an infinite loop of updates.
|
|
2876
|
+
timeoutId = setTimeout(() => {
|
|
2877
|
+
refresh(false, 1e-7);
|
|
2878
|
+
}, 1000);
|
|
2879
|
+
} else {
|
|
2880
|
+
refresh(false, ratio);
|
|
2881
|
+
}
|
|
2882
|
+
}
|
|
2883
|
+
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
|
2884
|
+
// It's possible that even though the ratio is reported as 1, the
|
|
2885
|
+
// element is not actually fully within the IntersectionObserver's root
|
|
2886
|
+
// area anymore. This can happen under performance constraints. This may
|
|
2887
|
+
// be a bug in the browser's IntersectionObserver implementation. To
|
|
2888
|
+
// work around this, we compare the element's bounding rect now with
|
|
2889
|
+
// what it was at the time we created the IntersectionObserver. If they
|
|
2890
|
+
// are not equal then the element moved, so we refresh.
|
|
2891
|
+
refresh();
|
|
2892
|
+
}
|
|
2893
|
+
isFirstUpdate = false;
|
|
2894
|
+
}
|
|
2895
|
+
|
|
2896
|
+
// Older browsers don't support a `document` as the root and will throw an
|
|
2897
|
+
// error.
|
|
2898
|
+
try {
|
|
2899
|
+
io = new IntersectionObserver(handleObserve, {
|
|
2900
|
+
...options,
|
|
2901
|
+
// Handle <iframe>s
|
|
2902
|
+
root: root.ownerDocument
|
|
2903
|
+
});
|
|
2904
|
+
} catch (_e) {
|
|
2905
|
+
io = new IntersectionObserver(handleObserve, options);
|
|
2906
|
+
}
|
|
2907
|
+
io.observe(element);
|
|
2908
|
+
}
|
|
2909
|
+
refresh(true);
|
|
2910
|
+
return cleanup;
|
|
2911
|
+
}
|
|
2912
|
+
|
|
2913
|
+
/**
|
|
2914
|
+
* Automatically updates the position of the floating element when necessary.
|
|
2915
|
+
* Should only be called when the floating element is mounted on the DOM or
|
|
2916
|
+
* visible on the screen.
|
|
2917
|
+
* @returns cleanup function that should be invoked when the floating element is
|
|
2918
|
+
* removed from the DOM or hidden from the screen.
|
|
2919
|
+
* @see https://floating-ui.com/docs/autoUpdate
|
|
2920
|
+
*/
|
|
2921
|
+
function autoUpdate(reference, floating, update, options) {
|
|
2922
|
+
if (options === void 0) {
|
|
2923
|
+
options = {};
|
|
2924
|
+
}
|
|
2925
|
+
const {
|
|
2926
|
+
ancestorScroll = true,
|
|
2927
|
+
ancestorResize = true,
|
|
2928
|
+
elementResize = typeof ResizeObserver === 'function',
|
|
2929
|
+
layoutShift = typeof IntersectionObserver === 'function',
|
|
2930
|
+
animationFrame = false
|
|
2931
|
+
} = options;
|
|
2932
|
+
const referenceEl = unwrapElement(reference);
|
|
2933
|
+
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];
|
|
2934
|
+
ancestors.forEach(ancestor => {
|
|
2935
|
+
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
|
2936
|
+
passive: true
|
|
2937
|
+
});
|
|
2938
|
+
ancestorResize && ancestor.addEventListener('resize', update);
|
|
2939
|
+
});
|
|
2940
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
2941
|
+
let reobserveFrame = -1;
|
|
2942
|
+
let resizeObserver = null;
|
|
2943
|
+
if (elementResize) {
|
|
2944
|
+
resizeObserver = new ResizeObserver(_ref => {
|
|
2945
|
+
let [firstEntry] = _ref;
|
|
2946
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
|
|
2947
|
+
// Prevent update loops when using the `size` middleware.
|
|
2948
|
+
// https://github.com/floating-ui/floating-ui/issues/1740
|
|
2949
|
+
resizeObserver.unobserve(floating);
|
|
2950
|
+
cancelAnimationFrame(reobserveFrame);
|
|
2951
|
+
reobserveFrame = requestAnimationFrame(() => {
|
|
2952
|
+
var _resizeObserver;
|
|
2953
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
2954
|
+
});
|
|
2955
|
+
}
|
|
2956
|
+
update();
|
|
2957
|
+
});
|
|
2958
|
+
if (referenceEl && !animationFrame) {
|
|
2959
|
+
resizeObserver.observe(referenceEl);
|
|
2960
|
+
}
|
|
2961
|
+
if (floating) {
|
|
2962
|
+
resizeObserver.observe(floating);
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
let frameId;
|
|
2966
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
2967
|
+
if (animationFrame) {
|
|
2968
|
+
frameLoop();
|
|
2969
|
+
}
|
|
2970
|
+
function frameLoop() {
|
|
2971
|
+
const nextRefRect = getBoundingClientRect(reference);
|
|
2972
|
+
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
|
2973
|
+
update();
|
|
2974
|
+
}
|
|
2975
|
+
prevRefRect = nextRefRect;
|
|
2976
|
+
frameId = requestAnimationFrame(frameLoop);
|
|
2977
|
+
}
|
|
2978
|
+
update();
|
|
2979
|
+
return () => {
|
|
2980
|
+
var _resizeObserver2;
|
|
2981
|
+
ancestors.forEach(ancestor => {
|
|
2982
|
+
ancestorScroll && ancestor.removeEventListener('scroll', update);
|
|
2983
|
+
ancestorResize && ancestor.removeEventListener('resize', update);
|
|
2984
|
+
});
|
|
2985
|
+
cleanupIo == null || cleanupIo();
|
|
2986
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
2987
|
+
resizeObserver = null;
|
|
2988
|
+
if (animationFrame) {
|
|
2989
|
+
cancelAnimationFrame(frameId);
|
|
2990
|
+
}
|
|
2991
|
+
};
|
|
2992
|
+
}
|
|
2993
|
+
|
|
2994
|
+
/**
|
|
2995
|
+
* Modifies the placement by translating the floating element along the
|
|
2996
|
+
* specified axes.
|
|
2997
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
2998
|
+
* object may be passed.
|
|
2999
|
+
* @see https://floating-ui.com/docs/offset
|
|
3000
|
+
*/
|
|
3001
|
+
const offset$1 = offset$2;
|
|
3002
|
+
|
|
3003
|
+
/**
|
|
3004
|
+
* Optimizes the visibility of the floating element by choosing the placement
|
|
3005
|
+
* that has the most space available automatically, without needing to specify a
|
|
3006
|
+
* preferred placement. Alternative to `flip`.
|
|
3007
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
3008
|
+
*/
|
|
3009
|
+
const autoPlacement$1 = autoPlacement$2;
|
|
3010
|
+
|
|
3011
|
+
/**
|
|
3012
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
3013
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
3014
|
+
* @see https://floating-ui.com/docs/shift
|
|
3015
|
+
*/
|
|
3016
|
+
const shift$1 = shift$2;
|
|
3017
|
+
|
|
3018
|
+
/**
|
|
3019
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
3020
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
3021
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
3022
|
+
* @see https://floating-ui.com/docs/flip
|
|
3023
|
+
*/
|
|
3024
|
+
const flip$1 = flip$2;
|
|
3025
|
+
|
|
3026
|
+
/**
|
|
3027
|
+
* Provides data that allows you to change the size of the floating element —
|
|
3028
|
+
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
3029
|
+
* width of the reference element.
|
|
3030
|
+
* @see https://floating-ui.com/docs/size
|
|
3031
|
+
*/
|
|
3032
|
+
const size$1 = size$2;
|
|
3033
|
+
|
|
3034
|
+
/**
|
|
3035
|
+
* Provides data to hide the floating element in applicable situations, such as
|
|
3036
|
+
* when it is not in the same clipping context as the reference element.
|
|
3037
|
+
* @see https://floating-ui.com/docs/hide
|
|
3038
|
+
*/
|
|
3039
|
+
const hide$1 = hide$2;
|
|
3040
|
+
|
|
3041
|
+
/**
|
|
3042
|
+
* Provides data to position an inner element of the floating element so that it
|
|
3043
|
+
* appears centered to the reference element.
|
|
3044
|
+
* @see https://floating-ui.com/docs/arrow
|
|
3045
|
+
*/
|
|
3046
|
+
const arrow$2 = arrow$3;
|
|
3047
|
+
|
|
3048
|
+
/**
|
|
3049
|
+
* Built-in `limiter` that will stop `shift()` at a certain point.
|
|
3050
|
+
*/
|
|
3051
|
+
const limitShift$1 = limitShift$2;
|
|
3052
|
+
|
|
3053
|
+
/**
|
|
3054
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
3055
|
+
* next to a given reference element.
|
|
3056
|
+
*/
|
|
3057
|
+
const computePosition = (reference, floating, options) => {
|
|
3058
|
+
// This caches the expensive `getClippingElementAncestors` function so that
|
|
3059
|
+
// multiple lifecycle resets re-use the same result. It only lives for a
|
|
3060
|
+
// single call. If other functions become expensive, we can add them as well.
|
|
3061
|
+
const cache = new Map();
|
|
3062
|
+
const mergedOptions = {
|
|
3063
|
+
platform,
|
|
3064
|
+
...options
|
|
3065
|
+
};
|
|
3066
|
+
const platformWithCache = {
|
|
3067
|
+
...mergedOptions.platform,
|
|
3068
|
+
_c: cache
|
|
3069
|
+
};
|
|
3070
|
+
return computePosition$1(reference, floating, {
|
|
3071
|
+
...mergedOptions,
|
|
3072
|
+
platform: platformWithCache
|
|
3073
|
+
});
|
|
3074
|
+
};
|
|
3075
|
+
|
|
3076
|
+
var isClient = typeof document !== 'undefined';
|
|
3077
|
+
|
|
3078
|
+
var noop = function noop() {};
|
|
3079
|
+
var index = isClient ? useLayoutEffect : noop;
|
|
3080
|
+
|
|
3081
|
+
// Fork of `fast-deep-equal` that only does the comparisons we need and compares
|
|
3082
|
+
// functions
|
|
3083
|
+
function deepEqual(a, b) {
|
|
3084
|
+
if (a === b) {
|
|
3085
|
+
return true;
|
|
3086
|
+
}
|
|
3087
|
+
if (typeof a !== typeof b) {
|
|
3088
|
+
return false;
|
|
3089
|
+
}
|
|
3090
|
+
if (typeof a === 'function' && a.toString() === b.toString()) {
|
|
3091
|
+
return true;
|
|
3092
|
+
}
|
|
3093
|
+
let length;
|
|
3094
|
+
let i;
|
|
3095
|
+
let keys;
|
|
3096
|
+
if (a && b && typeof a === 'object') {
|
|
3097
|
+
if (Array.isArray(a)) {
|
|
3098
|
+
length = a.length;
|
|
3099
|
+
if (length !== b.length) return false;
|
|
3100
|
+
for (i = length; i-- !== 0;) {
|
|
3101
|
+
if (!deepEqual(a[i], b[i])) {
|
|
3102
|
+
return false;
|
|
3103
|
+
}
|
|
985
3104
|
}
|
|
3105
|
+
return true;
|
|
986
3106
|
}
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
3107
|
+
keys = Object.keys(a);
|
|
3108
|
+
length = keys.length;
|
|
3109
|
+
if (length !== Object.keys(b).length) {
|
|
3110
|
+
return false;
|
|
990
3111
|
}
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
for (let j = 0; j < height; j++) {
|
|
995
|
-
targetCells.push(startIndex + i + j * cols);
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
if (startIndex % cols + width <= cols && targetCells.every(cell => cellMap[cell] == null)) {
|
|
999
|
-
targetCells.forEach(cell => {
|
|
1000
|
-
cellMap[cell] = index;
|
|
1001
|
-
});
|
|
1002
|
-
itemPlaced = true;
|
|
1003
|
-
} else {
|
|
1004
|
-
startIndex++;
|
|
3112
|
+
for (i = length; i-- !== 0;) {
|
|
3113
|
+
if (!{}.hasOwnProperty.call(b, keys[i])) {
|
|
3114
|
+
return false;
|
|
1005
3115
|
}
|
|
1006
3116
|
}
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
/** Gets cell index of an item's corner or -1 when index is -1. */
|
|
1014
|
-
function getGridCellIndexOfCorner(index, sizes, cellMap, cols, corner) {
|
|
1015
|
-
if (index === -1) return -1;
|
|
1016
|
-
const firstCellIndex = cellMap.indexOf(index);
|
|
1017
|
-
const sizeItem = sizes[index];
|
|
1018
|
-
switch (corner) {
|
|
1019
|
-
case 'tl':
|
|
1020
|
-
return firstCellIndex;
|
|
1021
|
-
case 'tr':
|
|
1022
|
-
if (!sizeItem) {
|
|
1023
|
-
return firstCellIndex;
|
|
3117
|
+
for (i = length; i-- !== 0;) {
|
|
3118
|
+
const key = keys[i];
|
|
3119
|
+
if (key === '_owner' && a.$$typeof) {
|
|
3120
|
+
continue;
|
|
1024
3121
|
}
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
if (!sizeItem) {
|
|
1028
|
-
return firstCellIndex;
|
|
3122
|
+
if (!deepEqual(a[key], b[key])) {
|
|
3123
|
+
return false;
|
|
1029
3124
|
}
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
return cellMap.lastIndexOf(index);
|
|
3125
|
+
}
|
|
3126
|
+
return true;
|
|
1033
3127
|
}
|
|
3128
|
+
return a !== a && b !== b;
|
|
1034
3129
|
}
|
|
1035
3130
|
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
}
|
|
1040
|
-
function isListIndexDisabled(listRef, index, disabledIndices) {
|
|
1041
|
-
if (typeof disabledIndices === 'function') {
|
|
1042
|
-
return disabledIndices(index);
|
|
1043
|
-
} else if (disabledIndices) {
|
|
1044
|
-
return disabledIndices.includes(index);
|
|
3131
|
+
function getDPR(element) {
|
|
3132
|
+
if (typeof window === 'undefined') {
|
|
3133
|
+
return 1;
|
|
1045
3134
|
}
|
|
1046
|
-
const
|
|
1047
|
-
return
|
|
3135
|
+
const win = element.ownerDocument.defaultView || window;
|
|
3136
|
+
return win.devicePixelRatio || 1;
|
|
1048
3137
|
}
|
|
1049
3138
|
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
// JSDOM does not support the `tabbable` library. To solve this we can
|
|
1054
|
-
// check if `ResizeObserver` is a real function (not polyfilled), which
|
|
1055
|
-
// determines if the current environment is JSDOM-like.
|
|
1056
|
-
typeof ResizeObserver === 'function' && ResizeObserver.toString().includes('[native code]') ? 'full' : 'none'
|
|
1057
|
-
});
|
|
1058
|
-
function getTabbableIn(container, dir) {
|
|
1059
|
-
const list = tabbable(container, getTabbableOptions());
|
|
1060
|
-
const len = list.length;
|
|
1061
|
-
if (len === 0) return;
|
|
1062
|
-
const active = activeElement(getDocument$1(container));
|
|
1063
|
-
const index = list.indexOf(active);
|
|
1064
|
-
const nextIndex = index === -1 ? dir === 1 ? 0 : len - 1 : index + dir;
|
|
1065
|
-
return list[nextIndex];
|
|
1066
|
-
}
|
|
1067
|
-
function getNextTabbable(referenceElement) {
|
|
1068
|
-
return getTabbableIn(getDocument$1(referenceElement).body, 1) || referenceElement;
|
|
1069
|
-
}
|
|
1070
|
-
function getPreviousTabbable(referenceElement) {
|
|
1071
|
-
return getTabbableIn(getDocument$1(referenceElement).body, -1) || referenceElement;
|
|
1072
|
-
}
|
|
1073
|
-
function isOutsideEvent(event, container) {
|
|
1074
|
-
const containerElement = container || event.currentTarget;
|
|
1075
|
-
const relatedTarget = event.relatedTarget;
|
|
1076
|
-
return !relatedTarget || !contains(containerElement, relatedTarget);
|
|
3139
|
+
function roundByDPR(element, value) {
|
|
3140
|
+
const dpr = getDPR(element);
|
|
3141
|
+
return Math.round(value * dpr) / dpr;
|
|
1077
3142
|
}
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
3143
|
+
|
|
3144
|
+
function useLatestRef(value) {
|
|
3145
|
+
const ref = React.useRef(value);
|
|
3146
|
+
index(() => {
|
|
3147
|
+
ref.current = value;
|
|
1083
3148
|
});
|
|
3149
|
+
return ref;
|
|
1084
3150
|
}
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
3151
|
+
|
|
3152
|
+
/**
|
|
3153
|
+
* Provides data to position a floating element.
|
|
3154
|
+
* @see https://floating-ui.com/docs/useFloating
|
|
3155
|
+
*/
|
|
3156
|
+
function useFloating$1(options) {
|
|
3157
|
+
if (options === void 0) {
|
|
3158
|
+
options = {};
|
|
3159
|
+
}
|
|
3160
|
+
const {
|
|
3161
|
+
placement = 'bottom',
|
|
3162
|
+
strategy = 'absolute',
|
|
3163
|
+
middleware = [],
|
|
3164
|
+
platform,
|
|
3165
|
+
elements: {
|
|
3166
|
+
reference: externalReference,
|
|
3167
|
+
floating: externalFloating
|
|
3168
|
+
} = {},
|
|
3169
|
+
transform = true,
|
|
3170
|
+
whileElementsMounted,
|
|
3171
|
+
open
|
|
3172
|
+
} = options;
|
|
3173
|
+
const [data, setData] = React.useState({
|
|
3174
|
+
x: 0,
|
|
3175
|
+
y: 0,
|
|
3176
|
+
strategy,
|
|
3177
|
+
placement,
|
|
3178
|
+
middlewareData: {},
|
|
3179
|
+
isPositioned: false
|
|
1095
3180
|
});
|
|
3181
|
+
const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);
|
|
3182
|
+
if (!deepEqual(latestMiddleware, middleware)) {
|
|
3183
|
+
setLatestMiddleware(middleware);
|
|
3184
|
+
}
|
|
3185
|
+
const [_reference, _setReference] = React.useState(null);
|
|
3186
|
+
const [_floating, _setFloating] = React.useState(null);
|
|
3187
|
+
const setReference = React.useCallback(node => {
|
|
3188
|
+
if (node !== referenceRef.current) {
|
|
3189
|
+
referenceRef.current = node;
|
|
3190
|
+
_setReference(node);
|
|
3191
|
+
}
|
|
3192
|
+
}, []);
|
|
3193
|
+
const setFloating = React.useCallback(node => {
|
|
3194
|
+
if (node !== floatingRef.current) {
|
|
3195
|
+
floatingRef.current = node;
|
|
3196
|
+
_setFloating(node);
|
|
3197
|
+
}
|
|
3198
|
+
}, []);
|
|
3199
|
+
const referenceEl = externalReference || _reference;
|
|
3200
|
+
const floatingEl = externalFloating || _floating;
|
|
3201
|
+
const referenceRef = React.useRef(null);
|
|
3202
|
+
const floatingRef = React.useRef(null);
|
|
3203
|
+
const dataRef = React.useRef(data);
|
|
3204
|
+
const hasWhileElementsMounted = whileElementsMounted != null;
|
|
3205
|
+
const whileElementsMountedRef = useLatestRef(whileElementsMounted);
|
|
3206
|
+
const platformRef = useLatestRef(platform);
|
|
3207
|
+
const openRef = useLatestRef(open);
|
|
3208
|
+
const update = React.useCallback(() => {
|
|
3209
|
+
if (!referenceRef.current || !floatingRef.current) {
|
|
3210
|
+
return;
|
|
3211
|
+
}
|
|
3212
|
+
const config = {
|
|
3213
|
+
placement,
|
|
3214
|
+
strategy,
|
|
3215
|
+
middleware: latestMiddleware
|
|
3216
|
+
};
|
|
3217
|
+
if (platformRef.current) {
|
|
3218
|
+
config.platform = platformRef.current;
|
|
3219
|
+
}
|
|
3220
|
+
computePosition(referenceRef.current, floatingRef.current, config).then(data => {
|
|
3221
|
+
const fullData = {
|
|
3222
|
+
...data,
|
|
3223
|
+
// The floating element's position may be recomputed while it's closed
|
|
3224
|
+
// but still mounted (such as when transitioning out). To ensure
|
|
3225
|
+
// `isPositioned` will be `false` initially on the next open, avoid
|
|
3226
|
+
// setting it to `true` when `open === false` (must be specified).
|
|
3227
|
+
isPositioned: openRef.current !== false
|
|
3228
|
+
};
|
|
3229
|
+
if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
|
|
3230
|
+
dataRef.current = fullData;
|
|
3231
|
+
ReactDOM.flushSync(() => {
|
|
3232
|
+
setData(fullData);
|
|
3233
|
+
});
|
|
3234
|
+
}
|
|
3235
|
+
});
|
|
3236
|
+
}, [latestMiddleware, placement, strategy, platformRef, openRef]);
|
|
3237
|
+
index(() => {
|
|
3238
|
+
if (open === false && dataRef.current.isPositioned) {
|
|
3239
|
+
dataRef.current.isPositioned = false;
|
|
3240
|
+
setData(data => ({
|
|
3241
|
+
...data,
|
|
3242
|
+
isPositioned: false
|
|
3243
|
+
}));
|
|
3244
|
+
}
|
|
3245
|
+
}, [open]);
|
|
3246
|
+
const isMountedRef = React.useRef(false);
|
|
3247
|
+
index(() => {
|
|
3248
|
+
isMountedRef.current = true;
|
|
3249
|
+
return () => {
|
|
3250
|
+
isMountedRef.current = false;
|
|
3251
|
+
};
|
|
3252
|
+
}, []);
|
|
3253
|
+
index(() => {
|
|
3254
|
+
if (referenceEl) referenceRef.current = referenceEl;
|
|
3255
|
+
if (floatingEl) floatingRef.current = floatingEl;
|
|
3256
|
+
if (referenceEl && floatingEl) {
|
|
3257
|
+
if (whileElementsMountedRef.current) {
|
|
3258
|
+
return whileElementsMountedRef.current(referenceEl, floatingEl, update);
|
|
3259
|
+
}
|
|
3260
|
+
update();
|
|
3261
|
+
}
|
|
3262
|
+
}, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
|
|
3263
|
+
const refs = React.useMemo(() => ({
|
|
3264
|
+
reference: referenceRef,
|
|
3265
|
+
floating: floatingRef,
|
|
3266
|
+
setReference,
|
|
3267
|
+
setFloating
|
|
3268
|
+
}), [setReference, setFloating]);
|
|
3269
|
+
const elements = React.useMemo(() => ({
|
|
3270
|
+
reference: referenceEl,
|
|
3271
|
+
floating: floatingEl
|
|
3272
|
+
}), [referenceEl, floatingEl]);
|
|
3273
|
+
const floatingStyles = React.useMemo(() => {
|
|
3274
|
+
const initialStyles = {
|
|
3275
|
+
position: strategy,
|
|
3276
|
+
left: 0,
|
|
3277
|
+
top: 0
|
|
3278
|
+
};
|
|
3279
|
+
if (!elements.floating) {
|
|
3280
|
+
return initialStyles;
|
|
3281
|
+
}
|
|
3282
|
+
const x = roundByDPR(elements.floating, data.x);
|
|
3283
|
+
const y = roundByDPR(elements.floating, data.y);
|
|
3284
|
+
if (transform) {
|
|
3285
|
+
return {
|
|
3286
|
+
...initialStyles,
|
|
3287
|
+
transform: "translate(" + x + "px, " + y + "px)",
|
|
3288
|
+
...(getDPR(elements.floating) >= 1.5 && {
|
|
3289
|
+
willChange: 'transform'
|
|
3290
|
+
})
|
|
3291
|
+
};
|
|
3292
|
+
}
|
|
3293
|
+
return {
|
|
3294
|
+
position: strategy,
|
|
3295
|
+
left: x,
|
|
3296
|
+
top: y
|
|
3297
|
+
};
|
|
3298
|
+
}, [strategy, transform, elements.floating, data.x, data.y]);
|
|
3299
|
+
return React.useMemo(() => ({
|
|
3300
|
+
...data,
|
|
3301
|
+
update,
|
|
3302
|
+
refs,
|
|
3303
|
+
elements,
|
|
3304
|
+
floatingStyles
|
|
3305
|
+
}), [data, update, refs, elements, floatingStyles]);
|
|
1096
3306
|
}
|
|
1097
3307
|
|
|
3308
|
+
/**
|
|
3309
|
+
* Provides data to position an inner element of the floating element so that it
|
|
3310
|
+
* appears centered to the reference element.
|
|
3311
|
+
* This wraps the core `arrow` middleware to allow React refs as the element.
|
|
3312
|
+
* @see https://floating-ui.com/docs/arrow
|
|
3313
|
+
*/
|
|
3314
|
+
const arrow$1 = options => {
|
|
3315
|
+
function isRef(value) {
|
|
3316
|
+
return {}.hasOwnProperty.call(value, 'current');
|
|
3317
|
+
}
|
|
3318
|
+
return {
|
|
3319
|
+
name: 'arrow',
|
|
3320
|
+
options,
|
|
3321
|
+
fn(state) {
|
|
3322
|
+
const {
|
|
3323
|
+
element,
|
|
3324
|
+
padding
|
|
3325
|
+
} = typeof options === 'function' ? options(state) : options;
|
|
3326
|
+
if (element && isRef(element)) {
|
|
3327
|
+
if (element.current != null) {
|
|
3328
|
+
return arrow$2({
|
|
3329
|
+
element: element.current,
|
|
3330
|
+
padding
|
|
3331
|
+
}).fn(state);
|
|
3332
|
+
}
|
|
3333
|
+
return {};
|
|
3334
|
+
}
|
|
3335
|
+
if (element) {
|
|
3336
|
+
return arrow$2({
|
|
3337
|
+
element,
|
|
3338
|
+
padding
|
|
3339
|
+
}).fn(state);
|
|
3340
|
+
}
|
|
3341
|
+
return {};
|
|
3342
|
+
}
|
|
3343
|
+
};
|
|
3344
|
+
};
|
|
3345
|
+
|
|
3346
|
+
/**
|
|
3347
|
+
* Modifies the placement by translating the floating element along the
|
|
3348
|
+
* specified axes.
|
|
3349
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
3350
|
+
* object may be passed.
|
|
3351
|
+
* @see https://floating-ui.com/docs/offset
|
|
3352
|
+
*/
|
|
3353
|
+
const offset = (options, deps) => {
|
|
3354
|
+
const result = offset$1(options);
|
|
3355
|
+
return {
|
|
3356
|
+
name: result.name,
|
|
3357
|
+
fn: result.fn,
|
|
3358
|
+
options: [options, deps]
|
|
3359
|
+
};
|
|
3360
|
+
};
|
|
3361
|
+
|
|
3362
|
+
/**
|
|
3363
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
3364
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
3365
|
+
* @see https://floating-ui.com/docs/shift
|
|
3366
|
+
*/
|
|
3367
|
+
const shift = (options, deps) => {
|
|
3368
|
+
const result = shift$1(options);
|
|
3369
|
+
return {
|
|
3370
|
+
name: result.name,
|
|
3371
|
+
fn: result.fn,
|
|
3372
|
+
options: [options, deps]
|
|
3373
|
+
};
|
|
3374
|
+
};
|
|
3375
|
+
|
|
3376
|
+
/**
|
|
3377
|
+
* Built-in `limiter` that will stop `shift()` at a certain point.
|
|
3378
|
+
*/
|
|
3379
|
+
const limitShift = (options, deps) => {
|
|
3380
|
+
const result = limitShift$1(options);
|
|
3381
|
+
return {
|
|
3382
|
+
fn: result.fn,
|
|
3383
|
+
options: [options, deps]
|
|
3384
|
+
};
|
|
3385
|
+
};
|
|
3386
|
+
|
|
3387
|
+
/**
|
|
3388
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
3389
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
3390
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
3391
|
+
* @see https://floating-ui.com/docs/flip
|
|
3392
|
+
*/
|
|
3393
|
+
const flip = (options, deps) => {
|
|
3394
|
+
const result = flip$1(options);
|
|
3395
|
+
return {
|
|
3396
|
+
name: result.name,
|
|
3397
|
+
fn: result.fn,
|
|
3398
|
+
options: [options, deps]
|
|
3399
|
+
};
|
|
3400
|
+
};
|
|
3401
|
+
|
|
3402
|
+
/**
|
|
3403
|
+
* Provides data that allows you to change the size of the floating element —
|
|
3404
|
+
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
3405
|
+
* width of the reference element.
|
|
3406
|
+
* @see https://floating-ui.com/docs/size
|
|
3407
|
+
*/
|
|
3408
|
+
const size = (options, deps) => {
|
|
3409
|
+
const result = size$1(options);
|
|
3410
|
+
return {
|
|
3411
|
+
name: result.name,
|
|
3412
|
+
fn: result.fn,
|
|
3413
|
+
options: [options, deps]
|
|
3414
|
+
};
|
|
3415
|
+
};
|
|
3416
|
+
|
|
3417
|
+
/**
|
|
3418
|
+
* Optimizes the visibility of the floating element by choosing the placement
|
|
3419
|
+
* that has the most space available automatically, without needing to specify a
|
|
3420
|
+
* preferred placement. Alternative to `flip`.
|
|
3421
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
3422
|
+
*/
|
|
3423
|
+
const autoPlacement = (options, deps) => {
|
|
3424
|
+
const result = autoPlacement$1(options);
|
|
3425
|
+
return {
|
|
3426
|
+
name: result.name,
|
|
3427
|
+
fn: result.fn,
|
|
3428
|
+
options: [options, deps]
|
|
3429
|
+
};
|
|
3430
|
+
};
|
|
3431
|
+
|
|
3432
|
+
/**
|
|
3433
|
+
* Provides data to hide the floating element in applicable situations, such as
|
|
3434
|
+
* when it is not in the same clipping context as the reference element.
|
|
3435
|
+
* @see https://floating-ui.com/docs/hide
|
|
3436
|
+
*/
|
|
3437
|
+
const hide = (options, deps) => {
|
|
3438
|
+
const result = hide$1(options);
|
|
3439
|
+
return {
|
|
3440
|
+
name: result.name,
|
|
3441
|
+
fn: result.fn,
|
|
3442
|
+
options: [options, deps]
|
|
3443
|
+
};
|
|
3444
|
+
};
|
|
3445
|
+
|
|
3446
|
+
/**
|
|
3447
|
+
* Provides data to position an inner element of the floating element so that it
|
|
3448
|
+
* appears centered to the reference element.
|
|
3449
|
+
* This wraps the core `arrow` middleware to allow React refs as the element.
|
|
3450
|
+
* @see https://floating-ui.com/docs/arrow
|
|
3451
|
+
*/
|
|
3452
|
+
const arrow = (options, deps) => {
|
|
3453
|
+
const result = arrow$1(options);
|
|
3454
|
+
return {
|
|
3455
|
+
name: result.name,
|
|
3456
|
+
fn: result.fn,
|
|
3457
|
+
options: [options, deps]
|
|
3458
|
+
};
|
|
3459
|
+
};
|
|
3460
|
+
|
|
1098
3461
|
const FOCUSABLE_ATTRIBUTE = 'data-floating-ui-focusable';
|
|
1099
3462
|
const ACTIVE_KEY = 'active';
|
|
1100
3463
|
const SELECTED_KEY = 'selected';
|
|
@@ -1115,7 +3478,7 @@ const genId = () => // Ensure the id is unique with multiple independent version
|
|
|
1115
3478
|
"floating-ui-" + Math.random().toString(36).slice(2, 6) + count++;
|
|
1116
3479
|
function useFloatingId() {
|
|
1117
3480
|
const [id, setId] = React.useState(() => serverHandoffComplete ? genId() : undefined);
|
|
1118
|
-
index(() => {
|
|
3481
|
+
index$1(() => {
|
|
1119
3482
|
if (id == null) {
|
|
1120
3483
|
setId(genId());
|
|
1121
3484
|
}
|
|
@@ -1203,7 +3566,7 @@ const FloatingArrow = /*#__PURE__*/React.forwardRef(function FloatingArrow(props
|
|
|
1203
3566
|
const [isRTL, setIsRTL] = React.useState(false);
|
|
1204
3567
|
|
|
1205
3568
|
// https://github.com/floating-ui/floating-ui/issues/2932
|
|
1206
|
-
index(() => {
|
|
3569
|
+
index$1(() => {
|
|
1207
3570
|
if (!floating) return;
|
|
1208
3571
|
const isRTL = getComputedStyle$1(floating).direction === 'rtl';
|
|
1209
3572
|
if (isRTL) {
|
|
@@ -1326,7 +3689,7 @@ function useFloatingNodeId(customParentId) {
|
|
|
1326
3689
|
const tree = useFloatingTree();
|
|
1327
3690
|
const reactParentId = useFloatingParentNodeId();
|
|
1328
3691
|
const parentId = reactParentId;
|
|
1329
|
-
index(() => {
|
|
3692
|
+
index$1(() => {
|
|
1330
3693
|
if (!id) return;
|
|
1331
3694
|
const node = {
|
|
1332
3695
|
id,
|
|
@@ -1557,7 +3920,7 @@ const HIDDEN_STYLES = {
|
|
|
1557
3920
|
};
|
|
1558
3921
|
const FocusGuard = /*#__PURE__*/React.forwardRef(function FocusGuard(props, ref) {
|
|
1559
3922
|
const [role, setRole] = React.useState();
|
|
1560
|
-
index(() => {
|
|
3923
|
+
index$1(() => {
|
|
1561
3924
|
if (isSafari()) {
|
|
1562
3925
|
// Unlike other screen readers such as NVDA and JAWS, the virtual cursor
|
|
1563
3926
|
// on VoiceOver does trigger the onFocus event, so we can use the focus
|
|
@@ -1599,7 +3962,7 @@ function useFloatingPortalNode(props) {
|
|
|
1599
3962
|
const portalContext = usePortalContext();
|
|
1600
3963
|
const [portalNode, setPortalNode] = React.useState(null);
|
|
1601
3964
|
const portalNodeRef = React.useRef(null);
|
|
1602
|
-
index(() => {
|
|
3965
|
+
index$1(() => {
|
|
1603
3966
|
return () => {
|
|
1604
3967
|
portalNode == null || portalNode.remove();
|
|
1605
3968
|
// Allow the subsequent layout effects to create a new node on updates.
|
|
@@ -1610,7 +3973,7 @@ function useFloatingPortalNode(props) {
|
|
|
1610
3973
|
});
|
|
1611
3974
|
};
|
|
1612
3975
|
}, [portalNode]);
|
|
1613
|
-
index(() => {
|
|
3976
|
+
index$1(() => {
|
|
1614
3977
|
// Wait for the uniqueId to be generated before creating the portal node in
|
|
1615
3978
|
// React <18 (using `useFloatingId` instead of the native `useId`).
|
|
1616
3979
|
// https://github.com/floating-ui/floating-ui/issues/2778
|
|
@@ -1625,7 +3988,7 @@ function useFloatingPortalNode(props) {
|
|
|
1625
3988
|
portalNodeRef.current = subRoot;
|
|
1626
3989
|
setPortalNode(subRoot);
|
|
1627
3990
|
}, [id, uniqueId]);
|
|
1628
|
-
index(() => {
|
|
3991
|
+
index$1(() => {
|
|
1629
3992
|
// Wait for the root to exist before creating the portal node. The root must
|
|
1630
3993
|
// be stored in state, not a ref, for this to work reactively.
|
|
1631
3994
|
if (root === null) return;
|
|
@@ -1875,9 +4238,9 @@ function FloatingFocusManager(props) {
|
|
|
1875
4238
|
const inertSupported = supportsInert();
|
|
1876
4239
|
const guards = inertSupported ? _guards : true;
|
|
1877
4240
|
const useInert = !guards || inertSupported && outsideElementsInert;
|
|
1878
|
-
const orderRef = useLatestRef(order);
|
|
1879
|
-
const initialFocusRef = useLatestRef(initialFocus);
|
|
1880
|
-
const returnFocusRef = useLatestRef(returnFocus);
|
|
4241
|
+
const orderRef = useLatestRef$1(order);
|
|
4242
|
+
const initialFocusRef = useLatestRef$1(initialFocus);
|
|
4243
|
+
const returnFocusRef = useLatestRef$1(returnFocus);
|
|
1881
4244
|
const tree = useFloatingTree();
|
|
1882
4245
|
const portalContext = usePortalContext();
|
|
1883
4246
|
const startDismissButtonRef = React.useRef(null);
|
|
@@ -2060,7 +4423,7 @@ function FloatingFocusManager(props) {
|
|
|
2060
4423
|
cleanup();
|
|
2061
4424
|
};
|
|
2062
4425
|
}, [disabled, domReference, floating, modal, orderRef, portalContext, isUntrappedTypeableCombobox, guards, useInert, tree, getNodeId, getInsideElements]);
|
|
2063
|
-
index(() => {
|
|
4426
|
+
index$1(() => {
|
|
2064
4427
|
if (disabled || !isHTMLElement(floatingFocusElement)) return;
|
|
2065
4428
|
const doc = getDocument$1(floatingFocusElement);
|
|
2066
4429
|
const previouslyFocusedElement = activeElement(doc);
|
|
@@ -2078,7 +4441,7 @@ function FloatingFocusManager(props) {
|
|
|
2078
4441
|
}
|
|
2079
4442
|
});
|
|
2080
4443
|
}, [disabled, open, floatingFocusElement, ignoreInitialFocus, getTabbableElements, initialFocusRef]);
|
|
2081
|
-
index(() => {
|
|
4444
|
+
index$1(() => {
|
|
2082
4445
|
if (disabled || !floatingFocusElement) return;
|
|
2083
4446
|
const doc = getDocument$1(floatingFocusElement);
|
|
2084
4447
|
const previouslyFocusedElement = activeElement(doc);
|
|
@@ -2169,7 +4532,7 @@ function FloatingFocusManager(props) {
|
|
|
2169
4532
|
|
|
2170
4533
|
// Synchronize the `context` & `modal` value to the FloatingPortal context.
|
|
2171
4534
|
// It will decide whether or not it needs to render its own guards.
|
|
2172
|
-
index(() => {
|
|
4535
|
+
index$1(() => {
|
|
2173
4536
|
if (disabled) return;
|
|
2174
4537
|
if (!portalContext) return;
|
|
2175
4538
|
portalContext.setFocusManagerState({
|
|
@@ -2183,7 +4546,7 @@ function FloatingFocusManager(props) {
|
|
|
2183
4546
|
portalContext.setFocusManagerState(null);
|
|
2184
4547
|
};
|
|
2185
4548
|
}, [disabled, portalContext, modal, open, onOpenChange, closeOnFocusOut, domReference]);
|
|
2186
|
-
index(() => {
|
|
4549
|
+
index$1(() => {
|
|
2187
4550
|
if (disabled) return;
|
|
2188
4551
|
if (!floatingFocusElement) return;
|
|
2189
4552
|
handleTabIndex(floatingFocusElement, orderRef);
|
|
@@ -2305,7 +4668,7 @@ const FloatingOverlay = /*#__PURE__*/React.forwardRef(function FloatingOverlay(p
|
|
|
2305
4668
|
lockScroll = false,
|
|
2306
4669
|
...rest
|
|
2307
4670
|
} = props;
|
|
2308
|
-
index(() => {
|
|
4671
|
+
index$1(() => {
|
|
2309
4672
|
if (!lockScroll) return;
|
|
2310
4673
|
lockCount++;
|
|
2311
4674
|
if (lockCount === 1) {
|
|
@@ -2812,7 +5175,7 @@ function useFloating(options) {
|
|
|
2812
5175
|
const domReference = optionDomReference || _domReference;
|
|
2813
5176
|
const domReferenceRef = React.useRef(null);
|
|
2814
5177
|
const tree = useFloatingTree();
|
|
2815
|
-
index(() => {
|
|
5178
|
+
index$1(() => {
|
|
2816
5179
|
if (domReference) {
|
|
2817
5180
|
domReferenceRef.current = domReference;
|
|
2818
5181
|
}
|
|
@@ -2870,7 +5233,7 @@ function useFloating(options) {
|
|
|
2870
5233
|
elements,
|
|
2871
5234
|
nodeId
|
|
2872
5235
|
}), [position, refs, elements, nodeId, rootContext]);
|
|
2873
|
-
index(() => {
|
|
5236
|
+
index$1(() => {
|
|
2874
5237
|
rootContext.dataRef.current.floatingContext = context;
|
|
2875
5238
|
const node = tree == null ? void 0 : tree.nodesRef.current.find(node => node.id === nodeId);
|
|
2876
5239
|
if (node) {
|
|
@@ -3053,10 +5416,10 @@ function useListNavigation(context, props) {
|
|
|
3053
5416
|
}
|
|
3054
5417
|
}
|
|
3055
5418
|
const floatingFocusElement = getFloatingFocusElement(elements.floating);
|
|
3056
|
-
const floatingFocusElementRef = useLatestRef(floatingFocusElement);
|
|
5419
|
+
const floatingFocusElementRef = useLatestRef$1(floatingFocusElement);
|
|
3057
5420
|
const parentId = useFloatingParentNodeId();
|
|
3058
5421
|
const tree = useFloatingTree();
|
|
3059
|
-
index(() => {
|
|
5422
|
+
index$1(() => {
|
|
3060
5423
|
context.dataRef.current.orientation = orientation;
|
|
3061
5424
|
}, [context, orientation]);
|
|
3062
5425
|
const onNavigate = useEffectEvent(() => {
|
|
@@ -3072,10 +5435,10 @@ function useListNavigation(context, props) {
|
|
|
3072
5435
|
const previousOpenRef = React.useRef(open);
|
|
3073
5436
|
const forceSyncFocusRef = React.useRef(false);
|
|
3074
5437
|
const forceScrollIntoViewRef = React.useRef(false);
|
|
3075
|
-
const disabledIndicesRef = useLatestRef(disabledIndices);
|
|
3076
|
-
const latestOpenRef = useLatestRef(open);
|
|
3077
|
-
const scrollItemIntoViewRef = useLatestRef(scrollItemIntoView);
|
|
3078
|
-
const selectedIndexRef = useLatestRef(selectedIndex);
|
|
5438
|
+
const disabledIndicesRef = useLatestRef$1(disabledIndices);
|
|
5439
|
+
const latestOpenRef = useLatestRef$1(open);
|
|
5440
|
+
const scrollItemIntoViewRef = useLatestRef$1(scrollItemIntoView);
|
|
5441
|
+
const selectedIndexRef = useLatestRef$1(selectedIndex);
|
|
3079
5442
|
const [activeId, setActiveId] = React.useState();
|
|
3080
5443
|
const [virtualId, setVirtualId] = React.useState();
|
|
3081
5444
|
const focusItem = useEffectEvent(() => {
|
|
@@ -3124,7 +5487,7 @@ function useListNavigation(context, props) {
|
|
|
3124
5487
|
|
|
3125
5488
|
// Sync `selectedIndex` to be the `activeIndex` upon opening the floating
|
|
3126
5489
|
// element. Also, reset `activeIndex` upon closing the floating element.
|
|
3127
|
-
index(() => {
|
|
5490
|
+
index$1(() => {
|
|
3128
5491
|
if (!enabled) return;
|
|
3129
5492
|
if (open && elements.floating) {
|
|
3130
5493
|
if (focusItemOnOpenRef.current && selectedIndex != null) {
|
|
@@ -3145,7 +5508,7 @@ function useListNavigation(context, props) {
|
|
|
3145
5508
|
|
|
3146
5509
|
// Sync `activeIndex` to be the focused item while the floating element is
|
|
3147
5510
|
// open.
|
|
3148
|
-
index(() => {
|
|
5511
|
+
index$1(() => {
|
|
3149
5512
|
if (!enabled) return;
|
|
3150
5513
|
if (!open) return;
|
|
3151
5514
|
if (!elements.floating) return;
|
|
@@ -3191,7 +5554,7 @@ function useListNavigation(context, props) {
|
|
|
3191
5554
|
|
|
3192
5555
|
// Ensure the parent floating element has focus when a nested child closes
|
|
3193
5556
|
// to allow arrow key navigation to work after the pointer leaves the child.
|
|
3194
|
-
index(() => {
|
|
5557
|
+
index$1(() => {
|
|
3195
5558
|
var _nodes$find;
|
|
3196
5559
|
if (!enabled || elements.floating || !tree || virtual || !previousMountedRef.current) {
|
|
3197
5560
|
return;
|
|
@@ -3206,7 +5569,7 @@ function useListNavigation(context, props) {
|
|
|
3206
5569
|
});
|
|
3207
5570
|
}
|
|
3208
5571
|
}, [enabled, elements.floating, tree, parentId, virtual]);
|
|
3209
|
-
index(() => {
|
|
5572
|
+
index$1(() => {
|
|
3210
5573
|
if (!enabled) return;
|
|
3211
5574
|
if (!tree) return;
|
|
3212
5575
|
if (!virtual) return;
|
|
@@ -3222,12 +5585,12 @@ function useListNavigation(context, props) {
|
|
|
3222
5585
|
tree.events.off('virtualfocus', handleVirtualFocus);
|
|
3223
5586
|
};
|
|
3224
5587
|
}, [enabled, tree, virtual, parentId, virtualItemRef]);
|
|
3225
|
-
index(() => {
|
|
5588
|
+
index$1(() => {
|
|
3226
5589
|
previousOnNavigateRef.current = onNavigate;
|
|
3227
5590
|
previousOpenRef.current = open;
|
|
3228
5591
|
previousMountedRef.current = !!elements.floating;
|
|
3229
5592
|
});
|
|
3230
|
-
index(() => {
|
|
5593
|
+
index$1(() => {
|
|
3231
5594
|
if (!open) {
|
|
3232
5595
|
keyRef.current = null;
|
|
3233
5596
|
focusItemOnOpenRef.current = focusItemOnOpen;
|
|
@@ -3705,7 +6068,7 @@ function useTransitionStatus(context, props) {
|
|
|
3705
6068
|
if (!isMounted && status === 'close') {
|
|
3706
6069
|
setStatus('unmounted');
|
|
3707
6070
|
}
|
|
3708
|
-
index(() => {
|
|
6071
|
+
index$1(() => {
|
|
3709
6072
|
if (!floating) return;
|
|
3710
6073
|
if (open) {
|
|
3711
6074
|
setStatus('initial');
|
|
@@ -3765,11 +6128,11 @@ function useTransitionStyles(context, props) {
|
|
|
3765
6128
|
} = useTransitionStatus(context, {
|
|
3766
6129
|
duration
|
|
3767
6130
|
});
|
|
3768
|
-
const initialRef = useLatestRef(unstable_initial);
|
|
3769
|
-
const openRef = useLatestRef(unstable_open);
|
|
3770
|
-
const closeRef = useLatestRef(unstable_close);
|
|
3771
|
-
const commonRef = useLatestRef(unstable_common);
|
|
3772
|
-
index(() => {
|
|
6131
|
+
const initialRef = useLatestRef$1(unstable_initial);
|
|
6132
|
+
const openRef = useLatestRef$1(unstable_open);
|
|
6133
|
+
const closeRef = useLatestRef$1(unstable_close);
|
|
6134
|
+
const commonRef = useLatestRef$1(unstable_common);
|
|
6135
|
+
index$1(() => {
|
|
3773
6136
|
const initialStyles = execWithArgsOrReturn(initialRef.current, fnArgs);
|
|
3774
6137
|
const closeStyles = execWithArgsOrReturn(closeRef.current, fnArgs);
|
|
3775
6138
|
const commonStyles = execWithArgsOrReturn(commonRef.current, fnArgs);
|
|
@@ -3808,4 +6171,4 @@ function useTransitionStyles(context, props) {
|
|
|
3808
6171
|
};
|
|
3809
6172
|
}
|
|
3810
6173
|
|
|
3811
|
-
export { FloatingPortal as F,
|
|
6174
|
+
export { FloatingPortal as F, arrow as a, autoUpdate as b, useFloatingParentNodeId as c, useFloatingNodeId as d, useDismiss as e, flip as f, useInteractions as g, hide as h, FloatingTree as i, FloatingNode as j, autoPlacement as k, limitShift as l, size as m, useListNavigation as n, offset as o, useRole as p, FloatingFocusManager as q, FloatingOverlay as r, shift as s, useClick as t, useFloating as u, useTransitionStyles as v, FloatingArrow as w };
|