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