@dso-toolkit/core 51.3.0 → 51.4.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.
Files changed (83) hide show
  1. package/dist/cjs/dso-accordion-section.cjs.entry.js +1 -1
  2. package/dist/cjs/dso-alert.cjs.entry.js +1 -1
  3. package/dist/cjs/dso-badge.cjs.entry.js +1 -1
  4. package/dist/cjs/dso-dropdown-menu.cjs.entry.js +45 -1
  5. package/dist/cjs/dso-header.cjs.entry.js +1 -1
  6. package/dist/cjs/dso-highlight-box.cjs.entry.js +1 -1
  7. package/dist/cjs/dso-info_2.cjs.entry.js +4 -3
  8. package/dist/cjs/dso-label.cjs.entry.js +1 -1
  9. package/dist/cjs/dso-map-controls.cjs.entry.js +12 -4
  10. package/dist/cjs/dso-toolkit.cjs.js +1 -1
  11. package/dist/cjs/dso-tooltip.cjs.entry.js +4 -1801
  12. package/dist/cjs/index.cjs.js +7 -0
  13. package/dist/cjs/loader.cjs.js +1 -1
  14. package/dist/cjs/map-controls.interfaces-5ceec716.js +5 -0
  15. package/dist/cjs/popper-6adb1c1a.js +1803 -0
  16. package/dist/collection/components/accordion/components/accordion-section.css +6 -11
  17. package/dist/collection/components/alert/alert.css +4 -4
  18. package/dist/collection/components/badge/badge.css +2 -2
  19. package/dist/collection/components/dropdown-menu/dropdown-menu.css +0 -1
  20. package/dist/collection/components/dropdown-menu/dropdown-menu.js +64 -0
  21. package/dist/collection/components/header/header.css +2 -2
  22. package/dist/collection/components/highlight-box/highlight-box.css +1 -0
  23. package/dist/collection/components/info/info.css +1 -0
  24. package/dist/collection/components/label/label.css +2 -2
  25. package/dist/collection/components/map-controls/map-controls.interfaces.js +1 -0
  26. package/dist/collection/components/map-controls/map-controls.js +58 -2
  27. package/dist/collection/components/selectable/selectable.css +1 -0
  28. package/dist/collection/components/selectable/selectable.js +19 -1
  29. package/dist/collection/index.js +1 -0
  30. package/dist/components/dropdown-menu.js +47 -2
  31. package/dist/components/dso-accordion-section.js +1 -1
  32. package/dist/components/dso-alert.js +1 -1
  33. package/dist/components/dso-badge.js +1 -1
  34. package/dist/components/dso-header.js +1 -1
  35. package/dist/components/dso-highlight-box.js +1 -1
  36. package/dist/components/dso-label.js +1 -1
  37. package/dist/components/dso-map-controls.js +14 -4
  38. package/dist/components/index.js +1 -1
  39. package/dist/components/info.js +1 -1
  40. package/dist/components/popper.js +1799 -0
  41. package/dist/components/selectable.js +4 -2
  42. package/dist/components/tooltip.js +4 -1801
  43. package/dist/dso-toolkit/dso-toolkit.esm.js +1 -1
  44. package/dist/dso-toolkit/index.esm.js +1 -0
  45. package/dist/dso-toolkit/p-07952ece.entry.js +1 -0
  46. package/dist/dso-toolkit/{p-1f0672f2.entry.js → p-147ec7bd.entry.js} +1 -1
  47. package/dist/dso-toolkit/p-1cea3b99.js +1 -0
  48. package/dist/dso-toolkit/p-30df5586.entry.js +1 -0
  49. package/dist/dso-toolkit/p-4b18389c.entry.js +1 -0
  50. package/dist/dso-toolkit/{p-2af58b20.entry.js → p-4c8426b7.entry.js} +1 -1
  51. package/dist/dso-toolkit/{p-8de85ae7.entry.js → p-5082d823.entry.js} +1 -1
  52. package/dist/dso-toolkit/p-85b18dbd.js +1 -0
  53. package/dist/dso-toolkit/{p-5b7c0fa5.entry.js → p-c1226b66.entry.js} +1 -1
  54. package/dist/dso-toolkit/p-c2a4f4ea.entry.js +1 -0
  55. package/dist/dso-toolkit/p-e3c9c7d0.entry.js +1 -0
  56. package/dist/dso-toolkit/{p-c4c309b5.entry.js → p-f53860da.entry.js} +1 -1
  57. package/dist/esm/dso-accordion-section.entry.js +1 -1
  58. package/dist/esm/dso-alert.entry.js +1 -1
  59. package/dist/esm/dso-badge.entry.js +1 -1
  60. package/dist/esm/dso-dropdown-menu.entry.js +45 -1
  61. package/dist/esm/dso-header.entry.js +1 -1
  62. package/dist/esm/dso-highlight-box.entry.js +1 -1
  63. package/dist/esm/dso-info_2.entry.js +4 -3
  64. package/dist/esm/dso-label.entry.js +1 -1
  65. package/dist/esm/dso-map-controls.entry.js +10 -2
  66. package/dist/esm/dso-toolkit.js +1 -1
  67. package/dist/esm/dso-tooltip.entry.js +1 -1798
  68. package/dist/esm/index.js +1 -1
  69. package/dist/esm/loader.js +1 -1
  70. package/dist/esm/map-controls.interfaces-2323e8ac.js +3 -0
  71. package/dist/esm/popper-467f7841.js +1799 -0
  72. package/dist/types/components/dropdown-menu/dropdown-menu.d.ts +5 -0
  73. package/dist/types/components/map-controls/map-controls.d.ts +9 -0
  74. package/dist/types/components/map-controls/map-controls.interfaces.d.ts +5 -0
  75. package/dist/types/components/selectable/selectable.d.ts +1 -0
  76. package/dist/types/components.d.ts +16 -0
  77. package/dist/types/index.d.ts +1 -0
  78. package/package.json +2 -2
  79. package/dist/dso-toolkit/p-0bc8885e.entry.js +0 -1
  80. package/dist/dso-toolkit/p-0ca60778.entry.js +0 -1
  81. package/dist/dso-toolkit/p-1854d6ed.entry.js +0 -1
  82. package/dist/dso-toolkit/p-b337f001.entry.js +0 -1
  83. package/dist/dso-toolkit/p-fbb20550.entry.js +0 -1
@@ -3,1806 +3,9 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-ecec64a0.js');
6
+ const popper = require('./popper-6adb1c1a.js');
6
7
  const clsx_m = require('./clsx.m-b81c6b86.js');
7
8
 
