@dso-toolkit/core 99.5.0 → 100.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/bundle/dso-advanced-select.js +3 -3
  2. package/dist/bundle/dso-document-component.js +1 -1
  3. package/dist/bundle/dso-dropdown-menu.js +51 -12
  4. package/dist/bundle/dso-header.js +51 -12
  5. package/dist/bundle/dso-highlight-box.js +1 -1
  6. package/dist/bundle/dso-info.js +1 -1
  7. package/dist/bundle/dso-list-button.js +2 -2
  8. package/dist/bundle/dso-map-base-layers.js +2 -2
  9. package/dist/bundle/dso-map-overlays.js +2 -2
  10. package/dist/bundle/dso-ozon-content.js +1 -1
  11. package/dist/bundle/dso-selectable.js +1 -1
  12. package/dist/bundle/dso-tree-view.js +1 -1
  13. package/dist/bundle/dso-viewer-grid.js +2 -2
  14. package/dist/bundle/dsot-document-component-demo.js +4 -4
  15. package/dist/bundle/index.js +0 -2
  16. package/dist/bundle/p-0mKOaHii.js +48 -0
  17. package/dist/bundle/{p-BHoewcI-.js → p-BSvOi0zH.js} +4 -4
  18. package/dist/bundle/{p-DtOWRu1L.js → p-ClW9x8PR.js} +1 -1
  19. package/dist/bundle/{p-ChjlyvQF.js → p-DoZnyoat.js} +39 -27
  20. package/dist/cjs/dso-advanced-select.cjs.entry.js +3 -3
  21. package/dist/cjs/dso-alert_7.cjs.entry.js +4 -4
  22. package/dist/cjs/dso-annotation-locatie_2.cjs.entry.js +37 -25
  23. package/dist/cjs/dso-dropdown-menu.cjs.entry.js +51 -12
  24. package/dist/cjs/dso-header.cjs.entry.js +51 -12
  25. package/dist/cjs/dso-highlight-box.cjs.entry.js +1 -1
  26. package/dist/cjs/dso-info_3.cjs.entry.js +1 -1
  27. package/dist/cjs/dso-toolkit.cjs.js +1 -1
  28. package/dist/cjs/dso-tree-view.cjs.entry.js +1 -1
  29. package/dist/cjs/dso-viewer-grid.cjs.entry.js +2 -2
  30. package/dist/cjs/dsot-document-component-demo.cjs.entry.js +2 -2
  31. package/dist/cjs/loader.cjs.js +1 -1
  32. package/dist/collection/collection-manifest.json +0 -1
  33. package/dist/collection/components/advanced-select/advanced-select.css +12 -11
  34. package/dist/collection/components/advanced-select/advanced-select.js +2 -2
  35. package/dist/collection/components/document-component/document-component-heading.js +28 -18
  36. package/dist/collection/components/document-component/document-component.js +16 -14
  37. package/dist/collection/components/document-component-demo/document-component.demo.js +2 -2
  38. package/dist/collection/components/dropdown-menu/dropdown-menu.js +51 -12
  39. package/dist/collection/components/header/header.js +51 -12
  40. package/dist/collection/components/highlight-box/highlight-box.css +2 -4
  41. package/dist/collection/components/info/info.css +10 -17
  42. package/dist/collection/components/ozon-content/nodes/int-io-ref.node.js +1 -1
  43. package/dist/collection/components/ozon-content/nodes/int-ref.node.js +1 -1
  44. package/dist/collection/components/ozon-content/nodes/noot.node.js +1 -1
  45. package/dist/collection/components/ozon-content/ozon-content-mapper.js +1 -1
  46. package/dist/collection/components/tree-view/tree-view.js +1 -1
  47. package/dist/collection/components/viewer-grid/viewer-grid.js +2 -2
  48. package/dist/components/document-component.js +1 -1
  49. package/dist/components/dso-advanced-select.js +1 -1
  50. package/dist/components/dso-dropdown-menu.js +1 -1
  51. package/dist/components/dso-header.js +1 -1
  52. package/dist/components/dso-highlight-box.js +1 -1
  53. package/dist/components/dso-tree-view.js +1 -1
  54. package/dist/components/dso-viewer-grid.js +1 -1
  55. package/dist/components/dsot-document-component-demo.js +1 -1
  56. package/dist/components/index.d.ts +0 -2
  57. package/dist/components/index.js +1 -1
  58. package/dist/components/info.js +1 -1
  59. package/dist/components/ozon-content.js +1 -1
  60. package/dist/dso-toolkit/dso-toolkit.esm.js +1 -1
  61. package/dist/dso-toolkit/{p-7a852b15.entry.js → p-4a971ee1.entry.js} +1 -1
  62. package/dist/dso-toolkit/{p-441b88f3.entry.js → p-4dacadca.entry.js} +1 -1
  63. package/dist/dso-toolkit/{p-16a9d23c.entry.js → p-5455f456.entry.js} +1 -1
  64. package/dist/dso-toolkit/p-56f5668a.entry.js +1 -0
  65. package/dist/dso-toolkit/p-72c632b1.entry.js +1 -0
  66. package/dist/dso-toolkit/{p-0083183c.entry.js → p-84cda47a.entry.js} +1 -1
  67. package/dist/dso-toolkit/p-b35b9bf4.entry.js +1 -0
  68. package/dist/dso-toolkit/{p-e3826220.entry.js → p-b6d829b6.entry.js} +2 -2
  69. package/dist/dso-toolkit/p-dce72b97.entry.js +1 -0
  70. package/dist/dso-toolkit/p-e0a1e35a.entry.js +1 -0
  71. package/dist/esm/dso-advanced-select.entry.js +3 -3
  72. package/dist/esm/dso-alert_7.entry.js +4 -4
  73. package/dist/esm/dso-annotation-locatie_2.entry.js +37 -25
  74. package/dist/esm/dso-dropdown-menu.entry.js +51 -12
  75. package/dist/esm/dso-header.entry.js +51 -12
  76. package/dist/esm/dso-highlight-box.entry.js +1 -1
  77. package/dist/esm/dso-info_3.entry.js +1 -1
  78. package/dist/esm/dso-toolkit.js +1 -1
  79. package/dist/esm/dso-tree-view.entry.js +1 -1
  80. package/dist/esm/dso-viewer-grid.entry.js +2 -2
  81. package/dist/esm/dsot-document-component-demo.entry.js +2 -2
  82. package/dist/esm/loader.js +1 -1
  83. package/dist/types/components/document-component/document-component-heading.d.ts +1 -1
  84. package/dist/types/components/document-component/document-component.d.ts +5 -3
  85. package/dist/types/components/dropdown-menu/dropdown-menu.d.ts +2 -0
  86. package/dist/types/components/header/header.d.ts +2 -0
  87. package/dist/types/components.d.ts +7 -105
  88. package/package.json +3 -5
  89. package/dist/bundle/dso-tooltip.d.ts +0 -11
  90. package/dist/bundle/dso-tooltip.js +0 -2119
  91. package/dist/bundle/p-CAqSxnd4.js +0 -48
  92. package/dist/cjs/dso-tooltip.cjs.entry.js +0 -2080
  93. package/dist/collection/components/tooltip/tooltip.css +0 -114
  94. package/dist/collection/components/tooltip/tooltip.js +0 -448
  95. package/dist/components/dso-tooltip.d.ts +0 -11
  96. package/dist/components/dso-tooltip.js +0 -1
  97. package/dist/dso-toolkit/p-2149be85.entry.js +0 -1
  98. package/dist/dso-toolkit/p-5cdda2dd.entry.js +0 -1
  99. package/dist/dso-toolkit/p-6e027a66.entry.js +0 -1
  100. package/dist/dso-toolkit/p-87a19b2e.entry.js +0 -1
  101. package/dist/dso-toolkit/p-cfb08b19.entry.js +0 -1
  102. package/dist/dso-toolkit/p-e3c1777e.entry.js +0 -1
  103. package/dist/esm/dso-tooltip.entry.js +0 -2078
  104. package/dist/types/components/tooltip/tooltip.d.ts +0 -61
