@lumx/react 3.20.1-alpha.36 → 3.20.1-alpha.38

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 (106) hide show
  1. package/index.d.ts +4 -15
  2. package/index.js +13966 -64
  3. package/index.js.map +1 -0
  4. package/package.json +3 -3
  5. package/utils/index.js +159 -3
  6. package/utils/index.js.map +1 -0
  7. package/_internal/035c132d.js +0 -314
  8. package/_internal/0b9c76cb.js +0 -5
  9. package/_internal/0ea95af1.js +0 -819
  10. package/_internal/230173a8.js +0 -12
  11. package/_internal/2a3d237c.js +0 -11
  12. package/_internal/2c2b6a89.js +0 -51
  13. package/_internal/3181f000.js +0 -13
  14. package/_internal/36bd7352.js +0 -218
  15. package/_internal/3864a6c1.js +0 -436
  16. package/_internal/3a1facc0.js +0 -17
  17. package/_internal/49bbeed3.js +0 -5
  18. package/_internal/4daccdd5.js +0 -24
  19. package/_internal/4f4c0582.js +0 -2169
  20. package/_internal/5cef5e8c.js +0 -74
  21. package/_internal/6a60381c.js +0 -117
  22. package/_internal/6f084a40.js +0 -111
  23. package/_internal/76ddefd4.js +0 -61
  24. package/_internal/78df9309.js +0 -19
  25. package/_internal/7ad474e4.js +0 -98
  26. package/_internal/7b293665.js +0 -19
  27. package/_internal/7daf0f24.js +0 -76
  28. package/_internal/825ac334.js +0 -129
  29. package/_internal/827b804a.js +0 -5
  30. package/_internal/8bce732e.js +0 -8
  31. package/_internal/9d1336a1.js +0 -18
  32. package/_internal/a38bdcd0.js +0 -49
  33. package/_internal/b326655a.js +0 -682
  34. package/_internal/b83e864b.js +0 -76
  35. package/_internal/bace1bf1.js +0 -103
  36. package/_internal/c57190eb.js +0 -146
  37. package/_internal/components/alert-dialog/index-284fed80.js +0 -163
  38. package/_internal/components/autocomplete/__mockData__/index-96fc7ea7.js +0 -27
  39. package/_internal/components/autocomplete/index-27a49d5d.js +0 -261
  40. package/_internal/components/avatar/index-b8bc3cae.js +0 -83
  41. package/_internal/components/badge/index-9880f056.js +0 -81
  42. package/_internal/components/button/index-d919f96d.js +0 -47
  43. package/_internal/components/checkbox/index-dd478de9.js +0 -143
  44. package/_internal/components/chip/index-7f84cdbd.js +0 -102
  45. package/_internal/components/comment-block/index-e942de30.js +0 -138
  46. package/_internal/components/date-picker/index-a258d3ce.js +0 -596
  47. package/_internal/components/dialog/index-c7066813.js +0 -238
  48. package/_internal/components/divider/index-b6934baf.js +0 -50
  49. package/_internal/components/drag-handle/index-80e5af6c.js +0 -52
  50. package/_internal/components/dropdown/index-cebfc268.js +0 -147
  51. package/_internal/components/expansion-panel/index-9d45a211.js +0 -167
  52. package/_internal/components/flag/index-33e9d909.js +0 -59
  53. package/_internal/components/flex-box/index-0d6b6b43.js +0 -56
  54. package/_internal/components/generic-block/index-836c4352.js +0 -124
  55. package/_internal/components/grid/index-8c16a4f1.js +0 -104
  56. package/_internal/components/grid-column/index-4a2f56bb.js +0 -59
  57. package/_internal/components/heading/index-fd558a9a.js +0 -53
  58. package/_internal/components/icon/index-e7b9b40e.js +0 -1
  59. package/_internal/components/image-block/index-7021c2f1.js +0 -110
  60. package/_internal/components/image-lightbox/index-27017547.js +0 -759
  61. package/_internal/components/inline-list/index-52efec7f.js +0 -74
  62. package/_internal/components/input-helper/index-5a837e7c.js +0 -71
  63. package/_internal/components/input-label/index-0113f382.js +0 -59
  64. package/_internal/components/lightbox/index-fad5a9f2.js +0 -155
  65. package/_internal/components/link/index-008bae4b.js +0 -72
  66. package/_internal/components/link-preview/index-3e9c32f2.js +0 -117
  67. package/_internal/components/list/index-da88c6e9.js +0 -71
  68. package/_internal/components/message/index-17b568f2.js +0 -98
  69. package/_internal/components/mosaic/index-2d40e01c.js +0 -95
  70. package/_internal/components/navigation/index-dc17c639.js +0 -225
  71. package/_internal/components/notification/index-a1101015.js +0 -146
  72. package/_internal/components/popover/index-dbca63f1.js +0 -2
  73. package/_internal/components/popover-dialog/index-654d2abc.js +0 -66
  74. package/_internal/components/post-block/index-4b6b4dcb.js +0 -109
  75. package/_internal/components/progress/index-6f578c31.js +0 -182
  76. package/_internal/components/progress-tracker/index-700bc4c2.js +0 -309
  77. package/_internal/components/radio-button/index-89b725af.js +0 -149
  78. package/_internal/components/select/index-2755aa32.js +0 -458
  79. package/_internal/components/side-navigation/index-0bbe1fdd.js +0 -165
  80. package/_internal/components/skeleton/index-b2f8501c.js +0 -166
  81. package/_internal/components/slider/index-4f9b891b.js +0 -311
  82. package/_internal/components/slideshow/index-d4604589.js +0 -150
  83. package/_internal/components/switch/index-58fe0f0c.js +0 -122
  84. package/_internal/components/table/index-d541aa88.js +0 -297
  85. package/_internal/components/tabs/index-af1538d6.js +0 -298
  86. package/_internal/components/text/index-5bfc6d5e.js +0 -1
  87. package/_internal/components/text-field/index-47c98d09.js +0 -360
  88. package/_internal/components/thumbnail/index-71545d95.js +0 -41
  89. package/_internal/components/toolbar/index-7041a5a6.js +0 -61
  90. package/_internal/components/tooltip/index-8bb97e60.js +0 -327
  91. package/_internal/components/uploader/index-8f6f55de.js +0 -153
  92. package/_internal/components/user-block/index-70d4ce8f.js +0 -145
  93. package/_internal/d0e3f49e.js +0 -23
  94. package/_internal/de24f857.js +0 -3
  95. package/_internal/e806b848.js +0 -8
  96. package/_internal/e913a3af.js +0 -117
  97. package/_internal/ea04260d.js +0 -28
  98. package/_internal/eaf6c45a.js +0 -3
  99. package/_internal/ebdcb0c7.js +0 -60
  100. package/_internal/ef5d1aac.js +0 -3
  101. package/_internal/f0d7d6ea.js +0 -29
  102. package/_internal/utils/ClickAwayProvider/index-1234ce76.js +0 -94
  103. package/_internal/utils/MaterialThemeSwitcher/index-8d22de5a.js +0 -48
  104. package/_internal/utils/Portal/index-6e0a7404.js +0 -44
  105. package/_internal/utils/disabled/index-075b99c3.js +0 -36
  106. package/_internal/utils/type/index-ea9fc197.js +0 -2
