@bigbinary/neetoui 6.6.0 → 6.7.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 (227) hide show
  1. package/README.md +2 -5
  2. package/dist/Accordion.js +2 -290
  3. package/dist/Accordion.js.map +1 -1
  4. package/dist/ActionDropdown.js +4 -3
  5. package/dist/ActionDropdown.js.map +1 -1
  6. package/dist/Alert.js +5 -4
  7. package/dist/Alert.js.map +1 -1
  8. package/dist/Avatar.js +9 -1128
  9. package/dist/Avatar.js.map +1 -1
  10. package/dist/Button.js +3 -2
  11. package/dist/Button.js.map +1 -1
  12. package/dist/Checkbox.js +3 -2
  13. package/dist/Checkbox.js.map +1 -1
  14. package/dist/ColorPicker.js +8 -8
  15. package/dist/ColorPicker.js.map +1 -1
  16. package/dist/DatePicker.js +3 -2
  17. package/dist/DatePicker.js.map +1 -1
  18. package/dist/DateTimePicker.js +7 -5
  19. package/dist/DateTimePicker.js.map +1 -1
  20. package/dist/Dropdown.js +4 -3
  21. package/dist/Dropdown.js.map +1 -1
  22. package/dist/Input.js +3 -2
  23. package/dist/Input.js.map +1 -1
  24. package/dist/Kbd.js +2 -1
  25. package/dist/Kbd.js.map +1 -1
  26. package/dist/Label.js +2 -1
  27. package/dist/Label.js.map +1 -1
  28. package/dist/Modal.js +5 -4
  29. package/dist/Modal.js.map +1 -1
  30. package/dist/MultiEmailInput.js +6 -4
  31. package/dist/MultiEmailInput.js.map +1 -1
  32. package/dist/NoData.js +3 -2
  33. package/dist/NoData.js.map +1 -1
  34. package/dist/Pagination.js +2 -2
  35. package/dist/Pane.js +5 -4
  36. package/dist/Pane.js.map +1 -1
  37. package/dist/Popover.js +2 -1
  38. package/dist/Popover.js.map +1 -1
  39. package/dist/ProgressBar.js +1 -1
  40. package/dist/Radio.js +3 -2
  41. package/dist/Radio.js.map +1 -1
  42. package/dist/Select.js +30 -182
  43. package/dist/Select.js.map +1 -1
  44. package/dist/Sidebar.js +4 -2
  45. package/dist/Sidebar.js.map +1 -1
  46. package/dist/Slider.js +3 -2
  47. package/dist/Slider.js.map +1 -1
  48. package/dist/Switch.js +3 -2
  49. package/dist/Switch.js.map +1 -1
  50. package/dist/Table.js +405 -4540
  51. package/dist/Table.js.map +1 -1
  52. package/dist/Textarea.js +3 -2
  53. package/dist/Textarea.js.map +1 -1
  54. package/dist/TimePicker.js +3 -2
  55. package/dist/TimePicker.js.map +1 -1
  56. package/dist/TimePickerInput.js +8 -6
  57. package/dist/TimePickerInput.js.map +1 -1
  58. package/dist/Toastr.js +3 -1653
  59. package/dist/Toastr.js.map +1 -1
  60. package/dist/Tooltip.js +2 -1
  61. package/dist/Tooltip.js.map +1 -1
  62. package/dist/Tree.js +1 -1
  63. package/dist/TreeSelect.js +3 -2
  64. package/dist/TreeSelect.js.map +1 -1
  65. package/dist/cjs/Accordion.js +3 -309
  66. package/dist/cjs/Accordion.js.map +1 -1
  67. package/dist/cjs/ActionDropdown.js +4 -3
  68. package/dist/cjs/ActionDropdown.js.map +1 -1
  69. package/dist/cjs/Alert.js +5 -4
  70. package/dist/cjs/Alert.js.map +1 -1
  71. package/dist/cjs/Avatar.js +10 -1128
  72. package/dist/cjs/Avatar.js.map +1 -1
  73. package/dist/cjs/Button.js +6 -5
  74. package/dist/cjs/Button.js.map +1 -1
  75. package/dist/cjs/Checkbox.js +3 -2
  76. package/dist/cjs/Checkbox.js.map +1 -1
  77. package/dist/cjs/ColorPicker.js +7 -7
  78. package/dist/cjs/ColorPicker.js.map +1 -1
  79. package/dist/cjs/DatePicker.js +3 -2
  80. package/dist/cjs/DatePicker.js.map +1 -1
  81. package/dist/cjs/DateTimePicker.js +7 -5
  82. package/dist/cjs/DateTimePicker.js.map +1 -1
  83. package/dist/cjs/Dropdown.js +4 -3
  84. package/dist/cjs/Dropdown.js.map +1 -1
  85. package/dist/cjs/Input.js +3 -2
  86. package/dist/cjs/Input.js.map +1 -1
  87. package/dist/cjs/Kbd.js +2 -1
  88. package/dist/cjs/Kbd.js.map +1 -1
  89. package/dist/cjs/Label.js +2 -1
  90. package/dist/cjs/Label.js.map +1 -1
  91. package/dist/cjs/Modal.js +5 -4
  92. package/dist/cjs/Modal.js.map +1 -1
  93. package/dist/cjs/MultiEmailInput.js +15 -12
  94. package/dist/cjs/MultiEmailInput.js.map +1 -1
  95. package/dist/cjs/NoData.js +3 -2
  96. package/dist/cjs/NoData.js.map +1 -1
  97. package/dist/cjs/Pagination.js +2 -2
  98. package/dist/cjs/Pane.js +5 -4
  99. package/dist/cjs/Pane.js.map +1 -1
  100. package/dist/cjs/Popover.js +2 -1
  101. package/dist/cjs/Popover.js.map +1 -1
  102. package/dist/cjs/ProgressBar.js +2 -2
  103. package/dist/cjs/ProgressBar.js.map +1 -1
  104. package/dist/cjs/Radio.js +3 -2
  105. package/dist/cjs/Radio.js.map +1 -1
  106. package/dist/cjs/Select.js +26 -192
  107. package/dist/cjs/Select.js.map +1 -1
  108. package/dist/cjs/Sidebar.js +4 -2
  109. package/dist/cjs/Sidebar.js.map +1 -1
  110. package/dist/cjs/Slider.js +3 -2
  111. package/dist/cjs/Slider.js.map +1 -1
  112. package/dist/cjs/Switch.js +3 -2
  113. package/dist/cjs/Switch.js.map +1 -1
  114. package/dist/cjs/Table.js +430 -4565
  115. package/dist/cjs/Table.js.map +1 -1
  116. package/dist/cjs/Textarea.js +3 -2
  117. package/dist/cjs/Textarea.js.map +1 -1
  118. package/dist/cjs/TimePicker.js +3 -2
  119. package/dist/cjs/TimePicker.js.map +1 -1
  120. package/dist/cjs/TimePickerInput.js +8 -6
  121. package/dist/cjs/TimePickerInput.js.map +1 -1
  122. package/dist/cjs/Toastr.js +6 -1656
  123. package/dist/cjs/Toastr.js.map +1 -1
  124. package/dist/cjs/Tooltip.js +2 -1
  125. package/dist/cjs/Tooltip.js.map +1 -1
  126. package/dist/cjs/Tree.js +1 -1
  127. package/dist/cjs/TreeSelect.js +3 -2
  128. package/dist/cjs/TreeSelect.js.map +1 -1
  129. package/dist/cjs/formik/ActionBlock.js +3 -2
  130. package/dist/cjs/formik/ActionBlock.js.map +1 -1
  131. package/dist/cjs/formik/BlockNavigation.js +5 -4
  132. package/dist/cjs/formik/BlockNavigation.js.map +1 -1
  133. package/dist/cjs/formik/Button.js +3 -2
  134. package/dist/cjs/formik/Button.js.map +1 -1
  135. package/dist/cjs/formik/Checkbox.js +3 -2
  136. package/dist/cjs/formik/Checkbox.js.map +1 -1
  137. package/dist/cjs/formik/Input.js +3 -2
  138. package/dist/cjs/formik/Input.js.map +1 -1
  139. package/dist/cjs/formik/MultiEmailInput.js +6 -4
  140. package/dist/cjs/formik/MultiEmailInput.js.map +1 -1
  141. package/dist/cjs/formik/Radio.js +3 -2
  142. package/dist/cjs/formik/Radio.js.map +1 -1
  143. package/dist/cjs/formik/Select.js +8 -4
  144. package/dist/cjs/formik/Select.js.map +1 -1
  145. package/dist/cjs/formik/Slider.js +3 -2
  146. package/dist/cjs/formik/Slider.js.map +1 -1
  147. package/dist/cjs/formik/Switch.js +3 -2
  148. package/dist/cjs/formik/Switch.js.map +1 -1
  149. package/dist/cjs/formik/Textarea.js +3 -2
  150. package/dist/cjs/formik/Textarea.js.map +1 -1
  151. package/dist/cjs/formik/TreeSelect.js +3 -2
  152. package/dist/cjs/formik/TreeSelect.js.map +1 -1
  153. package/dist/cjs/formik/index.js +9 -5
  154. package/dist/cjs/formik/index.js.map +1 -1
  155. package/dist/cjs/{index-16ef19ed.js → index-6e09c7bc.js} +1 -23
  156. package/dist/cjs/index-6e09c7bc.js.map +1 -0
  157. package/dist/cjs/index-773961dd.js +453 -0
  158. package/dist/cjs/index-773961dd.js.map +1 -0
  159. package/dist/cjs/index-becc6543.js +262 -0
  160. package/dist/cjs/index-becc6543.js.map +1 -0
  161. package/dist/cjs/index.js +18 -7
  162. package/dist/cjs/index.js.map +1 -1
  163. package/dist/cjs/layouts.js +4 -2
  164. package/dist/cjs/layouts.js.map +1 -1
  165. package/dist/cjs/{useOverlayManager-53380ba5.js → useOverlayManager-359ed795.js} +2 -2
  166. package/dist/cjs/{useOverlayManager-53380ba5.js.map → useOverlayManager-359ed795.js.map} +1 -1
  167. package/dist/cjs/{useQueryParams-3ddcf459.js → useQueryParams-14f054b3.js} +2 -2
  168. package/dist/cjs/{useQueryParams-3ddcf459.js.map → useQueryParams-14f054b3.js.map} +1 -1
  169. package/dist/formik/ActionBlock.js +3 -2
  170. package/dist/formik/ActionBlock.js.map +1 -1
  171. package/dist/formik/BlockNavigation.js +5 -4
  172. package/dist/formik/BlockNavigation.js.map +1 -1
  173. package/dist/formik/Button.js +3 -2
  174. package/dist/formik/Button.js.map +1 -1
  175. package/dist/formik/Checkbox.js +3 -2
  176. package/dist/formik/Checkbox.js.map +1 -1
  177. package/dist/formik/Input.js +3 -2
  178. package/dist/formik/Input.js.map +1 -1
  179. package/dist/formik/MultiEmailInput.js +6 -4
  180. package/dist/formik/MultiEmailInput.js.map +1 -1
  181. package/dist/formik/Radio.js +3 -2
  182. package/dist/formik/Radio.js.map +1 -1
  183. package/dist/formik/Select.js +8 -4
  184. package/dist/formik/Select.js.map +1 -1
  185. package/dist/formik/Slider.js +3 -2
  186. package/dist/formik/Slider.js.map +1 -1
  187. package/dist/formik/Switch.js +3 -2
  188. package/dist/formik/Switch.js.map +1 -1
  189. package/dist/formik/Textarea.js +3 -2
  190. package/dist/formik/Textarea.js.map +1 -1
  191. package/dist/formik/TreeSelect.js +3 -2
  192. package/dist/formik/TreeSelect.js.map +1 -1
  193. package/dist/formik/index.js +9 -5
  194. package/dist/formik/index.js.map +1 -1
  195. package/dist/index-661b9fd6.js +253 -0
  196. package/dist/index-661b9fd6.js.map +1 -0
  197. package/dist/index-c442518b.js +445 -0
  198. package/dist/index-c442518b.js.map +1 -0
  199. package/dist/{index-26f3deee.js → index-c8d9113c.js} +2 -23
  200. package/dist/index-c8d9113c.js.map +1 -0
  201. package/dist/index.js +18 -7
  202. package/dist/index.js.map +1 -1
  203. package/dist/layouts.js +4 -2
  204. package/dist/layouts.js.map +1 -1
  205. package/dist/{useOverlayManager-e76af01f.js → useOverlayManager-95a474d5.js} +2 -2
  206. package/dist/{useOverlayManager-e76af01f.js.map → useOverlayManager-95a474d5.js.map} +1 -1
  207. package/dist/{useQueryParams-4731dc94.js → useQueryParams-4e7ddcf8.js} +2 -2
  208. package/dist/{useQueryParams-4731dc94.js.map → useQueryParams-4e7ddcf8.js.map} +1 -1
  209. package/package.json +13 -2
  210. package/dist/cjs/index-0e68cfff.js +0 -3934
  211. package/dist/cjs/index-0e68cfff.js.map +0 -1
  212. package/dist/cjs/index-16ef19ed.js.map +0 -1
  213. package/dist/cjs/index-e722fedf.js +0 -3844
  214. package/dist/cjs/index-e722fedf.js.map +0 -1
  215. package/dist/cjs/motion-a1906aff.js +0 -8892
  216. package/dist/cjs/motion-a1906aff.js.map +0 -1
  217. package/dist/cjs/react-select-creatable.esm-b39742a3.js +0 -6675
  218. package/dist/cjs/react-select-creatable.esm-b39742a3.js.map +0 -1
  219. package/dist/index-2123b5e9.js +0 -3927
  220. package/dist/index-2123b5e9.js.map +0 -1
  221. package/dist/index-26f3deee.js.map +0 -1
  222. package/dist/index-8ff7d9a1.js +0 -3837
  223. package/dist/index-8ff7d9a1.js.map +0 -1
  224. package/dist/motion-087daf52.js +0 -8862
  225. package/dist/motion-087daf52.js.map +0 -1
  226. package/dist/react-select-creatable.esm-93affeca.js +0 -6644
  227. package/dist/react-select-creatable.esm-93affeca.js.map +0 -1