@@ -1,2080 +0,0 @@
1
- 'use strict';
2
-
3
- var index = require('./index-fOjUpMJG.js');
4
- var clsx = require('./clsx-BtxeOLZW.js');
5
- var index$1 = require('./index-DMUCyuUA.js');
6
-
7
- var top = 'top';
8
- var bottom = 'bottom';
9
- var right = 'right';
10
- var left = 'left';
11
- var auto = 'auto';
12
- var basePlacements = [top, bottom, right, left];
13
- var start = 'start';
14
- var end = 'end';
15
- var clippingParents = 'clippingParents';
16
- var viewport = 'viewport';
17
- var popper = 'popper';
18
- var reference = 'reference';
19
- var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
20
- return acc.concat([placement + "-" + start, placement + "-" + end]);
21
- }, []);
22
- var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
23
- return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
24
- }, []); // modifiers that need to read the DOM
25
-
26
- var beforeRead = 'beforeRead';
27
- var read = 'read';
28
- var afterRead = 'afterRead'; // pure-logic modifiers
29
-
30
- var beforeMain = 'beforeMain';
31
- var main = 'main';
32
- var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
33
-
34
- var beforeWrite = 'beforeWrite';
35
- var write = 'write';
36
- var afterWrite = 'afterWrite';
37
- var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
38
-
39
- function getNodeName(element) {
40
- return element ? (element.nodeName || '').toLowerCase() : null;
41
- }
42
-
43
- function getWindow(node) {
44
- if (node == null) {
45
- return window;
46
- }
47
-
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
- function isElement(node) {
57
- var OwnElement = getWindow(node).Element;
58
- return node instanceof OwnElement || node instanceof Element;
59
- }
60
-
61
- function isHTMLElement(node) {
62
- var OwnElement = getWindow(node).HTMLElement;
63
- return node instanceof OwnElement || node instanceof HTMLElement;
64
- }
65
-
66
- function isShadowRoot(node) {
67
- // IE 11 has no ShadowRoot
68
- if (typeof ShadowRoot === 'undefined') {
69
- return false;
70
- }
71
-
72
- var OwnElement = getWindow(node).ShadowRoot;
73
- return node instanceof OwnElement || node instanceof ShadowRoot;
74
- }
75
-
76
- // and applies them to the HTMLElements such as popper and arrow
77
-
78
- function applyStyles(_ref) {
79
- var state = _ref.state;
80
- Object.keys(state.elements).forEach(function (name) {
81
- var style = state.styles[name] || {};
82
- var attributes = state.attributes[name] || {};
83
- var element = state.elements[name]; // arrow is optional + virtual elements
84
-
85
- if (!isHTMLElement(element) || !getNodeName(element)) {
86
- return;
87
- } // Flow doesn't support to extend this property, but it's the most
88
- // effective way to apply styles to an HTMLElement
89
- // $FlowFixMe[cannot-write]
90
-
91
-
92
- Object.assign(element.style, style);
93
- Object.keys(attributes).forEach(function (name) {
94
- var value = attributes[name];
95
-
96
- if (value === false) {
97
- element.removeAttribute(name);
98
- } else {
99
- element.setAttribute(name, value === true ? '' : value);
100
- }
101
- });
102
- });
103
- }
104
-
105
- function effect$2(_ref2) {
106
- var state = _ref2.state;
107
- var initialStyles = {
108
- popper: {
109
- position: state.options.strategy,
110
- left: '0',
111
- top: '0',
112
- margin: '0'
113
- },
114
- arrow: {
115
- position: 'absolute'
116
- },
117
- reference: {}
118
- };
119
- Object.assign(state.elements.popper.style, initialStyles.popper);
120
- state.styles = initialStyles;
121
-
122
- if (state.elements.arrow) {
123
- Object.assign(state.elements.arrow.style, initialStyles.arrow);
124
- }
125
-
126
- return function () {
127
- Object.keys(state.elements).forEach(function (name) {
128
- var element = state.elements[name];
129
- var attributes = state.attributes[name] || {};
130
- var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
131
-
132
- var style = styleProperties.reduce(function (style, property) {
133
- style[property] = '';
134
- return style;
135
- }, {}); // arrow is optional + virtual elements
136
-
137
- if (!isHTMLElement(element) || !getNodeName(element)) {
138
- return;
139
- }
140
-
141
- Object.assign(element.style, style);
142
- Object.keys(attributes).forEach(function (attribute) {
143
- element.removeAttribute(attribute);
144
- });
145
- });
146
- };
147
- } // eslint-disable-next-line import/no-unused-modules
148
-
149
-
150
- var applyStyles$1 = {
151
- name: 'applyStyles',
152
- enabled: true,
153
- phase: 'write',
154
- fn: applyStyles,
155
- effect: effect$2,
156
- requires: ['computeStyles']
157
- };
158
-
159
- function getBasePlacement(placement) {
160
- return placement.split('-')[0];
161
- }
162
-
163
- var max = Math.max;
164
- var min = Math.min;
165
- var round = Math.round;
166
-
167
- function getUAString() {
168
- var uaData = navigator.userAgentData;
169
-
170
- if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
171
- return uaData.brands.map(function (item) {
172
- return item.brand + "/" + item.version;
173
- }).join(' ');
174
- }
175
-
176
- return navigator.userAgent;
177
- }
178
-
179
- function isLayoutViewport() {
180
- return !/^((?!chrome|android).)*safari/i.test(getUAString());
181
- }
182
-
183
- function getBoundingClientRect(element, includeScale, isFixedStrategy) {
184
- if (includeScale === void 0) {
185
- includeScale = false;
186
- }
187
-
188
- if (isFixedStrategy === void 0) {
189
- isFixedStrategy = false;
190
- }
191
-
192
- var clientRect = element.getBoundingClientRect();
193
- var scaleX = 1;
194
- var scaleY = 1;
195
-
196
- if (includeScale && isHTMLElement(element)) {
197
- scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
198
- scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
199
- }
200
-
201
- var _ref = isElement(element) ? getWindow(element) : window,
202
- visualViewport = _ref.visualViewport;
203
-
204
- var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
205
- var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
206
- var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
207
- var width = clientRect.width / scaleX;
208
- var height = clientRect.height / scaleY;
209
- return {
210
- width: width,
211
- height: height,
212
- top: y,
213
- right: x + width,
214
- bottom: y + height,
215
- left: x,
216
- x: x,
217
- y: y
218
- };
219
- }
220
-
221
- // means it doesn't take into account transforms.
222
-
223
- function getLayoutRect(element) {
224
- var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
225
- // Fixes https://github.com/popperjs/popper-core/issues/1223
226
-
227
- var width = element.offsetWidth;
228
- var height = element.offsetHeight;
229
-
230
- if (Math.abs(clientRect.width - width) <= 1) {
231
- width = clientRect.width;
232
- }
233
-
234
- if (Math.abs(clientRect.height - height) <= 1) {
235
- height = clientRect.height;
236
- }
237
-
238
- return {
239
- x: element.offsetLeft,
240
- y: element.offsetTop,
241
- width: width,
242
- height: height
243
- };
244
- }
245
-
246
- function contains(parent, child) {
247
- var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
248
-
249
- if (parent.contains(child)) {
250
- return true;
251
- } // then fallback to custom implementation with Shadow DOM support
252
- else if (rootNode && isShadowRoot(rootNode)) {
253
- var next = child;
254
-
255
- do {
256
- if (next && parent.isSameNode(next)) {
257
- return true;
258
- } // $FlowFixMe[prop-missing]: need a better way to handle this...
259
-
260
-
261
- next = next.parentNode || next.host;
262
- } while (next);
263
- } // Give up, the result is false
264
-
265
-
266
- return false;
267
- }
268
-
269
- function getComputedStyle(element) {
270
- return getWindow(element).getComputedStyle(element);
271
- }
272
-
273
- function isTableElement(element) {
274
- return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
275
- }
276
-
277
- function getDocumentElement(element) {
278
- // $FlowFixMe[incompatible-return]: assume body is always available
279
- return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
280
- element.document) || window.document).documentElement;
281
- }
282
-
283
- function getParentNode(element) {
284
- if (getNodeName(element) === 'html') {
285
- return element;
286
- }
287
-
288
- return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
289
- // $FlowFixMe[incompatible-return]
290
- // $FlowFixMe[prop-missing]
291
- element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
292
- element.parentNode || ( // DOM Element detected
293
- isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
294
- // $FlowFixMe[incompatible-call]: HTMLElement is a Node
295
- getDocumentElement(element) // fallback
296
-
297
- );
298
- }
299
-
300
- function getTrueOffsetParent(element) {
301
- if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
302
- getComputedStyle(element).position === 'fixed') {
303
- return null;
304
- }
305
-
306
- return element.offsetParent;
307
- } // `.offsetParent` reports `null` for fixed elements, while absolute elements
308
- // return the containing block
309
-
310
-
311
- function getContainingBlock(element) {
312
- var isFirefox = /firefox/i.test(getUAString());
313
- var isIE = /Trident/i.test(getUAString());
314
-
315
- if (isIE && isHTMLElement(element)) {
316
- // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
317
- var elementCss = getComputedStyle(element);
318
-
319
- if (elementCss.position === 'fixed') {
320
- return null;
321
- }
322
- }
323
-
324
- var currentNode = getParentNode(element);
325
-
326
- if (isShadowRoot(currentNode)) {
327
- currentNode = currentNode.host;
328
- }
329
-
330
- while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
331
- var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
332
- // create a containing block.
333
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
334
-
335
- 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') {
336
- return currentNode;
337
- } else {
338
- currentNode = currentNode.parentNode;
339
- }
340
- }
341
-
342
- return null;
343
- } // Gets the closest ancestor positioned element. Handles some edge cases,
344
- // such as table ancestors and cross browser bugs.
345
-
346
-
347
- function getOffsetParent(element) {
348
- var window = getWindow(element);
349
- var offsetParent = getTrueOffsetParent(element);
350
-
351
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
352
- offsetParent = getTrueOffsetParent(offsetParent);
353
- }
354
-
355
- if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
356
- return window;
357
- }
358
-
359
- return offsetParent || getContainingBlock(element) || window;
360
- }
361
-
362
- function getMainAxisFromPlacement(placement) {
363
- return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
364
- }
365
-
366
- function within(min$1, value, max$1) {
367
- return max(min$1, min(value, max$1));
368
- }
369
- function withinMaxClamp(min, value, max) {
370
- var v = within(min, value, max);
371
- return v > max ? max : v;
372
- }
373
-
374
- function getFreshSideObject() {
375
- return {
376
- top: 0,
377
- right: 0,
378
- bottom: 0,
379
- left: 0
380
- };
381
- }
382
-
383
- function mergePaddingObject(paddingObject) {
384
- return Object.assign({}, getFreshSideObject(), paddingObject);
385
- }
386
-
387
- function expandToHashMap(value, keys) {
388
- return keys.reduce(function (hashMap, key) {
389
- hashMap[key] = value;
390
- return hashMap;
391
- }, {});
392
- }
393
-
394
- var toPaddingObject = function toPaddingObject(padding, state) {
395
- padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
396
- placement: state.placement
397
- })) : padding;
398
- return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
399
- };
400
-
401
- function arrow(_ref) {
402
- var _state$modifiersData$;
403
-
404
- var state = _ref.state,
405
- name = _ref.name,
406
- options = _ref.options;
407
- var arrowElement = state.elements.arrow;
408
- var popperOffsets = state.modifiersData.popperOffsets;
409
- var basePlacement = getBasePlacement(state.placement);
410
- var axis = getMainAxisFromPlacement(basePlacement);
411
- var isVertical = [left, right].indexOf(basePlacement) >= 0;
412
- var len = isVertical ? 'height' : 'width';
413
-
414
- if (!arrowElement || !popperOffsets) {
415
- return;
416
- }
417
-
418
- var paddingObject = toPaddingObject(options.padding, state);
419
- var arrowRect = getLayoutRect(arrowElement);
420
- var minProp = axis === 'y' ? top : left;
421
- var maxProp = axis === 'y' ? bottom : right;
422
- var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
423
- var startDiff = popperOffsets[axis] - state.rects.reference[axis];
424
- var arrowOffsetParent = getOffsetParent(arrowElement);
425
- var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
426
- var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
427
- // outside of the popper bounds
428
-
429
- var min = paddingObject[minProp];
430
- var max = clientSize - arrowRect[len] - paddingObject[maxProp];
431
- var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
432
- var offset = within(min, center, max); // Prevents breaking syntax highlighting...
433
-
434
- var axisProp = axis;
435
- state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
436
- }
437
-
438
- function effect$1(_ref2) {
439
- var state = _ref2.state,
440
- options = _ref2.options;
441
- var _options$element = options.element,
442
- arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
443
-
444
- if (arrowElement == null) {
445
- return;
446
- } // CSS selector
447
-
448
-
449
- if (typeof arrowElement === 'string') {
450
- arrowElement = state.elements.popper.querySelector(arrowElement);
451
-
452
- if (!arrowElement) {
453
- return;
454
- }
455
- }
456
-
457
- if (!contains(state.elements.popper, arrowElement)) {
458
- return;
459
- }
460
-
461
- state.elements.arrow = arrowElement;
462
- } // eslint-disable-next-line import/no-unused-modules
463
-
464
-
465
- var arrow$1 = {
466
- name: 'arrow',
467
- enabled: true,
468
- phase: 'main',
469
- fn: arrow,
470
- effect: effect$1,
471
- requires: ['popperOffsets'],
472
- requiresIfExists: ['preventOverflow']
473
- };
474
-
475
- function getVariation(placement) {
476
- return placement.split('-')[1];
477
- }
478
-
479
- var unsetSides = {
480
- top: 'auto',
481
- right: 'auto',
482
- bottom: 'auto',
483
- left: 'auto'
484
- }; // Round the offsets to the nearest suitable subpixel based on the DPR.
485
- // Zooming can change the DPR, but it seems to report a value that will
486
- // cleanly divide the values into the appropriate subpixels.
487
-
488
- function roundOffsetsByDPR(_ref, win) {
489
- var x = _ref.x,
490
- y = _ref.y;
491
- var dpr = win.devicePixelRatio || 1;
492
- return {
493
- x: round(x * dpr) / dpr || 0,
494
- y: round(y * dpr) / dpr || 0
495
- };
496
- }
497
-
498
- function mapToStyles(_ref2) {
499
- var _Object$assign2;
500
-
501
- var popper = _ref2.popper,
502
- popperRect = _ref2.popperRect,
503
- placement = _ref2.placement,
504
- variation = _ref2.variation,
505
- offsets = _ref2.offsets,
506
- position = _ref2.position,
507
- gpuAcceleration = _ref2.gpuAcceleration,
508
- adaptive = _ref2.adaptive,
509
- roundOffsets = _ref2.roundOffsets,
510
- isFixed = _ref2.isFixed;
511
- var _offsets$x = offsets.x,
512
- x = _offsets$x === void 0 ? 0 : _offsets$x,
513
- _offsets$y = offsets.y,
514
- y = _offsets$y === void 0 ? 0 : _offsets$y;
515
-
516
- var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
517
- x: x,
518
- y: y
519
- }) : {
520
- x: x,
521
- y: y
522
- };
523
-
524
- x = _ref3.x;
525
- y = _ref3.y;
526
- var hasX = offsets.hasOwnProperty('x');
527
- var hasY = offsets.hasOwnProperty('y');
528
- var sideX = left;
529
- var sideY = top;
530
- var win = window;
531
-
532
- if (adaptive) {
533
- var offsetParent = getOffsetParent(popper);
534
- var heightProp = 'clientHeight';
535
- var widthProp = 'clientWidth';
536
-
537
- if (offsetParent === getWindow(popper)) {
538
- offsetParent = getDocumentElement(popper);
539
-
540
- if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
541
- heightProp = 'scrollHeight';
542
- widthProp = 'scrollWidth';
543
- }
544
- } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
545
-
546
-
547
- offsetParent = offsetParent;
548
-
549
- if (placement === top || (placement === left || placement === right) && variation === end) {
550
- sideY = bottom;
551
- var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
552
- offsetParent[heightProp];
553
- y -= offsetY - popperRect.height;
554
- y *= gpuAcceleration ? 1 : -1;
555
- }
556
-
557
- if (placement === left || (placement === top || placement === bottom) && variation === end) {
558
- sideX = right;
559
- var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
560
- offsetParent[widthProp];
561
- x -= offsetX - popperRect.width;
562
- x *= gpuAcceleration ? 1 : -1;
563
- }
564
- }
565
-
566
- var commonStyles = Object.assign({
567
- position: position
568
- }, adaptive && unsetSides);
569
-
570
- var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
571
- x: x,
572
- y: y
573
- }, getWindow(popper)) : {
574
- x: x,
575
- y: y
576
- };
577
-
578
- x = _ref4.x;
579
- y = _ref4.y;
580
-
581
- if (gpuAcceleration) {
582
- var _Object$assign;
583
-
584
- 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));
585
- }
586
-
587
- return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
588
- }
589
-
590
- function computeStyles(_ref5) {
591
- var state = _ref5.state,
592
- options = _ref5.options;
593
- var _options$gpuAccelerat = options.gpuAcceleration,
594
- gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
595
- _options$adaptive = options.adaptive,
596
- adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
597
- _options$roundOffsets = options.roundOffsets,
598
- roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
599
- var commonStyles = {
600
- placement: getBasePlacement(state.placement),
601
- variation: getVariation(state.placement),
602
- popper: state.elements.popper,
603
- popperRect: state.rects.popper,
604
- gpuAcceleration: gpuAcceleration,
605
- isFixed: state.options.strategy === 'fixed'
606
- };
607
-
608
- if (state.modifiersData.popperOffsets != null) {
609
- state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
610
- offsets: state.modifiersData.popperOffsets,
611
- position: state.options.strategy,
612
- adaptive: adaptive,
613
- roundOffsets: roundOffsets
614
- })));
615
- }
616
-
617
- if (state.modifiersData.arrow != null) {
618
- state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
619
- offsets: state.modifiersData.arrow,
620
- position: 'absolute',
621
- adaptive: false,
622
- roundOffsets: roundOffsets
623
- })));
624
- }
625
-
626
- state.attributes.popper = Object.assign({}, state.attributes.popper, {
627
- 'data-popper-placement': state.placement
628
- });
629
- } // eslint-disable-next-line import/no-unused-modules
630
-
631
-
632
- var computeStyles$1 = {
633
- name: 'computeStyles',
634
- enabled: true,
635
- phase: 'beforeWrite',
636
- fn: computeStyles,
637
- data: {}
638
- };
639
-
640
- var passive = {
641
- passive: true
642
- };
643
-
644
- function effect(_ref) {
645
- var state = _ref.state,
646
- instance = _ref.instance,
647
- options = _ref.options;
648
- var _options$scroll = options.scroll,
649
- scroll = _options$scroll === void 0 ? true : _options$scroll,
650
- _options$resize = options.resize,
651
- resize = _options$resize === void 0 ? true : _options$resize;
652
- var window = getWindow(state.elements.popper);
653
- var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
654
-
655
- if (scroll) {
656
- scrollParents.forEach(function (scrollParent) {
657
- scrollParent.addEventListener('scroll', instance.update, passive);
658
- });
659
- }
660
-
661
- if (resize) {
662
- window.addEventListener('resize', instance.update, passive);
663
- }
664
-
665
- return function () {
666
- if (scroll) {
667
- scrollParents.forEach(function (scrollParent) {
668
- scrollParent.removeEventListener('scroll', instance.update, passive);
669
- });
670
- }
671
-
672
- if (resize) {
673
- window.removeEventListener('resize', instance.update, passive);
674
- }
675
- };
676
- } // eslint-disable-next-line import/no-unused-modules
677
-
678
-
679
- var eventListeners = {
680
- name: 'eventListeners',
681
- enabled: true,
682
- phase: 'write',
683
- fn: function fn() {},
684
- effect: effect,
685
- data: {}
686
- };
687
-
688
- var hash$1 = {
689
- left: 'right',
690
- right: 'left',
691
- bottom: 'top',
692
- top: 'bottom'
693
- };
694
- function getOppositePlacement(placement) {
695
- return placement.replace(/left|right|bottom|top/g, function (matched) {
696
- return hash$1[matched];
697
- });
698
- }
699
-
700
- var hash = {
701
- start: 'end',
702
- end: 'start'
703
- };
704
- function getOppositeVariationPlacement(placement) {
705
- return placement.replace(/start|end/g, function (matched) {
706
- return hash[matched];
707
- });
708
- }
709
-
710
- function getWindowScroll(node) {
711
- var win = getWindow(node);
712
- var scrollLeft = win.pageXOffset;
713
- var scrollTop = win.pageYOffset;
714
- return {
715
- scrollLeft: scrollLeft,
716
- scrollTop: scrollTop
717
- };
718
- }
719
-
720
- function getWindowScrollBarX(element) {
721
- // If <html> has a CSS width greater than the viewport, then this will be
722
- // incorrect for RTL.
723
- // Popper 1 is broken in this case and never had a bug report so let's assume
724
- // it's not an issue. I don't think anyone ever specifies width on <html>
725
- // anyway.
726
- // Browsers where the left scrollbar doesn't cause an issue report `0` for
727
- // this (e.g. Edge 2019, IE11, Safari)
728
- return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
729
- }
730
-
731
- function getViewportRect(element, strategy) {
732
- var win = getWindow(element);
733
- var html = getDocumentElement(element);
734
- var visualViewport = win.visualViewport;
735
- var width = html.clientWidth;
736
- var height = html.clientHeight;
737
- var x = 0;
738
- var y = 0;
739
-
740
- if (visualViewport) {
741
- width = visualViewport.width;
742
- height = visualViewport.height;
743
- var layoutViewport = isLayoutViewport();
744
-
745
- if (layoutViewport || !layoutViewport && strategy === 'fixed') {
746
- x = visualViewport.offsetLeft;
747
- y = visualViewport.offsetTop;
748
- }
749
- }
750
-
751
- return {
752
- width: width,
753
- height: height,
754
- x: x + getWindowScrollBarX(element),
755
- y: y
756
- };
757
- }
758
-
759
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable
760
-
761
- function getDocumentRect(element) {
762
- var _element$ownerDocumen;
763
-
764
- var html = getDocumentElement(element);
765
- var winScroll = getWindowScroll(element);
766
- var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
767
- var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
768
- var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
769
- var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
770
- var y = -winScroll.scrollTop;
771
-
772
- if (getComputedStyle(body || html).direction === 'rtl') {
773
- x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
774
- }
775
-
776
- return {
777
- width: width,
778
- height: height,
779
- x: x,
780
- y: y
781
- };
782
- }
783
-
784
- function isScrollParent(element) {
785
- // Firefox wants us to check `-x` and `-y` variations as well
786
- var _getComputedStyle = getComputedStyle(element),
787
- overflow = _getComputedStyle.overflow,
788
- overflowX = _getComputedStyle.overflowX,
789
- overflowY = _getComputedStyle.overflowY;
790
-
791
- return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
792
- }
793
-
794
- function getScrollParent(node) {
795
- if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
796
- // $FlowFixMe[incompatible-return]: assume body is always available
797
- return node.ownerDocument.body;
798
- }
799
-
800
- if (isHTMLElement(node) && isScrollParent(node)) {
801
- return node;
802
- }
803
-
804
- return getScrollParent(getParentNode(node));
805
- }
806
-
807
- /*
808
- given a DOM element, return the list of all scroll parents, up the list of ancesors
809
- until we get to the top window object. This list is what we attach scroll listeners
810
- to, because if any of these parent elements scroll, we'll need to re-calculate the
811
- reference element's position.
812
- */
813
-
814
- function listScrollParents(element, list) {
815
- var _element$ownerDocumen;
816
-
817
- if (list === void 0) {
818
- list = [];
819
- }
820
-
821
- var scrollParent = getScrollParent(element);
822
- var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
823
- var win = getWindow(scrollParent);
824
- var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
825
- var updatedList = list.concat(target);
826
- return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
827
- updatedList.concat(listScrollParents(getParentNode(target)));
828
- }
829
-
830
- function rectToClientRect(rect) {
831
- return Object.assign({}, rect, {
832
- left: rect.x,
833
- top: rect.y,
834
- right: rect.x + rect.width,
835
- bottom: rect.y + rect.height
836
- });
837
- }
838
-
839
- function getInnerBoundingClientRect(element, strategy) {
840
- var rect = getBoundingClientRect(element, false, strategy === 'fixed');
841
- rect.top = rect.top + element.clientTop;
842
- rect.left = rect.left + element.clientLeft;
843
- rect.bottom = rect.top + element.clientHeight;
844
- rect.right = rect.left + element.clientWidth;
845
- rect.width = element.clientWidth;
846
- rect.height = element.clientHeight;
847
- rect.x = rect.left;
848
- rect.y = rect.top;
849
- return rect;
850
- }
851
-
852
- function getClientRectFromMixedType(element, clippingParent, strategy) {
853
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
854
- } // A "clipping parent" is an overflowable container with the characteristic of
855
- // clipping (or hiding) overflowing elements with a position different from
856
- // `initial`
857
-
858
-
859
- function getClippingParents(element) {
860
- var clippingParents = listScrollParents(getParentNode(element));
861
- var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
862
- var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
863
-
864
- if (!isElement(clipperElement)) {
865
- return [];
866
- } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
867
-
868
-
869
- return clippingParents.filter(function (clippingParent) {
870
- return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
871
- });
872
- } // Gets the maximum area that the element is visible in due to any number of
873
- // clipping parents
874
-
875
-
876
- function getClippingRect(element, boundary, rootBoundary, strategy) {
877
- var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
878
- var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
879
- var firstClippingParent = clippingParents[0];
880
- var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
881
- var rect = getClientRectFromMixedType(element, clippingParent, strategy);
882
- accRect.top = max(rect.top, accRect.top);
883
- accRect.right = min(rect.right, accRect.right);
884
- accRect.bottom = min(rect.bottom, accRect.bottom);
885
- accRect.left = max(rect.left, accRect.left);
886
- return accRect;
887
- }, getClientRectFromMixedType(element, firstClippingParent, strategy));
888
- clippingRect.width = clippingRect.right - clippingRect.left;
889
- clippingRect.height = clippingRect.bottom - clippingRect.top;
890
- clippingRect.x = clippingRect.left;
891
- clippingRect.y = clippingRect.top;
892
- return clippingRect;
893
- }
894
-
895
- function computeOffsets(_ref) {
896
- var reference = _ref.reference,
897
- element = _ref.element,
898
- placement = _ref.placement;
899
- var basePlacement = placement ? getBasePlacement(placement) : null;
900
- var variation = placement ? getVariation(placement) : null;
901
- var commonX = reference.x + reference.width / 2 - element.width / 2;
902
- var commonY = reference.y + reference.height / 2 - element.height / 2;
903
- var offsets;
904
-
905
- switch (basePlacement) {
906
- case top:
907
- offsets = {
908
- x: commonX,
909
- y: reference.y - element.height
910
- };
911
- break;
912
-
913
- case bottom:
914
- offsets = {
915
- x: commonX,
916
- y: reference.y + reference.height
917
- };
918
- break;
919
-
920
- case right:
921
- offsets = {
922
- x: reference.x + reference.width,
923
- y: commonY
924
- };
925
- break;
926
-
927
- case left:
928
- offsets = {
929
- x: reference.x - element.width,
930
- y: commonY
931
- };
932
- break;
933
-
934
- default:
935
- offsets = {
936
- x: reference.x,
937
- y: reference.y
938
- };
939
- }
940
-
941
- var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
942
-
943
- if (mainAxis != null) {
944
- var len = mainAxis === 'y' ? 'height' : 'width';
945
-
946
- switch (variation) {
947
- case start:
948
- offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
949
- break;
950
-
951
- case end:
952
- offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
953
- break;
954
- }
955
- }
956
-
957
- return offsets;
958
- }
959
-
960
- function detectOverflow(state, options) {
961
- if (options === void 0) {
962
- options = {};
963
- }
964
-
965
- var _options = options,
966
- _options$placement = _options.placement,
967
- placement = _options$placement === void 0 ? state.placement : _options$placement,
968
- _options$strategy = _options.strategy,
969
- strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
970
- _options$boundary = _options.boundary,
971
- boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
972
- _options$rootBoundary = _options.rootBoundary,
973
- rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
974
- _options$elementConte = _options.elementContext,
975
- elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
976
- _options$altBoundary = _options.altBoundary,
977
- altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
978
- _options$padding = _options.padding,
979
- padding = _options$padding === void 0 ? 0 : _options$padding;
980
- var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
981
- var altContext = elementContext === popper ? reference : popper;
982
- var popperRect = state.rects.popper;
983
- var element = state.elements[altBoundary ? altContext : elementContext];
984
- var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
985
- var referenceClientRect = getBoundingClientRect(state.elements.reference);
986
- var popperOffsets = computeOffsets({
987
- reference: referenceClientRect,
988
- element: popperRect,
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
- var 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
- var 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
- var 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
- placement: state.placement
1317
- });
1318
- } // eslint-disable-next-line import/no-unused-modules
1319
-
1320
-
1321
- var popperOffsets$1 = {
1322
- name: 'popperOffsets',
1323
- enabled: true,
1324
- phase: 'read',
1325
- fn: popperOffsets,
1326
- data: {}
1327
- };
1328
-
1329
- function getAltAxis(axis) {
1330
- return axis === 'x' ? 'y' : 'x';
1331
- }
1332
-
1333
- function preventOverflow(_ref) {
1334
- var state = _ref.state,
1335
- options = _ref.options,
1336
- name = _ref.name;
1337
- var _options$mainAxis = options.mainAxis,
1338
- checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1339
- _options$altAxis = options.altAxis,
1340
- checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
1341
- boundary = options.boundary,
1342
- rootBoundary = options.rootBoundary,
1343
- altBoundary = options.altBoundary,
1344
- padding = options.padding,
1345
- _options$tether = options.tether,
1346
- tether = _options$tether === void 0 ? true : _options$tether,
1347
- _options$tetherOffset = options.tetherOffset,
1348
- tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
1349
- var overflow = detectOverflow(state, {
1350
- boundary: boundary,
1351
- rootBoundary: rootBoundary,
1352
- padding: padding,
1353
- altBoundary: altBoundary
1354
- });
1355
- var basePlacement = getBasePlacement(state.placement);
1356
- var variation = getVariation(state.placement);
1357
- var isBasePlacement = !variation;
1358
- var mainAxis = getMainAxisFromPlacement(basePlacement);
1359
- var altAxis = getAltAxis(mainAxis);
1360
- var popperOffsets = state.modifiersData.popperOffsets;
1361
- var referenceRect = state.rects.reference;
1362
- var popperRect = state.rects.popper;
1363
- var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
1364
- placement: state.placement
1365
- })) : tetherOffset;
1366
- var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
1367
- mainAxis: tetherOffsetValue,
1368
- altAxis: tetherOffsetValue
1369
- } : Object.assign({
1370
- mainAxis: 0,
1371
- altAxis: 0
1372
- }, tetherOffsetValue);
1373
- var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
1374
- var data = {
1375
- x: 0,
1376
- y: 0
1377
- };
1378
-
1379
- if (!popperOffsets) {
1380
- return;
1381
- }
1382
-
1383
- if (checkMainAxis) {
1384
- var _offsetModifierState$;
1385
-
1386
- var mainSide = mainAxis === 'y' ? top : left;
1387
- var altSide = mainAxis === 'y' ? bottom : right;
1388
- var len = mainAxis === 'y' ? 'height' : 'width';
1389
- var offset = popperOffsets[mainAxis];
1390
- var min$1 = offset + overflow[mainSide];
1391
- var max$1 = offset - overflow[altSide];
1392
- var additive = tether ? -popperRect[len] / 2 : 0;
1393
- var minLen = variation === start ? referenceRect[len] : popperRect[len];
1394
- var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
1395
- // outside the reference bounds
1396
-
1397
- var arrowElement = state.elements.arrow;
1398
- var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
1399
- width: 0,
1400
- height: 0
1401
- };
1402
- var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
1403
- var arrowPaddingMin = arrowPaddingObject[mainSide];
1404
- var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
1405
- // to include its full size in the calculation. If the reference is small
1406
- // and near the edge of a boundary, the popper can overflow even if the
1407
- // reference is not overflowing as well (e.g. virtual elements with no
1408
- // width or height)
1409
-
1410
- var arrowLen = within(0, referenceRect[len], arrowRect[len]);
1411
- var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
1412
- var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
1413
- var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1414
- var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
1415
- var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
1416
- var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
1417
- var tetherMax = offset + maxOffset - offsetModifierValue;
1418
- var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
1419
- popperOffsets[mainAxis] = preventedOffset;
1420
- data[mainAxis] = preventedOffset - offset;
1421
- }
1422
-
1423
- if (checkAltAxis) {
1424
- var _offsetModifierState$2;
1425
-
1426
- var _mainSide = mainAxis === 'x' ? top : left;
1427
-
1428
- var _altSide = mainAxis === 'x' ? bottom : right;
1429
-
1430
- var _offset = popperOffsets[altAxis];
1431
-
1432
- var _len = altAxis === 'y' ? 'height' : 'width';
1433
-
1434
- var _min = _offset + overflow[_mainSide];
1435
-
1436
- var _max = _offset - overflow[_altSide];
1437
-
1438
- var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
1439
-
1440
- var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
1441
-
1442
- var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
1443
-
1444
- var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
1445
-
1446
- var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
1447
-
1448
- popperOffsets[altAxis] = _preventedOffset;
1449
- data[altAxis] = _preventedOffset - _offset;
1450
- }
1451
-
1452
- state.modifiersData[name] = data;
1453
- } // eslint-disable-next-line import/no-unused-modules
1454
-
1455
-
1456
- var preventOverflow$1 = {
1457
- name: 'preventOverflow',
1458
- enabled: true,
1459
- phase: 'main',
1460
- fn: preventOverflow,
1461
- requiresIfExists: ['offset']
1462
- };
1463
-
1464
- function getHTMLElementScroll(element) {
1465
- return {
1466
- scrollLeft: element.scrollLeft,
1467
- scrollTop: element.scrollTop
1468
- };
1469
- }
1470
-
1471
- function getNodeScroll(node) {
1472
- if (node === getWindow(node) || !isHTMLElement(node)) {
1473
- return getWindowScroll(node);
1474
- } else {
1475
- return getHTMLElementScroll(node);
1476
- }
1477
- }
1478
-
1479
- function isElementScaled(element) {
1480
- var rect = element.getBoundingClientRect();
1481
- var scaleX = round(rect.width) / element.offsetWidth || 1;
1482
- var scaleY = round(rect.height) / element.offsetHeight || 1;
1483
- return scaleX !== 1 || scaleY !== 1;
1484
- } // Returns the composite rect of an element relative to its offsetParent.
1485
- // Composite means it takes into account transforms as well as layout.
1486
-
1487
-
1488
- function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1489
- if (isFixed === void 0) {
1490
- isFixed = false;
1491
- }
1492
-
1493
- var isOffsetParentAnElement = isHTMLElement(offsetParent);
1494
- var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
1495
- var documentElement = getDocumentElement(offsetParent);
1496
- var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
1497
- var scroll = {
1498
- scrollLeft: 0,
1499
- scrollTop: 0
1500
- };
1501
- var offsets = {
1502
- x: 0,
1503
- y: 0
1504
- };
1505
-
1506
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1507
- if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
1508
- isScrollParent(documentElement)) {
1509
- scroll = getNodeScroll(offsetParent);
1510
- }
1511
-
1512
- if (isHTMLElement(offsetParent)) {
1513
- offsets = getBoundingClientRect(offsetParent, true);
1514
- offsets.x += offsetParent.clientLeft;
1515
- offsets.y += offsetParent.clientTop;
1516
- } else if (documentElement) {
1517
- offsets.x = getWindowScrollBarX(documentElement);
1518
- }
1519
- }
1520
-
1521
- return {
1522
- x: rect.left + scroll.scrollLeft - offsets.x,
1523
- y: rect.top + scroll.scrollTop - offsets.y,
1524
- width: rect.width,
1525
- height: rect.height
1526
- };
1527
- }
1528
-
1529
- function order(modifiers) {
1530
- var map = new Map();
1531
- var visited = new Set();
1532
- var result = [];
1533
- modifiers.forEach(function (modifier) {
1534
- map.set(modifier.name, modifier);
1535
- }); // On visiting object, check for its dependencies and visit them recursively
1536
-
1537
- function sort(modifier) {
1538
- visited.add(modifier.name);
1539
- var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
1540
- requires.forEach(function (dep) {
1541
- if (!visited.has(dep)) {
1542
- var depModifier = map.get(dep);
1543
-
1544
- if (depModifier) {
1545
- sort(depModifier);
1546
- }
1547
- }
1548
- });
1549
- result.push(modifier);
1550
- }
1551
-
1552
- modifiers.forEach(function (modifier) {
1553
- if (!visited.has(modifier.name)) {
1554
- // check for visited object
1555
- sort(modifier);
1556
- }
1557
- });
1558
- return result;
1559
- }
1560
-
1561
- function orderModifiers(modifiers) {
1562
- // order based on dependencies
1563
- var orderedModifiers = order(modifiers); // order based on phase
1564
-
1565
- return modifierPhases.reduce(function (acc, phase) {
1566
- return acc.concat(orderedModifiers.filter(function (modifier) {
1567
- return modifier.phase === phase;
1568
- }));
1569
- }, []);
1570
- }
1571
-
1572
- function debounce(fn) {
1573
- var pending;
1574
- return function () {
1575
- if (!pending) {
1576
- pending = new Promise(function (resolve) {
1577
- Promise.resolve().then(function () {
1578
- pending = undefined;
1579
- resolve(fn());
1580
- });
1581
- });
1582
- }
1583
-
1584
- return pending;
1585
- };
1586
- }
1587
-
1588
- function mergeByName(modifiers) {
1589
- var merged = modifiers.reduce(function (merged, current) {
1590
- var existing = merged[current.name];
1591
- merged[current.name] = existing ? Object.assign({}, existing, current, {
1592
- options: Object.assign({}, existing.options, current.options),
1593
- data: Object.assign({}, existing.data, current.data)
1594
- }) : current;
1595
- return merged;
1596
- }, {}); // IE11 does not support Object.values
1597
-
1598
- return Object.keys(merged).map(function (key) {
1599
- return merged[key];
1600
- });
1601
- }
1602
-
1603
- var DEFAULT_OPTIONS = {
1604
- placement: 'bottom',
1605
- modifiers: [],
1606
- strategy: 'absolute'
1607
- };
1608
-
1609
- function areValidElements() {
1610
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1611
- args[_key] = arguments[_key];
1612
- }
1613
-
1614
- return !args.some(function (element) {
1615
- return !(element && typeof element.getBoundingClientRect === 'function');
1616
- });
1617
- }
1618
-
1619
- function popperGenerator(generatorOptions) {
1620
- if (generatorOptions === void 0) {
1621
- generatorOptions = {};
1622
- }
1623
-
1624
- var _generatorOptions = generatorOptions,
1625
- _generatorOptions$def = _generatorOptions.defaultModifiers,
1626
- defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
1627
- _generatorOptions$def2 = _generatorOptions.defaultOptions,
1628
- defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
1629
- return function createPopper(reference, popper, options) {
1630
- if (options === void 0) {
1631
- options = defaultOptions;
1632
- }
1633
-
1634
- var state = {
1635
- placement: 'bottom',
1636
- orderedModifiers: [],
1637
- options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
1638
- modifiersData: {},
1639
- elements: {
1640
- reference: reference,
1641
- popper: popper
1642
- },
1643
- attributes: {},
1644
- styles: {}
1645
- };
1646
- var effectCleanupFns = [];
1647
- var isDestroyed = false;
1648
- var instance = {
1649
- state: state,
1650
- setOptions: function setOptions(setOptionsAction) {
1651
- var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
1652
- cleanupModifierEffects();
1653
- state.options = Object.assign({}, defaultOptions, state.options, options);
1654
- state.scrollParents = {
1655
- reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
1656
- popper: listScrollParents(popper)
1657
- }; // Orders the modifiers based on their dependencies and `phase`
1658
- // properties
1659
-
1660
- var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
1661
-
1662
- state.orderedModifiers = orderedModifiers.filter(function (m) {
1663
- return m.enabled;
1664
- });
1665
- runModifierEffects();
1666
- return instance.update();
1667
- },
1668
- // Sync update – it will always be executed, even if not necessary. This
1669
- // is useful for low frequency updates where sync behavior simplifies the
1670
- // logic.
1671
- // For high frequency updates (e.g. `resize` and `scroll` events), always
1672
- // prefer the async Popper#update method
1673
- forceUpdate: function forceUpdate() {
1674
- if (isDestroyed) {
1675
- return;
1676
- }
1677
-
1678
- var _state$elements = state.elements,
1679
- reference = _state$elements.reference,
1680
- popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
1681
- // anymore
1682
-
1683
- if (!areValidElements(reference, popper)) {
1684
- return;
1685
- } // Store the reference and popper rects to be read by modifiers
1686
-
1687
-
1688
- state.rects = {
1689
- reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
1690
- popper: getLayoutRect(popper)
1691
- }; // Modifiers have the ability to reset the current update cycle. The
1692
- // most common use case for this is the `flip` modifier changing the
1693
- // placement, which then needs to re-run all the modifiers, because the
1694
- // logic was previously ran for the previous placement and is therefore
1695
- // stale/incorrect
1696
-
1697
- state.reset = false;
1698
- state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
1699
- // is filled with the initial data specified by the modifier. This means
1700
- // it doesn't persist and is fresh on each update.
1701
- // To ensure persistent data, use `${name}#persistent`
1702
-
1703
- state.orderedModifiers.forEach(function (modifier) {
1704
- return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
1705
- });
1706
-
1707
- for (var index = 0; index < state.orderedModifiers.length; index++) {
1708
- if (state.reset === true) {
1709
- state.reset = false;
1710
- index = -1;
1711
- continue;
1712
- }
1713
-
1714
- var _state$orderedModifie = state.orderedModifiers[index],
1715
- fn = _state$orderedModifie.fn,
1716
- _state$orderedModifie2 = _state$orderedModifie.options,
1717
- _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
1718
- name = _state$orderedModifie.name;
1719
-
1720
- if (typeof fn === 'function') {
1721
- state = fn({
1722
- state: state,
1723
- options: _options,
1724
- name: name,
1725
- instance: instance
1726
- }) || state;
1727
- }
1728
- }
1729
- },
1730
- // Async and optimistically optimized update – it will not be executed if
1731
- // not necessary (debounced to run at most once-per-tick)
1732
- update: debounce(function () {
1733
- return new Promise(function (resolve) {
1734
- instance.forceUpdate();
1735
- resolve(state);
1736
- });
1737
- }),
1738
- destroy: function destroy() {
1739
- cleanupModifierEffects();
1740
- isDestroyed = true;
1741
- }
1742
- };
1743
-
1744
- if (!areValidElements(reference, popper)) {
1745
- return instance;
1746
- }
1747
-
1748
- instance.setOptions(options).then(function (state) {
1749
- if (!isDestroyed && options.onFirstUpdate) {
1750
- options.onFirstUpdate(state);
1751
- }
1752
- }); // Modifiers have the ability to execute arbitrary code before the first
1753
- // update cycle runs. They will be executed in the same order as the update
1754
- // cycle. This is useful when a modifier adds some persistent data that
1755
- // other modifiers need to use, but the modifier is run after the dependent
1756
- // one.
1757
-
1758
- function runModifierEffects() {
1759
- state.orderedModifiers.forEach(function (_ref) {
1760
- var name = _ref.name,
1761
- _ref$options = _ref.options,
1762
- options = _ref$options === void 0 ? {} : _ref$options,
1763
- effect = _ref.effect;
1764
-
1765
- if (typeof effect === 'function') {
1766
- var cleanupFn = effect({
1767
- state: state,
1768
- name: name,
1769
- instance: instance,
1770
- options: options
1771
- });
1772
-
1773
- var noopFn = function noopFn() {};
1774
-
1775
- effectCleanupFns.push(cleanupFn || noopFn);
1776
- }
1777
- });
1778
- }
1779
-
1780
- function cleanupModifierEffects() {
1781
- effectCleanupFns.forEach(function (fn) {
1782
- return fn();
1783
- });
1784
- effectCleanupFns = [];
1785
- }
1786
-
1787
- return instance;
1788
- };
1789
- }
1790
-
1791
- var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
1792
- var createPopper = /*#__PURE__*/popperGenerator({
1793
- defaultModifiers: defaultModifiers
1794
- }); // eslint-disable-next-line import/no-unused-modules
1795
-
1796
- var maxSize = {
1797
- name: 'maxSize',
1798
- enabled: true,
1799
- phase: 'main',
1800
- requiresIfExists: ['offset', 'preventOverflow', 'flip'],
1801
- fn: function fn(_ref) {
1802
- var state = _ref.state,
1803
- name = _ref.name,
1804
- options = _ref.options;
1805
- var overflow = detectOverflow(state, options);
1806
-
1807
- var _ref2 = state.modifiersData.preventOverflow || {
1808
- x: 0,
1809
- y: 0
1810
- },
1811
- x = _ref2.x,
1812
- y = _ref2.y;
1813
-
1814
- var _state$rects$popper = state.rects.popper,
1815
- width = _state$rects$popper.width,
1816
- height = _state$rects$popper.height;
1817
-
1818
- var _state$placement$spli = state.placement.split('-'),
1819
- basePlacement = _state$placement$spli[0];
1820
-
1821
- var widthProp = basePlacement === 'left' ? 'left' : 'right';
1822
- var heightProp = basePlacement === 'top' ? 'top' : 'bottom';
1823
- state.modifiersData[name] = {
1824
- width: width - overflow[widthProp] - x,
1825
- height: height - overflow[heightProp] - y
1826
- };
1827
- }
1828
- };
1829
-
1830
- function hasOverflow(el) {
1831
- const style = window.getComputedStyle(el);
1832
- const overflowX = style.getPropertyValue("overflow-x");
1833
- const overflowY = style.getPropertyValue("overflow-y");
1834
- const overflowValues = ["hidden", "clip"];
1835
- return overflowValues.indexOf(overflowX) !== -1 || overflowValues.indexOf(overflowY) !== -1;
1836
- }
1837
-
1838
- const tooltipCss = () => `:host(.hidden){visibility:hidden}*,*::after,*::before{box-sizing:border-box}.tooltip{font-family:Asap, sans-serif;font-style:normal;font-weight:400;line-height:1.5;line-break:auto;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-spacing:normal;overflow-wrap:normal;white-space:normal;--_dso-link-color:#39870c;display:block;filter:drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));font-size:0.875rem;opacity:0;position:absolute;transition:opacity 0.15s linear;z-index:410}.tooltip.in{opacity:1}.tooltip.in .tooltip-inner{max-block-size:200vh;overflow:auto;visibility:visible;padding-block:8px;padding-inline:16px}.tooltip:not(.in) .tooltip-inner{max-block-size:0;overflow:hidden;visibility:hidden;transition:all 0s linear 0.15s}.tooltip .tooltip-inner{background-color:#fff;border-radius:4px;color:#191919;display:inline-block;font-size:1rem;max-inline-size:640px;position:relative}.tooltip .tooltip-inner.dso-small{max-inline-size:320px}.tooltip .tooltip-arrow{border-color:transparent;border-style:solid;block-size:0;inline-size:0}.tooltip[data-popper-placement=top]{margin-block-start:-3px;padding-inline:0}.tooltip[data-popper-placement=top] .tooltip-arrow{inset-block-end:0;border-block-start-color:#fff;border-width:6px;border-block-end-width:0;margin-inline-start:var(--tooltip-margin-inline-start, -3px)}.tooltip[data-popper-placement=right]{margin-inline-start:3px;padding-inline-start:6px}.tooltip[data-popper-placement=right] .tooltip-arrow{inset-inline-start:0;border-inline-end-color:#fff;border-width:6px;border-inline-start-width:0;margin-block-start:var(--tooltip-margin-block-start, -3px)}.tooltip[data-popper-placement=bottom]{margin-block-start:3px;padding-block-start:6px;padding-inline:0}.tooltip[data-popper-placement=bottom] .tooltip-arrow{inset-block-start:0;border-block-end-color:#fff;border-width:6px;border-block-start-width:0;margin-inline-start:var(--tooltip-margin-inline-start, -3px)}.tooltip[data-popper-placement=left]{margin-inline-start:-3px;margin-inline-end:var(--tooltip-margin-inline-end, unset);padding-block:0;padding-inline-end:6px}.tooltip[data-popper-placement=left] .tooltip-arrow{inset-inline-end:0;border-inline-start-color:#fff;border-width:6px;border-inline-end-width:0;margin-block-start:var(--tooltip-margin-block-start, -3px)}`;
1839
-
1840
- var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
1841
- if (kind === "a" && !f)
1842
- throw new TypeError("Private accessor was defined without a getter");
1843
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
1844
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
1845
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1846
- };
1847
- var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1848
- if (kind === "m")
1849
- throw new TypeError("Private method is not writable");
1850
- if (kind === "a" && !f)
1851
- throw new TypeError("Private accessor was defined without a setter");
1852
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
1853
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
1854
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
1855
- };
1856
- var _Tooltip_target;
1857
- // Keep const in sync with $tooltip-transition-duration in dso-toolkit/src/components/tooltip/tooltip.scss tooltip_root() mixin
1858
- const transitionDuration = 150;
1859
- const applyMaxSize = {
1860
- name: "applyMaxSize",
1861
- enabled: true,
1862
- phase: beforeWrite,
1863
- requires: ["maxSize"],
1864
- fn({ state }) {
1865
- let { width } = state.modifiersData.maxSize;
1866
- if (width < 160) {
1867
- width = 160;
1868
- }
1869
- state.styles.popper = {
1870
- ...state.styles.popper,
1871
- maxWidth: `${width}px`,
1872
- };
1873
- },
1874
- };
1875
- const Tooltip = class {
1876
- constructor(hostRef) {
1877
- index.registerInstance(this, hostRef);
1878
- /**
1879
- * Defines if the tooltip is descriptive. A descriptive tooltip contains a meaningful message. Tooltips that are not descriptive are hidden from screenreaders using `aria-hidden`.
1880
- */
1881
- this.descriptive = false;
1882
- /**
1883
- * Set position of tooltip relative to target
1884
- */
1885
- this.position = "top";
1886
- /**
1887
- * Set position strategy of tooltip
1888
- */
1889
- this.strategy = "auto";
1890
- /**
1891
- * Set attribute `no-arrow` to hide the arrow
1892
- */
1893
- this.noArrow = false;
1894
- /**
1895
- * Whether or not to show the tooltip. To control the tooltip add the `active` attribute or use the `activate()` and `deactivate()` instance methods.
1896
- */
1897
- this.active = false;
1898
- this.callbacks = {
1899
- activate: () => (this.active = true),
1900
- deactivate: () => {
1901
- // Zie https://github.com/dso-toolkit/dso-toolkit/issues/2997#issuecomment-2654330094 voor de aanleiding
1902
- // van setTimeout() met 2ms.
1903
- setTimeout(() => {
1904
- if (this.element.isConnected) {
1905
- this.active = false;
1906
- }
1907
- }, 2);
1908
- },
1909
- };
1910
- this.onMouseLeave = () => {
1911
- if (!this.element.matches(":hover") && !this.target?.matches(":hover")) {
1912
- this.callbacks.deactivate();
1913
- }
1914
- };
1915
- this.hidden = true;
1916
- this.keyDownListener = (event) => {
1917
- if (event.key === "Escape") {
1918
- this.deactivate();
1919
- }
1920
- };
1921
- this.deactivatePopper = index$1.debounce(() => {
1922
- this.hidden = true;
1923
- this.popper?.destroy();
1924
- this.popper = undefined;
1925
- }, transitionDuration);
1926
- _Tooltip_target.set(this, void 0);
1927
- }
1928
- /**
1929
- * Activate the tooltip (Sets the `active` attribute)
1930
- */
1931
- async activate() {
1932
- this.active = true;
1933
- }
1934
- /**
1935
- * Deactivate the tooltip (Removes the `active` attribute)
1936
- */
1937
- async deactivate() {
1938
- this.active = false;
1939
- }
1940
- watchPosition() {
1941
- if (!this.popper) {
1942
- return;
1943
- }
1944
- this.popper.setOptions({
1945
- placement: this.position,
1946
- });
1947
- }
1948
- watchStrategy() {
1949
- this.setStrategy();
1950
- }
1951
- setStrategy() {
1952
- if (!this.popper) {
1953
- return;
1954
- }
1955
- if (this.strategy === "absolute" || this.strategy === "fixed") {
1956
- this.popper.setOptions({
1957
- strategy: this.strategy,
1958
- });
1959
- return;
1960
- }
1961
- let element = this.element;
1962
- while (element && element.parentNode !== document) {
1963
- element = element.parentNode instanceof ShadowRoot ? element.parentNode.host : element.parentElement;
1964
- if (element !== null && hasOverflow(element)) {
1965
- this.popper.setOptions({
1966
- strategy: "fixed",
1967
- });
1968
- return;
1969
- }
1970
- }
1971
- this.popper.setOptions({
1972
- strategy: "absolute",
1973
- });
1974
- }
1975
- watchActive() {
1976
- if (this.active) {
1977
- this.activatePopper();
1978
- if (!this.stateless) {
1979
- setTimeout(() => {
1980
- this.popper?.setOptions({
1981
- modifiers: [{ name: "eventListeners", enabled: true }],
1982
- });
1983
- document.addEventListener("keydown", this.keyDownListener);
1984
- });
1985
- }
1986
- }
1987
- else {
1988
- document.removeEventListener("keydown", this.keyDownListener);
1989
- this.deactivatePopper();
1990
- }
1991
- }
1992
- listenClick(e) {
1993
- e.stopPropagation();
1994
- }
1995
- componentDidLoad() {
1996
- const tooltip = this.element.shadowRoot?.querySelector(".tooltip");
1997
- if (!(tooltip instanceof HTMLElement)) {
1998
- throw new Error("tooltip element is not instanceof HTMLElement");
1999
- }
2000
- if (!this.stateless && this.target) {
2001
- this.target.addEventListener("mouseenter", this.callbacks.activate);
2002
- [this.element, this.target].forEach((element) => element.addEventListener("mouseleave", this.onMouseLeave));
2003
- this.target.addEventListener("focus", this.callbacks.activate);
2004
- this.target.addEventListener("blur", this.callbacks.deactivate);
2005
- }
2006
- }
2007
- disconnectedCallback() {
2008
- this.popper?.destroy();
2009
- if (!this.stateless && this.target) {
2010
- this.target.removeEventListener("mouseenter", this.callbacks.activate);
2011
- [this.element, this.target].forEach((element) => element.removeEventListener("mouseleave", this.onMouseLeave));
2012
- this.target.removeEventListener("focus", this.callbacks.activate);
2013
- this.target.removeEventListener("blur", this.callbacks.deactivate);
2014
- }
2015
- this.target = undefined;
2016
- }
2017
- componentDidRender() {
2018
- if (this.active) {
2019
- this.popper?.update();
2020
- }
2021
- }
2022
- render() {
2023
- return (index.h(index.Host, { key: 'e08707c05d17ee0a049dd74d6524c0b26b1dc639', class: { hidden: this.hidden }, role: "tooltip", onClick: this.listenClick }, index.h("div", { key: '12baf3facd788c17da5019ad2f01512701933e0a', class: clsx.clsx("tooltip", { in: this.active }) }, !this.noArrow && index.h("div", { key: '80cb136e9339aa6132528110cc98472a0ed1b0a5', "data-popper-arrow": true, class: "tooltip-arrow" }), index.h("div", { key: 'ed2853f256c5a66d1ef77a157b9f461e379fc658', "aria-hidden": !this.descriptive || undefined, class: clsx.clsx("tooltip-inner", { "dso-small": this.small }) }, index.h("slot", { key: 'b5365e342858376bc75ed209c9a458fd05b05b49' })))));
2024
- }
2025
- activatePopper() {
2026
- this.hidden = false;
2027
- if (this.popper) {
2028
- return;
2029
- }
2030
- const tooltip = this.element.shadowRoot?.querySelector(".tooltip");
2031
- if (this.target && tooltip instanceof HTMLElement) {
2032
- this.popper = createPopper(this.target, tooltip, {
2033
- placement: this.position,
2034
- modifiers: [maxSize, applyMaxSize, { name: "eventListeners", enabled: false }],
2035
- });
2036
- this.setStrategy();
2037
- }
2038
- }
2039
- get target() {
2040
- return __classPrivateFieldGet(this, _Tooltip_target, "f") ?? this.initializeTarget();
2041
- }
2042
- set target(element) {
2043
- __classPrivateFieldSet(this, _Tooltip_target, element, "f");
2044
- }
2045
- initializeTarget() {
2046
- const id = this.element.id;
2047
- if (!id) {
2048
- console.warn("Unable to find reference tooltip has no [id] attribute.");
2049
- return;
2050
- }
2051
- const rootNode = this.element.getRootNode();
2052
- if (!(rootNode instanceof Document || rootNode instanceof ShadowRoot)) {
2053
- console.warn(`rootNode is not instance of Document or ShadowRoot`);
2054
- return;
2055
- }
2056
- const reference = rootNode.querySelector(`[aria-describedBy="${id}`);
2057
- if (!reference) {
2058
- console.warn(`Unable to find reference with aria-describedby ${id}`);
2059
- return;
2060
- }
2061
- __classPrivateFieldSet(this, _Tooltip_target, reference, "f");
2062
- return reference;
2063
- }
2064
- get element() { return index.getElement(this); }
2065
- static get watchers() { return {
2066
- "position": [{
2067
- "watchPosition": 0
2068
- }],
2069
- "strategy": [{
2070
- "watchStrategy": 0
2071
- }],
2072
- "active": [{
2073
- "watchActive": 0
2074
- }]
2075
- }; }
2076
- };
2077
- _Tooltip_target = new WeakMap();
2078
- Tooltip.style = tooltipCss();
2079
-
2080
- exports.dso_tooltip = Tooltip;