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