@lumx/react 4.4.0 → 4.4.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2112 -2096
- package/index.js.map +1 -1
- package/package.json +6 -6
package/index.js
CHANGED
|
@@ -20,7 +20,8 @@ import { u as useDisabledStateContext, P as Portal, C as ClickAwayProvider } fro
|
|
|
20
20
|
import isEmpty from 'lodash/isEmpty.js';
|
|
21
21
|
import { getDisabledState } from '@lumx/core/js/utils/disabledState';
|
|
22
22
|
import { mdiCloseCircle } from '@lumx/icons/esm/close-circle.js';
|
|
23
|
-
import
|
|
23
|
+
import * as ReactDOM from 'react-dom';
|
|
24
|
+
import ReactDOM__default from 'react-dom';
|
|
24
25
|
import { mdiClose } from '@lumx/icons/esm/close.js';
|
|
25
26
|
import isFunction from 'lodash/isFunction.js';
|
|
26
27
|
import { mdiImageBroken } from '@lumx/icons/esm/image-broken.js';
|
|
@@ -32,17 +33,17 @@ import castArray from 'lodash/castArray.js';
|
|
|
32
33
|
import { mdiDragVertical } from '@lumx/icons/esm/drag-vertical.js';
|
|
33
34
|
import { mdiChevronDown } from '@lumx/icons/esm/chevron-down.js';
|
|
34
35
|
import { mdiChevronUp } from '@lumx/icons/esm/chevron-up.js';
|
|
35
|
-
import noop from 'lodash/noop.js';
|
|
36
|
+
import noop$1 from 'lodash/noop.js';
|
|
36
37
|
import pick from 'lodash/pick.js';
|
|
37
38
|
import isInteger from 'lodash/isInteger.js';
|
|
38
39
|
import { mdiMagnifyMinusOutline } from '@lumx/icons/esm/magnify-minus-outline.js';
|
|
39
40
|
import { mdiMagnifyPlusOutline } from '@lumx/icons/esm/magnify-plus-outline.js';
|
|
41
|
+
import memoize from 'lodash/memoize.js';
|
|
40
42
|
import throttle from 'lodash/throttle.js';
|
|
41
43
|
import range from 'lodash/range.js';
|
|
42
44
|
import { mdiPlayCircleOutline } from '@lumx/icons/esm/play-circle-outline.js';
|
|
43
45
|
import { mdiPauseCircleOutline } from '@lumx/icons/esm/pause-circle-outline.js';
|
|
44
46
|
import chunk from 'lodash/chunk.js';
|
|
45
|
-
import ReactDOM from 'react-dom';
|
|
46
47
|
import take from 'lodash/take.js';
|
|
47
48
|
import { mdiRadioboxBlank } from '@lumx/icons/esm/radiobox-blank.js';
|
|
48
49
|
import { mdiRadioboxMarked } from '@lumx/icons/esm/radiobox-marked.js';
|
|
@@ -4052,2117 +4053,2163 @@ function useRestoreFocusOnClose({
|
|
|
4052
4053
|
});
|
|
4053
4054
|
}
|
|
4054
4055
|
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
var auto = 'auto';
|
|
4060
|
-
var basePlacements = [top, bottom, right, left];
|
|
4061
|
-
var start = 'start';
|
|
4062
|
-
var end = 'end';
|
|
4063
|
-
var clippingParents = 'clippingParents';
|
|
4064
|
-
var viewport = 'viewport';
|
|
4065
|
-
var popper = 'popper';
|
|
4066
|
-
var reference = 'reference';
|
|
4067
|
-
var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
|
|
4068
|
-
return acc.concat([placement + "-" + start, placement + "-" + end]);
|
|
4069
|
-
}, []);
|
|
4070
|
-
var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
|
|
4071
|
-
return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
|
|
4072
|
-
}, []); // modifiers that need to read the DOM
|
|
4073
|
-
|
|
4074
|
-
var beforeRead = 'beforeRead';
|
|
4075
|
-
var read = 'read';
|
|
4076
|
-
var afterRead = 'afterRead'; // pure-logic modifiers
|
|
4077
|
-
|
|
4078
|
-
var beforeMain = 'beforeMain';
|
|
4079
|
-
var main = 'main';
|
|
4080
|
-
var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
|
|
4081
|
-
|
|
4082
|
-
var beforeWrite = 'beforeWrite';
|
|
4083
|
-
var write = 'write';
|
|
4084
|
-
var afterWrite = 'afterWrite';
|
|
4085
|
-
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
|
|
4086
|
-
|
|
4087
|
-
function getNodeName(element) {
|
|
4088
|
-
return element ? (element.nodeName || '').toLowerCase() : null;
|
|
4089
|
-
}
|
|
4090
|
-
|
|
4091
|
-
/*:: import type { Window } from '../types'; */
|
|
4092
|
-
|
|
4093
|
-
/*:: declare function getWindow(node: Node | Window): Window; */
|
|
4094
|
-
function getWindow(node) {
|
|
4095
|
-
if (node.toString() !== '[object Window]') {
|
|
4096
|
-
var ownerDocument = node.ownerDocument;
|
|
4097
|
-
return ownerDocument ? ownerDocument.defaultView || window : window;
|
|
4098
|
-
}
|
|
4056
|
+
/**
|
|
4057
|
+
* Custom positioning reference element.
|
|
4058
|
+
* @see https://floating-ui.com/docs/virtual-elements
|
|
4059
|
+
*/
|
|
4099
4060
|
|
|
4100
|
-
|
|
4061
|
+
const sides = ['top', 'right', 'bottom', 'left'];
|
|
4062
|
+
const alignments = ['start', 'end'];
|
|
4063
|
+
const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
|
|
4064
|
+
const min = Math.min;
|
|
4065
|
+
const max = Math.max;
|
|
4066
|
+
const round = Math.round;
|
|
4067
|
+
const floor = Math.floor;
|
|
4068
|
+
const createCoords = v => ({
|
|
4069
|
+
x: v,
|
|
4070
|
+
y: v
|
|
4071
|
+
});
|
|
4072
|
+
const oppositeSideMap = {
|
|
4073
|
+
left: 'right',
|
|
4074
|
+
right: 'left',
|
|
4075
|
+
bottom: 'top',
|
|
4076
|
+
top: 'bottom'
|
|
4077
|
+
};
|
|
4078
|
+
const oppositeAlignmentMap = {
|
|
4079
|
+
start: 'end',
|
|
4080
|
+
end: 'start'
|
|
4081
|
+
};
|
|
4082
|
+
function clamp$1(start, value, end) {
|
|
4083
|
+
return max(start, min(value, end));
|
|
4101
4084
|
}
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
Element); */
|
|
4105
|
-
|
|
4106
|
-
function isElement(node) {
|
|
4107
|
-
var OwnElement = getWindow(node).Element;
|
|
4108
|
-
return node instanceof OwnElement || node instanceof Element;
|
|
4085
|
+
function evaluate(value, param) {
|
|
4086
|
+
return typeof value === 'function' ? value(param) : value;
|
|
4109
4087
|
}
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
function isHTMLElement(node) {
|
|
4115
|
-
var OwnElement = getWindow(node).HTMLElement;
|
|
4116
|
-
return node instanceof OwnElement || node instanceof HTMLElement;
|
|
4088
|
+
function getSide(placement) {
|
|
4089
|
+
return placement.split('-')[0];
|
|
4117
4090
|
}
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
function isShadowRoot(node) {
|
|
4123
|
-
var OwnElement = getWindow(node).ShadowRoot;
|
|
4124
|
-
return node instanceof OwnElement || node instanceof ShadowRoot;
|
|
4091
|
+
function getAlignment(placement) {
|
|
4092
|
+
return placement.split('-')[1];
|
|
4125
4093
|
}
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
function applyStyles(_ref) {
|
|
4130
|
-
var state = _ref.state;
|
|
4131
|
-
Object.keys(state.elements).forEach(function (name) {
|
|
4132
|
-
var style = state.styles[name] || {};
|
|
4133
|
-
var attributes = state.attributes[name] || {};
|
|
4134
|
-
var element = state.elements[name]; // arrow is optional + virtual elements
|
|
4135
|
-
|
|
4136
|
-
if (!isHTMLElement(element) || !getNodeName(element)) {
|
|
4137
|
-
return;
|
|
4138
|
-
} // Flow doesn't support to extend this property, but it's the most
|
|
4139
|
-
// effective way to apply styles to an HTMLElement
|
|
4140
|
-
// $FlowFixMe
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
Object.assign(element.style, style);
|
|
4144
|
-
Object.keys(attributes).forEach(function (name) {
|
|
4145
|
-
var value = attributes[name];
|
|
4146
|
-
|
|
4147
|
-
if (value === false) {
|
|
4148
|
-
element.removeAttribute(name);
|
|
4149
|
-
} else {
|
|
4150
|
-
element.setAttribute(name, value === true ? '' : value);
|
|
4151
|
-
}
|
|
4152
|
-
});
|
|
4153
|
-
});
|
|
4094
|
+
function getOppositeAxis(axis) {
|
|
4095
|
+
return axis === 'x' ? 'y' : 'x';
|
|
4154
4096
|
}
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
var state = _ref2.state;
|
|
4158
|
-
var initialStyles = {
|
|
4159
|
-
popper: {
|
|
4160
|
-
position: state.options.strategy,
|
|
4161
|
-
left: '0',
|
|
4162
|
-
top: '0',
|
|
4163
|
-
margin: '0'
|
|
4164
|
-
},
|
|
4165
|
-
arrow: {
|
|
4166
|
-
position: 'absolute'
|
|
4167
|
-
},
|
|
4168
|
-
reference: {}
|
|
4169
|
-
};
|
|
4170
|
-
Object.assign(state.elements.popper.style, initialStyles.popper);
|
|
4171
|
-
|
|
4172
|
-
if (state.elements.arrow) {
|
|
4173
|
-
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
|
4174
|
-
}
|
|
4175
|
-
|
|
4176
|
-
return function () {
|
|
4177
|
-
Object.keys(state.elements).forEach(function (name) {
|
|
4178
|
-
var element = state.elements[name];
|
|
4179
|
-
var attributes = state.attributes[name] || {};
|
|
4180
|
-
var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
|
|
4181
|
-
|
|
4182
|
-
var style = styleProperties.reduce(function (style, property) {
|
|
4183
|
-
style[property] = '';
|
|
4184
|
-
return style;
|
|
4185
|
-
}, {}); // arrow is optional + virtual elements
|
|
4186
|
-
|
|
4187
|
-
if (!isHTMLElement(element) || !getNodeName(element)) {
|
|
4188
|
-
return;
|
|
4189
|
-
} // Flow doesn't support to extend this property, but it's the most
|
|
4190
|
-
// effective way to apply styles to an HTMLElement
|
|
4191
|
-
// $FlowFixMe
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
Object.assign(element.style, style);
|
|
4195
|
-
Object.keys(attributes).forEach(function (attribute) {
|
|
4196
|
-
element.removeAttribute(attribute);
|
|
4197
|
-
});
|
|
4198
|
-
});
|
|
4199
|
-
};
|
|
4200
|
-
} // eslint-disable-next-line import/no-unused-modules
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
var applyStyles$1 = {
|
|
4204
|
-
name: 'applyStyles',
|
|
4205
|
-
enabled: true,
|
|
4206
|
-
phase: 'write',
|
|
4207
|
-
fn: applyStyles,
|
|
4208
|
-
effect: effect$2,
|
|
4209
|
-
requires: ['computeStyles']
|
|
4210
|
-
};
|
|
4211
|
-
|
|
4212
|
-
function getBasePlacement(placement) {
|
|
4213
|
-
return placement.split('-')[0];
|
|
4097
|
+
function getAxisLength(axis) {
|
|
4098
|
+
return axis === 'y' ? 'height' : 'width';
|
|
4214
4099
|
}
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
function getLayoutRect(element) {
|
|
4219
|
-
return {
|
|
4220
|
-
x: element.offsetLeft,
|
|
4221
|
-
y: element.offsetTop,
|
|
4222
|
-
width: element.offsetWidth,
|
|
4223
|
-
height: element.offsetHeight
|
|
4224
|
-
};
|
|
4100
|
+
const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
|
|
4101
|
+
function getSideAxis(placement) {
|
|
4102
|
+
return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
|
|
4225
4103
|
}
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
|
|
4229
|
-
|
|
4230
|
-
if (parent.contains(child)) {
|
|
4231
|
-
return true;
|
|
4232
|
-
} // then fallback to custom implementation with Shadow DOM support
|
|
4233
|
-
else if (rootNode && isShadowRoot(rootNode)) {
|
|
4234
|
-
var next = child;
|
|
4235
|
-
|
|
4236
|
-
do {
|
|
4237
|
-
if (next && parent.isSameNode(next)) {
|
|
4238
|
-
return true;
|
|
4239
|
-
} // $FlowFixMe: need a better way to handle this...
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
next = next.parentNode || next.host;
|
|
4243
|
-
} while (next);
|
|
4244
|
-
} // Give up, the result is false
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
return false;
|
|
4104
|
+
function getAlignmentAxis(placement) {
|
|
4105
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
4248
4106
|
}
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4107
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
4108
|
+
if (rtl === void 0) {
|
|
4109
|
+
rtl = false;
|
|
4110
|
+
}
|
|
4111
|
+
const alignment = getAlignment(placement);
|
|
4112
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
4113
|
+
const length = getAxisLength(alignmentAxis);
|
|
4114
|
+
let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
|
4115
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
4116
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
4117
|
+
}
|
|
4118
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
4252
4119
|
}
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
return [
|
|
4120
|
+
function getExpandedPlacements(placement) {
|
|
4121
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
4122
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
4256
4123
|
}
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
// $FlowFixMe: assume body is always available
|
|
4260
|
-
return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
|
|
4124
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
4125
|
+
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
|
|
4261
4126
|
}
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4127
|
+
const lrPlacement = ['left', 'right'];
|
|
4128
|
+
const rlPlacement = ['right', 'left'];
|
|
4129
|
+
const tbPlacement = ['top', 'bottom'];
|
|
4130
|
+
const btPlacement = ['bottom', 'top'];
|
|
4131
|
+
function getSideList(side, isStart, rtl) {
|
|
4132
|
+
switch (side) {
|
|
4133
|
+
case 'top':
|
|
4134
|
+
case 'bottom':
|
|
4135
|
+
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
4136
|
+
return isStart ? lrPlacement : rlPlacement;
|
|
4137
|
+
case 'left':
|
|
4138
|
+
case 'right':
|
|
4139
|
+
return isStart ? tbPlacement : btPlacement;
|
|
4140
|
+
default:
|
|
4141
|
+
return [];
|
|
4266
4142
|
}
|
|
4267
|
-
|
|
4268
|
-
return (// $FlowFixMe: this is a quicker (but less type safe) way to save quite some bytes from the bundle
|
|
4269
|
-
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
|
|
4270
|
-
element.parentNode || // DOM Element detected
|
|
4271
|
-
// $FlowFixMe: need a better way to handle this...
|
|
4272
|
-
element.host || // ShadowRoot detected
|
|
4273
|
-
// $FlowFixMe: HTMLElement is a Node
|
|
4274
|
-
getDocumentElement(element) // fallback
|
|
4275
|
-
|
|
4276
|
-
);
|
|
4277
4143
|
}
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
var offsetParent = element.offsetParent;
|
|
4286
|
-
|
|
4287
|
-
if (offsetParent) {
|
|
4288
|
-
var html = getDocumentElement(offsetParent);
|
|
4289
|
-
|
|
4290
|
-
if (getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && getComputedStyle(html).position !== 'static') {
|
|
4291
|
-
return html;
|
|
4292
|
-
}
|
|
4293
|
-
}
|
|
4294
|
-
|
|
4295
|
-
return offsetParent;
|
|
4296
|
-
} // `.offsetParent` reports `null` for fixed elements, while absolute elements
|
|
4297
|
-
// return the containing block
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
function getContainingBlock(element) {
|
|
4301
|
-
var currentNode = getParentNode(element);
|
|
4302
|
-
|
|
4303
|
-
while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
|
|
4304
|
-
var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
|
|
4305
|
-
// create a containing block.
|
|
4306
|
-
|
|
4307
|
-
if (css.transform !== 'none' || css.perspective !== 'none' || css.willChange && css.willChange !== 'auto') {
|
|
4308
|
-
return currentNode;
|
|
4309
|
-
} else {
|
|
4310
|
-
currentNode = currentNode.parentNode;
|
|
4144
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
4145
|
+
const alignment = getAlignment(placement);
|
|
4146
|
+
let list = getSideList(getSide(placement), direction === 'start', rtl);
|
|
4147
|
+
if (alignment) {
|
|
4148
|
+
list = list.map(side => side + "-" + alignment);
|
|
4149
|
+
if (flipAlignment) {
|
|
4150
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
4311
4151
|
}
|
|
4312
4152
|
}
|
|
4313
|
-
|
|
4314
|
-
return null;
|
|
4315
|
-
} // Gets the closest ancestor positioned element. Handles some edge cases,
|
|
4316
|
-
// such as table ancestors and cross browser bugs.
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
function getOffsetParent(element) {
|
|
4320
|
-
var window = getWindow(element);
|
|
4321
|
-
var offsetParent = getTrueOffsetParent(element);
|
|
4322
|
-
|
|
4323
|
-
while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
|
|
4324
|
-
offsetParent = getTrueOffsetParent(offsetParent);
|
|
4325
|
-
}
|
|
4326
|
-
|
|
4327
|
-
if (offsetParent && getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static') {
|
|
4328
|
-
return window;
|
|
4329
|
-
}
|
|
4330
|
-
|
|
4331
|
-
return offsetParent || getContainingBlock(element) || window;
|
|
4153
|
+
return list;
|
|
4332
4154
|
}
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
|
|
4336
|
-
}
|
|
4337
|
-
|
|
4338
|
-
function within(min, value, max) {
|
|
4339
|
-
return Math.max(min, Math.min(value, max));
|
|
4155
|
+
function getOppositePlacement(placement) {
|
|
4156
|
+
return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
|
|
4340
4157
|
}
|
|
4341
|
-
|
|
4342
|
-
function getFreshSideObject() {
|
|
4158
|
+
function expandPaddingObject(padding) {
|
|
4343
4159
|
return {
|
|
4344
4160
|
top: 0,
|
|
4345
4161
|
right: 0,
|
|
4346
4162
|
bottom: 0,
|
|
4347
|
-
left: 0
|
|
4163
|
+
left: 0,
|
|
4164
|
+
...padding
|
|
4348
4165
|
};
|
|
4349
4166
|
}
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4167
|
+
function getPaddingObject(padding) {
|
|
4168
|
+
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
|
|
4169
|
+
top: padding,
|
|
4170
|
+
right: padding,
|
|
4171
|
+
bottom: padding,
|
|
4172
|
+
left: padding
|
|
4173
|
+
};
|
|
4353
4174
|
}
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4175
|
+
function rectToClientRect(rect) {
|
|
4176
|
+
const {
|
|
4177
|
+
x,
|
|
4178
|
+
y,
|
|
4179
|
+
width,
|
|
4180
|
+
height
|
|
4181
|
+
} = rect;
|
|
4182
|
+
return {
|
|
4183
|
+
width,
|
|
4184
|
+
height,
|
|
4185
|
+
top: y,
|
|
4186
|
+
left: x,
|
|
4187
|
+
right: x + width,
|
|
4188
|
+
bottom: y + height,
|
|
4189
|
+
x,
|
|
4190
|
+
y
|
|
4191
|
+
};
|
|
4360
4192
|
}
|
|
4361
4193
|
|
|
4362
|
-
function
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
if (arrowElement == null) {
|
|
4408
|
-
return;
|
|
4409
|
-
} // CSS selector
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
if (typeof arrowElement === 'string') {
|
|
4413
|
-
arrowElement = state.elements.popper.querySelector(arrowElement);
|
|
4414
|
-
|
|
4415
|
-
if (!arrowElement) {
|
|
4416
|
-
return;
|
|
4417
|
-
}
|
|
4194
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
4195
|
+
let {
|
|
4196
|
+
reference,
|
|
4197
|
+
floating
|
|
4198
|
+
} = _ref;
|
|
4199
|
+
const sideAxis = getSideAxis(placement);
|
|
4200
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
4201
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
4202
|
+
const side = getSide(placement);
|
|
4203
|
+
const isVertical = sideAxis === 'y';
|
|
4204
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
4205
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
4206
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
4207
|
+
let coords;
|
|
4208
|
+
switch (side) {
|
|
4209
|
+
case 'top':
|
|
4210
|
+
coords = {
|
|
4211
|
+
x: commonX,
|
|
4212
|
+
y: reference.y - floating.height
|
|
4213
|
+
};
|
|
4214
|
+
break;
|
|
4215
|
+
case 'bottom':
|
|
4216
|
+
coords = {
|
|
4217
|
+
x: commonX,
|
|
4218
|
+
y: reference.y + reference.height
|
|
4219
|
+
};
|
|
4220
|
+
break;
|
|
4221
|
+
case 'right':
|
|
4222
|
+
coords = {
|
|
4223
|
+
x: reference.x + reference.width,
|
|
4224
|
+
y: commonY
|
|
4225
|
+
};
|
|
4226
|
+
break;
|
|
4227
|
+
case 'left':
|
|
4228
|
+
coords = {
|
|
4229
|
+
x: reference.x - floating.width,
|
|
4230
|
+
y: commonY
|
|
4231
|
+
};
|
|
4232
|
+
break;
|
|
4233
|
+
default:
|
|
4234
|
+
coords = {
|
|
4235
|
+
x: reference.x,
|
|
4236
|
+
y: reference.y
|
|
4237
|
+
};
|
|
4418
4238
|
}
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4239
|
+
switch (getAlignment(placement)) {
|
|
4240
|
+
case 'start':
|
|
4241
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
4242
|
+
break;
|
|
4243
|
+
case 'end':
|
|
4244
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
4245
|
+
break;
|
|
4424
4246
|
}
|
|
4247
|
+
return coords;
|
|
4248
|
+
}
|
|
4425
4249
|
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4250
|
+
/**
|
|
4251
|
+
* Resolves with an object of overflow side offsets that determine how much the
|
|
4252
|
+
* element is overflowing a given clipping boundary on each side.
|
|
4253
|
+
* - positive = overflowing the boundary by that number of pixels
|
|
4254
|
+
* - negative = how many pixels left before it will overflow
|
|
4255
|
+
* - 0 = lies flush with the boundary
|
|
4256
|
+
* @see https://floating-ui.com/docs/detectOverflow
|
|
4257
|
+
*/
|
|
4258
|
+
async function detectOverflow(state, options) {
|
|
4259
|
+
var _await$platform$isEle;
|
|
4260
|
+
if (options === void 0) {
|
|
4261
|
+
options = {};
|
|
4432
4262
|
}
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4263
|
+
const {
|
|
4264
|
+
x,
|
|
4265
|
+
y,
|
|
4266
|
+
platform,
|
|
4267
|
+
rects,
|
|
4268
|
+
elements,
|
|
4269
|
+
strategy
|
|
4270
|
+
} = state;
|
|
4271
|
+
const {
|
|
4272
|
+
boundary = 'clippingAncestors',
|
|
4273
|
+
rootBoundary = 'viewport',
|
|
4274
|
+
elementContext = 'floating',
|
|
4275
|
+
altBoundary = false,
|
|
4276
|
+
padding = 0
|
|
4277
|
+
} = evaluate(options, state);
|
|
4278
|
+
const paddingObject = getPaddingObject(padding);
|
|
4279
|
+
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
4280
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
4281
|
+
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
4282
|
+
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
|
|
4283
|
+
boundary,
|
|
4284
|
+
rootBoundary,
|
|
4285
|
+
strategy
|
|
4286
|
+
}));
|
|
4287
|
+
const rect = elementContext === 'floating' ? {
|
|
4288
|
+
x,
|
|
4289
|
+
y,
|
|
4290
|
+
width: rects.floating.width,
|
|
4291
|
+
height: rects.floating.height
|
|
4292
|
+
} : rects.reference;
|
|
4293
|
+
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
4294
|
+
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
|
|
4295
|
+
x: 1,
|
|
4296
|
+
y: 1
|
|
4297
|
+
} : {
|
|
4298
|
+
x: 1,
|
|
4299
|
+
y: 1
|
|
4437
4300
|
};
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
phase: 'main',
|
|
4445
|
-
fn: arrow,
|
|
4446
|
-
effect: effect$1,
|
|
4447
|
-
requires: ['popperOffsets'],
|
|
4448
|
-
requiresIfExists: ['preventOverflow']
|
|
4449
|
-
};
|
|
4450
|
-
|
|
4451
|
-
var unsetSides = {
|
|
4452
|
-
top: 'auto',
|
|
4453
|
-
right: 'auto',
|
|
4454
|
-
bottom: 'auto',
|
|
4455
|
-
left: 'auto'
|
|
4456
|
-
}; // Round the offsets to the nearest suitable subpixel based on the DPR.
|
|
4457
|
-
// Zooming can change the DPR, but it seems to report a value that will
|
|
4458
|
-
// cleanly divide the values into the appropriate subpixels.
|
|
4459
|
-
|
|
4460
|
-
function roundOffsets(_ref) {
|
|
4461
|
-
var x = _ref.x,
|
|
4462
|
-
y = _ref.y;
|
|
4463
|
-
var win = window;
|
|
4464
|
-
var dpr = win.devicePixelRatio || 1;
|
|
4301
|
+
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
4302
|
+
elements,
|
|
4303
|
+
rect,
|
|
4304
|
+
offsetParent,
|
|
4305
|
+
strategy
|
|
4306
|
+
}) : rect);
|
|
4465
4307
|
return {
|
|
4466
|
-
|
|
4467
|
-
|
|
4308
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
4309
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
4310
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
4311
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
4468
4312
|
};
|
|
4469
4313
|
}
|
|
4470
4314
|
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
x
|
|
4315
|
+
/**
|
|
4316
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
4317
|
+
* next to a given reference element.
|
|
4318
|
+
*
|
|
4319
|
+
* This export does not have any `platform` interface logic. You will need to
|
|
4320
|
+
* write one for the platform you are using Floating UI with.
|
|
4321
|
+
*/
|
|
4322
|
+
const computePosition$1 = async (reference, floating, config) => {
|
|
4323
|
+
const {
|
|
4324
|
+
placement = 'bottom',
|
|
4325
|
+
strategy = 'absolute',
|
|
4326
|
+
middleware = [],
|
|
4327
|
+
platform
|
|
4328
|
+
} = config;
|
|
4329
|
+
const validMiddleware = middleware.filter(Boolean);
|
|
4330
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
4331
|
+
let rects = await platform.getElementRects({
|
|
4332
|
+
reference,
|
|
4333
|
+
floating,
|
|
4334
|
+
strategy
|
|
4335
|
+
});
|
|
4336
|
+
let {
|
|
4337
|
+
x,
|
|
4338
|
+
y
|
|
4339
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
4340
|
+
let statefulPlacement = placement;
|
|
4341
|
+
let middlewareData = {};
|
|
4342
|
+
let resetCount = 0;
|
|
4343
|
+
for (let i = 0; i < validMiddleware.length; i++) {
|
|
4344
|
+
var _platform$detectOverf;
|
|
4345
|
+
const {
|
|
4346
|
+
name,
|
|
4347
|
+
fn
|
|
4348
|
+
} = validMiddleware[i];
|
|
4349
|
+
const {
|
|
4350
|
+
x: nextX,
|
|
4351
|
+
y: nextY,
|
|
4352
|
+
data,
|
|
4353
|
+
reset
|
|
4354
|
+
} = await fn({
|
|
4355
|
+
x,
|
|
4356
|
+
y,
|
|
4357
|
+
initialPlacement: placement,
|
|
4358
|
+
placement: statefulPlacement,
|
|
4359
|
+
strategy,
|
|
4360
|
+
middlewareData,
|
|
4361
|
+
rects,
|
|
4362
|
+
platform: {
|
|
4363
|
+
...platform,
|
|
4364
|
+
detectOverflow: (_platform$detectOverf = platform.detectOverflow) != null ? _platform$detectOverf : detectOverflow
|
|
4365
|
+
},
|
|
4366
|
+
elements: {
|
|
4367
|
+
reference,
|
|
4368
|
+
floating
|
|
4369
|
+
}
|
|
4370
|
+
});
|
|
4371
|
+
x = nextX != null ? nextX : x;
|
|
4372
|
+
y = nextY != null ? nextY : y;
|
|
4373
|
+
middlewareData = {
|
|
4374
|
+
...middlewareData,
|
|
4375
|
+
[name]: {
|
|
4376
|
+
...middlewareData[name],
|
|
4377
|
+
...data
|
|
4378
|
+
}
|
|
4379
|
+
};
|
|
4380
|
+
if (reset && resetCount <= 50) {
|
|
4381
|
+
resetCount++;
|
|
4382
|
+
if (typeof reset === 'object') {
|
|
4383
|
+
if (reset.placement) {
|
|
4384
|
+
statefulPlacement = reset.placement;
|
|
4385
|
+
}
|
|
4386
|
+
if (reset.rects) {
|
|
4387
|
+
rects = reset.rects === true ? await platform.getElementRects({
|
|
4388
|
+
reference,
|
|
4389
|
+
floating,
|
|
4390
|
+
strategy
|
|
4391
|
+
}) : reset.rects;
|
|
4392
|
+
}
|
|
4393
|
+
({
|
|
4394
|
+
x,
|
|
4395
|
+
y
|
|
4396
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
4397
|
+
}
|
|
4398
|
+
i = -1;
|
|
4512
4399
|
}
|
|
4513
4400
|
}
|
|
4401
|
+
return {
|
|
4402
|
+
x,
|
|
4403
|
+
y,
|
|
4404
|
+
placement: statefulPlacement,
|
|
4405
|
+
strategy,
|
|
4406
|
+
middlewareData
|
|
4407
|
+
};
|
|
4408
|
+
};
|
|
4514
4409
|
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4410
|
+
/**
|
|
4411
|
+
* Provides data to position an inner element of the floating element so that it
|
|
4412
|
+
* appears centered to the reference element.
|
|
4413
|
+
* @see https://floating-ui.com/docs/arrow
|
|
4414
|
+
*/
|
|
4415
|
+
const arrow$3 = options => ({
|
|
4416
|
+
name: 'arrow',
|
|
4417
|
+
options,
|
|
4418
|
+
async fn(state) {
|
|
4419
|
+
const {
|
|
4420
|
+
x,
|
|
4421
|
+
y,
|
|
4422
|
+
placement,
|
|
4423
|
+
rects,
|
|
4424
|
+
platform,
|
|
4425
|
+
elements,
|
|
4426
|
+
middlewareData
|
|
4427
|
+
} = state;
|
|
4428
|
+
// Since `element` is required, we don't Partial<> the type.
|
|
4429
|
+
const {
|
|
4430
|
+
element,
|
|
4431
|
+
padding = 0
|
|
4432
|
+
} = evaluate(options, state) || {};
|
|
4433
|
+
if (element == null) {
|
|
4434
|
+
return {};
|
|
4435
|
+
}
|
|
4436
|
+
const paddingObject = getPaddingObject(padding);
|
|
4437
|
+
const coords = {
|
|
4438
|
+
x,
|
|
4439
|
+
y
|
|
4440
|
+
};
|
|
4441
|
+
const axis = getAlignmentAxis(placement);
|
|
4442
|
+
const length = getAxisLength(axis);
|
|
4443
|
+
const arrowDimensions = await platform.getDimensions(element);
|
|
4444
|
+
const isYAxis = axis === 'y';
|
|
4445
|
+
const minProp = isYAxis ? 'top' : 'left';
|
|
4446
|
+
const maxProp = isYAxis ? 'bottom' : 'right';
|
|
4447
|
+
const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
|
|
4448
|
+
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
|
4449
|
+
const startDiff = coords[axis] - rects.reference[axis];
|
|
4450
|
+
const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
|
|
4451
|
+
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
|
|
4452
|
+
|
|
4453
|
+
// DOM platform can return `window` as the `offsetParent`.
|
|
4454
|
+
if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
|
|
4455
|
+
clientSize = elements.floating[clientProp] || rects.floating[length];
|
|
4456
|
+
}
|
|
4457
|
+
const centerToReference = endDiff / 2 - startDiff / 2;
|
|
4458
|
+
|
|
4459
|
+
// If the padding is large enough that it causes the arrow to no longer be
|
|
4460
|
+
// centered, modify the padding so that it is centered.
|
|
4461
|
+
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
|
|
4462
|
+
const minPadding = min(paddingObject[minProp], largestPossiblePadding);
|
|
4463
|
+
const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
|
|
4464
|
+
|
|
4465
|
+
// Make sure the arrow doesn't overflow the floating element if the center
|
|
4466
|
+
// point is outside the floating element's bounds.
|
|
4467
|
+
const min$1 = minPadding;
|
|
4468
|
+
const max = clientSize - arrowDimensions[length] - maxPadding;
|
|
4469
|
+
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
4470
|
+
const offset = clamp$1(min$1, center, max);
|
|
4471
|
+
|
|
4472
|
+
// If the reference is small enough that the arrow's padding causes it to
|
|
4473
|
+
// to point to nothing for an aligned placement, adjust the offset of the
|
|
4474
|
+
// floating element itself. To ensure `shift()` continues to take action,
|
|
4475
|
+
// a single reset is performed when this is true.
|
|
4476
|
+
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
4477
|
+
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
|
|
4478
|
+
return {
|
|
4479
|
+
[axis]: coords[axis] + alignmentOffset,
|
|
4480
|
+
data: {
|
|
4481
|
+
[axis]: offset,
|
|
4482
|
+
centerOffset: center - offset - alignmentOffset,
|
|
4483
|
+
...(shouldAddOffset && {
|
|
4484
|
+
alignmentOffset
|
|
4485
|
+
})
|
|
4486
|
+
},
|
|
4487
|
+
reset: shouldAddOffset
|
|
4488
|
+
};
|
|
4523
4489
|
}
|
|
4490
|
+
});
|
|
4524
4491
|
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
options = _ref3.options;
|
|
4531
|
-
var _options$gpuAccelerat = options.gpuAcceleration,
|
|
4532
|
-
gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
|
|
4533
|
-
_options$adaptive = options.adaptive,
|
|
4534
|
-
adaptive = _options$adaptive === void 0 ? true : _options$adaptive;
|
|
4535
|
-
|
|
4536
|
-
if (process.env.NODE_ENV !== "production") {
|
|
4537
|
-
var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || '';
|
|
4538
|
-
|
|
4539
|
-
if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {
|
|
4540
|
-
return transitionProperty.indexOf(property) >= 0;
|
|
4541
|
-
})) {
|
|
4542
|
-
console.warn(['Popper: Detected CSS transitions on at least one of the following', 'CSS properties: "transform", "top", "right", "bottom", "left".', '\n\n', 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', 'for smooth transitions, or remove these properties from the CSS', 'transition declaration on the popper element if only transitioning', 'opacity or background-color for example.', '\n\n', 'We recommend using the popper element as a wrapper around an inner', 'element that can have any CSS property transitioned for animations.'].join(' '));
|
|
4492
|
+
function getPlacementList(alignment, autoAlignment, allowedPlacements) {
|
|
4493
|
+
const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
|
|
4494
|
+
return allowedPlacementsSortedByAlignment.filter(placement => {
|
|
4495
|
+
if (alignment) {
|
|
4496
|
+
return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
|
|
4543
4497
|
}
|
|
4498
|
+
return true;
|
|
4499
|
+
});
|
|
4500
|
+
}
|
|
4501
|
+
/**
|
|
4502
|
+
* Optimizes the visibility of the floating element by choosing the placement
|
|
4503
|
+
* that has the most space available automatically, without needing to specify a
|
|
4504
|
+
* preferred placement. Alternative to `flip`.
|
|
4505
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
4506
|
+
*/
|
|
4507
|
+
const autoPlacement$2 = function (options) {
|
|
4508
|
+
if (options === void 0) {
|
|
4509
|
+
options = {};
|
|
4544
4510
|
}
|
|
4511
|
+
return {
|
|
4512
|
+
name: 'autoPlacement',
|
|
4513
|
+
options,
|
|
4514
|
+
async fn(state) {
|
|
4515
|
+
var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
|
|
4516
|
+
const {
|
|
4517
|
+
rects,
|
|
4518
|
+
middlewareData,
|
|
4519
|
+
placement,
|
|
4520
|
+
platform,
|
|
4521
|
+
elements
|
|
4522
|
+
} = state;
|
|
4523
|
+
const {
|
|
4524
|
+
crossAxis = false,
|
|
4525
|
+
alignment,
|
|
4526
|
+
allowedPlacements = placements,
|
|
4527
|
+
autoAlignment = true,
|
|
4528
|
+
...detectOverflowOptions
|
|
4529
|
+
} = evaluate(options, state);
|
|
4530
|
+
const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
|
|
4531
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
4532
|
+
const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
|
|
4533
|
+
const currentPlacement = placements$1[currentIndex];
|
|
4534
|
+
if (currentPlacement == null) {
|
|
4535
|
+
return {};
|
|
4536
|
+
}
|
|
4537
|
+
const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
|
|
4545
4538
|
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4539
|
+
// Make `computeCoords` start from the right place.
|
|
4540
|
+
if (placement !== currentPlacement) {
|
|
4541
|
+
return {
|
|
4542
|
+
reset: {
|
|
4543
|
+
placement: placements$1[0]
|
|
4544
|
+
}
|
|
4545
|
+
};
|
|
4546
|
+
}
|
|
4547
|
+
const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
|
|
4548
|
+
const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
|
|
4549
|
+
placement: currentPlacement,
|
|
4550
|
+
overflows: currentOverflows
|
|
4551
|
+
}];
|
|
4552
|
+
const nextPlacement = placements$1[currentIndex + 1];
|
|
4553
|
+
|
|
4554
|
+
// There are more placements to check.
|
|
4555
|
+
if (nextPlacement) {
|
|
4556
|
+
return {
|
|
4557
|
+
data: {
|
|
4558
|
+
index: currentIndex + 1,
|
|
4559
|
+
overflows: allOverflows
|
|
4560
|
+
},
|
|
4561
|
+
reset: {
|
|
4562
|
+
placement: nextPlacement
|
|
4563
|
+
}
|
|
4564
|
+
};
|
|
4565
|
+
}
|
|
4566
|
+
const placementsSortedByMostSpace = allOverflows.map(d => {
|
|
4567
|
+
const alignment = getAlignment(d.placement);
|
|
4568
|
+
return [d.placement, alignment && crossAxis ?
|
|
4569
|
+
// Check along the mainAxis and main crossAxis side.
|
|
4570
|
+
d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :
|
|
4571
|
+
// Check only the mainAxis.
|
|
4572
|
+
d.overflows[0], d.overflows];
|
|
4573
|
+
}).sort((a, b) => a[1] - b[1]);
|
|
4574
|
+
const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,
|
|
4575
|
+
// Aligned placements should not check their opposite crossAxis
|
|
4576
|
+
// side.
|
|
4577
|
+
getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));
|
|
4578
|
+
const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
|
|
4579
|
+
if (resetPlacement !== placement) {
|
|
4580
|
+
return {
|
|
4581
|
+
data: {
|
|
4582
|
+
index: currentIndex + 1,
|
|
4583
|
+
overflows: allOverflows
|
|
4584
|
+
},
|
|
4585
|
+
reset: {
|
|
4586
|
+
placement: resetPlacement
|
|
4587
|
+
}
|
|
4588
|
+
};
|
|
4589
|
+
}
|
|
4590
|
+
return {};
|
|
4591
|
+
}
|
|
4551
4592
|
};
|
|
4552
|
-
|
|
4553
|
-
if (state.modifiersData.popperOffsets != null) {
|
|
4554
|
-
state.styles.popper = Object.assign(Object.assign({}, state.styles.popper), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
|
|
4555
|
-
offsets: state.modifiersData.popperOffsets,
|
|
4556
|
-
position: state.options.strategy,
|
|
4557
|
-
adaptive: adaptive
|
|
4558
|
-
})));
|
|
4559
|
-
}
|
|
4560
|
-
|
|
4561
|
-
if (state.modifiersData.arrow != null) {
|
|
4562
|
-
state.styles.arrow = Object.assign(Object.assign({}, state.styles.arrow), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
|
|
4563
|
-
offsets: state.modifiersData.arrow,
|
|
4564
|
-
position: 'absolute',
|
|
4565
|
-
adaptive: false
|
|
4566
|
-
})));
|
|
4567
|
-
}
|
|
4568
|
-
|
|
4569
|
-
state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
|
|
4570
|
-
'data-popper-placement': state.placement
|
|
4571
|
-
});
|
|
4572
|
-
} // eslint-disable-next-line import/no-unused-modules
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
var computeStyles$1 = {
|
|
4576
|
-
name: 'computeStyles',
|
|
4577
|
-
enabled: true,
|
|
4578
|
-
phase: 'beforeWrite',
|
|
4579
|
-
fn: computeStyles,
|
|
4580
|
-
data: {}
|
|
4581
4593
|
};
|
|
4582
4594
|
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
scroll = _options$scroll === void 0 ? true : _options$scroll,
|
|
4593
|
-
_options$resize = options.resize,
|
|
4594
|
-
resize = _options$resize === void 0 ? true : _options$resize;
|
|
4595
|
-
var window = getWindow(state.elements.popper);
|
|
4596
|
-
var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
|
|
4597
|
-
|
|
4598
|
-
if (scroll) {
|
|
4599
|
-
scrollParents.forEach(function (scrollParent) {
|
|
4600
|
-
scrollParent.addEventListener('scroll', instance.update, passive);
|
|
4601
|
-
});
|
|
4602
|
-
}
|
|
4603
|
-
|
|
4604
|
-
if (resize) {
|
|
4605
|
-
window.addEventListener('resize', instance.update, passive);
|
|
4595
|
+
/**
|
|
4596
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
4597
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
4598
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
4599
|
+
* @see https://floating-ui.com/docs/flip
|
|
4600
|
+
*/
|
|
4601
|
+
const flip$2 = function (options) {
|
|
4602
|
+
if (options === void 0) {
|
|
4603
|
+
options = {};
|
|
4606
4604
|
}
|
|
4605
|
+
return {
|
|
4606
|
+
name: 'flip',
|
|
4607
|
+
options,
|
|
4608
|
+
async fn(state) {
|
|
4609
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
4610
|
+
const {
|
|
4611
|
+
placement,
|
|
4612
|
+
middlewareData,
|
|
4613
|
+
rects,
|
|
4614
|
+
initialPlacement,
|
|
4615
|
+
platform,
|
|
4616
|
+
elements
|
|
4617
|
+
} = state;
|
|
4618
|
+
const {
|
|
4619
|
+
mainAxis: checkMainAxis = true,
|
|
4620
|
+
crossAxis: checkCrossAxis = true,
|
|
4621
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
4622
|
+
fallbackStrategy = 'bestFit',
|
|
4623
|
+
fallbackAxisSideDirection = 'none',
|
|
4624
|
+
flipAlignment = true,
|
|
4625
|
+
...detectOverflowOptions
|
|
4626
|
+
} = evaluate(options, state);
|
|
4627
|
+
|
|
4628
|
+
// If a reset by the arrow was caused due to an alignment offset being
|
|
4629
|
+
// added, we should skip any logic now since `flip()` has already done its
|
|
4630
|
+
// work.
|
|
4631
|
+
// https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
|
|
4632
|
+
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
4633
|
+
return {};
|
|
4634
|
+
}
|
|
4635
|
+
const side = getSide(placement);
|
|
4636
|
+
const initialSideAxis = getSideAxis(initialPlacement);
|
|
4637
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
4638
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
4639
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
4640
|
+
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
|
|
4641
|
+
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
4642
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
4643
|
+
}
|
|
4644
|
+
const placements = [initialPlacement, ...fallbackPlacements];
|
|
4645
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
4646
|
+
const overflows = [];
|
|
4647
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
4648
|
+
if (checkMainAxis) {
|
|
4649
|
+
overflows.push(overflow[side]);
|
|
4650
|
+
}
|
|
4651
|
+
if (checkCrossAxis) {
|
|
4652
|
+
const sides = getAlignmentSides(placement, rects, rtl);
|
|
4653
|
+
overflows.push(overflow[sides[0]], overflow[sides[1]]);
|
|
4654
|
+
}
|
|
4655
|
+
overflowsData = [...overflowsData, {
|
|
4656
|
+
placement,
|
|
4657
|
+
overflows
|
|
4658
|
+
}];
|
|
4659
|
+
|
|
4660
|
+
// One or more sides is overflowing.
|
|
4661
|
+
if (!overflows.every(side => side <= 0)) {
|
|
4662
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
4663
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
4664
|
+
const nextPlacement = placements[nextIndex];
|
|
4665
|
+
if (nextPlacement) {
|
|
4666
|
+
const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
|
|
4667
|
+
if (!ignoreCrossAxisOverflow ||
|
|
4668
|
+
// We leave the current main axis only if every placement on that axis
|
|
4669
|
+
// overflows the main axis.
|
|
4670
|
+
overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
|
|
4671
|
+
// Try next placement and re-run the lifecycle.
|
|
4672
|
+
return {
|
|
4673
|
+
data: {
|
|
4674
|
+
index: nextIndex,
|
|
4675
|
+
overflows: overflowsData
|
|
4676
|
+
},
|
|
4677
|
+
reset: {
|
|
4678
|
+
placement: nextPlacement
|
|
4679
|
+
}
|
|
4680
|
+
};
|
|
4681
|
+
}
|
|
4682
|
+
}
|
|
4607
4683
|
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4684
|
+
// First, find the candidates that fit on the mainAxis side of overflow,
|
|
4685
|
+
// then find the placement that fits the best on the main crossAxis side.
|
|
4686
|
+
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;
|
|
4687
|
+
|
|
4688
|
+
// Otherwise fallback.
|
|
4689
|
+
if (!resetPlacement) {
|
|
4690
|
+
switch (fallbackStrategy) {
|
|
4691
|
+
case 'bestFit':
|
|
4692
|
+
{
|
|
4693
|
+
var _overflowsData$filter2;
|
|
4694
|
+
const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
|
|
4695
|
+
if (hasFallbackAxisSideDirection) {
|
|
4696
|
+
const currentSideAxis = getSideAxis(d.placement);
|
|
4697
|
+
return currentSideAxis === initialSideAxis ||
|
|
4698
|
+
// Create a bias to the `y` side axis due to horizontal
|
|
4699
|
+
// reading directions favoring greater width.
|
|
4700
|
+
currentSideAxis === 'y';
|
|
4701
|
+
}
|
|
4702
|
+
return true;
|
|
4703
|
+
}).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
4704
|
+
if (placement) {
|
|
4705
|
+
resetPlacement = placement;
|
|
4706
|
+
}
|
|
4707
|
+
break;
|
|
4708
|
+
}
|
|
4709
|
+
case 'initialPlacement':
|
|
4710
|
+
resetPlacement = initialPlacement;
|
|
4711
|
+
break;
|
|
4712
|
+
}
|
|
4713
|
+
}
|
|
4714
|
+
if (placement !== resetPlacement) {
|
|
4715
|
+
return {
|
|
4716
|
+
reset: {
|
|
4717
|
+
placement: resetPlacement
|
|
4718
|
+
}
|
|
4719
|
+
};
|
|
4720
|
+
}
|
|
4721
|
+
}
|
|
4722
|
+
return {};
|
|
4617
4723
|
}
|
|
4618
4724
|
};
|
|
4619
|
-
}
|
|
4725
|
+
};
|
|
4620
4726
|
|
|
4727
|
+
const originSides = /*#__PURE__*/new Set(['left', 'top']);
|
|
4621
4728
|
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
enabled: true,
|
|
4625
|
-
phase: 'write',
|
|
4626
|
-
fn: function fn() {},
|
|
4627
|
-
effect: effect,
|
|
4628
|
-
data: {}
|
|
4629
|
-
};
|
|
4729
|
+
// For type backwards-compatibility, the `OffsetOptions` type was also
|
|
4730
|
+
// Derivable.
|
|
4630
4731
|
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
};
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4732
|
+
async function convertValueToCoords(state, options) {
|
|
4733
|
+
const {
|
|
4734
|
+
placement,
|
|
4735
|
+
platform,
|
|
4736
|
+
elements
|
|
4737
|
+
} = state;
|
|
4738
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
4739
|
+
const side = getSide(placement);
|
|
4740
|
+
const alignment = getAlignment(placement);
|
|
4741
|
+
const isVertical = getSideAxis(placement) === 'y';
|
|
4742
|
+
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
4743
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
4744
|
+
const rawValue = evaluate(options, state);
|
|
4745
|
+
|
|
4746
|
+
// eslint-disable-next-line prefer-const
|
|
4747
|
+
let {
|
|
4748
|
+
mainAxis,
|
|
4749
|
+
crossAxis,
|
|
4750
|
+
alignmentAxis
|
|
4751
|
+
} = typeof rawValue === 'number' ? {
|
|
4752
|
+
mainAxis: rawValue,
|
|
4753
|
+
crossAxis: 0,
|
|
4754
|
+
alignmentAxis: null
|
|
4755
|
+
} : {
|
|
4756
|
+
mainAxis: rawValue.mainAxis || 0,
|
|
4757
|
+
crossAxis: rawValue.crossAxis || 0,
|
|
4758
|
+
alignmentAxis: rawValue.alignmentAxis
|
|
4759
|
+
};
|
|
4760
|
+
if (alignment && typeof alignmentAxis === 'number') {
|
|
4761
|
+
crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
|
|
4762
|
+
}
|
|
4763
|
+
return isVertical ? {
|
|
4764
|
+
x: crossAxis * crossAxisMulti,
|
|
4765
|
+
y: mainAxis * mainAxisMulti
|
|
4766
|
+
} : {
|
|
4767
|
+
x: mainAxis * mainAxisMulti,
|
|
4768
|
+
y: crossAxis * crossAxisMulti
|
|
4769
|
+
};
|
|
4641
4770
|
}
|
|
4642
4771
|
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4772
|
+
/**
|
|
4773
|
+
* Modifies the placement by translating the floating element along the
|
|
4774
|
+
* specified axes.
|
|
4775
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
4776
|
+
* object may be passed.
|
|
4777
|
+
* @see https://floating-ui.com/docs/offset
|
|
4778
|
+
*/
|
|
4779
|
+
const offset$2 = function (options) {
|
|
4780
|
+
if (options === void 0) {
|
|
4781
|
+
options = 0;
|
|
4782
|
+
}
|
|
4783
|
+
return {
|
|
4784
|
+
name: 'offset',
|
|
4785
|
+
options,
|
|
4786
|
+
async fn(state) {
|
|
4787
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
4788
|
+
const {
|
|
4789
|
+
x,
|
|
4790
|
+
y,
|
|
4791
|
+
placement,
|
|
4792
|
+
middlewareData
|
|
4793
|
+
} = state;
|
|
4794
|
+
const diffCoords = await convertValueToCoords(state, options);
|
|
4795
|
+
|
|
4796
|
+
// If the placement is the same and the arrow caused an alignment offset
|
|
4797
|
+
// then we don't need to change the positioning coordinates.
|
|
4798
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
4799
|
+
return {};
|
|
4800
|
+
}
|
|
4801
|
+
return {
|
|
4802
|
+
x: x + diffCoords.x,
|
|
4803
|
+
y: y + diffCoords.y,
|
|
4804
|
+
data: {
|
|
4805
|
+
...diffCoords,
|
|
4806
|
+
placement
|
|
4807
|
+
}
|
|
4808
|
+
};
|
|
4809
|
+
}
|
|
4810
|
+
};
|
|
4646
4811
|
};
|
|
4647
|
-
function getOppositeVariationPlacement(placement) {
|
|
4648
|
-
return placement.replace(/start|end/g, function (matched) {
|
|
4649
|
-
return hash[matched];
|
|
4650
|
-
});
|
|
4651
|
-
}
|
|
4652
4812
|
|
|
4653
|
-
|
|
4654
|
-
|
|
4813
|
+
/**
|
|
4814
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
4815
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
4816
|
+
* @see https://floating-ui.com/docs/shift
|
|
4817
|
+
*/
|
|
4818
|
+
const shift$2 = function (options) {
|
|
4819
|
+
if (options === void 0) {
|
|
4820
|
+
options = {};
|
|
4821
|
+
}
|
|
4655
4822
|
return {
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4823
|
+
name: 'shift',
|
|
4824
|
+
options,
|
|
4825
|
+
async fn(state) {
|
|
4826
|
+
const {
|
|
4827
|
+
x,
|
|
4828
|
+
y,
|
|
4829
|
+
placement,
|
|
4830
|
+
platform
|
|
4831
|
+
} = state;
|
|
4832
|
+
const {
|
|
4833
|
+
mainAxis: checkMainAxis = true,
|
|
4834
|
+
crossAxis: checkCrossAxis = false,
|
|
4835
|
+
limiter = {
|
|
4836
|
+
fn: _ref => {
|
|
4837
|
+
let {
|
|
4838
|
+
x,
|
|
4839
|
+
y
|
|
4840
|
+
} = _ref;
|
|
4841
|
+
return {
|
|
4842
|
+
x,
|
|
4843
|
+
y
|
|
4844
|
+
};
|
|
4845
|
+
}
|
|
4846
|
+
},
|
|
4847
|
+
...detectOverflowOptions
|
|
4848
|
+
} = evaluate(options, state);
|
|
4849
|
+
const coords = {
|
|
4850
|
+
x,
|
|
4851
|
+
y
|
|
4852
|
+
};
|
|
4853
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
4854
|
+
const crossAxis = getSideAxis(getSide(placement));
|
|
4855
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
4856
|
+
let mainAxisCoord = coords[mainAxis];
|
|
4857
|
+
let crossAxisCoord = coords[crossAxis];
|
|
4858
|
+
if (checkMainAxis) {
|
|
4859
|
+
const minSide = mainAxis === 'y' ? 'top' : 'left';
|
|
4860
|
+
const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
|
|
4861
|
+
const min = mainAxisCoord + overflow[minSide];
|
|
4862
|
+
const max = mainAxisCoord - overflow[maxSide];
|
|
4863
|
+
mainAxisCoord = clamp$1(min, mainAxisCoord, max);
|
|
4864
|
+
}
|
|
4865
|
+
if (checkCrossAxis) {
|
|
4866
|
+
const minSide = crossAxis === 'y' ? 'top' : 'left';
|
|
4867
|
+
const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
|
|
4868
|
+
const min = crossAxisCoord + overflow[minSide];
|
|
4869
|
+
const max = crossAxisCoord - overflow[maxSide];
|
|
4870
|
+
crossAxisCoord = clamp$1(min, crossAxisCoord, max);
|
|
4871
|
+
}
|
|
4872
|
+
const limitedCoords = limiter.fn({
|
|
4873
|
+
...state,
|
|
4874
|
+
[mainAxis]: mainAxisCoord,
|
|
4875
|
+
[crossAxis]: crossAxisCoord
|
|
4876
|
+
});
|
|
4877
|
+
return {
|
|
4878
|
+
...limitedCoords,
|
|
4879
|
+
data: {
|
|
4880
|
+
x: limitedCoords.x - x,
|
|
4881
|
+
y: limitedCoords.y - y,
|
|
4882
|
+
enabled: {
|
|
4883
|
+
[mainAxis]: checkMainAxis,
|
|
4884
|
+
[crossAxis]: checkCrossAxis
|
|
4885
|
+
}
|
|
4886
|
+
}
|
|
4887
|
+
};
|
|
4888
|
+
}
|
|
4664
4889
|
};
|
|
4665
|
-
}
|
|
4890
|
+
};
|
|
4666
4891
|
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4892
|
+
/**
|
|
4893
|
+
* Provides data that allows you to change the size of the floating element —
|
|
4894
|
+
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
4895
|
+
* width of the reference element.
|
|
4896
|
+
* @see https://floating-ui.com/docs/size
|
|
4897
|
+
*/
|
|
4898
|
+
const size$2 = function (options) {
|
|
4899
|
+
if (options === void 0) {
|
|
4900
|
+
options = {};
|
|
4901
|
+
}
|
|
4671
4902
|
return {
|
|
4672
|
-
|
|
4673
|
-
|
|
4903
|
+
name: 'size',
|
|
4904
|
+
options,
|
|
4905
|
+
async fn(state) {
|
|
4906
|
+
var _state$middlewareData, _state$middlewareData2;
|
|
4907
|
+
const {
|
|
4908
|
+
placement,
|
|
4909
|
+
rects,
|
|
4910
|
+
platform,
|
|
4911
|
+
elements
|
|
4912
|
+
} = state;
|
|
4913
|
+
const {
|
|
4914
|
+
apply = () => {},
|
|
4915
|
+
...detectOverflowOptions
|
|
4916
|
+
} = evaluate(options, state);
|
|
4917
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
4918
|
+
const side = getSide(placement);
|
|
4919
|
+
const alignment = getAlignment(placement);
|
|
4920
|
+
const isYAxis = getSideAxis(placement) === 'y';
|
|
4921
|
+
const {
|
|
4922
|
+
width,
|
|
4923
|
+
height
|
|
4924
|
+
} = rects.floating;
|
|
4925
|
+
let heightSide;
|
|
4926
|
+
let widthSide;
|
|
4927
|
+
if (side === 'top' || side === 'bottom') {
|
|
4928
|
+
heightSide = side;
|
|
4929
|
+
widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
|
|
4930
|
+
} else {
|
|
4931
|
+
widthSide = side;
|
|
4932
|
+
heightSide = alignment === 'end' ? 'top' : 'bottom';
|
|
4933
|
+
}
|
|
4934
|
+
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
4935
|
+
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
4936
|
+
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
|
|
4937
|
+
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
|
|
4938
|
+
const noShift = !state.middlewareData.shift;
|
|
4939
|
+
let availableHeight = overflowAvailableHeight;
|
|
4940
|
+
let availableWidth = overflowAvailableWidth;
|
|
4941
|
+
if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
|
|
4942
|
+
availableWidth = maximumClippingWidth;
|
|
4943
|
+
}
|
|
4944
|
+
if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
|
|
4945
|
+
availableHeight = maximumClippingHeight;
|
|
4946
|
+
}
|
|
4947
|
+
if (noShift && !alignment) {
|
|
4948
|
+
const xMin = max(overflow.left, 0);
|
|
4949
|
+
const xMax = max(overflow.right, 0);
|
|
4950
|
+
const yMin = max(overflow.top, 0);
|
|
4951
|
+
const yMax = max(overflow.bottom, 0);
|
|
4952
|
+
if (isYAxis) {
|
|
4953
|
+
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
4954
|
+
} else {
|
|
4955
|
+
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
4956
|
+
}
|
|
4957
|
+
}
|
|
4958
|
+
await apply({
|
|
4959
|
+
...state,
|
|
4960
|
+
availableWidth,
|
|
4961
|
+
availableHeight
|
|
4962
|
+
});
|
|
4963
|
+
const nextDimensions = await platform.getDimensions(elements.floating);
|
|
4964
|
+
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
4965
|
+
return {
|
|
4966
|
+
reset: {
|
|
4967
|
+
rects: true
|
|
4968
|
+
}
|
|
4969
|
+
};
|
|
4970
|
+
}
|
|
4971
|
+
return {};
|
|
4972
|
+
}
|
|
4674
4973
|
};
|
|
4675
|
-
}
|
|
4676
|
-
|
|
4677
|
-
function getWindowScrollBarX(element) {
|
|
4678
|
-
// If <html> has a CSS width greater than the viewport, then this will be
|
|
4679
|
-
// incorrect for RTL.
|
|
4680
|
-
// Popper 1 is broken in this case and never had a bug report so let's assume
|
|
4681
|
-
// it's not an issue. I don't think anyone ever specifies width on <html>
|
|
4682
|
-
// anyway.
|
|
4683
|
-
// Browsers where the left scrollbar doesn't cause an issue report `0` for
|
|
4684
|
-
// this (e.g. Edge 2019, IE11, Safari)
|
|
4685
|
-
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
|
|
4686
|
-
}
|
|
4687
|
-
|
|
4688
|
-
function getViewportRect(element) {
|
|
4689
|
-
var win = getWindow(element);
|
|
4690
|
-
var html = getDocumentElement(element);
|
|
4691
|
-
var visualViewport = win.visualViewport;
|
|
4692
|
-
var width = html.clientWidth;
|
|
4693
|
-
var height = html.clientHeight;
|
|
4694
|
-
var x = 0;
|
|
4695
|
-
var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
|
|
4696
|
-
// can be obscured underneath it.
|
|
4697
|
-
// Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
|
|
4698
|
-
// if it isn't open, so if this isn't available, the popper will be detected
|
|
4699
|
-
// to overflow the bottom of the screen too early.
|
|
4974
|
+
};
|
|
4700
4975
|
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4976
|
+
function hasWindow() {
|
|
4977
|
+
return typeof window !== 'undefined';
|
|
4978
|
+
}
|
|
4979
|
+
function getNodeName(node) {
|
|
4980
|
+
if (isNode(node)) {
|
|
4981
|
+
return (node.nodeName || '').toLowerCase();
|
|
4982
|
+
}
|
|
4983
|
+
// Mocked nodes in testing environments may not be instances of Node. By
|
|
4984
|
+
// returning `#document` an infinite loop won't occur.
|
|
4985
|
+
// https://github.com/floating-ui/floating-ui/issues/2317
|
|
4986
|
+
return '#document';
|
|
4987
|
+
}
|
|
4988
|
+
function getWindow(node) {
|
|
4989
|
+
var _node$ownerDocument;
|
|
4990
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
4991
|
+
}
|
|
4992
|
+
function getDocumentElement(node) {
|
|
4993
|
+
var _ref;
|
|
4994
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
4995
|
+
}
|
|
4996
|
+
function isNode(value) {
|
|
4997
|
+
if (!hasWindow()) {
|
|
4998
|
+
return false;
|
|
4999
|
+
}
|
|
5000
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
5001
|
+
}
|
|
5002
|
+
function isElement(value) {
|
|
5003
|
+
if (!hasWindow()) {
|
|
5004
|
+
return false;
|
|
5005
|
+
}
|
|
5006
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
5007
|
+
}
|
|
5008
|
+
function isHTMLElement(value) {
|
|
5009
|
+
if (!hasWindow()) {
|
|
5010
|
+
return false;
|
|
5011
|
+
}
|
|
5012
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
5013
|
+
}
|
|
5014
|
+
function isShadowRoot(value) {
|
|
5015
|
+
if (!hasWindow() || typeof ShadowRoot === 'undefined') {
|
|
5016
|
+
return false;
|
|
5017
|
+
}
|
|
5018
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
5019
|
+
}
|
|
5020
|
+
const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
|
|
5021
|
+
function isOverflowElement(element) {
|
|
5022
|
+
const {
|
|
5023
|
+
overflow,
|
|
5024
|
+
overflowX,
|
|
5025
|
+
overflowY,
|
|
5026
|
+
display
|
|
5027
|
+
} = getComputedStyle$1(element);
|
|
5028
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
|
|
5029
|
+
}
|
|
5030
|
+
const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
|
|
5031
|
+
function isTableElement(element) {
|
|
5032
|
+
return tableElements.has(getNodeName(element));
|
|
5033
|
+
}
|
|
5034
|
+
const topLayerSelectors = [':popover-open', ':modal'];
|
|
5035
|
+
function isTopLayer(element) {
|
|
5036
|
+
return topLayerSelectors.some(selector => {
|
|
5037
|
+
try {
|
|
5038
|
+
return element.matches(selector);
|
|
5039
|
+
} catch (_e) {
|
|
5040
|
+
return false;
|
|
5041
|
+
}
|
|
5042
|
+
});
|
|
5043
|
+
}
|
|
5044
|
+
const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
|
|
5045
|
+
const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
|
|
5046
|
+
const containValues = ['paint', 'layout', 'strict', 'content'];
|
|
5047
|
+
function isContainingBlock(elementOrCss) {
|
|
5048
|
+
const webkit = isWebKit();
|
|
5049
|
+
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
5050
|
+
|
|
5051
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
5052
|
+
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
|
5053
|
+
return transformProperties.some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || willChangeValues.some(value => (css.willChange || '').includes(value)) || containValues.some(value => (css.contain || '').includes(value));
|
|
5054
|
+
}
|
|
5055
|
+
function getContainingBlock(element) {
|
|
5056
|
+
let currentNode = getParentNode(element);
|
|
5057
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
5058
|
+
if (isContainingBlock(currentNode)) {
|
|
5059
|
+
return currentNode;
|
|
5060
|
+
} else if (isTopLayer(currentNode)) {
|
|
5061
|
+
return null;
|
|
4715
5062
|
}
|
|
5063
|
+
currentNode = getParentNode(currentNode);
|
|
4716
5064
|
}
|
|
4717
|
-
|
|
4718
|
-
return {
|
|
4719
|
-
width: width,
|
|
4720
|
-
height: height,
|
|
4721
|
-
x: x + getWindowScrollBarX(element),
|
|
4722
|
-
y: y
|
|
4723
|
-
};
|
|
5065
|
+
return null;
|
|
4724
5066
|
}
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
if (
|
|
4738
|
-
|
|
5067
|
+
function isWebKit() {
|
|
5068
|
+
if (typeof CSS === 'undefined' || !CSS.supports) return false;
|
|
5069
|
+
return CSS.supports('-webkit-backdrop-filter', 'none');
|
|
5070
|
+
}
|
|
5071
|
+
const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
|
|
5072
|
+
function isLastTraversableNode(node) {
|
|
5073
|
+
return lastTraversableNodeNames.has(getNodeName(node));
|
|
5074
|
+
}
|
|
5075
|
+
function getComputedStyle$1(element) {
|
|
5076
|
+
return getWindow(element).getComputedStyle(element);
|
|
5077
|
+
}
|
|
5078
|
+
function getNodeScroll(element) {
|
|
5079
|
+
if (isElement(element)) {
|
|
5080
|
+
return {
|
|
5081
|
+
scrollLeft: element.scrollLeft,
|
|
5082
|
+
scrollTop: element.scrollTop
|
|
5083
|
+
};
|
|
4739
5084
|
}
|
|
4740
|
-
|
|
4741
5085
|
return {
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
x: x,
|
|
4745
|
-
y: y
|
|
5086
|
+
scrollLeft: element.scrollX,
|
|
5087
|
+
scrollTop: element.scrollY
|
|
4746
5088
|
};
|
|
4747
5089
|
}
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
5090
|
+
function getParentNode(node) {
|
|
5091
|
+
if (getNodeName(node) === 'html') {
|
|
5092
|
+
return node;
|
|
5093
|
+
}
|
|
5094
|
+
const result =
|
|
5095
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
5096
|
+
node.assignedSlot ||
|
|
5097
|
+
// DOM Element detected.
|
|
5098
|
+
node.parentNode ||
|
|
5099
|
+
// ShadowRoot detected.
|
|
5100
|
+
isShadowRoot(node) && node.host ||
|
|
5101
|
+
// Fallback.
|
|
5102
|
+
getDocumentElement(node);
|
|
5103
|
+
return isShadowRoot(result) ? result.host : result;
|
|
4757
5104
|
}
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
if (
|
|
4761
|
-
|
|
4762
|
-
return node.ownerDocument.body;
|
|
5105
|
+
function getNearestOverflowAncestor(node) {
|
|
5106
|
+
const parentNode = getParentNode(node);
|
|
5107
|
+
if (isLastTraversableNode(parentNode)) {
|
|
5108
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
4763
5109
|
}
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
return node;
|
|
5110
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
5111
|
+
return parentNode;
|
|
4767
5112
|
}
|
|
4768
|
-
|
|
4769
|
-
return getScrollParent(getParentNode(node));
|
|
5113
|
+
return getNearestOverflowAncestor(parentNode);
|
|
4770
5114
|
}
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
given a DOM element, return the list of all scroll parents, up the list of ancesors
|
|
4774
|
-
until we get to the top window object. This list is what we attach scroll listeners
|
|
4775
|
-
to, because if any of these parent elements scroll, we'll need to re-calculate the
|
|
4776
|
-
reference element's position.
|
|
4777
|
-
*/
|
|
4778
|
-
|
|
4779
|
-
function listScrollParents(element, list) {
|
|
5115
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
5116
|
+
var _node$ownerDocument2;
|
|
4780
5117
|
if (list === void 0) {
|
|
4781
5118
|
list = [];
|
|
4782
5119
|
}
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
return Object.assign(Object.assign({}, rect), {}, {
|
|
4795
|
-
left: rect.x,
|
|
4796
|
-
top: rect.y,
|
|
4797
|
-
right: rect.x + rect.width,
|
|
4798
|
-
bottom: rect.y + rect.height
|
|
4799
|
-
});
|
|
5120
|
+
if (traverseIframes === void 0) {
|
|
5121
|
+
traverseIframes = true;
|
|
5122
|
+
}
|
|
5123
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
5124
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
5125
|
+
const win = getWindow(scrollableAncestor);
|
|
5126
|
+
if (isBody) {
|
|
5127
|
+
const frameElement = getFrameElement(win);
|
|
5128
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
5129
|
+
}
|
|
5130
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
4800
5131
|
}
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
var rect = getBoundingClientRect(element);
|
|
4804
|
-
rect.top = rect.top + element.clientTop;
|
|
4805
|
-
rect.left = rect.left + element.clientLeft;
|
|
4806
|
-
rect.bottom = rect.top + element.clientHeight;
|
|
4807
|
-
rect.right = rect.left + element.clientWidth;
|
|
4808
|
-
rect.width = element.clientWidth;
|
|
4809
|
-
rect.height = element.clientHeight;
|
|
4810
|
-
rect.x = rect.left;
|
|
4811
|
-
rect.y = rect.top;
|
|
4812
|
-
return rect;
|
|
5132
|
+
function getFrameElement(win) {
|
|
5133
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
4813
5134
|
}
|
|
4814
5135
|
|
|
4815
|
-
function
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
//
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
});
|
|
4835
|
-
} // Gets the maximum area that the element is visible in due to any number of
|
|
4836
|
-
// clipping parents
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
function getClippingRect(element, boundary, rootBoundary) {
|
|
4840
|
-
var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
|
|
4841
|
-
var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
|
|
4842
|
-
var firstClippingParent = clippingParents[0];
|
|
4843
|
-
var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
|
|
4844
|
-
var rect = getClientRectFromMixedType(element, clippingParent);
|
|
4845
|
-
accRect.top = Math.max(rect.top, accRect.top);
|
|
4846
|
-
accRect.right = Math.min(rect.right, accRect.right);
|
|
4847
|
-
accRect.bottom = Math.min(rect.bottom, accRect.bottom);
|
|
4848
|
-
accRect.left = Math.max(rect.left, accRect.left);
|
|
4849
|
-
return accRect;
|
|
4850
|
-
}, getClientRectFromMixedType(element, firstClippingParent));
|
|
4851
|
-
clippingRect.width = clippingRect.right - clippingRect.left;
|
|
4852
|
-
clippingRect.height = clippingRect.bottom - clippingRect.top;
|
|
4853
|
-
clippingRect.x = clippingRect.left;
|
|
4854
|
-
clippingRect.y = clippingRect.top;
|
|
4855
|
-
return clippingRect;
|
|
5136
|
+
function getCssDimensions(element) {
|
|
5137
|
+
const css = getComputedStyle$1(element);
|
|
5138
|
+
// In testing environments, the `width` and `height` properties are empty
|
|
5139
|
+
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
5140
|
+
let width = parseFloat(css.width) || 0;
|
|
5141
|
+
let height = parseFloat(css.height) || 0;
|
|
5142
|
+
const hasOffset = isHTMLElement(element);
|
|
5143
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
5144
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
5145
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
5146
|
+
if (shouldFallback) {
|
|
5147
|
+
width = offsetWidth;
|
|
5148
|
+
height = offsetHeight;
|
|
5149
|
+
}
|
|
5150
|
+
return {
|
|
5151
|
+
width,
|
|
5152
|
+
height,
|
|
5153
|
+
$: shouldFallback
|
|
5154
|
+
};
|
|
4856
5155
|
}
|
|
4857
5156
|
|
|
4858
|
-
function
|
|
4859
|
-
return
|
|
5157
|
+
function unwrapElement(element) {
|
|
5158
|
+
return !isElement(element) ? element.contextElement : element;
|
|
4860
5159
|
}
|
|
4861
5160
|
|
|
4862
|
-
function
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
var basePlacement = placement ? getBasePlacement(placement) : null;
|
|
4867
|
-
var variation = placement ? getVariation(placement) : null;
|
|
4868
|
-
var commonX = reference.x + reference.width / 2 - element.width / 2;
|
|
4869
|
-
var commonY = reference.y + reference.height / 2 - element.height / 2;
|
|
4870
|
-
var offsets;
|
|
4871
|
-
|
|
4872
|
-
switch (basePlacement) {
|
|
4873
|
-
case top:
|
|
4874
|
-
offsets = {
|
|
4875
|
-
x: commonX,
|
|
4876
|
-
y: reference.y - element.height
|
|
4877
|
-
};
|
|
4878
|
-
break;
|
|
4879
|
-
|
|
4880
|
-
case bottom:
|
|
4881
|
-
offsets = {
|
|
4882
|
-
x: commonX,
|
|
4883
|
-
y: reference.y + reference.height
|
|
4884
|
-
};
|
|
4885
|
-
break;
|
|
4886
|
-
|
|
4887
|
-
case right:
|
|
4888
|
-
offsets = {
|
|
4889
|
-
x: reference.x + reference.width,
|
|
4890
|
-
y: commonY
|
|
4891
|
-
};
|
|
4892
|
-
break;
|
|
4893
|
-
|
|
4894
|
-
case left:
|
|
4895
|
-
offsets = {
|
|
4896
|
-
x: reference.x - element.width,
|
|
4897
|
-
y: commonY
|
|
4898
|
-
};
|
|
4899
|
-
break;
|
|
4900
|
-
|
|
4901
|
-
default:
|
|
4902
|
-
offsets = {
|
|
4903
|
-
x: reference.x,
|
|
4904
|
-
y: reference.y
|
|
4905
|
-
};
|
|
5161
|
+
function getScale(element) {
|
|
5162
|
+
const domElement = unwrapElement(element);
|
|
5163
|
+
if (!isHTMLElement(domElement)) {
|
|
5164
|
+
return createCoords(1);
|
|
4906
5165
|
}
|
|
5166
|
+
const rect = domElement.getBoundingClientRect();
|
|
5167
|
+
const {
|
|
5168
|
+
width,
|
|
5169
|
+
height,
|
|
5170
|
+
$
|
|
5171
|
+
} = getCssDimensions(domElement);
|
|
5172
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
5173
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
4907
5174
|
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
if (mainAxis != null) {
|
|
4911
|
-
var len = mainAxis === 'y' ? 'height' : 'width';
|
|
4912
|
-
|
|
4913
|
-
switch (variation) {
|
|
4914
|
-
case start:
|
|
4915
|
-
offsets[mainAxis] = Math.floor(offsets[mainAxis]) - Math.floor(reference[len] / 2 - element[len] / 2);
|
|
4916
|
-
break;
|
|
5175
|
+
// 0, NaN, or Infinity should always fallback to 1.
|
|
4917
5176
|
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
break;
|
|
4921
|
-
}
|
|
5177
|
+
if (!x || !Number.isFinite(x)) {
|
|
5178
|
+
x = 1;
|
|
4922
5179
|
}
|
|
4923
|
-
|
|
4924
|
-
|
|
5180
|
+
if (!y || !Number.isFinite(y)) {
|
|
5181
|
+
y = 1;
|
|
5182
|
+
}
|
|
5183
|
+
return {
|
|
5184
|
+
x,
|
|
5185
|
+
y
|
|
5186
|
+
};
|
|
4925
5187
|
}
|
|
4926
5188
|
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
5189
|
+
const noOffsets = /*#__PURE__*/createCoords(0);
|
|
5190
|
+
function getVisualOffsets(element) {
|
|
5191
|
+
const win = getWindow(element);
|
|
5192
|
+
if (!isWebKit() || !win.visualViewport) {
|
|
5193
|
+
return noOffsets;
|
|
4930
5194
|
}
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
placement = _options$placement === void 0 ? state.placement : _options$placement,
|
|
4935
|
-
_options$boundary = _options.boundary,
|
|
4936
|
-
boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
|
|
4937
|
-
_options$rootBoundary = _options.rootBoundary,
|
|
4938
|
-
rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
|
|
4939
|
-
_options$elementConte = _options.elementContext,
|
|
4940
|
-
elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
|
|
4941
|
-
_options$altBoundary = _options.altBoundary,
|
|
4942
|
-
altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
|
|
4943
|
-
_options$padding = _options.padding,
|
|
4944
|
-
padding = _options$padding === void 0 ? 0 : _options$padding;
|
|
4945
|
-
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
|
4946
|
-
var altContext = elementContext === popper ? reference : popper;
|
|
4947
|
-
var referenceElement = state.elements.reference;
|
|
4948
|
-
var popperRect = state.rects.popper;
|
|
4949
|
-
var element = state.elements[altBoundary ? altContext : elementContext];
|
|
4950
|
-
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
|
|
4951
|
-
var referenceClientRect = getBoundingClientRect(referenceElement);
|
|
4952
|
-
var popperOffsets = computeOffsets({
|
|
4953
|
-
reference: referenceClientRect,
|
|
4954
|
-
element: popperRect,
|
|
4955
|
-
placement: placement
|
|
4956
|
-
});
|
|
4957
|
-
var popperClientRect = rectToClientRect(Object.assign(Object.assign({}, popperRect), popperOffsets));
|
|
4958
|
-
var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
|
|
4959
|
-
// 0 or negative = within the clipping rect
|
|
4960
|
-
|
|
4961
|
-
var overflowOffsets = {
|
|
4962
|
-
top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
|
|
4963
|
-
bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
|
|
4964
|
-
left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
|
|
4965
|
-
right: elementClientRect.right - clippingClientRect.right + paddingObject.right
|
|
5195
|
+
return {
|
|
5196
|
+
x: win.visualViewport.offsetLeft,
|
|
5197
|
+
y: win.visualViewport.offsetTop
|
|
4966
5198
|
};
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
if (
|
|
4970
|
-
|
|
4971
|
-
Object.keys(overflowOffsets).forEach(function (key) {
|
|
4972
|
-
var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
|
|
4973
|
-
var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
|
|
4974
|
-
overflowOffsets[key] += offset[axis] * multiply;
|
|
4975
|
-
});
|
|
5199
|
+
}
|
|
5200
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
5201
|
+
if (isFixed === void 0) {
|
|
5202
|
+
isFixed = false;
|
|
4976
5203
|
}
|
|
4977
|
-
|
|
4978
|
-
|
|
5204
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
5205
|
+
return false;
|
|
5206
|
+
}
|
|
5207
|
+
return isFixed;
|
|
4979
5208
|
}
|
|
4980
5209
|
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
function computeAutoPlacement(state, options) {
|
|
4985
|
-
if (options === void 0) {
|
|
4986
|
-
options = {};
|
|
5210
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
5211
|
+
if (includeScale === void 0) {
|
|
5212
|
+
includeScale = false;
|
|
4987
5213
|
}
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
var allowedPlacements = placements$1.filter(function (placement) {
|
|
5003
|
-
return allowedAutoPlacements.indexOf(placement) >= 0;
|
|
5004
|
-
});
|
|
5005
|
-
|
|
5006
|
-
if (allowedPlacements.length === 0) {
|
|
5007
|
-
allowedPlacements = placements$1;
|
|
5008
|
-
|
|
5009
|
-
if (process.env.NODE_ENV !== "production") {
|
|
5010
|
-
console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(' '));
|
|
5214
|
+
if (isFixedStrategy === void 0) {
|
|
5215
|
+
isFixedStrategy = false;
|
|
5216
|
+
}
|
|
5217
|
+
const clientRect = element.getBoundingClientRect();
|
|
5218
|
+
const domElement = unwrapElement(element);
|
|
5219
|
+
let scale = createCoords(1);
|
|
5220
|
+
if (includeScale) {
|
|
5221
|
+
if (offsetParent) {
|
|
5222
|
+
if (isElement(offsetParent)) {
|
|
5223
|
+
scale = getScale(offsetParent);
|
|
5224
|
+
}
|
|
5225
|
+
} else {
|
|
5226
|
+
scale = getScale(element);
|
|
5011
5227
|
}
|
|
5012
|
-
}
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5228
|
+
}
|
|
5229
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
5230
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
5231
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
5232
|
+
let width = clientRect.width / scale.x;
|
|
5233
|
+
let height = clientRect.height / scale.y;
|
|
5234
|
+
if (domElement) {
|
|
5235
|
+
const win = getWindow(domElement);
|
|
5236
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
5237
|
+
let currentWin = win;
|
|
5238
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
5239
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
5240
|
+
const iframeScale = getScale(currentIFrame);
|
|
5241
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
5242
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
5243
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
5244
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
5245
|
+
x *= iframeScale.x;
|
|
5246
|
+
y *= iframeScale.y;
|
|
5247
|
+
width *= iframeScale.x;
|
|
5248
|
+
height *= iframeScale.y;
|
|
5249
|
+
x += left;
|
|
5250
|
+
y += top;
|
|
5251
|
+
currentWin = getWindow(currentIFrame);
|
|
5252
|
+
currentIFrame = getFrameElement(currentWin);
|
|
5253
|
+
}
|
|
5254
|
+
}
|
|
5255
|
+
return rectToClientRect({
|
|
5256
|
+
width,
|
|
5257
|
+
height,
|
|
5258
|
+
x,
|
|
5259
|
+
y
|
|
5026
5260
|
});
|
|
5027
5261
|
}
|
|
5028
5262
|
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5263
|
+
// If <html> has a CSS width greater than the viewport, then this will be
|
|
5264
|
+
// incorrect for RTL.
|
|
5265
|
+
function getWindowScrollBarX(element, rect) {
|
|
5266
|
+
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
5267
|
+
if (!rect) {
|
|
5268
|
+
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
5032
5269
|
}
|
|
5033
|
-
|
|
5034
|
-
var oppositePlacement = getOppositePlacement(placement);
|
|
5035
|
-
return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
|
|
5270
|
+
return rect.left + leftScroll;
|
|
5036
5271
|
}
|
|
5037
5272
|
|
|
5038
|
-
function
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5273
|
+
function getHTMLOffset(documentElement, scroll) {
|
|
5274
|
+
const htmlRect = documentElement.getBoundingClientRect();
|
|
5275
|
+
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
|
5276
|
+
const y = htmlRect.top + scroll.scrollTop;
|
|
5277
|
+
return {
|
|
5278
|
+
x,
|
|
5279
|
+
y
|
|
5280
|
+
};
|
|
5281
|
+
}
|
|
5042
5282
|
|
|
5043
|
-
|
|
5044
|
-
|
|
5283
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
5284
|
+
let {
|
|
5285
|
+
elements,
|
|
5286
|
+
rect,
|
|
5287
|
+
offsetParent,
|
|
5288
|
+
strategy
|
|
5289
|
+
} = _ref;
|
|
5290
|
+
const isFixed = strategy === 'fixed';
|
|
5291
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
5292
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
5293
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
5294
|
+
return rect;
|
|
5045
5295
|
}
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
_options$flipVariatio = options.flipVariations,
|
|
5057
|
-
flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
|
|
5058
|
-
allowedAutoPlacements = options.allowedAutoPlacements;
|
|
5059
|
-
var preferredPlacement = state.options.placement;
|
|
5060
|
-
var basePlacement = getBasePlacement(preferredPlacement);
|
|
5061
|
-
var isBasePlacement = basePlacement === preferredPlacement;
|
|
5062
|
-
var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
|
|
5063
|
-
var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
|
|
5064
|
-
return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
|
|
5065
|
-
placement: placement,
|
|
5066
|
-
boundary: boundary,
|
|
5067
|
-
rootBoundary: rootBoundary,
|
|
5068
|
-
padding: padding,
|
|
5069
|
-
flipVariations: flipVariations,
|
|
5070
|
-
allowedAutoPlacements: allowedAutoPlacements
|
|
5071
|
-
}) : placement);
|
|
5072
|
-
}, []);
|
|
5073
|
-
var referenceRect = state.rects.reference;
|
|
5074
|
-
var popperRect = state.rects.popper;
|
|
5075
|
-
var checksMap = new Map();
|
|
5076
|
-
var makeFallbackChecks = true;
|
|
5077
|
-
var firstFittingPlacement = placements[0];
|
|
5078
|
-
|
|
5079
|
-
for (var i = 0; i < placements.length; i++) {
|
|
5080
|
-
var placement = placements[i];
|
|
5081
|
-
|
|
5082
|
-
var _basePlacement = getBasePlacement(placement);
|
|
5083
|
-
|
|
5084
|
-
var isStartVariation = getVariation(placement) === start;
|
|
5085
|
-
var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
|
|
5086
|
-
var len = isVertical ? 'width' : 'height';
|
|
5087
|
-
var overflow = detectOverflow(state, {
|
|
5088
|
-
placement: placement,
|
|
5089
|
-
boundary: boundary,
|
|
5090
|
-
rootBoundary: rootBoundary,
|
|
5091
|
-
altBoundary: altBoundary,
|
|
5092
|
-
padding: padding
|
|
5093
|
-
});
|
|
5094
|
-
var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
|
|
5095
|
-
|
|
5096
|
-
if (referenceRect[len] > popperRect[len]) {
|
|
5097
|
-
mainVariationSide = getOppositePlacement(mainVariationSide);
|
|
5098
|
-
}
|
|
5099
|
-
|
|
5100
|
-
var altVariationSide = getOppositePlacement(mainVariationSide);
|
|
5101
|
-
var checks = [];
|
|
5102
|
-
|
|
5103
|
-
if (checkMainAxis) {
|
|
5104
|
-
checks.push(overflow[_basePlacement] <= 0);
|
|
5105
|
-
}
|
|
5106
|
-
|
|
5107
|
-
if (checkAltAxis) {
|
|
5108
|
-
checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
|
|
5296
|
+
let scroll = {
|
|
5297
|
+
scrollLeft: 0,
|
|
5298
|
+
scrollTop: 0
|
|
5299
|
+
};
|
|
5300
|
+
let scale = createCoords(1);
|
|
5301
|
+
const offsets = createCoords(0);
|
|
5302
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
5303
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
5304
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
5305
|
+
scroll = getNodeScroll(offsetParent);
|
|
5109
5306
|
}
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
makeFallbackChecks = false;
|
|
5116
|
-
break;
|
|
5307
|
+
if (isHTMLElement(offsetParent)) {
|
|
5308
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
5309
|
+
scale = getScale(offsetParent);
|
|
5310
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
5311
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
5117
5312
|
}
|
|
5118
|
-
|
|
5119
|
-
checksMap.set(placement, checks);
|
|
5120
5313
|
}
|
|
5314
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
5315
|
+
return {
|
|
5316
|
+
width: rect.width * scale.x,
|
|
5317
|
+
height: rect.height * scale.y,
|
|
5318
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
5319
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
5320
|
+
};
|
|
5321
|
+
}
|
|
5121
5322
|
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
var _loop = function _loop(_i) {
|
|
5127
|
-
var fittingPlacement = placements.find(function (placement) {
|
|
5128
|
-
var checks = checksMap.get(placement);
|
|
5129
|
-
|
|
5130
|
-
if (checks) {
|
|
5131
|
-
return checks.slice(0, _i).every(function (check) {
|
|
5132
|
-
return check;
|
|
5133
|
-
});
|
|
5134
|
-
}
|
|
5135
|
-
});
|
|
5136
|
-
|
|
5137
|
-
if (fittingPlacement) {
|
|
5138
|
-
firstFittingPlacement = fittingPlacement;
|
|
5139
|
-
return "break";
|
|
5140
|
-
}
|
|
5141
|
-
};
|
|
5142
|
-
|
|
5143
|
-
for (var _i = numberOfChecks; _i > 0; _i--) {
|
|
5144
|
-
var _ret = _loop(_i);
|
|
5145
|
-
|
|
5146
|
-
if (_ret === "break") break;
|
|
5147
|
-
}
|
|
5148
|
-
}
|
|
5323
|
+
function getClientRects(element) {
|
|
5324
|
+
return Array.from(element.getClientRects());
|
|
5325
|
+
}
|
|
5149
5326
|
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5327
|
+
// Gets the entire size of the scrollable document area, even extending outside
|
|
5328
|
+
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
|
5329
|
+
function getDocumentRect(element) {
|
|
5330
|
+
const html = getDocumentElement(element);
|
|
5331
|
+
const scroll = getNodeScroll(element);
|
|
5332
|
+
const body = element.ownerDocument.body;
|
|
5333
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
5334
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
5335
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
5336
|
+
const y = -scroll.scrollTop;
|
|
5337
|
+
if (getComputedStyle$1(body).direction === 'rtl') {
|
|
5338
|
+
x += max(html.clientWidth, body.clientWidth) - width;
|
|
5154
5339
|
}
|
|
5155
|
-
|
|
5156
|
-
|
|
5340
|
+
return {
|
|
5341
|
+
width,
|
|
5342
|
+
height,
|
|
5343
|
+
x,
|
|
5344
|
+
y
|
|
5345
|
+
};
|
|
5346
|
+
}
|
|
5157
5347
|
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5348
|
+
// Safety check: ensure the scrollbar space is reasonable in case this
|
|
5349
|
+
// calculation is affected by unusual styles.
|
|
5350
|
+
// Most scrollbars leave 15-18px of space.
|
|
5351
|
+
const SCROLLBAR_MAX = 25;
|
|
5352
|
+
function getViewportRect(element, strategy) {
|
|
5353
|
+
const win = getWindow(element);
|
|
5354
|
+
const html = getDocumentElement(element);
|
|
5355
|
+
const visualViewport = win.visualViewport;
|
|
5356
|
+
let width = html.clientWidth;
|
|
5357
|
+
let height = html.clientHeight;
|
|
5358
|
+
let x = 0;
|
|
5359
|
+
let y = 0;
|
|
5360
|
+
if (visualViewport) {
|
|
5361
|
+
width = visualViewport.width;
|
|
5362
|
+
height = visualViewport.height;
|
|
5363
|
+
const visualViewportBased = isWebKit();
|
|
5364
|
+
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
|
|
5365
|
+
x = visualViewport.offsetLeft;
|
|
5366
|
+
y = visualViewport.offsetTop;
|
|
5367
|
+
}
|
|
5166
5368
|
}
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5369
|
+
const windowScrollbarX = getWindowScrollBarX(html);
|
|
5370
|
+
// <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
|
|
5371
|
+
// visual width of the <html> but this is not considered in the size
|
|
5372
|
+
// of `html.clientWidth`.
|
|
5373
|
+
if (windowScrollbarX <= 0) {
|
|
5374
|
+
const doc = html.ownerDocument;
|
|
5375
|
+
const body = doc.body;
|
|
5376
|
+
const bodyStyles = getComputedStyle(body);
|
|
5377
|
+
const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
5378
|
+
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
5379
|
+
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
|
5380
|
+
width -= clippingStableScrollbarWidth;
|
|
5381
|
+
}
|
|
5382
|
+
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
|
5383
|
+
// If the <body> scrollbar is on the left, the width needs to be extended
|
|
5384
|
+
// by the scrollbar amount so there isn't extra space on the right.
|
|
5385
|
+
width += windowScrollbarX;
|
|
5175
5386
|
}
|
|
5176
|
-
|
|
5177
5387
|
return {
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5388
|
+
width,
|
|
5389
|
+
height,
|
|
5390
|
+
x,
|
|
5391
|
+
y
|
|
5182
5392
|
};
|
|
5183
5393
|
}
|
|
5184
5394
|
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
altBoundary: true
|
|
5202
|
-
});
|
|
5203
|
-
var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
|
|
5204
|
-
var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
|
|
5205
|
-
var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
|
|
5206
|
-
var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
|
|
5207
|
-
state.modifiersData[name] = {
|
|
5208
|
-
referenceClippingOffsets: referenceClippingOffsets,
|
|
5209
|
-
popperEscapeOffsets: popperEscapeOffsets,
|
|
5210
|
-
isReferenceHidden: isReferenceHidden,
|
|
5211
|
-
hasPopperEscaped: hasPopperEscaped
|
|
5212
|
-
};
|
|
5213
|
-
state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
|
|
5214
|
-
'data-popper-reference-hidden': isReferenceHidden,
|
|
5215
|
-
'data-popper-escaped': hasPopperEscaped
|
|
5216
|
-
});
|
|
5217
|
-
} // eslint-disable-next-line import/no-unused-modules
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
var hide$1 = {
|
|
5221
|
-
name: 'hide',
|
|
5222
|
-
enabled: true,
|
|
5223
|
-
phase: 'main',
|
|
5224
|
-
requiresIfExists: ['preventOverflow'],
|
|
5225
|
-
fn: hide
|
|
5226
|
-
};
|
|
5227
|
-
|
|
5228
|
-
function distanceAndSkiddingToXY(placement, rects, offset) {
|
|
5229
|
-
var basePlacement = getBasePlacement(placement);
|
|
5230
|
-
var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
|
|
5231
|
-
|
|
5232
|
-
var _ref = typeof offset === 'function' ? offset(Object.assign(Object.assign({}, rects), {}, {
|
|
5233
|
-
placement: placement
|
|
5234
|
-
})) : offset,
|
|
5235
|
-
skidding = _ref[0],
|
|
5236
|
-
distance = _ref[1];
|
|
5237
|
-
|
|
5238
|
-
skidding = skidding || 0;
|
|
5239
|
-
distance = (distance || 0) * invertDistance;
|
|
5240
|
-
return [left, right].indexOf(basePlacement) >= 0 ? {
|
|
5241
|
-
x: distance,
|
|
5242
|
-
y: skidding
|
|
5243
|
-
} : {
|
|
5244
|
-
x: skidding,
|
|
5245
|
-
y: distance
|
|
5395
|
+
const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
|
|
5396
|
+
// Returns the inner client rect, subtracting scrollbars if present.
|
|
5397
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
5398
|
+
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
5399
|
+
const top = clientRect.top + element.clientTop;
|
|
5400
|
+
const left = clientRect.left + element.clientLeft;
|
|
5401
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
5402
|
+
const width = element.clientWidth * scale.x;
|
|
5403
|
+
const height = element.clientHeight * scale.y;
|
|
5404
|
+
const x = left * scale.x;
|
|
5405
|
+
const y = top * scale.y;
|
|
5406
|
+
return {
|
|
5407
|
+
width,
|
|
5408
|
+
height,
|
|
5409
|
+
x,
|
|
5410
|
+
y
|
|
5246
5411
|
};
|
|
5247
5412
|
}
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
state.modifiersData.popperOffsets.x += x;
|
|
5265
|
-
state.modifiersData.popperOffsets.y += y;
|
|
5413
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
5414
|
+
let rect;
|
|
5415
|
+
if (clippingAncestor === 'viewport') {
|
|
5416
|
+
rect = getViewportRect(element, strategy);
|
|
5417
|
+
} else if (clippingAncestor === 'document') {
|
|
5418
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
5419
|
+
} else if (isElement(clippingAncestor)) {
|
|
5420
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
5421
|
+
} else {
|
|
5422
|
+
const visualOffsets = getVisualOffsets(element);
|
|
5423
|
+
rect = {
|
|
5424
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
5425
|
+
y: clippingAncestor.y - visualOffsets.y,
|
|
5426
|
+
width: clippingAncestor.width,
|
|
5427
|
+
height: clippingAncestor.height
|
|
5428
|
+
};
|
|
5266
5429
|
}
|
|
5267
|
-
|
|
5268
|
-
state.modifiersData[name] = data;
|
|
5269
|
-
} // eslint-disable-next-line import/no-unused-modules
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
var offset$1 = {
|
|
5273
|
-
name: 'offset',
|
|
5274
|
-
enabled: true,
|
|
5275
|
-
phase: 'main',
|
|
5276
|
-
requires: ['popperOffsets'],
|
|
5277
|
-
fn: offset
|
|
5278
|
-
};
|
|
5279
|
-
|
|
5280
|
-
function popperOffsets(_ref) {
|
|
5281
|
-
var state = _ref.state,
|
|
5282
|
-
name = _ref.name;
|
|
5283
|
-
// Offsets are the actual position the popper needs to have to be
|
|
5284
|
-
// properly positioned near its reference element
|
|
5285
|
-
// This is the most basic placement, and will be adjusted by
|
|
5286
|
-
// the modifiers in the next step
|
|
5287
|
-
state.modifiersData[name] = computeOffsets({
|
|
5288
|
-
reference: state.rects.reference,
|
|
5289
|
-
element: state.rects.popper,
|
|
5290
|
-
placement: state.placement
|
|
5291
|
-
});
|
|
5292
|
-
} // eslint-disable-next-line import/no-unused-modules
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
var popperOffsets$1 = {
|
|
5296
|
-
name: 'popperOffsets',
|
|
5297
|
-
enabled: true,
|
|
5298
|
-
phase: 'read',
|
|
5299
|
-
fn: popperOffsets,
|
|
5300
|
-
data: {}
|
|
5301
|
-
};
|
|
5302
|
-
|
|
5303
|
-
function getAltAxis(axis) {
|
|
5304
|
-
return axis === 'x' ? 'y' : 'x';
|
|
5430
|
+
return rectToClientRect(rect);
|
|
5305
5431
|
}
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
name = _ref.name;
|
|
5311
|
-
var _options$mainAxis = options.mainAxis,
|
|
5312
|
-
checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
|
|
5313
|
-
_options$altAxis = options.altAxis,
|
|
5314
|
-
checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
|
|
5315
|
-
boundary = options.boundary,
|
|
5316
|
-
rootBoundary = options.rootBoundary,
|
|
5317
|
-
altBoundary = options.altBoundary,
|
|
5318
|
-
padding = options.padding,
|
|
5319
|
-
_options$tether = options.tether,
|
|
5320
|
-
tether = _options$tether === void 0 ? true : _options$tether,
|
|
5321
|
-
_options$tetherOffset = options.tetherOffset,
|
|
5322
|
-
tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
|
|
5323
|
-
var overflow = detectOverflow(state, {
|
|
5324
|
-
boundary: boundary,
|
|
5325
|
-
rootBoundary: rootBoundary,
|
|
5326
|
-
padding: padding,
|
|
5327
|
-
altBoundary: altBoundary
|
|
5328
|
-
});
|
|
5329
|
-
var basePlacement = getBasePlacement(state.placement);
|
|
5330
|
-
var variation = getVariation(state.placement);
|
|
5331
|
-
var isBasePlacement = !variation;
|
|
5332
|
-
var mainAxis = getMainAxisFromPlacement(basePlacement);
|
|
5333
|
-
var altAxis = getAltAxis(mainAxis);
|
|
5334
|
-
var popperOffsets = state.modifiersData.popperOffsets;
|
|
5335
|
-
var referenceRect = state.rects.reference;
|
|
5336
|
-
var popperRect = state.rects.popper;
|
|
5337
|
-
var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign(Object.assign({}, state.rects), {}, {
|
|
5338
|
-
placement: state.placement
|
|
5339
|
-
})) : tetherOffset;
|
|
5340
|
-
var data = {
|
|
5341
|
-
x: 0,
|
|
5342
|
-
y: 0
|
|
5343
|
-
};
|
|
5344
|
-
|
|
5345
|
-
if (!popperOffsets) {
|
|
5346
|
-
return;
|
|
5432
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
5433
|
+
const parentNode = getParentNode(element);
|
|
5434
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
5435
|
+
return false;
|
|
5347
5436
|
}
|
|
5437
|
+
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
5438
|
+
}
|
|
5348
5439
|
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
var additive = tether ? -popperRect[len] / 2 : 0;
|
|
5357
|
-
var minLen = variation === start ? referenceRect[len] : popperRect[len];
|
|
5358
|
-
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
|
|
5359
|
-
// outside the reference bounds
|
|
5360
|
-
|
|
5361
|
-
var arrowElement = state.elements.arrow;
|
|
5362
|
-
var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
|
|
5363
|
-
width: 0,
|
|
5364
|
-
height: 0
|
|
5365
|
-
};
|
|
5366
|
-
var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
|
|
5367
|
-
var arrowPaddingMin = arrowPaddingObject[mainSide];
|
|
5368
|
-
var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
|
|
5369
|
-
// to include its full size in the calculation. If the reference is small
|
|
5370
|
-
// and near the edge of a boundary, the popper can overflow even if the
|
|
5371
|
-
// reference is not overflowing as well (e.g. virtual elements with no
|
|
5372
|
-
// width or height)
|
|
5373
|
-
|
|
5374
|
-
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
|
|
5375
|
-
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;
|
|
5376
|
-
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;
|
|
5377
|
-
var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
|
|
5378
|
-
var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
|
|
5379
|
-
var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;
|
|
5380
|
-
var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset;
|
|
5381
|
-
var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue;
|
|
5382
|
-
var preventedOffset = within(tether ? Math.min(min, tetherMin) : min, offset, tether ? Math.max(max, tetherMax) : max);
|
|
5383
|
-
popperOffsets[mainAxis] = preventedOffset;
|
|
5384
|
-
data[mainAxis] = preventedOffset - offset;
|
|
5440
|
+
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
5441
|
+
// clipping (or hiding) child elements. This returns all clipping ancestors
|
|
5442
|
+
// of the given element up the tree.
|
|
5443
|
+
function getClippingElementAncestors(element, cache) {
|
|
5444
|
+
const cachedResult = cache.get(element);
|
|
5445
|
+
if (cachedResult) {
|
|
5446
|
+
return cachedResult;
|
|
5385
5447
|
}
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5448
|
+
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
5449
|
+
let currentContainingBlockComputedStyle = null;
|
|
5450
|
+
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
5451
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
5452
|
+
|
|
5453
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
5454
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
5455
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
5456
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
5457
|
+
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
5458
|
+
currentContainingBlockComputedStyle = null;
|
|
5459
|
+
}
|
|
5460
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
5461
|
+
if (shouldDropCurrentNode) {
|
|
5462
|
+
// Drop non-containing blocks.
|
|
5463
|
+
result = result.filter(ancestor => ancestor !== currentNode);
|
|
5464
|
+
} else {
|
|
5465
|
+
// Record last containing block for next iteration.
|
|
5466
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
5467
|
+
}
|
|
5468
|
+
currentNode = getParentNode(currentNode);
|
|
5402
5469
|
}
|
|
5470
|
+
cache.set(element, result);
|
|
5471
|
+
return result;
|
|
5472
|
+
}
|
|
5403
5473
|
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5474
|
+
// Gets the maximum area that the element is visible in due to any number of
|
|
5475
|
+
// clipping ancestors.
|
|
5476
|
+
function getClippingRect(_ref) {
|
|
5477
|
+
let {
|
|
5478
|
+
element,
|
|
5479
|
+
boundary,
|
|
5480
|
+
rootBoundary,
|
|
5481
|
+
strategy
|
|
5482
|
+
} = _ref;
|
|
5483
|
+
const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
5484
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
5485
|
+
const firstClippingAncestor = clippingAncestors[0];
|
|
5486
|
+
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
5487
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
5488
|
+
accRect.top = max(rect.top, accRect.top);
|
|
5489
|
+
accRect.right = min(rect.right, accRect.right);
|
|
5490
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
5491
|
+
accRect.left = max(rect.left, accRect.left);
|
|
5492
|
+
return accRect;
|
|
5493
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
5417
5494
|
return {
|
|
5418
|
-
|
|
5419
|
-
|
|
5495
|
+
width: clippingRect.right - clippingRect.left,
|
|
5496
|
+
height: clippingRect.bottom - clippingRect.top,
|
|
5497
|
+
x: clippingRect.left,
|
|
5498
|
+
y: clippingRect.top
|
|
5420
5499
|
};
|
|
5421
5500
|
}
|
|
5422
5501
|
|
|
5423
|
-
function
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5502
|
+
function getDimensions(element) {
|
|
5503
|
+
const {
|
|
5504
|
+
width,
|
|
5505
|
+
height
|
|
5506
|
+
} = getCssDimensions(element);
|
|
5507
|
+
return {
|
|
5508
|
+
width,
|
|
5509
|
+
height
|
|
5510
|
+
};
|
|
5429
5511
|
}
|
|
5430
5512
|
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
var documentElement = getDocumentElement(offsetParent);
|
|
5439
|
-
var rect = getBoundingClientRect(elementOrVirtualElement);
|
|
5440
|
-
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
5441
|
-
var scroll = {
|
|
5513
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
5514
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
5515
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
5516
|
+
const isFixed = strategy === 'fixed';
|
|
5517
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
5518
|
+
let scroll = {
|
|
5442
5519
|
scrollLeft: 0,
|
|
5443
5520
|
scrollTop: 0
|
|
5444
5521
|
};
|
|
5445
|
-
|
|
5446
|
-
x: 0,
|
|
5447
|
-
y: 0
|
|
5448
|
-
};
|
|
5522
|
+
const offsets = createCoords(0);
|
|
5449
5523
|
|
|
5524
|
+
// If the <body> scrollbar appears on the left (e.g. RTL systems). Use
|
|
5525
|
+
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
|
|
5526
|
+
function setLeftRTLScrollbarOffset() {
|
|
5527
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
5528
|
+
}
|
|
5450
5529
|
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
5451
|
-
if (getNodeName(offsetParent) !== 'body' ||
|
|
5452
|
-
isScrollParent(documentElement)) {
|
|
5530
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
5453
5531
|
scroll = getNodeScroll(offsetParent);
|
|
5454
5532
|
}
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
offsets =
|
|
5458
|
-
offsets.
|
|
5459
|
-
offsets.y += offsetParent.clientTop;
|
|
5533
|
+
if (isOffsetParentAnElement) {
|
|
5534
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
5535
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
5536
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
5460
5537
|
} else if (documentElement) {
|
|
5461
|
-
|
|
5538
|
+
setLeftRTLScrollbarOffset();
|
|
5462
5539
|
}
|
|
5463
5540
|
}
|
|
5464
|
-
|
|
5541
|
+
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
|
5542
|
+
setLeftRTLScrollbarOffset();
|
|
5543
|
+
}
|
|
5544
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
5545
|
+
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
5546
|
+
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
5465
5547
|
return {
|
|
5466
|
-
x
|
|
5467
|
-
y
|
|
5548
|
+
x,
|
|
5549
|
+
y,
|
|
5468
5550
|
width: rect.width,
|
|
5469
5551
|
height: rect.height
|
|
5470
5552
|
};
|
|
5471
5553
|
}
|
|
5472
5554
|
|
|
5473
|
-
function
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
var result = [];
|
|
5477
|
-
modifiers.forEach(function (modifier) {
|
|
5478
|
-
map.set(modifier.name, modifier);
|
|
5479
|
-
}); // On visiting object, check for its dependencies and visit them recursively
|
|
5480
|
-
|
|
5481
|
-
function sort(modifier) {
|
|
5482
|
-
visited.add(modifier.name);
|
|
5483
|
-
var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
|
|
5484
|
-
requires.forEach(function (dep) {
|
|
5485
|
-
if (!visited.has(dep)) {
|
|
5486
|
-
var depModifier = map.get(dep);
|
|
5555
|
+
function isStaticPositioned(element) {
|
|
5556
|
+
return getComputedStyle$1(element).position === 'static';
|
|
5557
|
+
}
|
|
5487
5558
|
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
}
|
|
5492
|
-
});
|
|
5493
|
-
result.push(modifier);
|
|
5559
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
5560
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
5561
|
+
return null;
|
|
5494
5562
|
}
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5563
|
+
if (polyfill) {
|
|
5564
|
+
return polyfill(element);
|
|
5565
|
+
}
|
|
5566
|
+
let rawOffsetParent = element.offsetParent;
|
|
5567
|
+
|
|
5568
|
+
// Firefox returns the <html> element as the offsetParent if it's non-static,
|
|
5569
|
+
// while Chrome and Safari return the <body> element. The <body> element must
|
|
5570
|
+
// be used to perform the correct calculations even if the <html> element is
|
|
5571
|
+
// non-static.
|
|
5572
|
+
if (getDocumentElement(element) === rawOffsetParent) {
|
|
5573
|
+
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
5574
|
+
}
|
|
5575
|
+
return rawOffsetParent;
|
|
5503
5576
|
}
|
|
5504
5577
|
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
return
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5578
|
+
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
5579
|
+
// such as table ancestors and cross browser bugs.
|
|
5580
|
+
function getOffsetParent(element, polyfill) {
|
|
5581
|
+
const win = getWindow(element);
|
|
5582
|
+
if (isTopLayer(element)) {
|
|
5583
|
+
return win;
|
|
5584
|
+
}
|
|
5585
|
+
if (!isHTMLElement(element)) {
|
|
5586
|
+
let svgOffsetParent = getParentNode(element);
|
|
5587
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
5588
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
5589
|
+
return svgOffsetParent;
|
|
5590
|
+
}
|
|
5591
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
5592
|
+
}
|
|
5593
|
+
return win;
|
|
5594
|
+
}
|
|
5595
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
5596
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
5597
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
5598
|
+
}
|
|
5599
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
5600
|
+
return win;
|
|
5601
|
+
}
|
|
5602
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
5514
5603
|
}
|
|
5515
5604
|
|
|
5516
|
-
function
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5605
|
+
const getElementRects = async function (data) {
|
|
5606
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
5607
|
+
const getDimensionsFn = this.getDimensions;
|
|
5608
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
5609
|
+
return {
|
|
5610
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
5611
|
+
floating: {
|
|
5612
|
+
x: 0,
|
|
5613
|
+
y: 0,
|
|
5614
|
+
width: floatingDimensions.width,
|
|
5615
|
+
height: floatingDimensions.height
|
|
5526
5616
|
}
|
|
5527
|
-
|
|
5528
|
-
return pending;
|
|
5529
5617
|
};
|
|
5530
|
-
}
|
|
5531
|
-
|
|
5532
|
-
function format(str) {
|
|
5533
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
5534
|
-
args[_key - 1] = arguments[_key];
|
|
5535
|
-
}
|
|
5618
|
+
};
|
|
5536
5619
|
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
}, str);
|
|
5620
|
+
function isRTL(element) {
|
|
5621
|
+
return getComputedStyle$1(element).direction === 'rtl';
|
|
5540
5622
|
}
|
|
5541
5623
|
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
if (typeof modifier.enabled !== 'boolean') {
|
|
5558
|
-
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\""));
|
|
5559
|
-
}
|
|
5560
|
-
|
|
5561
|
-
case 'phase':
|
|
5562
|
-
if (modifierPhases.indexOf(modifier.phase) < 0) {
|
|
5563
|
-
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\""));
|
|
5564
|
-
}
|
|
5565
|
-
|
|
5566
|
-
break;
|
|
5567
|
-
|
|
5568
|
-
case 'fn':
|
|
5569
|
-
if (typeof modifier.fn !== 'function') {
|
|
5570
|
-
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\""));
|
|
5571
|
-
}
|
|
5572
|
-
|
|
5573
|
-
break;
|
|
5574
|
-
|
|
5575
|
-
case 'effect':
|
|
5576
|
-
if (typeof modifier.effect !== 'function') {
|
|
5577
|
-
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\""));
|
|
5578
|
-
}
|
|
5579
|
-
|
|
5580
|
-
break;
|
|
5581
|
-
|
|
5582
|
-
case 'requires':
|
|
5583
|
-
if (!Array.isArray(modifier.requires)) {
|
|
5584
|
-
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\""));
|
|
5585
|
-
}
|
|
5586
|
-
|
|
5587
|
-
break;
|
|
5588
|
-
|
|
5589
|
-
case 'requiresIfExists':
|
|
5590
|
-
if (!Array.isArray(modifier.requiresIfExists)) {
|
|
5591
|
-
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\""));
|
|
5592
|
-
}
|
|
5593
|
-
|
|
5594
|
-
break;
|
|
5595
|
-
|
|
5596
|
-
case 'options':
|
|
5597
|
-
case 'data':
|
|
5598
|
-
break;
|
|
5599
|
-
|
|
5600
|
-
default:
|
|
5601
|
-
console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function (s) {
|
|
5602
|
-
return "\"" + s + "\"";
|
|
5603
|
-
}).join(', ') + "; but \"" + key + "\" was provided.");
|
|
5604
|
-
}
|
|
5605
|
-
|
|
5606
|
-
modifier.requires && modifier.requires.forEach(function (requirement) {
|
|
5607
|
-
if (modifiers.find(function (mod) {
|
|
5608
|
-
return mod.name === requirement;
|
|
5609
|
-
}) == null) {
|
|
5610
|
-
console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
|
|
5611
|
-
}
|
|
5612
|
-
});
|
|
5613
|
-
});
|
|
5614
|
-
});
|
|
5624
|
+
const platform = {
|
|
5625
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
5626
|
+
getDocumentElement,
|
|
5627
|
+
getClippingRect,
|
|
5628
|
+
getOffsetParent,
|
|
5629
|
+
getElementRects,
|
|
5630
|
+
getClientRects,
|
|
5631
|
+
getDimensions,
|
|
5632
|
+
getScale,
|
|
5633
|
+
isElement,
|
|
5634
|
+
isRTL
|
|
5635
|
+
};
|
|
5636
|
+
|
|
5637
|
+
function rectsAreEqual(a, b) {
|
|
5638
|
+
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
5615
5639
|
}
|
|
5616
5640
|
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5641
|
+
// https://samthor.au/2021/observing-dom/
|
|
5642
|
+
function observeMove(element, onMove) {
|
|
5643
|
+
let io = null;
|
|
5644
|
+
let timeoutId;
|
|
5645
|
+
const root = getDocumentElement(element);
|
|
5646
|
+
function cleanup() {
|
|
5647
|
+
var _io;
|
|
5648
|
+
clearTimeout(timeoutId);
|
|
5649
|
+
(_io = io) == null || _io.disconnect();
|
|
5650
|
+
io = null;
|
|
5651
|
+
}
|
|
5652
|
+
function refresh(skip, threshold) {
|
|
5653
|
+
if (skip === void 0) {
|
|
5654
|
+
skip = false;
|
|
5655
|
+
}
|
|
5656
|
+
if (threshold === void 0) {
|
|
5657
|
+
threshold = 1;
|
|
5658
|
+
}
|
|
5659
|
+
cleanup();
|
|
5660
|
+
const elementRectForRootMargin = element.getBoundingClientRect();
|
|
5661
|
+
const {
|
|
5662
|
+
left,
|
|
5663
|
+
top,
|
|
5664
|
+
width,
|
|
5665
|
+
height
|
|
5666
|
+
} = elementRectForRootMargin;
|
|
5667
|
+
if (!skip) {
|
|
5668
|
+
onMove();
|
|
5669
|
+
}
|
|
5670
|
+
if (!width || !height) {
|
|
5671
|
+
return;
|
|
5672
|
+
}
|
|
5673
|
+
const insetTop = floor(top);
|
|
5674
|
+
const insetRight = floor(root.clientWidth - (left + width));
|
|
5675
|
+
const insetBottom = floor(root.clientHeight - (top + height));
|
|
5676
|
+
const insetLeft = floor(left);
|
|
5677
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
5678
|
+
const options = {
|
|
5679
|
+
rootMargin,
|
|
5680
|
+
threshold: max(0, min(1, threshold)) || 1
|
|
5681
|
+
};
|
|
5682
|
+
let isFirstUpdate = true;
|
|
5683
|
+
function handleObserve(entries) {
|
|
5684
|
+
const ratio = entries[0].intersectionRatio;
|
|
5685
|
+
if (ratio !== threshold) {
|
|
5686
|
+
if (!isFirstUpdate) {
|
|
5687
|
+
return refresh();
|
|
5688
|
+
}
|
|
5689
|
+
if (!ratio) {
|
|
5690
|
+
// If the reference is clipped, the ratio is 0. Throttle the refresh
|
|
5691
|
+
// to prevent an infinite loop of updates.
|
|
5692
|
+
timeoutId = setTimeout(() => {
|
|
5693
|
+
refresh(false, 1e-7);
|
|
5694
|
+
}, 1000);
|
|
5695
|
+
} else {
|
|
5696
|
+
refresh(false, ratio);
|
|
5697
|
+
}
|
|
5698
|
+
}
|
|
5699
|
+
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
|
5700
|
+
// It's possible that even though the ratio is reported as 1, the
|
|
5701
|
+
// element is not actually fully within the IntersectionObserver's root
|
|
5702
|
+
// area anymore. This can happen under performance constraints. This may
|
|
5703
|
+
// be a bug in the browser's IntersectionObserver implementation. To
|
|
5704
|
+
// work around this, we compare the element's bounding rect now with
|
|
5705
|
+
// what it was at the time we created the IntersectionObserver. If they
|
|
5706
|
+
// are not equal then the element moved, so we refresh.
|
|
5707
|
+
refresh();
|
|
5708
|
+
}
|
|
5709
|
+
isFirstUpdate = false;
|
|
5625
5710
|
}
|
|
5626
|
-
});
|
|
5627
|
-
}
|
|
5628
|
-
|
|
5629
|
-
function mergeByName(modifiers) {
|
|
5630
|
-
var merged = modifiers.reduce(function (merged, current) {
|
|
5631
|
-
var existing = merged[current.name];
|
|
5632
|
-
merged[current.name] = existing ? Object.assign(Object.assign(Object.assign({}, existing), current), {}, {
|
|
5633
|
-
options: Object.assign(Object.assign({}, existing.options), current.options),
|
|
5634
|
-
data: Object.assign(Object.assign({}, existing.data), current.data)
|
|
5635
|
-
}) : current;
|
|
5636
|
-
return merged;
|
|
5637
|
-
}, {}); // IE11 does not support Object.values
|
|
5638
|
-
|
|
5639
|
-
return Object.keys(merged).map(function (key) {
|
|
5640
|
-
return merged[key];
|
|
5641
|
-
});
|
|
5642
|
-
}
|
|
5643
|
-
|
|
5644
|
-
var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
|
|
5645
|
-
var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';
|
|
5646
|
-
var DEFAULT_OPTIONS$1 = {
|
|
5647
|
-
placement: 'bottom',
|
|
5648
|
-
modifiers: [],
|
|
5649
|
-
strategy: 'absolute'
|
|
5650
|
-
};
|
|
5651
5711
|
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5712
|
+
// Older browsers don't support a `document` as the root and will throw an
|
|
5713
|
+
// error.
|
|
5714
|
+
try {
|
|
5715
|
+
io = new IntersectionObserver(handleObserve, {
|
|
5716
|
+
...options,
|
|
5717
|
+
// Handle <iframe>s
|
|
5718
|
+
root: root.ownerDocument
|
|
5719
|
+
});
|
|
5720
|
+
} catch (_e) {
|
|
5721
|
+
io = new IntersectionObserver(handleObserve, options);
|
|
5722
|
+
}
|
|
5723
|
+
io.observe(element);
|
|
5655
5724
|
}
|
|
5656
|
-
|
|
5657
|
-
return
|
|
5658
|
-
return !(element && typeof element.getBoundingClientRect === 'function');
|
|
5659
|
-
});
|
|
5725
|
+
refresh(true);
|
|
5726
|
+
return cleanup;
|
|
5660
5727
|
}
|
|
5661
5728
|
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5729
|
+
/**
|
|
5730
|
+
* Automatically updates the position of the floating element when necessary.
|
|
5731
|
+
* Should only be called when the floating element is mounted on the DOM or
|
|
5732
|
+
* visible on the screen.
|
|
5733
|
+
* @returns cleanup function that should be invoked when the floating element is
|
|
5734
|
+
* removed from the DOM or hidden from the screen.
|
|
5735
|
+
* @see https://floating-ui.com/docs/autoUpdate
|
|
5736
|
+
*/
|
|
5737
|
+
function autoUpdate(reference, floating, update, options) {
|
|
5738
|
+
if (options === void 0) {
|
|
5739
|
+
options = {};
|
|
5665
5740
|
}
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5741
|
+
const {
|
|
5742
|
+
ancestorScroll = true,
|
|
5743
|
+
ancestorResize = true,
|
|
5744
|
+
elementResize = typeof ResizeObserver === 'function',
|
|
5745
|
+
layoutShift = typeof IntersectionObserver === 'function',
|
|
5746
|
+
animationFrame = false
|
|
5747
|
+
} = options;
|
|
5748
|
+
const referenceEl = unwrapElement(reference);
|
|
5749
|
+
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
|
|
5750
|
+
ancestors.forEach(ancestor => {
|
|
5751
|
+
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
|
5752
|
+
passive: true
|
|
5753
|
+
});
|
|
5754
|
+
ancestorResize && ancestor.addEventListener('resize', update);
|
|
5755
|
+
});
|
|
5756
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
5757
|
+
let reobserveFrame = -1;
|
|
5758
|
+
let resizeObserver = null;
|
|
5759
|
+
if (elementResize) {
|
|
5760
|
+
resizeObserver = new ResizeObserver(_ref => {
|
|
5761
|
+
let [firstEntry] = _ref;
|
|
5762
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
5763
|
+
// Prevent update loops when using the `size` middleware.
|
|
5764
|
+
// https://github.com/floating-ui/floating-ui/issues/1740
|
|
5765
|
+
resizeObserver.unobserve(floating);
|
|
5766
|
+
cancelAnimationFrame(reobserveFrame);
|
|
5767
|
+
reobserveFrame = requestAnimationFrame(() => {
|
|
5768
|
+
var _resizeObserver;
|
|
5769
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
5770
|
+
});
|
|
5771
|
+
}
|
|
5772
|
+
update();
|
|
5773
|
+
});
|
|
5774
|
+
if (referenceEl && !animationFrame) {
|
|
5775
|
+
resizeObserver.observe(referenceEl);
|
|
5675
5776
|
}
|
|
5777
|
+
resizeObserver.observe(floating);
|
|
5778
|
+
}
|
|
5779
|
+
let frameId;
|
|
5780
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
5781
|
+
if (animationFrame) {
|
|
5782
|
+
frameLoop();
|
|
5783
|
+
}
|
|
5784
|
+
function frameLoop() {
|
|
5785
|
+
const nextRefRect = getBoundingClientRect(reference);
|
|
5786
|
+
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
|
5787
|
+
update();
|
|
5788
|
+
}
|
|
5789
|
+
prevRefRect = nextRefRect;
|
|
5790
|
+
frameId = requestAnimationFrame(frameLoop);
|
|
5791
|
+
}
|
|
5792
|
+
update();
|
|
5793
|
+
return () => {
|
|
5794
|
+
var _resizeObserver2;
|
|
5795
|
+
ancestors.forEach(ancestor => {
|
|
5796
|
+
ancestorScroll && ancestor.removeEventListener('scroll', update);
|
|
5797
|
+
ancestorResize && ancestor.removeEventListener('resize', update);
|
|
5798
|
+
});
|
|
5799
|
+
cleanupIo == null || cleanupIo();
|
|
5800
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
5801
|
+
resizeObserver = null;
|
|
5802
|
+
if (animationFrame) {
|
|
5803
|
+
cancelAnimationFrame(frameId);
|
|
5804
|
+
}
|
|
5805
|
+
};
|
|
5806
|
+
}
|
|
5676
5807
|
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
},
|
|
5686
|
-
attributes: {},
|
|
5687
|
-
styles: {}
|
|
5688
|
-
};
|
|
5689
|
-
var effectCleanupFns = [];
|
|
5690
|
-
var isDestroyed = false;
|
|
5691
|
-
var instance = {
|
|
5692
|
-
state: state,
|
|
5693
|
-
setOptions: function setOptions(options) {
|
|
5694
|
-
cleanupModifierEffects();
|
|
5695
|
-
state.options = Object.assign(Object.assign(Object.assign({}, defaultOptions), state.options), options);
|
|
5696
|
-
state.scrollParents = {
|
|
5697
|
-
reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
|
|
5698
|
-
popper: listScrollParents(popper)
|
|
5699
|
-
}; // Orders the modifiers based on their dependencies and `phase`
|
|
5700
|
-
// properties
|
|
5701
|
-
|
|
5702
|
-
var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
|
|
5703
|
-
|
|
5704
|
-
state.orderedModifiers = orderedModifiers.filter(function (m) {
|
|
5705
|
-
return m.enabled;
|
|
5706
|
-
}); // Validate the provided modifiers so that the consumer will get warned
|
|
5707
|
-
// if one of the modifiers is invalid for any reason
|
|
5708
|
-
|
|
5709
|
-
if (process.env.NODE_ENV !== "production") {
|
|
5710
|
-
var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {
|
|
5711
|
-
var name = _ref.name;
|
|
5712
|
-
return name;
|
|
5713
|
-
});
|
|
5714
|
-
validateModifiers(modifiers);
|
|
5715
|
-
|
|
5716
|
-
if (getBasePlacement(state.options.placement) === auto) {
|
|
5717
|
-
var flipModifier = state.orderedModifiers.find(function (_ref2) {
|
|
5718
|
-
var name = _ref2.name;
|
|
5719
|
-
return name === 'flip';
|
|
5720
|
-
});
|
|
5721
|
-
|
|
5722
|
-
if (!flipModifier) {
|
|
5723
|
-
console.error(['Popper: "auto" placements require the "flip" modifier be', 'present and enabled to work.'].join(' '));
|
|
5724
|
-
}
|
|
5725
|
-
}
|
|
5726
|
-
|
|
5727
|
-
var _getComputedStyle = getComputedStyle(popper),
|
|
5728
|
-
marginTop = _getComputedStyle.marginTop,
|
|
5729
|
-
marginRight = _getComputedStyle.marginRight,
|
|
5730
|
-
marginBottom = _getComputedStyle.marginBottom,
|
|
5731
|
-
marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can
|
|
5732
|
-
// cause bugs with positioning, so we'll warn the consumer
|
|
5733
|
-
|
|
5808
|
+
/**
|
|
5809
|
+
* Modifies the placement by translating the floating element along the
|
|
5810
|
+
* specified axes.
|
|
5811
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
5812
|
+
* object may be passed.
|
|
5813
|
+
* @see https://floating-ui.com/docs/offset
|
|
5814
|
+
*/
|
|
5815
|
+
const offset$1 = offset$2;
|
|
5734
5816
|
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5817
|
+
/**
|
|
5818
|
+
* Optimizes the visibility of the floating element by choosing the placement
|
|
5819
|
+
* that has the most space available automatically, without needing to specify a
|
|
5820
|
+
* preferred placement. Alternative to `flip`.
|
|
5821
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
5822
|
+
*/
|
|
5823
|
+
const autoPlacement$1 = autoPlacement$2;
|
|
5741
5824
|
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
// For high frequency updates (e.g. `resize` and `scroll` events), always
|
|
5749
|
-
// prefer the async Popper#update method
|
|
5750
|
-
forceUpdate: function forceUpdate() {
|
|
5751
|
-
if (isDestroyed) {
|
|
5752
|
-
return;
|
|
5753
|
-
}
|
|
5825
|
+
/**
|
|
5826
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
5827
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
5828
|
+
* @see https://floating-ui.com/docs/shift
|
|
5829
|
+
*/
|
|
5830
|
+
const shift$1 = shift$2;
|
|
5754
5831
|
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5832
|
+
/**
|
|
5833
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
5834
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
5835
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
5836
|
+
* @see https://floating-ui.com/docs/flip
|
|
5837
|
+
*/
|
|
5838
|
+
const flip$1 = flip$2;
|
|
5759
5839
|
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5840
|
+
/**
|
|
5841
|
+
* Provides data that allows you to change the size of the floating element —
|
|
5842
|
+
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
5843
|
+
* width of the reference element.
|
|
5844
|
+
* @see https://floating-ui.com/docs/size
|
|
5845
|
+
*/
|
|
5846
|
+
const size$1 = size$2;
|
|
5764
5847
|
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
popper: getLayoutRect(popper)
|
|
5772
|
-
}; // Modifiers have the ability to reset the current update cycle. The
|
|
5773
|
-
// most common use case for this is the `flip` modifier changing the
|
|
5774
|
-
// placement, which then needs to re-run all the modifiers, because the
|
|
5775
|
-
// logic was previously ran for the previous placement and is therefore
|
|
5776
|
-
// stale/incorrect
|
|
5777
|
-
|
|
5778
|
-
state.reset = false;
|
|
5779
|
-
state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
|
|
5780
|
-
// is filled with the initial data specified by the modifier. This means
|
|
5781
|
-
// it doesn't persist and is fresh on each update.
|
|
5782
|
-
// To ensure persistent data, use `${name}#persistent`
|
|
5783
|
-
|
|
5784
|
-
state.orderedModifiers.forEach(function (modifier) {
|
|
5785
|
-
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
|
5786
|
-
});
|
|
5787
|
-
var __debug_loops__ = 0;
|
|
5848
|
+
/**
|
|
5849
|
+
* Provides data to position an inner element of the floating element so that it
|
|
5850
|
+
* appears centered to the reference element.
|
|
5851
|
+
* @see https://floating-ui.com/docs/arrow
|
|
5852
|
+
*/
|
|
5853
|
+
const arrow$2 = arrow$3;
|
|
5788
5854
|
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5855
|
+
/**
|
|
5856
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
5857
|
+
* next to a given reference element.
|
|
5858
|
+
*/
|
|
5859
|
+
const computePosition = (reference, floating, options) => {
|
|
5860
|
+
// This caches the expensive `getClippingElementAncestors` function so that
|
|
5861
|
+
// multiple lifecycle resets re-use the same result. It only lives for a
|
|
5862
|
+
// single call. If other functions become expensive, we can add them as well.
|
|
5863
|
+
const cache = new Map();
|
|
5864
|
+
const mergedOptions = {
|
|
5865
|
+
platform,
|
|
5866
|
+
...options
|
|
5867
|
+
};
|
|
5868
|
+
const platformWithCache = {
|
|
5869
|
+
...mergedOptions.platform,
|
|
5870
|
+
_c: cache
|
|
5871
|
+
};
|
|
5872
|
+
return computePosition$1(reference, floating, {
|
|
5873
|
+
...mergedOptions,
|
|
5874
|
+
platform: platformWithCache
|
|
5875
|
+
});
|
|
5876
|
+
};
|
|
5792
5877
|
|
|
5793
|
-
|
|
5794
|
-
console.error(INFINITE_LOOP_ERROR);
|
|
5795
|
-
break;
|
|
5796
|
-
}
|
|
5797
|
-
}
|
|
5878
|
+
var isClient = typeof document !== 'undefined';
|
|
5798
5879
|
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
index = -1;
|
|
5802
|
-
continue;
|
|
5803
|
-
}
|
|
5880
|
+
var noop = function noop() {};
|
|
5881
|
+
var index = isClient ? useLayoutEffect : noop;
|
|
5804
5882
|
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5883
|
+
// Fork of `fast-deep-equal` that only does the comparisons we need and compares
|
|
5884
|
+
// functions
|
|
5885
|
+
function deepEqual(a, b) {
|
|
5886
|
+
if (a === b) {
|
|
5887
|
+
return true;
|
|
5888
|
+
}
|
|
5889
|
+
if (typeof a !== typeof b) {
|
|
5890
|
+
return false;
|
|
5891
|
+
}
|
|
5892
|
+
if (typeof a === 'function' && a.toString() === b.toString()) {
|
|
5893
|
+
return true;
|
|
5894
|
+
}
|
|
5895
|
+
let length;
|
|
5896
|
+
let i;
|
|
5897
|
+
let keys;
|
|
5898
|
+
if (a && b && typeof a === 'object') {
|
|
5899
|
+
if (Array.isArray(a)) {
|
|
5900
|
+
length = a.length;
|
|
5901
|
+
if (length !== b.length) return false;
|
|
5902
|
+
for (i = length; i-- !== 0;) {
|
|
5903
|
+
if (!deepEqual(a[i], b[i])) {
|
|
5904
|
+
return false;
|
|
5819
5905
|
}
|
|
5820
|
-
},
|
|
5821
|
-
// Async and optimistically optimized update – it will not be executed if
|
|
5822
|
-
// not necessary (debounced to run at most once-per-tick)
|
|
5823
|
-
update: debounce(function () {
|
|
5824
|
-
return new Promise(function (resolve) {
|
|
5825
|
-
instance.forceUpdate();
|
|
5826
|
-
resolve(state);
|
|
5827
|
-
});
|
|
5828
|
-
}),
|
|
5829
|
-
destroy: function destroy() {
|
|
5830
|
-
cleanupModifierEffects();
|
|
5831
|
-
isDestroyed = true;
|
|
5832
5906
|
}
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5907
|
+
return true;
|
|
5908
|
+
}
|
|
5909
|
+
keys = Object.keys(a);
|
|
5910
|
+
length = keys.length;
|
|
5911
|
+
if (length !== Object.keys(b).length) {
|
|
5912
|
+
return false;
|
|
5913
|
+
}
|
|
5914
|
+
for (i = length; i-- !== 0;) {
|
|
5915
|
+
if (!{}.hasOwnProperty.call(b, keys[i])) {
|
|
5916
|
+
return false;
|
|
5838
5917
|
}
|
|
5839
|
-
|
|
5840
|
-
return instance;
|
|
5841
5918
|
}
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
if (
|
|
5845
|
-
|
|
5919
|
+
for (i = length; i-- !== 0;) {
|
|
5920
|
+
const key = keys[i];
|
|
5921
|
+
if (key === '_owner' && a.$$typeof) {
|
|
5922
|
+
continue;
|
|
5923
|
+
}
|
|
5924
|
+
if (!deepEqual(a[key], b[key])) {
|
|
5925
|
+
return false;
|
|
5846
5926
|
}
|
|
5847
|
-
}); // Modifiers have the ability to execute arbitrary code before the first
|
|
5848
|
-
// update cycle runs. They will be executed in the same order as the update
|
|
5849
|
-
// cycle. This is useful when a modifier adds some persistent data that
|
|
5850
|
-
// other modifiers need to use, but the modifier is run after the dependent
|
|
5851
|
-
// one.
|
|
5852
|
-
|
|
5853
|
-
function runModifierEffects() {
|
|
5854
|
-
state.orderedModifiers.forEach(function (_ref3) {
|
|
5855
|
-
var name = _ref3.name,
|
|
5856
|
-
_ref3$options = _ref3.options,
|
|
5857
|
-
options = _ref3$options === void 0 ? {} : _ref3$options,
|
|
5858
|
-
effect = _ref3.effect;
|
|
5859
|
-
|
|
5860
|
-
if (typeof effect === 'function') {
|
|
5861
|
-
var cleanupFn = effect({
|
|
5862
|
-
state: state,
|
|
5863
|
-
name: name,
|
|
5864
|
-
instance: instance,
|
|
5865
|
-
options: options
|
|
5866
|
-
});
|
|
5867
|
-
|
|
5868
|
-
var noopFn = function noopFn() {};
|
|
5869
|
-
|
|
5870
|
-
effectCleanupFns.push(cleanupFn || noopFn);
|
|
5871
|
-
}
|
|
5872
|
-
});
|
|
5873
5927
|
}
|
|
5928
|
+
return true;
|
|
5929
|
+
}
|
|
5930
|
+
return a !== a && b !== b;
|
|
5931
|
+
}
|
|
5874
5932
|
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5933
|
+
function getDPR(element) {
|
|
5934
|
+
if (typeof window === 'undefined') {
|
|
5935
|
+
return 1;
|
|
5936
|
+
}
|
|
5937
|
+
const win = element.ownerDocument.defaultView || window;
|
|
5938
|
+
return win.devicePixelRatio || 1;
|
|
5939
|
+
}
|
|
5881
5940
|
|
|
5882
|
-
|
|
5883
|
-
|
|
5941
|
+
function roundByDPR(element, value) {
|
|
5942
|
+
const dpr = getDPR(element);
|
|
5943
|
+
return Math.round(value * dpr) / dpr;
|
|
5944
|
+
}
|
|
5945
|
+
|
|
5946
|
+
function useLatestRef(value) {
|
|
5947
|
+
const ref = React.useRef(value);
|
|
5948
|
+
index(() => {
|
|
5949
|
+
ref.current = value;
|
|
5950
|
+
});
|
|
5951
|
+
return ref;
|
|
5884
5952
|
}
|
|
5885
5953
|
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
5891
|
-
/**
|
|
5892
|
-
* Simple ponyfill for Object.fromEntries
|
|
5893
|
-
*/
|
|
5894
|
-
|
|
5895
|
-
var fromEntries = function fromEntries(entries) {
|
|
5896
|
-
return entries.reduce(function (acc, _ref) {
|
|
5897
|
-
var key = _ref[0],
|
|
5898
|
-
value = _ref[1];
|
|
5899
|
-
acc[key] = value;
|
|
5900
|
-
return acc;
|
|
5901
|
-
}, {});
|
|
5902
|
-
};
|
|
5903
|
-
/**
|
|
5904
|
-
* Small wrapper around `useLayoutEffect` to get rid of the warning on SSR envs
|
|
5905
|
-
*/
|
|
5906
|
-
|
|
5907
|
-
var useIsomorphicLayoutEffect = typeof window !== 'undefined' && window.document && window.document.createElement ? React.useLayoutEffect : React.useEffect;
|
|
5908
|
-
|
|
5909
|
-
/* global Map:readonly, Set:readonly, ArrayBuffer:readonly */
|
|
5910
|
-
|
|
5911
|
-
var reactFastCompare;
|
|
5912
|
-
var hasRequiredReactFastCompare;
|
|
5913
|
-
|
|
5914
|
-
function requireReactFastCompare () {
|
|
5915
|
-
if (hasRequiredReactFastCompare) return reactFastCompare;
|
|
5916
|
-
hasRequiredReactFastCompare = 1;
|
|
5917
|
-
var hasElementType = typeof Element !== 'undefined';
|
|
5918
|
-
var hasMap = typeof Map === 'function';
|
|
5919
|
-
var hasSet = typeof Set === 'function';
|
|
5920
|
-
var hasArrayBuffer = typeof ArrayBuffer === 'function' && !!ArrayBuffer.isView;
|
|
5921
|
-
|
|
5922
|
-
// Note: We **don't** need `envHasBigInt64Array` in fde es6/index.js
|
|
5923
|
-
|
|
5924
|
-
function equal(a, b) {
|
|
5925
|
-
// START: fast-deep-equal es6/index.js 3.1.1
|
|
5926
|
-
if (a === b) return true;
|
|
5927
|
-
|
|
5928
|
-
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
|
5929
|
-
if (a.constructor !== b.constructor) return false;
|
|
5930
|
-
|
|
5931
|
-
var length, i, keys;
|
|
5932
|
-
if (Array.isArray(a)) {
|
|
5933
|
-
length = a.length;
|
|
5934
|
-
if (length != b.length) return false;
|
|
5935
|
-
for (i = length; i-- !== 0;)
|
|
5936
|
-
if (!equal(a[i], b[i])) return false;
|
|
5937
|
-
return true;
|
|
5938
|
-
}
|
|
5939
|
-
|
|
5940
|
-
// START: Modifications:
|
|
5941
|
-
// 1. Extra `has<Type> &&` helpers in initial condition allow es6 code
|
|
5942
|
-
// to co-exist with es5.
|
|
5943
|
-
// 2. Replace `for of` with es5 compliant iteration using `for`.
|
|
5944
|
-
// Basically, take:
|
|
5945
|
-
//
|
|
5946
|
-
// ```js
|
|
5947
|
-
// for (i of a.entries())
|
|
5948
|
-
// if (!b.has(i[0])) return false;
|
|
5949
|
-
// ```
|
|
5950
|
-
//
|
|
5951
|
-
// ... and convert to:
|
|
5952
|
-
//
|
|
5953
|
-
// ```js
|
|
5954
|
-
// it = a.entries();
|
|
5955
|
-
// while (!(i = it.next()).done)
|
|
5956
|
-
// if (!b.has(i.value[0])) return false;
|
|
5957
|
-
// ```
|
|
5958
|
-
//
|
|
5959
|
-
// **Note**: `i` access switches to `i.value`.
|
|
5960
|
-
var it;
|
|
5961
|
-
if (hasMap && (a instanceof Map) && (b instanceof Map)) {
|
|
5962
|
-
if (a.size !== b.size) return false;
|
|
5963
|
-
it = a.entries();
|
|
5964
|
-
while (!(i = it.next()).done)
|
|
5965
|
-
if (!b.has(i.value[0])) return false;
|
|
5966
|
-
it = a.entries();
|
|
5967
|
-
while (!(i = it.next()).done)
|
|
5968
|
-
if (!equal(i.value[1], b.get(i.value[0]))) return false;
|
|
5969
|
-
return true;
|
|
5970
|
-
}
|
|
5971
|
-
|
|
5972
|
-
if (hasSet && (a instanceof Set) && (b instanceof Set)) {
|
|
5973
|
-
if (a.size !== b.size) return false;
|
|
5974
|
-
it = a.entries();
|
|
5975
|
-
while (!(i = it.next()).done)
|
|
5976
|
-
if (!b.has(i.value[0])) return false;
|
|
5977
|
-
return true;
|
|
5978
|
-
}
|
|
5979
|
-
// END: Modifications
|
|
5980
|
-
|
|
5981
|
-
if (hasArrayBuffer && ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
|
|
5982
|
-
length = a.length;
|
|
5983
|
-
if (length != b.length) return false;
|
|
5984
|
-
for (i = length; i-- !== 0;)
|
|
5985
|
-
if (a[i] !== b[i]) return false;
|
|
5986
|
-
return true;
|
|
5987
|
-
}
|
|
5988
|
-
|
|
5989
|
-
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
5990
|
-
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
5991
|
-
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
5992
|
-
|
|
5993
|
-
keys = Object.keys(a);
|
|
5994
|
-
length = keys.length;
|
|
5995
|
-
if (length !== Object.keys(b).length) return false;
|
|
5996
|
-
|
|
5997
|
-
for (i = length; i-- !== 0;)
|
|
5998
|
-
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
5999
|
-
// END: fast-deep-equal
|
|
6000
|
-
|
|
6001
|
-
// START: react-fast-compare
|
|
6002
|
-
// custom handling for DOM elements
|
|
6003
|
-
if (hasElementType && a instanceof Element) return false;
|
|
6004
|
-
|
|
6005
|
-
// custom handling for React/Preact
|
|
6006
|
-
for (i = length; i-- !== 0;) {
|
|
6007
|
-
if ((keys[i] === '_owner' || keys[i] === '__v' || keys[i] === '__o') && a.$$typeof) {
|
|
6008
|
-
// React-specific: avoid traversing React elements' _owner
|
|
6009
|
-
// Preact-specific: avoid traversing Preact elements' __v and __o
|
|
6010
|
-
// __v = $_original / $_vnode
|
|
6011
|
-
// __o = $_owner
|
|
6012
|
-
// These properties contain circular references and are not needed when
|
|
6013
|
-
// comparing the actual elements (and not their owners)
|
|
6014
|
-
// .$$typeof and ._store on just reasonable markers of elements
|
|
6015
|
-
|
|
6016
|
-
continue;
|
|
6017
|
-
}
|
|
6018
|
-
|
|
6019
|
-
// all other properties should be traversed as usual
|
|
6020
|
-
if (!equal(a[keys[i]], b[keys[i]])) return false;
|
|
6021
|
-
}
|
|
6022
|
-
// END: react-fast-compare
|
|
6023
|
-
|
|
6024
|
-
// START: fast-deep-equal
|
|
6025
|
-
return true;
|
|
6026
|
-
}
|
|
6027
|
-
|
|
6028
|
-
return a !== a && b !== b;
|
|
6029
|
-
}
|
|
6030
|
-
// end fast-deep-equal
|
|
6031
|
-
|
|
6032
|
-
reactFastCompare = function isEqual(a, b) {
|
|
6033
|
-
try {
|
|
6034
|
-
return equal(a, b);
|
|
6035
|
-
} catch (error) {
|
|
6036
|
-
if (((error.message || '').match(/stack|recursion/i))) {
|
|
6037
|
-
// warn on circular references, don't crash
|
|
6038
|
-
// browsers give this different errors name and messages:
|
|
6039
|
-
// chrome/safari: "RangeError", "Maximum call stack size exceeded"
|
|
6040
|
-
// firefox: "InternalError", too much recursion"
|
|
6041
|
-
// edge: "Error", "Out of stack space"
|
|
6042
|
-
console.warn('react-fast-compare cannot handle circular refs');
|
|
6043
|
-
return false;
|
|
6044
|
-
}
|
|
6045
|
-
// some other error. we should definitely know about these
|
|
6046
|
-
throw error;
|
|
6047
|
-
}
|
|
6048
|
-
};
|
|
6049
|
-
return reactFastCompare;
|
|
6050
|
-
}
|
|
6051
|
-
|
|
6052
|
-
var reactFastCompareExports = requireReactFastCompare();
|
|
6053
|
-
var isEqual$1 = /*@__PURE__*/getDefaultExportFromCjs(reactFastCompareExports);
|
|
6054
|
-
|
|
6055
|
-
var EMPTY_MODIFIERS = [];
|
|
6056
|
-
var usePopper$1 = function usePopper(referenceElement, popperElement, options) {
|
|
5954
|
+
/**
|
|
5955
|
+
* Provides data to position a floating element.
|
|
5956
|
+
* @see https://floating-ui.com/docs/useFloating
|
|
5957
|
+
*/
|
|
5958
|
+
function useFloating(options) {
|
|
6057
5959
|
if (options === void 0) {
|
|
6058
5960
|
options = {};
|
|
6059
5961
|
}
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
5962
|
+
const {
|
|
5963
|
+
placement = 'bottom',
|
|
5964
|
+
strategy = 'absolute',
|
|
5965
|
+
middleware = [],
|
|
5966
|
+
platform,
|
|
5967
|
+
elements: {
|
|
5968
|
+
reference: externalReference,
|
|
5969
|
+
floating: externalFloating
|
|
5970
|
+
} = {},
|
|
5971
|
+
transform = true,
|
|
5972
|
+
whileElementsMounted,
|
|
5973
|
+
open
|
|
5974
|
+
} = options;
|
|
5975
|
+
const [data, setData] = React.useState({
|
|
5976
|
+
x: 0,
|
|
5977
|
+
y: 0,
|
|
5978
|
+
strategy,
|
|
5979
|
+
placement,
|
|
5980
|
+
middlewareData: {},
|
|
5981
|
+
isPositioned: false
|
|
5982
|
+
});
|
|
5983
|
+
const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);
|
|
5984
|
+
if (!deepEqual(latestMiddleware, middleware)) {
|
|
5985
|
+
setLatestMiddleware(middleware);
|
|
5986
|
+
}
|
|
5987
|
+
const [_reference, _setReference] = React.useState(null);
|
|
5988
|
+
const [_floating, _setFloating] = React.useState(null);
|
|
5989
|
+
const setReference = React.useCallback(node => {
|
|
5990
|
+
if (node !== referenceRef.current) {
|
|
5991
|
+
referenceRef.current = node;
|
|
5992
|
+
_setReference(node);
|
|
5993
|
+
}
|
|
5994
|
+
}, []);
|
|
5995
|
+
const setFloating = React.useCallback(node => {
|
|
5996
|
+
if (node !== floatingRef.current) {
|
|
5997
|
+
floatingRef.current = node;
|
|
5998
|
+
_setFloating(node);
|
|
5999
|
+
}
|
|
6000
|
+
}, []);
|
|
6001
|
+
const referenceEl = externalReference || _reference;
|
|
6002
|
+
const floatingEl = externalFloating || _floating;
|
|
6003
|
+
const referenceRef = React.useRef(null);
|
|
6004
|
+
const floatingRef = React.useRef(null);
|
|
6005
|
+
const dataRef = React.useRef(data);
|
|
6006
|
+
const hasWhileElementsMounted = whileElementsMounted != null;
|
|
6007
|
+
const whileElementsMountedRef = useLatestRef(whileElementsMounted);
|
|
6008
|
+
const platformRef = useLatestRef(platform);
|
|
6009
|
+
const openRef = useLatestRef(open);
|
|
6010
|
+
const update = React.useCallback(() => {
|
|
6011
|
+
if (!referenceRef.current || !floatingRef.current) {
|
|
6012
|
+
return;
|
|
6013
|
+
}
|
|
6014
|
+
const config = {
|
|
6015
|
+
placement,
|
|
6016
|
+
strategy,
|
|
6017
|
+
middleware: latestMiddleware
|
|
6018
|
+
};
|
|
6019
|
+
if (platformRef.current) {
|
|
6020
|
+
config.platform = platformRef.current;
|
|
6021
|
+
}
|
|
6022
|
+
computePosition(referenceRef.current, floatingRef.current, config).then(data => {
|
|
6023
|
+
const fullData = {
|
|
6024
|
+
...data,
|
|
6025
|
+
// The floating element's position may be recomputed while it's closed
|
|
6026
|
+
// but still mounted (such as when transitioning out). To ensure
|
|
6027
|
+
// `isPositioned` will be `false` initially on the next open, avoid
|
|
6028
|
+
// setting it to `true` when `open === false` (must be specified).
|
|
6029
|
+
isPositioned: openRef.current !== false
|
|
6030
|
+
};
|
|
6031
|
+
if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
|
|
6032
|
+
dataRef.current = fullData;
|
|
6033
|
+
ReactDOM.flushSync(() => {
|
|
6034
|
+
setData(fullData);
|
|
6097
6035
|
});
|
|
6098
|
-
}
|
|
6099
|
-
|
|
6036
|
+
}
|
|
6037
|
+
});
|
|
6038
|
+
}, [latestMiddleware, placement, strategy, platformRef, openRef]);
|
|
6039
|
+
index(() => {
|
|
6040
|
+
if (open === false && dataRef.current.isPositioned) {
|
|
6041
|
+
dataRef.current.isPositioned = false;
|
|
6042
|
+
setData(data => ({
|
|
6043
|
+
...data,
|
|
6044
|
+
isPositioned: false
|
|
6045
|
+
}));
|
|
6046
|
+
}
|
|
6047
|
+
}, [open]);
|
|
6048
|
+
const isMountedRef = React.useRef(false);
|
|
6049
|
+
index(() => {
|
|
6050
|
+
isMountedRef.current = true;
|
|
6051
|
+
return () => {
|
|
6052
|
+
isMountedRef.current = false;
|
|
6100
6053
|
};
|
|
6101
6054
|
}, []);
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6055
|
+
index(() => {
|
|
6056
|
+
if (referenceEl) referenceRef.current = referenceEl;
|
|
6057
|
+
if (floatingEl) floatingRef.current = floatingEl;
|
|
6058
|
+
if (referenceEl && floatingEl) {
|
|
6059
|
+
if (whileElementsMountedRef.current) {
|
|
6060
|
+
return whileElementsMountedRef.current(referenceEl, floatingEl, update);
|
|
6061
|
+
}
|
|
6062
|
+
update();
|
|
6063
|
+
}
|
|
6064
|
+
}, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
|
|
6065
|
+
const refs = React.useMemo(() => ({
|
|
6066
|
+
reference: referenceRef,
|
|
6067
|
+
floating: floatingRef,
|
|
6068
|
+
setReference,
|
|
6069
|
+
setFloating
|
|
6070
|
+
}), [setReference, setFloating]);
|
|
6071
|
+
const elements = React.useMemo(() => ({
|
|
6072
|
+
reference: referenceEl,
|
|
6073
|
+
floating: floatingEl
|
|
6074
|
+
}), [referenceEl, floatingEl]);
|
|
6075
|
+
const floatingStyles = React.useMemo(() => {
|
|
6076
|
+
const initialStyles = {
|
|
6077
|
+
position: strategy,
|
|
6078
|
+
left: 0,
|
|
6079
|
+
top: 0
|
|
6111
6080
|
};
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
return prevOptions.current || newOptions;
|
|
6115
|
-
} else {
|
|
6116
|
-
prevOptions.current = newOptions;
|
|
6117
|
-
return newOptions;
|
|
6118
|
-
}
|
|
6119
|
-
}, [optionsWithDefaults.onFirstUpdate, optionsWithDefaults.placement, optionsWithDefaults.strategy, optionsWithDefaults.modifiers, updateStateModifier]);
|
|
6120
|
-
var popperInstanceRef = React.useRef();
|
|
6121
|
-
useIsomorphicLayoutEffect(function () {
|
|
6122
|
-
if (popperInstanceRef.current) {
|
|
6123
|
-
popperInstanceRef.current.setOptions(popperOptions);
|
|
6124
|
-
}
|
|
6125
|
-
}, [popperOptions]);
|
|
6126
|
-
useIsomorphicLayoutEffect(function () {
|
|
6127
|
-
if (referenceElement == null || popperElement == null) {
|
|
6128
|
-
return;
|
|
6081
|
+
if (!elements.floating) {
|
|
6082
|
+
return initialStyles;
|
|
6129
6083
|
}
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6084
|
+
const x = roundByDPR(elements.floating, data.x);
|
|
6085
|
+
const y = roundByDPR(elements.floating, data.y);
|
|
6086
|
+
if (transform) {
|
|
6087
|
+
return {
|
|
6088
|
+
...initialStyles,
|
|
6089
|
+
transform: "translate(" + x + "px, " + y + "px)",
|
|
6090
|
+
...(getDPR(elements.floating) >= 1.5 && {
|
|
6091
|
+
willChange: 'transform'
|
|
6092
|
+
})
|
|
6093
|
+
};
|
|
6094
|
+
}
|
|
6095
|
+
return {
|
|
6096
|
+
position: strategy,
|
|
6097
|
+
left: x,
|
|
6098
|
+
top: y
|
|
6137
6099
|
};
|
|
6138
|
-
}, [
|
|
6100
|
+
}, [strategy, transform, elements.floating, data.x, data.y]);
|
|
6101
|
+
return React.useMemo(() => ({
|
|
6102
|
+
...data,
|
|
6103
|
+
update,
|
|
6104
|
+
refs,
|
|
6105
|
+
elements,
|
|
6106
|
+
floatingStyles
|
|
6107
|
+
}), [data, update, refs, elements, floatingStyles]);
|
|
6108
|
+
}
|
|
6109
|
+
|
|
6110
|
+
/**
|
|
6111
|
+
* Provides data to position an inner element of the floating element so that it
|
|
6112
|
+
* appears centered to the reference element.
|
|
6113
|
+
* This wraps the core `arrow` middleware to allow React refs as the element.
|
|
6114
|
+
* @see https://floating-ui.com/docs/arrow
|
|
6115
|
+
*/
|
|
6116
|
+
const arrow$1 = options => {
|
|
6117
|
+
function isRef(value) {
|
|
6118
|
+
return {}.hasOwnProperty.call(value, 'current');
|
|
6119
|
+
}
|
|
6139
6120
|
return {
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6121
|
+
name: 'arrow',
|
|
6122
|
+
options,
|
|
6123
|
+
fn(state) {
|
|
6124
|
+
const {
|
|
6125
|
+
element,
|
|
6126
|
+
padding
|
|
6127
|
+
} = typeof options === 'function' ? options(state) : options;
|
|
6128
|
+
if (element && isRef(element)) {
|
|
6129
|
+
if (element.current != null) {
|
|
6130
|
+
return arrow$2({
|
|
6131
|
+
element: element.current,
|
|
6132
|
+
padding
|
|
6133
|
+
}).fn(state);
|
|
6134
|
+
}
|
|
6135
|
+
return {};
|
|
6136
|
+
}
|
|
6137
|
+
if (element) {
|
|
6138
|
+
return arrow$2({
|
|
6139
|
+
element,
|
|
6140
|
+
padding
|
|
6141
|
+
}).fn(state);
|
|
6142
|
+
}
|
|
6143
|
+
return {};
|
|
6144
|
+
}
|
|
6145
6145
|
};
|
|
6146
6146
|
};
|
|
6147
6147
|
|
|
6148
|
-
/**
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6148
|
+
/**
|
|
6149
|
+
* Modifies the placement by translating the floating element along the
|
|
6150
|
+
* specified axes.
|
|
6151
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
6152
|
+
* object may be passed.
|
|
6153
|
+
* @see https://floating-ui.com/docs/offset
|
|
6154
|
+
*/
|
|
6155
|
+
const offset = (options, deps) => ({
|
|
6156
|
+
...offset$1(options),
|
|
6157
|
+
options: [options, deps]
|
|
6158
|
+
});
|
|
6159
|
+
|
|
6160
|
+
/**
|
|
6161
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
6162
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
6163
|
+
* @see https://floating-ui.com/docs/shift
|
|
6164
|
+
*/
|
|
6165
|
+
const shift = (options, deps) => ({
|
|
6166
|
+
...shift$1(options),
|
|
6167
|
+
options: [options, deps]
|
|
6168
|
+
});
|
|
6169
|
+
|
|
6170
|
+
/**
|
|
6171
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
6172
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
6173
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
6174
|
+
* @see https://floating-ui.com/docs/flip
|
|
6175
|
+
*/
|
|
6176
|
+
const flip = (options, deps) => ({
|
|
6177
|
+
...flip$1(options),
|
|
6178
|
+
options: [options, deps]
|
|
6179
|
+
});
|
|
6180
|
+
|
|
6181
|
+
/**
|
|
6182
|
+
* Provides data that allows you to change the size of the floating element —
|
|
6183
|
+
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
6184
|
+
* width of the reference element.
|
|
6185
|
+
* @see https://floating-ui.com/docs/size
|
|
6186
|
+
*/
|
|
6187
|
+
const size = (options, deps) => ({
|
|
6188
|
+
...size$1(options),
|
|
6189
|
+
options: [options, deps]
|
|
6190
|
+
});
|
|
6191
|
+
|
|
6192
|
+
/**
|
|
6193
|
+
* Optimizes the visibility of the floating element by choosing the placement
|
|
6194
|
+
* that has the most space available automatically, without needing to specify a
|
|
6195
|
+
* preferred placement. Alternative to `flip`.
|
|
6196
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
6197
|
+
*/
|
|
6198
|
+
const autoPlacement = (options, deps) => ({
|
|
6199
|
+
...autoPlacement$1(options),
|
|
6200
|
+
options: [options, deps]
|
|
6162
6201
|
});
|
|
6163
6202
|
|
|
6164
|
-
/**
|
|
6165
|
-
|
|
6203
|
+
/**
|
|
6204
|
+
* Provides data to position an inner element of the floating element so that it
|
|
6205
|
+
* appears centered to the reference element.
|
|
6206
|
+
* This wraps the core `arrow` middleware to allow React refs as the element.
|
|
6207
|
+
* @see https://floating-ui.com/docs/arrow
|
|
6208
|
+
*/
|
|
6209
|
+
const arrow = (options, deps) => ({
|
|
6210
|
+
...arrow$1(options),
|
|
6211
|
+
options: [options, deps]
|
|
6212
|
+
});
|
|
6166
6213
|
|
|
6167
6214
|
/**
|
|
6168
6215
|
* Different possible placements for the popover.
|
|
@@ -6208,81 +6255,30 @@ const ARROW_SIZE$1 = 14;
|
|
|
6208
6255
|
*/
|
|
6209
6256
|
const POPOVER_ZINDEX = 9999;
|
|
6210
6257
|
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
/**
|
|
6234
|
-
* Popper js modifier to compute max size of the popover.
|
|
6235
|
-
*/
|
|
6236
|
-
const maxSize = {
|
|
6237
|
-
name: 'maxSize',
|
|
6238
|
-
enabled: true,
|
|
6239
|
-
phase: 'main',
|
|
6240
|
-
requiresIfExists: ['offset', 'preventOverflow', 'flip'],
|
|
6241
|
-
fn({
|
|
6242
|
-
state,
|
|
6243
|
-
name,
|
|
6244
|
-
options
|
|
6245
|
-
}) {
|
|
6246
|
-
const overflow = detectOverflow(state, options);
|
|
6247
|
-
const {
|
|
6248
|
-
y = 0,
|
|
6249
|
-
x = 0
|
|
6250
|
-
} = state.modifiersData.preventOverflow;
|
|
6251
|
-
const {
|
|
6252
|
-
width,
|
|
6253
|
-
height
|
|
6254
|
-
} = state.rects.popper;
|
|
6255
|
-
const [basePlacement] = state.placement.split('-');
|
|
6256
|
-
const widthProp = basePlacement === 'left' ? 'left' : 'right';
|
|
6257
|
-
const heightProp = basePlacement === 'top' ? 'top' : 'bottom';
|
|
6258
|
-
// eslint-disable-next-line no-param-reassign
|
|
6259
|
-
state.modifiersData[name] = {
|
|
6260
|
-
width: width - overflow[widthProp] - x,
|
|
6261
|
-
height: height - overflow[heightProp] - y
|
|
6262
|
-
};
|
|
6263
|
-
}
|
|
6264
|
-
};
|
|
6265
|
-
|
|
6266
|
-
/**
|
|
6267
|
-
* Popper js modifier to apply the max height.
|
|
6268
|
-
*/
|
|
6269
|
-
const applyMaxHeight = {
|
|
6270
|
-
name: 'applyMaxHeight',
|
|
6271
|
-
enabled: true,
|
|
6272
|
-
phase: 'beforeWrite',
|
|
6273
|
-
requires: ['maxSize'],
|
|
6274
|
-
fn({
|
|
6275
|
-
state
|
|
6276
|
-
}) {
|
|
6277
|
-
const {
|
|
6278
|
-
height
|
|
6279
|
-
} = state.modifiersData.maxSize;
|
|
6280
|
-
// eslint-disable-next-line no-param-reassign
|
|
6281
|
-
state.elements.popper.style.maxHeight = `${height - ARROW_SIZE$1}px`;
|
|
6282
|
-
}
|
|
6283
|
-
};
|
|
6258
|
+
function parseAutoPlacement(placement) {
|
|
6259
|
+
if (placement === 'auto') return {
|
|
6260
|
+
isAuto: true
|
|
6261
|
+
};
|
|
6262
|
+
if (placement === 'auto-start') return {
|
|
6263
|
+
isAuto: true,
|
|
6264
|
+
autoAlignment: 'start'
|
|
6265
|
+
};
|
|
6266
|
+
if (placement === 'auto-end') return {
|
|
6267
|
+
isAuto: true,
|
|
6268
|
+
autoAlignment: 'end'
|
|
6269
|
+
};
|
|
6270
|
+
return {
|
|
6271
|
+
floatingPlacement: placement,
|
|
6272
|
+
isAuto: false
|
|
6273
|
+
};
|
|
6274
|
+
}
|
|
6275
|
+
function parseFitWidth(fitToAnchorWidth) {
|
|
6276
|
+
if (!fitToAnchorWidth) return undefined;
|
|
6277
|
+
if (typeof fitToAnchorWidth === 'string') return fitToAnchorWidth;
|
|
6278
|
+
return FitAnchorWidth.MIN_WIDTH;
|
|
6279
|
+
}
|
|
6284
6280
|
function usePopoverStyle({
|
|
6285
|
-
offset,
|
|
6281
|
+
offset: offset$1,
|
|
6286
6282
|
hasArrow,
|
|
6287
6283
|
fitToAnchorWidth,
|
|
6288
6284
|
fitWithinViewportHeight,
|
|
@@ -6294,105 +6290,124 @@ function usePopoverStyle({
|
|
|
6294
6290
|
}) {
|
|
6295
6291
|
const [popperElement, setPopperElement] = useState(null);
|
|
6296
6292
|
const [arrowElement, setArrowElement] = useState(null);
|
|
6297
|
-
const actualOffset = [offset?.along ?? 0, (offset?.away ?? 0) + (hasArrow ? ARROW_SIZE$1 : 0)];
|
|
6298
|
-
const modifiers = [{
|
|
6299
|
-
name: 'offset',
|
|
6300
|
-
options: {
|
|
6301
|
-
offset: actualOffset
|
|
6302
|
-
}
|
|
6303
|
-
}];
|
|
6304
|
-
if (hasArrow && arrowElement) {
|
|
6305
|
-
modifiers.push({
|
|
6306
|
-
name: 'arrow',
|
|
6307
|
-
options: {
|
|
6308
|
-
element: arrowElement,
|
|
6309
|
-
padding: ARROW_SIZE$1 / 2
|
|
6310
|
-
}
|
|
6311
|
-
});
|
|
6312
|
-
}
|
|
6313
|
-
if (fitToAnchorWidth) {
|
|
6314
|
-
const fitWidth = typeof fitToAnchorWidth === 'string' ? fitToAnchorWidth : FitAnchorWidth.MIN_WIDTH;
|
|
6315
|
-
modifiers.push(sameWidth(fitWidth));
|
|
6316
|
-
}
|
|
6317
|
-
if (fitWithinViewportHeight) {
|
|
6318
|
-
modifiers.push({
|
|
6319
|
-
...maxSize,
|
|
6320
|
-
options: {
|
|
6321
|
-
boundary: boundaryRef?.current
|
|
6322
|
-
}
|
|
6323
|
-
}, applyMaxHeight);
|
|
6324
|
-
}
|
|
6325
|
-
if (boundaryRef) {
|
|
6326
|
-
modifiers.push({
|
|
6327
|
-
name: 'flip',
|
|
6328
|
-
options: {
|
|
6329
|
-
boundary: boundaryRef.current
|
|
6330
|
-
}
|
|
6331
|
-
}, {
|
|
6332
|
-
name: 'preventOverflow',
|
|
6333
|
-
options: {
|
|
6334
|
-
boundary: boundaryRef.current
|
|
6335
|
-
}
|
|
6336
|
-
});
|
|
6337
|
-
}
|
|
6338
6293
|
const {
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6294
|
+
floatingPlacement,
|
|
6295
|
+
isAuto,
|
|
6296
|
+
autoAlignment
|
|
6297
|
+
} = parseAutoPlacement(placement);
|
|
6298
|
+
const fitWidth = parseFitWidth(fitToAnchorWidth);
|
|
6299
|
+
const boundary = boundaryRef?.current ?? undefined;
|
|
6300
|
+
|
|
6301
|
+
// Build middleware array (order matters: offset → flip/autoPlacement → shift → size → arrow)
|
|
6302
|
+
const middleware = useMemo(() => {
|
|
6303
|
+
const mw = [];
|
|
6304
|
+
|
|
6305
|
+
// Offset middleware
|
|
6306
|
+
const awayOffset = (offset$1?.away ?? 0) + (hasArrow ? ARROW_SIZE$1 : 0);
|
|
6307
|
+
const alongOffset = offset$1?.along ?? 0;
|
|
6308
|
+
mw.push(offset({
|
|
6309
|
+
mainAxis: awayOffset,
|
|
6310
|
+
crossAxis: alongOffset
|
|
6311
|
+
}));
|
|
6347
6312
|
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
}
|
|
6313
|
+
// Positioning middlewares
|
|
6314
|
+
if (isAuto) {
|
|
6315
|
+
mw.push(autoPlacement({
|
|
6316
|
+
...(boundary ? {
|
|
6317
|
+
boundary
|
|
6318
|
+
} : {}),
|
|
6319
|
+
alignment: autoAlignment
|
|
6320
|
+
}));
|
|
6321
|
+
} else {
|
|
6322
|
+
mw.push(flip(boundary ? {
|
|
6323
|
+
boundary
|
|
6324
|
+
} : {}));
|
|
6325
|
+
mw.push(shift(boundary ? {
|
|
6326
|
+
boundary
|
|
6327
|
+
} : {}));
|
|
6328
|
+
}
|
|
6329
|
+
|
|
6330
|
+
// Size middleware
|
|
6331
|
+
if (fitWidth || fitWithinViewportHeight) {
|
|
6332
|
+
mw.push(size({
|
|
6333
|
+
...(boundary ? {
|
|
6334
|
+
boundary
|
|
6335
|
+
} : {}),
|
|
6336
|
+
apply({
|
|
6337
|
+
availableHeight,
|
|
6338
|
+
rects,
|
|
6339
|
+
elements
|
|
6340
|
+
}) {
|
|
6341
|
+
if (fitWidth) {
|
|
6342
|
+
Object.assign(elements.floating.style, {
|
|
6343
|
+
[fitWidth]: `${rects.reference.width}px`
|
|
6344
|
+
});
|
|
6345
|
+
}
|
|
6346
|
+
if (fitWithinViewportHeight) {
|
|
6347
|
+
// eslint-disable-next-line no-param-reassign
|
|
6348
|
+
elements.floating.style.maxHeight = `${Math.max(0, availableHeight - ARROW_SIZE$1)}px`;
|
|
6349
|
+
}
|
|
6350
|
+
}
|
|
6351
|
+
}));
|
|
6363
6352
|
}
|
|
6364
|
-
updateRateLimited();
|
|
6365
6353
|
|
|
6366
|
-
//
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6354
|
+
// Arrow middleware
|
|
6355
|
+
if (hasArrow) {
|
|
6356
|
+
mw.push(arrow({
|
|
6357
|
+
element: arrowElement,
|
|
6358
|
+
padding: ARROW_SIZE$1 / 2
|
|
6359
|
+
}));
|
|
6360
|
+
}
|
|
6361
|
+
return mw;
|
|
6362
|
+
}, [offset$1?.away, offset$1?.along, hasArrow, isAuto, autoAlignment, boundary, fitWidth, fitWithinViewportHeight, arrowElement]);
|
|
6363
|
+
const anchorElement = anchorRef.current;
|
|
6364
|
+
const {
|
|
6365
|
+
floatingStyles,
|
|
6366
|
+
placement: resolvedPlacement,
|
|
6367
|
+
isPositioned,
|
|
6368
|
+
middlewareData
|
|
6369
|
+
} = useFloating({
|
|
6370
|
+
placement: floatingPlacement,
|
|
6371
|
+
whileElementsMounted: autoUpdate,
|
|
6372
|
+
middleware,
|
|
6373
|
+
elements: {
|
|
6374
|
+
reference: anchorElement,
|
|
6375
|
+
floating: popperElement
|
|
6376
|
+
}
|
|
6377
|
+
});
|
|
6378
|
+
const position = resolvedPlacement ?? placement;
|
|
6379
|
+
|
|
6380
|
+
// Compute arrow styles from middleware data
|
|
6381
|
+
const arrowStyles = useMemo(() => {
|
|
6382
|
+
const arrowData = middlewareData.arrow;
|
|
6383
|
+
if (!arrowData) return undefined;
|
|
6384
|
+
return {
|
|
6385
|
+
left: arrowData.x != null ? `${arrowData.x}px` : '',
|
|
6386
|
+
top: arrowData.y != null ? `${arrowData.y}px` : ''
|
|
6372
6387
|
};
|
|
6373
|
-
}, [
|
|
6374
|
-
|
|
6388
|
+
}, [middlewareData.arrow]);
|
|
6389
|
+
|
|
6390
|
+
// Merge floating styles with user-provided styles and zIndex
|
|
6375
6391
|
const popoverStyle = useMemo(() => {
|
|
6376
|
-
|
|
6392
|
+
return {
|
|
6377
6393
|
...style,
|
|
6378
|
-
...
|
|
6394
|
+
...floatingStyles,
|
|
6379
6395
|
zIndex
|
|
6380
6396
|
};
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6397
|
+
}, [style, floatingStyles, zIndex]);
|
|
6398
|
+
|
|
6399
|
+
// Stable setter wrapping useState setter (already stable but typed for consistency)
|
|
6400
|
+
const setPopperElementCallback = useCallback(el => setPopperElement(el), []);
|
|
6401
|
+
const setArrowElementCallback = useCallback(el => setArrowElement(el), []);
|
|
6386
6402
|
return {
|
|
6387
6403
|
styles: {
|
|
6388
|
-
arrow:
|
|
6404
|
+
arrow: arrowStyles,
|
|
6389
6405
|
popover: popoverStyle
|
|
6390
6406
|
},
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
setPopperElement,
|
|
6407
|
+
isPositioned,
|
|
6408
|
+
position: position,
|
|
6409
|
+
setArrowElement: setArrowElementCallback,
|
|
6410
|
+
setPopperElement: setPopperElementCallback,
|
|
6396
6411
|
popperElement
|
|
6397
6412
|
};
|
|
6398
6413
|
}
|
|
@@ -6454,7 +6469,6 @@ const _InnerPopover = forwardRef((props, ref) => {
|
|
|
6454
6469
|
const popoverRef = useRef(null);
|
|
6455
6470
|
const {
|
|
6456
6471
|
styles,
|
|
6457
|
-
attributes,
|
|
6458
6472
|
isPositioned,
|
|
6459
6473
|
position,
|
|
6460
6474
|
setArrowElement,
|
|
@@ -6493,11 +6507,11 @@ const _InnerPopover = forwardRef((props, ref) => {
|
|
|
6493
6507
|
className: classNames.join(className, block$Q({
|
|
6494
6508
|
[`theme-${theme}`]: Boolean(theme),
|
|
6495
6509
|
[`elevation-${adjustedElevation}`]: Boolean(adjustedElevation),
|
|
6496
|
-
[`position-${position}`]: Boolean(position)
|
|
6497
|
-
'is-initializing': !
|
|
6510
|
+
[`position-${position}`]: Boolean(position)
|
|
6511
|
+
//'is-initializing': !isPositioned,
|
|
6498
6512
|
})),
|
|
6499
6513
|
style: styles.popover,
|
|
6500
|
-
|
|
6514
|
+
"data-popper-placement": position,
|
|
6501
6515
|
children: [unmountSentinel, /*#__PURE__*/jsxs(ClickAwayProvider, {
|
|
6502
6516
|
callback: closeOnClickAway && onClose,
|
|
6503
6517
|
childrenRefs: clickAwayRefs,
|
|
@@ -6993,11 +7007,11 @@ const DEFAULT_PROPS$Q = {
|
|
|
6993
7007
|
gap: Size$1.big,
|
|
6994
7008
|
orientation: Orientation$1.horizontal
|
|
6995
7009
|
};
|
|
6996
|
-
const Figure = noop.bind({});
|
|
7010
|
+
const Figure = noop$1.bind({});
|
|
6997
7011
|
const isFigure = isComponentType(Figure);
|
|
6998
|
-
const Content = noop.bind({});
|
|
7012
|
+
const Content = noop$1.bind({});
|
|
6999
7013
|
const isContent = isComponentType(Content);
|
|
7000
|
-
const Actions = noop.bind({});
|
|
7014
|
+
const Actions = noop$1.bind({});
|
|
7001
7015
|
const isActions = isComponentType(Actions);
|
|
7002
7016
|
|
|
7003
7017
|
/**
|
|
@@ -8272,7 +8286,7 @@ async function startViewTransition({
|
|
|
8272
8286
|
const prefersReducedMotion = isReducedMotion();
|
|
8273
8287
|
const {
|
|
8274
8288
|
flushSync
|
|
8275
|
-
} =
|
|
8289
|
+
} = ReactDOM__default;
|
|
8276
8290
|
if (prefersReducedMotion || !start || !flushSync || viewTransitionName && (!viewTransitionName?.source || !viewTransitionName?.target)) {
|
|
8277
8291
|
// Skip, apply changes without a transition
|
|
8278
8292
|
changes();
|
|
@@ -13618,7 +13632,7 @@ const TabProvider = props => {
|
|
|
13618
13632
|
// Escape rendering/useEffect context
|
|
13619
13633
|
queueMicrotask(() => {
|
|
13620
13634
|
// Wait for React to commit last state changes (avoid looping state update)
|
|
13621
|
-
|
|
13635
|
+
ReactDOM__default.flushSync(() => {
|
|
13622
13636
|
onChange(state.activeTabIndex);
|
|
13623
13637
|
});
|
|
13624
13638
|
});
|
|
@@ -15033,19 +15047,20 @@ const Tooltip = forwardRef((props, ref) => {
|
|
|
15033
15047
|
const [popperElement, setPopperElement] = useState(null);
|
|
15034
15048
|
const [anchorElement, setAnchorElement] = useState(null);
|
|
15035
15049
|
const {
|
|
15036
|
-
|
|
15037
|
-
|
|
15050
|
+
floatingStyles,
|
|
15051
|
+
placement: resolvedPlacement,
|
|
15052
|
+
isPositioned,
|
|
15038
15053
|
update
|
|
15039
|
-
} =
|
|
15040
|
-
placement,
|
|
15041
|
-
|
|
15042
|
-
|
|
15043
|
-
|
|
15044
|
-
|
|
15045
|
-
|
|
15046
|
-
}
|
|
15054
|
+
} = useFloating({
|
|
15055
|
+
placement: placement,
|
|
15056
|
+
whileElementsMounted: autoUpdate,
|
|
15057
|
+
middleware: [offset(ARROW_SIZE)],
|
|
15058
|
+
elements: {
|
|
15059
|
+
reference: anchorElement,
|
|
15060
|
+
floating: popperElement
|
|
15061
|
+
}
|
|
15047
15062
|
});
|
|
15048
|
-
const position =
|
|
15063
|
+
const position = resolvedPlacement ?? placement;
|
|
15049
15064
|
const {
|
|
15050
15065
|
isOpen: isActivated,
|
|
15051
15066
|
onPopperMount
|
|
@@ -15063,9 +15078,10 @@ const Tooltip = forwardRef((props, ref) => {
|
|
|
15063
15078
|
});
|
|
15064
15079
|
|
|
15065
15080
|
// Update on open
|
|
15066
|
-
|
|
15067
|
-
if (isOpen || popperElement) update?.();
|
|
15068
|
-
}, [isOpen, update, popperElement]);
|
|
15081
|
+
// React.useEffect(() => {
|
|
15082
|
+
// if (isOpen || popperElement) update?.();
|
|
15083
|
+
// }, [isOpen, update, popperElement]);
|
|
15084
|
+
|
|
15069
15085
|
const labelLines = label ? label.split('\n') : [];
|
|
15070
15086
|
const tooltipRef = useMergeRefs(ref, setPopperElement, onPopperMount);
|
|
15071
15087
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
@@ -15078,14 +15094,14 @@ const Tooltip = forwardRef((props, ref) => {
|
|
|
15078
15094
|
id: id,
|
|
15079
15095
|
role: "tooltip",
|
|
15080
15096
|
className: classNames.join(className, block$2({
|
|
15081
|
-
[`position-${position}`]: Boolean(position)
|
|
15082
|
-
'is-initializing': !
|
|
15097
|
+
[`position-${position}`]: Boolean(position)
|
|
15098
|
+
//'is-initializing': !isPositioned,
|
|
15083
15099
|
}), isHidden && classNames.visuallyHidden()),
|
|
15084
15100
|
style: {
|
|
15085
|
-
...(isHidden ? undefined :
|
|
15101
|
+
...(isHidden ? undefined : floatingStyles),
|
|
15086
15102
|
zIndex
|
|
15087
15103
|
},
|
|
15088
|
-
|
|
15104
|
+
"data-popper-placement": position,
|
|
15089
15105
|
children: [/*#__PURE__*/jsx("div", {
|
|
15090
15106
|
className: element$2('arrow')
|
|
15091
15107
|
}), /*#__PURE__*/jsx("div", {
|