@addsign/moje-agenda-shared-lib 2.0.52 → 2.0.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Combination-DK1PD8Kn.js +1162 -0
- package/dist/Combination-DK1PD8Kn.js.map +1 -0
- package/dist/Dialog-BCdHj5XF.js +424 -0
- package/dist/Dialog-BCdHj5XF.js.map +1 -0
- package/dist/assets/style.css +3 -3
- package/dist/components/Attachments.js +2 -2
- package/dist/components/datatable/DataTable.js +2 -2
- package/dist/components/datatable/DataTableServer.js +175 -141
- package/dist/components/datatable/DataTableServer.js.map +1 -1
- package/dist/components/form/AutocompleteSearchBar.js +2 -2
- package/dist/components/form/AutocompleteSearchBarServer.js +2 -2
- package/dist/components/form/FileInput.js +2 -2
- package/dist/components/form/FileInputMultiple.js +2 -2
- package/dist/components/form/FormField.js +2 -2
- package/dist/components/form/PositionsSelectorSingle.js +2 -2
- package/dist/components/form/SelectField.js +2 -2
- package/dist/components/layout/Neoptimizovano.js +2 -2
- package/dist/components/profiles/ProfileOverview.js +2 -2
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/select.js.map +1 -1
- package/dist/index-BDmNRBtj.js +28864 -0
- package/dist/index-BDmNRBtj.js.map +1 -0
- package/dist/index-BE-ioJyt.js +2399 -0
- package/dist/index-BE-ioJyt.js.map +1 -0
- package/dist/index-BP2JKuhl.js +18 -0
- package/dist/index-BP2JKuhl.js.map +1 -0
- package/dist/index-BwPkj4HH.js +2203 -0
- package/dist/index-BwPkj4HH.js.map +1 -0
- package/dist/index-CZ8q92_F.js +234 -0
- package/dist/index-CZ8q92_F.js.map +1 -0
- package/dist/index-Cz20_uvt.js +36 -0
- package/dist/index-Cz20_uvt.js.map +1 -0
- package/dist/index.es-Dtj1Qgb9.js +9600 -0
- package/dist/index.es-Dtj1Qgb9.js.map +1 -0
- package/dist/jspdf.plugin.autotable-DuWOu3BU.js +11475 -0
- package/dist/jspdf.plugin.autotable-DuWOu3BU.js.map +1 -0
- package/dist/popover--cBqrVd7.js +319 -0
- package/dist/popover--cBqrVd7.js.map +1 -0
- package/lib/components/datatable/DataTableServer.tsx +86 -42
- package/lib/components/ui/select.tsx +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,2203 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useLayoutEffect, useEffect } from "react";
|
|
3
|
+
import { r as reactDomExports, P as Primitive } from "./index-BDmNRBtj.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { u as useComposedRefs } from "./index-D9mvqz1C.js";
|
|
6
|
+
import { a as useCallbackRef, u as useLayoutEffect2 } from "./index-NZPkObcw.js";
|
|
7
|
+
import { u as useSize } from "./index-CK9QfV6i.js";
|
|
8
|
+
const sides = ["top", "right", "bottom", "left"];
|
|
9
|
+
const min = Math.min;
|
|
10
|
+
const max = Math.max;
|
|
11
|
+
const round = Math.round;
|
|
12
|
+
const floor = Math.floor;
|
|
13
|
+
const createCoords = (v) => ({
|
|
14
|
+
x: v,
|
|
15
|
+
y: v
|
|
16
|
+
});
|
|
17
|
+
const oppositeSideMap = {
|
|
18
|
+
left: "right",
|
|
19
|
+
right: "left",
|
|
20
|
+
bottom: "top",
|
|
21
|
+
top: "bottom"
|
|
22
|
+
};
|
|
23
|
+
const oppositeAlignmentMap = {
|
|
24
|
+
start: "end",
|
|
25
|
+
end: "start"
|
|
26
|
+
};
|
|
27
|
+
function clamp(start, value, end) {
|
|
28
|
+
return max(start, min(value, end));
|
|
29
|
+
}
|
|
30
|
+
function evaluate(value, param) {
|
|
31
|
+
return typeof value === "function" ? value(param) : value;
|
|
32
|
+
}
|
|
33
|
+
function getSide(placement) {
|
|
34
|
+
return placement.split("-")[0];
|
|
35
|
+
}
|
|
36
|
+
function getAlignment(placement) {
|
|
37
|
+
return placement.split("-")[1];
|
|
38
|
+
}
|
|
39
|
+
function getOppositeAxis(axis) {
|
|
40
|
+
return axis === "x" ? "y" : "x";
|
|
41
|
+
}
|
|
42
|
+
function getAxisLength(axis) {
|
|
43
|
+
return axis === "y" ? "height" : "width";
|
|
44
|
+
}
|
|
45
|
+
function getSideAxis(placement) {
|
|
46
|
+
return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
|
|
47
|
+
}
|
|
48
|
+
function getAlignmentAxis(placement) {
|
|
49
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
50
|
+
}
|
|
51
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
52
|
+
if (rtl === void 0) {
|
|
53
|
+
rtl = false;
|
|
54
|
+
}
|
|
55
|
+
const alignment = getAlignment(placement);
|
|
56
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
57
|
+
const length = getAxisLength(alignmentAxis);
|
|
58
|
+
let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
|
|
59
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
60
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
61
|
+
}
|
|
62
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
63
|
+
}
|
|
64
|
+
function getExpandedPlacements(placement) {
|
|
65
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
66
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
67
|
+
}
|
|
68
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
69
|
+
return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
|
|
70
|
+
}
|
|
71
|
+
function getSideList(side, isStart, rtl) {
|
|
72
|
+
const lr = ["left", "right"];
|
|
73
|
+
const rl = ["right", "left"];
|
|
74
|
+
const tb = ["top", "bottom"];
|
|
75
|
+
const bt = ["bottom", "top"];
|
|
76
|
+
switch (side) {
|
|
77
|
+
case "top":
|
|
78
|
+
case "bottom":
|
|
79
|
+
if (rtl)
|
|
80
|
+
return isStart ? rl : lr;
|
|
81
|
+
return isStart ? lr : rl;
|
|
82
|
+
case "left":
|
|
83
|
+
case "right":
|
|
84
|
+
return isStart ? tb : bt;
|
|
85
|
+
default:
|
|
86
|
+
return [];
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
90
|
+
const alignment = getAlignment(placement);
|
|
91
|
+
let list = getSideList(getSide(placement), direction === "start", rtl);
|
|
92
|
+
if (alignment) {
|
|
93
|
+
list = list.map((side) => side + "-" + alignment);
|
|
94
|
+
if (flipAlignment) {
|
|
95
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return list;
|
|
99
|
+
}
|
|
100
|
+
function getOppositePlacement(placement) {
|
|
101
|
+
return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
|
|
102
|
+
}
|
|
103
|
+
function expandPaddingObject(padding) {
|
|
104
|
+
return {
|
|
105
|
+
top: 0,
|
|
106
|
+
right: 0,
|
|
107
|
+
bottom: 0,
|
|
108
|
+
left: 0,
|
|
109
|
+
...padding
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function getPaddingObject(padding) {
|
|
113
|
+
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
|
114
|
+
top: padding,
|
|
115
|
+
right: padding,
|
|
116
|
+
bottom: padding,
|
|
117
|
+
left: padding
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function rectToClientRect(rect) {
|
|
121
|
+
const {
|
|
122
|
+
x,
|
|
123
|
+
y,
|
|
124
|
+
width,
|
|
125
|
+
height
|
|
126
|
+
} = rect;
|
|
127
|
+
return {
|
|
128
|
+
width,
|
|
129
|
+
height,
|
|
130
|
+
top: y,
|
|
131
|
+
left: x,
|
|
132
|
+
right: x + width,
|
|
133
|
+
bottom: y + height,
|
|
134
|
+
x,
|
|
135
|
+
y
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
139
|
+
let {
|
|
140
|
+
reference,
|
|
141
|
+
floating
|
|
142
|
+
} = _ref;
|
|
143
|
+
const sideAxis = getSideAxis(placement);
|
|
144
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
145
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
146
|
+
const side = getSide(placement);
|
|
147
|
+
const isVertical = sideAxis === "y";
|
|
148
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
149
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
150
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
151
|
+
let coords;
|
|
152
|
+
switch (side) {
|
|
153
|
+
case "top":
|
|
154
|
+
coords = {
|
|
155
|
+
x: commonX,
|
|
156
|
+
y: reference.y - floating.height
|
|
157
|
+
};
|
|
158
|
+
break;
|
|
159
|
+
case "bottom":
|
|
160
|
+
coords = {
|
|
161
|
+
x: commonX,
|
|
162
|
+
y: reference.y + reference.height
|
|
163
|
+
};
|
|
164
|
+
break;
|
|
165
|
+
case "right":
|
|
166
|
+
coords = {
|
|
167
|
+
x: reference.x + reference.width,
|
|
168
|
+
y: commonY
|
|
169
|
+
};
|
|
170
|
+
break;
|
|
171
|
+
case "left":
|
|
172
|
+
coords = {
|
|
173
|
+
x: reference.x - floating.width,
|
|
174
|
+
y: commonY
|
|
175
|
+
};
|
|
176
|
+
break;
|
|
177
|
+
default:
|
|
178
|
+
coords = {
|
|
179
|
+
x: reference.x,
|
|
180
|
+
y: reference.y
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
switch (getAlignment(placement)) {
|
|
184
|
+
case "start":
|
|
185
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
186
|
+
break;
|
|
187
|
+
case "end":
|
|
188
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
return coords;
|
|
192
|
+
}
|
|
193
|
+
const computePosition$1 = async (reference, floating, config) => {
|
|
194
|
+
const {
|
|
195
|
+
placement = "bottom",
|
|
196
|
+
strategy = "absolute",
|
|
197
|
+
middleware = [],
|
|
198
|
+
platform: platform2
|
|
199
|
+
} = config;
|
|
200
|
+
const validMiddleware = middleware.filter(Boolean);
|
|
201
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
|
|
202
|
+
let rects = await platform2.getElementRects({
|
|
203
|
+
reference,
|
|
204
|
+
floating,
|
|
205
|
+
strategy
|
|
206
|
+
});
|
|
207
|
+
let {
|
|
208
|
+
x,
|
|
209
|
+
y
|
|
210
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
211
|
+
let statefulPlacement = placement;
|
|
212
|
+
let middlewareData = {};
|
|
213
|
+
let resetCount = 0;
|
|
214
|
+
for (let i = 0; i < validMiddleware.length; i++) {
|
|
215
|
+
const {
|
|
216
|
+
name,
|
|
217
|
+
fn
|
|
218
|
+
} = validMiddleware[i];
|
|
219
|
+
const {
|
|
220
|
+
x: nextX,
|
|
221
|
+
y: nextY,
|
|
222
|
+
data,
|
|
223
|
+
reset
|
|
224
|
+
} = await fn({
|
|
225
|
+
x,
|
|
226
|
+
y,
|
|
227
|
+
initialPlacement: placement,
|
|
228
|
+
placement: statefulPlacement,
|
|
229
|
+
strategy,
|
|
230
|
+
middlewareData,
|
|
231
|
+
rects,
|
|
232
|
+
platform: platform2,
|
|
233
|
+
elements: {
|
|
234
|
+
reference,
|
|
235
|
+
floating
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
x = nextX != null ? nextX : x;
|
|
239
|
+
y = nextY != null ? nextY : y;
|
|
240
|
+
middlewareData = {
|
|
241
|
+
...middlewareData,
|
|
242
|
+
[name]: {
|
|
243
|
+
...middlewareData[name],
|
|
244
|
+
...data
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
if (reset && resetCount <= 50) {
|
|
248
|
+
resetCount++;
|
|
249
|
+
if (typeof reset === "object") {
|
|
250
|
+
if (reset.placement) {
|
|
251
|
+
statefulPlacement = reset.placement;
|
|
252
|
+
}
|
|
253
|
+
if (reset.rects) {
|
|
254
|
+
rects = reset.rects === true ? await platform2.getElementRects({
|
|
255
|
+
reference,
|
|
256
|
+
floating,
|
|
257
|
+
strategy
|
|
258
|
+
}) : reset.rects;
|
|
259
|
+
}
|
|
260
|
+
({
|
|
261
|
+
x,
|
|
262
|
+
y
|
|
263
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
264
|
+
}
|
|
265
|
+
i = -1;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return {
|
|
269
|
+
x,
|
|
270
|
+
y,
|
|
271
|
+
placement: statefulPlacement,
|
|
272
|
+
strategy,
|
|
273
|
+
middlewareData
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
async function detectOverflow(state, options) {
|
|
277
|
+
var _await$platform$isEle;
|
|
278
|
+
if (options === void 0) {
|
|
279
|
+
options = {};
|
|
280
|
+
}
|
|
281
|
+
const {
|
|
282
|
+
x,
|
|
283
|
+
y,
|
|
284
|
+
platform: platform2,
|
|
285
|
+
rects,
|
|
286
|
+
elements,
|
|
287
|
+
strategy
|
|
288
|
+
} = state;
|
|
289
|
+
const {
|
|
290
|
+
boundary = "clippingAncestors",
|
|
291
|
+
rootBoundary = "viewport",
|
|
292
|
+
elementContext = "floating",
|
|
293
|
+
altBoundary = false,
|
|
294
|
+
padding = 0
|
|
295
|
+
} = evaluate(options, state);
|
|
296
|
+
const paddingObject = getPaddingObject(padding);
|
|
297
|
+
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
298
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
299
|
+
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
|
|
300
|
+
element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
|
|
301
|
+
boundary,
|
|
302
|
+
rootBoundary,
|
|
303
|
+
strategy
|
|
304
|
+
}));
|
|
305
|
+
const rect = elementContext === "floating" ? {
|
|
306
|
+
x,
|
|
307
|
+
y,
|
|
308
|
+
width: rects.floating.width,
|
|
309
|
+
height: rects.floating.height
|
|
310
|
+
} : rects.reference;
|
|
311
|
+
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
312
|
+
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
313
|
+
x: 1,
|
|
314
|
+
y: 1
|
|
315
|
+
} : {
|
|
316
|
+
x: 1,
|
|
317
|
+
y: 1
|
|
318
|
+
};
|
|
319
|
+
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
320
|
+
elements,
|
|
321
|
+
rect,
|
|
322
|
+
offsetParent,
|
|
323
|
+
strategy
|
|
324
|
+
}) : rect);
|
|
325
|
+
return {
|
|
326
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
327
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
328
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
329
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
const arrow$3 = (options) => ({
|
|
333
|
+
name: "arrow",
|
|
334
|
+
options,
|
|
335
|
+
async fn(state) {
|
|
336
|
+
const {
|
|
337
|
+
x,
|
|
338
|
+
y,
|
|
339
|
+
placement,
|
|
340
|
+
rects,
|
|
341
|
+
platform: platform2,
|
|
342
|
+
elements,
|
|
343
|
+
middlewareData
|
|
344
|
+
} = state;
|
|
345
|
+
const {
|
|
346
|
+
element,
|
|
347
|
+
padding = 0
|
|
348
|
+
} = evaluate(options, state) || {};
|
|
349
|
+
if (element == null) {
|
|
350
|
+
return {};
|
|
351
|
+
}
|
|
352
|
+
const paddingObject = getPaddingObject(padding);
|
|
353
|
+
const coords = {
|
|
354
|
+
x,
|
|
355
|
+
y
|
|
356
|
+
};
|
|
357
|
+
const axis = getAlignmentAxis(placement);
|
|
358
|
+
const length = getAxisLength(axis);
|
|
359
|
+
const arrowDimensions = await platform2.getDimensions(element);
|
|
360
|
+
const isYAxis = axis === "y";
|
|
361
|
+
const minProp = isYAxis ? "top" : "left";
|
|
362
|
+
const maxProp = isYAxis ? "bottom" : "right";
|
|
363
|
+
const clientProp = isYAxis ? "clientHeight" : "clientWidth";
|
|
364
|
+
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
|
365
|
+
const startDiff = coords[axis] - rects.reference[axis];
|
|
366
|
+
const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
|
|
367
|
+
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
|
|
368
|
+
if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) {
|
|
369
|
+
clientSize = elements.floating[clientProp] || rects.floating[length];
|
|
370
|
+
}
|
|
371
|
+
const centerToReference = endDiff / 2 - startDiff / 2;
|
|
372
|
+
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
|
|
373
|
+
const minPadding = min(paddingObject[minProp], largestPossiblePadding);
|
|
374
|
+
const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
|
|
375
|
+
const min$1 = minPadding;
|
|
376
|
+
const max2 = clientSize - arrowDimensions[length] - maxPadding;
|
|
377
|
+
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
378
|
+
const offset2 = clamp(min$1, center, max2);
|
|
379
|
+
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
380
|
+
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
|
|
381
|
+
return {
|
|
382
|
+
[axis]: coords[axis] + alignmentOffset,
|
|
383
|
+
data: {
|
|
384
|
+
[axis]: offset2,
|
|
385
|
+
centerOffset: center - offset2 - alignmentOffset,
|
|
386
|
+
...shouldAddOffset && {
|
|
387
|
+
alignmentOffset
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
reset: shouldAddOffset
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
const flip$2 = function(options) {
|
|
395
|
+
if (options === void 0) {
|
|
396
|
+
options = {};
|
|
397
|
+
}
|
|
398
|
+
return {
|
|
399
|
+
name: "flip",
|
|
400
|
+
options,
|
|
401
|
+
async fn(state) {
|
|
402
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
403
|
+
const {
|
|
404
|
+
placement,
|
|
405
|
+
middlewareData,
|
|
406
|
+
rects,
|
|
407
|
+
initialPlacement,
|
|
408
|
+
platform: platform2,
|
|
409
|
+
elements
|
|
410
|
+
} = state;
|
|
411
|
+
const {
|
|
412
|
+
mainAxis: checkMainAxis = true,
|
|
413
|
+
crossAxis: checkCrossAxis = true,
|
|
414
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
415
|
+
fallbackStrategy = "bestFit",
|
|
416
|
+
fallbackAxisSideDirection = "none",
|
|
417
|
+
flipAlignment = true,
|
|
418
|
+
...detectOverflowOptions
|
|
419
|
+
} = evaluate(options, state);
|
|
420
|
+
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
421
|
+
return {};
|
|
422
|
+
}
|
|
423
|
+
const side = getSide(placement);
|
|
424
|
+
const initialSideAxis = getSideAxis(initialPlacement);
|
|
425
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
426
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
427
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
428
|
+
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
|
|
429
|
+
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
430
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
431
|
+
}
|
|
432
|
+
const placements = [initialPlacement, ...fallbackPlacements];
|
|
433
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
434
|
+
const overflows = [];
|
|
435
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
436
|
+
if (checkMainAxis) {
|
|
437
|
+
overflows.push(overflow[side]);
|
|
438
|
+
}
|
|
439
|
+
if (checkCrossAxis) {
|
|
440
|
+
const sides2 = getAlignmentSides(placement, rects, rtl);
|
|
441
|
+
overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
|
|
442
|
+
}
|
|
443
|
+
overflowsData = [...overflowsData, {
|
|
444
|
+
placement,
|
|
445
|
+
overflows
|
|
446
|
+
}];
|
|
447
|
+
if (!overflows.every((side2) => side2 <= 0)) {
|
|
448
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
449
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
450
|
+
const nextPlacement = placements[nextIndex];
|
|
451
|
+
if (nextPlacement) {
|
|
452
|
+
return {
|
|
453
|
+
data: {
|
|
454
|
+
index: nextIndex,
|
|
455
|
+
overflows: overflowsData
|
|
456
|
+
},
|
|
457
|
+
reset: {
|
|
458
|
+
placement: nextPlacement
|
|
459
|
+
}
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
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;
|
|
463
|
+
if (!resetPlacement) {
|
|
464
|
+
switch (fallbackStrategy) {
|
|
465
|
+
case "bestFit": {
|
|
466
|
+
var _overflowsData$filter2;
|
|
467
|
+
const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
|
|
468
|
+
if (hasFallbackAxisSideDirection) {
|
|
469
|
+
const currentSideAxis = getSideAxis(d.placement);
|
|
470
|
+
return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
|
|
471
|
+
// reading directions favoring greater width.
|
|
472
|
+
currentSideAxis === "y";
|
|
473
|
+
}
|
|
474
|
+
return true;
|
|
475
|
+
}).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
476
|
+
if (placement2) {
|
|
477
|
+
resetPlacement = placement2;
|
|
478
|
+
}
|
|
479
|
+
break;
|
|
480
|
+
}
|
|
481
|
+
case "initialPlacement":
|
|
482
|
+
resetPlacement = initialPlacement;
|
|
483
|
+
break;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
if (placement !== resetPlacement) {
|
|
487
|
+
return {
|
|
488
|
+
reset: {
|
|
489
|
+
placement: resetPlacement
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
return {};
|
|
495
|
+
}
|
|
496
|
+
};
|
|
497
|
+
};
|
|
498
|
+
function getSideOffsets(overflow, rect) {
|
|
499
|
+
return {
|
|
500
|
+
top: overflow.top - rect.height,
|
|
501
|
+
right: overflow.right - rect.width,
|
|
502
|
+
bottom: overflow.bottom - rect.height,
|
|
503
|
+
left: overflow.left - rect.width
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
function isAnySideFullyClipped(overflow) {
|
|
507
|
+
return sides.some((side) => overflow[side] >= 0);
|
|
508
|
+
}
|
|
509
|
+
const hide$2 = function(options) {
|
|
510
|
+
if (options === void 0) {
|
|
511
|
+
options = {};
|
|
512
|
+
}
|
|
513
|
+
return {
|
|
514
|
+
name: "hide",
|
|
515
|
+
options,
|
|
516
|
+
async fn(state) {
|
|
517
|
+
const {
|
|
518
|
+
rects
|
|
519
|
+
} = state;
|
|
520
|
+
const {
|
|
521
|
+
strategy = "referenceHidden",
|
|
522
|
+
...detectOverflowOptions
|
|
523
|
+
} = evaluate(options, state);
|
|
524
|
+
switch (strategy) {
|
|
525
|
+
case "referenceHidden": {
|
|
526
|
+
const overflow = await detectOverflow(state, {
|
|
527
|
+
...detectOverflowOptions,
|
|
528
|
+
elementContext: "reference"
|
|
529
|
+
});
|
|
530
|
+
const offsets = getSideOffsets(overflow, rects.reference);
|
|
531
|
+
return {
|
|
532
|
+
data: {
|
|
533
|
+
referenceHiddenOffsets: offsets,
|
|
534
|
+
referenceHidden: isAnySideFullyClipped(offsets)
|
|
535
|
+
}
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
case "escaped": {
|
|
539
|
+
const overflow = await detectOverflow(state, {
|
|
540
|
+
...detectOverflowOptions,
|
|
541
|
+
altBoundary: true
|
|
542
|
+
});
|
|
543
|
+
const offsets = getSideOffsets(overflow, rects.floating);
|
|
544
|
+
return {
|
|
545
|
+
data: {
|
|
546
|
+
escapedOffsets: offsets,
|
|
547
|
+
escaped: isAnySideFullyClipped(offsets)
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
default: {
|
|
552
|
+
return {};
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
};
|
|
558
|
+
async function convertValueToCoords(state, options) {
|
|
559
|
+
const {
|
|
560
|
+
placement,
|
|
561
|
+
platform: platform2,
|
|
562
|
+
elements
|
|
563
|
+
} = state;
|
|
564
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
565
|
+
const side = getSide(placement);
|
|
566
|
+
const alignment = getAlignment(placement);
|
|
567
|
+
const isVertical = getSideAxis(placement) === "y";
|
|
568
|
+
const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1;
|
|
569
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
570
|
+
const rawValue = evaluate(options, state);
|
|
571
|
+
let {
|
|
572
|
+
mainAxis,
|
|
573
|
+
crossAxis,
|
|
574
|
+
alignmentAxis
|
|
575
|
+
} = typeof rawValue === "number" ? {
|
|
576
|
+
mainAxis: rawValue,
|
|
577
|
+
crossAxis: 0,
|
|
578
|
+
alignmentAxis: null
|
|
579
|
+
} : {
|
|
580
|
+
mainAxis: rawValue.mainAxis || 0,
|
|
581
|
+
crossAxis: rawValue.crossAxis || 0,
|
|
582
|
+
alignmentAxis: rawValue.alignmentAxis
|
|
583
|
+
};
|
|
584
|
+
if (alignment && typeof alignmentAxis === "number") {
|
|
585
|
+
crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
|
|
586
|
+
}
|
|
587
|
+
return isVertical ? {
|
|
588
|
+
x: crossAxis * crossAxisMulti,
|
|
589
|
+
y: mainAxis * mainAxisMulti
|
|
590
|
+
} : {
|
|
591
|
+
x: mainAxis * mainAxisMulti,
|
|
592
|
+
y: crossAxis * crossAxisMulti
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
const offset$2 = function(options) {
|
|
596
|
+
if (options === void 0) {
|
|
597
|
+
options = 0;
|
|
598
|
+
}
|
|
599
|
+
return {
|
|
600
|
+
name: "offset",
|
|
601
|
+
options,
|
|
602
|
+
async fn(state) {
|
|
603
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
604
|
+
const {
|
|
605
|
+
x,
|
|
606
|
+
y,
|
|
607
|
+
placement,
|
|
608
|
+
middlewareData
|
|
609
|
+
} = state;
|
|
610
|
+
const diffCoords = await convertValueToCoords(state, options);
|
|
611
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
612
|
+
return {};
|
|
613
|
+
}
|
|
614
|
+
return {
|
|
615
|
+
x: x + diffCoords.x,
|
|
616
|
+
y: y + diffCoords.y,
|
|
617
|
+
data: {
|
|
618
|
+
...diffCoords,
|
|
619
|
+
placement
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
};
|
|
624
|
+
};
|
|
625
|
+
const shift$2 = function(options) {
|
|
626
|
+
if (options === void 0) {
|
|
627
|
+
options = {};
|
|
628
|
+
}
|
|
629
|
+
return {
|
|
630
|
+
name: "shift",
|
|
631
|
+
options,
|
|
632
|
+
async fn(state) {
|
|
633
|
+
const {
|
|
634
|
+
x,
|
|
635
|
+
y,
|
|
636
|
+
placement
|
|
637
|
+
} = state;
|
|
638
|
+
const {
|
|
639
|
+
mainAxis: checkMainAxis = true,
|
|
640
|
+
crossAxis: checkCrossAxis = false,
|
|
641
|
+
limiter = {
|
|
642
|
+
fn: (_ref) => {
|
|
643
|
+
let {
|
|
644
|
+
x: x2,
|
|
645
|
+
y: y2
|
|
646
|
+
} = _ref;
|
|
647
|
+
return {
|
|
648
|
+
x: x2,
|
|
649
|
+
y: y2
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
},
|
|
653
|
+
...detectOverflowOptions
|
|
654
|
+
} = evaluate(options, state);
|
|
655
|
+
const coords = {
|
|
656
|
+
x,
|
|
657
|
+
y
|
|
658
|
+
};
|
|
659
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
660
|
+
const crossAxis = getSideAxis(getSide(placement));
|
|
661
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
662
|
+
let mainAxisCoord = coords[mainAxis];
|
|
663
|
+
let crossAxisCoord = coords[crossAxis];
|
|
664
|
+
if (checkMainAxis) {
|
|
665
|
+
const minSide = mainAxis === "y" ? "top" : "left";
|
|
666
|
+
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
667
|
+
const min2 = mainAxisCoord + overflow[minSide];
|
|
668
|
+
const max2 = mainAxisCoord - overflow[maxSide];
|
|
669
|
+
mainAxisCoord = clamp(min2, mainAxisCoord, max2);
|
|
670
|
+
}
|
|
671
|
+
if (checkCrossAxis) {
|
|
672
|
+
const minSide = crossAxis === "y" ? "top" : "left";
|
|
673
|
+
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
674
|
+
const min2 = crossAxisCoord + overflow[minSide];
|
|
675
|
+
const max2 = crossAxisCoord - overflow[maxSide];
|
|
676
|
+
crossAxisCoord = clamp(min2, crossAxisCoord, max2);
|
|
677
|
+
}
|
|
678
|
+
const limitedCoords = limiter.fn({
|
|
679
|
+
...state,
|
|
680
|
+
[mainAxis]: mainAxisCoord,
|
|
681
|
+
[crossAxis]: crossAxisCoord
|
|
682
|
+
});
|
|
683
|
+
return {
|
|
684
|
+
...limitedCoords,
|
|
685
|
+
data: {
|
|
686
|
+
x: limitedCoords.x - x,
|
|
687
|
+
y: limitedCoords.y - y,
|
|
688
|
+
enabled: {
|
|
689
|
+
[mainAxis]: checkMainAxis,
|
|
690
|
+
[crossAxis]: checkCrossAxis
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
};
|
|
697
|
+
const limitShift$2 = function(options) {
|
|
698
|
+
if (options === void 0) {
|
|
699
|
+
options = {};
|
|
700
|
+
}
|
|
701
|
+
return {
|
|
702
|
+
options,
|
|
703
|
+
fn(state) {
|
|
704
|
+
const {
|
|
705
|
+
x,
|
|
706
|
+
y,
|
|
707
|
+
placement,
|
|
708
|
+
rects,
|
|
709
|
+
middlewareData
|
|
710
|
+
} = state;
|
|
711
|
+
const {
|
|
712
|
+
offset: offset2 = 0,
|
|
713
|
+
mainAxis: checkMainAxis = true,
|
|
714
|
+
crossAxis: checkCrossAxis = true
|
|
715
|
+
} = evaluate(options, state);
|
|
716
|
+
const coords = {
|
|
717
|
+
x,
|
|
718
|
+
y
|
|
719
|
+
};
|
|
720
|
+
const crossAxis = getSideAxis(placement);
|
|
721
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
722
|
+
let mainAxisCoord = coords[mainAxis];
|
|
723
|
+
let crossAxisCoord = coords[crossAxis];
|
|
724
|
+
const rawOffset = evaluate(offset2, state);
|
|
725
|
+
const computedOffset = typeof rawOffset === "number" ? {
|
|
726
|
+
mainAxis: rawOffset,
|
|
727
|
+
crossAxis: 0
|
|
728
|
+
} : {
|
|
729
|
+
mainAxis: 0,
|
|
730
|
+
crossAxis: 0,
|
|
731
|
+
...rawOffset
|
|
732
|
+
};
|
|
733
|
+
if (checkMainAxis) {
|
|
734
|
+
const len = mainAxis === "y" ? "height" : "width";
|
|
735
|
+
const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
|
|
736
|
+
const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
|
|
737
|
+
if (mainAxisCoord < limitMin) {
|
|
738
|
+
mainAxisCoord = limitMin;
|
|
739
|
+
} else if (mainAxisCoord > limitMax) {
|
|
740
|
+
mainAxisCoord = limitMax;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
if (checkCrossAxis) {
|
|
744
|
+
var _middlewareData$offse, _middlewareData$offse2;
|
|
745
|
+
const len = mainAxis === "y" ? "width" : "height";
|
|
746
|
+
const isOriginSide = ["top", "left"].includes(getSide(placement));
|
|
747
|
+
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);
|
|
748
|
+
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);
|
|
749
|
+
if (crossAxisCoord < limitMin) {
|
|
750
|
+
crossAxisCoord = limitMin;
|
|
751
|
+
} else if (crossAxisCoord > limitMax) {
|
|
752
|
+
crossAxisCoord = limitMax;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
return {
|
|
756
|
+
[mainAxis]: mainAxisCoord,
|
|
757
|
+
[crossAxis]: crossAxisCoord
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
};
|
|
761
|
+
};
|
|
762
|
+
const size$2 = function(options) {
|
|
763
|
+
if (options === void 0) {
|
|
764
|
+
options = {};
|
|
765
|
+
}
|
|
766
|
+
return {
|
|
767
|
+
name: "size",
|
|
768
|
+
options,
|
|
769
|
+
async fn(state) {
|
|
770
|
+
var _state$middlewareData, _state$middlewareData2;
|
|
771
|
+
const {
|
|
772
|
+
placement,
|
|
773
|
+
rects,
|
|
774
|
+
platform: platform2,
|
|
775
|
+
elements
|
|
776
|
+
} = state;
|
|
777
|
+
const {
|
|
778
|
+
apply = () => {
|
|
779
|
+
},
|
|
780
|
+
...detectOverflowOptions
|
|
781
|
+
} = evaluate(options, state);
|
|
782
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
783
|
+
const side = getSide(placement);
|
|
784
|
+
const alignment = getAlignment(placement);
|
|
785
|
+
const isYAxis = getSideAxis(placement) === "y";
|
|
786
|
+
const {
|
|
787
|
+
width,
|
|
788
|
+
height
|
|
789
|
+
} = rects.floating;
|
|
790
|
+
let heightSide;
|
|
791
|
+
let widthSide;
|
|
792
|
+
if (side === "top" || side === "bottom") {
|
|
793
|
+
heightSide = side;
|
|
794
|
+
widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
|
|
795
|
+
} else {
|
|
796
|
+
widthSide = side;
|
|
797
|
+
heightSide = alignment === "end" ? "top" : "bottom";
|
|
798
|
+
}
|
|
799
|
+
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
800
|
+
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
801
|
+
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
|
|
802
|
+
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
|
|
803
|
+
const noShift = !state.middlewareData.shift;
|
|
804
|
+
let availableHeight = overflowAvailableHeight;
|
|
805
|
+
let availableWidth = overflowAvailableWidth;
|
|
806
|
+
if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
|
|
807
|
+
availableWidth = maximumClippingWidth;
|
|
808
|
+
}
|
|
809
|
+
if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
|
|
810
|
+
availableHeight = maximumClippingHeight;
|
|
811
|
+
}
|
|
812
|
+
if (noShift && !alignment) {
|
|
813
|
+
const xMin = max(overflow.left, 0);
|
|
814
|
+
const xMax = max(overflow.right, 0);
|
|
815
|
+
const yMin = max(overflow.top, 0);
|
|
816
|
+
const yMax = max(overflow.bottom, 0);
|
|
817
|
+
if (isYAxis) {
|
|
818
|
+
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
819
|
+
} else {
|
|
820
|
+
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
await apply({
|
|
824
|
+
...state,
|
|
825
|
+
availableWidth,
|
|
826
|
+
availableHeight
|
|
827
|
+
});
|
|
828
|
+
const nextDimensions = await platform2.getDimensions(elements.floating);
|
|
829
|
+
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
830
|
+
return {
|
|
831
|
+
reset: {
|
|
832
|
+
rects: true
|
|
833
|
+
}
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
return {};
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
};
|
|
840
|
+
function hasWindow() {
|
|
841
|
+
return typeof window !== "undefined";
|
|
842
|
+
}
|
|
843
|
+
function getNodeName(node) {
|
|
844
|
+
if (isNode(node)) {
|
|
845
|
+
return (node.nodeName || "").toLowerCase();
|
|
846
|
+
}
|
|
847
|
+
return "#document";
|
|
848
|
+
}
|
|
849
|
+
function getWindow(node) {
|
|
850
|
+
var _node$ownerDocument;
|
|
851
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
852
|
+
}
|
|
853
|
+
function getDocumentElement(node) {
|
|
854
|
+
var _ref;
|
|
855
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
856
|
+
}
|
|
857
|
+
function isNode(value) {
|
|
858
|
+
if (!hasWindow()) {
|
|
859
|
+
return false;
|
|
860
|
+
}
|
|
861
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
862
|
+
}
|
|
863
|
+
function isElement(value) {
|
|
864
|
+
if (!hasWindow()) {
|
|
865
|
+
return false;
|
|
866
|
+
}
|
|
867
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
868
|
+
}
|
|
869
|
+
function isHTMLElement(value) {
|
|
870
|
+
if (!hasWindow()) {
|
|
871
|
+
return false;
|
|
872
|
+
}
|
|
873
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
874
|
+
}
|
|
875
|
+
function isShadowRoot(value) {
|
|
876
|
+
if (!hasWindow() || typeof ShadowRoot === "undefined") {
|
|
877
|
+
return false;
|
|
878
|
+
}
|
|
879
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
880
|
+
}
|
|
881
|
+
function isOverflowElement(element) {
|
|
882
|
+
const {
|
|
883
|
+
overflow,
|
|
884
|
+
overflowX,
|
|
885
|
+
overflowY,
|
|
886
|
+
display
|
|
887
|
+
} = getComputedStyle(element);
|
|
888
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
|
|
889
|
+
}
|
|
890
|
+
function isTableElement(element) {
|
|
891
|
+
return ["table", "td", "th"].includes(getNodeName(element));
|
|
892
|
+
}
|
|
893
|
+
function isTopLayer(element) {
|
|
894
|
+
return [":popover-open", ":modal"].some((selector) => {
|
|
895
|
+
try {
|
|
896
|
+
return element.matches(selector);
|
|
897
|
+
} catch (e) {
|
|
898
|
+
return false;
|
|
899
|
+
}
|
|
900
|
+
});
|
|
901
|
+
}
|
|
902
|
+
function isContainingBlock(elementOrCss) {
|
|
903
|
+
const webkit = isWebKit();
|
|
904
|
+
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
905
|
+
return css.transform !== "none" || css.perspective !== "none" || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value));
|
|
906
|
+
}
|
|
907
|
+
function getContainingBlock(element) {
|
|
908
|
+
let currentNode = getParentNode(element);
|
|
909
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
910
|
+
if (isContainingBlock(currentNode)) {
|
|
911
|
+
return currentNode;
|
|
912
|
+
} else if (isTopLayer(currentNode)) {
|
|
913
|
+
return null;
|
|
914
|
+
}
|
|
915
|
+
currentNode = getParentNode(currentNode);
|
|
916
|
+
}
|
|
917
|
+
return null;
|
|
918
|
+
}
|
|
919
|
+
function isWebKit() {
|
|
920
|
+
if (typeof CSS === "undefined" || !CSS.supports)
|
|
921
|
+
return false;
|
|
922
|
+
return CSS.supports("-webkit-backdrop-filter", "none");
|
|
923
|
+
}
|
|
924
|
+
function isLastTraversableNode(node) {
|
|
925
|
+
return ["html", "body", "#document"].includes(getNodeName(node));
|
|
926
|
+
}
|
|
927
|
+
function getComputedStyle(element) {
|
|
928
|
+
return getWindow(element).getComputedStyle(element);
|
|
929
|
+
}
|
|
930
|
+
function getNodeScroll(element) {
|
|
931
|
+
if (isElement(element)) {
|
|
932
|
+
return {
|
|
933
|
+
scrollLeft: element.scrollLeft,
|
|
934
|
+
scrollTop: element.scrollTop
|
|
935
|
+
};
|
|
936
|
+
}
|
|
937
|
+
return {
|
|
938
|
+
scrollLeft: element.scrollX,
|
|
939
|
+
scrollTop: element.scrollY
|
|
940
|
+
};
|
|
941
|
+
}
|
|
942
|
+
function getParentNode(node) {
|
|
943
|
+
if (getNodeName(node) === "html") {
|
|
944
|
+
return node;
|
|
945
|
+
}
|
|
946
|
+
const result = (
|
|
947
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
948
|
+
node.assignedSlot || // DOM Element detected.
|
|
949
|
+
node.parentNode || // ShadowRoot detected.
|
|
950
|
+
isShadowRoot(node) && node.host || // Fallback.
|
|
951
|
+
getDocumentElement(node)
|
|
952
|
+
);
|
|
953
|
+
return isShadowRoot(result) ? result.host : result;
|
|
954
|
+
}
|
|
955
|
+
function getNearestOverflowAncestor(node) {
|
|
956
|
+
const parentNode = getParentNode(node);
|
|
957
|
+
if (isLastTraversableNode(parentNode)) {
|
|
958
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
959
|
+
}
|
|
960
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
961
|
+
return parentNode;
|
|
962
|
+
}
|
|
963
|
+
return getNearestOverflowAncestor(parentNode);
|
|
964
|
+
}
|
|
965
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
966
|
+
var _node$ownerDocument2;
|
|
967
|
+
if (list === void 0) {
|
|
968
|
+
list = [];
|
|
969
|
+
}
|
|
970
|
+
if (traverseIframes === void 0) {
|
|
971
|
+
traverseIframes = true;
|
|
972
|
+
}
|
|
973
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
974
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
975
|
+
const win = getWindow(scrollableAncestor);
|
|
976
|
+
if (isBody) {
|
|
977
|
+
const frameElement = getFrameElement(win);
|
|
978
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
979
|
+
}
|
|
980
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
981
|
+
}
|
|
982
|
+
function getFrameElement(win) {
|
|
983
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
984
|
+
}
|
|
985
|
+
function getCssDimensions(element) {
|
|
986
|
+
const css = getComputedStyle(element);
|
|
987
|
+
let width = parseFloat(css.width) || 0;
|
|
988
|
+
let height = parseFloat(css.height) || 0;
|
|
989
|
+
const hasOffset = isHTMLElement(element);
|
|
990
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
991
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
992
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
993
|
+
if (shouldFallback) {
|
|
994
|
+
width = offsetWidth;
|
|
995
|
+
height = offsetHeight;
|
|
996
|
+
}
|
|
997
|
+
return {
|
|
998
|
+
width,
|
|
999
|
+
height,
|
|
1000
|
+
$: shouldFallback
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
1003
|
+
function unwrapElement(element) {
|
|
1004
|
+
return !isElement(element) ? element.contextElement : element;
|
|
1005
|
+
}
|
|
1006
|
+
function getScale(element) {
|
|
1007
|
+
const domElement = unwrapElement(element);
|
|
1008
|
+
if (!isHTMLElement(domElement)) {
|
|
1009
|
+
return createCoords(1);
|
|
1010
|
+
}
|
|
1011
|
+
const rect = domElement.getBoundingClientRect();
|
|
1012
|
+
const {
|
|
1013
|
+
width,
|
|
1014
|
+
height,
|
|
1015
|
+
$
|
|
1016
|
+
} = getCssDimensions(domElement);
|
|
1017
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
1018
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
1019
|
+
if (!x || !Number.isFinite(x)) {
|
|
1020
|
+
x = 1;
|
|
1021
|
+
}
|
|
1022
|
+
if (!y || !Number.isFinite(y)) {
|
|
1023
|
+
y = 1;
|
|
1024
|
+
}
|
|
1025
|
+
return {
|
|
1026
|
+
x,
|
|
1027
|
+
y
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
const noOffsets = /* @__PURE__ */ createCoords(0);
|
|
1031
|
+
function getVisualOffsets(element) {
|
|
1032
|
+
const win = getWindow(element);
|
|
1033
|
+
if (!isWebKit() || !win.visualViewport) {
|
|
1034
|
+
return noOffsets;
|
|
1035
|
+
}
|
|
1036
|
+
return {
|
|
1037
|
+
x: win.visualViewport.offsetLeft,
|
|
1038
|
+
y: win.visualViewport.offsetTop
|
|
1039
|
+
};
|
|
1040
|
+
}
|
|
1041
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
1042
|
+
if (isFixed === void 0) {
|
|
1043
|
+
isFixed = false;
|
|
1044
|
+
}
|
|
1045
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
1046
|
+
return false;
|
|
1047
|
+
}
|
|
1048
|
+
return isFixed;
|
|
1049
|
+
}
|
|
1050
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
1051
|
+
if (includeScale === void 0) {
|
|
1052
|
+
includeScale = false;
|
|
1053
|
+
}
|
|
1054
|
+
if (isFixedStrategy === void 0) {
|
|
1055
|
+
isFixedStrategy = false;
|
|
1056
|
+
}
|
|
1057
|
+
const clientRect = element.getBoundingClientRect();
|
|
1058
|
+
const domElement = unwrapElement(element);
|
|
1059
|
+
let scale = createCoords(1);
|
|
1060
|
+
if (includeScale) {
|
|
1061
|
+
if (offsetParent) {
|
|
1062
|
+
if (isElement(offsetParent)) {
|
|
1063
|
+
scale = getScale(offsetParent);
|
|
1064
|
+
}
|
|
1065
|
+
} else {
|
|
1066
|
+
scale = getScale(element);
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
1070
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
1071
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
1072
|
+
let width = clientRect.width / scale.x;
|
|
1073
|
+
let height = clientRect.height / scale.y;
|
|
1074
|
+
if (domElement) {
|
|
1075
|
+
const win = getWindow(domElement);
|
|
1076
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
1077
|
+
let currentWin = win;
|
|
1078
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
1079
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
1080
|
+
const iframeScale = getScale(currentIFrame);
|
|
1081
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
1082
|
+
const css = getComputedStyle(currentIFrame);
|
|
1083
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
1084
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
1085
|
+
x *= iframeScale.x;
|
|
1086
|
+
y *= iframeScale.y;
|
|
1087
|
+
width *= iframeScale.x;
|
|
1088
|
+
height *= iframeScale.y;
|
|
1089
|
+
x += left;
|
|
1090
|
+
y += top;
|
|
1091
|
+
currentWin = getWindow(currentIFrame);
|
|
1092
|
+
currentIFrame = getFrameElement(currentWin);
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
return rectToClientRect({
|
|
1096
|
+
width,
|
|
1097
|
+
height,
|
|
1098
|
+
x,
|
|
1099
|
+
y
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
function getWindowScrollBarX(element, rect) {
|
|
1103
|
+
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
1104
|
+
if (!rect) {
|
|
1105
|
+
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
1106
|
+
}
|
|
1107
|
+
return rect.left + leftScroll;
|
|
1108
|
+
}
|
|
1109
|
+
function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
|
|
1110
|
+
if (ignoreScrollbarX === void 0) {
|
|
1111
|
+
ignoreScrollbarX = false;
|
|
1112
|
+
}
|
|
1113
|
+
const htmlRect = documentElement.getBoundingClientRect();
|
|
1114
|
+
const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 : (
|
|
1115
|
+
// RTL <body> scrollbar.
|
|
1116
|
+
getWindowScrollBarX(documentElement, htmlRect)
|
|
1117
|
+
));
|
|
1118
|
+
const y = htmlRect.top + scroll.scrollTop;
|
|
1119
|
+
return {
|
|
1120
|
+
x,
|
|
1121
|
+
y
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
1124
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
1125
|
+
let {
|
|
1126
|
+
elements,
|
|
1127
|
+
rect,
|
|
1128
|
+
offsetParent,
|
|
1129
|
+
strategy
|
|
1130
|
+
} = _ref;
|
|
1131
|
+
const isFixed = strategy === "fixed";
|
|
1132
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
1133
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
1134
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
1135
|
+
return rect;
|
|
1136
|
+
}
|
|
1137
|
+
let scroll = {
|
|
1138
|
+
scrollLeft: 0,
|
|
1139
|
+
scrollTop: 0
|
|
1140
|
+
};
|
|
1141
|
+
let scale = createCoords(1);
|
|
1142
|
+
const offsets = createCoords(0);
|
|
1143
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1144
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1145
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
1146
|
+
scroll = getNodeScroll(offsetParent);
|
|
1147
|
+
}
|
|
1148
|
+
if (isHTMLElement(offsetParent)) {
|
|
1149
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
1150
|
+
scale = getScale(offsetParent);
|
|
1151
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1152
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
|
|
1156
|
+
return {
|
|
1157
|
+
width: rect.width * scale.x,
|
|
1158
|
+
height: rect.height * scale.y,
|
|
1159
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
1160
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
1161
|
+
};
|
|
1162
|
+
}
|
|
1163
|
+
function getClientRects(element) {
|
|
1164
|
+
return Array.from(element.getClientRects());
|
|
1165
|
+
}
|
|
1166
|
+
function getDocumentRect(element) {
|
|
1167
|
+
const html = getDocumentElement(element);
|
|
1168
|
+
const scroll = getNodeScroll(element);
|
|
1169
|
+
const body = element.ownerDocument.body;
|
|
1170
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
1171
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
1172
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
1173
|
+
const y = -scroll.scrollTop;
|
|
1174
|
+
if (getComputedStyle(body).direction === "rtl") {
|
|
1175
|
+
x += max(html.clientWidth, body.clientWidth) - width;
|
|
1176
|
+
}
|
|
1177
|
+
return {
|
|
1178
|
+
width,
|
|
1179
|
+
height,
|
|
1180
|
+
x,
|
|
1181
|
+
y
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
function getViewportRect(element, strategy) {
|
|
1185
|
+
const win = getWindow(element);
|
|
1186
|
+
const html = getDocumentElement(element);
|
|
1187
|
+
const visualViewport = win.visualViewport;
|
|
1188
|
+
let width = html.clientWidth;
|
|
1189
|
+
let height = html.clientHeight;
|
|
1190
|
+
let x = 0;
|
|
1191
|
+
let y = 0;
|
|
1192
|
+
if (visualViewport) {
|
|
1193
|
+
width = visualViewport.width;
|
|
1194
|
+
height = visualViewport.height;
|
|
1195
|
+
const visualViewportBased = isWebKit();
|
|
1196
|
+
if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
|
|
1197
|
+
x = visualViewport.offsetLeft;
|
|
1198
|
+
y = visualViewport.offsetTop;
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
return {
|
|
1202
|
+
width,
|
|
1203
|
+
height,
|
|
1204
|
+
x,
|
|
1205
|
+
y
|
|
1206
|
+
};
|
|
1207
|
+
}
|
|
1208
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
1209
|
+
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
|
1210
|
+
const top = clientRect.top + element.clientTop;
|
|
1211
|
+
const left = clientRect.left + element.clientLeft;
|
|
1212
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
1213
|
+
const width = element.clientWidth * scale.x;
|
|
1214
|
+
const height = element.clientHeight * scale.y;
|
|
1215
|
+
const x = left * scale.x;
|
|
1216
|
+
const y = top * scale.y;
|
|
1217
|
+
return {
|
|
1218
|
+
width,
|
|
1219
|
+
height,
|
|
1220
|
+
x,
|
|
1221
|
+
y
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1224
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
1225
|
+
let rect;
|
|
1226
|
+
if (clippingAncestor === "viewport") {
|
|
1227
|
+
rect = getViewportRect(element, strategy);
|
|
1228
|
+
} else if (clippingAncestor === "document") {
|
|
1229
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
1230
|
+
} else if (isElement(clippingAncestor)) {
|
|
1231
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
1232
|
+
} else {
|
|
1233
|
+
const visualOffsets = getVisualOffsets(element);
|
|
1234
|
+
rect = {
|
|
1235
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
1236
|
+
y: clippingAncestor.y - visualOffsets.y,
|
|
1237
|
+
width: clippingAncestor.width,
|
|
1238
|
+
height: clippingAncestor.height
|
|
1239
|
+
};
|
|
1240
|
+
}
|
|
1241
|
+
return rectToClientRect(rect);
|
|
1242
|
+
}
|
|
1243
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
1244
|
+
const parentNode = getParentNode(element);
|
|
1245
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
1246
|
+
return false;
|
|
1247
|
+
}
|
|
1248
|
+
return getComputedStyle(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
|
|
1249
|
+
}
|
|
1250
|
+
function getClippingElementAncestors(element, cache) {
|
|
1251
|
+
const cachedResult = cache.get(element);
|
|
1252
|
+
if (cachedResult) {
|
|
1253
|
+
return cachedResult;
|
|
1254
|
+
}
|
|
1255
|
+
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
|
1256
|
+
let currentContainingBlockComputedStyle = null;
|
|
1257
|
+
const elementIsFixed = getComputedStyle(element).position === "fixed";
|
|
1258
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
1259
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1260
|
+
const computedStyle = getComputedStyle(currentNode);
|
|
1261
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
1262
|
+
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
|
|
1263
|
+
currentContainingBlockComputedStyle = null;
|
|
1264
|
+
}
|
|
1265
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
1266
|
+
if (shouldDropCurrentNode) {
|
|
1267
|
+
result = result.filter((ancestor) => ancestor !== currentNode);
|
|
1268
|
+
} else {
|
|
1269
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
1270
|
+
}
|
|
1271
|
+
currentNode = getParentNode(currentNode);
|
|
1272
|
+
}
|
|
1273
|
+
cache.set(element, result);
|
|
1274
|
+
return result;
|
|
1275
|
+
}
|
|
1276
|
+
function getClippingRect(_ref) {
|
|
1277
|
+
let {
|
|
1278
|
+
element,
|
|
1279
|
+
boundary,
|
|
1280
|
+
rootBoundary,
|
|
1281
|
+
strategy
|
|
1282
|
+
} = _ref;
|
|
1283
|
+
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
1284
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
1285
|
+
const firstClippingAncestor = clippingAncestors[0];
|
|
1286
|
+
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
1287
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
1288
|
+
accRect.top = max(rect.top, accRect.top);
|
|
1289
|
+
accRect.right = min(rect.right, accRect.right);
|
|
1290
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
1291
|
+
accRect.left = max(rect.left, accRect.left);
|
|
1292
|
+
return accRect;
|
|
1293
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
1294
|
+
return {
|
|
1295
|
+
width: clippingRect.right - clippingRect.left,
|
|
1296
|
+
height: clippingRect.bottom - clippingRect.top,
|
|
1297
|
+
x: clippingRect.left,
|
|
1298
|
+
y: clippingRect.top
|
|
1299
|
+
};
|
|
1300
|
+
}
|
|
1301
|
+
function getDimensions(element) {
|
|
1302
|
+
const {
|
|
1303
|
+
width,
|
|
1304
|
+
height
|
|
1305
|
+
} = getCssDimensions(element);
|
|
1306
|
+
return {
|
|
1307
|
+
width,
|
|
1308
|
+
height
|
|
1309
|
+
};
|
|
1310
|
+
}
|
|
1311
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
1312
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1313
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
1314
|
+
const isFixed = strategy === "fixed";
|
|
1315
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
1316
|
+
let scroll = {
|
|
1317
|
+
scrollLeft: 0,
|
|
1318
|
+
scrollTop: 0
|
|
1319
|
+
};
|
|
1320
|
+
const offsets = createCoords(0);
|
|
1321
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1322
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
1323
|
+
scroll = getNodeScroll(offsetParent);
|
|
1324
|
+
}
|
|
1325
|
+
if (isOffsetParentAnElement) {
|
|
1326
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
1327
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1328
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1329
|
+
} else if (documentElement) {
|
|
1330
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
1334
|
+
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
1335
|
+
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
1336
|
+
return {
|
|
1337
|
+
x,
|
|
1338
|
+
y,
|
|
1339
|
+
width: rect.width,
|
|
1340
|
+
height: rect.height
|
|
1341
|
+
};
|
|
1342
|
+
}
|
|
1343
|
+
function isStaticPositioned(element) {
|
|
1344
|
+
return getComputedStyle(element).position === "static";
|
|
1345
|
+
}
|
|
1346
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
1347
|
+
if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
|
|
1348
|
+
return null;
|
|
1349
|
+
}
|
|
1350
|
+
if (polyfill) {
|
|
1351
|
+
return polyfill(element);
|
|
1352
|
+
}
|
|
1353
|
+
let rawOffsetParent = element.offsetParent;
|
|
1354
|
+
if (getDocumentElement(element) === rawOffsetParent) {
|
|
1355
|
+
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
1356
|
+
}
|
|
1357
|
+
return rawOffsetParent;
|
|
1358
|
+
}
|
|
1359
|
+
function getOffsetParent(element, polyfill) {
|
|
1360
|
+
const win = getWindow(element);
|
|
1361
|
+
if (isTopLayer(element)) {
|
|
1362
|
+
return win;
|
|
1363
|
+
}
|
|
1364
|
+
if (!isHTMLElement(element)) {
|
|
1365
|
+
let svgOffsetParent = getParentNode(element);
|
|
1366
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
1367
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
1368
|
+
return svgOffsetParent;
|
|
1369
|
+
}
|
|
1370
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
1371
|
+
}
|
|
1372
|
+
return win;
|
|
1373
|
+
}
|
|
1374
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
1375
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
1376
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
1377
|
+
}
|
|
1378
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
1379
|
+
return win;
|
|
1380
|
+
}
|
|
1381
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
1382
|
+
}
|
|
1383
|
+
const getElementRects = async function(data) {
|
|
1384
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
1385
|
+
const getDimensionsFn = this.getDimensions;
|
|
1386
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
1387
|
+
return {
|
|
1388
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
1389
|
+
floating: {
|
|
1390
|
+
x: 0,
|
|
1391
|
+
y: 0,
|
|
1392
|
+
width: floatingDimensions.width,
|
|
1393
|
+
height: floatingDimensions.height
|
|
1394
|
+
}
|
|
1395
|
+
};
|
|
1396
|
+
};
|
|
1397
|
+
function isRTL(element) {
|
|
1398
|
+
return getComputedStyle(element).direction === "rtl";
|
|
1399
|
+
}
|
|
1400
|
+
const platform = {
|
|
1401
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
1402
|
+
getDocumentElement,
|
|
1403
|
+
getClippingRect,
|
|
1404
|
+
getOffsetParent,
|
|
1405
|
+
getElementRects,
|
|
1406
|
+
getClientRects,
|
|
1407
|
+
getDimensions,
|
|
1408
|
+
getScale,
|
|
1409
|
+
isElement,
|
|
1410
|
+
isRTL
|
|
1411
|
+
};
|
|
1412
|
+
function observeMove(element, onMove) {
|
|
1413
|
+
let io = null;
|
|
1414
|
+
let timeoutId;
|
|
1415
|
+
const root = getDocumentElement(element);
|
|
1416
|
+
function cleanup() {
|
|
1417
|
+
var _io;
|
|
1418
|
+
clearTimeout(timeoutId);
|
|
1419
|
+
(_io = io) == null || _io.disconnect();
|
|
1420
|
+
io = null;
|
|
1421
|
+
}
|
|
1422
|
+
function refresh(skip, threshold) {
|
|
1423
|
+
if (skip === void 0) {
|
|
1424
|
+
skip = false;
|
|
1425
|
+
}
|
|
1426
|
+
if (threshold === void 0) {
|
|
1427
|
+
threshold = 1;
|
|
1428
|
+
}
|
|
1429
|
+
cleanup();
|
|
1430
|
+
const {
|
|
1431
|
+
left,
|
|
1432
|
+
top,
|
|
1433
|
+
width,
|
|
1434
|
+
height
|
|
1435
|
+
} = element.getBoundingClientRect();
|
|
1436
|
+
if (!skip) {
|
|
1437
|
+
onMove();
|
|
1438
|
+
}
|
|
1439
|
+
if (!width || !height) {
|
|
1440
|
+
return;
|
|
1441
|
+
}
|
|
1442
|
+
const insetTop = floor(top);
|
|
1443
|
+
const insetRight = floor(root.clientWidth - (left + width));
|
|
1444
|
+
const insetBottom = floor(root.clientHeight - (top + height));
|
|
1445
|
+
const insetLeft = floor(left);
|
|
1446
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
1447
|
+
const options = {
|
|
1448
|
+
rootMargin,
|
|
1449
|
+
threshold: max(0, min(1, threshold)) || 1
|
|
1450
|
+
};
|
|
1451
|
+
let isFirstUpdate = true;
|
|
1452
|
+
function handleObserve(entries) {
|
|
1453
|
+
const ratio = entries[0].intersectionRatio;
|
|
1454
|
+
if (ratio !== threshold) {
|
|
1455
|
+
if (!isFirstUpdate) {
|
|
1456
|
+
return refresh();
|
|
1457
|
+
}
|
|
1458
|
+
if (!ratio) {
|
|
1459
|
+
timeoutId = setTimeout(() => {
|
|
1460
|
+
refresh(false, 1e-7);
|
|
1461
|
+
}, 1e3);
|
|
1462
|
+
} else {
|
|
1463
|
+
refresh(false, ratio);
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
isFirstUpdate = false;
|
|
1467
|
+
}
|
|
1468
|
+
try {
|
|
1469
|
+
io = new IntersectionObserver(handleObserve, {
|
|
1470
|
+
...options,
|
|
1471
|
+
// Handle <iframe>s
|
|
1472
|
+
root: root.ownerDocument
|
|
1473
|
+
});
|
|
1474
|
+
} catch (e) {
|
|
1475
|
+
io = new IntersectionObserver(handleObserve, options);
|
|
1476
|
+
}
|
|
1477
|
+
io.observe(element);
|
|
1478
|
+
}
|
|
1479
|
+
refresh(true);
|
|
1480
|
+
return cleanup;
|
|
1481
|
+
}
|
|
1482
|
+
function autoUpdate(reference, floating, update, options) {
|
|
1483
|
+
if (options === void 0) {
|
|
1484
|
+
options = {};
|
|
1485
|
+
}
|
|
1486
|
+
const {
|
|
1487
|
+
ancestorScroll = true,
|
|
1488
|
+
ancestorResize = true,
|
|
1489
|
+
elementResize = typeof ResizeObserver === "function",
|
|
1490
|
+
layoutShift = typeof IntersectionObserver === "function",
|
|
1491
|
+
animationFrame = false
|
|
1492
|
+
} = options;
|
|
1493
|
+
const referenceEl = unwrapElement(reference);
|
|
1494
|
+
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
|
|
1495
|
+
ancestors.forEach((ancestor) => {
|
|
1496
|
+
ancestorScroll && ancestor.addEventListener("scroll", update, {
|
|
1497
|
+
passive: true
|
|
1498
|
+
});
|
|
1499
|
+
ancestorResize && ancestor.addEventListener("resize", update);
|
|
1500
|
+
});
|
|
1501
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
1502
|
+
let reobserveFrame = -1;
|
|
1503
|
+
let resizeObserver = null;
|
|
1504
|
+
if (elementResize) {
|
|
1505
|
+
resizeObserver = new ResizeObserver((_ref) => {
|
|
1506
|
+
let [firstEntry] = _ref;
|
|
1507
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
1508
|
+
resizeObserver.unobserve(floating);
|
|
1509
|
+
cancelAnimationFrame(reobserveFrame);
|
|
1510
|
+
reobserveFrame = requestAnimationFrame(() => {
|
|
1511
|
+
var _resizeObserver;
|
|
1512
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
1513
|
+
});
|
|
1514
|
+
}
|
|
1515
|
+
update();
|
|
1516
|
+
});
|
|
1517
|
+
if (referenceEl && !animationFrame) {
|
|
1518
|
+
resizeObserver.observe(referenceEl);
|
|
1519
|
+
}
|
|
1520
|
+
resizeObserver.observe(floating);
|
|
1521
|
+
}
|
|
1522
|
+
let frameId;
|
|
1523
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
1524
|
+
if (animationFrame) {
|
|
1525
|
+
frameLoop();
|
|
1526
|
+
}
|
|
1527
|
+
function frameLoop() {
|
|
1528
|
+
const nextRefRect = getBoundingClientRect(reference);
|
|
1529
|
+
if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
|
|
1530
|
+
update();
|
|
1531
|
+
}
|
|
1532
|
+
prevRefRect = nextRefRect;
|
|
1533
|
+
frameId = requestAnimationFrame(frameLoop);
|
|
1534
|
+
}
|
|
1535
|
+
update();
|
|
1536
|
+
return () => {
|
|
1537
|
+
var _resizeObserver2;
|
|
1538
|
+
ancestors.forEach((ancestor) => {
|
|
1539
|
+
ancestorScroll && ancestor.removeEventListener("scroll", update);
|
|
1540
|
+
ancestorResize && ancestor.removeEventListener("resize", update);
|
|
1541
|
+
});
|
|
1542
|
+
cleanupIo == null || cleanupIo();
|
|
1543
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
1544
|
+
resizeObserver = null;
|
|
1545
|
+
if (animationFrame) {
|
|
1546
|
+
cancelAnimationFrame(frameId);
|
|
1547
|
+
}
|
|
1548
|
+
};
|
|
1549
|
+
}
|
|
1550
|
+
const offset$1 = offset$2;
|
|
1551
|
+
const shift$1 = shift$2;
|
|
1552
|
+
const flip$1 = flip$2;
|
|
1553
|
+
const size$1 = size$2;
|
|
1554
|
+
const hide$1 = hide$2;
|
|
1555
|
+
const arrow$2 = arrow$3;
|
|
1556
|
+
const limitShift$1 = limitShift$2;
|
|
1557
|
+
const computePosition = (reference, floating, options) => {
|
|
1558
|
+
const cache = /* @__PURE__ */ new Map();
|
|
1559
|
+
const mergedOptions = {
|
|
1560
|
+
platform,
|
|
1561
|
+
...options
|
|
1562
|
+
};
|
|
1563
|
+
const platformWithCache = {
|
|
1564
|
+
...mergedOptions.platform,
|
|
1565
|
+
_c: cache
|
|
1566
|
+
};
|
|
1567
|
+
return computePosition$1(reference, floating, {
|
|
1568
|
+
...mergedOptions,
|
|
1569
|
+
platform: platformWithCache
|
|
1570
|
+
});
|
|
1571
|
+
};
|
|
1572
|
+
var index = typeof document !== "undefined" ? useLayoutEffect : useEffect;
|
|
1573
|
+
function deepEqual(a, b) {
|
|
1574
|
+
if (a === b) {
|
|
1575
|
+
return true;
|
|
1576
|
+
}
|
|
1577
|
+
if (typeof a !== typeof b) {
|
|
1578
|
+
return false;
|
|
1579
|
+
}
|
|
1580
|
+
if (typeof a === "function" && a.toString() === b.toString()) {
|
|
1581
|
+
return true;
|
|
1582
|
+
}
|
|
1583
|
+
let length;
|
|
1584
|
+
let i;
|
|
1585
|
+
let keys;
|
|
1586
|
+
if (a && b && typeof a === "object") {
|
|
1587
|
+
if (Array.isArray(a)) {
|
|
1588
|
+
length = a.length;
|
|
1589
|
+
if (length !== b.length)
|
|
1590
|
+
return false;
|
|
1591
|
+
for (i = length; i-- !== 0; ) {
|
|
1592
|
+
if (!deepEqual(a[i], b[i])) {
|
|
1593
|
+
return false;
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
return true;
|
|
1597
|
+
}
|
|
1598
|
+
keys = Object.keys(a);
|
|
1599
|
+
length = keys.length;
|
|
1600
|
+
if (length !== Object.keys(b).length) {
|
|
1601
|
+
return false;
|
|
1602
|
+
}
|
|
1603
|
+
for (i = length; i-- !== 0; ) {
|
|
1604
|
+
if (!{}.hasOwnProperty.call(b, keys[i])) {
|
|
1605
|
+
return false;
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
for (i = length; i-- !== 0; ) {
|
|
1609
|
+
const key = keys[i];
|
|
1610
|
+
if (key === "_owner" && a.$$typeof) {
|
|
1611
|
+
continue;
|
|
1612
|
+
}
|
|
1613
|
+
if (!deepEqual(a[key], b[key])) {
|
|
1614
|
+
return false;
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
return true;
|
|
1618
|
+
}
|
|
1619
|
+
return a !== a && b !== b;
|
|
1620
|
+
}
|
|
1621
|
+
function getDPR(element) {
|
|
1622
|
+
if (typeof window === "undefined") {
|
|
1623
|
+
return 1;
|
|
1624
|
+
}
|
|
1625
|
+
const win = element.ownerDocument.defaultView || window;
|
|
1626
|
+
return win.devicePixelRatio || 1;
|
|
1627
|
+
}
|
|
1628
|
+
function roundByDPR(element, value) {
|
|
1629
|
+
const dpr = getDPR(element);
|
|
1630
|
+
return Math.round(value * dpr) / dpr;
|
|
1631
|
+
}
|
|
1632
|
+
function useLatestRef(value) {
|
|
1633
|
+
const ref = React.useRef(value);
|
|
1634
|
+
index(() => {
|
|
1635
|
+
ref.current = value;
|
|
1636
|
+
});
|
|
1637
|
+
return ref;
|
|
1638
|
+
}
|
|
1639
|
+
function useFloating(options) {
|
|
1640
|
+
if (options === void 0) {
|
|
1641
|
+
options = {};
|
|
1642
|
+
}
|
|
1643
|
+
const {
|
|
1644
|
+
placement = "bottom",
|
|
1645
|
+
strategy = "absolute",
|
|
1646
|
+
middleware = [],
|
|
1647
|
+
platform: platform2,
|
|
1648
|
+
elements: {
|
|
1649
|
+
reference: externalReference,
|
|
1650
|
+
floating: externalFloating
|
|
1651
|
+
} = {},
|
|
1652
|
+
transform = true,
|
|
1653
|
+
whileElementsMounted,
|
|
1654
|
+
open
|
|
1655
|
+
} = options;
|
|
1656
|
+
const [data, setData] = React.useState({
|
|
1657
|
+
x: 0,
|
|
1658
|
+
y: 0,
|
|
1659
|
+
strategy,
|
|
1660
|
+
placement,
|
|
1661
|
+
middlewareData: {},
|
|
1662
|
+
isPositioned: false
|
|
1663
|
+
});
|
|
1664
|
+
const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);
|
|
1665
|
+
if (!deepEqual(latestMiddleware, middleware)) {
|
|
1666
|
+
setLatestMiddleware(middleware);
|
|
1667
|
+
}
|
|
1668
|
+
const [_reference, _setReference] = React.useState(null);
|
|
1669
|
+
const [_floating, _setFloating] = React.useState(null);
|
|
1670
|
+
const setReference = React.useCallback((node) => {
|
|
1671
|
+
if (node !== referenceRef.current) {
|
|
1672
|
+
referenceRef.current = node;
|
|
1673
|
+
_setReference(node);
|
|
1674
|
+
}
|
|
1675
|
+
}, []);
|
|
1676
|
+
const setFloating = React.useCallback((node) => {
|
|
1677
|
+
if (node !== floatingRef.current) {
|
|
1678
|
+
floatingRef.current = node;
|
|
1679
|
+
_setFloating(node);
|
|
1680
|
+
}
|
|
1681
|
+
}, []);
|
|
1682
|
+
const referenceEl = externalReference || _reference;
|
|
1683
|
+
const floatingEl = externalFloating || _floating;
|
|
1684
|
+
const referenceRef = React.useRef(null);
|
|
1685
|
+
const floatingRef = React.useRef(null);
|
|
1686
|
+
const dataRef = React.useRef(data);
|
|
1687
|
+
const hasWhileElementsMounted = whileElementsMounted != null;
|
|
1688
|
+
const whileElementsMountedRef = useLatestRef(whileElementsMounted);
|
|
1689
|
+
const platformRef = useLatestRef(platform2);
|
|
1690
|
+
const openRef = useLatestRef(open);
|
|
1691
|
+
const update = React.useCallback(() => {
|
|
1692
|
+
if (!referenceRef.current || !floatingRef.current) {
|
|
1693
|
+
return;
|
|
1694
|
+
}
|
|
1695
|
+
const config = {
|
|
1696
|
+
placement,
|
|
1697
|
+
strategy,
|
|
1698
|
+
middleware: latestMiddleware
|
|
1699
|
+
};
|
|
1700
|
+
if (platformRef.current) {
|
|
1701
|
+
config.platform = platformRef.current;
|
|
1702
|
+
}
|
|
1703
|
+
computePosition(referenceRef.current, floatingRef.current, config).then((data2) => {
|
|
1704
|
+
const fullData = {
|
|
1705
|
+
...data2,
|
|
1706
|
+
// The floating element's position may be recomputed while it's closed
|
|
1707
|
+
// but still mounted (such as when transitioning out). To ensure
|
|
1708
|
+
// `isPositioned` will be `false` initially on the next open, avoid
|
|
1709
|
+
// setting it to `true` when `open === false` (must be specified).
|
|
1710
|
+
isPositioned: openRef.current !== false
|
|
1711
|
+
};
|
|
1712
|
+
if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
|
|
1713
|
+
dataRef.current = fullData;
|
|
1714
|
+
reactDomExports.flushSync(() => {
|
|
1715
|
+
setData(fullData);
|
|
1716
|
+
});
|
|
1717
|
+
}
|
|
1718
|
+
});
|
|
1719
|
+
}, [latestMiddleware, placement, strategy, platformRef, openRef]);
|
|
1720
|
+
index(() => {
|
|
1721
|
+
if (open === false && dataRef.current.isPositioned) {
|
|
1722
|
+
dataRef.current.isPositioned = false;
|
|
1723
|
+
setData((data2) => ({
|
|
1724
|
+
...data2,
|
|
1725
|
+
isPositioned: false
|
|
1726
|
+
}));
|
|
1727
|
+
}
|
|
1728
|
+
}, [open]);
|
|
1729
|
+
const isMountedRef = React.useRef(false);
|
|
1730
|
+
index(() => {
|
|
1731
|
+
isMountedRef.current = true;
|
|
1732
|
+
return () => {
|
|
1733
|
+
isMountedRef.current = false;
|
|
1734
|
+
};
|
|
1735
|
+
}, []);
|
|
1736
|
+
index(() => {
|
|
1737
|
+
if (referenceEl)
|
|
1738
|
+
referenceRef.current = referenceEl;
|
|
1739
|
+
if (floatingEl)
|
|
1740
|
+
floatingRef.current = floatingEl;
|
|
1741
|
+
if (referenceEl && floatingEl) {
|
|
1742
|
+
if (whileElementsMountedRef.current) {
|
|
1743
|
+
return whileElementsMountedRef.current(referenceEl, floatingEl, update);
|
|
1744
|
+
}
|
|
1745
|
+
update();
|
|
1746
|
+
}
|
|
1747
|
+
}, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
|
|
1748
|
+
const refs = React.useMemo(() => ({
|
|
1749
|
+
reference: referenceRef,
|
|
1750
|
+
floating: floatingRef,
|
|
1751
|
+
setReference,
|
|
1752
|
+
setFloating
|
|
1753
|
+
}), [setReference, setFloating]);
|
|
1754
|
+
const elements = React.useMemo(() => ({
|
|
1755
|
+
reference: referenceEl,
|
|
1756
|
+
floating: floatingEl
|
|
1757
|
+
}), [referenceEl, floatingEl]);
|
|
1758
|
+
const floatingStyles = React.useMemo(() => {
|
|
1759
|
+
const initialStyles = {
|
|
1760
|
+
position: strategy,
|
|
1761
|
+
left: 0,
|
|
1762
|
+
top: 0
|
|
1763
|
+
};
|
|
1764
|
+
if (!elements.floating) {
|
|
1765
|
+
return initialStyles;
|
|
1766
|
+
}
|
|
1767
|
+
const x = roundByDPR(elements.floating, data.x);
|
|
1768
|
+
const y = roundByDPR(elements.floating, data.y);
|
|
1769
|
+
if (transform) {
|
|
1770
|
+
return {
|
|
1771
|
+
...initialStyles,
|
|
1772
|
+
transform: "translate(" + x + "px, " + y + "px)",
|
|
1773
|
+
...getDPR(elements.floating) >= 1.5 && {
|
|
1774
|
+
willChange: "transform"
|
|
1775
|
+
}
|
|
1776
|
+
};
|
|
1777
|
+
}
|
|
1778
|
+
return {
|
|
1779
|
+
position: strategy,
|
|
1780
|
+
left: x,
|
|
1781
|
+
top: y
|
|
1782
|
+
};
|
|
1783
|
+
}, [strategy, transform, elements.floating, data.x, data.y]);
|
|
1784
|
+
return React.useMemo(() => ({
|
|
1785
|
+
...data,
|
|
1786
|
+
update,
|
|
1787
|
+
refs,
|
|
1788
|
+
elements,
|
|
1789
|
+
floatingStyles
|
|
1790
|
+
}), [data, update, refs, elements, floatingStyles]);
|
|
1791
|
+
}
|
|
1792
|
+
const arrow$1 = (options) => {
|
|
1793
|
+
function isRef(value) {
|
|
1794
|
+
return {}.hasOwnProperty.call(value, "current");
|
|
1795
|
+
}
|
|
1796
|
+
return {
|
|
1797
|
+
name: "arrow",
|
|
1798
|
+
options,
|
|
1799
|
+
fn(state) {
|
|
1800
|
+
const {
|
|
1801
|
+
element,
|
|
1802
|
+
padding
|
|
1803
|
+
} = typeof options === "function" ? options(state) : options;
|
|
1804
|
+
if (element && isRef(element)) {
|
|
1805
|
+
if (element.current != null) {
|
|
1806
|
+
return arrow$2({
|
|
1807
|
+
element: element.current,
|
|
1808
|
+
padding
|
|
1809
|
+
}).fn(state);
|
|
1810
|
+
}
|
|
1811
|
+
return {};
|
|
1812
|
+
}
|
|
1813
|
+
if (element) {
|
|
1814
|
+
return arrow$2({
|
|
1815
|
+
element,
|
|
1816
|
+
padding
|
|
1817
|
+
}).fn(state);
|
|
1818
|
+
}
|
|
1819
|
+
return {};
|
|
1820
|
+
}
|
|
1821
|
+
};
|
|
1822
|
+
};
|
|
1823
|
+
const offset = (options, deps) => ({
|
|
1824
|
+
...offset$1(options),
|
|
1825
|
+
options: [options, deps]
|
|
1826
|
+
});
|
|
1827
|
+
const shift = (options, deps) => ({
|
|
1828
|
+
...shift$1(options),
|
|
1829
|
+
options: [options, deps]
|
|
1830
|
+
});
|
|
1831
|
+
const limitShift = (options, deps) => ({
|
|
1832
|
+
...limitShift$1(options),
|
|
1833
|
+
options: [options, deps]
|
|
1834
|
+
});
|
|
1835
|
+
const flip = (options, deps) => ({
|
|
1836
|
+
...flip$1(options),
|
|
1837
|
+
options: [options, deps]
|
|
1838
|
+
});
|
|
1839
|
+
const size = (options, deps) => ({
|
|
1840
|
+
...size$1(options),
|
|
1841
|
+
options: [options, deps]
|
|
1842
|
+
});
|
|
1843
|
+
const hide = (options, deps) => ({
|
|
1844
|
+
...hide$1(options),
|
|
1845
|
+
options: [options, deps]
|
|
1846
|
+
});
|
|
1847
|
+
const arrow = (options, deps) => ({
|
|
1848
|
+
...arrow$1(options),
|
|
1849
|
+
options: [options, deps]
|
|
1850
|
+
});
|
|
1851
|
+
var NAME = "Arrow";
|
|
1852
|
+
var Arrow$1 = React.forwardRef((props, forwardedRef) => {
|
|
1853
|
+
const { children, width = 10, height = 5, ...arrowProps } = props;
|
|
1854
|
+
return /* @__PURE__ */ jsx(
|
|
1855
|
+
Primitive.svg,
|
|
1856
|
+
{
|
|
1857
|
+
...arrowProps,
|
|
1858
|
+
ref: forwardedRef,
|
|
1859
|
+
width,
|
|
1860
|
+
height,
|
|
1861
|
+
viewBox: "0 0 30 10",
|
|
1862
|
+
preserveAspectRatio: "none",
|
|
1863
|
+
children: props.asChild ? children : /* @__PURE__ */ jsx("polygon", { points: "0,0 30,0 15,10" })
|
|
1864
|
+
}
|
|
1865
|
+
);
|
|
1866
|
+
});
|
|
1867
|
+
Arrow$1.displayName = NAME;
|
|
1868
|
+
var Root = Arrow$1;
|
|
1869
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
1870
|
+
let defaultContexts = [];
|
|
1871
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
1872
|
+
const BaseContext = React.createContext(defaultContext);
|
|
1873
|
+
const index2 = defaultContexts.length;
|
|
1874
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
1875
|
+
function Provider(props) {
|
|
1876
|
+
const { scope, children, ...context } = props;
|
|
1877
|
+
const Context = (scope == null ? void 0 : scope[scopeName][index2]) || BaseContext;
|
|
1878
|
+
const value = React.useMemo(() => context, Object.values(context));
|
|
1879
|
+
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
1880
|
+
}
|
|
1881
|
+
function useContext2(consumerName, scope) {
|
|
1882
|
+
const Context = (scope == null ? void 0 : scope[scopeName][index2]) || BaseContext;
|
|
1883
|
+
const context = React.useContext(Context);
|
|
1884
|
+
if (context)
|
|
1885
|
+
return context;
|
|
1886
|
+
if (defaultContext !== void 0)
|
|
1887
|
+
return defaultContext;
|
|
1888
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
1889
|
+
}
|
|
1890
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
1891
|
+
return [Provider, useContext2];
|
|
1892
|
+
}
|
|
1893
|
+
const createScope = () => {
|
|
1894
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
1895
|
+
return React.createContext(defaultContext);
|
|
1896
|
+
});
|
|
1897
|
+
return function useScope(scope) {
|
|
1898
|
+
const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
|
|
1899
|
+
return React.useMemo(
|
|
1900
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
1901
|
+
[scope, contexts]
|
|
1902
|
+
);
|
|
1903
|
+
};
|
|
1904
|
+
};
|
|
1905
|
+
createScope.scopeName = scopeName;
|
|
1906
|
+
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
1907
|
+
}
|
|
1908
|
+
function composeContextScopes(...scopes) {
|
|
1909
|
+
const baseScope = scopes[0];
|
|
1910
|
+
if (scopes.length === 1)
|
|
1911
|
+
return baseScope;
|
|
1912
|
+
const createScope = () => {
|
|
1913
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
1914
|
+
useScope: createScope2(),
|
|
1915
|
+
scopeName: createScope2.scopeName
|
|
1916
|
+
}));
|
|
1917
|
+
return function useComposedScopes(overrideScopes) {
|
|
1918
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
1919
|
+
const scopeProps = useScope(overrideScopes);
|
|
1920
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
1921
|
+
return { ...nextScopes2, ...currentScope };
|
|
1922
|
+
}, {});
|
|
1923
|
+
return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
1924
|
+
};
|
|
1925
|
+
};
|
|
1926
|
+
createScope.scopeName = baseScope.scopeName;
|
|
1927
|
+
return createScope;
|
|
1928
|
+
}
|
|
1929
|
+
var POPPER_NAME = "Popper";
|
|
1930
|
+
var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
1931
|
+
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
1932
|
+
var Popper = (props) => {
|
|
1933
|
+
const { __scopePopper, children } = props;
|
|
1934
|
+
const [anchor, setAnchor] = React.useState(null);
|
|
1935
|
+
return /* @__PURE__ */ jsx(PopperProvider, { scope: __scopePopper, anchor, onAnchorChange: setAnchor, children });
|
|
1936
|
+
};
|
|
1937
|
+
Popper.displayName = POPPER_NAME;
|
|
1938
|
+
var ANCHOR_NAME = "PopperAnchor";
|
|
1939
|
+
var PopperAnchor = React.forwardRef(
|
|
1940
|
+
(props, forwardedRef) => {
|
|
1941
|
+
const { __scopePopper, virtualRef, ...anchorProps } = props;
|
|
1942
|
+
const context = usePopperContext(ANCHOR_NAME, __scopePopper);
|
|
1943
|
+
const ref = React.useRef(null);
|
|
1944
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
1945
|
+
React.useEffect(() => {
|
|
1946
|
+
context.onAnchorChange((virtualRef == null ? void 0 : virtualRef.current) || ref.current);
|
|
1947
|
+
});
|
|
1948
|
+
return virtualRef ? null : /* @__PURE__ */ jsx(Primitive.div, { ...anchorProps, ref: composedRefs });
|
|
1949
|
+
}
|
|
1950
|
+
);
|
|
1951
|
+
PopperAnchor.displayName = ANCHOR_NAME;
|
|
1952
|
+
var CONTENT_NAME = "PopperContent";
|
|
1953
|
+
var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME);
|
|
1954
|
+
var PopperContent = React.forwardRef(
|
|
1955
|
+
(props, forwardedRef) => {
|
|
1956
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1957
|
+
const {
|
|
1958
|
+
__scopePopper,
|
|
1959
|
+
side = "bottom",
|
|
1960
|
+
sideOffset = 0,
|
|
1961
|
+
align = "center",
|
|
1962
|
+
alignOffset = 0,
|
|
1963
|
+
arrowPadding = 0,
|
|
1964
|
+
avoidCollisions = true,
|
|
1965
|
+
collisionBoundary = [],
|
|
1966
|
+
collisionPadding: collisionPaddingProp = 0,
|
|
1967
|
+
sticky = "partial",
|
|
1968
|
+
hideWhenDetached = false,
|
|
1969
|
+
updatePositionStrategy = "optimized",
|
|
1970
|
+
onPlaced,
|
|
1971
|
+
...contentProps
|
|
1972
|
+
} = props;
|
|
1973
|
+
const context = usePopperContext(CONTENT_NAME, __scopePopper);
|
|
1974
|
+
const [content, setContent] = React.useState(null);
|
|
1975
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
|
|
1976
|
+
const [arrow$12, setArrow] = React.useState(null);
|
|
1977
|
+
const arrowSize = useSize(arrow$12);
|
|
1978
|
+
const arrowWidth = (arrowSize == null ? void 0 : arrowSize.width) ?? 0;
|
|
1979
|
+
const arrowHeight = (arrowSize == null ? void 0 : arrowSize.height) ?? 0;
|
|
1980
|
+
const desiredPlacement = side + (align !== "center" ? "-" + align : "");
|
|
1981
|
+
const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };
|
|
1982
|
+
const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];
|
|
1983
|
+
const hasExplicitBoundaries = boundary.length > 0;
|
|
1984
|
+
const detectOverflowOptions = {
|
|
1985
|
+
padding: collisionPadding,
|
|
1986
|
+
boundary: boundary.filter(isNotNull),
|
|
1987
|
+
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
1988
|
+
altBoundary: hasExplicitBoundaries
|
|
1989
|
+
};
|
|
1990
|
+
const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({
|
|
1991
|
+
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
1992
|
+
strategy: "fixed",
|
|
1993
|
+
placement: desiredPlacement,
|
|
1994
|
+
whileElementsMounted: (...args) => {
|
|
1995
|
+
const cleanup = autoUpdate(...args, {
|
|
1996
|
+
animationFrame: updatePositionStrategy === "always"
|
|
1997
|
+
});
|
|
1998
|
+
return cleanup;
|
|
1999
|
+
},
|
|
2000
|
+
elements: {
|
|
2001
|
+
reference: context.anchor
|
|
2002
|
+
},
|
|
2003
|
+
middleware: [
|
|
2004
|
+
offset({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),
|
|
2005
|
+
avoidCollisions && shift({
|
|
2006
|
+
mainAxis: true,
|
|
2007
|
+
crossAxis: false,
|
|
2008
|
+
limiter: sticky === "partial" ? limitShift() : void 0,
|
|
2009
|
+
...detectOverflowOptions
|
|
2010
|
+
}),
|
|
2011
|
+
avoidCollisions && flip({ ...detectOverflowOptions }),
|
|
2012
|
+
size({
|
|
2013
|
+
...detectOverflowOptions,
|
|
2014
|
+
apply: ({ elements, rects, availableWidth, availableHeight }) => {
|
|
2015
|
+
const { width: anchorWidth, height: anchorHeight } = rects.reference;
|
|
2016
|
+
const contentStyle = elements.floating.style;
|
|
2017
|
+
contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`);
|
|
2018
|
+
contentStyle.setProperty("--radix-popper-available-height", `${availableHeight}px`);
|
|
2019
|
+
contentStyle.setProperty("--radix-popper-anchor-width", `${anchorWidth}px`);
|
|
2020
|
+
contentStyle.setProperty("--radix-popper-anchor-height", `${anchorHeight}px`);
|
|
2021
|
+
}
|
|
2022
|
+
}),
|
|
2023
|
+
arrow$12 && arrow({ element: arrow$12, padding: arrowPadding }),
|
|
2024
|
+
transformOrigin({ arrowWidth, arrowHeight }),
|
|
2025
|
+
hideWhenDetached && hide({ strategy: "referenceHidden", ...detectOverflowOptions })
|
|
2026
|
+
]
|
|
2027
|
+
});
|
|
2028
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
2029
|
+
const handlePlaced = useCallbackRef(onPlaced);
|
|
2030
|
+
useLayoutEffect2(() => {
|
|
2031
|
+
if (isPositioned) {
|
|
2032
|
+
handlePlaced == null ? void 0 : handlePlaced();
|
|
2033
|
+
}
|
|
2034
|
+
}, [isPositioned, handlePlaced]);
|
|
2035
|
+
const arrowX = (_a = middlewareData.arrow) == null ? void 0 : _a.x;
|
|
2036
|
+
const arrowY = (_b = middlewareData.arrow) == null ? void 0 : _b.y;
|
|
2037
|
+
const cannotCenterArrow = ((_c = middlewareData.arrow) == null ? void 0 : _c.centerOffset) !== 0;
|
|
2038
|
+
const [contentZIndex, setContentZIndex] = React.useState();
|
|
2039
|
+
useLayoutEffect2(() => {
|
|
2040
|
+
if (content)
|
|
2041
|
+
setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
2042
|
+
}, [content]);
|
|
2043
|
+
return /* @__PURE__ */ jsx(
|
|
2044
|
+
"div",
|
|
2045
|
+
{
|
|
2046
|
+
ref: refs.setFloating,
|
|
2047
|
+
"data-radix-popper-content-wrapper": "",
|
|
2048
|
+
style: {
|
|
2049
|
+
...floatingStyles,
|
|
2050
|
+
transform: isPositioned ? floatingStyles.transform : "translate(0, -200%)",
|
|
2051
|
+
// keep off the page when measuring
|
|
2052
|
+
minWidth: "max-content",
|
|
2053
|
+
zIndex: contentZIndex,
|
|
2054
|
+
["--radix-popper-transform-origin"]: [
|
|
2055
|
+
(_d = middlewareData.transformOrigin) == null ? void 0 : _d.x,
|
|
2056
|
+
(_e = middlewareData.transformOrigin) == null ? void 0 : _e.y
|
|
2057
|
+
].join(" "),
|
|
2058
|
+
// hide the content if using the hide middleware and should be hidden
|
|
2059
|
+
// set visibility to hidden and disable pointer events so the UI behaves
|
|
2060
|
+
// as if the PopperContent isn't there at all
|
|
2061
|
+
...((_f = middlewareData.hide) == null ? void 0 : _f.referenceHidden) && {
|
|
2062
|
+
visibility: "hidden",
|
|
2063
|
+
pointerEvents: "none"
|
|
2064
|
+
}
|
|
2065
|
+
},
|
|
2066
|
+
dir: props.dir,
|
|
2067
|
+
children: /* @__PURE__ */ jsx(
|
|
2068
|
+
PopperContentProvider,
|
|
2069
|
+
{
|
|
2070
|
+
scope: __scopePopper,
|
|
2071
|
+
placedSide,
|
|
2072
|
+
onArrowChange: setArrow,
|
|
2073
|
+
arrowX,
|
|
2074
|
+
arrowY,
|
|
2075
|
+
shouldHideArrow: cannotCenterArrow,
|
|
2076
|
+
children: /* @__PURE__ */ jsx(
|
|
2077
|
+
Primitive.div,
|
|
2078
|
+
{
|
|
2079
|
+
"data-side": placedSide,
|
|
2080
|
+
"data-align": placedAlign,
|
|
2081
|
+
...contentProps,
|
|
2082
|
+
ref: composedRefs,
|
|
2083
|
+
style: {
|
|
2084
|
+
...contentProps.style,
|
|
2085
|
+
// if the PopperContent hasn't been placed yet (not all measurements done)
|
|
2086
|
+
// we prevent animations so that users's animation don't kick in too early referring wrong sides
|
|
2087
|
+
animation: !isPositioned ? "none" : void 0
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
)
|
|
2091
|
+
}
|
|
2092
|
+
)
|
|
2093
|
+
}
|
|
2094
|
+
);
|
|
2095
|
+
}
|
|
2096
|
+
);
|
|
2097
|
+
PopperContent.displayName = CONTENT_NAME;
|
|
2098
|
+
var ARROW_NAME = "PopperArrow";
|
|
2099
|
+
var OPPOSITE_SIDE = {
|
|
2100
|
+
top: "bottom",
|
|
2101
|
+
right: "left",
|
|
2102
|
+
bottom: "top",
|
|
2103
|
+
left: "right"
|
|
2104
|
+
};
|
|
2105
|
+
var PopperArrow = React.forwardRef(function PopperArrow2(props, forwardedRef) {
|
|
2106
|
+
const { __scopePopper, ...arrowProps } = props;
|
|
2107
|
+
const contentContext = useContentContext(ARROW_NAME, __scopePopper);
|
|
2108
|
+
const baseSide = OPPOSITE_SIDE[contentContext.placedSide];
|
|
2109
|
+
return (
|
|
2110
|
+
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
2111
|
+
// doesn't report size as we'd expect on SVG elements.
|
|
2112
|
+
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
2113
|
+
/* @__PURE__ */ jsx(
|
|
2114
|
+
"span",
|
|
2115
|
+
{
|
|
2116
|
+
ref: contentContext.onArrowChange,
|
|
2117
|
+
style: {
|
|
2118
|
+
position: "absolute",
|
|
2119
|
+
left: contentContext.arrowX,
|
|
2120
|
+
top: contentContext.arrowY,
|
|
2121
|
+
[baseSide]: 0,
|
|
2122
|
+
transformOrigin: {
|
|
2123
|
+
top: "",
|
|
2124
|
+
right: "0 0",
|
|
2125
|
+
bottom: "center 0",
|
|
2126
|
+
left: "100% 0"
|
|
2127
|
+
}[contentContext.placedSide],
|
|
2128
|
+
transform: {
|
|
2129
|
+
top: "translateY(100%)",
|
|
2130
|
+
right: "translateY(50%) rotate(90deg) translateX(-50%)",
|
|
2131
|
+
bottom: `rotate(180deg)`,
|
|
2132
|
+
left: "translateY(50%) rotate(-90deg) translateX(50%)"
|
|
2133
|
+
}[contentContext.placedSide],
|
|
2134
|
+
visibility: contentContext.shouldHideArrow ? "hidden" : void 0
|
|
2135
|
+
},
|
|
2136
|
+
children: /* @__PURE__ */ jsx(
|
|
2137
|
+
Root,
|
|
2138
|
+
{
|
|
2139
|
+
...arrowProps,
|
|
2140
|
+
ref: forwardedRef,
|
|
2141
|
+
style: {
|
|
2142
|
+
...arrowProps.style,
|
|
2143
|
+
// ensures the element can be measured correctly (mostly for if SVG)
|
|
2144
|
+
display: "block"
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
)
|
|
2148
|
+
}
|
|
2149
|
+
)
|
|
2150
|
+
);
|
|
2151
|
+
});
|
|
2152
|
+
PopperArrow.displayName = ARROW_NAME;
|
|
2153
|
+
function isNotNull(value) {
|
|
2154
|
+
return value !== null;
|
|
2155
|
+
}
|
|
2156
|
+
var transformOrigin = (options) => ({
|
|
2157
|
+
name: "transformOrigin",
|
|
2158
|
+
options,
|
|
2159
|
+
fn(data) {
|
|
2160
|
+
var _a, _b, _c;
|
|
2161
|
+
const { placement, rects, middlewareData } = data;
|
|
2162
|
+
const cannotCenterArrow = ((_a = middlewareData.arrow) == null ? void 0 : _a.centerOffset) !== 0;
|
|
2163
|
+
const isArrowHidden = cannotCenterArrow;
|
|
2164
|
+
const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
|
|
2165
|
+
const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
|
|
2166
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
2167
|
+
const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign];
|
|
2168
|
+
const arrowXCenter = (((_b = middlewareData.arrow) == null ? void 0 : _b.x) ?? 0) + arrowWidth / 2;
|
|
2169
|
+
const arrowYCenter = (((_c = middlewareData.arrow) == null ? void 0 : _c.y) ?? 0) + arrowHeight / 2;
|
|
2170
|
+
let x = "";
|
|
2171
|
+
let y = "";
|
|
2172
|
+
if (placedSide === "bottom") {
|
|
2173
|
+
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
2174
|
+
y = `${-arrowHeight}px`;
|
|
2175
|
+
} else if (placedSide === "top") {
|
|
2176
|
+
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
2177
|
+
y = `${rects.floating.height + arrowHeight}px`;
|
|
2178
|
+
} else if (placedSide === "right") {
|
|
2179
|
+
x = `${-arrowHeight}px`;
|
|
2180
|
+
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
2181
|
+
} else if (placedSide === "left") {
|
|
2182
|
+
x = `${rects.floating.width + arrowHeight}px`;
|
|
2183
|
+
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
2184
|
+
}
|
|
2185
|
+
return { data: { x, y } };
|
|
2186
|
+
}
|
|
2187
|
+
});
|
|
2188
|
+
function getSideAndAlignFromPlacement(placement) {
|
|
2189
|
+
const [side, align = "center"] = placement.split("-");
|
|
2190
|
+
return [side, align];
|
|
2191
|
+
}
|
|
2192
|
+
var Root2 = Popper;
|
|
2193
|
+
var Anchor = PopperAnchor;
|
|
2194
|
+
var Content = PopperContent;
|
|
2195
|
+
var Arrow = PopperArrow;
|
|
2196
|
+
export {
|
|
2197
|
+
Anchor as A,
|
|
2198
|
+
Content as C,
|
|
2199
|
+
Root2 as R,
|
|
2200
|
+
Arrow as a,
|
|
2201
|
+
createPopperScope as c
|
|
2202
|
+
};
|
|
2203
|
+
//# sourceMappingURL=index-BwPkj4HH.js.map
|