@vertexvis/ui 0.0.16-canary.0 → 0.1.0-testing.1

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