@@ -1,3934 +0,0 @@
1
- 'use strict';
2
-
3
- var _extends = require('./extends-1b35a664.js');
4
- var slicedToArray = require('./slicedToArray-732a2048.js');
5
- var objectWithoutProperties = require('./objectWithoutProperties-2fed2d7d.js');
6
- var React = require('react');
7
- var ReactDOM = require('react-dom');
8
-
9
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
-
11
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
12
-
13
- var top = 'top';
14
- var bottom = 'bottom';
15
- var right = 'right';
16
- var left = 'left';
17
- var auto = 'auto';
18
- var basePlacements = [top, bottom, right, left];
19
- var start = 'start';
20
- var end = 'end';
21
- var clippingParents = 'clippingParents';
22
- var viewport = 'viewport';
23
- var popper = 'popper';
24
- var reference = 'reference';
25
- var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
26
- return acc.concat([placement + "-" + start, placement + "-" + end]);
27
- }, []);
28
- var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
29
- return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
30
- }, []); // modifiers that need to read the DOM
31
-
32
- var beforeRead = 'beforeRead';
33
- var read = 'read';
34
- var afterRead = 'afterRead'; // pure-logic modifiers
35
-
36
- var beforeMain = 'beforeMain';
37
- var main = 'main';
38
- var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
39
-
40
- var beforeWrite = 'beforeWrite';
41
- var write = 'write';
42
- var afterWrite = 'afterWrite';
43
- var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
44
-
45
- function getNodeName(element) {
46
- return element ? (element.nodeName || '').toLowerCase() : null;
47
- }
48
-
49
- function getWindow(node) {
50
- if (node == null) {
51
- return window;
52
- }
53
-
54
- if (node.toString() !== '[object Window]') {
55
- var ownerDocument = node.ownerDocument;
56
- return ownerDocument ? ownerDocument.defaultView || window : window;
57
- }
58
-
59
- return node;
60
- }
61
-
62
- function isElement$1(node) {
63
- var OwnElement = getWindow(node).Element;
64
- return node instanceof OwnElement || node instanceof Element;
65
- }
66
-
67
- function isHTMLElement(node) {
68
- var OwnElement = getWindow(node).HTMLElement;
69
- return node instanceof OwnElement || node instanceof HTMLElement;
70
- }
71
-
72
- function isShadowRoot(node) {
73
- // IE 11 has no ShadowRoot
74
- if (typeof ShadowRoot === 'undefined') {
75
- return false;
76
- }
77
-
78
- var OwnElement = getWindow(node).ShadowRoot;
79
- return node instanceof OwnElement || node instanceof ShadowRoot;
80
- }
81
-
82
- // and applies them to the HTMLElements such as popper and arrow
83
-
84
- function applyStyles(_ref) {
85
- var state = _ref.state;
86
- Object.keys(state.elements).forEach(function (name) {
87
- var style = state.styles[name] || {};
88
- var attributes = state.attributes[name] || {};
89
- var element = state.elements[name]; // arrow is optional + virtual elements
90
-
91
- if (!isHTMLElement(element) || !getNodeName(element)) {
92
- return;
93
- } // Flow doesn't support to extend this property, but it's the most
94
- // effective way to apply styles to an HTMLElement
95
- // $FlowFixMe[cannot-write]
96
-
97
-
98
- Object.assign(element.style, style);
99
- Object.keys(attributes).forEach(function (name) {
100
- var value = attributes[name];
101
-
102
- if (value === false) {
103
- element.removeAttribute(name);
104
- } else {
105
- element.setAttribute(name, value === true ? '' : value);
106
- }
107
- });
108
- });
109
- }
110
-
111
- function effect$2(_ref2) {
112
- var state = _ref2.state;
113
- var initialStyles = {
114
- popper: {
115
- position: state.options.strategy,
116
- left: '0',
117
- top: '0',
118
- margin: '0'
119
- },
120
- arrow: {
121
- position: 'absolute'
122
- },
123
- reference: {}
124
- };
125
- Object.assign(state.elements.popper.style, initialStyles.popper);
126
- state.styles = initialStyles;
127
-
128
- if (state.elements.arrow) {
129
- Object.assign(state.elements.arrow.style, initialStyles.arrow);
130
- }
131
-
132
- return function () {
133
- Object.keys(state.elements).forEach(function (name) {
134
- var element = state.elements[name];
135
- var attributes = state.attributes[name] || {};
136
- var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
137
-
138
- var style = styleProperties.reduce(function (style, property) {
139
- style[property] = '';
140
- return style;
141
- }, {}); // arrow is optional + virtual elements
142
-
143
- if (!isHTMLElement(element) || !getNodeName(element)) {
144
- return;
145
- }
146
-
147
- Object.assign(element.style, style);
148
- Object.keys(attributes).forEach(function (attribute) {
149
- element.removeAttribute(attribute);
150
- });
151
- });
152
- };
153
- } // eslint-disable-next-line import/no-unused-modules
154
-
155
-
156
- var applyStyles$1 = {
157
- name: 'applyStyles',
158
- enabled: true,
159
- phase: 'write',
160
- fn: applyStyles,
161
- effect: effect$2,
162
- requires: ['computeStyles']
163
- };
164
-
165
- function getBasePlacement$1(placement) {
166
- return placement.split('-')[0];
167
- }
168
-
169
- var max = Math.max;
170
- var min = Math.min;
171
- var round = Math.round;
172
-
173
- function getUAString() {
174
- var uaData = navigator.userAgentData;
175
-
176
- if (uaData != null && uaData.brands) {
177
- return uaData.brands.map(function (item) {
178
- return item.brand + "/" + item.version;
179
- }).join(' ');
180
- }
181
-
182
- return navigator.userAgent;
183
- }
184
-
185
- function isLayoutViewport() {
186
- return !/^((?!chrome|android).)*safari/i.test(getUAString());
187
- }
188
-
189
- function getBoundingClientRect(element, includeScale, isFixedStrategy) {
190
- if (includeScale === void 0) {
191
- includeScale = false;
192
- }
193
-
194
- if (isFixedStrategy === void 0) {
195
- isFixedStrategy = false;
196
- }
197
-
198
- var clientRect = element.getBoundingClientRect();
199
- var scaleX = 1;
200
- var scaleY = 1;
201
-
202
- if (includeScale && isHTMLElement(element)) {
203
- scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
204
- scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
205
- }
206
-
207
- var _ref = isElement$1(element) ? getWindow(element) : window,
208
- visualViewport = _ref.visualViewport;
209
-
210
- var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
211
- var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
212
- var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
213
- var width = clientRect.width / scaleX;
214
- var height = clientRect.height / scaleY;
215
- return {
216
- width: width,
217
- height: height,
218
- top: y,
219
- right: x + width,
220
- bottom: y + height,
221
- left: x,
222
- x: x,
223
- y: y
224
- };
225
- }
226
-
227
- // means it doesn't take into account transforms.
228
-
229
- function getLayoutRect(element) {
230
- var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
231
- // Fixes https://github.com/popperjs/popper-core/issues/1223
232
-
233
- var width = element.offsetWidth;
234
- var height = element.offsetHeight;
235
-
236
- if (Math.abs(clientRect.width - width) <= 1) {
237
- width = clientRect.width;
238
- }
239
-
240
- if (Math.abs(clientRect.height - height) <= 1) {
241
- height = clientRect.height;
242
- }
243
-
244
- return {
245
- x: element.offsetLeft,
246
- y: element.offsetTop,
247
- width: width,
248
- height: height
249
- };
250
- }
251
-
252
- function contains(parent, child) {
253
- var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
254
-
255
- if (parent.contains(child)) {
256
- return true;
257
- } // then fallback to custom implementation with Shadow DOM support
258
- else if (rootNode && isShadowRoot(rootNode)) {
259
- var next = child;
260
-
261
- do {
262
- if (next && parent.isSameNode(next)) {
263
- return true;
264
- } // $FlowFixMe[prop-missing]: need a better way to handle this...
265
-
266
-
267
- next = next.parentNode || next.host;
268
- } while (next);
269
- } // Give up, the result is false
270
-
271
-
272
- return false;
273
- }
274
-
275
- function getComputedStyle(element) {
276
- return getWindow(element).getComputedStyle(element);
277
- }
278
-
279
- function isTableElement(element) {
280
- return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
281
- }
282
-
283
- function getDocumentElement(element) {
284
- // $FlowFixMe[incompatible-return]: assume body is always available
285
- return ((isElement$1(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
286
- element.document) || window.document).documentElement;
287
- }
288
-
289
- function getParentNode(element) {
290
- if (getNodeName(element) === 'html') {
291
- return element;
292
- }
293
-
294
- return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
295
- // $FlowFixMe[incompatible-return]
296
- // $FlowFixMe[prop-missing]
297
- element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
298
- element.parentNode || ( // DOM Element detected
299
- isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
300
- // $FlowFixMe[incompatible-call]: HTMLElement is a Node
301
- getDocumentElement(element) // fallback
302
-
303
- );
304
- }
305
-
306
- function getTrueOffsetParent(element) {
307
- if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
308
- getComputedStyle(element).position === 'fixed') {
309
- return null;
310
- }
311
-
312
- return element.offsetParent;
313
- } // `.offsetParent` reports `null` for fixed elements, while absolute elements
314
- // return the containing block
315
-
316
-
317
- function getContainingBlock(element) {
318
- var isFirefox = /firefox/i.test(getUAString());
319
- var isIE = /Trident/i.test(getUAString());
320
-
321
- if (isIE && isHTMLElement(element)) {
322
- // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
323
- var elementCss = getComputedStyle(element);
324
-
325
- if (elementCss.position === 'fixed') {
326
- return null;
327
- }
328
- }
329
-
330
- var currentNode = getParentNode(element);
331
-
332
- if (isShadowRoot(currentNode)) {
333
- currentNode = currentNode.host;
334
- }
335
-
336
- while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
337
- var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
338
- // create a containing block.
339
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
340
-
341
- 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') {
342
- return currentNode;
343
- } else {
344
- currentNode = currentNode.parentNode;
345
- }
346
- }
347
-
348
- return null;
349
- } // Gets the closest ancestor positioned element. Handles some edge cases,
350
- // such as table ancestors and cross browser bugs.
351
-
352
-
353
- function getOffsetParent(element) {
354
- var window = getWindow(element);
355
- var offsetParent = getTrueOffsetParent(element);
356
-
357
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
358
- offsetParent = getTrueOffsetParent(offsetParent);
359
- }
360
-
361
- if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
362
- return window;
363
- }
364
-
365
- return offsetParent || getContainingBlock(element) || window;
366
- }
367
-
368
- function getMainAxisFromPlacement(placement) {
369
- return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
370
- }
371
-
372
- function within(min$1, value, max$1) {
373
- return max(min$1, min(value, max$1));
374
- }
375
- function withinMaxClamp(min, value, max) {
376
- var v = within(min, value, max);
377
- return v > max ? max : v;
378
- }
379
-
380
- function getFreshSideObject() {
381
- return {
382
- top: 0,
383
- right: 0,
384
- bottom: 0,
385
- left: 0
386
- };
387
- }
388
-
389
- function mergePaddingObject(paddingObject) {
390
- return Object.assign({}, getFreshSideObject(), paddingObject);
391
- }
392
-
393
- function expandToHashMap(value, keys) {
394
- return keys.reduce(function (hashMap, key) {
395
- hashMap[key] = value;
396
- return hashMap;
397
- }, {});
398
- }
399
-
400
- var toPaddingObject = function toPaddingObject(padding, state) {
401
- padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
402
- placement: state.placement
403
- })) : padding;
404
- return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
405
- };
406
-
407
- function arrow(_ref) {
408
- var _state$modifiersData$;
409
-
410
- var state = _ref.state,
411
- name = _ref.name,
412
- options = _ref.options;
413
- var arrowElement = state.elements.arrow;
414
- var popperOffsets = state.modifiersData.popperOffsets;
415
- var basePlacement = getBasePlacement$1(state.placement);
416
- var axis = getMainAxisFromPlacement(basePlacement);
417
- var isVertical = [left, right].indexOf(basePlacement) >= 0;
418
- var len = isVertical ? 'height' : 'width';
419
-
420
- if (!arrowElement || !popperOffsets) {
421
- return;
422
- }
423
-
424
- var paddingObject = toPaddingObject(options.padding, state);
425
- var arrowRect = getLayoutRect(arrowElement);
426
- var minProp = axis === 'y' ? top : left;
427
- var maxProp = axis === 'y' ? bottom : right;
428
- var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
429
- var startDiff = popperOffsets[axis] - state.rects.reference[axis];
430
- var arrowOffsetParent = getOffsetParent(arrowElement);
431
- var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
432
- var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
433
- // outside of the popper bounds
434
-
435
- var min = paddingObject[minProp];
436
- var max = clientSize - arrowRect[len] - paddingObject[maxProp];
437
- var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
438
- var offset = within(min, center, max); // Prevents breaking syntax highlighting...
439
-
440
- var axisProp = axis;
441
- state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
442
- }
443
-
444
- function effect$1(_ref2) {
445
- var state = _ref2.state,
446
- options = _ref2.options;
447
- var _options$element = options.element,
448
- arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
449
-
450
- if (arrowElement == null) {
451
- return;
452
- } // CSS selector
453
-
454
-
455
- if (typeof arrowElement === 'string') {
456
- arrowElement = state.elements.popper.querySelector(arrowElement);
457
-
458
- if (!arrowElement) {
459
- return;
460
- }
461
- }
462
-
463
- if (!contains(state.elements.popper, arrowElement)) {
464
-
465
- return;
466
- }
467
-
468
- state.elements.arrow = arrowElement;
469
- } // eslint-disable-next-line import/no-unused-modules
470
-
471
-
472
- var arrow$1 = {
473
- name: 'arrow',
474
- enabled: true,
475
- phase: 'main',
476
- fn: arrow,
477
- effect: effect$1,
478
- requires: ['popperOffsets'],
479
- requiresIfExists: ['preventOverflow']
480
- };
481
-
482
- function getVariation(placement) {
483
- return placement.split('-')[1];
484
- }
485
-
486
- var unsetSides = {
487
- top: 'auto',
488
- right: 'auto',
489
- bottom: 'auto',
490
- left: 'auto'
491
- }; // Round the offsets to the nearest suitable subpixel based on the DPR.
492
- // Zooming can change the DPR, but it seems to report a value that will
493
- // cleanly divide the values into the appropriate subpixels.
494
-
495
- function roundOffsetsByDPR(_ref) {
496
- var x = _ref.x,
497
- y = _ref.y;
498
- var win = window;
499
- var dpr = win.devicePixelRatio || 1;
500
- return {
501
- x: round(x * dpr) / dpr || 0,
502
- y: round(y * dpr) / dpr || 0
503
- };
504
- }
505
-
506
- function mapToStyles(_ref2) {
507
- var _Object$assign2;
508
-
509
- var popper = _ref2.popper,
510
- popperRect = _ref2.popperRect,
511
- placement = _ref2.placement,
512
- variation = _ref2.variation,
513
- offsets = _ref2.offsets,
514
- position = _ref2.position,
515
- gpuAcceleration = _ref2.gpuAcceleration,
516
- adaptive = _ref2.adaptive,
517
- roundOffsets = _ref2.roundOffsets,
518
- isFixed = _ref2.isFixed;
519
- var _offsets$x = offsets.x,
520
- x = _offsets$x === void 0 ? 0 : _offsets$x,
521
- _offsets$y = offsets.y,
522
- y = _offsets$y === void 0 ? 0 : _offsets$y;
523
-
524
- var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
525
- x: x,
526
- y: y
527
- }) : {
528
- x: x,
529
- y: y
530
- };
531
-
532
- x = _ref3.x;
533
- y = _ref3.y;
534
- var hasX = offsets.hasOwnProperty('x');
535
- var hasY = offsets.hasOwnProperty('y');
536
- var sideX = left;
537
- var sideY = top;
538
- var win = window;
539
-
540
- if (adaptive) {
541
- var offsetParent = getOffsetParent(popper);
542
- var heightProp = 'clientHeight';
543
- var widthProp = 'clientWidth';
544
-
545
- if (offsetParent === getWindow(popper)) {
546
- offsetParent = getDocumentElement(popper);
547
-
548
- if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
549
- heightProp = 'scrollHeight';
550
- widthProp = 'scrollWidth';
551
- }
552
- } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
553
-
554
-
555
- offsetParent = offsetParent;
556
-
557
- if (placement === top || (placement === left || placement === right) && variation === end) {
558
- sideY = bottom;
559
- var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
560
- offsetParent[heightProp];
561
- y -= offsetY - popperRect.height;
562
- y *= gpuAcceleration ? 1 : -1;
563
- }
564
-
565
- if (placement === left || (placement === top || placement === bottom) && variation === end) {
566
- sideX = right;
567
- var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
568
- offsetParent[widthProp];
569
- x -= offsetX - popperRect.width;
570
- x *= gpuAcceleration ? 1 : -1;
571
- }
572
- }
573
-
574
- var commonStyles = Object.assign({
575
- position: position
576
- }, adaptive && unsetSides);
577
-
578
- var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
579
- x: x,
580
- y: y
581
- }) : {
582
- x: x,
583
- y: y
584
- };
585
-
586
- x = _ref4.x;
587
- y = _ref4.y;
588
-
589
- if (gpuAcceleration) {
590
- var _Object$assign;
591
-
592
- return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
593
- }
594
-
595
- return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
596
- }
597
-
598
- function computeStyles(_ref5) {
599
- var state = _ref5.state,
600
- options = _ref5.options;
601
- var _options$gpuAccelerat = options.gpuAcceleration,
602
- gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
603
- _options$adaptive = options.adaptive,
604
- adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
605
- _options$roundOffsets = options.roundOffsets,
606
- roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
607
-
608
- var commonStyles = {
609
- placement: getBasePlacement$1(state.placement),
610
- variation: getVariation(state.placement),
611
- popper: state.elements.popper,
612
- popperRect: state.rects.popper,
613
- gpuAcceleration: gpuAcceleration,
614
- isFixed: state.options.strategy === 'fixed'
615
- };
616
-
617
- if (state.modifiersData.popperOffsets != null) {
618
- state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
619
- offsets: state.modifiersData.popperOffsets,
620
- position: state.options.strategy,
621
- adaptive: adaptive,
622
- roundOffsets: roundOffsets
623
- })));
624
- }
625
-
626
- if (state.modifiersData.arrow != null) {
627
- state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
628
- offsets: state.modifiersData.arrow,
629
- position: 'absolute',
630
- adaptive: false,
631
- roundOffsets: roundOffsets
632
- })));
633
- }
634
-
635
- state.attributes.popper = Object.assign({}, state.attributes.popper, {
636
- 'data-popper-placement': state.placement
637
- });
638
- } // eslint-disable-next-line import/no-unused-modules
639
-
640
-
641
- var computeStyles$1 = {
642
- name: 'computeStyles',
643
- enabled: true,
644
- phase: 'beforeWrite',
645
- fn: computeStyles,
646
- data: {}
647
- };
648
-
649
- var passive = {
650
- passive: true
651
- };
652
-
653
- function effect(_ref) {
654
- var state = _ref.state,
655
- instance = _ref.instance,
656
- options = _ref.options;
657
- var _options$scroll = options.scroll,
658
- scroll = _options$scroll === void 0 ? true : _options$scroll,
659
- _options$resize = options.resize,
660
- resize = _options$resize === void 0 ? true : _options$resize;
661
- var window = getWindow(state.elements.popper);
662
- var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
663
-
664
- if (scroll) {
665
- scrollParents.forEach(function (scrollParent) {
666
- scrollParent.addEventListener('scroll', instance.update, passive);
667
- });
668
- }
669
-
670
- if (resize) {
671
- window.addEventListener('resize', instance.update, passive);
672
- }
673
-
674
- return function () {
675
- if (scroll) {
676
- scrollParents.forEach(function (scrollParent) {
677
- scrollParent.removeEventListener('scroll', instance.update, passive);
678
- });
679
- }
680
-
681
- if (resize) {
682
- window.removeEventListener('resize', instance.update, passive);
683
- }
684
- };
685
- } // eslint-disable-next-line import/no-unused-modules
686
-
687
-
688
- var eventListeners = {
689
- name: 'eventListeners',
690
- enabled: true,
691
- phase: 'write',
692
- fn: function fn() {},
693
- effect: effect,
694
- data: {}
695
- };
696
-
697
- var hash$1 = {
698
- left: 'right',
699
- right: 'left',
700
- bottom: 'top',
701
- top: 'bottom'
702
- };
703
- function getOppositePlacement(placement) {
704
- return placement.replace(/left|right|bottom|top/g, function (matched) {
705
- return hash$1[matched];
706
- });
707
- }
708
-
709
- var hash = {
710
- start: 'end',
711
- end: 'start'
712
- };
713
- function getOppositeVariationPlacement(placement) {
714
- return placement.replace(/start|end/g, function (matched) {
715
- return hash[matched];
716
- });
717
- }
718
-
719
- function getWindowScroll(node) {
720
- var win = getWindow(node);
721
- var scrollLeft = win.pageXOffset;
722
- var scrollTop = win.pageYOffset;
723
- return {
724
- scrollLeft: scrollLeft,
725
- scrollTop: scrollTop
726
- };
727
- }
728
-
729
- function getWindowScrollBarX(element) {
730
- // If <html> has a CSS width greater than the viewport, then this will be
731
- // incorrect for RTL.
732
- // Popper 1 is broken in this case and never had a bug report so let's assume
733
- // it's not an issue. I don't think anyone ever specifies width on <html>
734
- // anyway.
735
- // Browsers where the left scrollbar doesn't cause an issue report `0` for
736
- // this (e.g. Edge 2019, IE11, Safari)
737
- return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
738
- }
739
-
740
- function getViewportRect(element, strategy) {
741
- var win = getWindow(element);
742
- var html = getDocumentElement(element);
743
- var visualViewport = win.visualViewport;
744
- var width = html.clientWidth;
745
- var height = html.clientHeight;
746
- var x = 0;
747
- var y = 0;
748
-
749
- if (visualViewport) {
750
- width = visualViewport.width;
751
- height = visualViewport.height;
752
- var layoutViewport = isLayoutViewport();
753
-
754
- if (layoutViewport || !layoutViewport && strategy === 'fixed') {
755
- x = visualViewport.offsetLeft;
756
- y = visualViewport.offsetTop;
757
- }
758
- }
759
-
760
- return {
761
- width: width,
762
- height: height,
763
- x: x + getWindowScrollBarX(element),
764
- y: y
765
- };
766
- }
767
-
768
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable
769
-
770
- function getDocumentRect(element) {
771
- var _element$ownerDocumen;
772
-
773
- var html = getDocumentElement(element);
774
- var winScroll = getWindowScroll(element);
775
- var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
776
- var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
777
- var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
778
- var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
779
- var y = -winScroll.scrollTop;
780
-
781
- if (getComputedStyle(body || html).direction === 'rtl') {
782
- x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
783
- }
784
-
785
- return {
786
- width: width,
787
- height: height,
788
- x: x,
789
- y: y
790
- };
791
- }
792
-
793
- function isScrollParent(element) {
794
- // Firefox wants us to check `-x` and `-y` variations as well
795
- var _getComputedStyle = getComputedStyle(element),
796
- overflow = _getComputedStyle.overflow,
797
- overflowX = _getComputedStyle.overflowX,
798
- overflowY = _getComputedStyle.overflowY;
799
-
800
- return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
801
- }
802
-
803
- function getScrollParent(node) {
804
- if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
805
- // $FlowFixMe[incompatible-return]: assume body is always available
806
- return node.ownerDocument.body;
807
- }
808
-
809
- if (isHTMLElement(node) && isScrollParent(node)) {
810
- return node;
811
- }
812
-
813
- return getScrollParent(getParentNode(node));
814
- }
815
-
816
- /*
817
- given a DOM element, return the list of all scroll parents, up the list of ancesors
818
- until we get to the top window object. This list is what we attach scroll listeners
819
- to, because if any of these parent elements scroll, we'll need to re-calculate the
820
- reference element's position.
821
- */
822
-
823
- function listScrollParents(element, list) {
824
- var _element$ownerDocumen;
825
-
826
- if (list === void 0) {
827
- list = [];
828
- }
829
-
830
- var scrollParent = getScrollParent(element);
831
- var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
832
- var win = getWindow(scrollParent);
833
- var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
834
- var updatedList = list.concat(target);
835
- return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
836
- updatedList.concat(listScrollParents(getParentNode(target)));
837
- }
838
-
839
- function rectToClientRect(rect) {
840
- return Object.assign({}, rect, {
841
- left: rect.x,
842
- top: rect.y,
843
- right: rect.x + rect.width,
844
- bottom: rect.y + rect.height
845
- });
846
- }
847
-
848
- function getInnerBoundingClientRect(element, strategy) {
849
- var rect = getBoundingClientRect(element, false, strategy === 'fixed');
850
- rect.top = rect.top + element.clientTop;
851
- rect.left = rect.left + element.clientLeft;
852
- rect.bottom = rect.top + element.clientHeight;
853
- rect.right = rect.left + element.clientWidth;
854
- rect.width = element.clientWidth;
855
- rect.height = element.clientHeight;
856
- rect.x = rect.left;
857
- rect.y = rect.top;
858
- return rect;
859
- }
860
-
861
- function getClientRectFromMixedType(element, clippingParent, strategy) {
862
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement$1(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
863
- } // A "clipping parent" is an overflowable container with the characteristic of
864
- // clipping (or hiding) overflowing elements with a position different from
865
- // `initial`
866
-
867
-
868
- function getClippingParents(element) {
869
- var clippingParents = listScrollParents(getParentNode(element));
870
- var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
871
- var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
872
-
873
- if (!isElement$1(clipperElement)) {
874
- return [];
875
- } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
876
-
877
-
878
- return clippingParents.filter(function (clippingParent) {
879
- return isElement$1(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
880
- });
881
- } // Gets the maximum area that the element is visible in due to any number of
882
- // clipping parents
883
-
884
-
885
- function getClippingRect(element, boundary, rootBoundary, strategy) {
886
- var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
887
- var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
888
- var firstClippingParent = clippingParents[0];
889
- var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
890
- var rect = getClientRectFromMixedType(element, clippingParent, strategy);
891
- accRect.top = max(rect.top, accRect.top);
892
- accRect.right = min(rect.right, accRect.right);
893
- accRect.bottom = min(rect.bottom, accRect.bottom);
894
- accRect.left = max(rect.left, accRect.left);
895
- return accRect;
896
- }, getClientRectFromMixedType(element, firstClippingParent, strategy));
897
- clippingRect.width = clippingRect.right - clippingRect.left;
898
- clippingRect.height = clippingRect.bottom - clippingRect.top;
899
- clippingRect.x = clippingRect.left;
900
- clippingRect.y = clippingRect.top;
901
- return clippingRect;
902
- }
903
-
904
- function computeOffsets(_ref) {
905
- var reference = _ref.reference,
906
- element = _ref.element,
907
- placement = _ref.placement;
908
- var basePlacement = placement ? getBasePlacement$1(placement) : null;
909
- var variation = placement ? getVariation(placement) : null;
910
- var commonX = reference.x + reference.width / 2 - element.width / 2;
911
- var commonY = reference.y + reference.height / 2 - element.height / 2;
912
- var offsets;
913
-
914
- switch (basePlacement) {
915
- case top:
916
- offsets = {
917
- x: commonX,
918
- y: reference.y - element.height
919
- };
920
- break;
921
-
922
- case bottom:
923
- offsets = {
924
- x: commonX,
925
- y: reference.y + reference.height
926
- };
927
- break;
928
-
929
- case right:
930
- offsets = {
931
- x: reference.x + reference.width,
932
- y: commonY
933
- };
934
- break;
935
-
936
- case left:
937
- offsets = {
938
- x: reference.x - element.width,
939
- y: commonY
940
- };
941
- break;
942
-
943
- default:
944
- offsets = {
945
- x: reference.x,
946
- y: reference.y
947
- };
948
- }
949
-
950
- var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
951
-
952
- if (mainAxis != null) {
953
- var len = mainAxis === 'y' ? 'height' : 'width';
954
-
955
- switch (variation) {
956
- case start:
957
- offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
958
- break;
959
-
960
- case end:
961
- offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
962
- break;
963
- }
964
- }
965
-
966
- return offsets;
967
- }
968
-
969
- function detectOverflow(state, options) {
970
- if (options === void 0) {
971
- options = {};
972
- }
973
-
974
- var _options = options,
975
- _options$placement = _options.placement,
976
- placement = _options$placement === void 0 ? state.placement : _options$placement,
977
- _options$strategy = _options.strategy,
978
- strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
979
- _options$boundary = _options.boundary,
980
- boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
981
- _options$rootBoundary = _options.rootBoundary,
982
- rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
983
- _options$elementConte = _options.elementContext,
984
- elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
985
- _options$altBoundary = _options.altBoundary,
986
- altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
987
- _options$padding = _options.padding,
988
- padding = _options$padding === void 0 ? 0 : _options$padding;
989
- var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
990
- var altContext = elementContext === popper ? reference : popper;
991
- var popperRect = state.rects.popper;
992
- var element = state.elements[altBoundary ? altContext : elementContext];
993
- var clippingClientRect = getClippingRect(isElement$1(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
994
- var referenceClientRect = getBoundingClientRect(state.elements.reference);
995
- var popperOffsets = computeOffsets({
996
- reference: referenceClientRect,
997
- element: popperRect,
998
- strategy: 'absolute',
999
- placement: placement
1000
- });
1001
- var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
1002
- var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
1003
- // 0 or negative = within the clipping rect
1004
-
1005
- var overflowOffsets = {
1006
- top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
1007
- bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
1008
- left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
1009
- right: elementClientRect.right - clippingClientRect.right + paddingObject.right
1010
- };
1011
- var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
1012
-
1013
- if (elementContext === popper && offsetData) {
1014
- var offset = offsetData[placement];
1015
- Object.keys(overflowOffsets).forEach(function (key) {
1016
- var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
1017
- var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
1018
- overflowOffsets[key] += offset[axis] * multiply;
1019
- });
1020
- }
1021
-
1022
- return overflowOffsets;
1023
- }
1024
-
1025
- function computeAutoPlacement(state, options) {
1026
- if (options === void 0) {
1027
- options = {};
1028
- }
1029
-
1030
- var _options = options,
1031
- placement = _options.placement,
1032
- boundary = _options.boundary,
1033
- rootBoundary = _options.rootBoundary,
1034
- padding = _options.padding,
1035
- flipVariations = _options.flipVariations,
1036
- _options$allowedAutoP = _options.allowedAutoPlacements,
1037
- allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
1038
- var variation = getVariation(placement);
1039
- var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
1040
- return getVariation(placement) === variation;
1041
- }) : basePlacements;
1042
- var allowedPlacements = placements$1.filter(function (placement) {
1043
- return allowedAutoPlacements.indexOf(placement) >= 0;
1044
- });
1045
-
1046
- if (allowedPlacements.length === 0) {
1047
- allowedPlacements = placements$1;
1048
- } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
1049
-
1050
-
1051
- var overflows = allowedPlacements.reduce(function (acc, placement) {
1052
- acc[placement] = detectOverflow(state, {
1053
- placement: placement,
1054
- boundary: boundary,
1055
- rootBoundary: rootBoundary,
1056
- padding: padding
1057
- })[getBasePlacement$1(placement)];
1058
- return acc;
1059
- }, {});
1060
- return Object.keys(overflows).sort(function (a, b) {
1061
- return overflows[a] - overflows[b];
1062
- });
1063
- }
1064
-
1065
- function getExpandedFallbackPlacements(placement) {
1066
- if (getBasePlacement$1(placement) === auto) {
1067
- return [];
1068
- }
1069
-
1070
- var oppositePlacement = getOppositePlacement(placement);
1071
- return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
1072
- }
1073
-
1074
- function flip(_ref) {
1075
- var state = _ref.state,
1076
- options = _ref.options,
1077
- name = _ref.name;
1078
-
1079
- if (state.modifiersData[name]._skip) {
1080
- return;
1081
- }
1082
-
1083
- var _options$mainAxis = options.mainAxis,
1084
- checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1085
- _options$altAxis = options.altAxis,
1086
- checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
1087
- specifiedFallbackPlacements = options.fallbackPlacements,
1088
- padding = options.padding,
1089
- boundary = options.boundary,
1090
- rootBoundary = options.rootBoundary,
1091
- altBoundary = options.altBoundary,
1092
- _options$flipVariatio = options.flipVariations,
1093
- flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
1094
- allowedAutoPlacements = options.allowedAutoPlacements;
1095
- var preferredPlacement = state.options.placement;
1096
- var basePlacement = getBasePlacement$1(preferredPlacement);
1097
- var isBasePlacement = basePlacement === preferredPlacement;
1098
- var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
1099
- var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
1100
- return acc.concat(getBasePlacement$1(placement) === auto ? computeAutoPlacement(state, {
1101
- placement: placement,
1102
- boundary: boundary,
1103
- rootBoundary: rootBoundary,
1104
- padding: padding,
1105
- flipVariations: flipVariations,
1106
- allowedAutoPlacements: allowedAutoPlacements
1107
- }) : placement);
1108
- }, []);
1109
- var referenceRect = state.rects.reference;
1110
- var popperRect = state.rects.popper;
1111
- var checksMap = new Map();
1112
- var makeFallbackChecks = true;
1113
- var firstFittingPlacement = placements[0];
1114
-
1115
- for (var i = 0; i < placements.length; i++) {
1116
- var placement = placements[i];
1117
-
1118
- var _basePlacement = getBasePlacement$1(placement);
1119
-
1120
- var isStartVariation = getVariation(placement) === start;
1121
- var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
1122
- var len = isVertical ? 'width' : 'height';
1123
- var overflow = detectOverflow(state, {
1124
- placement: placement,
1125
- boundary: boundary,
1126
- rootBoundary: rootBoundary,
1127
- altBoundary: altBoundary,
1128
- padding: padding
1129
- });
1130
- var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
1131
-
1132
- if (referenceRect[len] > popperRect[len]) {
1133
- mainVariationSide = getOppositePlacement(mainVariationSide);
1134
- }
1135
-
1136
- var altVariationSide = getOppositePlacement(mainVariationSide);
1137
- var checks = [];
1138
-
1139
- if (checkMainAxis) {
1140
- checks.push(overflow[_basePlacement] <= 0);
1141
- }
1142
-
1143
- if (checkAltAxis) {
1144
- checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
1145
- }
1146
-
1147
- if (checks.every(function (check) {
1148
- return check;
1149
- })) {
1150
- firstFittingPlacement = placement;
1151
- makeFallbackChecks = false;
1152
- break;
1153
- }
1154
-
1155
- checksMap.set(placement, checks);
1156
- }
1157
-
1158
- if (makeFallbackChecks) {
1159
- // `2` may be desired in some cases – research later
1160
- var numberOfChecks = flipVariations ? 3 : 1;
1161
-
1162
- var _loop = function _loop(_i) {
1163
- var fittingPlacement = placements.find(function (placement) {
1164
- var checks = checksMap.get(placement);
1165
-
1166
- if (checks) {
1167
- return checks.slice(0, _i).every(function (check) {
1168
- return check;
1169
- });
1170
- }
1171
- });
1172
-
1173
- if (fittingPlacement) {
1174
- firstFittingPlacement = fittingPlacement;
1175
- return "break";
1176
- }
1177
- };
1178
-
1179
- for (var _i = numberOfChecks; _i > 0; _i--) {
1180
- var _ret = _loop(_i);
1181
-
1182
- if (_ret === "break") break;
1183
- }
1184
- }
1185
-
1186
- if (state.placement !== firstFittingPlacement) {
1187
- state.modifiersData[name]._skip = true;
1188
- state.placement = firstFittingPlacement;
1189
- state.reset = true;
1190
- }
1191
- } // eslint-disable-next-line import/no-unused-modules
1192
-
1193
-
1194
- var flip$1 = {
1195
- name: 'flip',
1196
- enabled: true,
1197
- phase: 'main',
1198
- fn: flip,
1199
- requiresIfExists: ['offset'],
1200
- data: {
1201
- _skip: false
1202
- }
1203
- };
1204
-
1205
- function getSideOffsets(overflow, rect, preventedOffsets) {
1206
- if (preventedOffsets === void 0) {
1207
- preventedOffsets = {
1208
- x: 0,
1209
- y: 0
1210
- };
1211
- }
1212
-
1213
- return {
1214
- top: overflow.top - rect.height - preventedOffsets.y,
1215
- right: overflow.right - rect.width + preventedOffsets.x,
1216
- bottom: overflow.bottom - rect.height + preventedOffsets.y,
1217
- left: overflow.left - rect.width - preventedOffsets.x
1218
- };
1219
- }
1220
-
1221
- function isAnySideFullyClipped(overflow) {
1222
- return [top, right, bottom, left].some(function (side) {
1223
- return overflow[side] >= 0;
1224
- });
1225
- }
1226
-
1227
- function hide(_ref) {
1228
- var state = _ref.state,
1229
- name = _ref.name;
1230
- var referenceRect = state.rects.reference;
1231
- var popperRect = state.rects.popper;
1232
- var preventedOffsets = state.modifiersData.preventOverflow;
1233
- var referenceOverflow = detectOverflow(state, {
1234
- elementContext: 'reference'
1235
- });
1236
- var popperAltOverflow = detectOverflow(state, {
1237
- altBoundary: true
1238
- });
1239
- var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
1240
- var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
1241
- var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
1242
- var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
1243
- state.modifiersData[name] = {
1244
- referenceClippingOffsets: referenceClippingOffsets,
1245
- popperEscapeOffsets: popperEscapeOffsets,
1246
- isReferenceHidden: isReferenceHidden,
1247
- hasPopperEscaped: hasPopperEscaped
1248
- };
1249
- state.attributes.popper = Object.assign({}, state.attributes.popper, {
1250
- 'data-popper-reference-hidden': isReferenceHidden,
1251
- 'data-popper-escaped': hasPopperEscaped
1252
- });
1253
- } // eslint-disable-next-line import/no-unused-modules
1254
-
1255
-
1256
- var hide$1 = {
1257
- name: 'hide',
1258
- enabled: true,
1259
- phase: 'main',
1260
- requiresIfExists: ['preventOverflow'],
1261
- fn: hide
1262
- };
1263
-
1264
- function distanceAndSkiddingToXY(placement, rects, offset) {
1265
- var basePlacement = getBasePlacement$1(placement);
1266
- var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
1267
-
1268
- var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
1269
- placement: placement
1270
- })) : offset,
1271
- skidding = _ref[0],
1272
- distance = _ref[1];
1273
-
1274
- skidding = skidding || 0;
1275
- distance = (distance || 0) * invertDistance;
1276
- return [left, right].indexOf(basePlacement) >= 0 ? {
1277
- x: distance,
1278
- y: skidding
1279
- } : {
1280
- x: skidding,
1281
- y: distance
1282
- };
1283
- }
1284
-
1285
- function offset(_ref2) {
1286
- var state = _ref2.state,
1287
- options = _ref2.options,
1288
- name = _ref2.name;
1289
- var _options$offset = options.offset,
1290
- offset = _options$offset === void 0 ? [0, 0] : _options$offset;
1291
- var data = placements.reduce(function (acc, placement) {
1292
- acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
1293
- return acc;
1294
- }, {});
1295
- var _data$state$placement = data[state.placement],
1296
- x = _data$state$placement.x,
1297
- y = _data$state$placement.y;
1298
-
1299
- if (state.modifiersData.popperOffsets != null) {
1300
- state.modifiersData.popperOffsets.x += x;
1301
- state.modifiersData.popperOffsets.y += y;
1302
- }
1303
-
1304
- state.modifiersData[name] = data;
1305
- } // eslint-disable-next-line import/no-unused-modules
1306
-
1307
-
1308
- var offset$1 = {
1309
- name: 'offset',
1310
- enabled: true,
1311
- phase: 'main',
1312
- requires: ['popperOffsets'],
1313
- fn: offset
1314
- };
1315
-
1316
- function popperOffsets(_ref) {
1317
- var state = _ref.state,
1318
- name = _ref.name;
1319
- // Offsets are the actual position the popper needs to have to be
1320
- // properly positioned near its reference element
1321
- // This is the most basic placement, and will be adjusted by
1322
- // the modifiers in the next step
1323
- state.modifiersData[name] = computeOffsets({
1324
- reference: state.rects.reference,
1325
- element: state.rects.popper,
1326
- strategy: 'absolute',
1327
- placement: state.placement
1328
- });
1329
- } // eslint-disable-next-line import/no-unused-modules
1330
-
1331
-
1332
- var popperOffsets$1 = {
1333
- name: 'popperOffsets',
1334
- enabled: true,
1335
- phase: 'read',
1336
- fn: popperOffsets,
1337
- data: {}
1338
- };
1339
-
1340
- function getAltAxis(axis) {
1341
- return axis === 'x' ? 'y' : 'x';
1342
- }
1343
-
1344
- function preventOverflow(_ref) {
1345
- var state = _ref.state,
1346
- options = _ref.options,
1347
- name = _ref.name;
1348
- var _options$mainAxis = options.mainAxis,
1349
- checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1350
- _options$altAxis = options.altAxis,
1351
- checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
1352
- boundary = options.boundary,
1353
- rootBoundary = options.rootBoundary,
1354
- altBoundary = options.altBoundary,
1355
- padding = options.padding,
1356
- _options$tether = options.tether,
1357
- tether = _options$tether === void 0 ? true : _options$tether,
1358
- _options$tetherOffset = options.tetherOffset,
1359
- tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
1360
- var overflow = detectOverflow(state, {
1361
- boundary: boundary,
1362
- rootBoundary: rootBoundary,
1363
- padding: padding,
1364
- altBoundary: altBoundary
1365
- });
1366
- var basePlacement = getBasePlacement$1(state.placement);
1367
- var variation = getVariation(state.placement);
1368
- var isBasePlacement = !variation;
1369
- var mainAxis = getMainAxisFromPlacement(basePlacement);
1370
- var altAxis = getAltAxis(mainAxis);
1371
- var popperOffsets = state.modifiersData.popperOffsets;
1372
- var referenceRect = state.rects.reference;
1373
- var popperRect = state.rects.popper;
1374
- var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
1375
- placement: state.placement
1376
- })) : tetherOffset;
1377
- var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
1378
- mainAxis: tetherOffsetValue,
1379
- altAxis: tetherOffsetValue
1380
- } : Object.assign({
1381
- mainAxis: 0,
1382
- altAxis: 0
1383
- }, tetherOffsetValue);
1384
- var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
1385
- var data = {
1386
- x: 0,
1387
- y: 0
1388
- };
1389
-
1390
- if (!popperOffsets) {
1391
- return;
1392
- }
1393
-
1394
- if (checkMainAxis) {
1395
- var _offsetModifierState$;
1396
-
1397
- var mainSide = mainAxis === 'y' ? top : left;
1398
- var altSide = mainAxis === 'y' ? bottom : right;
1399
- var len = mainAxis === 'y' ? 'height' : 'width';
1400
- var offset = popperOffsets[mainAxis];
1401
- var min$1 = offset + overflow[mainSide];
1402
- var max$1 = offset - overflow[altSide];
1403
- var additive = tether ? -popperRect[len] / 2 : 0;
1404
- var minLen = variation === start ? referenceRect[len] : popperRect[len];
1405
- var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
1406
- // outside the reference bounds
1407
-
1408
- var arrowElement = state.elements.arrow;
1409
- var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
1410
- width: 0,
1411
- height: 0
1412
- };
1413
- var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
1414
- var arrowPaddingMin = arrowPaddingObject[mainSide];
1415
- var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
1416
- // to include its full size in the calculation. If the reference is small
1417
- // and near the edge of a boundary, the popper can overflow even if the
1418
- // reference is not overflowing as well (e.g. virtual elements with no
1419
- // width or height)
1420
-
1421
- var arrowLen = within(0, referenceRect[len], arrowRect[len]);
1422
- var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
1423
- var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
1424
- var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1425
- var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
1426
- var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
1427
- var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
1428
- var tetherMax = offset + maxOffset - offsetModifierValue;
1429
- var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
1430
- popperOffsets[mainAxis] = preventedOffset;
1431
- data[mainAxis] = preventedOffset - offset;
1432
- }
1433
-
1434
- if (checkAltAxis) {
1435
- var _offsetModifierState$2;
1436
-
1437
- var _mainSide = mainAxis === 'x' ? top : left;
1438
-
1439
- var _altSide = mainAxis === 'x' ? bottom : right;
1440
-
1441
- var _offset = popperOffsets[altAxis];
1442
-
1443
- var _len = altAxis === 'y' ? 'height' : 'width';
1444
-
1445
- var _min = _offset + overflow[_mainSide];
1446
-
1447
- var _max = _offset - overflow[_altSide];
1448
-
1449
- var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
1450
-
1451
- var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
1452
-
1453
- var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
1454
-
1455
- var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
1456
-
1457
- var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
1458
-
1459
- popperOffsets[altAxis] = _preventedOffset;
1460
- data[altAxis] = _preventedOffset - _offset;
1461
- }
1462
-
1463
- state.modifiersData[name] = data;
1464
- } // eslint-disable-next-line import/no-unused-modules
1465
-
1466
-
1467
- var preventOverflow$1 = {
1468
- name: 'preventOverflow',
1469
- enabled: true,
1470
- phase: 'main',
1471
- fn: preventOverflow,
1472
- requiresIfExists: ['offset']
1473
- };
1474
-
1475
- function getHTMLElementScroll(element) {
1476
- return {
1477
- scrollLeft: element.scrollLeft,
1478
- scrollTop: element.scrollTop
1479
- };
1480
- }
1481
-
1482
- function getNodeScroll(node) {
1483
- if (node === getWindow(node) || !isHTMLElement(node)) {
1484
- return getWindowScroll(node);
1485
- } else {
1486
- return getHTMLElementScroll(node);
1487
- }
1488
- }
1489
-
1490
- function isElementScaled(element) {
1491
- var rect = element.getBoundingClientRect();
1492
- var scaleX = round(rect.width) / element.offsetWidth || 1;
1493
- var scaleY = round(rect.height) / element.offsetHeight || 1;
1494
- return scaleX !== 1 || scaleY !== 1;
1495
- } // Returns the composite rect of an element relative to its offsetParent.
1496
- // Composite means it takes into account transforms as well as layout.
1497
-
1498
-
1499
- function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1500
- if (isFixed === void 0) {
1501
- isFixed = false;
1502
- }
1503
-
1504
- var isOffsetParentAnElement = isHTMLElement(offsetParent);
1505
- var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
1506
- var documentElement = getDocumentElement(offsetParent);
1507
- var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
1508
- var scroll = {
1509
- scrollLeft: 0,
1510
- scrollTop: 0
1511
- };
1512
- var offsets = {
1513
- x: 0,
1514
- y: 0
1515
- };
1516
-
1517
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1518
- if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
1519
- isScrollParent(documentElement)) {
1520
- scroll = getNodeScroll(offsetParent);
1521
- }
1522
-
1523
- if (isHTMLElement(offsetParent)) {
1524
- offsets = getBoundingClientRect(offsetParent, true);
1525
- offsets.x += offsetParent.clientLeft;
1526
- offsets.y += offsetParent.clientTop;
1527
- } else if (documentElement) {
1528
- offsets.x = getWindowScrollBarX(documentElement);
1529
- }
1530
- }
1531
-
1532
- return {
1533
- x: rect.left + scroll.scrollLeft - offsets.x,
1534
- y: rect.top + scroll.scrollTop - offsets.y,
1535
- width: rect.width,
1536
- height: rect.height
1537
- };
1538
- }
1539
-
1540
- function order(modifiers) {
1541
- var map = new Map();
1542
- var visited = new Set();
1543
- var result = [];
1544
- modifiers.forEach(function (modifier) {
1545
- map.set(modifier.name, modifier);
1546
- }); // On visiting object, check for its dependencies and visit them recursively
1547
-
1548
- function sort(modifier) {
1549
- visited.add(modifier.name);
1550
- var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
1551
- requires.forEach(function (dep) {
1552
- if (!visited.has(dep)) {
1553
- var depModifier = map.get(dep);
1554
-
1555
- if (depModifier) {
1556
- sort(depModifier);
1557
- }
1558
- }
1559
- });
1560
- result.push(modifier);
1561
- }
1562
-
1563
- modifiers.forEach(function (modifier) {
1564
- if (!visited.has(modifier.name)) {
1565
- // check for visited object
1566
- sort(modifier);
1567
- }
1568
- });
1569
- return result;
1570
- }
1571
-
1572
- function orderModifiers(modifiers) {
1573
- // order based on dependencies
1574
- var orderedModifiers = order(modifiers); // order based on phase
1575
-
1576
- return modifierPhases.reduce(function (acc, phase) {
1577
- return acc.concat(orderedModifiers.filter(function (modifier) {
1578
- return modifier.phase === phase;
1579
- }));
1580
- }, []);
1581
- }
1582
-
1583
- function debounce$1(fn) {
1584
- var pending;
1585
- return function () {
1586
- if (!pending) {
1587
- pending = new Promise(function (resolve) {
1588
- Promise.resolve().then(function () {
1589
- pending = undefined;
1590
- resolve(fn());
1591
- });
1592
- });
1593
- }
1594
-
1595
- return pending;
1596
- };
1597
- }
1598
-
1599
- function mergeByName(modifiers) {
1600
- var merged = modifiers.reduce(function (merged, current) {
1601
- var existing = merged[current.name];
1602
- merged[current.name] = existing ? Object.assign({}, existing, current, {
1603
- options: Object.assign({}, existing.options, current.options),
1604
- data: Object.assign({}, existing.data, current.data)
1605
- }) : current;
1606
- return merged;
1607
- }, {}); // IE11 does not support Object.values
1608
-
1609
- return Object.keys(merged).map(function (key) {
1610
- return merged[key];
1611
- });
1612
- }
1613
-
1614
- var DEFAULT_OPTIONS = {
1615
- placement: 'bottom',
1616
- modifiers: [],
1617
- strategy: 'absolute'
1618
- };
1619
-
1620
- function areValidElements() {
1621
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1622
- args[_key] = arguments[_key];
1623
- }
1624
-
1625
- return !args.some(function (element) {
1626
- return !(element && typeof element.getBoundingClientRect === 'function');
1627
- });
1628
- }
1629
-
1630
- function popperGenerator(generatorOptions) {
1631
- if (generatorOptions === void 0) {
1632
- generatorOptions = {};
1633
- }
1634
-
1635
- var _generatorOptions = generatorOptions,
1636
- _generatorOptions$def = _generatorOptions.defaultModifiers,
1637
- defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
1638
- _generatorOptions$def2 = _generatorOptions.defaultOptions,
1639
- defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
1640
- return function createPopper(reference, popper, options) {
1641
- if (options === void 0) {
1642
- options = defaultOptions;
1643
- }
1644
-
1645
- var state = {
1646
- placement: 'bottom',
1647
- orderedModifiers: [],
1648
- options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
1649
- modifiersData: {},
1650
- elements: {
1651
- reference: reference,
1652
- popper: popper
1653
- },
1654
- attributes: {},
1655
- styles: {}
1656
- };
1657
- var effectCleanupFns = [];
1658
- var isDestroyed = false;
1659
- var instance = {
1660
- state: state,
1661
- setOptions: function setOptions(setOptionsAction) {
1662
- var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
1663
- cleanupModifierEffects();
1664
- state.options = Object.assign({}, defaultOptions, state.options, options);
1665
- state.scrollParents = {
1666
- reference: isElement$1(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
1667
- popper: listScrollParents(popper)
1668
- }; // Orders the modifiers based on their dependencies and `phase`
1669
- // properties
1670
-
1671
- var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
1672
-
1673
- state.orderedModifiers = orderedModifiers.filter(function (m) {
1674
- return m.enabled;
1675
- }); // Validate the provided modifiers so that the consumer will get warned
1676
-
1677
- runModifierEffects();
1678
- return instance.update();
1679
- },
1680
- // Sync update – it will always be executed, even if not necessary. This
1681
- // is useful for low frequency updates where sync behavior simplifies the
1682
- // logic.
1683
- // For high frequency updates (e.g. `resize` and `scroll` events), always
1684
- // prefer the async Popper#update method
1685
- forceUpdate: function forceUpdate() {
1686
- if (isDestroyed) {
1687
- return;
1688
- }
1689
-
1690
- var _state$elements = state.elements,
1691
- reference = _state$elements.reference,
1692
- popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
1693
- // anymore
1694
-
1695
- if (!areValidElements(reference, popper)) {
1696
-
1697
- return;
1698
- } // Store the reference and popper rects to be read by modifiers
1699
-
1700
-
1701
- state.rects = {
1702
- reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
1703
- popper: getLayoutRect(popper)
1704
- }; // Modifiers have the ability to reset the current update cycle. The
1705
- // most common use case for this is the `flip` modifier changing the
1706
- // placement, which then needs to re-run all the modifiers, because the
1707
- // logic was previously ran for the previous placement and is therefore
1708
- // stale/incorrect
1709
-
1710
- state.reset = false;
1711
- state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
1712
- // is filled with the initial data specified by the modifier. This means
1713
- // it doesn't persist and is fresh on each update.
1714
- // To ensure persistent data, use `${name}#persistent`
1715
-
1716
- state.orderedModifiers.forEach(function (modifier) {
1717
- return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
1718
- });
1719
-
1720
- for (var index = 0; index < state.orderedModifiers.length; index++) {
1721
-
1722
- if (state.reset === true) {
1723
- state.reset = false;
1724
- index = -1;
1725
- continue;
1726
- }
1727
-
1728
- var _state$orderedModifie = state.orderedModifiers[index],
1729
- fn = _state$orderedModifie.fn,
1730
- _state$orderedModifie2 = _state$orderedModifie.options,
1731
- _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
1732
- name = _state$orderedModifie.name;
1733
-
1734
- if (typeof fn === 'function') {
1735
- state = fn({
1736
- state: state,
1737
- options: _options,
1738
- name: name,
1739
- instance: instance
1740
- }) || state;
1741
- }
1742
- }
1743
- },
1744
- // Async and optimistically optimized update – it will not be executed if
1745
- // not necessary (debounced to run at most once-per-tick)
1746
- update: debounce$1(function () {
1747
- return new Promise(function (resolve) {
1748
- instance.forceUpdate();
1749
- resolve(state);
1750
- });
1751
- }),
1752
- destroy: function destroy() {
1753
- cleanupModifierEffects();
1754
- isDestroyed = true;
1755
- }
1756
- };
1757
-
1758
- if (!areValidElements(reference, popper)) {
1759
-
1760
- return instance;
1761
- }
1762
-
1763
- instance.setOptions(options).then(function (state) {
1764
- if (!isDestroyed && options.onFirstUpdate) {
1765
- options.onFirstUpdate(state);
1766
- }
1767
- }); // Modifiers have the ability to execute arbitrary code before the first
1768
- // update cycle runs. They will be executed in the same order as the update
1769
- // cycle. This is useful when a modifier adds some persistent data that
1770
- // other modifiers need to use, but the modifier is run after the dependent
1771
- // one.
1772
-
1773
- function runModifierEffects() {
1774
- state.orderedModifiers.forEach(function (_ref3) {
1775
- var name = _ref3.name,
1776
- _ref3$options = _ref3.options,
1777
- options = _ref3$options === void 0 ? {} : _ref3$options,
1778
- effect = _ref3.effect;
1779
-
1780
- if (typeof effect === 'function') {
1781
- var cleanupFn = effect({
1782
- state: state,
1783
- name: name,
1784
- instance: instance,
1785
- options: options
1786
- });
1787
-
1788
- var noopFn = function noopFn() {};
1789
-
1790
- effectCleanupFns.push(cleanupFn || noopFn);
1791
- }
1792
- });
1793
- }
1794
-
1795
- function cleanupModifierEffects() {
1796
- effectCleanupFns.forEach(function (fn) {
1797
- return fn();
1798
- });
1799
- effectCleanupFns = [];
1800
- }
1801
-
1802
- return instance;
1803
- };
1804
- }
1805
-
1806
- var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
1807
- var createPopper = /*#__PURE__*/popperGenerator({
1808
- defaultModifiers: defaultModifiers
1809
- }); // eslint-disable-next-line import/no-unused-modules
1810
-
1811
- /**!
1812
- * tippy.js v6.3.7
1813
- * (c) 2017-2021 atomiks
1814
- * MIT License
1815
- */
1816
- var BOX_CLASS = "tippy-box";
1817
- var CONTENT_CLASS = "tippy-content";
1818
- var BACKDROP_CLASS = "tippy-backdrop";
1819
- var ARROW_CLASS = "tippy-arrow";
1820
- var SVG_ARROW_CLASS = "tippy-svg-arrow";
1821
- var TOUCH_OPTIONS = {
1822
- passive: true,
1823
- capture: true
1824
- };
1825
- var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO() {
1826
- return document.body;
1827
- };
1828
- function getValueAtIndexOrReturn(value, index, defaultValue) {
1829
- if (Array.isArray(value)) {
1830
- var v = value[index];
1831
- return v == null ? Array.isArray(defaultValue) ? defaultValue[index] : defaultValue : v;
1832
- }
1833
-
1834
- return value;
1835
- }
1836
- function isType(value, type) {
1837
- var str = {}.toString.call(value);
1838
- return str.indexOf('[object') === 0 && str.indexOf(type + "]") > -1;
1839
- }
1840
- function invokeWithArgsOrReturn(value, args) {
1841
- return typeof value === 'function' ? value.apply(void 0, args) : value;
1842
- }
1843
- function debounce(fn, ms) {
1844
- // Avoid wrapping in `setTimeout` if ms is 0 anyway
1845
- if (ms === 0) {
1846
- return fn;
1847
- }
1848
-
1849
- var timeout;
1850
- return function (arg) {
1851
- clearTimeout(timeout);
1852
- timeout = setTimeout(function () {
1853
- fn(arg);
1854
- }, ms);
1855
- };
1856
- }
1857
- function splitBySpaces(value) {
1858
- return value.split(/\s+/).filter(Boolean);
1859
- }
1860
- function normalizeToArray(value) {
1861
- return [].concat(value);
1862
- }
1863
- function pushIfUnique(arr, value) {
1864
- if (arr.indexOf(value) === -1) {
1865
- arr.push(value);
1866
- }
1867
- }
1868
- function unique(arr) {
1869
- return arr.filter(function (item, index) {
1870
- return arr.indexOf(item) === index;
1871
- });
1872
- }
1873
- function getBasePlacement(placement) {
1874
- return placement.split('-')[0];
1875
- }
1876
- function arrayFrom(value) {
1877
- return [].slice.call(value);
1878
- }
1879
- function removeUndefinedProps(obj) {
1880
- return Object.keys(obj).reduce(function (acc, key) {
1881
- if (obj[key] !== undefined) {
1882
- acc[key] = obj[key];
1883
- }
1884
-
1885
- return acc;
1886
- }, {});
1887
- }
1888
-
1889
- function div() {
1890
- return document.createElement('div');
1891
- }
1892
- function isElement(value) {
1893
- return ['Element', 'Fragment'].some(function (type) {
1894
- return isType(value, type);
1895
- });
1896
- }
1897
- function isNodeList(value) {
1898
- return isType(value, 'NodeList');
1899
- }
1900
- function isMouseEvent(value) {
1901
- return isType(value, 'MouseEvent');
1902
- }
1903
- function isReferenceElement(value) {
1904
- return !!(value && value._tippy && value._tippy.reference === value);
1905
- }
1906
- function getArrayOfElements(value) {
1907
- if (isElement(value)) {
1908
- return [value];
1909
- }
1910
-
1911
- if (isNodeList(value)) {
1912
- return arrayFrom(value);
1913
- }
1914
-
1915
- if (Array.isArray(value)) {
1916
- return value;
1917
- }
1918
-
1919
- return arrayFrom(document.querySelectorAll(value));
1920
- }
1921
- function setTransitionDuration(els, value) {
1922
- els.forEach(function (el) {
1923
- if (el) {
1924
- el.style.transitionDuration = value + "ms";
1925
- }
1926
- });
1927
- }
1928
- function setVisibilityState(els, state) {
1929
- els.forEach(function (el) {
1930
- if (el) {
1931
- el.setAttribute('data-state', state);
1932
- }
1933
- });
1934
- }
1935
- function getOwnerDocument(elementOrElements) {
1936
- var _element$ownerDocumen;
1937
-
1938
- var _normalizeToArray = normalizeToArray(elementOrElements),
1939
- element = _normalizeToArray[0]; // Elements created via a <template> have an ownerDocument with no reference to the body
1940
-
1941
-
1942
- return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
1943
- }
1944
- function isCursorOutsideInteractiveBorder(popperTreeData, event) {
1945
- var clientX = event.clientX,
1946
- clientY = event.clientY;
1947
- return popperTreeData.every(function (_ref) {
1948
- var popperRect = _ref.popperRect,
1949
- popperState = _ref.popperState,
1950
- props = _ref.props;
1951
- var interactiveBorder = props.interactiveBorder;
1952
- var basePlacement = getBasePlacement(popperState.placement);
1953
- var offsetData = popperState.modifiersData.offset;
1954
-
1955
- if (!offsetData) {
1956
- return true;
1957
- }
1958
-
1959
- var topDistance = basePlacement === 'bottom' ? offsetData.top.y : 0;
1960
- var bottomDistance = basePlacement === 'top' ? offsetData.bottom.y : 0;
1961
- var leftDistance = basePlacement === 'right' ? offsetData.left.x : 0;
1962
- var rightDistance = basePlacement === 'left' ? offsetData.right.x : 0;
1963
- var exceedsTop = popperRect.top - clientY + topDistance > interactiveBorder;
1964
- var exceedsBottom = clientY - popperRect.bottom - bottomDistance > interactiveBorder;
1965
- var exceedsLeft = popperRect.left - clientX + leftDistance > interactiveBorder;
1966
- var exceedsRight = clientX - popperRect.right - rightDistance > interactiveBorder;
1967
- return exceedsTop || exceedsBottom || exceedsLeft || exceedsRight;
1968
- });
1969
- }
1970
- function updateTransitionEndListener(box, action, listener) {
1971
- var method = action + "EventListener"; // some browsers apparently support `transition` (unprefixed) but only fire
1972
- // `webkitTransitionEnd`...
1973
-
1974
- ['transitionend', 'webkitTransitionEnd'].forEach(function (event) {
1975
- box[method](event, listener);
1976
- });
1977
- }
1978
- /**
1979
- * Compared to xxx.contains, this function works for dom structures with shadow
1980
- * dom
1981
- */
1982
-
1983
- function actualContains(parent, child) {
1984
- var target = child;
1985
-
1986
- while (target) {
1987
- var _target$getRootNode;
1988
-
1989
- if (parent.contains(target)) {
1990
- return true;
1991
- }
1992
-
1993
- target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
1994
- }
1995
-
1996
- return false;
1997
- }
1998
-
1999
- var currentInput = {
2000
- isTouch: false
2001
- };
2002
- var lastMouseMoveTime = 0;
2003
- /**
2004
- * When a `touchstart` event is fired, it's assumed the user is using touch
2005
- * input. We'll bind a `mousemove` event listener to listen for mouse input in
2006
- * the future. This way, the `isTouch` property is fully dynamic and will handle
2007
- * hybrid devices that use a mix of touch + mouse input.
2008
- */
2009
-
2010
- function onDocumentTouchStart() {
2011
- if (currentInput.isTouch) {
2012
- return;
2013
- }
2014
-
2015
- currentInput.isTouch = true;
2016
-
2017
- if (window.performance) {
2018
- document.addEventListener('mousemove', onDocumentMouseMove);
2019
- }
2020
- }
2021
- /**
2022
- * When two `mousemove` event are fired consecutively within 20ms, it's assumed
2023
- * the user is using mouse input again. `mousemove` can fire on touch devices as
2024
- * well, but very rarely that quickly.
2025
- */
2026
-
2027
- function onDocumentMouseMove() {
2028
- var now = performance.now();
2029
-
2030
- if (now - lastMouseMoveTime < 20) {
2031
- currentInput.isTouch = false;
2032
- document.removeEventListener('mousemove', onDocumentMouseMove);
2033
- }
2034
-
2035
- lastMouseMoveTime = now;
2036
- }
2037
- /**
2038
- * When an element is in focus and has a tippy, leaving the tab/window and
2039
- * returning causes it to show again. For mouse users this is unexpected, but
2040
- * for keyboard use it makes sense.
2041
- * TODO: find a better technique to solve this problem
2042
- */
2043
-
2044
- function onWindowBlur() {
2045
- var activeElement = document.activeElement;
2046
-
2047
- if (isReferenceElement(activeElement)) {
2048
- var instance = activeElement._tippy;
2049
-
2050
- if (activeElement.blur && !instance.state.isVisible) {
2051
- activeElement.blur();
2052
- }
2053
- }
2054
- }
2055
- function bindGlobalEventListeners() {
2056
- document.addEventListener('touchstart', onDocumentTouchStart, TOUCH_OPTIONS);
2057
- window.addEventListener('blur', onWindowBlur);
2058
- }
2059
-
2060
- var isBrowser$1 = typeof window !== 'undefined' && typeof document !== 'undefined';
2061
- var isIE11 = isBrowser$1 ? // @ts-ignore
2062
- !!window.msCrypto : false;
2063
-
2064
- var pluginProps = {
2065
- animateFill: false,
2066
- followCursor: false,
2067
- inlinePositioning: false,
2068
- sticky: false
2069
- };
2070
- var renderProps = {
2071
- allowHTML: false,
2072
- animation: 'fade',
2073
- arrow: true,
2074
- content: '',
2075
- inertia: false,
2076
- maxWidth: 350,
2077
- role: 'tooltip',
2078
- theme: '',
2079
- zIndex: 9999
2080
- };
2081
- var defaultProps = Object.assign({
2082
- appendTo: TIPPY_DEFAULT_APPEND_TO,
2083
- aria: {
2084
- content: 'auto',
2085
- expanded: 'auto'
2086
- },
2087
- delay: 0,
2088
- duration: [300, 250],
2089
- getReferenceClientRect: null,
2090
- hideOnClick: true,
2091
- ignoreAttributes: false,
2092
- interactive: false,
2093
- interactiveBorder: 2,
2094
- interactiveDebounce: 0,
2095
- moveTransition: '',
2096
- offset: [0, 10],
2097
- onAfterUpdate: function onAfterUpdate() {},
2098
- onBeforeUpdate: function onBeforeUpdate() {},
2099
- onCreate: function onCreate() {},
2100
- onDestroy: function onDestroy() {},
2101
- onHidden: function onHidden() {},
2102
- onHide: function onHide() {},
2103
- onMount: function onMount() {},
2104
- onShow: function onShow() {},
2105
- onShown: function onShown() {},
2106
- onTrigger: function onTrigger() {},
2107
- onUntrigger: function onUntrigger() {},
2108
- onClickOutside: function onClickOutside() {},
2109
- placement: 'top',
2110
- plugins: [],
2111
- popperOptions: {},
2112
- render: null,
2113
- showOnCreate: false,
2114
- touch: true,
2115
- trigger: 'mouseenter focus',
2116
- triggerTarget: null
2117
- }, pluginProps, renderProps);
2118
- var defaultKeys = Object.keys(defaultProps);
2119
- var setDefaultProps = function setDefaultProps(partialProps) {
2120
-
2121
- var keys = Object.keys(partialProps);
2122
- keys.forEach(function (key) {
2123
- defaultProps[key] = partialProps[key];
2124
- });
2125
- };
2126
- function getExtendedPassedProps(passedProps) {
2127
- var plugins = passedProps.plugins || [];
2128
- var pluginProps = plugins.reduce(function (acc, plugin) {
2129
- var name = plugin.name,
2130
- defaultValue = plugin.defaultValue;
2131
-
2132
- if (name) {
2133
- var _name;
2134
-
2135
- acc[name] = passedProps[name] !== undefined ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
2136
- }
2137
-
2138
- return acc;
2139
- }, {});
2140
- return Object.assign({}, passedProps, pluginProps);
2141
- }
2142
- function getDataAttributeProps(reference, plugins) {
2143
- var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
2144
- plugins: plugins
2145
- }))) : defaultKeys;
2146
- var props = propKeys.reduce(function (acc, key) {
2147
- var valueAsString = (reference.getAttribute("data-tippy-" + key) || '').trim();
2148
-
2149
- if (!valueAsString) {
2150
- return acc;
2151
- }
2152
-
2153
- if (key === 'content') {
2154
- acc[key] = valueAsString;
2155
- } else {
2156
- try {
2157
- acc[key] = JSON.parse(valueAsString);
2158
- } catch (e) {
2159
- acc[key] = valueAsString;
2160
- }
2161
- }
2162
-
2163
- return acc;
2164
- }, {});
2165
- return props;
2166
- }
2167
- function evaluateProps(reference, props) {
2168
- var out = Object.assign({}, props, {
2169
- content: invokeWithArgsOrReturn(props.content, [reference])
2170
- }, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
2171
- out.aria = Object.assign({}, defaultProps.aria, out.aria);
2172
- out.aria = {
2173
- expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
2174
- content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
2175
- };
2176
- return out;
2177
- }
2178
-
2179
- var innerHTML = function innerHTML() {
2180
- return 'innerHTML';
2181
- };
2182
-
2183
- function dangerouslySetInnerHTML(element, html) {
2184
- element[innerHTML()] = html;
2185
- }
2186
-
2187
- function createArrowElement(value) {
2188
- var arrow = div();
2189
-
2190
- if (value === true) {
2191
- arrow.className = ARROW_CLASS;
2192
- } else {
2193
- arrow.className = SVG_ARROW_CLASS;
2194
-
2195
- if (isElement(value)) {
2196
- arrow.appendChild(value);
2197
- } else {
2198
- dangerouslySetInnerHTML(arrow, value);
2199
- }
2200
- }
2201
-
2202
- return arrow;
2203
- }
2204
-
2205
- function setContent(content, props) {
2206
- if (isElement(props.content)) {
2207
- dangerouslySetInnerHTML(content, '');
2208
- content.appendChild(props.content);
2209
- } else if (typeof props.content !== 'function') {
2210
- if (props.allowHTML) {
2211
- dangerouslySetInnerHTML(content, props.content);
2212
- } else {
2213
- content.textContent = props.content;
2214
- }
2215
- }
2216
- }
2217
- function getChildren(popper) {
2218
- var box = popper.firstElementChild;
2219
- var boxChildren = arrayFrom(box.children);
2220
- return {
2221
- box: box,
2222
- content: boxChildren.find(function (node) {
2223
- return node.classList.contains(CONTENT_CLASS);
2224
- }),
2225
- arrow: boxChildren.find(function (node) {
2226
- return node.classList.contains(ARROW_CLASS) || node.classList.contains(SVG_ARROW_CLASS);
2227
- }),
2228
- backdrop: boxChildren.find(function (node) {
2229
- return node.classList.contains(BACKDROP_CLASS);
2230
- })
2231
- };
2232
- }
2233
- function render(instance) {
2234
- var popper = div();
2235
- var box = div();
2236
- box.className = BOX_CLASS;
2237
- box.setAttribute('data-state', 'hidden');
2238
- box.setAttribute('tabindex', '-1');
2239
- var content = div();
2240
- content.className = CONTENT_CLASS;
2241
- content.setAttribute('data-state', 'hidden');
2242
- setContent(content, instance.props);
2243
- popper.appendChild(box);
2244
- box.appendChild(content);
2245
- onUpdate(instance.props, instance.props);
2246
-
2247
- function onUpdate(prevProps, nextProps) {
2248
- var _getChildren = getChildren(popper),
2249
- box = _getChildren.box,
2250
- content = _getChildren.content,
2251
- arrow = _getChildren.arrow;
2252
-
2253
- if (nextProps.theme) {
2254
- box.setAttribute('data-theme', nextProps.theme);
2255
- } else {
2256
- box.removeAttribute('data-theme');
2257
- }
2258
-
2259
- if (typeof nextProps.animation === 'string') {
2260
- box.setAttribute('data-animation', nextProps.animation);
2261
- } else {
2262
- box.removeAttribute('data-animation');
2263
- }
2264
-
2265
- if (nextProps.inertia) {
2266
- box.setAttribute('data-inertia', '');
2267
- } else {
2268
- box.removeAttribute('data-inertia');
2269
- }
2270
-
2271
- box.style.maxWidth = typeof nextProps.maxWidth === 'number' ? nextProps.maxWidth + "px" : nextProps.maxWidth;
2272
-
2273
- if (nextProps.role) {
2274
- box.setAttribute('role', nextProps.role);
2275
- } else {
2276
- box.removeAttribute('role');
2277
- }
2278
-
2279
- if (prevProps.content !== nextProps.content || prevProps.allowHTML !== nextProps.allowHTML) {
2280
- setContent(content, instance.props);
2281
- }
2282
-
2283
- if (nextProps.arrow) {
2284
- if (!arrow) {
2285
- box.appendChild(createArrowElement(nextProps.arrow));
2286
- } else if (prevProps.arrow !== nextProps.arrow) {
2287
- box.removeChild(arrow);
2288
- box.appendChild(createArrowElement(nextProps.arrow));
2289
- }
2290
- } else if (arrow) {
2291
- box.removeChild(arrow);
2292
- }
2293
- }
2294
-
2295
- return {
2296
- popper: popper,
2297
- onUpdate: onUpdate
2298
- };
2299
- } // Runtime check to identify if the render function is the default one; this
2300
- // way we can apply default CSS transitions logic and it can be tree-shaken away
2301
-
2302
- render.$$tippy = true;
2303
-
2304
- var idCounter = 1;
2305
- var mouseMoveListeners = []; // Used by `hideAll()`
2306
-
2307
- var mountedInstances = [];
2308
- function createTippy(reference, passedProps) {
2309
- var props = evaluateProps(reference, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
2310
- // 🔒 Private members
2311
- // ===========================================================================
2312
-
2313
- var showTimeout;
2314
- var hideTimeout;
2315
- var scheduleHideAnimationFrame;
2316
- var isVisibleFromClick = false;
2317
- var didHideDueToDocumentMouseDown = false;
2318
- var didTouchMove = false;
2319
- var ignoreOnFirstUpdate = false;
2320
- var lastTriggerEvent;
2321
- var currentTransitionEndListener;
2322
- var onFirstUpdate;
2323
- var listeners = [];
2324
- var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
2325
- var currentTarget; // ===========================================================================
2326
- // 🔑 Public members
2327
- // ===========================================================================
2328
-
2329
- var id = idCounter++;
2330
- var popperInstance = null;
2331
- var plugins = unique(props.plugins);
2332
- var state = {
2333
- // Is the instance currently enabled?
2334
- isEnabled: true,
2335
- // Is the tippy currently showing and not transitioning out?
2336
- isVisible: false,
2337
- // Has the instance been destroyed?
2338
- isDestroyed: false,
2339
- // Is the tippy currently mounted to the DOM?
2340
- isMounted: false,
2341
- // Has the tippy finished transitioning in?
2342
- isShown: false
2343
- };
2344
- var instance = {
2345
- // properties
2346
- id: id,
2347
- reference: reference,
2348
- popper: div(),
2349
- popperInstance: popperInstance,
2350
- props: props,
2351
- state: state,
2352
- plugins: plugins,
2353
- // methods
2354
- clearDelayTimeouts: clearDelayTimeouts,
2355
- setProps: setProps,
2356
- setContent: setContent,
2357
- show: show,
2358
- hide: hide,
2359
- hideWithInteractivity: hideWithInteractivity,
2360
- enable: enable,
2361
- disable: disable,
2362
- unmount: unmount,
2363
- destroy: destroy
2364
- }; // TODO: Investigate why this early return causes a TDZ error in the tests —
2365
- // it doesn't seem to happen in the browser
2366
-
2367
- /* istanbul ignore if */
2368
-
2369
- if (!props.render) {
2370
-
2371
- return instance;
2372
- } // ===========================================================================
2373
- // Initial mutations
2374
- // ===========================================================================
2375
-
2376
-
2377
- var _props$render = props.render(instance),
2378
- popper = _props$render.popper,
2379
- onUpdate = _props$render.onUpdate;
2380
-
2381
- popper.setAttribute('data-tippy-root', '');
2382
- popper.id = "tippy-" + instance.id;
2383
- instance.popper = popper;
2384
- reference._tippy = instance;
2385
- popper._tippy = instance;
2386
- var pluginsHooks = plugins.map(function (plugin) {
2387
- return plugin.fn(instance);
2388
- });
2389
- var hasAriaExpanded = reference.hasAttribute('aria-expanded');
2390
- addListeners();
2391
- handleAriaExpandedAttribute();
2392
- handleStyles();
2393
- invokeHook('onCreate', [instance]);
2394
-
2395
- if (props.showOnCreate) {
2396
- scheduleShow();
2397
- } // Prevent a tippy with a delay from hiding if the cursor left then returned
2398
- // before it started hiding
2399
-
2400
-
2401
- popper.addEventListener('mouseenter', function () {
2402
- if (instance.props.interactive && instance.state.isVisible) {
2403
- instance.clearDelayTimeouts();
2404
- }
2405
- });
2406
- popper.addEventListener('mouseleave', function () {
2407
- if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
2408
- getDocument().addEventListener('mousemove', debouncedOnMouseMove);
2409
- }
2410
- });
2411
- return instance; // ===========================================================================
2412
- // 🔒 Private methods
2413
- // ===========================================================================
2414
-
2415
- function getNormalizedTouchSettings() {
2416
- var touch = instance.props.touch;
2417
- return Array.isArray(touch) ? touch : [touch, 0];
2418
- }
2419
-
2420
- function getIsCustomTouchBehavior() {
2421
- return getNormalizedTouchSettings()[0] === 'hold';
2422
- }
2423
-
2424
- function getIsDefaultRenderFn() {
2425
- var _instance$props$rende;
2426
-
2427
- // @ts-ignore
2428
- return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
2429
- }
2430
-
2431
- function getCurrentTarget() {
2432
- return currentTarget || reference;
2433
- }
2434
-
2435
- function getDocument() {
2436
- var parent = getCurrentTarget().parentNode;
2437
- return parent ? getOwnerDocument(parent) : document;
2438
- }
2439
-
2440
- function getDefaultTemplateChildren() {
2441
- return getChildren(popper);
2442
- }
2443
-
2444
- function getDelay(isShow) {
2445
- // For touch or keyboard input, force `0` delay for UX reasons
2446
- // Also if the instance is mounted but not visible (transitioning out),
2447
- // ignore delay
2448
- if (instance.state.isMounted && !instance.state.isVisible || currentInput.isTouch || lastTriggerEvent && lastTriggerEvent.type === 'focus') {
2449
- return 0;
2450
- }
2451
-
2452
- return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
2453
- }
2454
-
2455
- function handleStyles(fromHide) {
2456
- if (fromHide === void 0) {
2457
- fromHide = false;
2458
- }
2459
-
2460
- popper.style.pointerEvents = instance.props.interactive && !fromHide ? '' : 'none';
2461
- popper.style.zIndex = "" + instance.props.zIndex;
2462
- }
2463
-
2464
- function invokeHook(hook, args, shouldInvokePropsHook) {
2465
- if (shouldInvokePropsHook === void 0) {
2466
- shouldInvokePropsHook = true;
2467
- }
2468
-
2469
- pluginsHooks.forEach(function (pluginHooks) {
2470
- if (pluginHooks[hook]) {
2471
- pluginHooks[hook].apply(pluginHooks, args);
2472
- }
2473
- });
2474
-
2475
- if (shouldInvokePropsHook) {
2476
- var _instance$props;
2477
-
2478
- (_instance$props = instance.props)[hook].apply(_instance$props, args);
2479
- }
2480
- }
2481
-
2482
- function handleAriaContentAttribute() {
2483
- var aria = instance.props.aria;
2484
-
2485
- if (!aria.content) {
2486
- return;
2487
- }
2488
-
2489
- var attr = "aria-" + aria.content;
2490
- var id = popper.id;
2491
- var nodes = normalizeToArray(instance.props.triggerTarget || reference);
2492
- nodes.forEach(function (node) {
2493
- var currentValue = node.getAttribute(attr);
2494
-
2495
- if (instance.state.isVisible) {
2496
- node.setAttribute(attr, currentValue ? currentValue + " " + id : id);
2497
- } else {
2498
- var nextValue = currentValue && currentValue.replace(id, '').trim();
2499
-
2500
- if (nextValue) {
2501
- node.setAttribute(attr, nextValue);
2502
- } else {
2503
- node.removeAttribute(attr);
2504
- }
2505
- }
2506
- });
2507
- }
2508
-
2509
- function handleAriaExpandedAttribute() {
2510
- if (hasAriaExpanded || !instance.props.aria.expanded) {
2511
- return;
2512
- }
2513
-
2514
- var nodes = normalizeToArray(instance.props.triggerTarget || reference);
2515
- nodes.forEach(function (node) {
2516
- if (instance.props.interactive) {
2517
- node.setAttribute('aria-expanded', instance.state.isVisible && node === getCurrentTarget() ? 'true' : 'false');
2518
- } else {
2519
- node.removeAttribute('aria-expanded');
2520
- }
2521
- });
2522
- }
2523
-
2524
- function cleanupInteractiveMouseListeners() {
2525
- getDocument().removeEventListener('mousemove', debouncedOnMouseMove);
2526
- mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
2527
- return listener !== debouncedOnMouseMove;
2528
- });
2529
- }
2530
-
2531
- function onDocumentPress(event) {
2532
- // Moved finger to scroll instead of an intentional tap outside
2533
- if (currentInput.isTouch) {
2534
- if (didTouchMove || event.type === 'mousedown') {
2535
- return;
2536
- }
2537
- }
2538
-
2539
- var actualTarget = event.composedPath && event.composedPath()[0] || event.target; // Clicked on interactive popper
2540
-
2541
- if (instance.props.interactive && actualContains(popper, actualTarget)) {
2542
- return;
2543
- } // Clicked on the event listeners target
2544
-
2545
-
2546
- if (normalizeToArray(instance.props.triggerTarget || reference).some(function (el) {
2547
- return actualContains(el, actualTarget);
2548
- })) {
2549
- if (currentInput.isTouch) {
2550
- return;
2551
- }
2552
-
2553
- if (instance.state.isVisible && instance.props.trigger.indexOf('click') >= 0) {
2554
- return;
2555
- }
2556
- } else {
2557
- invokeHook('onClickOutside', [instance, event]);
2558
- }
2559
-
2560
- if (instance.props.hideOnClick === true) {
2561
- instance.clearDelayTimeouts();
2562
- instance.hide(); // `mousedown` event is fired right before `focus` if pressing the
2563
- // currentTarget. This lets a tippy with `focus` trigger know that it
2564
- // should not show
2565
-
2566
- didHideDueToDocumentMouseDown = true;
2567
- setTimeout(function () {
2568
- didHideDueToDocumentMouseDown = false;
2569
- }); // The listener gets added in `scheduleShow()`, but this may be hiding it
2570
- // before it shows, and hide()'s early bail-out behavior can prevent it
2571
- // from being cleaned up
2572
-
2573
- if (!instance.state.isMounted) {
2574
- removeDocumentPress();
2575
- }
2576
- }
2577
- }
2578
-
2579
- function onTouchMove() {
2580
- didTouchMove = true;
2581
- }
2582
-
2583
- function onTouchStart() {
2584
- didTouchMove = false;
2585
- }
2586
-
2587
- function addDocumentPress() {
2588
- var doc = getDocument();
2589
- doc.addEventListener('mousedown', onDocumentPress, true);
2590
- doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
2591
- doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
2592
- doc.addEventListener('touchmove', onTouchMove, TOUCH_OPTIONS);
2593
- }
2594
-
2595
- function removeDocumentPress() {
2596
- var doc = getDocument();
2597
- doc.removeEventListener('mousedown', onDocumentPress, true);
2598
- doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
2599
- doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
2600
- doc.removeEventListener('touchmove', onTouchMove, TOUCH_OPTIONS);
2601
- }
2602
-
2603
- function onTransitionedOut(duration, callback) {
2604
- onTransitionEnd(duration, function () {
2605
- if (!instance.state.isVisible && popper.parentNode && popper.parentNode.contains(popper)) {
2606
- callback();
2607
- }
2608
- });
2609
- }
2610
-
2611
- function onTransitionedIn(duration, callback) {
2612
- onTransitionEnd(duration, callback);
2613
- }
2614
-
2615
- function onTransitionEnd(duration, callback) {
2616
- var box = getDefaultTemplateChildren().box;
2617
-
2618
- function listener(event) {
2619
- if (event.target === box) {
2620
- updateTransitionEndListener(box, 'remove', listener);
2621
- callback();
2622
- }
2623
- } // Make callback synchronous if duration is 0
2624
- // `transitionend` won't fire otherwise
2625
-
2626
-
2627
- if (duration === 0) {
2628
- return callback();
2629
- }
2630
-
2631
- updateTransitionEndListener(box, 'remove', currentTransitionEndListener);
2632
- updateTransitionEndListener(box, 'add', listener);
2633
- currentTransitionEndListener = listener;
2634
- }
2635
-
2636
- function on(eventType, handler, options) {
2637
- if (options === void 0) {
2638
- options = false;
2639
- }
2640
-
2641
- var nodes = normalizeToArray(instance.props.triggerTarget || reference);
2642
- nodes.forEach(function (node) {
2643
- node.addEventListener(eventType, handler, options);
2644
- listeners.push({
2645
- node: node,
2646
- eventType: eventType,
2647
- handler: handler,
2648
- options: options
2649
- });
2650
- });
2651
- }
2652
-
2653
- function addListeners() {
2654
- if (getIsCustomTouchBehavior()) {
2655
- on('touchstart', onTrigger, {
2656
- passive: true
2657
- });
2658
- on('touchend', onMouseLeave, {
2659
- passive: true
2660
- });
2661
- }
2662
-
2663
- splitBySpaces(instance.props.trigger).forEach(function (eventType) {
2664
- if (eventType === 'manual') {
2665
- return;
2666
- }
2667
-
2668
- on(eventType, onTrigger);
2669
-
2670
- switch (eventType) {
2671
- case 'mouseenter':
2672
- on('mouseleave', onMouseLeave);
2673
- break;
2674
-
2675
- case 'focus':
2676
- on(isIE11 ? 'focusout' : 'blur', onBlurOrFocusOut);
2677
- break;
2678
-
2679
- case 'focusin':
2680
- on('focusout', onBlurOrFocusOut);
2681
- break;
2682
- }
2683
- });
2684
- }
2685
-
2686
- function removeListeners() {
2687
- listeners.forEach(function (_ref) {
2688
- var node = _ref.node,
2689
- eventType = _ref.eventType,
2690
- handler = _ref.handler,
2691
- options = _ref.options;
2692
- node.removeEventListener(eventType, handler, options);
2693
- });
2694
- listeners = [];
2695
- }
2696
-
2697
- function onTrigger(event) {
2698
- var _lastTriggerEvent;
2699
-
2700
- var shouldScheduleClickHide = false;
2701
-
2702
- if (!instance.state.isEnabled || isEventListenerStopped(event) || didHideDueToDocumentMouseDown) {
2703
- return;
2704
- }
2705
-
2706
- var wasFocused = ((_lastTriggerEvent = lastTriggerEvent) == null ? void 0 : _lastTriggerEvent.type) === 'focus';
2707
- lastTriggerEvent = event;
2708
- currentTarget = event.currentTarget;
2709
- handleAriaExpandedAttribute();
2710
-
2711
- if (!instance.state.isVisible && isMouseEvent(event)) {
2712
- // If scrolling, `mouseenter` events can be fired if the cursor lands
2713
- // over a new target, but `mousemove` events don't get fired. This
2714
- // causes interactive tooltips to get stuck open until the cursor is
2715
- // moved
2716
- mouseMoveListeners.forEach(function (listener) {
2717
- return listener(event);
2718
- });
2719
- } // Toggle show/hide when clicking click-triggered tooltips
2720
-
2721
-
2722
- if (event.type === 'click' && (instance.props.trigger.indexOf('mouseenter') < 0 || isVisibleFromClick) && instance.props.hideOnClick !== false && instance.state.isVisible) {
2723
- shouldScheduleClickHide = true;
2724
- } else {
2725
- scheduleShow(event);
2726
- }
2727
-
2728
- if (event.type === 'click') {
2729
- isVisibleFromClick = !shouldScheduleClickHide;
2730
- }
2731
-
2732
- if (shouldScheduleClickHide && !wasFocused) {
2733
- scheduleHide(event);
2734
- }
2735
- }
2736
-
2737
- function onMouseMove(event) {
2738
- var target = event.target;
2739
- var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper.contains(target);
2740
-
2741
- if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) {
2742
- return;
2743
- }
2744
-
2745
- var popperTreeData = getNestedPopperTree().concat(popper).map(function (popper) {
2746
- var _instance$popperInsta;
2747
-
2748
- var instance = popper._tippy;
2749
- var state = (_instance$popperInsta = instance.popperInstance) == null ? void 0 : _instance$popperInsta.state;
2750
-
2751
- if (state) {
2752
- return {
2753
- popperRect: popper.getBoundingClientRect(),
2754
- popperState: state,
2755
- props: props
2756
- };
2757
- }
2758
-
2759
- return null;
2760
- }).filter(Boolean);
2761
-
2762
- if (isCursorOutsideInteractiveBorder(popperTreeData, event)) {
2763
- cleanupInteractiveMouseListeners();
2764
- scheduleHide(event);
2765
- }
2766
- }
2767
-
2768
- function onMouseLeave(event) {
2769
- var shouldBail = isEventListenerStopped(event) || instance.props.trigger.indexOf('click') >= 0 && isVisibleFromClick;
2770
-
2771
- if (shouldBail) {
2772
- return;
2773
- }
2774
-
2775
- if (instance.props.interactive) {
2776
- instance.hideWithInteractivity(event);
2777
- return;
2778
- }
2779
-
2780
- scheduleHide(event);
2781
- }
2782
-
2783
- function onBlurOrFocusOut(event) {
2784
- if (instance.props.trigger.indexOf('focusin') < 0 && event.target !== getCurrentTarget()) {
2785
- return;
2786
- } // If focus was moved to within the popper
2787
-
2788
-
2789
- if (instance.props.interactive && event.relatedTarget && popper.contains(event.relatedTarget)) {
2790
- return;
2791
- }
2792
-
2793
- scheduleHide(event);
2794
- }
2795
-
2796
- function isEventListenerStopped(event) {
2797
- return currentInput.isTouch ? getIsCustomTouchBehavior() !== event.type.indexOf('touch') >= 0 : false;
2798
- }
2799
-
2800
- function createPopperInstance() {
2801
- destroyPopperInstance();
2802
- var _instance$props2 = instance.props,
2803
- popperOptions = _instance$props2.popperOptions,
2804
- placement = _instance$props2.placement,
2805
- offset = _instance$props2.offset,
2806
- getReferenceClientRect = _instance$props2.getReferenceClientRect,
2807
- moveTransition = _instance$props2.moveTransition;
2808
- var arrow = getIsDefaultRenderFn() ? getChildren(popper).arrow : null;
2809
- var computedReference = getReferenceClientRect ? {
2810
- getBoundingClientRect: getReferenceClientRect,
2811
- contextElement: getReferenceClientRect.contextElement || getCurrentTarget()
2812
- } : reference;
2813
- var tippyModifier = {
2814
- name: '$$tippy',
2815
- enabled: true,
2816
- phase: 'beforeWrite',
2817
- requires: ['computeStyles'],
2818
- fn: function fn(_ref2) {
2819
- var state = _ref2.state;
2820
-
2821
- if (getIsDefaultRenderFn()) {
2822
- var _getDefaultTemplateCh = getDefaultTemplateChildren(),
2823
- box = _getDefaultTemplateCh.box;
2824
-
2825
- ['placement', 'reference-hidden', 'escaped'].forEach(function (attr) {
2826
- if (attr === 'placement') {
2827
- box.setAttribute('data-placement', state.placement);
2828
- } else {
2829
- if (state.attributes.popper["data-popper-" + attr]) {
2830
- box.setAttribute("data-" + attr, '');
2831
- } else {
2832
- box.removeAttribute("data-" + attr);
2833
- }
2834
- }
2835
- });
2836
- state.attributes.popper = {};
2837
- }
2838
- }
2839
- };
2840
- var modifiers = [{
2841
- name: 'offset',
2842
- options: {
2843
- offset: offset
2844
- }
2845
- }, {
2846
- name: 'preventOverflow',
2847
- options: {
2848
- padding: {
2849
- top: 2,
2850
- bottom: 2,
2851
- left: 5,
2852
- right: 5
2853
- }
2854
- }
2855
- }, {
2856
- name: 'flip',
2857
- options: {
2858
- padding: 5
2859
- }
2860
- }, {
2861
- name: 'computeStyles',
2862
- options: {
2863
- adaptive: !moveTransition
2864
- }
2865
- }, tippyModifier];
2866
-
2867
- if (getIsDefaultRenderFn() && arrow) {
2868
- modifiers.push({
2869
- name: 'arrow',
2870
- options: {
2871
- element: arrow,
2872
- padding: 3
2873
- }
2874
- });
2875
- }
2876
-
2877
- modifiers.push.apply(modifiers, (popperOptions == null ? void 0 : popperOptions.modifiers) || []);
2878
- instance.popperInstance = createPopper(computedReference, popper, Object.assign({}, popperOptions, {
2879
- placement: placement,
2880
- onFirstUpdate: onFirstUpdate,
2881
- modifiers: modifiers
2882
- }));
2883
- }
2884
-
2885
- function destroyPopperInstance() {
2886
- if (instance.popperInstance) {
2887
- instance.popperInstance.destroy();
2888
- instance.popperInstance = null;
2889
- }
2890
- }
2891
-
2892
- function mount() {
2893
- var appendTo = instance.props.appendTo;
2894
- var parentNode; // By default, we'll append the popper to the triggerTargets's parentNode so
2895
- // it's directly after the reference element so the elements inside the
2896
- // tippy can be tabbed to
2897
- // If there are clipping issues, the user can specify a different appendTo
2898
- // and ensure focus management is handled correctly manually
2899
-
2900
- var node = getCurrentTarget();
2901
-
2902
- if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === 'parent') {
2903
- parentNode = node.parentNode;
2904
- } else {
2905
- parentNode = invokeWithArgsOrReturn(appendTo, [node]);
2906
- } // The popper element needs to exist on the DOM before its position can be
2907
- // updated as Popper needs to read its dimensions
2908
-
2909
-
2910
- if (!parentNode.contains(popper)) {
2911
- parentNode.appendChild(popper);
2912
- }
2913
-
2914
- instance.state.isMounted = true;
2915
- createPopperInstance();
2916
- }
2917
-
2918
- function getNestedPopperTree() {
2919
- return arrayFrom(popper.querySelectorAll('[data-tippy-root]'));
2920
- }
2921
-
2922
- function scheduleShow(event) {
2923
- instance.clearDelayTimeouts();
2924
-
2925
- if (event) {
2926
- invokeHook('onTrigger', [instance, event]);
2927
- }
2928
-
2929
- addDocumentPress();
2930
- var delay = getDelay(true);
2931
-
2932
- var _getNormalizedTouchSe = getNormalizedTouchSettings(),
2933
- touchValue = _getNormalizedTouchSe[0],
2934
- touchDelay = _getNormalizedTouchSe[1];
2935
-
2936
- if (currentInput.isTouch && touchValue === 'hold' && touchDelay) {
2937
- delay = touchDelay;
2938
- }
2939
-
2940
- if (delay) {
2941
- showTimeout = setTimeout(function () {
2942
- instance.show();
2943
- }, delay);
2944
- } else {
2945
- instance.show();
2946
- }
2947
- }
2948
-
2949
- function scheduleHide(event) {
2950
- instance.clearDelayTimeouts();
2951
- invokeHook('onUntrigger', [instance, event]);
2952
-
2953
- if (!instance.state.isVisible) {
2954
- removeDocumentPress();
2955
- return;
2956
- } // For interactive tippies, scheduleHide is added to a document.body handler
2957
- // from onMouseLeave so must intercept scheduled hides from mousemove/leave
2958
- // events when trigger contains mouseenter and click, and the tip is
2959
- // currently shown as a result of a click.
2960
-
2961
-
2962
- if (instance.props.trigger.indexOf('mouseenter') >= 0 && instance.props.trigger.indexOf('click') >= 0 && ['mouseleave', 'mousemove'].indexOf(event.type) >= 0 && isVisibleFromClick) {
2963
- return;
2964
- }
2965
-
2966
- var delay = getDelay(false);
2967
-
2968
- if (delay) {
2969
- hideTimeout = setTimeout(function () {
2970
- if (instance.state.isVisible) {
2971
- instance.hide();
2972
- }
2973
- }, delay);
2974
- } else {
2975
- // Fixes a `transitionend` problem when it fires 1 frame too
2976
- // late sometimes, we don't want hide() to be called.
2977
- scheduleHideAnimationFrame = requestAnimationFrame(function () {
2978
- instance.hide();
2979
- });
2980
- }
2981
- } // ===========================================================================
2982
- // 🔑 Public methods
2983
- // ===========================================================================
2984
-
2985
-
2986
- function enable() {
2987
- instance.state.isEnabled = true;
2988
- }
2989
-
2990
- function disable() {
2991
- // Disabling the instance should also hide it
2992
- // https://github.com/atomiks/tippy.js-react/issues/106
2993
- instance.hide();
2994
- instance.state.isEnabled = false;
2995
- }
2996
-
2997
- function clearDelayTimeouts() {
2998
- clearTimeout(showTimeout);
2999
- clearTimeout(hideTimeout);
3000
- cancelAnimationFrame(scheduleHideAnimationFrame);
3001
- }
3002
-
3003
- function setProps(partialProps) {
3004
-
3005
- if (instance.state.isDestroyed) {
3006
- return;
3007
- }
3008
-
3009
- invokeHook('onBeforeUpdate', [instance, partialProps]);
3010
- removeListeners();
3011
- var prevProps = instance.props;
3012
- var nextProps = evaluateProps(reference, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
3013
- ignoreAttributes: true
3014
- }));
3015
- instance.props = nextProps;
3016
- addListeners();
3017
-
3018
- if (prevProps.interactiveDebounce !== nextProps.interactiveDebounce) {
3019
- cleanupInteractiveMouseListeners();
3020
- debouncedOnMouseMove = debounce(onMouseMove, nextProps.interactiveDebounce);
3021
- } // Ensure stale aria-expanded attributes are removed
3022
-
3023
-
3024
- if (prevProps.triggerTarget && !nextProps.triggerTarget) {
3025
- normalizeToArray(prevProps.triggerTarget).forEach(function (node) {
3026
- node.removeAttribute('aria-expanded');
3027
- });
3028
- } else if (nextProps.triggerTarget) {
3029
- reference.removeAttribute('aria-expanded');
3030
- }
3031
-
3032
- handleAriaExpandedAttribute();
3033
- handleStyles();
3034
-
3035
- if (onUpdate) {
3036
- onUpdate(prevProps, nextProps);
3037
- }
3038
-
3039
- if (instance.popperInstance) {
3040
- createPopperInstance(); // Fixes an issue with nested tippies if they are all getting re-rendered,
3041
- // and the nested ones get re-rendered first.
3042
- // https://github.com/atomiks/tippyjs-react/issues/177
3043
- // TODO: find a cleaner / more efficient solution(!)
3044
-
3045
- getNestedPopperTree().forEach(function (nestedPopper) {
3046
- // React (and other UI libs likely) requires a rAF wrapper as it flushes
3047
- // its work in one
3048
- requestAnimationFrame(nestedPopper._tippy.popperInstance.forceUpdate);
3049
- });
3050
- }
3051
-
3052
- invokeHook('onAfterUpdate', [instance, partialProps]);
3053
- }
3054
-
3055
- function setContent(content) {
3056
- instance.setProps({
3057
- content: content
3058
- });
3059
- }
3060
-
3061
- function show() {
3062
-
3063
-
3064
- var isAlreadyVisible = instance.state.isVisible;
3065
- var isDestroyed = instance.state.isDestroyed;
3066
- var isDisabled = !instance.state.isEnabled;
3067
- var isTouchAndTouchDisabled = currentInput.isTouch && !instance.props.touch;
3068
- var duration = getValueAtIndexOrReturn(instance.props.duration, 0, defaultProps.duration);
3069
-
3070
- if (isAlreadyVisible || isDestroyed || isDisabled || isTouchAndTouchDisabled) {
3071
- return;
3072
- } // Normalize `disabled` behavior across browsers.
3073
- // Firefox allows events on disabled elements, but Chrome doesn't.
3074
- // Using a wrapper element (i.e. <span>) is recommended.
3075
-
3076
-
3077
- if (getCurrentTarget().hasAttribute('disabled')) {
3078
- return;
3079
- }
3080
-
3081
- invokeHook('onShow', [instance], false);
3082
-
3083
- if (instance.props.onShow(instance) === false) {
3084
- return;
3085
- }
3086
-
3087
- instance.state.isVisible = true;
3088
-
3089
- if (getIsDefaultRenderFn()) {
3090
- popper.style.visibility = 'visible';
3091
- }
3092
-
3093
- handleStyles();
3094
- addDocumentPress();
3095
-
3096
- if (!instance.state.isMounted) {
3097
- popper.style.transition = 'none';
3098
- } // If flipping to the opposite side after hiding at least once, the
3099
- // animation will use the wrong placement without resetting the duration
3100
-
3101
-
3102
- if (getIsDefaultRenderFn()) {
3103
- var _getDefaultTemplateCh2 = getDefaultTemplateChildren(),
3104
- box = _getDefaultTemplateCh2.box,
3105
- content = _getDefaultTemplateCh2.content;
3106
-
3107
- setTransitionDuration([box, content], 0);
3108
- }
3109
-
3110
- onFirstUpdate = function onFirstUpdate() {
3111
- var _instance$popperInsta2;
3112
-
3113
- if (!instance.state.isVisible || ignoreOnFirstUpdate) {
3114
- return;
3115
- }
3116
-
3117
- ignoreOnFirstUpdate = true; // reflow
3118
-
3119
- void popper.offsetHeight;
3120
- popper.style.transition = instance.props.moveTransition;
3121
-
3122
- if (getIsDefaultRenderFn() && instance.props.animation) {
3123
- var _getDefaultTemplateCh3 = getDefaultTemplateChildren(),
3124
- _box = _getDefaultTemplateCh3.box,
3125
- _content = _getDefaultTemplateCh3.content;
3126
-
3127
- setTransitionDuration([_box, _content], duration);
3128
- setVisibilityState([_box, _content], 'visible');
3129
- }
3130
-
3131
- handleAriaContentAttribute();
3132
- handleAriaExpandedAttribute();
3133
- pushIfUnique(mountedInstances, instance); // certain modifiers (e.g. `maxSize`) require a second update after the
3134
- // popper has been positioned for the first time
3135
-
3136
- (_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
3137
- invokeHook('onMount', [instance]);
3138
-
3139
- if (instance.props.animation && getIsDefaultRenderFn()) {
3140
- onTransitionedIn(duration, function () {
3141
- instance.state.isShown = true;
3142
- invokeHook('onShown', [instance]);
3143
- });
3144
- }
3145
- };
3146
-
3147
- mount();
3148
- }
3149
-
3150
- function hide() {
3151
-
3152
-
3153
- var isAlreadyHidden = !instance.state.isVisible;
3154
- var isDestroyed = instance.state.isDestroyed;
3155
- var isDisabled = !instance.state.isEnabled;
3156
- var duration = getValueAtIndexOrReturn(instance.props.duration, 1, defaultProps.duration);
3157
-
3158
- if (isAlreadyHidden || isDestroyed || isDisabled) {
3159
- return;
3160
- }
3161
-
3162
- invokeHook('onHide', [instance], false);
3163
-
3164
- if (instance.props.onHide(instance) === false) {
3165
- return;
3166
- }
3167
-
3168
- instance.state.isVisible = false;
3169
- instance.state.isShown = false;
3170
- ignoreOnFirstUpdate = false;
3171
- isVisibleFromClick = false;
3172
-
3173
- if (getIsDefaultRenderFn()) {
3174
- popper.style.visibility = 'hidden';
3175
- }
3176
-
3177
- cleanupInteractiveMouseListeners();
3178
- removeDocumentPress();
3179
- handleStyles(true);
3180
-
3181
- if (getIsDefaultRenderFn()) {
3182
- var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
3183
- box = _getDefaultTemplateCh4.box,
3184
- content = _getDefaultTemplateCh4.content;
3185
-
3186
- if (instance.props.animation) {
3187
- setTransitionDuration([box, content], duration);
3188
- setVisibilityState([box, content], 'hidden');
3189
- }
3190
- }
3191
-
3192
- handleAriaContentAttribute();
3193
- handleAriaExpandedAttribute();
3194
-
3195
- if (instance.props.animation) {
3196
- if (getIsDefaultRenderFn()) {
3197
- onTransitionedOut(duration, instance.unmount);
3198
- }
3199
- } else {
3200
- instance.unmount();
3201
- }
3202
- }
3203
-
3204
- function hideWithInteractivity(event) {
3205
-
3206
- getDocument().addEventListener('mousemove', debouncedOnMouseMove);
3207
- pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
3208
- debouncedOnMouseMove(event);
3209
- }
3210
-
3211
- function unmount() {
3212
-
3213
- if (instance.state.isVisible) {
3214
- instance.hide();
3215
- }
3216
-
3217
- if (!instance.state.isMounted) {
3218
- return;
3219
- }
3220
-
3221
- destroyPopperInstance(); // If a popper is not interactive, it will be appended outside the popper
3222
- // tree by default. This seems mainly for interactive tippies, but we should
3223
- // find a workaround if possible
3224
-
3225
- getNestedPopperTree().forEach(function (nestedPopper) {
3226
- nestedPopper._tippy.unmount();
3227
- });
3228
-
3229
- if (popper.parentNode) {
3230
- popper.parentNode.removeChild(popper);
3231
- }
3232
-
3233
- mountedInstances = mountedInstances.filter(function (i) {
3234
- return i !== instance;
3235
- });
3236
- instance.state.isMounted = false;
3237
- invokeHook('onHidden', [instance]);
3238
- }
3239
-
3240
- function destroy() {
3241
-
3242
- if (instance.state.isDestroyed) {
3243
- return;
3244
- }
3245
-
3246
- instance.clearDelayTimeouts();
3247
- instance.unmount();
3248
- removeListeners();
3249
- delete reference._tippy;
3250
- instance.state.isDestroyed = true;
3251
- invokeHook('onDestroy', [instance]);
3252
- }
3253
- }
3254
-
3255
- function tippy(targets, optionalProps) {
3256
- if (optionalProps === void 0) {
3257
- optionalProps = {};
3258
- }
3259
-
3260
- var plugins = defaultProps.plugins.concat(optionalProps.plugins || []);
3261
-
3262
- bindGlobalEventListeners();
3263
- var passedProps = Object.assign({}, optionalProps, {
3264
- plugins: plugins
3265
- });
3266
- var elements = getArrayOfElements(targets);
3267
-
3268
- var instances = elements.reduce(function (acc, reference) {
3269
- var instance = reference && createTippy(reference, passedProps);
3270
-
3271
- if (instance) {
3272
- acc.push(instance);
3273
- }
3274
-
3275
- return acc;
3276
- }, []);
3277
- return isElement(targets) ? instances[0] : instances;
3278
- }
3279
-
3280
- tippy.defaultProps = defaultProps;
3281
- tippy.setDefaultProps = setDefaultProps;
3282
- tippy.currentInput = currentInput;
3283
-
3284
- // every time the popper is destroyed (i.e. a new target), removing the styles
3285
- // and causing transitions to break for singletons when the console is open, but
3286
- // most notably for non-transform styles being used, `gpuAcceleration: false`.
3287
-
3288
- Object.assign({}, applyStyles$1, {
3289
- effect: function effect(_ref) {
3290
- var state = _ref.state;
3291
- var initialStyles = {
3292
- popper: {
3293
- position: state.options.strategy,
3294
- left: '0',
3295
- top: '0',
3296
- margin: '0'
3297
- },
3298
- arrow: {
3299
- position: 'absolute'
3300
- },
3301
- reference: {}
3302
- };
3303
- Object.assign(state.elements.popper.style, initialStyles.popper);
3304
- state.styles = initialStyles;
3305
-
3306
- if (state.elements.arrow) {
3307
- Object.assign(state.elements.arrow.style, initialStyles.arrow);
3308
- } // intentionally return no cleanup function
3309
- // return () => { ... }
3310
-
3311
- }
3312
- });
3313
-
3314
- var mouseCoords = {
3315
- clientX: 0,
3316
- clientY: 0
3317
- };
3318
- var activeInstances = [];
3319
-
3320
- function storeMouseCoords(_ref) {
3321
- var clientX = _ref.clientX,
3322
- clientY = _ref.clientY;
3323
- mouseCoords = {
3324
- clientX: clientX,
3325
- clientY: clientY
3326
- };
3327
- }
3328
-
3329
- function addMouseCoordsListener(doc) {
3330
- doc.addEventListener('mousemove', storeMouseCoords);
3331
- }
3332
-
3333
- function removeMouseCoordsListener(doc) {
3334
- doc.removeEventListener('mousemove', storeMouseCoords);
3335
- }
3336
-
3337
- var followCursor = {
3338
- name: 'followCursor',
3339
- defaultValue: false,
3340
- fn: function fn(instance) {
3341
- var reference = instance.reference;
3342
- var doc = getOwnerDocument(instance.props.triggerTarget || reference);
3343
- var isInternalUpdate = false;
3344
- var wasFocusEvent = false;
3345
- var isUnmounted = true;
3346
- var prevProps = instance.props;
3347
-
3348
- function getIsInitialBehavior() {
3349
- return instance.props.followCursor === 'initial' && instance.state.isVisible;
3350
- }
3351
-
3352
- function addListener() {
3353
- doc.addEventListener('mousemove', onMouseMove);
3354
- }
3355
-
3356
- function removeListener() {
3357
- doc.removeEventListener('mousemove', onMouseMove);
3358
- }
3359
-
3360
- function unsetGetReferenceClientRect() {
3361
- isInternalUpdate = true;
3362
- instance.setProps({
3363
- getReferenceClientRect: null
3364
- });
3365
- isInternalUpdate = false;
3366
- }
3367
-
3368
- function onMouseMove(event) {
3369
- // If the instance is interactive, avoid updating the position unless it's
3370
- // over the reference element
3371
- var isCursorOverReference = event.target ? reference.contains(event.target) : true;
3372
- var followCursor = instance.props.followCursor;
3373
- var clientX = event.clientX,
3374
- clientY = event.clientY;
3375
- var rect = reference.getBoundingClientRect();
3376
- var relativeX = clientX - rect.left;
3377
- var relativeY = clientY - rect.top;
3378
-
3379
- if (isCursorOverReference || !instance.props.interactive) {
3380
- instance.setProps({
3381
- // @ts-ignore - unneeded DOMRect properties
3382
- getReferenceClientRect: function getReferenceClientRect() {
3383
- var rect = reference.getBoundingClientRect();
3384
- var x = clientX;
3385
- var y = clientY;
3386
-
3387
- if (followCursor === 'initial') {
3388
- x = rect.left + relativeX;
3389
- y = rect.top + relativeY;
3390
- }
3391
-
3392
- var top = followCursor === 'horizontal' ? rect.top : y;
3393
- var right = followCursor === 'vertical' ? rect.right : x;
3394
- var bottom = followCursor === 'horizontal' ? rect.bottom : y;
3395
- var left = followCursor === 'vertical' ? rect.left : x;
3396
- return {
3397
- width: right - left,
3398
- height: bottom - top,
3399
- top: top,
3400
- right: right,
3401
- bottom: bottom,
3402
- left: left
3403
- };
3404
- }
3405
- });
3406
- }
3407
- }
3408
-
3409
- function create() {
3410
- if (instance.props.followCursor) {
3411
- activeInstances.push({
3412
- instance: instance,
3413
- doc: doc
3414
- });
3415
- addMouseCoordsListener(doc);
3416
- }
3417
- }
3418
-
3419
- function destroy() {
3420
- activeInstances = activeInstances.filter(function (data) {
3421
- return data.instance !== instance;
3422
- });
3423
-
3424
- if (activeInstances.filter(function (data) {
3425
- return data.doc === doc;
3426
- }).length === 0) {
3427
- removeMouseCoordsListener(doc);
3428
- }
3429
- }
3430
-
3431
- return {
3432
- onCreate: create,
3433
- onDestroy: destroy,
3434
- onBeforeUpdate: function onBeforeUpdate() {
3435
- prevProps = instance.props;
3436
- },
3437
- onAfterUpdate: function onAfterUpdate(_, _ref2) {
3438
- var followCursor = _ref2.followCursor;
3439
-
3440
- if (isInternalUpdate) {
3441
- return;
3442
- }
3443
-
3444
- if (followCursor !== undefined && prevProps.followCursor !== followCursor) {
3445
- destroy();
3446
-
3447
- if (followCursor) {
3448
- create();
3449
-
3450
- if (instance.state.isMounted && !wasFocusEvent && !getIsInitialBehavior()) {
3451
- addListener();
3452
- }
3453
- } else {
3454
- removeListener();
3455
- unsetGetReferenceClientRect();
3456
- }
3457
- }
3458
- },
3459
- onMount: function onMount() {
3460
- if (instance.props.followCursor && !wasFocusEvent) {
3461
- if (isUnmounted) {
3462
- onMouseMove(mouseCoords);
3463
- isUnmounted = false;
3464
- }
3465
-
3466
- if (!getIsInitialBehavior()) {
3467
- addListener();
3468
- }
3469
- }
3470
- },
3471
- onTrigger: function onTrigger(_, event) {
3472
- if (isMouseEvent(event)) {
3473
- mouseCoords = {
3474
- clientX: event.clientX,
3475
- clientY: event.clientY
3476
- };
3477
- }
3478
-
3479
- wasFocusEvent = event.type === 'focus';
3480
- },
3481
- onHidden: function onHidden() {
3482
- if (instance.props.followCursor) {
3483
- unsetGetReferenceClientRect();
3484
- removeListener();
3485
- isUnmounted = true;
3486
- }
3487
- }
3488
- };
3489
- }
3490
- };
3491
-
3492
- tippy.setDefaultProps({
3493
- render: render
3494
- });
3495
-
3496
- function _objectWithoutPropertiesLoose(source, excluded) {
3497
- if (source == null) return {};
3498
- var target = {};
3499
- var sourceKeys = Object.keys(source);
3500
- var key, i;
3501
-
3502
- for (i = 0; i < sourceKeys.length; i++) {
3503
- key = sourceKeys[i];
3504
- if (excluded.indexOf(key) >= 0) continue;
3505
- target[key] = source[key];
3506
- }
3507
-
3508
- return target;
3509
- }
3510
-
3511
- var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
3512
- function preserveRef(ref, node) {
3513
- if (ref) {
3514
- if (typeof ref === 'function') {
3515
- ref(node);
3516
- }
3517
-
3518
- if ({}.hasOwnProperty.call(ref, 'current')) {
3519
- ref.current = node;
3520
- }
3521
- }
3522
- }
3523
- function ssrSafeCreateDiv() {
3524
- return isBrowser && document.createElement('div');
3525
- }
3526
- function toDataAttributes(attrs) {
3527
- var dataAttrs = {
3528
- 'data-placement': attrs.placement
3529
- };
3530
-
3531
- if (attrs.referenceHidden) {
3532
- dataAttrs['data-reference-hidden'] = '';
3533
- }
3534
-
3535
- if (attrs.escaped) {
3536
- dataAttrs['data-escaped'] = '';
3537
- }
3538
-
3539
- return dataAttrs;
3540
- }
3541
-
3542
- function deepEqual(x, y) {
3543
- if (x === y) {
3544
- return true;
3545
- } else if (typeof x === 'object' && x != null && typeof y === 'object' && y != null) {
3546
- if (Object.keys(x).length !== Object.keys(y).length) {
3547
- return false;
3548
- }
3549
-
3550
- for (var prop in x) {
3551
- if (y.hasOwnProperty(prop)) {
3552
- if (!deepEqual(x[prop], y[prop])) {
3553
- return false;
3554
- }
3555
- } else {
3556
- return false;
3557
- }
3558
- }
3559
-
3560
- return true;
3561
- } else {
3562
- return false;
3563
- }
3564
- }
3565
-
3566
- function uniqueByShape(arr) {
3567
- var output = [];
3568
- arr.forEach(function (item) {
3569
- if (!output.find(function (outputItem) {
3570
- return deepEqual(item, outputItem);
3571
- })) {
3572
- output.push(item);
3573
- }
3574
- });
3575
- return output;
3576
- }
3577
- function deepPreserveProps(instanceProps, componentProps) {
3578
- var _instanceProps$popper, _componentProps$poppe;
3579
-
3580
- return Object.assign({}, componentProps, {
3581
- popperOptions: Object.assign({}, instanceProps.popperOptions, componentProps.popperOptions, {
3582
- modifiers: uniqueByShape([].concat(((_instanceProps$popper = instanceProps.popperOptions) == null ? void 0 : _instanceProps$popper.modifiers) || [], ((_componentProps$poppe = componentProps.popperOptions) == null ? void 0 : _componentProps$poppe.modifiers) || []))
3583
- })
3584
- });
3585
- }
3586
-
3587
- var useIsomorphicLayoutEffect = isBrowser ? React.useLayoutEffect : React.useEffect;
3588
- function useMutableBox(initialValue) {
3589
- // Using refs instead of state as it's recommended to not store imperative
3590
- // values in state due to memory problems in React(?)
3591
- var ref = React.useRef();
3592
-
3593
- if (!ref.current) {
3594
- ref.current = typeof initialValue === 'function' ? initialValue() : initialValue;
3595
- }
3596
-
3597
- return ref.current;
3598
- }
3599
-
3600
- function updateClassName(box, action, classNames) {
3601
- classNames.split(/\s+/).forEach(function (name) {
3602
- if (name) {
3603
- box.classList[action](name);
3604
- }
3605
- });
3606
- }
3607
-
3608
- var classNamePlugin = {
3609
- name: 'className',
3610
- defaultValue: '',
3611
- fn: function fn(instance) {
3612
- var box = instance.popper.firstElementChild;
3613
-
3614
- var isDefaultRenderFn = function isDefaultRenderFn() {
3615
- var _instance$props$rende;
3616
-
3617
- return !!((_instance$props$rende = instance.props.render) == null ? void 0 : _instance$props$rende.$$tippy);
3618
- };
3619
-
3620
- function add() {
3621
- if (instance.props.className && !isDefaultRenderFn()) {
3622
-
3623
- return;
3624
- }
3625
-
3626
- updateClassName(box, 'add', instance.props.className);
3627
- }
3628
-
3629
- function remove() {
3630
- if (isDefaultRenderFn()) {
3631
- updateClassName(box, 'remove', instance.props.className);
3632
- }
3633
- }
3634
-
3635
- return {
3636
- onCreate: add,
3637
- onBeforeUpdate: remove,
3638
- onAfterUpdate: add
3639
- };
3640
- }
3641
- };
3642
-
3643
- function TippyGenerator(tippy) {
3644
- function Tippy(_ref) {
3645
- var children = _ref.children,
3646
- content = _ref.content,
3647
- visible = _ref.visible,
3648
- singleton = _ref.singleton,
3649
- render = _ref.render,
3650
- reference = _ref.reference,
3651
- _ref$disabled = _ref.disabled,
3652
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
3653
- _ref$ignoreAttributes = _ref.ignoreAttributes,
3654
- ignoreAttributes = _ref$ignoreAttributes === void 0 ? true : _ref$ignoreAttributes;
3655
- _ref.__source;
3656
- _ref.__self;
3657
- var restOfNativeProps = _objectWithoutPropertiesLoose(_ref, ["children", "content", "visible", "singleton", "render", "reference", "disabled", "ignoreAttributes", "__source", "__self"]);
3658
-
3659
- var isControlledMode = visible !== undefined;
3660
- var isSingletonMode = singleton !== undefined;
3661
-
3662
- var _useState = React.useState(false),
3663
- mounted = _useState[0],
3664
- setMounted = _useState[1];
3665
-
3666
- var _useState2 = React.useState({}),
3667
- attrs = _useState2[0],
3668
- setAttrs = _useState2[1];
3669
-
3670
- var _useState3 = React.useState(),
3671
- singletonContent = _useState3[0],
3672
- setSingletonContent = _useState3[1];
3673
-
3674
- var mutableBox = useMutableBox(function () {
3675
- return {
3676
- container: ssrSafeCreateDiv(),
3677
- renders: 1
3678
- };
3679
- });
3680
- var props = Object.assign({
3681
- ignoreAttributes: ignoreAttributes
3682
- }, restOfNativeProps, {
3683
- content: mutableBox.container
3684
- });
3685
-
3686
- if (isControlledMode) {
3687
-
3688
- props.trigger = 'manual';
3689
- props.hideOnClick = false;
3690
- }
3691
-
3692
- if (isSingletonMode) {
3693
- disabled = true;
3694
- }
3695
-
3696
- var computedProps = props;
3697
- var plugins = props.plugins || [];
3698
-
3699
- if (render) {
3700
- computedProps = Object.assign({}, props, {
3701
- plugins: isSingletonMode ? [].concat(plugins, [{
3702
- fn: function fn() {
3703
- return {
3704
- onTrigger: function onTrigger(_, event) {
3705
- var _singleton$data$child = singleton.data.children.find(function (_ref2) {
3706
- var instance = _ref2.instance;
3707
- return instance.reference === event.currentTarget;
3708
- }),
3709
- content = _singleton$data$child.content;
3710
-
3711
- setSingletonContent(content);
3712
- }
3713
- };
3714
- }
3715
- }]) : plugins,
3716
- render: function render() {
3717
- return {
3718
- popper: mutableBox.container
3719
- };
3720
- }
3721
- });
3722
- }
3723
-
3724
- var deps = [reference].concat(children ? [children.type] : []); // CREATE
3725
-
3726
- useIsomorphicLayoutEffect(function () {
3727
- var element = reference;
3728
-
3729
- if (reference && reference.hasOwnProperty('current')) {
3730
- element = reference.current;
3731
- }
3732
-
3733
- var instance = tippy(element || mutableBox.ref || ssrSafeCreateDiv(), Object.assign({}, computedProps, {
3734
- plugins: [classNamePlugin].concat(props.plugins || [])
3735
- }));
3736
- mutableBox.instance = instance;
3737
-
3738
- if (disabled) {
3739
- instance.disable();
3740
- }
3741
-
3742
- if (visible) {
3743
- instance.show();
3744
- }
3745
-
3746
- if (isSingletonMode) {
3747
- singleton.hook({
3748
- instance: instance,
3749
- content: content,
3750
- props: computedProps
3751
- });
3752
- }
3753
-
3754
- setMounted(true);
3755
- return function () {
3756
- instance.destroy();
3757
- singleton == null ? void 0 : singleton.cleanup(instance);
3758
- };
3759
- }, deps); // UPDATE
3760
-
3761
- useIsomorphicLayoutEffect(function () {
3762
- var _instance$popperInsta;
3763
-
3764
- // Prevent this effect from running on 1st render
3765
- if (mutableBox.renders === 1) {
3766
- mutableBox.renders++;
3767
- return;
3768
- }
3769
-
3770
- var instance = mutableBox.instance;
3771
- instance.setProps(deepPreserveProps(instance.props, computedProps)); // Fixes #264
3772
-
3773
- (_instance$popperInsta = instance.popperInstance) == null ? void 0 : _instance$popperInsta.forceUpdate();
3774
-
3775
- if (disabled) {
3776
- instance.disable();
3777
- } else {
3778
- instance.enable();
3779
- }
3780
-
3781
- if (isControlledMode) {
3782
- if (visible) {
3783
- instance.show();
3784
- } else {
3785
- instance.hide();
3786
- }
3787
- }
3788
-
3789
- if (isSingletonMode) {
3790
- singleton.hook({
3791
- instance: instance,
3792
- content: content,
3793
- props: computedProps
3794
- });
3795
- }
3796
- });
3797
- useIsomorphicLayoutEffect(function () {
3798
- var _instance$props$poppe;
3799
-
3800
- if (!render) {
3801
- return;
3802
- }
3803
-
3804
- var instance = mutableBox.instance;
3805
- instance.setProps({
3806
- popperOptions: Object.assign({}, instance.props.popperOptions, {
3807
- modifiers: [].concat((((_instance$props$poppe = instance.props.popperOptions) == null ? void 0 : _instance$props$poppe.modifiers) || []).filter(function (_ref3) {
3808
- var name = _ref3.name;
3809
- return name !== '$$tippyReact';
3810
- }), [{
3811
- name: '$$tippyReact',
3812
- enabled: true,
3813
- phase: 'beforeWrite',
3814
- requires: ['computeStyles'],
3815
- fn: function fn(_ref4) {
3816
- var _state$modifiersData;
3817
-
3818
- var state = _ref4.state;
3819
- var hideData = (_state$modifiersData = state.modifiersData) == null ? void 0 : _state$modifiersData.hide; // WARNING: this is a high-risk path that can cause an infinite
3820
- // loop. This expression _must_ evaluate to false when required
3821
-
3822
- if (attrs.placement !== state.placement || attrs.referenceHidden !== (hideData == null ? void 0 : hideData.isReferenceHidden) || attrs.escaped !== (hideData == null ? void 0 : hideData.hasPopperEscaped)) {
3823
- setAttrs({
3824
- placement: state.placement,
3825
- referenceHidden: hideData == null ? void 0 : hideData.isReferenceHidden,
3826
- escaped: hideData == null ? void 0 : hideData.hasPopperEscaped
3827
- });
3828
- }
3829
-
3830
- state.attributes.popper = {};
3831
- }
3832
- }])
3833
- })
3834
- });
3835
- }, [attrs.placement, attrs.referenceHidden, attrs.escaped].concat(deps));
3836
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, children ? /*#__PURE__*/React.cloneElement(children, {
3837
- ref: function ref(node) {
3838
- mutableBox.ref = node;
3839
- preserveRef(children.ref, node);
3840
- }
3841
- }) : null, mounted && /*#__PURE__*/ReactDOM.createPortal(render ? render(toDataAttributes(attrs), singletonContent, mutableBox.instance) : content, mutableBox.container));
3842
- }
3843
-
3844
- return Tippy;
3845
- }
3846
-
3847
- var forwardRef = (function (Tippy, defaultProps) {
3848
- return /*#__PURE__*/React.forwardRef(function TippyWrapper(_ref, _ref2) {
3849
- var children = _ref.children,
3850
- props = _objectWithoutPropertiesLoose(_ref, ["children"]);
3851
-
3852
- return (
3853
- /*#__PURE__*/
3854
- // If I spread them separately here, Babel adds the _extends ponyfill for
3855
- // some reason
3856
- React__default["default"].createElement(Tippy, Object.assign({}, defaultProps, props), children ? /*#__PURE__*/React.cloneElement(children, {
3857
- ref: function ref(node) {
3858
- preserveRef(_ref2, node);
3859
- preserveRef(children.ref, node);
3860
- }
3861
- }) : null)
3862
- );
3863
- });
3864
- });
3865
- var index = /*#__PURE__*/forwardRef( /*#__PURE__*/TippyGenerator(tippy));
3866
-
3867
- var ARROW = "<svg width='12' height='6' viewBox='0 0 10 5' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M10 5H0.926697L3.95208 1.63847C4.74227 0.760478 6.11722 0.754951 6.91445 1.62656L10 5Z' /></svg>";
3868
-
3869
- var _excluded = ["content", "children", "theme", "disabled", "position", "interactive", "hideAfter", "hideOnTargetExit"];
3870
- var Tooltip = function Tooltip(_ref) {
3871
- var content = _ref.content,
3872
- children = _ref.children,
3873
- _ref$theme = _ref.theme,
3874
- theme = _ref$theme === void 0 ? "dark" : _ref$theme,
3875
- _ref$disabled = _ref.disabled,
3876
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
3877
- _ref$position = _ref.position,
3878
- position = _ref$position === void 0 ? "auto" : _ref$position,
3879
- _ref$interactive = _ref.interactive,
3880
- interactive = _ref$interactive === void 0 ? false : _ref$interactive,
3881
- _ref$hideAfter = _ref.hideAfter,
3882
- hideAfter = _ref$hideAfter === void 0 ? -1 : _ref$hideAfter,
3883
- _ref$hideOnTargetExit = _ref.hideOnTargetExit,
3884
- hideOnTargetExit = _ref$hideOnTargetExit === void 0 ? false : _ref$hideOnTargetExit,
3885
- otherProps = objectWithoutProperties._objectWithoutProperties(_ref, _excluded);
3886
- var _useState = React.useState(null),
3887
- _useState2 = slicedToArray._slicedToArray(_useState, 2),
3888
- instance = _useState2[0],
3889
- setInstance = _useState2[1];
3890
- var localProps = {};
3891
- if (hideAfter > 0) {
3892
- localProps["onShow"] = function (instance) {
3893
- return setTimeout(function () {
3894
- return instance.hide();
3895
- }, hideAfter);
3896
- };
3897
- }
3898
- React.useEffect(function () {
3899
- if (hideOnTargetExit) {
3900
- var intersectionObserver = new IntersectionObserver(function (entries) {
3901
- entries.forEach(function (entry) {
3902
- return !entry.isIntersecting && (instance === null || instance === void 0 ? void 0 : instance.hide());
3903
- });
3904
- });
3905
- (instance === null || instance === void 0 ? void 0 : instance.reference) && intersectionObserver.observe(instance === null || instance === void 0 ? void 0 : instance.reference);
3906
- return function () {
3907
- return intersectionObserver.disconnect();
3908
- };
3909
- }
3910
- return undefined;
3911
- }, [instance, hideOnTargetExit]);
3912
- return /*#__PURE__*/React__default["default"].createElement(index, _extends._extends({
3913
- animation: "scale-subtle",
3914
- arrow: ARROW,
3915
- content: content,
3916
- disabled: disabled,
3917
- duration: [100, 200],
3918
- interactive: interactive,
3919
- placement: position,
3920
- plugins: [followCursor],
3921
- role: "tooltip",
3922
- theme: theme,
3923
- zIndex: 100001,
3924
- onCreate: function onCreate(instance) {
3925
- var _instance$popper$firs;
3926
- setInstance(instance);
3927
- (_instance$popper$firs = instance.popper.firstElementChild) === null || _instance$popper$firs === void 0 || _instance$popper$firs.setAttribute("data-cy", "tooltip-box");
3928
- }
3929
- }, localProps, otherProps), /*#__PURE__*/React__default["default"].isValidElement(children) ? children : /*#__PURE__*/React__default["default"].createElement("span", null, children));
3930
- };
3931
-
3932
- exports.Tooltip = Tooltip;
3933
- exports.index = index;
3934
- //# sourceMappingURL=index-0e68cfff.js.map