8
- var top = 'top';
9
- var bottom = 'bottom';
10
- var right = 'right';
11
- var left = 'left';
12
- var auto = 'auto';
13
- var basePlacements = [top, bottom, right, left];
14
- var start = 'start';
15
- var end = 'end';
16
- var clippingParents = 'clippingParents';
17
- var viewport = 'viewport';
18
- var popper = 'popper';
19
- var reference = 'reference';
20
- var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
21
- return acc.concat([placement + "-" + start, placement + "-" + end]);
22
- }, []);
23
- var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
24
- return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
25
- }, []); // modifiers that need to read the DOM
26
-
27
- var beforeRead = 'beforeRead';
28
- var read = 'read';
29
- var afterRead = 'afterRead'; // pure-logic modifiers
30
-
31
- var beforeMain = 'beforeMain';
32
- var main = 'main';
33
- var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
34
-
35
- var beforeWrite = 'beforeWrite';
36
- var write = 'write';
37
- var afterWrite = 'afterWrite';
38
- var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
39
-
40
- function getNodeName(element) {
41
- return element ? (element.nodeName || '').toLowerCase() : null;
42
- }
43
-
44
- function getWindow(node) {
45
- if (node == null) {
46
- return window;
47
- }
48
-
49
- if (node.toString() !== '[object Window]') {
50
- var ownerDocument = node.ownerDocument;
51
- return ownerDocument ? ownerDocument.defaultView || window : window;
52
- }
53
-
54
- return node;
55
- }
56
-
57
- function isElement(node) {
58
- var OwnElement = getWindow(node).Element;
59
- return node instanceof OwnElement || node instanceof Element;
60
- }
61
-
62
- function isHTMLElement(node) {
63
- var OwnElement = getWindow(node).HTMLElement;
64
- return node instanceof OwnElement || node instanceof HTMLElement;
65
- }
66
-
67
- function isShadowRoot(node) {
68
- // IE 11 has no ShadowRoot
69
- if (typeof ShadowRoot === 'undefined') {
70
- return false;
71
- }
72
-
73
- var OwnElement = getWindow(node).ShadowRoot;
74
- return node instanceof OwnElement || node instanceof ShadowRoot;
75
- }
76
-
77
- // and applies them to the HTMLElements such as popper and arrow
78
-
79
- function applyStyles(_ref) {
80
- var state = _ref.state;
81
- Object.keys(state.elements).forEach(function (name) {
82
- var style = state.styles[name] || {};
83
- var attributes = state.attributes[name] || {};
84
- var element = state.elements[name]; // arrow is optional + virtual elements
85
-
86
- if (!isHTMLElement(element) || !getNodeName(element)) {
87
- return;
88
- } // Flow doesn't support to extend this property, but it's the most
89
- // effective way to apply styles to an HTMLElement
90
- // $FlowFixMe[cannot-write]
91
-
92
-
93
- Object.assign(element.style, style);
94
- Object.keys(attributes).forEach(function (name) {
95
- var value = attributes[name];
96
-
97
- if (value === false) {
98
- element.removeAttribute(name);
99
- } else {
100
- element.setAttribute(name, value === true ? '' : value);
101
- }
102
- });
103
- });
104
- }
105
-
106
- function effect$2(_ref2) {
107
- var state = _ref2.state;
108
- var initialStyles = {
109
- popper: {
110
- position: state.options.strategy,
111
- left: '0',
112
- top: '0',
113
- margin: '0'
114
- },
115
- arrow: {
116
- position: 'absolute'
117
- },
118
- reference: {}
119
- };
120
- Object.assign(state.elements.popper.style, initialStyles.popper);
121
- state.styles = initialStyles;
122
-
123
- if (state.elements.arrow) {
124
- Object.assign(state.elements.arrow.style, initialStyles.arrow);
125
- }
126
-
127
- return function () {
128
- Object.keys(state.elements).forEach(function (name) {
129
- var element = state.elements[name];
130
- var attributes = state.attributes[name] || {};
131
- var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
132
-
133
- var style = styleProperties.reduce(function (style, property) {
134
- style[property] = '';
135
- return style;
136
- }, {}); // arrow is optional + virtual elements
137
-
138
- if (!isHTMLElement(element) || !getNodeName(element)) {
139
- return;
140
- }
141
-
142
- Object.assign(element.style, style);
143
- Object.keys(attributes).forEach(function (attribute) {
144
- element.removeAttribute(attribute);
145
- });
146
- });
147
- };
148
- } // eslint-disable-next-line import/no-unused-modules
149
-
150
-
151
- const applyStyles$1 = {
152
- name: 'applyStyles',
153
- enabled: true,
154
- phase: 'write',
155
- fn: applyStyles,
156
- effect: effect$2,
157
- requires: ['computeStyles']
158
- };
159
-
160
- function getBasePlacement(placement) {
161
- return placement.split('-')[0];
162
- }
163
-
164
- var max = Math.max;
165
- var min = Math.min;
166
- var round = Math.round;
167
-
168
- function getUAString() {
169
- var uaData = navigator.userAgentData;
170
-
171
- if (uaData != null && uaData.brands) {
172
- return uaData.brands.map(function (item) {
173
- return item.brand + "/" + item.version;
174
- }).join(' ');
175
- }
176
-
177
- return navigator.userAgent;
178
- }
179
-
180
- function isLayoutViewport() {
181
- return !/^((?!chrome|android).)*safari/i.test(getUAString());
182
- }
183
-
184
- function getBoundingClientRect(element, includeScale, isFixedStrategy) {
185
- if (includeScale === void 0) {
186
- includeScale = false;
187
- }
188
-
189
- if (isFixedStrategy === void 0) {
190
- isFixedStrategy = false;
191
- }
192
-
193
- var clientRect = element.getBoundingClientRect();
194
- var scaleX = 1;
195
- var scaleY = 1;
196
-
197
- if (includeScale && isHTMLElement(element)) {
198
- scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
199
- scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
200
- }
201
-
202
- var _ref = isElement(element) ? getWindow(element) : window,
203
- visualViewport = _ref.visualViewport;
204
-
205
- var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
206
- var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
207
- var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
208
- var width = clientRect.width / scaleX;
209
- var height = clientRect.height / scaleY;
210
- return {
211
- width: width,
212
- height: height,
213
- top: y,
214
- right: x + width,
215
- bottom: y + height,
216
- left: x,
217
- x: x,
218
- y: y
219
- };
220
- }
221
-
222
- // means it doesn't take into account transforms.
223
-
224
- function getLayoutRect(element) {
225
- var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
226
- // Fixes https://github.com/popperjs/popper-core/issues/1223
227
-
228
- var width = element.offsetWidth;
229
- var height = element.offsetHeight;
230
-
231
- if (Math.abs(clientRect.width - width) <= 1) {
232
- width = clientRect.width;
233
- }
234
-
235
- if (Math.abs(clientRect.height - height) <= 1) {
236
- height = clientRect.height;
237
- }
238
-
239
- return {
240
- x: element.offsetLeft,
241
- y: element.offsetTop,
242
- width: width,
243
- height: height
244
- };
245
- }
246
-
247
- function contains(parent, child) {
248
- var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
249
-
250
- if (parent.contains(child)) {
251
- return true;
252
- } // then fallback to custom implementation with Shadow DOM support
253
- else if (rootNode && isShadowRoot(rootNode)) {
254
- var next = child;
255
-
256
- do {
257
- if (next && parent.isSameNode(next)) {
258
- return true;
259
- } // $FlowFixMe[prop-missing]: need a better way to handle this...
260
-
261
-
262
- next = next.parentNode || next.host;
263
- } while (next);
264
- } // Give up, the result is false
265
-
266
-
267
- return false;
268
- }
269
-
270
- function getComputedStyle(element) {
271
- return getWindow(element).getComputedStyle(element);
272
- }
273
-
274
- function isTableElement(element) {
275
- return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
276
- }
277
-
278
- function getDocumentElement(element) {
279
- // $FlowFixMe[incompatible-return]: assume body is always available
280
- return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
281
- element.document) || window.document).documentElement;
282
- }
283
-
284
- function getParentNode(element) {
285
- if (getNodeName(element) === 'html') {
286
- return element;
287
- }
288
-
289
- return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
290
- // $FlowFixMe[incompatible-return]
291
- // $FlowFixMe[prop-missing]
292
- element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
293
- element.parentNode || ( // DOM Element detected
294
- isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
295
- // $FlowFixMe[incompatible-call]: HTMLElement is a Node
296
- getDocumentElement(element) // fallback
297
-
298
- );
299
- }
300
-
301
- function getTrueOffsetParent(element) {
302
- if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
303
- getComputedStyle(element).position === 'fixed') {
304
- return null;
305
- }
306
-
307
- return element.offsetParent;
308
- } // `.offsetParent` reports `null` for fixed elements, while absolute elements
309
- // return the containing block
310
-
311
-
312
- function getContainingBlock(element) {
313
- var isFirefox = /firefox/i.test(getUAString());
314
- var isIE = /Trident/i.test(getUAString());
315
-
316
- if (isIE && isHTMLElement(element)) {
317
- // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
318
- var elementCss = getComputedStyle(element);
319
-
320
- if (elementCss.position === 'fixed') {
321
- return null;
322
- }
323
- }
324
-
325
- var currentNode = getParentNode(element);
326
-
327
- if (isShadowRoot(currentNode)) {
328
- currentNode = currentNode.host;
329
- }
330
-
331
- while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
332
- var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
333
- // create a containing block.
334
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
335
-
336
- if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
337
- return currentNode;
338
- } else {
339
- currentNode = currentNode.parentNode;
340
- }
341
- }
342
-
343
- return null;
344
- } // Gets the closest ancestor positioned element. Handles some edge cases,
345
- // such as table ancestors and cross browser bugs.
346
-
347
-
348
- function getOffsetParent(element) {
349
- var window = getWindow(element);
350
- var offsetParent = getTrueOffsetParent(element);
351
-
352
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
353
- offsetParent = getTrueOffsetParent(offsetParent);
354
- }
355
-
356
- if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
357
- return window;
358
- }
359
-
360
- return offsetParent || getContainingBlock(element) || window;
361
- }
362
-
363
- function getMainAxisFromPlacement(placement) {
364
- return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
365
- }
366
-
367
- function within(min$1, value, max$1) {
368
- return max(min$1, min(value, max$1));
369
- }
370
- function withinMaxClamp(min, value, max) {
371
- var v = within(min, value, max);
372
- return v > max ? max : v;
373
- }
374
-
375
- function getFreshSideObject() {
376
- return {
377
- top: 0,
378
- right: 0,
379
- bottom: 0,
380
- left: 0
381
- };
382
- }
383
-
384
- function mergePaddingObject(paddingObject) {
385
- return Object.assign({}, getFreshSideObject(), paddingObject);
386
- }
387
-
388
- function expandToHashMap(value, keys) {
389
- return keys.reduce(function (hashMap, key) {
390
- hashMap[key] = value;
391
- return hashMap;
392
- }, {});
393
- }
394
-
395
- var toPaddingObject = function toPaddingObject(padding, state) {
396
- padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
397
- placement: state.placement
398
- })) : padding;
399
- return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
400
- };
401
-
402
- function arrow(_ref) {
403
- var _state$modifiersData$;
404
-
405
- var state = _ref.state,
406
- name = _ref.name,
407
- options = _ref.options;
408
- var arrowElement = state.elements.arrow;
409
- var popperOffsets = state.modifiersData.popperOffsets;
410
- var basePlacement = getBasePlacement(state.placement);
411
- var axis = getMainAxisFromPlacement(basePlacement);
412
- var isVertical = [left, right].indexOf(basePlacement) >= 0;
413
- var len = isVertical ? 'height' : 'width';
414
-
415
- if (!arrowElement || !popperOffsets) {
416
- return;
417
- }
418
-
419
- var paddingObject = toPaddingObject(options.padding, state);
420
- var arrowRect = getLayoutRect(arrowElement);
421
- var minProp = axis === 'y' ? top : left;
422
- var maxProp = axis === 'y' ? bottom : right;
423
- var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
424
- var startDiff = popperOffsets[axis] - state.rects.reference[axis];
425
- var arrowOffsetParent = getOffsetParent(arrowElement);
426
- var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
427
- var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
428
- // outside of the popper bounds
429
-
430
- var min = paddingObject[minProp];
431
- var max = clientSize - arrowRect[len] - paddingObject[maxProp];
432
- var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
433
- var offset = within(min, center, max); // Prevents breaking syntax highlighting...
434
-
435
- var axisProp = axis;
436
- state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
437
- }
438
-
439
- function effect$1(_ref2) {
440
- var state = _ref2.state,
441
- options = _ref2.options;
442
- var _options$element = options.element,
443
- arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
444
-
445
- if (arrowElement == null) {
446
- return;
447
- } // CSS selector
448
-
449
-
450
- if (typeof arrowElement === 'string') {
451
- arrowElement = state.elements.popper.querySelector(arrowElement);
452
-
453
- if (!arrowElement) {
454
- return;
455
- }
456
- }
457
-
458
- if (!contains(state.elements.popper, arrowElement)) {
459
-
460
- return;
461
- }
462
-
463
- state.elements.arrow = arrowElement;
464
- } // eslint-disable-next-line import/no-unused-modules
465
-
466
-
467
- const arrow$1 = {
468
- name: 'arrow',
469
- enabled: true,
470
- phase: 'main',
471
- fn: arrow,
472
- effect: effect$1,
473
- requires: ['popperOffsets'],
474
- requiresIfExists: ['preventOverflow']
475
- };
476
-
477
- function getVariation(placement) {
478
- return placement.split('-')[1];
479
- }
480
-
481
- var unsetSides = {
482
- top: 'auto',
483
- right: 'auto',
484
- bottom: 'auto',
485
- left: 'auto'
486
- }; // Round the offsets to the nearest suitable subpixel based on the DPR.
487
- // Zooming can change the DPR, but it seems to report a value that will
488
- // cleanly divide the values into the appropriate subpixels.
489
-
490
- function roundOffsetsByDPR(_ref) {
491
- var x = _ref.x,
492
- y = _ref.y;
493
- var win = window;
494
- var dpr = win.devicePixelRatio || 1;
495
- return {
496
- x: round(x * dpr) / dpr || 0,
497
- y: round(y * dpr) / dpr || 0
498
- };
499
- }
500
-
501
- function mapToStyles(_ref2) {
502
- var _Object$assign2;
503
-
504
- var popper = _ref2.popper,
505
- popperRect = _ref2.popperRect,
506
- placement = _ref2.placement,
507
- variation = _ref2.variation,
508
- offsets = _ref2.offsets,
509
- position = _ref2.position,
510
- gpuAcceleration = _ref2.gpuAcceleration,
511
- adaptive = _ref2.adaptive,
512
- roundOffsets = _ref2.roundOffsets,
513
- isFixed = _ref2.isFixed;
514
- var _offsets$x = offsets.x,
515
- x = _offsets$x === void 0 ? 0 : _offsets$x,
516
- _offsets$y = offsets.y,
517
- y = _offsets$y === void 0 ? 0 : _offsets$y;
518
-
519
- var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
520
- x: x,
521
- y: y
522
- }) : {
523
- x: x,
524
- y: y
525
- };
526
-
527
- x = _ref3.x;
528
- y = _ref3.y;
529
- var hasX = offsets.hasOwnProperty('x');
530
- var hasY = offsets.hasOwnProperty('y');
531
- var sideX = left;
532
- var sideY = top;
533
- var win = window;
534
-
535
- if (adaptive) {
536
- var offsetParent = getOffsetParent(popper);
537
- var heightProp = 'clientHeight';
538
- var widthProp = 'clientWidth';
539
-
540
- if (offsetParent === getWindow(popper)) {
541
- offsetParent = getDocumentElement(popper);
542
-
543
- if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
544
- heightProp = 'scrollHeight';
545
- widthProp = 'scrollWidth';
546
- }
547
- } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
548
-
549
-
550
- offsetParent = offsetParent;
551
-
552
- if (placement === top || (placement === left || placement === right) && variation === end) {
553
- sideY = bottom;
554
- var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
555
- offsetParent[heightProp];
556
- y -= offsetY - popperRect.height;
557
- y *= gpuAcceleration ? 1 : -1;
558
- }
559
-
560
- if (placement === left || (placement === top || placement === bottom) && variation === end) {
561
- sideX = right;
562
- var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
563
- offsetParent[widthProp];
564
- x -= offsetX - popperRect.width;
565
- x *= gpuAcceleration ? 1 : -1;
566
- }
567
- }
568
-
569
- var commonStyles = Object.assign({
570
- position: position
571
- }, adaptive && unsetSides);
572
-
573
- var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
574
- x: x,
575
- y: y
576
- }) : {
577
- x: x,
578
- y: y
579
- };
580
-
581
- x = _ref4.x;
582
- y = _ref4.y;
583
-
584
- if (gpuAcceleration) {
585
- var _Object$assign;
586
-
587
- return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
588
- }
589
-
590
- return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
591
- }
592
-
593
- function computeStyles(_ref5) {
594
- var state = _ref5.state,
595
- options = _ref5.options;
596
- var _options$gpuAccelerat = options.gpuAcceleration,
597
- gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
598
- _options$adaptive = options.adaptive,
599
- adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
600
- _options$roundOffsets = options.roundOffsets,
601
- roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
602
-
603
- var commonStyles = {
604
- placement: getBasePlacement(state.placement),
605
- variation: getVariation(state.placement),
606
- popper: state.elements.popper,
607
- popperRect: state.rects.popper,
608
- gpuAcceleration: gpuAcceleration,
609
- isFixed: state.options.strategy === 'fixed'
610
- };
611
-
612
- if (state.modifiersData.popperOffsets != null) {
613
- state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
614
- offsets: state.modifiersData.popperOffsets,
615
- position: state.options.strategy,
616
- adaptive: adaptive,
617
- roundOffsets: roundOffsets
618
- })));
619
- }
620
-
621
- if (state.modifiersData.arrow != null) {
622
- state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
623
- offsets: state.modifiersData.arrow,
624
- position: 'absolute',
625
- adaptive: false,
626
- roundOffsets: roundOffsets
627
- })));
628
- }
629
-
630
- state.attributes.popper = Object.assign({}, state.attributes.popper, {
631
- 'data-popper-placement': state.placement
632
- });
633
- } // eslint-disable-next-line import/no-unused-modules
634
-
635
-
636
- const computeStyles$1 = {
637
- name: 'computeStyles',
638
- enabled: true,
639
- phase: 'beforeWrite',
640
- fn: computeStyles,
641
- data: {}
642
- };
643
-
644
- var passive = {
645
- passive: true
646
- };
647
-
648
- function effect(_ref) {
649
- var state = _ref.state,
650
- instance = _ref.instance,
651
- options = _ref.options;
652
- var _options$scroll = options.scroll,
653
- scroll = _options$scroll === void 0 ? true : _options$scroll,
654
- _options$resize = options.resize,
655
- resize = _options$resize === void 0 ? true : _options$resize;
656
- var window = getWindow(state.elements.popper);
657
- var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
658
-
659
- if (scroll) {
660
- scrollParents.forEach(function (scrollParent) {
661
- scrollParent.addEventListener('scroll', instance.update, passive);
662
- });
663
- }
664
-
665
- if (resize) {
666
- window.addEventListener('resize', instance.update, passive);
667
- }
668
-
669
- return function () {
670
- if (scroll) {
671
- scrollParents.forEach(function (scrollParent) {
672
- scrollParent.removeEventListener('scroll', instance.update, passive);
673
- });
674
- }
675
-
676
- if (resize) {
677
- window.removeEventListener('resize', instance.update, passive);
678
- }
679
- };
680
- } // eslint-disable-next-line import/no-unused-modules
681
-
682
-
683
- const eventListeners = {
684
- name: 'eventListeners',
685
- enabled: true,
686
- phase: 'write',
687
- fn: function fn() {},
688
- effect: effect,
689
- data: {}
690
- };
691
-
692
- var hash$1 = {
693
- left: 'right',
694
- right: 'left',
695
- bottom: 'top',
696
- top: 'bottom'
697
- };
698
- function getOppositePlacement(placement) {
699
- return placement.replace(/left|right|bottom|top/g, function (matched) {
700
- return hash$1[matched];
701
- });
702
- }
703
-
704
- var hash = {
705
- start: 'end',
706
- end: 'start'
707
- };
708
- function getOppositeVariationPlacement(placement) {
709
- return placement.replace(/start|end/g, function (matched) {
710
- return hash[matched];
711
- });
712
- }
713
-
714
- function getWindowScroll(node) {
715
- var win = getWindow(node);
716
- var scrollLeft = win.pageXOffset;
717
- var scrollTop = win.pageYOffset;
718
- return {
719
- scrollLeft: scrollLeft,
720
- scrollTop: scrollTop
721
- };
722
- }
723
-
724
- function getWindowScrollBarX(element) {
725
- // If <html> has a CSS width greater than the viewport, then this will be
726
- // incorrect for RTL.
727
- // Popper 1 is broken in this case and never had a bug report so let's assume
728
- // it's not an issue. I don't think anyone ever specifies width on <html>
729
- // anyway.
730
- // Browsers where the left scrollbar doesn't cause an issue report `0` for
731
- // this (e.g. Edge 2019, IE11, Safari)
732
- return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
733
- }
734
-
735
- function getViewportRect(element, strategy) {
736
- var win = getWindow(element);
737
- var html = getDocumentElement(element);
738
- var visualViewport = win.visualViewport;
739
- var width = html.clientWidth;
740
- var height = html.clientHeight;
741
- var x = 0;
742
- var y = 0;
743
-
744
- if (visualViewport) {
745
- width = visualViewport.width;
746
- height = visualViewport.height;
747
- var layoutViewport = isLayoutViewport();
748
-
749
- if (layoutViewport || !layoutViewport && strategy === 'fixed') {
750
- x = visualViewport.offsetLeft;
751
- y = visualViewport.offsetTop;
752
- }
753
- }
754
-
755
- return {
756
- width: width,
757
- height: height,
758
- x: x + getWindowScrollBarX(element),
759
- y: y
760
- };
761
- }
762
-
763
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable
764
-
765
- function getDocumentRect(element) {
766
- var _element$ownerDocumen;
767
-
768
- var html = getDocumentElement(element);
769
- var winScroll = getWindowScroll(element);
770
- var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
771
- var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
772
- var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
773
- var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
774
- var y = -winScroll.scrollTop;
775
-
776
- if (getComputedStyle(body || html).direction === 'rtl') {
777
- x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
778
- }
779
-
780
- return {
781
- width: width,
782
- height: height,
783
- x: x,
784
- y: y
785
- };
786
- }
787
-
788
- function isScrollParent(element) {
789
- // Firefox wants us to check `-x` and `-y` variations as well
790
- var _getComputedStyle = getComputedStyle(element),
791
- overflow = _getComputedStyle.overflow,
792
- overflowX = _getComputedStyle.overflowX,
793
- overflowY = _getComputedStyle.overflowY;
794
-
795
- return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
796
- }
797
-
798
- function getScrollParent(node) {
799
- if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
800
- // $FlowFixMe[incompatible-return]: assume body is always available
801
- return node.ownerDocument.body;
802
- }
803
-
804
- if (isHTMLElement(node) && isScrollParent(node)) {
805
- return node;
806
- }
807
-
808
- return getScrollParent(getParentNode(node));
809
- }
810
-
811
- /*
812
- given a DOM element, return the list of all scroll parents, up the list of ancesors
813
- until we get to the top window object. This list is what we attach scroll listeners
814
- to, because if any of these parent elements scroll, we'll need to re-calculate the
815
- reference element's position.
816
- */
817
-
818
- function listScrollParents(element, list) {
819
- var _element$ownerDocumen;
820
-
821
- if (list === void 0) {
822
- list = [];
823
- }
824
-
825
- var scrollParent = getScrollParent(element);
826
- var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
827
- var win = getWindow(scrollParent);
828
- var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
829
- var updatedList = list.concat(target);
830
- return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
831
- updatedList.concat(listScrollParents(getParentNode(target)));
832
- }
833
-
834
- function rectToClientRect(rect) {
835
- return Object.assign({}, rect, {
836
- left: rect.x,
837
- top: rect.y,
838
- right: rect.x + rect.width,
839
- bottom: rect.y + rect.height
840
- });
841
- }
842
-
843
- function getInnerBoundingClientRect(element, strategy) {
844
- var rect = getBoundingClientRect(element, false, strategy === 'fixed');
845
- rect.top = rect.top + element.clientTop;
846
- rect.left = rect.left + element.clientLeft;
847
- rect.bottom = rect.top + element.clientHeight;
848
- rect.right = rect.left + element.clientWidth;
849
- rect.width = element.clientWidth;
850
- rect.height = element.clientHeight;
851
- rect.x = rect.left;
852
- rect.y = rect.top;
853
- return rect;
854
- }
855
-
856
- function getClientRectFromMixedType(element, clippingParent, strategy) {
857
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
858
- } // A "clipping parent" is an overflowable container with the characteristic of
859
- // clipping (or hiding) overflowing elements with a position different from
860
- // `initial`
861
-
862
-
863
- function getClippingParents(element) {
864
- var clippingParents = listScrollParents(getParentNode(element));
865
- var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
866
- var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
867
-
868
- if (!isElement(clipperElement)) {
869
- return [];
870
- } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
871
-
872
-
873
- return clippingParents.filter(function (clippingParent) {
874
- return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
875
- });
876
- } // Gets the maximum area that the element is visible in due to any number of
877
- // clipping parents
878
-
879
-
880
- function getClippingRect(element, boundary, rootBoundary, strategy) {
881
- var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
882
- var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
883
- var firstClippingParent = clippingParents[0];
884
- var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
885
- var rect = getClientRectFromMixedType(element, clippingParent, strategy);
886
- accRect.top = max(rect.top, accRect.top);
887
- accRect.right = min(rect.right, accRect.right);
888
- accRect.bottom = min(rect.bottom, accRect.bottom);
889
- accRect.left = max(rect.left, accRect.left);
890
- return accRect;
891
- }, getClientRectFromMixedType(element, firstClippingParent, strategy));
892
- clippingRect.width = clippingRect.right - clippingRect.left;
893
- clippingRect.height = clippingRect.bottom - clippingRect.top;
894
- clippingRect.x = clippingRect.left;
895
- clippingRect.y = clippingRect.top;
896
- return clippingRect;
897
- }
898
-
899
- function computeOffsets(_ref) {
900
- var reference = _ref.reference,
901
- element = _ref.element,
902
- placement = _ref.placement;
903
- var basePlacement = placement ? getBasePlacement(placement) : null;
904
- var variation = placement ? getVariation(placement) : null;
905
- var commonX = reference.x + reference.width / 2 - element.width / 2;
906
- var commonY = reference.y + reference.height / 2 - element.height / 2;
907
- var offsets;
908
-
909
- switch (basePlacement) {
910
- case top:
911
- offsets = {
912
- x: commonX,
913
- y: reference.y - element.height
914
- };
915
- break;
916
-
917
- case bottom:
918
- offsets = {
919
- x: commonX,
920
- y: reference.y + reference.height
921
- };
922
- break;
923
-
924
- case right:
925
- offsets = {
926
- x: reference.x + reference.width,
927
- y: commonY
928
- };
929
- break;
930
-
931
- case left:
932
- offsets = {
933
- x: reference.x - element.width,
934
- y: commonY
935
- };
936
- break;
937
-
938
- default:
939
- offsets = {
940
- x: reference.x,
941
- y: reference.y
942
- };
943
- }
944
-
945
- var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
946
-
947
- if (mainAxis != null) {
948
- var len = mainAxis === 'y' ? 'height' : 'width';
949
-
950
- switch (variation) {
951
- case start:
952
- offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
953
- break;
954
-
955
- case end:
956
- offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
957
- break;
958
- }
959
- }
960
-
961
- return offsets;
962
- }
963
-
964
- function detectOverflow(state, options) {
965
- if (options === void 0) {
966
- options = {};
967
- }
968
-
969
- var _options = options,
970
- _options$placement = _options.placement,
971
- placement = _options$placement === void 0 ? state.placement : _options$placement,
972
- _options$strategy = _options.strategy,
973
- strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
974
- _options$boundary = _options.boundary,
975
- boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
976
- _options$rootBoundary = _options.rootBoundary,
977
- rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
978
- _options$elementConte = _options.elementContext,
979
- elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
980
- _options$altBoundary = _options.altBoundary,
981
- altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
982
- _options$padding = _options.padding,
983
- padding = _options$padding === void 0 ? 0 : _options$padding;
984
- var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
985
- var altContext = elementContext === popper ? reference : popper;
986
- var popperRect = state.rects.popper;
987
- var element = state.elements[altBoundary ? altContext : elementContext];
988
- var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
989
- var referenceClientRect = getBoundingClientRect(state.elements.reference);
990
- var popperOffsets = computeOffsets({
991
- reference: referenceClientRect,
992
- element: popperRect,
993
- strategy: 'absolute',
994
- placement: placement
995
- });
996
- var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
997
- var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
998
- // 0 or negative = within the clipping rect
999
-
1000
- var overflowOffsets = {
1001
- top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
1002
- bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
1003
- left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
1004
- right: elementClientRect.right - clippingClientRect.right + paddingObject.right
1005
- };
1006
- var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
1007
-
1008
- if (elementContext === popper && offsetData) {
1009
- var offset = offsetData[placement];
1010
- Object.keys(overflowOffsets).forEach(function (key) {
1011
- var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
1012
- var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
1013
- overflowOffsets[key] += offset[axis] * multiply;
1014
- });
1015
- }
1016
-
1017
- return overflowOffsets;
1018
- }
1019
-
1020
- function computeAutoPlacement(state, options) {
1021
- if (options === void 0) {
1022
- options = {};
1023
- }
1024
-
1025
- var _options = options,
1026
- placement = _options.placement,
1027
- boundary = _options.boundary,
1028
- rootBoundary = _options.rootBoundary,
1029
- padding = _options.padding,
1030
- flipVariations = _options.flipVariations,
1031
- _options$allowedAutoP = _options.allowedAutoPlacements,
1032
- allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
1033
- var variation = getVariation(placement);
1034
- var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
1035
- return getVariation(placement) === variation;
1036
- }) : basePlacements;
1037
- var allowedPlacements = placements$1.filter(function (placement) {
1038
- return allowedAutoPlacements.indexOf(placement) >= 0;
1039
- });
1040
-
1041
- if (allowedPlacements.length === 0) {
1042
- allowedPlacements = placements$1;
1043
- } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
1044
-
1045
-
1046
- var overflows = allowedPlacements.reduce(function (acc, placement) {
1047
- acc[placement] = detectOverflow(state, {
1048
- placement: placement,
1049
- boundary: boundary,
1050
- rootBoundary: rootBoundary,
1051
- padding: padding
1052
- })[getBasePlacement(placement)];
1053
- return acc;
1054
- }, {});
1055
- return Object.keys(overflows).sort(function (a, b) {
1056
- return overflows[a] - overflows[b];
1057
- });
1058
- }
1059
-
1060
- function getExpandedFallbackPlacements(placement) {
1061
- if (getBasePlacement(placement) === auto) {
1062
- return [];
1063
- }
1064
-
1065
- var oppositePlacement = getOppositePlacement(placement);
1066
- return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
1067
- }
1068
-
1069
- function flip(_ref) {
1070
- var state = _ref.state,
1071
- options = _ref.options,
1072
- name = _ref.name;
1073
-
1074
- if (state.modifiersData[name]._skip) {
1075
- return;
1076
- }
1077
-
1078
- var _options$mainAxis = options.mainAxis,
1079
- checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1080
- _options$altAxis = options.altAxis,
1081
- checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
1082
- specifiedFallbackPlacements = options.fallbackPlacements,
1083
- padding = options.padding,
1084
- boundary = options.boundary,
1085
- rootBoundary = options.rootBoundary,
1086
- altBoundary = options.altBoundary,
1087
- _options$flipVariatio = options.flipVariations,
1088
- flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
1089
- allowedAutoPlacements = options.allowedAutoPlacements;
1090
- var preferredPlacement = state.options.placement;
1091
- var basePlacement = getBasePlacement(preferredPlacement);
1092
- var isBasePlacement = basePlacement === preferredPlacement;
1093
- var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
1094
- var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
1095
- return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
1096
- placement: placement,
1097
- boundary: boundary,
1098
- rootBoundary: rootBoundary,
1099
- padding: padding,
1100
- flipVariations: flipVariations,
1101
- allowedAutoPlacements: allowedAutoPlacements
1102
- }) : placement);
1103
- }, []);
1104
- var referenceRect = state.rects.reference;
1105
- var popperRect = state.rects.popper;
1106
- var checksMap = new Map();
1107
- var makeFallbackChecks = true;
1108
- var firstFittingPlacement = placements[0];
1109
-
1110
- for (var i = 0; i < placements.length; i++) {
1111
- var placement = placements[i];
1112
-
1113
- var _basePlacement = getBasePlacement(placement);
1114
-
1115
- var isStartVariation = getVariation(placement) === start;
1116
- var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
1117
- var len = isVertical ? 'width' : 'height';
1118
- var overflow = detectOverflow(state, {
1119
- placement: placement,
1120
- boundary: boundary,
1121
- rootBoundary: rootBoundary,
1122
- altBoundary: altBoundary,
1123
- padding: padding
1124
- });
1125
- var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
1126
-
1127
- if (referenceRect[len] > popperRect[len]) {
1128
- mainVariationSide = getOppositePlacement(mainVariationSide);
1129
- }
1130
-
1131
- var altVariationSide = getOppositePlacement(mainVariationSide);
1132
- var checks = [];
1133
-
1134
- if (checkMainAxis) {
1135
- checks.push(overflow[_basePlacement] <= 0);
1136
- }
1137
-
1138
- if (checkAltAxis) {
1139
- checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
1140
- }
1141
-
1142
- if (checks.every(function (check) {
1143
- return check;
1144
- })) {
1145
- firstFittingPlacement = placement;
1146
- makeFallbackChecks = false;
1147
- break;
1148
- }
1149
-
1150
- checksMap.set(placement, checks);
1151
- }
1152
-
1153
- if (makeFallbackChecks) {
1154
- // `2` may be desired in some cases – research later
1155
- var numberOfChecks = flipVariations ? 3 : 1;
1156
-
1157
- var _loop = function _loop(_i) {
1158
- var fittingPlacement = placements.find(function (placement) {
1159
- var checks = checksMap.get(placement);
1160
-
1161
- if (checks) {
1162
- return checks.slice(0, _i).every(function (check) {
1163
- return check;
1164
- });
1165
- }
1166
- });
1167
-
1168
- if (fittingPlacement) {
1169
- firstFittingPlacement = fittingPlacement;
1170
- return "break";
1171
- }
1172
- };
1173
-
1174
- for (var _i = numberOfChecks; _i > 0; _i--) {
1175
- var _ret = _loop(_i);
1176
-
1177
- if (_ret === "break") break;
1178
- }
1179
- }
1180
-
1181
- if (state.placement !== firstFittingPlacement) {
1182
- state.modifiersData[name]._skip = true;
1183
- state.placement = firstFittingPlacement;
1184
- state.reset = true;
1185
- }
1186
- } // eslint-disable-next-line import/no-unused-modules
1187
-
1188
-
1189
- const flip$1 = {
1190
- name: 'flip',
1191
- enabled: true,
1192
- phase: 'main',
1193
- fn: flip,
1194
- requiresIfExists: ['offset'],
1195
- data: {
1196
- _skip: false
1197
- }
1198
- };
1199
-
1200
- function getSideOffsets(overflow, rect, preventedOffsets) {
1201
- if (preventedOffsets === void 0) {
1202
- preventedOffsets = {
1203
- x: 0,
1204
- y: 0
1205
- };
1206
- }
1207
-
1208
- return {
1209
- top: overflow.top - rect.height - preventedOffsets.y,
1210
- right: overflow.right - rect.width + preventedOffsets.x,
1211
- bottom: overflow.bottom - rect.height + preventedOffsets.y,
1212
- left: overflow.left - rect.width - preventedOffsets.x
1213
- };
1214
- }
1215
-
1216
- function isAnySideFullyClipped(overflow) {
1217
- return [top, right, bottom, left].some(function (side) {
1218
- return overflow[side] >= 0;
1219
- });
1220
- }
1221
-
1222
- function hide(_ref) {
1223
- var state = _ref.state,
1224
- name = _ref.name;
1225
- var referenceRect = state.rects.reference;
1226
- var popperRect = state.rects.popper;
1227
- var preventedOffsets = state.modifiersData.preventOverflow;
1228
- var referenceOverflow = detectOverflow(state, {
1229
- elementContext: 'reference'
1230
- });
1231
- var popperAltOverflow = detectOverflow(state, {
1232
- altBoundary: true
1233
- });
1234
- var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
1235
- var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
1236
- var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
1237
- var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
1238
- state.modifiersData[name] = {
1239
- referenceClippingOffsets: referenceClippingOffsets,
1240
- popperEscapeOffsets: popperEscapeOffsets,
1241
- isReferenceHidden: isReferenceHidden,
1242
- hasPopperEscaped: hasPopperEscaped
1243
- };
1244
- state.attributes.popper = Object.assign({}, state.attributes.popper, {
1245
- 'data-popper-reference-hidden': isReferenceHidden,
1246
- 'data-popper-escaped': hasPopperEscaped
1247
- });
1248
- } // eslint-disable-next-line import/no-unused-modules
1249
-
1250
-
1251
- const hide$1 = {
1252
- name: 'hide',
1253
- enabled: true,
1254
- phase: 'main',
1255
- requiresIfExists: ['preventOverflow'],
1256
- fn: hide
1257
- };
1258
-
1259
- function distanceAndSkiddingToXY(placement, rects, offset) {
1260
- var basePlacement = getBasePlacement(placement);
1261
- var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
1262
-
1263
- var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
1264
- placement: placement
1265
- })) : offset,
1266
- skidding = _ref[0],
1267
- distance = _ref[1];
1268
-
1269
- skidding = skidding || 0;
1270
- distance = (distance || 0) * invertDistance;
1271
- return [left, right].indexOf(basePlacement) >= 0 ? {
1272
- x: distance,
1273
- y: skidding
1274
- } : {
1275
- x: skidding,
1276
- y: distance
1277
- };
1278
- }
1279
-
1280
- function offset(_ref2) {
1281
- var state = _ref2.state,
1282
- options = _ref2.options,
1283
- name = _ref2.name;
1284
- var _options$offset = options.offset,
1285
- offset = _options$offset === void 0 ? [0, 0] : _options$offset;
1286
- var data = placements.reduce(function (acc, placement) {
1287
- acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
1288
- return acc;
1289
- }, {});
1290
- var _data$state$placement = data[state.placement],
1291
- x = _data$state$placement.x,
1292
- y = _data$state$placement.y;
1293
-
1294
- if (state.modifiersData.popperOffsets != null) {
1295
- state.modifiersData.popperOffsets.x += x;
1296
- state.modifiersData.popperOffsets.y += y;
1297
- }
1298
-
1299
- state.modifiersData[name] = data;
1300
- } // eslint-disable-next-line import/no-unused-modules
1301
-
1302
-
1303
- const offset$1 = {
1304
- name: 'offset',
1305
- enabled: true,
1306
- phase: 'main',
1307
- requires: ['popperOffsets'],
1308
- fn: offset
1309
- };
1310
-
1311
- function popperOffsets(_ref) {
1312
- var state = _ref.state,
1313
- name = _ref.name;
1314
- // Offsets are the actual position the popper needs to have to be
1315
- // properly positioned near its reference element
1316
- // This is the most basic placement, and will be adjusted by
1317
- // the modifiers in the next step
1318
- state.modifiersData[name] = computeOffsets({
1319
- reference: state.rects.reference,
1320
- element: state.rects.popper,
1321
- strategy: 'absolute',
1322
- placement: state.placement
1323
- });
1324
- } // eslint-disable-next-line import/no-unused-modules
1325
-
1326
-
1327
- const popperOffsets$1 = {
1328
- name: 'popperOffsets',
1329
- enabled: true,
1330
- phase: 'read',
1331
- fn: popperOffsets,
1332
- data: {}
1333
- };
1334
-
1335
- function getAltAxis(axis) {
1336
- return axis === 'x' ? 'y' : 'x';
1337
- }
1338
-
1339
- function preventOverflow(_ref) {
1340
- var state = _ref.state,
1341
- options = _ref.options,
1342
- name = _ref.name;
1343
- var _options$mainAxis = options.mainAxis,
1344
- checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1345
- _options$altAxis = options.altAxis,
1346
- checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
1347
- boundary = options.boundary,
1348
- rootBoundary = options.rootBoundary,
1349
- altBoundary = options.altBoundary,
1350
- padding = options.padding,
1351
- _options$tether = options.tether,
1352
- tether = _options$tether === void 0 ? true : _options$tether,
1353
- _options$tetherOffset = options.tetherOffset,
1354
- tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
1355
- var overflow = detectOverflow(state, {
1356
- boundary: boundary,
1357
- rootBoundary: rootBoundary,
1358
- padding: padding,
1359
- altBoundary: altBoundary
1360
- });
1361
- var basePlacement = getBasePlacement(state.placement);
1362
- var variation = getVariation(state.placement);
1363
- var isBasePlacement = !variation;
1364
- var mainAxis = getMainAxisFromPlacement(basePlacement);
1365
- var altAxis = getAltAxis(mainAxis);
1366
- var popperOffsets = state.modifiersData.popperOffsets;
1367
- var referenceRect = state.rects.reference;
1368
- var popperRect = state.rects.popper;
1369
- var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
1370
- placement: state.placement
1371
- })) : tetherOffset;
1372
- var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
1373
- mainAxis: tetherOffsetValue,
1374
- altAxis: tetherOffsetValue
1375
- } : Object.assign({
1376
- mainAxis: 0,
1377
- altAxis: 0
1378
- }, tetherOffsetValue);
1379
- var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
1380
- var data = {
1381
- x: 0,
1382
- y: 0
1383
- };
1384
-
1385
- if (!popperOffsets) {
1386
- return;
1387
- }
1388
-
1389
- if (checkMainAxis) {
1390
- var _offsetModifierState$;
1391
-
1392
- var mainSide = mainAxis === 'y' ? top : left;
1393
- var altSide = mainAxis === 'y' ? bottom : right;
1394
- var len = mainAxis === 'y' ? 'height' : 'width';
1395
- var offset = popperOffsets[mainAxis];
1396
- var min$1 = offset + overflow[mainSide];
1397
- var max$1 = offset - overflow[altSide];
1398
- var additive = tether ? -popperRect[len] / 2 : 0;
1399
- var minLen = variation === start ? referenceRect[len] : popperRect[len];
1400
- var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
1401
- // outside the reference bounds
1402
-
1403
- var arrowElement = state.elements.arrow;
1404
- var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
1405
- width: 0,
1406
- height: 0
1407
- };
1408
- var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
1409
- var arrowPaddingMin = arrowPaddingObject[mainSide];
1410
- var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
1411
- // to include its full size in the calculation. If the reference is small
1412
- // and near the edge of a boundary, the popper can overflow even if the
1413
- // reference is not overflowing as well (e.g. virtual elements with no
1414
- // width or height)
1415
-
1416
- var arrowLen = within(0, referenceRect[len], arrowRect[len]);
1417
- var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
1418
- var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
1419
- var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1420
- var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
1421
- var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
1422
- var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
1423
- var tetherMax = offset + maxOffset - offsetModifierValue;
1424
- var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
1425
- popperOffsets[mainAxis] = preventedOffset;
1426
- data[mainAxis] = preventedOffset - offset;
1427
- }
1428
-
1429
- if (checkAltAxis) {
1430
- var _offsetModifierState$2;
1431
-
1432
- var _mainSide = mainAxis === 'x' ? top : left;
1433
-
1434
- var _altSide = mainAxis === 'x' ? bottom : right;
1435
-
1436
- var _offset = popperOffsets[altAxis];
1437
-
1438
- var _len = altAxis === 'y' ? 'height' : 'width';
1439
-
1440
- var _min = _offset + overflow[_mainSide];
1441
-
1442
- var _max = _offset - overflow[_altSide];
1443
-
1444
- var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
1445
-
1446
- var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
1447
-
1448
- var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
1449
-
1450
- var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
1451
-
1452
- var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
1453
-
1454
- popperOffsets[altAxis] = _preventedOffset;
1455
- data[altAxis] = _preventedOffset - _offset;
1456
- }
1457
-
1458
- state.modifiersData[name] = data;
1459
- } // eslint-disable-next-line import/no-unused-modules
1460
-
1461
-
1462
- const preventOverflow$1 = {
1463
- name: 'preventOverflow',
1464
- enabled: true,
1465
- phase: 'main',
1466
- fn: preventOverflow,
1467
- requiresIfExists: ['offset']
1468
- };
1469
-
1470
- function getHTMLElementScroll(element) {
1471
- return {
1472
- scrollLeft: element.scrollLeft,
1473
- scrollTop: element.scrollTop
1474
- };
1475
- }
1476
-
1477
- function getNodeScroll(node) {
1478
- if (node === getWindow(node) || !isHTMLElement(node)) {
1479
- return getWindowScroll(node);
1480
- } else {
1481
- return getHTMLElementScroll(node);
1482
- }
1483
- }
1484
-
1485
- function isElementScaled(element) {
1486
- var rect = element.getBoundingClientRect();
1487
- var scaleX = round(rect.width) / element.offsetWidth || 1;
1488
- var scaleY = round(rect.height) / element.offsetHeight || 1;
1489
- return scaleX !== 1 || scaleY !== 1;
1490
- } // Returns the composite rect of an element relative to its offsetParent.
1491
- // Composite means it takes into account transforms as well as layout.
1492
-
1493
-
1494
- function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1495
- if (isFixed === void 0) {
1496
- isFixed = false;
1497
- }
1498
-
1499
- var isOffsetParentAnElement = isHTMLElement(offsetParent);
1500
- var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
1501
- var documentElement = getDocumentElement(offsetParent);
1502
- var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
1503
- var scroll = {
1504
- scrollLeft: 0,
1505
- scrollTop: 0
1506
- };
1507
- var offsets = {
1508
- x: 0,
1509
- y: 0
1510
- };
1511
-
1512
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1513
- if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
1514
- isScrollParent(documentElement)) {
1515
- scroll = getNodeScroll(offsetParent);
1516
- }
1517
-
1518
- if (isHTMLElement(offsetParent)) {
1519
- offsets = getBoundingClientRect(offsetParent, true);
1520
- offsets.x += offsetParent.clientLeft;
1521
- offsets.y += offsetParent.clientTop;
1522
- } else if (documentElement) {
1523
- offsets.x = getWindowScrollBarX(documentElement);
1524
- }
1525
- }
1526
-
1527
- return {
1528
- x: rect.left + scroll.scrollLeft - offsets.x,
1529
- y: rect.top + scroll.scrollTop - offsets.y,
1530
- width: rect.width,
1531
- height: rect.height
1532
- };
1533
- }
1534
-
1535
- function order(modifiers) {
1536
- var map = new Map();
1537
- var visited = new Set();
1538
- var result = [];
1539
- modifiers.forEach(function (modifier) {
1540
- map.set(modifier.name, modifier);
1541
- }); // On visiting object, check for its dependencies and visit them recursively
1542
-
1543
- function sort(modifier) {
1544
- visited.add(modifier.name);
1545
- var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
1546
- requires.forEach(function (dep) {
1547
- if (!visited.has(dep)) {
1548
- var depModifier = map.get(dep);
1549
-
1550
- if (depModifier) {
1551
- sort(depModifier);
1552
- }
1553
- }
1554
- });
1555
- result.push(modifier);
1556
- }
1557
-
1558
- modifiers.forEach(function (modifier) {
1559
- if (!visited.has(modifier.name)) {
1560
- // check for visited object
1561
- sort(modifier);
1562
- }
1563
- });
1564
- return result;
1565
- }
1566
-
1567
- function orderModifiers(modifiers) {
1568
- // order based on dependencies
1569
- var orderedModifiers = order(modifiers); // order based on phase
1570
-
1571
- return modifierPhases.reduce(function (acc, phase) {
1572
- return acc.concat(orderedModifiers.filter(function (modifier) {
1573
- return modifier.phase === phase;
1574
- }));
1575
- }, []);
1576
- }
1577
-
1578
- function debounce(fn) {
1579
- var pending;
1580
- return function () {
1581
- if (!pending) {
1582
- pending = new Promise(function (resolve) {
1583
- Promise.resolve().then(function () {
1584
- pending = undefined;
1585
- resolve(fn());
1586
- });
1587
- });
1588
- }
1589
-
1590
- return pending;
1591
- };
1592
- }
1593
-
1594
- function mergeByName(modifiers) {
1595
- var merged = modifiers.reduce(function (merged, current) {
1596
- var existing = merged[current.name];
1597
- merged[current.name] = existing ? Object.assign({}, existing, current, {
1598
- options: Object.assign({}, existing.options, current.options),
1599
- data: Object.assign({}, existing.data, current.data)
1600
- }) : current;
1601
- return merged;
1602
- }, {}); // IE11 does not support Object.values
1603
-
1604
- return Object.keys(merged).map(function (key) {
1605
- return merged[key];
1606
- });
1607
- }
1608
-
1609
- var DEFAULT_OPTIONS = {
1610
- placement: 'bottom',
1611
- modifiers: [],
1612
- strategy: 'absolute'
1613
- };
1614
-
1615
- function areValidElements() {
1616
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1617
- args[_key] = arguments[_key];
1618
- }
1619
-
1620
- return !args.some(function (element) {
1621
- return !(element && typeof element.getBoundingClientRect === 'function');
1622
- });
1623
- }
1624
-
1625
- function popperGenerator(generatorOptions) {
1626
- if (generatorOptions === void 0) {
1627
- generatorOptions = {};
1628
- }
1629
-
1630
- var _generatorOptions = generatorOptions,
1631
- _generatorOptions$def = _generatorOptions.defaultModifiers,
1632
- defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
1633
- _generatorOptions$def2 = _generatorOptions.defaultOptions,
1634
- defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
1635
- return function createPopper(reference, popper, options) {
1636
- if (options === void 0) {
1637
- options = defaultOptions;
1638
- }
1639
-
1640
- var state = {
1641
- placement: 'bottom',
1642
- orderedModifiers: [],
1643
- options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
1644
- modifiersData: {},
1645
- elements: {
1646
- reference: reference,
1647
- popper: popper
1648
- },
1649
- attributes: {},
1650
- styles: {}
1651
- };
1652
- var effectCleanupFns = [];
1653
- var isDestroyed = false;
1654
- var instance = {
1655
- state: state,
1656
- setOptions: function setOptions(setOptionsAction) {
1657
- var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
1658
- cleanupModifierEffects();
1659
- state.options = Object.assign({}, defaultOptions, state.options, options);
1660
- state.scrollParents = {
1661
- reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
1662
- popper: listScrollParents(popper)
1663
- }; // Orders the modifiers based on their dependencies and `phase`
1664
- // properties
1665
-
1666
- var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
1667
-
1668
- state.orderedModifiers = orderedModifiers.filter(function (m) {
1669
- return m.enabled;
1670
- }); // Validate the provided modifiers so that the consumer will get warned
1671
-
1672
- runModifierEffects();
1673
- return instance.update();
1674
- },
1675
- // Sync update – it will always be executed, even if not necessary. This
1676
- // is useful for low frequency updates where sync behavior simplifies the
1677
- // logic.
1678
- // For high frequency updates (e.g. `resize` and `scroll` events), always
1679
- // prefer the async Popper#update method
1680
- forceUpdate: function forceUpdate() {
1681
- if (isDestroyed) {
1682
- return;
1683
- }
1684
-
1685
- var _state$elements = state.elements,
1686
- reference = _state$elements.reference,
1687
- popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
1688
- // anymore
1689
-
1690
- if (!areValidElements(reference, popper)) {
1691
-
1692
- return;
1693
- } // Store the reference and popper rects to be read by modifiers
1694
-
1695
-
1696
- state.rects = {
1697
- reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
1698
- popper: getLayoutRect(popper)
1699
- }; // Modifiers have the ability to reset the current update cycle. The
1700
- // most common use case for this is the `flip` modifier changing the
1701
- // placement, which then needs to re-run all the modifiers, because the
1702
- // logic was previously ran for the previous placement and is therefore
1703
- // stale/incorrect
1704
-
1705
- state.reset = false;
1706
- state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
1707
- // is filled with the initial data specified by the modifier. This means
1708
- // it doesn't persist and is fresh on each update.
1709
- // To ensure persistent data, use `${name}#persistent`
1710
-
1711
- state.orderedModifiers.forEach(function (modifier) {
1712
- return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
1713
- });
1714
-
1715
- for (var index = 0; index < state.orderedModifiers.length; index++) {
1716
-
1717
- if (state.reset === true) {
1718
- state.reset = false;
1719
- index = -1;
1720
- continue;
1721
- }
1722
-
1723
- var _state$orderedModifie = state.orderedModifiers[index],
1724
- fn = _state$orderedModifie.fn,
1725
- _state$orderedModifie2 = _state$orderedModifie.options,
1726
- _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
1727
- name = _state$orderedModifie.name;
1728
-
1729
- if (typeof fn === 'function') {
1730
- state = fn({
1731
- state: state,
1732
- options: _options,
1733
- name: name,
1734
- instance: instance
1735
- }) || state;
1736
- }
1737
- }
1738
- },
1739
- // Async and optimistically optimized update – it will not be executed if
1740
- // not necessary (debounced to run at most once-per-tick)
1741
- update: debounce(function () {
1742
- return new Promise(function (resolve) {
1743
- instance.forceUpdate();
1744
- resolve(state);
1745
- });
1746
- }),
1747
- destroy: function destroy() {
1748
- cleanupModifierEffects();
1749
- isDestroyed = true;
1750
- }
1751
- };
1752
-
1753
- if (!areValidElements(reference, popper)) {
1754
-
1755
- return instance;
1756
- }
1757
-
1758
- instance.setOptions(options).then(function (state) {
1759
- if (!isDestroyed && options.onFirstUpdate) {
1760
- options.onFirstUpdate(state);
1761
- }
1762
- }); // Modifiers have the ability to execute arbitrary code before the first
1763
- // update cycle runs. They will be executed in the same order as the update
1764
- // cycle. This is useful when a modifier adds some persistent data that
1765
- // other modifiers need to use, but the modifier is run after the dependent
1766
- // one.
1767
-
1768
- function runModifierEffects() {
1769
- state.orderedModifiers.forEach(function (_ref3) {
1770
- var name = _ref3.name,
1771
- _ref3$options = _ref3.options,
1772
- options = _ref3$options === void 0 ? {} : _ref3$options,
1773
- effect = _ref3.effect;
1774
-
1775
- if (typeof effect === 'function') {
1776
- var cleanupFn = effect({
1777
- state: state,
1778
- name: name,
1779
- instance: instance,
1780
- options: options
1781
- });
1782
-
1783
- var noopFn = function noopFn() {};
1784
-
1785
- effectCleanupFns.push(cleanupFn || noopFn);
1786
- }
1787
- });
1788
- }
1789
-
1790
- function cleanupModifierEffects() {
1791
- effectCleanupFns.forEach(function (fn) {
1792
- return fn();
1793
- });
1794
- effectCleanupFns = [];
1795
- }
1796
-
1797
- return instance;
1798
- };
1799
- }
1800
-
1801
- var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
1802
- var createPopper = /*#__PURE__*/popperGenerator({
1803
- defaultModifiers: defaultModifiers
1804
- }); // eslint-disable-next-line import/no-unused-modules
1805
-
1806
9
  var maxSize = {
1807
10
  name: 'maxSize',
1808
11
  enabled: true,
@@ -1812,7 +15,7 @@ var maxSize = {
1812
15
  var state = _ref.state,
1813
16
  name = _ref.name,
1814
17
  options = _ref.options;
1815
- var overflow = detectOverflow(state, options);
18
+ var overflow = popper.detectOverflow(state, options);
1816
19
 
1817
20
  var _ref2 = state.modifiersData.preventOverflow || {
1818
21
  x: 0,
@@ -1854,7 +57,7 @@ const Tooltip = class {
1854
57
  this.applyMaxSize = {
1855
58
  name: "applyMaxSize",
1856
59
  enabled: true,
1857
- phase: beforeWrite,
60
+ phase: popper.beforeWrite,
1858
61
  requires: ["maxSize"],
1859
62
  fn({ state }) {
1860
63
  let { width } = state.modifiersData.maxSize;
@@ -1965,7 +168,7 @@ const Tooltip = class {
1965
168
  throw new Error("Unable to find reference tooltip has no [id] attribute.");
1966
169
  }
1967
170
  this.target = this.getTarget(this.element.id);
1968
- this.popper = createPopper(this.target, tooltip, {
171
+ this.popper = popper.createPopper(this.target, tooltip, {
1969
172
  placement: this.position,
1970
173
  modifiers: [maxSize, this.applyMaxSize],
1971
174
  });