@@ -1,2169 +0,0 @@
1
- import * as React from 'react';
2
- import { I as IS_BROWSER } from './d0e3f49e.js';
3
-
4
- function getDefaultExportFromCjs (x) {
5
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
6
- }
7
-
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
- /*:: import type { Window } from '../types'; */
45
-
46
- /*:: declare function getWindow(node: Node | Window): Window; */
47
- function getWindow(node) {
48
- if (node.toString() !== '[object Window]') {
49
- var ownerDocument = node.ownerDocument;
50
- return ownerDocument ? ownerDocument.defaultView || window : window;
51
- }
52
-
53
- return node;
54
- }
55
-
56
- /*:: declare function isElement(node: mixed): boolean %checks(node instanceof
57
- Element); */
58
-
59
- function isElement(node) {
60
- var OwnElement = getWindow(node).Element;
61
- return node instanceof OwnElement || node instanceof Element;
62
- }
63
- /*:: declare function isHTMLElement(node: mixed): boolean %checks(node instanceof
64
- HTMLElement); */
65
-
66
-
67
- function isHTMLElement(node) {
68
- var OwnElement = getWindow(node).HTMLElement;
69
- return node instanceof OwnElement || node instanceof HTMLElement;
70
- }
71
- /*:: declare function isShadowRoot(node: mixed): boolean %checks(node instanceof
72
- ShadowRoot); */
73
-
74
-
75
- function isShadowRoot(node) {
76
- var OwnElement = getWindow(node).ShadowRoot;
77
- return node instanceof OwnElement || node instanceof ShadowRoot;
78
- }
79
-
80
- // and applies them to the HTMLElements such as popper and arrow
81
-
82
- function applyStyles(_ref) {
83
- var state = _ref.state;
84
- Object.keys(state.elements).forEach(function (name) {
85
- var style = state.styles[name] || {};
86
- var attributes = state.attributes[name] || {};
87
- var element = state.elements[name]; // arrow is optional + virtual elements
88
-
89
- if (!isHTMLElement(element) || !getNodeName(element)) {
90
- return;
91
- } // Flow doesn't support to extend this property, but it's the most
92
- // effective way to apply styles to an HTMLElement
93
- // $FlowFixMe
94
-
95
-
96
- Object.assign(element.style, style);
97
- Object.keys(attributes).forEach(function (name) {
98
- var value = attributes[name];
99
-
100
- if (value === false) {
101
- element.removeAttribute(name);
102
- } else {
103
- element.setAttribute(name, value === true ? '' : value);
104
- }
105
- });
106
- });
107
- }
108
-
109
- function effect$2(_ref2) {
110
- var state = _ref2.state;
111
- var initialStyles = {
112
- popper: {
113
- position: state.options.strategy,
114
- left: '0',
115
- top: '0',
116
- margin: '0'
117
- },
118
- arrow: {
119
- position: 'absolute'
120
- },
121
- reference: {}
122
- };
123
- Object.assign(state.elements.popper.style, initialStyles.popper);
124
-
125
- if (state.elements.arrow) {
126
- Object.assign(state.elements.arrow.style, initialStyles.arrow);
127
- }
128
-
129
- return function () {
130
- Object.keys(state.elements).forEach(function (name) {
131
- var element = state.elements[name];
132
- var attributes = state.attributes[name] || {};
133
- var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
134
-
135
- var style = styleProperties.reduce(function (style, property) {
136
- style[property] = '';
137
- return style;
138
- }, {}); // arrow is optional + virtual elements
139
-
140
- if (!isHTMLElement(element) || !getNodeName(element)) {
141
- return;
142
- } // Flow doesn't support to extend this property, but it's the most
143
- // effective way to apply styles to an HTMLElement
144
- // $FlowFixMe
145
-
146
-
147
- Object.assign(element.style, style);
148
- Object.keys(attributes).forEach(function (attribute) {
149
- element.removeAttribute(attribute);
150
- });
151
- });
152
- };
153
- } // eslint-disable-next-line import/no-unused-modules
154
-
155
-
156
- var applyStyles$1 = {
157
- name: 'applyStyles',
158
- enabled: true,
159
- phase: 'write',
160
- fn: applyStyles,
161
- effect: effect$2,
162
- requires: ['computeStyles']
163
- };
164
-
165
- function getBasePlacement(placement) {
166
- return placement.split('-')[0];
167
- }
168
-
169
- // Returns the layout rect of an element relative to its offsetParent. Layout
170
- // means it doesn't take into account transforms.
171
- function getLayoutRect(element) {
172
- return {
173
- x: element.offsetLeft,
174
- y: element.offsetTop,
175
- width: element.offsetWidth,
176
- height: element.offsetHeight
177
- };
178
- }
179
-
180
- function contains(parent, child) {
181
- var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
182
-
183
- if (parent.contains(child)) {
184
- return true;
185
- } // then fallback to custom implementation with Shadow DOM support
186
- else if (rootNode && isShadowRoot(rootNode)) {
187
- var next = child;
188
-
189
- do {
190
- if (next && parent.isSameNode(next)) {
191
- return true;
192
- } // $FlowFixMe: need a better way to handle this...
193
-
194
-
195
- next = next.parentNode || next.host;
196
- } while (next);
197
- } // Give up, the result is false
198
-
199
-
200
- return false;
201
- }
202
-
203
- function getComputedStyle(element) {
204
- return getWindow(element).getComputedStyle(element);
205
- }
206
-
207
- function isTableElement(element) {
208
- return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
209
- }
210
-
211
- function getDocumentElement(element) {
212
- // $FlowFixMe: assume body is always available
213
- return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
214
- }
215
-
216
- function getParentNode(element) {
217
- if (getNodeName(element) === 'html') {
218
- return element;
219
- }
220
-
221
- return (// $FlowFixMe: this is a quicker (but less type safe) way to save quite some bytes from the bundle
222
- element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
223
- element.parentNode || // DOM Element detected
224
- // $FlowFixMe: need a better way to handle this...
225
- element.host || // ShadowRoot detected
226
- // $FlowFixMe: HTMLElement is a Node
227
- getDocumentElement(element) // fallback
228
-
229
- );
230
- }
231
-
232
- function getTrueOffsetParent(element) {
233
- if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
234
- getComputedStyle(element).position === 'fixed') {
235
- return null;
236
- }
237
-
238
- var offsetParent = element.offsetParent;
239
-
240
- if (offsetParent) {
241
- var html = getDocumentElement(offsetParent);
242
-
243
- if (getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && getComputedStyle(html).position !== 'static') {
244
- return html;
245
- }
246
- }
247
-
248
- return offsetParent;
249
- } // `.offsetParent` reports `null` for fixed elements, while absolute elements
250
- // return the containing block
251
-
252
-
253
- function getContainingBlock(element) {
254
- var currentNode = getParentNode(element);
255
-
256
- while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
257
- var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
258
- // create a containing block.
259
-
260
- if (css.transform !== 'none' || css.perspective !== 'none' || css.willChange && css.willChange !== 'auto') {
261
- return currentNode;
262
- } else {
263
- currentNode = currentNode.parentNode;
264
- }
265
- }
266
-
267
- return null;
268
- } // Gets the closest ancestor positioned element. Handles some edge cases,
269
- // such as table ancestors and cross browser bugs.
270
-
271
-
272
- function getOffsetParent(element) {
273
- var window = getWindow(element);
274
- var offsetParent = getTrueOffsetParent(element);
275
-
276
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
277
- offsetParent = getTrueOffsetParent(offsetParent);
278
- }
279
-
280
- if (offsetParent && getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static') {
281
- return window;
282
- }
283
-
284
- return offsetParent || getContainingBlock(element) || window;
285
- }
286
-
287
- function getMainAxisFromPlacement(placement) {
288
- return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
289
- }
290
-
291
- function within(min, value, max) {
292
- return Math.max(min, Math.min(value, max));
293
- }
294
-
295
- function getFreshSideObject() {
296
- return {
297
- top: 0,
298
- right: 0,
299
- bottom: 0,
300
- left: 0
301
- };
302
- }
303
-
304
- function mergePaddingObject(paddingObject) {
305
- return Object.assign(Object.assign({}, getFreshSideObject()), paddingObject);
306
- }
307
-
308
- function expandToHashMap(value, keys) {
309
- return keys.reduce(function (hashMap, key) {
310
- hashMap[key] = value;
311
- return hashMap;
312
- }, {});
313
- }
314
-
315
- function arrow(_ref) {
316
- var _state$modifiersData$;
317
-
318
- var state = _ref.state,
319
- name = _ref.name;
320
- var arrowElement = state.elements.arrow;
321
- var popperOffsets = state.modifiersData.popperOffsets;
322
- var basePlacement = getBasePlacement(state.placement);
323
- var axis = getMainAxisFromPlacement(basePlacement);
324
- var isVertical = [left, right].indexOf(basePlacement) >= 0;
325
- var len = isVertical ? 'height' : 'width';
326
-
327
- if (!arrowElement || !popperOffsets) {
328
- return;
329
- }
330
-
331
- var paddingObject = state.modifiersData[name + "#persistent"].padding;
332
- var arrowRect = getLayoutRect(arrowElement);
333
- var minProp = axis === 'y' ? top : left;
334
- var maxProp = axis === 'y' ? bottom : right;
335
- var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
336
- var startDiff = popperOffsets[axis] - state.rects.reference[axis];
337
- var arrowOffsetParent = getOffsetParent(arrowElement);
338
- var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
339
- var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
340
- // outside of the popper bounds
341
-
342
- var min = paddingObject[minProp];
343
- var max = clientSize - arrowRect[len] - paddingObject[maxProp];
344
- var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
345
- var offset = within(min, center, max); // Prevents breaking syntax highlighting...
346
-
347
- var axisProp = axis;
348
- state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
349
- }
350
-
351
- function effect$1(_ref2) {
352
- var state = _ref2.state,
353
- options = _ref2.options,
354
- name = _ref2.name;
355
- var _options$element = options.element,
356
- arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element,
357
- _options$padding = options.padding,
358
- padding = _options$padding === void 0 ? 0 : _options$padding;
359
-
360
- if (arrowElement == null) {
361
- return;
362
- } // CSS selector
363
-
364
-
365
- if (typeof arrowElement === 'string') {
366
- arrowElement = state.elements.popper.querySelector(arrowElement);
367
-
368
- if (!arrowElement) {
369
- return;
370
- }
371
- }
372
-
373
- if (process.env.NODE_ENV !== "production") {
374
- if (!isHTMLElement(arrowElement)) {
375
- console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).', 'To use an SVG arrow, wrap it in an HTMLElement that will be used as', 'the arrow.'].join(' '));
376
- }
377
- }
378
-
379
- if (!contains(state.elements.popper, arrowElement)) {
380
- if (process.env.NODE_ENV !== "production") {
381
- console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', 'element.'].join(' '));
382
- }
383
-
384
- return;
385
- }
386
-
387
- state.elements.arrow = arrowElement;
388
- state.modifiersData[name + "#persistent"] = {
389
- padding: mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements))
390
- };
391
- } // eslint-disable-next-line import/no-unused-modules
392
-
393
-
394
- var arrow$1 = {
395
- name: 'arrow',
396
- enabled: true,
397
- phase: 'main',
398
- fn: arrow,
399
- effect: effect$1,
400
- requires: ['popperOffsets'],
401
- requiresIfExists: ['preventOverflow']
402
- };
403
-
404
- var unsetSides = {
405
- top: 'auto',
406
- right: 'auto',
407
- bottom: 'auto',
408
- left: 'auto'
409
- }; // Round the offsets to the nearest suitable subpixel based on the DPR.
410
- // Zooming can change the DPR, but it seems to report a value that will
411
- // cleanly divide the values into the appropriate subpixels.
412
-
413
- function roundOffsets(_ref) {
414
- var x = _ref.x,
415
- y = _ref.y;
416
- var win = window;
417
- var dpr = win.devicePixelRatio || 1;
418
- return {
419
- x: Math.round(x * dpr) / dpr || 0,
420
- y: Math.round(y * dpr) / dpr || 0
421
- };
422
- }
423
-
424
- function mapToStyles(_ref2) {
425
- var _Object$assign2;
426
-
427
- var popper = _ref2.popper,
428
- popperRect = _ref2.popperRect,
429
- placement = _ref2.placement,
430
- offsets = _ref2.offsets,
431
- position = _ref2.position,
432
- gpuAcceleration = _ref2.gpuAcceleration,
433
- adaptive = _ref2.adaptive;
434
-
435
- var _roundOffsets = roundOffsets(offsets),
436
- x = _roundOffsets.x,
437
- y = _roundOffsets.y;
438
-
439
- var hasX = offsets.hasOwnProperty('x');
440
- var hasY = offsets.hasOwnProperty('y');
441
- var sideX = left;
442
- var sideY = top;
443
- var win = window;
444
-
445
- if (adaptive) {
446
- var offsetParent = getOffsetParent(popper);
447
-
448
- if (offsetParent === getWindow(popper)) {
449
- offsetParent = getDocumentElement(popper);
450
- } // $FlowFixMe: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
451
-
452
- /*:: offsetParent = (offsetParent: Element); */
453
-
454
-
455
- if (placement === top) {
456
- sideY = bottom;
457
- y -= offsetParent.clientHeight - popperRect.height;
458
- y *= gpuAcceleration ? 1 : -1;
459
- }
460
-
461
- if (placement === left) {
462
- sideX = right;
463
- x -= offsetParent.clientWidth - popperRect.width;
464
- x *= gpuAcceleration ? 1 : -1;
465
- }
466
- }
467
-
468
- var commonStyles = Object.assign({
469
- position: position
470
- }, adaptive && unsetSides);
471
-
472
- if (gpuAcceleration) {
473
- var _Object$assign;
474
-
475
- return Object.assign(Object.assign({}, commonStyles), {}, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
476
- }
477
-
478
- return Object.assign(Object.assign({}, commonStyles), {}, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
479
- }
480
-
481
- function computeStyles(_ref3) {
482
- var state = _ref3.state,
483
- options = _ref3.options;
484
- var _options$gpuAccelerat = options.gpuAcceleration,
485
- gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
486
- _options$adaptive = options.adaptive,
487
- adaptive = _options$adaptive === void 0 ? true : _options$adaptive;
488
-
489
- if (process.env.NODE_ENV !== "production") {
490
- var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || '';
491
-
492
- if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {
493
- return transitionProperty.indexOf(property) >= 0;
494
- })) {
495
- 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(' '));
496
- }
497
- }
498
-
499
- var commonStyles = {
500
- placement: getBasePlacement(state.placement),
501
- popper: state.elements.popper,
502
- popperRect: state.rects.popper,
503
- gpuAcceleration: gpuAcceleration
504
- };
505
-
506
- if (state.modifiersData.popperOffsets != null) {
507
- state.styles.popper = Object.assign(Object.assign({}, state.styles.popper), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
508
- offsets: state.modifiersData.popperOffsets,
509
- position: state.options.strategy,
510
- adaptive: adaptive
511
- })));
512
- }
513
-
514
- if (state.modifiersData.arrow != null) {
515
- state.styles.arrow = Object.assign(Object.assign({}, state.styles.arrow), mapToStyles(Object.assign(Object.assign({}, commonStyles), {}, {
516
- offsets: state.modifiersData.arrow,
517
- position: 'absolute',
518
- adaptive: false
519
- })));
520
- }
521
-
522
- state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
523
- 'data-popper-placement': state.placement
524
- });
525
- } // eslint-disable-next-line import/no-unused-modules
526
-
527
-
528
- var computeStyles$1 = {
529
- name: 'computeStyles',
530
- enabled: true,
531
- phase: 'beforeWrite',
532
- fn: computeStyles,
533
- data: {}
534
- };
535
-
536
- var passive = {
537
- passive: true
538
- };
539
-
540
- function effect(_ref) {
541
- var state = _ref.state,
542
- instance = _ref.instance,
543
- options = _ref.options;
544
- var _options$scroll = options.scroll,
545
- scroll = _options$scroll === void 0 ? true : _options$scroll,
546
- _options$resize = options.resize,
547
- resize = _options$resize === void 0 ? true : _options$resize;
548
- var window = getWindow(state.elements.popper);
549
- var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
550
-
551
- if (scroll) {
552
- scrollParents.forEach(function (scrollParent) {
553
- scrollParent.addEventListener('scroll', instance.update, passive);
554
- });
555
- }
556
-
557
- if (resize) {
558
- window.addEventListener('resize', instance.update, passive);
559
- }
560
-
561
- return function () {
562
- if (scroll) {
563
- scrollParents.forEach(function (scrollParent) {
564
- scrollParent.removeEventListener('scroll', instance.update, passive);
565
- });
566
- }
567
-
568
- if (resize) {
569
- window.removeEventListener('resize', instance.update, passive);
570
- }
571
- };
572
- } // eslint-disable-next-line import/no-unused-modules
573
-
574
-
575
- var eventListeners = {
576
- name: 'eventListeners',
577
- enabled: true,
578
- phase: 'write',
579
- fn: function fn() {},
580
- effect: effect,
581
- data: {}
582
- };
583
-
584
- var hash$1 = {
585
- left: 'right',
586
- right: 'left',
587
- bottom: 'top',
588
- top: 'bottom'
589
- };
590
- function getOppositePlacement(placement) {
591
- return placement.replace(/left|right|bottom|top/g, function (matched) {
592
- return hash$1[matched];
593
- });
594
- }
595
-
596
- var hash = {
597
- start: 'end',
598
- end: 'start'
599
- };
600
- function getOppositeVariationPlacement(placement) {
601
- return placement.replace(/start|end/g, function (matched) {
602
- return hash[matched];
603
- });
604
- }
605
-
606
- function getBoundingClientRect(element) {
607
- var rect = element.getBoundingClientRect();
608
- return {
609
- width: rect.width,
610
- height: rect.height,
611
- top: rect.top,
612
- right: rect.right,
613
- bottom: rect.bottom,
614
- left: rect.left,
615
- x: rect.left,
616
- y: rect.top
617
- };
618
- }
619
-
620
- function getWindowScroll(node) {
621
- var win = getWindow(node);
622
- var scrollLeft = win.pageXOffset;
623
- var scrollTop = win.pageYOffset;
624
- return {
625
- scrollLeft: scrollLeft,
626
- scrollTop: scrollTop
627
- };
628
- }
629
-
630
- function getWindowScrollBarX(element) {
631
- // If <html> has a CSS width greater than the viewport, then this will be
632
- // incorrect for RTL.
633
- // Popper 1 is broken in this case and never had a bug report so let's assume
634
- // it's not an issue. I don't think anyone ever specifies width on <html>
635
- // anyway.
636
- // Browsers where the left scrollbar doesn't cause an issue report `0` for
637
- // this (e.g. Edge 2019, IE11, Safari)
638
- return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
639
- }
640
-
641
- function getViewportRect(element) {
642
- var win = getWindow(element);
643
- var html = getDocumentElement(element);
644
- var visualViewport = win.visualViewport;
645
- var width = html.clientWidth;
646
- var height = html.clientHeight;
647
- var x = 0;
648
- var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
649
- // can be obscured underneath it.
650
- // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
651
- // if it isn't open, so if this isn't available, the popper will be detected
652
- // to overflow the bottom of the screen too early.
653
-
654
- if (visualViewport) {
655
- width = visualViewport.width;
656
- height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
657
- // In Chrome, it returns a value very close to 0 (+/-) but contains rounding
658
- // errors due to floating point numbers, so we need to check precision.
659
- // Safari returns a number <= 0, usually < -1 when pinch-zoomed
660
- // Feature detection fails in mobile emulation mode in Chrome.
661
- // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
662
- // 0.001
663
- // Fallback here: "Not Safari" userAgent
664
-
665
- if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
666
- x = visualViewport.offsetLeft;
667
- y = visualViewport.offsetTop;
668
- }
669
- }
670
-
671
- return {
672
- width: width,
673
- height: height,
674
- x: x + getWindowScrollBarX(element),
675
- y: y
676
- };
677
- }
678
-
679
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable
680
-
681
- function getDocumentRect(element) {
682
- var html = getDocumentElement(element);
683
- var winScroll = getWindowScroll(element);
684
- var body = element.ownerDocument.body;
685
- var width = Math.max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
686
- var height = Math.max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
687
- var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
688
- var y = -winScroll.scrollTop;
689
-
690
- if (getComputedStyle(body || html).direction === 'rtl') {
691
- x += Math.max(html.clientWidth, body ? body.clientWidth : 0) - width;
692
- }
693
-
694
- return {
695
- width: width,
696
- height: height,
697
- x: x,
698
- y: y
699
- };
700
- }
701
-
702
- function isScrollParent(element) {
703
- // Firefox wants us to check `-x` and `-y` variations as well
704
- var _getComputedStyle = getComputedStyle(element),
705
- overflow = _getComputedStyle.overflow,
706
- overflowX = _getComputedStyle.overflowX,
707
- overflowY = _getComputedStyle.overflowY;
708
-
709
- return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
710
- }
711
-
712
- function getScrollParent(node) {
713
- if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
714
- // $FlowFixMe: assume body is always available
715
- return node.ownerDocument.body;
716
- }
717
-
718
- if (isHTMLElement(node) && isScrollParent(node)) {
719
- return node;
720
- }
721
-
722
- return getScrollParent(getParentNode(node));
723
- }
724
-
725
- /*
726
- given a DOM element, return the list of all scroll parents, up the list of ancesors
727
- until we get to the top window object. This list is what we attach scroll listeners
728
- to, because if any of these parent elements scroll, we'll need to re-calculate the
729
- reference element's position.
730
- */
731
-
732
- function listScrollParents(element, list) {
733
- if (list === void 0) {
734
- list = [];
735
- }
736
-
737
- var scrollParent = getScrollParent(element);
738
- var isBody = getNodeName(scrollParent) === 'body';
739
- var win = getWindow(scrollParent);
740
- var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
741
- var updatedList = list.concat(target);
742
- return isBody ? updatedList : // $FlowFixMe: isBody tells us target will be an HTMLElement here
743
- updatedList.concat(listScrollParents(getParentNode(target)));
744
- }
745
-
746
- function rectToClientRect(rect) {
747
- return Object.assign(Object.assign({}, rect), {}, {
748
- left: rect.x,
749
- top: rect.y,
750
- right: rect.x + rect.width,
751
- bottom: rect.y + rect.height
752
- });
753
- }
754
-
755
- function getInnerBoundingClientRect(element) {
756
- var rect = getBoundingClientRect(element);
757
- rect.top = rect.top + element.clientTop;
758
- rect.left = rect.left + element.clientLeft;
759
- rect.bottom = rect.top + element.clientHeight;
760
- rect.right = rect.left + element.clientWidth;
761
- rect.width = element.clientWidth;
762
- rect.height = element.clientHeight;
763
- rect.x = rect.left;
764
- rect.y = rect.top;
765
- return rect;
766
- }
767
-
768
- function getClientRectFromMixedType(element, clippingParent) {
769
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
770
- } // A "clipping parent" is an overflowable container with the characteristic of
771
- // clipping (or hiding) overflowing elements with a position different from
772
- // `initial`
773
-
774
-
775
- function getClippingParents(element) {
776
- var clippingParents = listScrollParents(getParentNode(element));
777
- var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
778
- var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
779
-
780
- if (!isElement(clipperElement)) {
781
- return [];
782
- } // $FlowFixMe: https://github.com/facebook/flow/issues/1414
783
-
784
-
785
- return clippingParents.filter(function (clippingParent) {
786
- return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
787
- });
788
- } // Gets the maximum area that the element is visible in due to any number of
789
- // clipping parents
790
-
791
-
792
- function getClippingRect(element, boundary, rootBoundary) {
793
- var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
794
- var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
795
- var firstClippingParent = clippingParents[0];
796
- var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
797
- var rect = getClientRectFromMixedType(element, clippingParent);
798
- accRect.top = Math.max(rect.top, accRect.top);
799
- accRect.right = Math.min(rect.right, accRect.right);
800
- accRect.bottom = Math.min(rect.bottom, accRect.bottom);
801
- accRect.left = Math.max(rect.left, accRect.left);
802
- return accRect;
803
- }, getClientRectFromMixedType(element, firstClippingParent));
804
- clippingRect.width = clippingRect.right - clippingRect.left;
805
- clippingRect.height = clippingRect.bottom - clippingRect.top;
806
- clippingRect.x = clippingRect.left;
807
- clippingRect.y = clippingRect.top;
808
- return clippingRect;
809
- }
810
-
811
- function getVariation(placement) {
812
- return placement.split('-')[1];
813
- }
814
-
815
- function computeOffsets(_ref) {
816
- var reference = _ref.reference,
817
- element = _ref.element,
818
- placement = _ref.placement;
819
- var basePlacement = placement ? getBasePlacement(placement) : null;
820
- var variation = placement ? getVariation(placement) : null;
821
- var commonX = reference.x + reference.width / 2 - element.width / 2;
822
- var commonY = reference.y + reference.height / 2 - element.height / 2;
823
- var offsets;
824
-
825
- switch (basePlacement) {
826
- case top:
827
- offsets = {
828
- x: commonX,
829
- y: reference.y - element.height
830
- };
831
- break;
832
-
833
- case bottom:
834
- offsets = {
835
- x: commonX,
836
- y: reference.y + reference.height
837
- };
838
- break;
839
-
840
- case right:
841
- offsets = {
842
- x: reference.x + reference.width,
843
- y: commonY
844
- };
845
- break;
846
-
847
- case left:
848
- offsets = {
849
- x: reference.x - element.width,
850
- y: commonY
851
- };
852
- break;
853
-
854
- default:
855
- offsets = {
856
- x: reference.x,
857
- y: reference.y
858
- };
859
- }
860
-
861
- var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
862
-
863
- if (mainAxis != null) {
864
- var len = mainAxis === 'y' ? 'height' : 'width';
865
-
866
- switch (variation) {
867
- case start:
868
- offsets[mainAxis] = Math.floor(offsets[mainAxis]) - Math.floor(reference[len] / 2 - element[len] / 2);
869
- break;
870
-
871
- case end:
872
- offsets[mainAxis] = Math.floor(offsets[mainAxis]) + Math.ceil(reference[len] / 2 - element[len] / 2);
873
- break;
874
- }
875
- }
876
-
877
- return offsets;
878
- }
879
-
880
- function detectOverflow(state, options) {
881
- if (options === void 0) {
882
- options = {};
883
- }
884
-
885
- var _options = options,
886
- _options$placement = _options.placement,
887
- placement = _options$placement === void 0 ? state.placement : _options$placement,
888
- _options$boundary = _options.boundary,
889
- boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
890
- _options$rootBoundary = _options.rootBoundary,
891
- rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
892
- _options$elementConte = _options.elementContext,
893
- elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
894
- _options$altBoundary = _options.altBoundary,
895
- altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
896
- _options$padding = _options.padding,
897
- padding = _options$padding === void 0 ? 0 : _options$padding;
898
- var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
899
- var altContext = elementContext === popper ? reference : popper;
900
- var referenceElement = state.elements.reference;
901
- var popperRect = state.rects.popper;
902
- var element = state.elements[altBoundary ? altContext : elementContext];
903
- var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
904
- var referenceClientRect = getBoundingClientRect(referenceElement);
905
- var popperOffsets = computeOffsets({
906
- reference: referenceClientRect,
907
- element: popperRect,
908
- strategy: 'absolute',
909
- placement: placement
910
- });
911
- var popperClientRect = rectToClientRect(Object.assign(Object.assign({}, popperRect), popperOffsets));
912
- var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
913
- // 0 or negative = within the clipping rect
914
-
915
- var overflowOffsets = {
916
- top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
917
- bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
918
- left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
919
- right: elementClientRect.right - clippingClientRect.right + paddingObject.right
920
- };
921
- var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
922
-
923
- if (elementContext === popper && offsetData) {
924
- var offset = offsetData[placement];
925
- Object.keys(overflowOffsets).forEach(function (key) {
926
- var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
927
- var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
928
- overflowOffsets[key] += offset[axis] * multiply;
929
- });
930
- }
931
-
932
- return overflowOffsets;
933
- }
934
-
935
- /*:: type OverflowsMap = { [ComputedPlacement]: number }; */
936
-
937
- /*;; type OverflowsMap = { [key in ComputedPlacement]: number }; */
938
- function computeAutoPlacement(state, options) {
939
- if (options === void 0) {
940
- options = {};
941
- }
942
-
943
- var _options = options,
944
- placement = _options.placement,
945
- boundary = _options.boundary,
946
- rootBoundary = _options.rootBoundary,
947
- padding = _options.padding,
948
- flipVariations = _options.flipVariations,
949
- _options$allowedAutoP = _options.allowedAutoPlacements,
950
- allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
951
- var variation = getVariation(placement);
952
- var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
953
- return getVariation(placement) === variation;
954
- }) : basePlacements; // $FlowFixMe
955
-
956
- var allowedPlacements = placements$1.filter(function (placement) {
957
- return allowedAutoPlacements.indexOf(placement) >= 0;
958
- });
959
-
960
- if (allowedPlacements.length === 0) {
961
- allowedPlacements = placements$1;
962
-
963
- if (process.env.NODE_ENV !== "production") {
964
- 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(' '));
965
- }
966
- } // $FlowFixMe: Flow seems to have problems with two array unions...
967
-
968
-
969
- var overflows = allowedPlacements.reduce(function (acc, placement) {
970
- acc[placement] = detectOverflow(state, {
971
- placement: placement,
972
- boundary: boundary,
973
- rootBoundary: rootBoundary,
974
- padding: padding
975
- })[getBasePlacement(placement)];
976
- return acc;
977
- }, {});
978
- return Object.keys(overflows).sort(function (a, b) {
979
- return overflows[a] - overflows[b];
980
- });
981
- }
982
-
983
- function getExpandedFallbackPlacements(placement) {
984
- if (getBasePlacement(placement) === auto) {
985
- return [];
986
- }
987
-
988
- var oppositePlacement = getOppositePlacement(placement);
989
- return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
990
- }
991
-
992
- function flip(_ref) {
993
- var state = _ref.state,
994
- options = _ref.options,
995
- name = _ref.name;
996
-
997
- if (state.modifiersData[name]._skip) {
998
- return;
999
- }
1000
-
1001
- var _options$mainAxis = options.mainAxis,
1002
- checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1003
- _options$altAxis = options.altAxis,
1004
- checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
1005
- specifiedFallbackPlacements = options.fallbackPlacements,
1006
- padding = options.padding,
1007
- boundary = options.boundary,
1008
- rootBoundary = options.rootBoundary,
1009
- altBoundary = options.altBoundary,
1010
- _options$flipVariatio = options.flipVariations,
1011
- flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
1012
- allowedAutoPlacements = options.allowedAutoPlacements;
1013
- var preferredPlacement = state.options.placement;
1014
- var basePlacement = getBasePlacement(preferredPlacement);
1015
- var isBasePlacement = basePlacement === preferredPlacement;
1016
- var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
1017
- var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
1018
- return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
1019
- placement: placement,
1020
- boundary: boundary,
1021
- rootBoundary: rootBoundary,
1022
- padding: padding,
1023
- flipVariations: flipVariations,
1024
- allowedAutoPlacements: allowedAutoPlacements
1025
- }) : placement);
1026
- }, []);
1027
- var referenceRect = state.rects.reference;
1028
- var popperRect = state.rects.popper;
1029
- var checksMap = new Map();
1030
- var makeFallbackChecks = true;
1031
- var firstFittingPlacement = placements[0];
1032
-
1033
- for (var i = 0; i < placements.length; i++) {
1034
- var placement = placements[i];
1035
-
1036
- var _basePlacement = getBasePlacement(placement);
1037
-
1038
- var isStartVariation = getVariation(placement) === start;
1039
- var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
1040
- var len = isVertical ? 'width' : 'height';
1041
- var overflow = detectOverflow(state, {
1042
- placement: placement,
1043
- boundary: boundary,
1044
- rootBoundary: rootBoundary,
1045
- altBoundary: altBoundary,
1046
- padding: padding
1047
- });
1048
- var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
1049
-
1050
- if (referenceRect[len] > popperRect[len]) {
1051
- mainVariationSide = getOppositePlacement(mainVariationSide);
1052
- }
1053
-
1054
- var altVariationSide = getOppositePlacement(mainVariationSide);
1055
- var checks = [];
1056
-
1057
- if (checkMainAxis) {
1058
- checks.push(overflow[_basePlacement] <= 0);
1059
- }
1060
-
1061
- if (checkAltAxis) {
1062
- checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
1063
- }
1064
-
1065
- if (checks.every(function (check) {
1066
- return check;
1067
- })) {
1068
- firstFittingPlacement = placement;
1069
- makeFallbackChecks = false;
1070
- break;
1071
- }
1072
-
1073
- checksMap.set(placement, checks);
1074
- }
1075
-
1076
- if (makeFallbackChecks) {
1077
- // `2` may be desired in some cases – research later
1078
- var numberOfChecks = flipVariations ? 3 : 1;
1079
-
1080
- var _loop = function _loop(_i) {
1081
- var fittingPlacement = placements.find(function (placement) {
1082
- var checks = checksMap.get(placement);
1083
-
1084
- if (checks) {
1085
- return checks.slice(0, _i).every(function (check) {
1086
- return check;
1087
- });
1088
- }
1089
- });
1090
-
1091
- if (fittingPlacement) {
1092
- firstFittingPlacement = fittingPlacement;
1093
- return "break";
1094
- }
1095
- };
1096
-
1097
- for (var _i = numberOfChecks; _i > 0; _i--) {
1098
- var _ret = _loop(_i);
1099
-
1100
- if (_ret === "break") break;
1101
- }
1102
- }
1103
-
1104
- if (state.placement !== firstFittingPlacement) {
1105
- state.modifiersData[name]._skip = true;
1106
- state.placement = firstFittingPlacement;
1107
- state.reset = true;
1108
- }
1109
- } // eslint-disable-next-line import/no-unused-modules
1110
-
1111
-
1112
- var flip$1 = {
1113
- name: 'flip',
1114
- enabled: true,
1115
- phase: 'main',
1116
- fn: flip,
1117
- requiresIfExists: ['offset'],
1118
- data: {
1119
- _skip: false
1120
- }
1121
- };
1122
-
1123
- function getSideOffsets(overflow, rect, preventedOffsets) {
1124
- if (preventedOffsets === void 0) {
1125
- preventedOffsets = {
1126
- x: 0,
1127
- y: 0
1128
- };
1129
- }
1130
-
1131
- return {
1132
- top: overflow.top - rect.height - preventedOffsets.y,
1133
- right: overflow.right - rect.width + preventedOffsets.x,
1134
- bottom: overflow.bottom - rect.height + preventedOffsets.y,
1135
- left: overflow.left - rect.width - preventedOffsets.x
1136
- };
1137
- }
1138
-
1139
- function isAnySideFullyClipped(overflow) {
1140
- return [top, right, bottom, left].some(function (side) {
1141
- return overflow[side] >= 0;
1142
- });
1143
- }
1144
-
1145
- function hide(_ref) {
1146
- var state = _ref.state,
1147
- name = _ref.name;
1148
- var referenceRect = state.rects.reference;
1149
- var popperRect = state.rects.popper;
1150
- var preventedOffsets = state.modifiersData.preventOverflow;
1151
- var referenceOverflow = detectOverflow(state, {
1152
- elementContext: 'reference'
1153
- });
1154
- var popperAltOverflow = detectOverflow(state, {
1155
- altBoundary: true
1156
- });
1157
- var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
1158
- var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
1159
- var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
1160
- var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
1161
- state.modifiersData[name] = {
1162
- referenceClippingOffsets: referenceClippingOffsets,
1163
- popperEscapeOffsets: popperEscapeOffsets,
1164
- isReferenceHidden: isReferenceHidden,
1165
- hasPopperEscaped: hasPopperEscaped
1166
- };
1167
- state.attributes.popper = Object.assign(Object.assign({}, state.attributes.popper), {}, {
1168
- 'data-popper-reference-hidden': isReferenceHidden,
1169
- 'data-popper-escaped': hasPopperEscaped
1170
- });
1171
- } // eslint-disable-next-line import/no-unused-modules
1172
-
1173
-
1174
- var hide$1 = {
1175
- name: 'hide',
1176
- enabled: true,
1177
- phase: 'main',
1178
- requiresIfExists: ['preventOverflow'],
1179
- fn: hide
1180
- };
1181
-
1182
- function distanceAndSkiddingToXY(placement, rects, offset) {
1183
- var basePlacement = getBasePlacement(placement);
1184
- var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
1185
-
1186
- var _ref = typeof offset === 'function' ? offset(Object.assign(Object.assign({}, rects), {}, {
1187
- placement: placement
1188
- })) : offset,
1189
- skidding = _ref[0],
1190
- distance = _ref[1];
1191
-
1192
- skidding = skidding || 0;
1193
- distance = (distance || 0) * invertDistance;
1194
- return [left, right].indexOf(basePlacement) >= 0 ? {
1195
- x: distance,
1196
- y: skidding
1197
- } : {
1198
- x: skidding,
1199
- y: distance
1200
- };
1201
- }
1202
-
1203
- function offset(_ref2) {
1204
- var state = _ref2.state,
1205
- options = _ref2.options,
1206
- name = _ref2.name;
1207
- var _options$offset = options.offset,
1208
- offset = _options$offset === void 0 ? [0, 0] : _options$offset;
1209
- var data = placements.reduce(function (acc, placement) {
1210
- acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
1211
- return acc;
1212
- }, {});
1213
- var _data$state$placement = data[state.placement],
1214
- x = _data$state$placement.x,
1215
- y = _data$state$placement.y;
1216
-
1217
- if (state.modifiersData.popperOffsets != null) {
1218
- state.modifiersData.popperOffsets.x += x;
1219
- state.modifiersData.popperOffsets.y += y;
1220
- }
1221
-
1222
- state.modifiersData[name] = data;
1223
- } // eslint-disable-next-line import/no-unused-modules
1224
-
1225
-
1226
- var offset$1 = {
1227
- name: 'offset',
1228
- enabled: true,
1229
- phase: 'main',
1230
- requires: ['popperOffsets'],
1231
- fn: offset
1232
- };
1233
-
1234
- function popperOffsets(_ref) {
1235
- var state = _ref.state,
1236
- name = _ref.name;
1237
- // Offsets are the actual position the popper needs to have to be
1238
- // properly positioned near its reference element
1239
- // This is the most basic placement, and will be adjusted by
1240
- // the modifiers in the next step
1241
- state.modifiersData[name] = computeOffsets({
1242
- reference: state.rects.reference,
1243
- element: state.rects.popper,
1244
- strategy: 'absolute',
1245
- placement: state.placement
1246
- });
1247
- } // eslint-disable-next-line import/no-unused-modules
1248
-
1249
-
1250
- var popperOffsets$1 = {
1251
- name: 'popperOffsets',
1252
- enabled: true,
1253
- phase: 'read',
1254
- fn: popperOffsets,
1255
- data: {}
1256
- };
1257
-
1258
- function getAltAxis(axis) {
1259
- return axis === 'x' ? 'y' : 'x';
1260
- }
1261
-
1262
- function preventOverflow(_ref) {
1263
- var state = _ref.state,
1264
- options = _ref.options,
1265
- name = _ref.name;
1266
- var _options$mainAxis = options.mainAxis,
1267
- checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1268
- _options$altAxis = options.altAxis,
1269
- checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
1270
- boundary = options.boundary,
1271
- rootBoundary = options.rootBoundary,
1272
- altBoundary = options.altBoundary,
1273
- padding = options.padding,
1274
- _options$tether = options.tether,
1275
- tether = _options$tether === void 0 ? true : _options$tether,
1276
- _options$tetherOffset = options.tetherOffset,
1277
- tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
1278
- var overflow = detectOverflow(state, {
1279
- boundary: boundary,
1280
- rootBoundary: rootBoundary,
1281
- padding: padding,
1282
- altBoundary: altBoundary
1283
- });
1284
- var basePlacement = getBasePlacement(state.placement);
1285
- var variation = getVariation(state.placement);
1286
- var isBasePlacement = !variation;
1287
- var mainAxis = getMainAxisFromPlacement(basePlacement);
1288
- var altAxis = getAltAxis(mainAxis);
1289
- var popperOffsets = state.modifiersData.popperOffsets;
1290
- var referenceRect = state.rects.reference;
1291
- var popperRect = state.rects.popper;
1292
- var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign(Object.assign({}, state.rects), {}, {
1293
- placement: state.placement
1294
- })) : tetherOffset;
1295
- var data = {
1296
- x: 0,
1297
- y: 0
1298
- };
1299
-
1300
- if (!popperOffsets) {
1301
- return;
1302
- }
1303
-
1304
- if (checkMainAxis) {
1305
- var mainSide = mainAxis === 'y' ? top : left;
1306
- var altSide = mainAxis === 'y' ? bottom : right;
1307
- var len = mainAxis === 'y' ? 'height' : 'width';
1308
- var offset = popperOffsets[mainAxis];
1309
- var min = popperOffsets[mainAxis] + overflow[mainSide];
1310
- var max = popperOffsets[mainAxis] - overflow[altSide];
1311
- var additive = tether ? -popperRect[len] / 2 : 0;
1312
- var minLen = variation === start ? referenceRect[len] : popperRect[len];
1313
- var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
1314
- // outside the reference bounds
1315
-
1316
- var arrowElement = state.elements.arrow;
1317
- var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
1318
- width: 0,
1319
- height: 0
1320
- };
1321
- var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
1322
- var arrowPaddingMin = arrowPaddingObject[mainSide];
1323
- var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
1324
- // to include its full size in the calculation. If the reference is small
1325
- // and near the edge of a boundary, the popper can overflow even if the
1326
- // reference is not overflowing as well (e.g. virtual elements with no
1327
- // width or height)
1328
-
1329
- var arrowLen = within(0, referenceRect[len], arrowRect[len]);
1330
- var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;
1331
- var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;
1332
- var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1333
- var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
1334
- var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;
1335
- var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset;
1336
- var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue;
1337
- var preventedOffset = within(tether ? Math.min(min, tetherMin) : min, offset, tether ? Math.max(max, tetherMax) : max);
1338
- popperOffsets[mainAxis] = preventedOffset;
1339
- data[mainAxis] = preventedOffset - offset;
1340
- }
1341
-
1342
- if (checkAltAxis) {
1343
- var _mainSide = mainAxis === 'x' ? top : left;
1344
-
1345
- var _altSide = mainAxis === 'x' ? bottom : right;
1346
-
1347
- var _offset = popperOffsets[altAxis];
1348
-
1349
- var _min = _offset + overflow[_mainSide];
1350
-
1351
- var _max = _offset - overflow[_altSide];
1352
-
1353
- var _preventedOffset = within(_min, _offset, _max);
1354
-
1355
- popperOffsets[altAxis] = _preventedOffset;
1356
- data[altAxis] = _preventedOffset - _offset;
1357
- }
1358
-
1359
- state.modifiersData[name] = data;
1360
- } // eslint-disable-next-line import/no-unused-modules
1361
-
1362
-
1363
- var preventOverflow$1 = {
1364
- name: 'preventOverflow',
1365
- enabled: true,
1366
- phase: 'main',
1367
- fn: preventOverflow,
1368
- requiresIfExists: ['offset']
1369
- };
1370
-
1371
- function getHTMLElementScroll(element) {
1372
- return {
1373
- scrollLeft: element.scrollLeft,
1374
- scrollTop: element.scrollTop
1375
- };
1376
- }
1377
-
1378
- function getNodeScroll(node) {
1379
- if (node === getWindow(node) || !isHTMLElement(node)) {
1380
- return getWindowScroll(node);
1381
- } else {
1382
- return getHTMLElementScroll(node);
1383
- }
1384
- }
1385
-
1386
- // Composite means it takes into account transforms as well as layout.
1387
-
1388
- function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1389
- if (isFixed === void 0) {
1390
- isFixed = false;
1391
- }
1392
-
1393
- var documentElement = getDocumentElement(offsetParent);
1394
- var rect = getBoundingClientRect(elementOrVirtualElement);
1395
- var isOffsetParentAnElement = isHTMLElement(offsetParent);
1396
- var scroll = {
1397
- scrollLeft: 0,
1398
- scrollTop: 0
1399
- };
1400
- var offsets = {
1401
- x: 0,
1402
- y: 0
1403
- };
1404
-
1405
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1406
- if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
1407
- isScrollParent(documentElement)) {
1408
- scroll = getNodeScroll(offsetParent);
1409
- }
1410
-
1411
- if (isHTMLElement(offsetParent)) {
1412
- offsets = getBoundingClientRect(offsetParent);
1413
- offsets.x += offsetParent.clientLeft;
1414
- offsets.y += offsetParent.clientTop;
1415
- } else if (documentElement) {
1416
- offsets.x = getWindowScrollBarX(documentElement);
1417
- }
1418
- }
1419
-
1420
- return {
1421
- x: rect.left + scroll.scrollLeft - offsets.x,
1422
- y: rect.top + scroll.scrollTop - offsets.y,
1423
- width: rect.width,
1424
- height: rect.height
1425
- };
1426
- }
1427
-
1428
- function order(modifiers) {
1429
- var map = new Map();
1430
- var visited = new Set();
1431
- var result = [];
1432
- modifiers.forEach(function (modifier) {
1433
- map.set(modifier.name, modifier);
1434
- }); // On visiting object, check for its dependencies and visit them recursively
1435
-
1436
- function sort(modifier) {
1437
- visited.add(modifier.name);
1438
- var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
1439
- requires.forEach(function (dep) {
1440
- if (!visited.has(dep)) {
1441
- var depModifier = map.get(dep);
1442
-
1443
- if (depModifier) {
1444
- sort(depModifier);
1445
- }
1446
- }
1447
- });
1448
- result.push(modifier);
1449
- }
1450
-
1451
- modifiers.forEach(function (modifier) {
1452
- if (!visited.has(modifier.name)) {
1453
- // check for visited object
1454
- sort(modifier);
1455
- }
1456
- });
1457
- return result;
1458
- }
1459
-
1460
- function orderModifiers(modifiers) {
1461
- // order based on dependencies
1462
- var orderedModifiers = order(modifiers); // order based on phase
1463
-
1464
- return modifierPhases.reduce(function (acc, phase) {
1465
- return acc.concat(orderedModifiers.filter(function (modifier) {
1466
- return modifier.phase === phase;
1467
- }));
1468
- }, []);
1469
- }
1470
-
1471
- function debounce(fn) {
1472
- var pending;
1473
- return function () {
1474
- if (!pending) {
1475
- pending = new Promise(function (resolve) {
1476
- Promise.resolve().then(function () {
1477
- pending = undefined;
1478
- resolve(fn());
1479
- });
1480
- });
1481
- }
1482
-
1483
- return pending;
1484
- };
1485
- }
1486
-
1487
- function format(str) {
1488
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1489
- args[_key - 1] = arguments[_key];
1490
- }
1491
-
1492
- return [].concat(args).reduce(function (p, c) {
1493
- return p.replace(/%s/, c);
1494
- }, str);
1495
- }
1496
-
1497
- var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
1498
- var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
1499
- var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options'];
1500
- function validateModifiers(modifiers) {
1501
- modifiers.forEach(function (modifier) {
1502
- Object.keys(modifier).forEach(function (key) {
1503
- switch (key) {
1504
- case 'name':
1505
- if (typeof modifier.name !== 'string') {
1506
- console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\""));
1507
- }
1508
-
1509
- break;
1510
-
1511
- case 'enabled':
1512
- if (typeof modifier.enabled !== 'boolean') {
1513
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\""));
1514
- }
1515
-
1516
- case 'phase':
1517
- if (modifierPhases.indexOf(modifier.phase) < 0) {
1518
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\""));
1519
- }
1520
-
1521
- break;
1522
-
1523
- case 'fn':
1524
- if (typeof modifier.fn !== 'function') {
1525
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\""));
1526
- }
1527
-
1528
- break;
1529
-
1530
- case 'effect':
1531
- if (typeof modifier.effect !== 'function') {
1532
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\""));
1533
- }
1534
-
1535
- break;
1536
-
1537
- case 'requires':
1538
- if (!Array.isArray(modifier.requires)) {
1539
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\""));
1540
- }
1541
-
1542
- break;
1543
-
1544
- case 'requiresIfExists':
1545
- if (!Array.isArray(modifier.requiresIfExists)) {
1546
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\""));
1547
- }
1548
-
1549
- break;
1550
-
1551
- case 'options':
1552
- case 'data':
1553
- break;
1554
-
1555
- default:
1556
- console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function (s) {
1557
- return "\"" + s + "\"";
1558
- }).join(', ') + "; but \"" + key + "\" was provided.");
1559
- }
1560
-
1561
- modifier.requires && modifier.requires.forEach(function (requirement) {
1562
- if (modifiers.find(function (mod) {
1563
- return mod.name === requirement;
1564
- }) == null) {
1565
- console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
1566
- }
1567
- });
1568
- });
1569
- });
1570
- }
1571
-
1572
- function uniqueBy(arr, fn) {
1573
- var identifiers = new Set();
1574
- return arr.filter(function (item) {
1575
- var identifier = fn(item);
1576
-
1577
- if (!identifiers.has(identifier)) {
1578
- identifiers.add(identifier);
1579
- return true;
1580
- }
1581
- });
1582
- }
1583
-
1584
- function mergeByName(modifiers) {
1585
- var merged = modifiers.reduce(function (merged, current) {
1586
- var existing = merged[current.name];
1587
- merged[current.name] = existing ? Object.assign(Object.assign(Object.assign({}, existing), current), {}, {
1588
- options: Object.assign(Object.assign({}, existing.options), current.options),
1589
- data: Object.assign(Object.assign({}, existing.data), current.data)
1590
- }) : current;
1591
- return merged;
1592
- }, {}); // IE11 does not support Object.values
1593
-
1594
- return Object.keys(merged).map(function (key) {
1595
- return merged[key];
1596
- });
1597
- }
1598
-
1599
- var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
1600
- 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.';
1601
- var DEFAULT_OPTIONS = {
1602
- placement: 'bottom',
1603
- modifiers: [],
1604
- strategy: 'absolute'
1605
- };
1606
-
1607
- function areValidElements() {
1608
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1609
- args[_key] = arguments[_key];
1610
- }
1611
-
1612
- return !args.some(function (element) {
1613
- return !(element && typeof element.getBoundingClientRect === 'function');
1614
- });
1615
- }
1616
-
1617
- function popperGenerator(generatorOptions) {
1618
- if (generatorOptions === void 0) {
1619
- generatorOptions = {};
1620
- }
1621
-
1622
- var _generatorOptions = generatorOptions,
1623
- _generatorOptions$def = _generatorOptions.defaultModifiers,
1624
- defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
1625
- _generatorOptions$def2 = _generatorOptions.defaultOptions,
1626
- defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
1627
- return function createPopper(reference, popper, options) {
1628
- if (options === void 0) {
1629
- options = defaultOptions;
1630
- }
1631
-
1632
- var state = {
1633
- placement: 'bottom',
1634
- orderedModifiers: [],
1635
- options: Object.assign(Object.assign({}, DEFAULT_OPTIONS), defaultOptions),
1636
- modifiersData: {},
1637
- elements: {
1638
- reference: reference,
1639
- popper: popper
1640
- },
1641
- attributes: {},
1642
- styles: {}
1643
- };
1644
- var effectCleanupFns = [];
1645
- var isDestroyed = false;
1646
- var instance = {
1647
- state: state,
1648
- setOptions: function setOptions(options) {
1649
- cleanupModifierEffects();
1650
- state.options = Object.assign(Object.assign(Object.assign({}, defaultOptions), state.options), options);
1651
- state.scrollParents = {
1652
- reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
1653
- popper: listScrollParents(popper)
1654
- }; // Orders the modifiers based on their dependencies and `phase`
1655
- // properties
1656
-
1657
- var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
1658
-
1659
- state.orderedModifiers = orderedModifiers.filter(function (m) {
1660
- return m.enabled;
1661
- }); // Validate the provided modifiers so that the consumer will get warned
1662
- // if one of the modifiers is invalid for any reason
1663
-
1664
- if (process.env.NODE_ENV !== "production") {
1665
- var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {
1666
- var name = _ref.name;
1667
- return name;
1668
- });
1669
- validateModifiers(modifiers);
1670
-
1671
- if (getBasePlacement(state.options.placement) === auto) {
1672
- var flipModifier = state.orderedModifiers.find(function (_ref2) {
1673
- var name = _ref2.name;
1674
- return name === 'flip';
1675
- });
1676
-
1677
- if (!flipModifier) {
1678
- console.error(['Popper: "auto" placements require the "flip" modifier be', 'present and enabled to work.'].join(' '));
1679
- }
1680
- }
1681
-
1682
- var _getComputedStyle = getComputedStyle(popper),
1683
- marginTop = _getComputedStyle.marginTop,
1684
- marginRight = _getComputedStyle.marginRight,
1685
- marginBottom = _getComputedStyle.marginBottom,
1686
- marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can
1687
- // cause bugs with positioning, so we'll warn the consumer
1688
-
1689
-
1690
- if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {
1691
- return parseFloat(margin);
1692
- })) {
1693
- console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));
1694
- }
1695
- }
1696
-
1697
- runModifierEffects();
1698
- return instance.update();
1699
- },
1700
- // Sync update – it will always be executed, even if not necessary. This
1701
- // is useful for low frequency updates where sync behavior simplifies the
1702
- // logic.
1703
- // For high frequency updates (e.g. `resize` and `scroll` events), always
1704
- // prefer the async Popper#update method
1705
- forceUpdate: function forceUpdate() {
1706
- if (isDestroyed) {
1707
- return;
1708
- }
1709
-
1710
- var _state$elements = state.elements,
1711
- reference = _state$elements.reference,
1712
- popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
1713
- // anymore
1714
-
1715
- if (!areValidElements(reference, popper)) {
1716
- if (process.env.NODE_ENV !== "production") {
1717
- console.error(INVALID_ELEMENT_ERROR);
1718
- }
1719
-
1720
- return;
1721
- } // Store the reference and popper rects to be read by modifiers
1722
-
1723
-
1724
- state.rects = {
1725
- reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
1726
- popper: getLayoutRect(popper)
1727
- }; // Modifiers have the ability to reset the current update cycle. The
1728
- // most common use case for this is the `flip` modifier changing the
1729
- // placement, which then needs to re-run all the modifiers, because the
1730
- // logic was previously ran for the previous placement and is therefore
1731
- // stale/incorrect
1732
-
1733
- state.reset = false;
1734
- state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
1735
- // is filled with the initial data specified by the modifier. This means
1736
- // it doesn't persist and is fresh on each update.
1737
- // To ensure persistent data, use `${name}#persistent`
1738
-
1739
- state.orderedModifiers.forEach(function (modifier) {
1740
- return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
1741
- });
1742
- var __debug_loops__ = 0;
1743
-
1744
- for (var index = 0; index < state.orderedModifiers.length; index++) {
1745
- if (process.env.NODE_ENV !== "production") {
1746
- __debug_loops__ += 1;
1747
-
1748
- if (__debug_loops__ > 100) {
1749
- console.error(INFINITE_LOOP_ERROR);
1750
- break;
1751
- }
1752
- }
1753
-
1754
- if (state.reset === true) {
1755
- state.reset = false;
1756
- index = -1;
1757
- continue;
1758
- }
1759
-
1760
- var _state$orderedModifie = state.orderedModifiers[index],
1761
- fn = _state$orderedModifie.fn,
1762
- _state$orderedModifie2 = _state$orderedModifie.options,
1763
- _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
1764
- name = _state$orderedModifie.name;
1765
-
1766
- if (typeof fn === 'function') {
1767
- state = fn({
1768
- state: state,
1769
- options: _options,
1770
- name: name,
1771
- instance: instance
1772
- }) || state;
1773
- }
1774
- }
1775
- },
1776
- // Async and optimistically optimized update – it will not be executed if
1777
- // not necessary (debounced to run at most once-per-tick)
1778
- update: debounce(function () {
1779
- return new Promise(function (resolve) {
1780
- instance.forceUpdate();
1781
- resolve(state);
1782
- });
1783
- }),
1784
- destroy: function destroy() {
1785
- cleanupModifierEffects();
1786
- isDestroyed = true;
1787
- }
1788
- };
1789
-
1790
- if (!areValidElements(reference, popper)) {
1791
- if (process.env.NODE_ENV !== "production") {
1792
- console.error(INVALID_ELEMENT_ERROR);
1793
- }
1794
-
1795
- return instance;
1796
- }
1797
-
1798
- instance.setOptions(options).then(function (state) {
1799
- if (!isDestroyed && options.onFirstUpdate) {
1800
- options.onFirstUpdate(state);
1801
- }
1802
- }); // Modifiers have the ability to execute arbitrary code before the first
1803
- // update cycle runs. They will be executed in the same order as the update
1804
- // cycle. This is useful when a modifier adds some persistent data that
1805
- // other modifiers need to use, but the modifier is run after the dependent
1806
- // one.
1807
-
1808
- function runModifierEffects() {
1809
- state.orderedModifiers.forEach(function (_ref3) {
1810
- var name = _ref3.name,
1811
- _ref3$options = _ref3.options,
1812
- options = _ref3$options === void 0 ? {} : _ref3$options,
1813
- effect = _ref3.effect;
1814
-
1815
- if (typeof effect === 'function') {
1816
- var cleanupFn = effect({
1817
- state: state,
1818
- name: name,
1819
- instance: instance,
1820
- options: options
1821
- });
1822
-
1823
- var noopFn = function noopFn() {};
1824
-
1825
- effectCleanupFns.push(cleanupFn || noopFn);
1826
- }
1827
- });
1828
- }
1829
-
1830
- function cleanupModifierEffects() {
1831
- effectCleanupFns.forEach(function (fn) {
1832
- return fn();
1833
- });
1834
- effectCleanupFns = [];
1835
- }
1836
-
1837
- return instance;
1838
- };
1839
- }
1840
-
1841
- var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
1842
- var createPopper = /*#__PURE__*/popperGenerator({
1843
- defaultModifiers: defaultModifiers
1844
- }); // eslint-disable-next-line import/no-unused-modules
1845
-
1846
- /**
1847
- * Simple ponyfill for Object.fromEntries
1848
- */
1849
-
1850
- var fromEntries = function fromEntries(entries) {
1851
- return entries.reduce(function (acc, _ref) {
1852
- var key = _ref[0],
1853
- value = _ref[1];
1854
- acc[key] = value;
1855
- return acc;
1856
- }, {});
1857
- };
1858
- /**
1859
- * Small wrapper around `useLayoutEffect` to get rid of the warning on SSR envs
1860
- */
1861
-
1862
- var useIsomorphicLayoutEffect = typeof window !== 'undefined' && window.document && window.document.createElement ? React.useLayoutEffect : React.useEffect;
1863
-
1864
- /* global Map:readonly, Set:readonly, ArrayBuffer:readonly */
1865
-
1866
- var reactFastCompare;
1867
- var hasRequiredReactFastCompare;
1868
-
1869
- function requireReactFastCompare () {
1870
- if (hasRequiredReactFastCompare) return reactFastCompare;
1871
- hasRequiredReactFastCompare = 1;
1872
- var hasElementType = typeof Element !== 'undefined';
1873
- var hasMap = typeof Map === 'function';
1874
- var hasSet = typeof Set === 'function';
1875
- var hasArrayBuffer = typeof ArrayBuffer === 'function' && !!ArrayBuffer.isView;
1876
-
1877
- // Note: We **don't** need `envHasBigInt64Array` in fde es6/index.js
1878
-
1879
- function equal(a, b) {
1880
- // START: fast-deep-equal es6/index.js 3.1.1
1881
- if (a === b) return true;
1882
-
1883
- if (a && b && typeof a == 'object' && typeof b == 'object') {
1884
- if (a.constructor !== b.constructor) return false;
1885
-
1886
- var length, i, keys;
1887
- if (Array.isArray(a)) {
1888
- length = a.length;
1889
- if (length != b.length) return false;
1890
- for (i = length; i-- !== 0;)
1891
- if (!equal(a[i], b[i])) return false;
1892
- return true;
1893
- }
1894
-
1895
- // START: Modifications:
1896
- // 1. Extra `has<Type> &&` helpers in initial condition allow es6 code
1897
- // to co-exist with es5.
1898
- // 2. Replace `for of` with es5 compliant iteration using `for`.
1899
- // Basically, take:
1900
- //
1901
- // ```js
1902
- // for (i of a.entries())
1903
- // if (!b.has(i[0])) return false;
1904
- // ```
1905
- //
1906
- // ... and convert to:
1907
- //
1908
- // ```js
1909
- // it = a.entries();
1910
- // while (!(i = it.next()).done)
1911
- // if (!b.has(i.value[0])) return false;
1912
- // ```
1913
- //
1914
- // **Note**: `i` access switches to `i.value`.
1915
- var it;
1916
- if (hasMap && (a instanceof Map) && (b instanceof Map)) {
1917
- if (a.size !== b.size) return false;
1918
- it = a.entries();
1919
- while (!(i = it.next()).done)
1920
- if (!b.has(i.value[0])) return false;
1921
- it = a.entries();
1922
- while (!(i = it.next()).done)
1923
- if (!equal(i.value[1], b.get(i.value[0]))) return false;
1924
- return true;
1925
- }
1926
-
1927
- if (hasSet && (a instanceof Set) && (b instanceof Set)) {
1928
- if (a.size !== b.size) return false;
1929
- it = a.entries();
1930
- while (!(i = it.next()).done)
1931
- if (!b.has(i.value[0])) return false;
1932
- return true;
1933
- }
1934
- // END: Modifications
1935
-
1936
- if (hasArrayBuffer && ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
1937
- length = a.length;
1938
- if (length != b.length) return false;
1939
- for (i = length; i-- !== 0;)
1940
- if (a[i] !== b[i]) return false;
1941
- return true;
1942
- }
1943
-
1944
- if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
1945
- if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
1946
- if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
1947
-
1948
- keys = Object.keys(a);
1949
- length = keys.length;
1950
- if (length !== Object.keys(b).length) return false;
1951
-
1952
- for (i = length; i-- !== 0;)
1953
- if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
1954
- // END: fast-deep-equal
1955
-
1956
- // START: react-fast-compare
1957
- // custom handling for DOM elements
1958
- if (hasElementType && a instanceof Element) return false;
1959
-
1960
- // custom handling for React/Preact
1961
- for (i = length; i-- !== 0;) {
1962
- if ((keys[i] === '_owner' || keys[i] === '__v' || keys[i] === '__o') && a.$$typeof) {
1963
- // React-specific: avoid traversing React elements' _owner
1964
- // Preact-specific: avoid traversing Preact elements' __v and __o
1965
- // __v = $_original / $_vnode
1966
- // __o = $_owner
1967
- // These properties contain circular references and are not needed when
1968
- // comparing the actual elements (and not their owners)
1969
- // .$$typeof and ._store on just reasonable markers of elements
1970
-
1971
- continue;
1972
- }
1973
-
1974
- // all other properties should be traversed as usual
1975
- if (!equal(a[keys[i]], b[keys[i]])) return false;
1976
- }
1977
- // END: react-fast-compare
1978
-
1979
- // START: fast-deep-equal
1980
- return true;
1981
- }
1982
-
1983
- return a !== a && b !== b;
1984
- }
1985
- // end fast-deep-equal
1986
-
1987
- reactFastCompare = function isEqual(a, b) {
1988
- try {
1989
- return equal(a, b);
1990
- } catch (error) {
1991
- if (((error.message || '').match(/stack|recursion/i))) {
1992
- // warn on circular references, don't crash
1993
- // browsers give this different errors name and messages:
1994
- // chrome/safari: "RangeError", "Maximum call stack size exceeded"
1995
- // firefox: "InternalError", too much recursion"
1996
- // edge: "Error", "Out of stack space"
1997
- console.warn('react-fast-compare cannot handle circular refs');
1998
- return false;
1999
- }
2000
- // some other error. we should definitely know about these
2001
- throw error;
2002
- }
2003
- };
2004
- return reactFastCompare;
2005
- }
2006
-
2007
- var reactFastCompareExports = requireReactFastCompare();
2008
- var isEqual = /*@__PURE__*/getDefaultExportFromCjs(reactFastCompareExports);
2009
-
2010
- var EMPTY_MODIFIERS = [];
2011
- var usePopper$1 = function usePopper(referenceElement, popperElement, options) {
2012
- if (options === void 0) {
2013
- options = {};
2014
- }
2015
-
2016
- var prevOptions = React.useRef(null);
2017
- var optionsWithDefaults = {
2018
- onFirstUpdate: options.onFirstUpdate,
2019
- placement: options.placement || 'bottom',
2020
- strategy: options.strategy || 'absolute',
2021
- modifiers: options.modifiers || EMPTY_MODIFIERS
2022
- };
2023
-
2024
- var _React$useState = React.useState({
2025
- styles: {
2026
- popper: {
2027
- position: optionsWithDefaults.strategy,
2028
- left: '0',
2029
- top: '0'
2030
- }
2031
- },
2032
- attributes: {}
2033
- }),
2034
- state = _React$useState[0],
2035
- setState = _React$useState[1];
2036
-
2037
- var updateStateModifier = React.useMemo(function () {
2038
- return {
2039
- name: 'updateState',
2040
- enabled: true,
2041
- phase: 'write',
2042
- fn: function fn(_ref) {
2043
- var state = _ref.state;
2044
- var elements = Object.keys(state.elements);
2045
- setState({
2046
- styles: fromEntries(elements.map(function (element) {
2047
- return [element, state.styles[element] || {}];
2048
- })),
2049
- attributes: fromEntries(elements.map(function (element) {
2050
- return [element, state.attributes[element]];
2051
- }))
2052
- });
2053
- },
2054
- requires: ['computeStyles']
2055
- };
2056
- }, []);
2057
- var popperOptions = React.useMemo(function () {
2058
- var newOptions = {
2059
- onFirstUpdate: optionsWithDefaults.onFirstUpdate,
2060
- placement: optionsWithDefaults.placement,
2061
- strategy: optionsWithDefaults.strategy,
2062
- modifiers: [].concat(optionsWithDefaults.modifiers, [updateStateModifier, {
2063
- name: 'applyStyles',
2064
- enabled: false
2065
- }])
2066
- };
2067
-
2068
- if (isEqual(prevOptions.current, newOptions)) {
2069
- return prevOptions.current || newOptions;
2070
- } else {
2071
- prevOptions.current = newOptions;
2072
- return newOptions;
2073
- }
2074
- }, [optionsWithDefaults.onFirstUpdate, optionsWithDefaults.placement, optionsWithDefaults.strategy, optionsWithDefaults.modifiers, updateStateModifier]);
2075
- var popperInstanceRef = React.useRef();
2076
- useIsomorphicLayoutEffect(function () {
2077
- if (popperInstanceRef.current) {
2078
- popperInstanceRef.current.setOptions(popperOptions);
2079
- }
2080
- }, [popperOptions]);
2081
- useIsomorphicLayoutEffect(function () {
2082
- if (referenceElement == null || popperElement == null) {
2083
- return;
2084
- }
2085
-
2086
- var createPopper$1 = options.createPopper || createPopper;
2087
- var popperInstance = createPopper$1(referenceElement, popperElement, popperOptions);
2088
- popperInstanceRef.current = popperInstance;
2089
- return function () {
2090
- popperInstance.destroy();
2091
- popperInstanceRef.current = null;
2092
- };
2093
- }, [referenceElement, popperElement, options.createPopper]);
2094
- return {
2095
- state: popperInstanceRef.current ? popperInstanceRef.current.state : null,
2096
- styles: state.styles,
2097
- attributes: state.attributes,
2098
- update: popperInstanceRef.current ? popperInstanceRef.current.update : null,
2099
- forceUpdate: popperInstanceRef.current ? popperInstanceRef.current.forceUpdate : null
2100
- };
2101
- };
2102
-
2103
- /** Stub usePopper for use outside of browsers */
2104
- const useStubPopper = (_a, _p, {
2105
- placement
2106
- }) => ({
2107
- attributes: {
2108
- popper: {
2109
- 'data-popper-placement': placement
2110
- }
2111
- },
2112
- styles: {
2113
- popper: {
2114
- transform: 'translate(1, 1)'
2115
- }
2116
- }
2117
- });
2118
-
2119
- /** Switch hook implementation between environment */
2120
- const usePopper = IS_BROWSER ? usePopper$1 : useStubPopper;
2121
-
2122
- /**
2123
- * Different possible placements for the popover.
2124
- */
2125
- const Placement = {
2126
- AUTO: 'auto',
2127
- AUTO_END: 'auto-end',
2128
- AUTO_START: 'auto-start',
2129
- TOP: 'top',
2130
- TOP_END: 'top-end',
2131
- TOP_START: 'top-start',
2132
- RIGHT: 'right',
2133
- RIGHT_END: 'right-end',
2134
- RIGHT_START: 'right-start',
2135
- BOTTOM: 'bottom',
2136
- BOTTOM_END: 'bottom-end',
2137
- BOTTOM_START: 'bottom-start',
2138
- LEFT: 'left',
2139
- LEFT_END: 'left-end',
2140
- LEFT_START: 'left-start'
2141
- };
2142
-
2143
- /**
2144
- * Offset of the popover.
2145
- */
2146
-
2147
- /**
2148
- * Popover elevation index.
2149
- */
2150
-
2151
- /**
2152
- * Popover fit anchor width options.
2153
- */
2154
- const FitAnchorWidth = {
2155
- MAX_WIDTH: 'maxWidth',
2156
- MIN_WIDTH: 'minWidth',
2157
- WIDTH: 'width'
2158
- };
2159
- /**
2160
- * Arrow size (in pixel).
2161
- */
2162
- const ARROW_SIZE = 14;
2163
-
2164
- /**
2165
- * Popover default z-index
2166
- */
2167
- const POPOVER_ZINDEX = 9999;
2168
-
2169
- export { ARROW_SIZE as A, FitAnchorWidth as F, Placement as P, POPOVER_ZINDEX as a, detectOverflow as d, usePopper as u };