@splunk/react-ui 4.20.0 → 4.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Accordion.js +425 -441
- package/Anchor.js +147 -193
- package/Animation.js +142 -166
- package/AnimationToggle.js +197 -253
- package/Box.js +145 -194
- package/Breadcrumbs.js +288 -298
- package/Button.js +488 -613
- package/ButtonGroup.js +160 -212
- package/ButtonSimple.js +543 -562
- package/CHANGELOG.md +26 -0
- package/Calendar.js +1107 -1195
- package/Card.js +771 -746
- package/CardLayout.js +205 -223
- package/Chip.js +509 -612
- package/Clickable.js +416 -472
- package/CloseButton.js +165 -250
- package/Code.js +1808 -2172
- package/Code.js.LICENSE.txt +8 -0
- package/CollapsiblePanel.js +586 -675
- package/Color.js +1066 -1297
- package/ColumnLayout.js +402 -465
- package/ComboBox.js +892 -969
- package/Concertina.js +998 -963
- package/ControlGroup.js +687 -718
- package/Date.js +567 -697
- package/DefinitionList.js +308 -310
- package/Divider.js +149 -194
- package/Dropdown.js +459 -558
- package/DualListbox.js +1480 -1735
- package/EventListener.js +94 -165
- package/File.js +1051 -1173
- package/FormRows.js +885 -880
- package/Heading.js +216 -263
- package/Image.js +446 -558
- package/JSONTree.js +690 -699
- package/Layer.js +442 -582
- package/Link.js +336 -361
- package/List.js +213 -237
- package/Markdown.js +510 -612
- package/Menu.js +1109 -1331
- package/Message.js +474 -629
- package/MessageBar.js +387 -561
- package/Modal.js +810 -798
- package/ModalLayer.js +326 -343
- package/Monogram.js +308 -368
- package/Multiselect.js +3558 -3998
- package/Number.js +729 -843
- package/Paginator.js +510 -615
- package/Paragraph.js +145 -188
- package/Popover.js +1470 -1693
- package/Progress.js +301 -362
- package/RadioBar.js +610 -651
- package/RadioList.js +483 -544
- package/Resize.js +530 -623
- package/ResultsMenu.js +494 -597
- package/ScreenReaderContent.js +142 -187
- package/Scroll.js +595 -598
- package/ScrollContainerContext.js +197 -278
- package/Search.js +745 -817
- package/Select.js +2441 -2746
- package/SidePanel.js +390 -392
- package/Slider.js +668 -825
- package/SlidingPanels.js +639 -645
- package/SplitButton.js +464 -499
- package/StaticContent.js +161 -217
- package/StepBar.js +386 -466
- package/Switch.js +710 -764
- package/TabBar.js +724 -815
- package/TabLayout.js +406 -438
- package/Table.js +4842 -5121
- package/Text.js +1169 -1351
- package/TextArea.js +1097 -1307
- package/Tooltip.js +624 -721
- package/TransitionOpen.js +489 -546
- package/Typography.js +176 -229
- package/WaitSpinner.js +230 -298
- package/package.json +14 -15
- package/stubs-splunkui.d.ts +4 -1
- package/types/src/ComboBox/Option.d.ts +1 -1
- package/types/src/Concertina/Concertina.d.ts +4 -0
- package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
- package/types/src/JSONTree/TreeNode.d.ts +5 -0
- package/types/src/Link/Link.d.ts +7 -3
- package/types/src/Link/docs/examples/NewWindow.d.ts +2 -0
- package/types/src/Markdown/Markdown.d.ts +1 -1
- package/types/src/Markdown/renderers/MarkdownHeading.d.ts +1 -1
- package/types/src/Menu/Item.d.ts +1 -1
- package/types/src/Menu/Menu.d.ts +1 -0
- package/types/src/MessageBar/docs/examples/WithActions.d.ts +2 -0
- package/types/src/Multiselect/Option.d.ts +1 -1
- package/types/src/Search/Option.d.ts +1 -1
- package/types/src/Select/Option.d.ts +1 -1
- package/types/src/Select/OptionBase.d.ts +1 -1
- package/types/src/fixtures/FetchOptions.d.ts +2 -8
- package/useForceUpdate.js +112 -146
- package/useKeyPress.js +74 -128
- package/usePrevious.js +65 -129
- package/useRovingFocus.js +122 -218
- package/types/src/Link/docs/examples/NewTab.d.ts +0 -2
- /package/types/src/Table/docs/examples/{DockedHeader.d.ts → DockedHeaderScrollbar.d.ts} +0 -0
- /package/types/src/Table/docs/examples/prisma/{DockedHeader.d.ts → DockedHeaderScrollbar.d.ts} +0 -0
package/Popover.js
CHANGED
|
@@ -1,1732 +1,1509 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/******/
|
|
4
|
-
/******/
|
|
5
|
-
/******/
|
|
6
|
-
/******/
|
|
7
|
-
|
|
8
|
-
/******/
|
|
9
|
-
/******/
|
|
10
|
-
/******/
|
|
11
|
-
/******/
|
|
12
|
-
/******/
|
|
13
|
-
/******/
|
|
14
|
-
/******/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/******/
|
|
20
|
-
/******/
|
|
21
|
-
/******/
|
|
22
|
-
/******/
|
|
23
|
-
/******/
|
|
24
|
-
/******/
|
|
25
|
-
/******/
|
|
26
|
-
/******/
|
|
27
|
-
/******/
|
|
28
|
-
/******/
|
|
29
|
-
/******/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/******/
|
|
34
|
-
/******/
|
|
35
|
-
/******/
|
|
36
|
-
/******/
|
|
37
|
-
/******/
|
|
38
|
-
/******/
|
|
39
|
-
/******/
|
|
40
|
-
/******/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/******/
|
|
44
|
-
/******/
|
|
45
|
-
/******/
|
|
46
|
-
/******/
|
|
47
|
-
/******/
|
|
48
|
-
/******/
|
|
49
|
-
/******/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/******/
|
|
53
|
-
/******/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
/******/
|
|
57
|
-
/******/
|
|
58
|
-
/******/
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
1
|
+
/******/ (() => {
|
|
2
|
+
// webpackBootstrap
|
|
3
|
+
/******/ "use strict";
|
|
4
|
+
/******/ // The require scope
|
|
5
|
+
/******/ var e = {};
|
|
6
|
+
/******/
|
|
7
|
+
/************************************************************************/
|
|
8
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
9
|
+
/******/ (() => {
|
|
10
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
11
|
+
/******/ e.n = t => {
|
|
12
|
+
/******/ var r = t && t.__esModule ?
|
|
13
|
+
/******/ () => t["default"]
|
|
14
|
+
/******/ : () => t
|
|
15
|
+
/******/;
|
|
16
|
+
e.d(r, {
|
|
17
|
+
a: r
|
|
18
|
+
});
|
|
19
|
+
/******/ return r;
|
|
20
|
+
/******/ };
|
|
21
|
+
/******/ })();
|
|
22
|
+
/******/
|
|
23
|
+
/******/ /* webpack/runtime/define property getters */
|
|
24
|
+
/******/ (() => {
|
|
25
|
+
/******/ // define getter functions for harmony exports
|
|
26
|
+
/******/ e.d = (t, r) => {
|
|
27
|
+
/******/ for (var n in r) {
|
|
28
|
+
/******/ if (e.o(r, n) && !e.o(t, n)) {
|
|
29
|
+
/******/ Object.defineProperty(t, n, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: r[n]
|
|
32
|
+
});
|
|
33
|
+
/******/ }
|
|
34
|
+
/******/ }
|
|
35
|
+
/******/ };
|
|
36
|
+
/******/ })();
|
|
37
|
+
/******/
|
|
38
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
39
|
+
/******/ (() => {
|
|
40
|
+
/******/ e.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)
|
|
41
|
+
/******/;
|
|
42
|
+
})();
|
|
43
|
+
/******/
|
|
44
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
45
|
+
/******/ (() => {
|
|
46
|
+
/******/ // define __esModule on exports
|
|
47
|
+
/******/ e.r = e => {
|
|
48
|
+
/******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
|
|
49
|
+
/******/ Object.defineProperty(e, Symbol.toStringTag, {
|
|
50
|
+
value: "Module"
|
|
51
|
+
});
|
|
52
|
+
/******/ }
|
|
53
|
+
/******/ Object.defineProperty(e, "__esModule", {
|
|
54
|
+
value: true
|
|
55
|
+
});
|
|
56
|
+
/******/ };
|
|
57
|
+
/******/ })();
|
|
58
|
+
/******/
|
|
59
|
+
/************************************************************************/ var t = {};
|
|
60
|
+
// ESM COMPAT FLAG
|
|
61
|
+
e.r(t);
|
|
62
|
+
// EXPORTS
|
|
63
|
+
e.d(t, {
|
|
64
|
+
PopoverContext: () => /* reexport */ $,
|
|
65
|
+
default: () => /* reexport */ Ze
|
|
66
|
+
});
|
|
67
|
+
// CONCATENATED MODULE: external "react"
|
|
68
|
+
const r = require("react");
|
|
69
|
+
var n = e.n(r);
|
|
70
|
+
// CONCATENATED MODULE: external "prop-types"
|
|
71
|
+
const o = require("prop-types");
|
|
72
|
+
var a = e.n(o);
|
|
73
|
+
// CONCATENATED MODULE: external "react-dom"
|
|
74
|
+
const i = require("react-dom");
|
|
75
|
+
// CONCATENATED MODULE: external "lodash/clamp"
|
|
76
|
+
const l = require("lodash/clamp");
|
|
77
|
+
var c = e.n(l);
|
|
78
|
+
// CONCATENATED MODULE: external "lodash/defer"
|
|
79
|
+
const f = require("lodash/defer");
|
|
80
|
+
var s = e.n(f);
|
|
81
|
+
// CONCATENATED MODULE: external "lodash/every"
|
|
82
|
+
const u = require("lodash/every");
|
|
83
|
+
var p = e.n(u);
|
|
84
|
+
// CONCATENATED MODULE: external "lodash/has"
|
|
85
|
+
const h = require("lodash/has");
|
|
86
|
+
var d = e.n(h);
|
|
87
|
+
// CONCATENATED MODULE: external "lodash/includes"
|
|
88
|
+
const v = require("lodash/includes");
|
|
89
|
+
var m = e.n(v);
|
|
90
|
+
// CONCATENATED MODULE: external "lodash/intersection"
|
|
91
|
+
const b = require("lodash/intersection");
|
|
92
|
+
var y = e.n(b);
|
|
93
|
+
// CONCATENATED MODULE: external "lodash/isFinite"
|
|
94
|
+
const g = require("lodash/isFinite");
|
|
95
|
+
var w = e.n(g);
|
|
96
|
+
// CONCATENATED MODULE: external "lodash/isFunction"
|
|
97
|
+
const S = require("lodash/isFunction");
|
|
98
|
+
var O = e.n(S);
|
|
99
|
+
// CONCATENATED MODULE: external "lodash/keys"
|
|
100
|
+
const P = require("lodash/keys");
|
|
101
|
+
var E = e.n(P);
|
|
102
|
+
// CONCATENATED MODULE: external "lodash/omit"
|
|
103
|
+
const C = require("lodash/omit");
|
|
104
|
+
var j = e.n(C);
|
|
105
|
+
// CONCATENATED MODULE: external "lodash/throttle"
|
|
106
|
+
const k = require("lodash/throttle");
|
|
107
|
+
var x = e.n(k);
|
|
108
|
+
// CONCATENATED MODULE: external "@splunk/themes"
|
|
109
|
+
const A = require("@splunk/themes");
|
|
110
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/Animation"
|
|
111
|
+
const T = require("@splunk/react-ui/Animation");
|
|
112
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/EventListener"
|
|
113
|
+
const R = require("@splunk/react-ui/EventListener");
|
|
114
|
+
var q = e.n(R);
|
|
115
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/Layer"
|
|
116
|
+
const W = require("@splunk/react-ui/Layer");
|
|
117
|
+
var M = e.n(W);
|
|
118
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/ScrollContainerContext"
|
|
119
|
+
const H = require("@splunk/react-ui/ScrollContainerContext");
|
|
120
|
+
var _ = e.n(H);
|
|
121
|
+
// CONCATENATED MODULE: external "@splunk/ui-utils/focus"
|
|
122
|
+
const L = require("@splunk/ui-utils/focus");
|
|
123
|
+
// CONCATENATED MODULE: ./src/Popover/getPlacement.ts
|
|
124
|
+
function D(e, t) {
|
|
125
|
+
var r = Object.keys(e);
|
|
126
|
+
if (Object.getOwnPropertySymbols) {
|
|
127
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
128
|
+
if (t) n = n.filter((function(t) {
|
|
129
|
+
return Object.getOwnPropertyDescriptor(e, t).enumerable;
|
|
130
|
+
}));
|
|
131
|
+
r.push.apply(r, n);
|
|
132
|
+
}
|
|
133
|
+
return r;
|
|
123
134
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
module.exports = require("lodash/includes");
|
|
142
|
-
|
|
143
|
-
/***/ }),
|
|
144
|
-
|
|
145
|
-
/***/ 150:
|
|
146
|
-
/***/ (function(module, exports) {
|
|
147
|
-
|
|
148
|
-
module.exports = require("lodash/clamp");
|
|
149
|
-
|
|
150
|
-
/***/ }),
|
|
151
|
-
|
|
152
|
-
/***/ 151:
|
|
153
|
-
/***/ (function(module, exports) {
|
|
154
|
-
|
|
155
|
-
module.exports = require("lodash/every");
|
|
156
|
-
|
|
157
|
-
/***/ }),
|
|
158
|
-
|
|
159
|
-
/***/ 152:
|
|
160
|
-
/***/ (function(module, exports) {
|
|
161
|
-
|
|
162
|
-
module.exports = require("lodash/intersection");
|
|
163
|
-
|
|
164
|
-
/***/ }),
|
|
165
|
-
|
|
166
|
-
/***/ 16:
|
|
167
|
-
/***/ (function(module, exports) {
|
|
168
|
-
|
|
169
|
-
module.exports = require("@splunk/react-ui/EventListener");
|
|
170
|
-
|
|
171
|
-
/***/ }),
|
|
172
|
-
|
|
173
|
-
/***/ 18:
|
|
174
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
175
|
-
|
|
176
|
-
"use strict";
|
|
177
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getWindow; });
|
|
178
|
-
/* unused harmony export ssrWindow */
|
|
179
|
-
/* harmony import */ var _ssrDocument__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28);
|
|
180
|
-
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
181
|
-
|
|
182
|
-
var ssrWindow = {
|
|
183
|
-
document: _ssrDocument__WEBPACK_IMPORTED_MODULE_0__[/* ssrDocument */ "b"],
|
|
184
|
-
navigator: {
|
|
185
|
-
userAgent: ''
|
|
186
|
-
},
|
|
187
|
-
location: {
|
|
188
|
-
hash: '',
|
|
189
|
-
host: '',
|
|
190
|
-
hostname: '',
|
|
191
|
-
href: '',
|
|
192
|
-
origin: '',
|
|
193
|
-
pathname: '',
|
|
194
|
-
protocol: '',
|
|
195
|
-
search: ''
|
|
196
|
-
},
|
|
197
|
-
history: {
|
|
198
|
-
replaceState: function replaceState() {},
|
|
199
|
-
pushState: function pushState() {},
|
|
200
|
-
go: function go() {},
|
|
201
|
-
back: function back() {}
|
|
202
|
-
},
|
|
203
|
-
CustomEvent: function CustomEvent() {
|
|
204
|
-
return this;
|
|
205
|
-
},
|
|
206
|
-
addEventListener: function addEventListener() {},
|
|
207
|
-
removeEventListener: function removeEventListener() {},
|
|
208
|
-
getComputedStyle: function getComputedStyle() {
|
|
209
|
-
return {
|
|
210
|
-
getPropertyValue: function getPropertyValue() {
|
|
211
|
-
return '';
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
},
|
|
215
|
-
Image: function Image() {},
|
|
216
|
-
Date: function Date() {},
|
|
217
|
-
screen: {},
|
|
218
|
-
setTimeout: function setTimeout() {},
|
|
219
|
-
clearTimeout: function clearTimeout() {},
|
|
220
|
-
matchMedia: function matchMedia() {
|
|
221
|
-
return {};
|
|
222
|
-
},
|
|
223
|
-
requestAnimationFrame: function requestAnimationFrame(callback) {
|
|
224
|
-
if (typeof setTimeout === 'undefined') {
|
|
225
|
-
callback();
|
|
226
|
-
return null;
|
|
135
|
+
function I(e) {
|
|
136
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
137
|
+
var r = arguments[t] != null ? arguments[t] : {};
|
|
138
|
+
if (t % 2) {
|
|
139
|
+
D(Object(r), true).forEach((function(t) {
|
|
140
|
+
F(e, t, r[t]);
|
|
141
|
+
}));
|
|
142
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
143
|
+
Object.defineProperties(e, Object.getOwnPropertyDescriptors(r));
|
|
144
|
+
} else {
|
|
145
|
+
D(Object(r)).forEach((function(t) {
|
|
146
|
+
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
|
|
147
|
+
}));
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return e;
|
|
227
151
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
152
|
+
function F(e, t, r) {
|
|
153
|
+
if (t in e) {
|
|
154
|
+
Object.defineProperty(e, t, {
|
|
155
|
+
value: r,
|
|
156
|
+
enumerable: true,
|
|
157
|
+
configurable: true,
|
|
158
|
+
writable: true
|
|
159
|
+
});
|
|
160
|
+
} else {
|
|
161
|
+
e[t] = r;
|
|
162
|
+
}
|
|
163
|
+
return e;
|
|
234
164
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
var
|
|
277
|
-
var
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
//
|
|
288
|
-
var
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
var
|
|
297
|
-
var
|
|
298
|
-
|
|
299
|
-
//
|
|
300
|
-
var
|
|
301
|
-
var
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
var
|
|
305
|
-
var
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
var
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
165
|
+
function N(e) {
|
|
166
|
+
var t = e.align, r = e.anchorPos, n = e.outerContainerEl, o = e.padding, a = e.placement;
|
|
167
|
+
switch (a) {
|
|
168
|
+
case "above":
|
|
169
|
+
return {
|
|
170
|
+
top: r.top - n.offsetHeight,
|
|
171
|
+
left: t === "edge" ? r.left - o : r.middle - n.offsetWidth / 2
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
case "below":
|
|
175
|
+
// Align 'end' is only supported by below
|
|
176
|
+
// TODO: SUI-5101 Enable users to align Popover and Dropdown
|
|
177
|
+
if (t === "end") {
|
|
178
|
+
return {
|
|
179
|
+
top: r.bottom,
|
|
180
|
+
left: r.right - n.offsetWidth + o
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
top: r.bottom,
|
|
185
|
+
left: t === "edge" ? r.left - o : r.middle - n.offsetWidth / 2
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
case "left":
|
|
189
|
+
return {
|
|
190
|
+
top: t === "edge" ? r.top - o : r.center - n.offsetHeight / 2,
|
|
191
|
+
left: r.left - n.offsetWidth
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
case "right":
|
|
195
|
+
return {
|
|
196
|
+
top: t === "edge" ? r.top - o : r.center - n.offsetHeight / 2,
|
|
197
|
+
left: r.right
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
default:
|
|
201
|
+
throw new Error("".concat(a, " is not a valid placement value. Valid options are: 'above', 'below', 'left', or 'right'"));
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function z(e) {
|
|
205
|
+
var t = e.align, r = e.anchorPos, n = e.scrollContainerPos, o = e.canCoverAnchor, a = e.defaultPlacement, i = e.outerContainerEl, l = e.padding, c = e.repositionMode, f = e.windowHeight, s = e.windowWidth;
|
|
206
|
+
var u = c === "flip";
|
|
207
|
+
var p = c === "any";
|
|
208
|
+
var h = u || p;
|
|
209
|
+
var d = e.placement || a;
|
|
210
|
+
// Translate vertical/horizontal to above/below/left/right
|
|
211
|
+
if (a === "vertical") {
|
|
212
|
+
d = r.top > f - r.bottom ? "above" : "below";
|
|
213
|
+
} else if (a === "horizontal") {
|
|
214
|
+
d = r.left > s - r.right ? "left" : "right";
|
|
215
|
+
}
|
|
216
|
+
var v = d;
|
|
217
|
+
// Initialize the result variables. These will be mutated as needed and returned.
|
|
218
|
+
var m = N({
|
|
219
|
+
align: t,
|
|
220
|
+
anchorPos: r,
|
|
221
|
+
outerContainerEl: i,
|
|
222
|
+
padding: l,
|
|
223
|
+
placement: v
|
|
224
|
+
}), b = m.top, y = m.left;
|
|
225
|
+
var g = "auto";
|
|
226
|
+
var w = s;
|
|
227
|
+
var S = f;
|
|
228
|
+
var O = v;
|
|
229
|
+
// Boolean convenience variables to simplify positioning logic.
|
|
230
|
+
var P = r.top - i.offsetHeight > 0;
|
|
231
|
+
var E = r.bottom + i.offsetHeight < f;
|
|
232
|
+
var C = r.left - i.offsetWidth > 0;
|
|
233
|
+
var j = r.right + i.offsetWidth < s;
|
|
234
|
+
var k = r.top * .7 > f - r.bottom;
|
|
235
|
+
var x = (t === "edge" ? r.left + i.offsetWidth - l : r.middle + i.offsetWidth / 2) > s;
|
|
236
|
+
var A = (t === "edge" ? r.left - l : r.middle - i.offsetWidth / 2) < 0;
|
|
237
|
+
var T = (t === "edge" ? r.top - l : r.top - i.offsetHeight / 2) < 0;
|
|
238
|
+
var R = (t === "edge" ? r.top + i.offsetHeight - l : r.bottom + i.offsetHeight / 2) > f;
|
|
239
|
+
// Handle each of the four placement options individually.
|
|
240
|
+
if (O === "above") {
|
|
241
|
+
if (!P && h) {
|
|
242
|
+
if (E) {
|
|
243
|
+
return z(I(I({}, e), {}, {
|
|
244
|
+
placement: "below"
|
|
245
|
+
}));
|
|
246
|
+
}
|
|
247
|
+
if (p && j) {
|
|
248
|
+
return z(I(I({}, e), {}, {
|
|
249
|
+
placement: "right"
|
|
250
|
+
}));
|
|
251
|
+
}
|
|
252
|
+
if (p && C) {
|
|
253
|
+
return z(I(I({}, e), {}, {
|
|
254
|
+
placement: "left"
|
|
255
|
+
}));
|
|
256
|
+
}
|
|
257
|
+
if (o) {
|
|
258
|
+
O = "misaligned";
|
|
259
|
+
b = 0;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (O !== "misaligned") {
|
|
263
|
+
g = f - b - i.offsetHeight;
|
|
264
|
+
if (n) {
|
|
265
|
+
g = Math.min(g, f - n.top);
|
|
266
|
+
}
|
|
267
|
+
b = "auto";
|
|
268
|
+
}
|
|
269
|
+
if (x) {
|
|
270
|
+
y = Math.max(s - i.offsetWidth, 0);
|
|
271
|
+
} else if (A) {
|
|
272
|
+
y = 0;
|
|
273
|
+
}
|
|
274
|
+
if (!o) {
|
|
275
|
+
S = r.top;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (O === "below") {
|
|
279
|
+
if (!E && h) {
|
|
280
|
+
if (P && k) {
|
|
281
|
+
return z(I(I({}, e), {}, {
|
|
282
|
+
placement: "above"
|
|
283
|
+
}));
|
|
284
|
+
}
|
|
285
|
+
if (p && j) {
|
|
286
|
+
return z(I(I({}, e), {}, {
|
|
287
|
+
placement: "right"
|
|
288
|
+
}));
|
|
289
|
+
}
|
|
290
|
+
if (p && C) {
|
|
291
|
+
return z(I(I({}, e), {}, {
|
|
292
|
+
placement: "left"
|
|
293
|
+
}));
|
|
294
|
+
}
|
|
295
|
+
if (o) {
|
|
296
|
+
O = "misaligned";
|
|
297
|
+
b = 0;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
if (n) {
|
|
301
|
+
b = Math.min(b, n.bottom);
|
|
302
|
+
}
|
|
303
|
+
if (x) {
|
|
304
|
+
y = Math.max(s - i.offsetWidth, 0);
|
|
305
|
+
} else if (A) {
|
|
306
|
+
y = 0;
|
|
307
|
+
}
|
|
308
|
+
if (!o) {
|
|
309
|
+
S = f - r.bottom;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
if (O === "left") {
|
|
313
|
+
if (!C && h) {
|
|
314
|
+
if (j) {
|
|
315
|
+
return z(I(I({}, e), {}, {
|
|
316
|
+
placement: "right"
|
|
317
|
+
}));
|
|
318
|
+
}
|
|
319
|
+
if (p && E) {
|
|
320
|
+
return z(I(I({}, e), {}, {
|
|
321
|
+
placement: "below"
|
|
322
|
+
}));
|
|
323
|
+
}
|
|
324
|
+
if (p && P) {
|
|
325
|
+
return z(I(I({}, e), {}, {
|
|
326
|
+
placement: "above"
|
|
327
|
+
}));
|
|
328
|
+
}
|
|
329
|
+
if (o) {
|
|
330
|
+
O = "misaligned";
|
|
331
|
+
b = 0;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
if (T) {
|
|
335
|
+
b = 0;
|
|
336
|
+
} else if (R) {
|
|
337
|
+
b = Math.max(f - i.offsetHeight, 0);
|
|
338
|
+
}
|
|
339
|
+
if (!o) {
|
|
340
|
+
w = r.left;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
if (O === "right") {
|
|
344
|
+
if (!j && h) {
|
|
345
|
+
if (C) {
|
|
346
|
+
return z(I(I({}, e), {}, {
|
|
347
|
+
placement: "left"
|
|
348
|
+
}));
|
|
349
|
+
}
|
|
350
|
+
if (p && E) {
|
|
351
|
+
return z(I(I({}, e), {}, {
|
|
352
|
+
placement: "below"
|
|
353
|
+
}));
|
|
354
|
+
}
|
|
355
|
+
if (p && P) {
|
|
356
|
+
return z(I(I({}, e), {}, {
|
|
357
|
+
placement: "above"
|
|
358
|
+
}));
|
|
359
|
+
}
|
|
360
|
+
if (o) {
|
|
361
|
+
O = "misaligned";
|
|
362
|
+
b = 0;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
if (T) {
|
|
366
|
+
b = 0;
|
|
367
|
+
} else if (R) {
|
|
368
|
+
b = Math.max(f - i.offsetHeight, 0);
|
|
369
|
+
}
|
|
370
|
+
if (!o) {
|
|
371
|
+
w = s - r.left;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
361
374
|
return {
|
|
362
|
-
|
|
363
|
-
|
|
375
|
+
placement: O,
|
|
376
|
+
maxHeight: S,
|
|
377
|
+
maxWidth: w,
|
|
378
|
+
outerContainerStyle: {
|
|
379
|
+
top: b,
|
|
380
|
+
left: y,
|
|
381
|
+
bottom: g
|
|
382
|
+
}
|
|
364
383
|
};
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
return {
|
|
368
|
-
top: anchorPos.bottom,
|
|
369
|
-
left: align === 'edge' ? anchorPos.left - padding : anchorPos.middle - outerContainerEl.offsetWidth / 2
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
case 'left':
|
|
373
|
-
return {
|
|
374
|
-
top: align === 'edge' ? anchorPos.top - padding : anchorPos.center - outerContainerEl.offsetHeight / 2,
|
|
375
|
-
left: anchorPos.left - outerContainerEl.offsetWidth
|
|
376
|
-
};
|
|
377
|
-
|
|
378
|
-
case 'right':
|
|
379
|
-
return {
|
|
380
|
-
top: align === 'edge' ? anchorPos.top - padding : anchorPos.center - outerContainerEl.offsetHeight / 2,
|
|
381
|
-
left: anchorPos.right
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
default:
|
|
385
|
-
throw new Error("".concat(placement, " is not a valid placement value. Valid options are: 'above', 'below', 'left', or 'right'"));
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
function getPlacement(args) {
|
|
390
|
-
var align = args.align,
|
|
391
|
-
anchorPos = args.anchorPos,
|
|
392
|
-
scrollContainerPos = args.scrollContainerPos,
|
|
393
|
-
canCoverAnchor = args.canCoverAnchor,
|
|
394
|
-
defaultPlacement = args.defaultPlacement,
|
|
395
|
-
outerContainerEl = args.outerContainerEl,
|
|
396
|
-
padding = args.padding,
|
|
397
|
-
repositionMode = args.repositionMode,
|
|
398
|
-
windowHeight = args.windowHeight,
|
|
399
|
-
windowWidth = args.windowWidth;
|
|
400
|
-
var repositionFlip = repositionMode === 'flip';
|
|
401
|
-
var repositionAny = repositionMode === 'any';
|
|
402
|
-
var canReposition = repositionFlip || repositionAny;
|
|
403
|
-
var placement = args.placement || defaultPlacement; // Translate vertical/horizontal to above/below/left/right
|
|
404
|
-
|
|
405
|
-
if (defaultPlacement === 'vertical') {
|
|
406
|
-
placement = anchorPos.top > windowHeight - anchorPos.bottom ? 'above' : 'below';
|
|
407
|
-
} else if (defaultPlacement === 'horizontal') {
|
|
408
|
-
placement = anchorPos.left > windowWidth - anchorPos.right ? 'left' : 'right';
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
var resolvedPlacement = placement; // Initialize the result variables. These will be mutated as needed and returned.
|
|
412
|
-
|
|
413
|
-
var _getInitialStyle = getInitialStyle({
|
|
414
|
-
align: align,
|
|
415
|
-
anchorPos: anchorPos,
|
|
416
|
-
outerContainerEl: outerContainerEl,
|
|
417
|
-
padding: padding,
|
|
418
|
-
placement: resolvedPlacement
|
|
419
|
-
}),
|
|
420
|
-
top = _getInitialStyle.top,
|
|
421
|
-
left = _getInitialStyle.left;
|
|
422
|
-
|
|
423
|
-
var bottom = 'auto';
|
|
424
|
-
var maxWidth = windowWidth;
|
|
425
|
-
var maxHeight = windowHeight;
|
|
426
|
-
var placementStatus = resolvedPlacement; // Boolean convenience variables to simplify positioning logic.
|
|
427
|
-
|
|
428
|
-
var canPlaceAbove = anchorPos.top - outerContainerEl.offsetHeight > 0;
|
|
429
|
-
var canPlaceBelow = anchorPos.bottom + outerContainerEl.offsetHeight < windowHeight;
|
|
430
|
-
var canPlaceLeft = anchorPos.left - outerContainerEl.offsetWidth > 0;
|
|
431
|
-
var canPlaceRight = anchorPos.right + outerContainerEl.offsetWidth < windowWidth;
|
|
432
|
-
var significantlyMoreSpaceAbove = anchorPos.top * 0.7 > windowHeight - anchorPos.bottom;
|
|
433
|
-
var offScreenRight = (align === 'edge' ? anchorPos.left + outerContainerEl.offsetWidth - padding : anchorPos.middle + outerContainerEl.offsetWidth / 2) > windowWidth;
|
|
434
|
-
var offScreenLeft = (align === 'edge' ? anchorPos.left - padding : anchorPos.middle - outerContainerEl.offsetWidth / 2) < 0;
|
|
435
|
-
var offScreenTop = (align === 'edge' ? anchorPos.top - padding : anchorPos.top - outerContainerEl.offsetHeight / 2) < 0;
|
|
436
|
-
var offScreenBottom = (align === 'edge' ? anchorPos.top + outerContainerEl.offsetHeight - padding : anchorPos.bottom + outerContainerEl.offsetHeight / 2) > windowHeight; // Handle each of the four placement options individually.
|
|
437
|
-
|
|
438
|
-
if (placementStatus === 'above') {
|
|
439
|
-
if (!canPlaceAbove && canReposition) {
|
|
440
|
-
if (canPlaceBelow) {
|
|
441
|
-
return getPlacement(_objectSpread(_objectSpread({}, args), {}, {
|
|
442
|
-
placement: 'below'
|
|
443
|
-
}));
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
if (repositionAny && canPlaceRight) {
|
|
447
|
-
return getPlacement(_objectSpread(_objectSpread({}, args), {}, {
|
|
448
|
-
placement: 'right'
|
|
449
|
-
}));
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
if (repositionAny && canPlaceLeft) {
|
|
453
|
-
return getPlacement(_objectSpread(_objectSpread({}, args), {}, {
|
|
454
|
-
placement: 'left'
|
|
455
|
-
}));
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
if (canCoverAnchor) {
|
|
459
|
-
placementStatus = 'misaligned';
|
|
460
|
-
top = 0;
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
if (placementStatus !== 'misaligned') {
|
|
465
|
-
bottom = windowHeight - top - outerContainerEl.offsetHeight;
|
|
466
|
-
|
|
467
|
-
if (scrollContainerPos) {
|
|
468
|
-
bottom = Math.min(bottom, windowHeight - scrollContainerPos.top);
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
top = 'auto';
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
if (offScreenRight) {
|
|
475
|
-
left = Math.max(windowWidth - outerContainerEl.offsetWidth, 0);
|
|
476
|
-
} else if (offScreenLeft) {
|
|
477
|
-
left = 0;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
if (!canCoverAnchor) {
|
|
481
|
-
maxHeight = anchorPos.top;
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
if (placementStatus === 'below') {
|
|
486
|
-
if (!canPlaceBelow && canReposition) {
|
|
487
|
-
if (canPlaceAbove && significantlyMoreSpaceAbove) {
|
|
488
|
-
return getPlacement(_objectSpread(_objectSpread({}, args), {}, {
|
|
489
|
-
placement: 'above'
|
|
490
|
-
}));
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
if (repositionAny && canPlaceRight) {
|
|
494
|
-
return getPlacement(_objectSpread(_objectSpread({}, args), {}, {
|
|
495
|
-
placement: 'right'
|
|
496
|
-
}));
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
if (repositionAny && canPlaceLeft) {
|
|
500
|
-
return getPlacement(_objectSpread(_objectSpread({}, args), {}, {
|
|
501
|
-
placement: 'left'
|
|
502
|
-
}));
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
if (canCoverAnchor) {
|
|
506
|
-
placementStatus = 'misaligned';
|
|
507
|
-
top = 0;
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
if (scrollContainerPos) {
|
|
512
|
-
top = Math.min(top, scrollContainerPos.bottom);
|
|
513
384
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
return
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
385
|
+
// CONCATENATED MODULE: ./src/Popover/PopoverContext.tsx
|
|
386
|
+
var $ = (0, r.createContext)({});
|
|
387
|
+
// CONCATENATED MODULE: external "react-spring"
|
|
388
|
+
const U = require("react-spring");
|
|
389
|
+
// CONCATENATED MODULE: external "styled-components"
|
|
390
|
+
const K = require("styled-components");
|
|
391
|
+
var V = e.n(K);
|
|
392
|
+
// CONCATENATED MODULE: ./src/Popover/PopoverStyles.ts
|
|
393
|
+
var B = (0, A.pick)({
|
|
394
|
+
enterprise: "8px",
|
|
395
|
+
prisma: 0
|
|
396
|
+
});
|
|
397
|
+
var X = V()(U.animated.div).withConfig({
|
|
398
|
+
displayName: "PopoverStyles__Styled",
|
|
399
|
+
componentId: "sc-1nahsvw-0"
|
|
400
|
+
})([ "position:fixed;z-index:", ";left:-300%;top:-300%;" ], A.variables.zindexPopover);
|
|
401
|
+
var Y = V().div.withConfig({
|
|
402
|
+
displayName: "PopoverStyles__StyledBox",
|
|
403
|
+
componentId: "sc-1nahsvw-1"
|
|
404
|
+
})([ "", ";", ";", ";" ], A.mixins.reset("block"), (function(e) {
|
|
405
|
+
var t = e.$open;
|
|
406
|
+
return !t && (0, K.css)([ "pointer-events:none;" ]);
|
|
407
|
+
}), (function(e) {
|
|
408
|
+
var t = e.$appearance;
|
|
409
|
+
return t !== "none" && (0, K.css)([ "padding:8px;" ]);
|
|
410
|
+
}));
|
|
411
|
+
var G = V().div.withConfig({
|
|
412
|
+
displayName: "PopoverStyles__StyledContent",
|
|
413
|
+
componentId: "sc-1nahsvw-2"
|
|
414
|
+
})([ "", "" ], (0, A.pickVariant)("$appearance", {
|
|
415
|
+
normal: (0, K.css)([ "background-color:", ";color:", ";border:", ";box-shadow:", ";border-radius:", ";" ], A.variables.backgroundColorPopup, A.variables.contentColorDefault, (0,
|
|
416
|
+
A.pick)({
|
|
417
|
+
enterprise: {
|
|
418
|
+
light: A.variables.border,
|
|
419
|
+
dark: A.variables.border
|
|
420
|
+
},
|
|
421
|
+
prisma: "none"
|
|
422
|
+
}), (0, A.pick)({
|
|
423
|
+
enterprise: {
|
|
424
|
+
light: (0, K.css)([ "0 2px 2px ", "" ], A.mixins.colorWithAlpha(A.variables.gray20, .1)),
|
|
425
|
+
dark: "0 1px 2px #000"
|
|
426
|
+
},
|
|
427
|
+
prisma: A.variables.overlayShadow
|
|
428
|
+
}), A.variables.borderRadius),
|
|
429
|
+
// Enterprise Only
|
|
430
|
+
inverted: (0, K.css)([ "background-color:", ";color:", ";" ], (0, A.pick)({
|
|
431
|
+
light: A.variables.gray20,
|
|
432
|
+
dark: A.variables.white
|
|
433
|
+
}), (0, A.pick)({
|
|
434
|
+
light: A.variables.white,
|
|
435
|
+
dark: A.variables.gray30
|
|
436
|
+
}))
|
|
437
|
+
}));
|
|
438
|
+
// Enterprise Only
|
|
439
|
+
var J = V().div.withConfig({
|
|
440
|
+
displayName: "PopoverStyles__StyledArrow",
|
|
441
|
+
componentId: "sc-1nahsvw-3"
|
|
442
|
+
})([ "width:0;height:0;border-left:", " solid transparent;border-right:", " solid transparent;position:absolute;border-bottom-width:", ";border-bottom-style:solid;", "" ], B, B, B, (0,
|
|
443
|
+
A.pickVariant)("$appearance", {
|
|
444
|
+
normal: (0, K.css)([ "border-bottom-color:", ";&::before{content:'';display:block;width:0;height:0;border-left:", " solid transparent;border-right:", " solid transparent;border-bottom:", " solid ", ";position:absolute;top:1px;left:0;margin-left:-", ";}" ], (0,
|
|
445
|
+
A.pick)({
|
|
446
|
+
light: A.variables.borderColor,
|
|
447
|
+
dark: A.variables.black
|
|
448
|
+
}), B, B, B, A.variables.backgroundColor, B),
|
|
449
|
+
inverted: (0, K.css)([ "border-bottom-color:", ";" ], (0, A.pick)({
|
|
450
|
+
light: A.variables.gray20,
|
|
451
|
+
dark: A.variables.white
|
|
452
|
+
}))
|
|
453
|
+
}));
|
|
454
|
+
var Q = V().div.withConfig({
|
|
455
|
+
displayName: "PopoverStyles__StyledLowerRightCorner",
|
|
456
|
+
componentId: "sc-1nahsvw-4"
|
|
457
|
+
})([ "position:fixed;right:0;bottom:0;" ]);
|
|
458
|
+
var Z = V().svg.withConfig({
|
|
459
|
+
displayName: "PopoverStyles__StyledHitArea",
|
|
460
|
+
componentId: "sc-1nahsvw-5"
|
|
461
|
+
})([ "position:fixed;pointer-events:none;path{pointer-events:auto;stroke-width:0;stroke:transparent;fill:transparent;}" ]);
|
|
462
|
+
// CONCATENATED MODULE: ./src/Popover/PopoverHitArea.tsx
|
|
463
|
+
function ee(e, t) {
|
|
464
|
+
return ae(e) || oe(e, t) || re(e, t) || te();
|
|
593
465
|
}
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
maxWidth = windowWidth - anchorPos.left;
|
|
466
|
+
function te() {
|
|
467
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
597
468
|
}
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
top: top,
|
|
606
|
-
left: left,
|
|
607
|
-
bottom: bottom
|
|
469
|
+
function re(e, t) {
|
|
470
|
+
if (!e) return;
|
|
471
|
+
if (typeof e === "string") return ne(e, t);
|
|
472
|
+
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
473
|
+
if (r === "Object" && e.constructor) r = e.constructor.name;
|
|
474
|
+
if (r === "Map" || r === "Set") return Array.from(e);
|
|
475
|
+
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return ne(e, t);
|
|
608
476
|
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
var PopoverContext = /*#__PURE__*/Object(external_react_["createContext"])({});
|
|
614
|
-
|
|
615
|
-
// EXTERNAL MODULE: external "react-spring"
|
|
616
|
-
var external_react_spring_ = __webpack_require__(24);
|
|
617
|
-
|
|
618
|
-
// EXTERNAL MODULE: external "styled-components"
|
|
619
|
-
var external_styled_components_ = __webpack_require__(3);
|
|
620
|
-
var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_);
|
|
621
|
-
|
|
622
|
-
// CONCATENATED MODULE: ./src/Popover/PopoverStyles.ts
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
var PopoverStyles_arrowHeight = Object(themes_["pick"])({
|
|
627
|
-
enterprise: '8px',
|
|
628
|
-
prisma: 0
|
|
629
|
-
});
|
|
630
|
-
var Styled = external_styled_components_default()(external_react_spring_["animated"].div).withConfig({
|
|
631
|
-
displayName: "PopoverStyles__Styled",
|
|
632
|
-
componentId: "sc-1nahsvw-0"
|
|
633
|
-
})(["position:fixed;z-index:", ";left:-300%;top:-300%;"], themes_["variables"].zindexPopover);
|
|
634
|
-
var StyledBox = external_styled_components_default.a.div.withConfig({
|
|
635
|
-
displayName: "PopoverStyles__StyledBox",
|
|
636
|
-
componentId: "sc-1nahsvw-1"
|
|
637
|
-
})(["", ";", ";", ";"], themes_["mixins"].reset('block'), function (_ref) {
|
|
638
|
-
var $open = _ref.$open;
|
|
639
|
-
return !$open && Object(external_styled_components_["css"])(["pointer-events:none;"]);
|
|
640
|
-
}, function (_ref2) {
|
|
641
|
-
var $appearance = _ref2.$appearance;
|
|
642
|
-
return $appearance !== 'none' && Object(external_styled_components_["css"])(["padding:8px;"]);
|
|
643
|
-
});
|
|
644
|
-
var StyledContent = external_styled_components_default.a.div.withConfig({
|
|
645
|
-
displayName: "PopoverStyles__StyledContent",
|
|
646
|
-
componentId: "sc-1nahsvw-2"
|
|
647
|
-
})(["", ""], Object(themes_["pickVariant"])('$appearance', {
|
|
648
|
-
normal: Object(external_styled_components_["css"])(["background-color:", ";color:", ";border:", ";box-shadow:", ";border-radius:", ";"], themes_["variables"].backgroundColorPopup, themes_["variables"].contentColorDefault, Object(themes_["pick"])({
|
|
649
|
-
enterprise: {
|
|
650
|
-
light: themes_["variables"].border,
|
|
651
|
-
dark: themes_["variables"].border
|
|
652
|
-
},
|
|
653
|
-
prisma: 'none'
|
|
654
|
-
}), Object(themes_["pick"])({
|
|
655
|
-
enterprise: {
|
|
656
|
-
light: Object(external_styled_components_["css"])(["0 2px 2px ", ""], themes_["mixins"].colorWithAlpha(themes_["variables"].gray20, 0.1)),
|
|
657
|
-
dark: '0 1px 2px #000'
|
|
658
|
-
},
|
|
659
|
-
prisma: themes_["variables"].overlayShadow
|
|
660
|
-
}), themes_["variables"].borderRadius),
|
|
661
|
-
// Enterprise Only
|
|
662
|
-
inverted: Object(external_styled_components_["css"])(["background-color:", ";color:", ";"], Object(themes_["pick"])({
|
|
663
|
-
light: themes_["variables"].gray20,
|
|
664
|
-
dark: themes_["variables"].white
|
|
665
|
-
}), Object(themes_["pick"])({
|
|
666
|
-
light: themes_["variables"].white,
|
|
667
|
-
dark: themes_["variables"].gray30
|
|
668
|
-
}))
|
|
669
|
-
})); // Enterprise Only
|
|
670
|
-
|
|
671
|
-
var StyledArrow = external_styled_components_default.a.div.withConfig({
|
|
672
|
-
displayName: "PopoverStyles__StyledArrow",
|
|
673
|
-
componentId: "sc-1nahsvw-3"
|
|
674
|
-
})(["width:0;height:0;border-left:", " solid transparent;border-right:", " solid transparent;position:absolute;border-bottom-width:", ";border-bottom-style:solid;", ""], PopoverStyles_arrowHeight, PopoverStyles_arrowHeight, PopoverStyles_arrowHeight, Object(themes_["pickVariant"])('$appearance', {
|
|
675
|
-
normal: Object(external_styled_components_["css"])(["border-bottom-color:", ";&::before{content:'';display:block;width:0;height:0;border-left:", " solid transparent;border-right:", " solid transparent;border-bottom:", " solid ", ";position:absolute;top:1px;left:0;margin-left:-", ";}"], Object(themes_["pick"])({
|
|
676
|
-
light: themes_["variables"].borderColor,
|
|
677
|
-
dark: themes_["variables"].black
|
|
678
|
-
}), PopoverStyles_arrowHeight, PopoverStyles_arrowHeight, PopoverStyles_arrowHeight, themes_["variables"].backgroundColor, PopoverStyles_arrowHeight),
|
|
679
|
-
inverted: Object(external_styled_components_["css"])(["border-bottom-color:", ";"], Object(themes_["pick"])({
|
|
680
|
-
light: themes_["variables"].gray20,
|
|
681
|
-
dark: themes_["variables"].white
|
|
682
|
-
}))
|
|
683
|
-
}));
|
|
684
|
-
var StyledLowerRightCorner = external_styled_components_default.a.div.withConfig({
|
|
685
|
-
displayName: "PopoverStyles__StyledLowerRightCorner",
|
|
686
|
-
componentId: "sc-1nahsvw-4"
|
|
687
|
-
})(["position:fixed;right:0;bottom:0;"]);
|
|
688
|
-
var StyledHitArea = external_styled_components_default.a.svg.withConfig({
|
|
689
|
-
displayName: "PopoverStyles__StyledHitArea",
|
|
690
|
-
componentId: "sc-1nahsvw-5"
|
|
691
|
-
})(["position:fixed;pointer-events:none;path{pointer-events:auto;stroke-width:0;stroke:transparent;fill:transparent;}"]);
|
|
692
|
-
|
|
693
|
-
// CONCATENATED MODULE: ./src/Popover/PopoverHitArea.tsx
|
|
694
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
695
|
-
|
|
696
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
697
|
-
|
|
698
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
699
|
-
|
|
700
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
701
|
-
|
|
702
|
-
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
703
|
-
|
|
704
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
var propTypes = {
|
|
710
|
-
anchorRect: external_prop_types_default.a.object,
|
|
711
|
-
popoverEl: external_prop_types_default.a.object,
|
|
712
|
-
popoverPlacement: external_prop_types_default.a.oneOf(['above', 'below', 'left', 'right', 'misaligned'])
|
|
713
|
-
};
|
|
714
|
-
|
|
715
|
-
var getHitAreaSettings = function getHitAreaSettings(_ref) {
|
|
716
|
-
var anchorRect = _ref.anchorRect,
|
|
717
|
-
popoverEl = _ref.popoverEl,
|
|
718
|
-
popoverPlacement = _ref.popoverPlacement;
|
|
719
|
-
|
|
720
|
-
if (anchorRect != null && popoverEl != null && popoverPlacement != null) {
|
|
721
|
-
var menuRect = popoverEl.getBoundingClientRect();
|
|
722
|
-
|
|
723
|
-
if (popoverPlacement === 'above' || popoverPlacement === 'below') {
|
|
724
|
-
var anchorLeftEdge = anchorRect.left - menuRect.left;
|
|
725
|
-
var verticalStart = anchorRect.height;
|
|
726
|
-
var verticalEnd = 0;
|
|
727
|
-
|
|
728
|
-
if (popoverPlacement === 'above') {
|
|
729
|
-
verticalStart = 0;
|
|
730
|
-
verticalEnd = anchorRect.height;
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
var menuStart = "0 ".concat(verticalStart);
|
|
734
|
-
var menuEnd = "".concat(menuRect.width, " ").concat(verticalStart);
|
|
735
|
-
var anchorStartNear = "".concat(anchorLeftEdge, " ").concat(verticalStart);
|
|
736
|
-
var anchorStartFar = "".concat(anchorLeftEdge, " ").concat(verticalEnd);
|
|
737
|
-
var anchorEndNear = "".concat(anchorLeftEdge + anchorRect.width, " ").concat(verticalStart);
|
|
738
|
-
var anchorEndFar = "".concat(anchorLeftEdge + anchorRect.width, " ").concat(verticalEnd);
|
|
739
|
-
var hitAreaPath = "\n M ".concat(menuStart, "\n S ").concat(anchorStartNear, " , ").concat(anchorStartFar, "\n L ").concat(anchorStartNear, "\n L ").concat(anchorEndNear, "\n L ").concat(anchorEndFar, "\n S ").concat(anchorEndNear, " , ").concat(menuEnd, "\n ");
|
|
740
|
-
return {
|
|
741
|
-
hitAreaPath: hitAreaPath,
|
|
742
|
-
hitAreaStyle: {
|
|
743
|
-
left: menuRect.left,
|
|
744
|
-
top: anchorRect.top,
|
|
745
|
-
width: menuRect.width,
|
|
746
|
-
height: anchorRect.height
|
|
477
|
+
function ne(e, t) {
|
|
478
|
+
if (t == null || t > e.length) t = e.length;
|
|
479
|
+
for (var r = 0, n = new Array(t); r < t; r++) {
|
|
480
|
+
n[r] = e[r];
|
|
747
481
|
}
|
|
748
|
-
|
|
482
|
+
return n;
|
|
749
483
|
}
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
var _anchorEndFar = "".concat(horizontalEnd, " ").concat(anchorTopEdge + anchorRect.height);
|
|
772
|
-
|
|
773
|
-
var _hitAreaPath = "\n M ".concat(_menuStart, "\n S ").concat(_anchorStartNear, " , ").concat(_anchorStartFar, "\n L ").concat(_anchorStartNear, "\n L ").concat(_anchorEndNear, "\n L ").concat(_anchorEndFar, "\n S ").concat(_anchorEndNear, " , ").concat(_menuEnd, "\n ");
|
|
774
|
-
|
|
775
|
-
return {
|
|
776
|
-
hitAreaPath: _hitAreaPath,
|
|
777
|
-
hitAreaStyle: {
|
|
778
|
-
left: anchorRect.left,
|
|
779
|
-
top: menuRect.top,
|
|
780
|
-
width: anchorRect.width,
|
|
781
|
-
height: menuRect.height
|
|
484
|
+
function oe(e, t) {
|
|
485
|
+
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(e))) return;
|
|
486
|
+
var r = [];
|
|
487
|
+
var n = true;
|
|
488
|
+
var o = false;
|
|
489
|
+
var a = undefined;
|
|
490
|
+
try {
|
|
491
|
+
for (var i = e[Symbol.iterator](), l; !(n = (l = i.next()).done); n = true) {
|
|
492
|
+
r.push(l.value);
|
|
493
|
+
if (t && r.length === t) break;
|
|
494
|
+
}
|
|
495
|
+
} catch (e) {
|
|
496
|
+
o = true;
|
|
497
|
+
a = e;
|
|
498
|
+
} finally {
|
|
499
|
+
try {
|
|
500
|
+
if (!n && i["return"] != null) i["return"]();
|
|
501
|
+
} finally {
|
|
502
|
+
if (o) throw a;
|
|
503
|
+
}
|
|
782
504
|
}
|
|
783
|
-
|
|
505
|
+
return r;
|
|
784
506
|
}
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
var
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
var
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
function
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
function
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
function
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
function
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
941
|
-
|
|
942
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
943
|
-
|
|
944
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
945
|
-
|
|
946
|
-
function Popover_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
/** @public */
|
|
976
|
-
|
|
977
|
-
var possibleCloseReasons = ['clickAway', 'escapeKey', 'offScreen', 'tabKey'];
|
|
978
|
-
var Popover_propTypes = {
|
|
979
|
-
align: external_prop_types_default.a.oneOf(['center', 'edge', 'theme', 'end']),
|
|
980
|
-
anchor: external_prop_types_default.a.object,
|
|
981
|
-
animation: external_prop_types_default.a.bool,
|
|
982
|
-
animationConfig: external_prop_types_default.a.object,
|
|
983
|
-
appearance: external_prop_types_default.a.oneOf(['normal', 'inverted', 'none']),
|
|
984
|
-
autoCloseWhenOffScreen: external_prop_types_default.a.bool,
|
|
985
|
-
canCoverAnchor: external_prop_types_default.a.bool,
|
|
986
|
-
children: external_prop_types_default.a.oneOfType([external_prop_types_default.a.node, external_prop_types_default.a.func]),
|
|
987
|
-
closeReasons: external_prop_types_default.a.arrayOf(external_prop_types_default.a.oneOf(possibleCloseReasons)),
|
|
988
|
-
defaultPlacement: external_prop_types_default.a.oneOf(['above', 'below', 'left', 'right', 'vertical', 'horizontal']),
|
|
989
|
-
elementRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
|
|
990
|
-
id: external_prop_types_default.a.string,
|
|
991
|
-
hitAreaRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
|
|
992
|
-
onRequestClose: external_prop_types_default.a.func,
|
|
993
|
-
open: external_prop_types_default.a.bool,
|
|
994
|
-
outerRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
|
|
995
|
-
pointTo: external_prop_types_default.a.shape({
|
|
996
|
-
x: external_prop_types_default.a.number,
|
|
997
|
-
y: external_prop_types_default.a.number
|
|
998
|
-
}),
|
|
999
|
-
repositionMode: external_prop_types_default.a.oneOf(['none', 'flip', 'any']),
|
|
1000
|
-
retainFocus: external_prop_types_default.a.bool,
|
|
1001
|
-
takeFocus: external_prop_types_default.a.bool,
|
|
1002
|
-
splunkTheme: external_prop_types_default.a.object
|
|
1003
|
-
};
|
|
1004
|
-
var defaultProps = {
|
|
1005
|
-
align: 'theme',
|
|
1006
|
-
animation: true,
|
|
1007
|
-
animationConfig: {},
|
|
1008
|
-
appearance: 'normal',
|
|
1009
|
-
autoCloseWhenOffScreen: true,
|
|
1010
|
-
canCoverAnchor: false,
|
|
1011
|
-
closeReasons: possibleCloseReasons,
|
|
1012
|
-
defaultPlacement: 'below',
|
|
1013
|
-
open: false,
|
|
1014
|
-
repositionMode: 'flip',
|
|
1015
|
-
retainFocus: true,
|
|
1016
|
-
takeFocus: false
|
|
1017
|
-
};
|
|
1018
|
-
|
|
1019
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
1020
|
-
function everyApproxEqual(a, b) {
|
|
1021
|
-
var threshold = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
1022
|
-
return !!a && !!b && every_default()(a, function (val, key) {
|
|
1023
|
-
if (isFinite_default()(val)) {
|
|
1024
|
-
return Math.abs(b[key] - val) <= threshold;
|
|
507
|
+
function ae(e) {
|
|
508
|
+
if (Array.isArray(e)) return e;
|
|
509
|
+
}
|
|
510
|
+
var ie = {
|
|
511
|
+
anchorRect: a().object,
|
|
512
|
+
popoverEl: a().object,
|
|
513
|
+
popoverPlacement: a().oneOf([ "above", "below", "left", "right", "misaligned" ])
|
|
514
|
+
};
|
|
515
|
+
var le = function e(t) {
|
|
516
|
+
var r = t.anchorRect, n = t.popoverEl, o = t.popoverPlacement;
|
|
517
|
+
if (r != null && n != null && o != null) {
|
|
518
|
+
var a = n.getBoundingClientRect();
|
|
519
|
+
if (o === "above" || o === "below") {
|
|
520
|
+
var i = r.left - a.left;
|
|
521
|
+
var l = r.height;
|
|
522
|
+
var c = 0;
|
|
523
|
+
if (o === "above") {
|
|
524
|
+
l = 0;
|
|
525
|
+
c = r.height;
|
|
526
|
+
}
|
|
527
|
+
var f = "0 ".concat(l);
|
|
528
|
+
var s = "".concat(a.width, " ").concat(l);
|
|
529
|
+
var u = "".concat(i, " ").concat(l);
|
|
530
|
+
var p = "".concat(i, " ").concat(c);
|
|
531
|
+
var h = "".concat(i + r.width, " ").concat(l);
|
|
532
|
+
var d = "".concat(i + r.width, " ").concat(c);
|
|
533
|
+
var v = "\n M ".concat(f, "\n S ").concat(u, " , ").concat(p, "\n L ").concat(u, "\n L ").concat(h, "\n L ").concat(d, "\n S ").concat(h, " , ").concat(s, "\n ");
|
|
534
|
+
return {
|
|
535
|
+
hitAreaPath: v,
|
|
536
|
+
hitAreaStyle: {
|
|
537
|
+
left: a.left,
|
|
538
|
+
top: r.top,
|
|
539
|
+
width: a.width,
|
|
540
|
+
height: r.height
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
if (o === "left" || o === "right") {
|
|
545
|
+
var m = r.top - a.top;
|
|
546
|
+
var b = 0;
|
|
547
|
+
var y = r.width;
|
|
548
|
+
if (o === "right") {
|
|
549
|
+
b = r.width;
|
|
550
|
+
y = 0;
|
|
551
|
+
}
|
|
552
|
+
var g = "".concat(b, " 0");
|
|
553
|
+
var w = "".concat(b, " ").concat(a.height);
|
|
554
|
+
var S = "".concat(b, " ").concat(m);
|
|
555
|
+
var O = "".concat(y, " ").concat(m);
|
|
556
|
+
var P = "".concat(b, " ").concat(m + r.height);
|
|
557
|
+
var E = "".concat(y, " ").concat(m + r.height);
|
|
558
|
+
var C = "\n M ".concat(g, "\n S ").concat(S, " , ").concat(O, "\n L ").concat(S, "\n L ").concat(P, "\n L ").concat(E, "\n S ").concat(P, " , ").concat(w, "\n ");
|
|
559
|
+
return {
|
|
560
|
+
hitAreaPath: C,
|
|
561
|
+
hitAreaStyle: {
|
|
562
|
+
left: r.left,
|
|
563
|
+
top: a.top,
|
|
564
|
+
width: r.width,
|
|
565
|
+
height: a.height
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
return {
|
|
571
|
+
hitAreaPath: null,
|
|
572
|
+
hitAreaStyle: {}
|
|
573
|
+
};
|
|
574
|
+
};
|
|
575
|
+
var ce = n().forwardRef((function(e, t) {
|
|
576
|
+
var o = e.anchorRect, a = e.popoverEl, i = e.popoverPlacement;
|
|
577
|
+
var l = (0, r.useState)(null), c = ee(l, 2), f = c[0], s = c[1];
|
|
578
|
+
var u = (0, r.useState)({}), p = ee(u, 2), h = p[0], d = p[1];
|
|
579
|
+
(0, r.useEffect)((function() {
|
|
580
|
+
var e = le({
|
|
581
|
+
anchorRect: o,
|
|
582
|
+
popoverEl: a,
|
|
583
|
+
popoverPlacement: i
|
|
584
|
+
}), t = e.hitAreaPath, r = e.hitAreaStyle;
|
|
585
|
+
s(t);
|
|
586
|
+
d(r);
|
|
587
|
+
}), [ o, a, i ]);
|
|
588
|
+
if (f != null) {
|
|
589
|
+
|
|
590
|
+
return n().createElement(Z, {
|
|
591
|
+
"data-test": "popover-hit-area",
|
|
592
|
+
style: h
|
|
593
|
+
}, n().createElement("path", {
|
|
594
|
+
d: f,
|
|
595
|
+
ref: t
|
|
596
|
+
}));
|
|
597
|
+
}
|
|
598
|
+
return null;
|
|
599
|
+
}));
|
|
600
|
+
ce.propTypes = ie;
|
|
601
|
+
/* harmony default export */ const fe = ce;
|
|
602
|
+
// CONCATENATED MODULE: ./src/utils/ssrDocument.ts
|
|
603
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
604
|
+
var se = {
|
|
605
|
+
body: {
|
|
606
|
+
appendChild: function e() {
|
|
607
|
+
return [];
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
addEventListener: function e() {},
|
|
611
|
+
removeEventListener: function e() {},
|
|
612
|
+
activeElement: {
|
|
613
|
+
blur: function e() {},
|
|
614
|
+
nodeName: ""
|
|
615
|
+
},
|
|
616
|
+
querySelector: function e() {
|
|
617
|
+
return null;
|
|
618
|
+
},
|
|
619
|
+
querySelectorAll: function e() {
|
|
620
|
+
return [];
|
|
621
|
+
},
|
|
622
|
+
getElementById: function e() {
|
|
623
|
+
return null;
|
|
624
|
+
},
|
|
625
|
+
createEvent: function e() {
|
|
626
|
+
return {
|
|
627
|
+
initEvent: function e() {}
|
|
628
|
+
};
|
|
629
|
+
},
|
|
630
|
+
createElement: function e() {
|
|
631
|
+
return {
|
|
632
|
+
children: [],
|
|
633
|
+
childNodes: [],
|
|
634
|
+
style: {},
|
|
635
|
+
setAttribute: function e() {},
|
|
636
|
+
getElementsByTagName: function e() {
|
|
637
|
+
return [];
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
},
|
|
641
|
+
createElementNS: function e() {
|
|
642
|
+
return {};
|
|
643
|
+
},
|
|
644
|
+
importNode: function e() {
|
|
645
|
+
return null;
|
|
646
|
+
},
|
|
647
|
+
location: {
|
|
648
|
+
hash: "",
|
|
649
|
+
host: "",
|
|
650
|
+
hostname: "",
|
|
651
|
+
href: "",
|
|
652
|
+
origin: "",
|
|
653
|
+
pathname: "",
|
|
654
|
+
protocol: "",
|
|
655
|
+
search: ""
|
|
656
|
+
}
|
|
657
|
+
};
|
|
658
|
+
function ue() {
|
|
659
|
+
var e = typeof document !== "undefined" ? document : se;
|
|
660
|
+
return e;
|
|
1025
661
|
}
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
_inherits(Popover, _Component);
|
|
1043
|
-
|
|
1044
|
-
var _super = _createSuper(Popover);
|
|
1045
|
-
|
|
1046
|
-
_createClass(Popover, null, [{
|
|
1047
|
-
key: "getArrowStyle",
|
|
1048
|
-
// @docs-props-type PopoverPropsBase
|
|
1049
|
-
value: function getArrowStyle(_ref) {
|
|
1050
|
-
var anchorPos = _ref.anchorPos,
|
|
1051
|
-
arrowHeight = _ref.arrowHeight,
|
|
1052
|
-
placement = _ref.placement,
|
|
1053
|
-
outerContainerStyle = _ref.outerContainerStyle,
|
|
1054
|
-
outerContainerEl = _ref.outerContainerEl;
|
|
1055
|
-
|
|
1056
|
-
if (placement === 'misaligned') {
|
|
1057
|
-
return [{
|
|
1058
|
-
display: 'none'
|
|
1059
|
-
}];
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
var style = {
|
|
1063
|
-
display: 'block'
|
|
1064
|
-
};
|
|
1065
|
-
var maxVertDiff = outerContainerEl.offsetHeight / 2 - 22;
|
|
1066
|
-
var minVertDiff = -(outerContainerEl.offsetHeight / 2 - 15);
|
|
1067
|
-
var initVertDiff = anchorPos.center - (outerContainerStyle.top + outerContainerEl.offsetHeight / 2) - arrowHeight / 2;
|
|
1068
|
-
var vertDiff = clamp_default()(initVertDiff, minVertDiff, maxVertDiff);
|
|
1069
|
-
var horizontalDiff = anchorPos.middle - (outerContainerStyle.left + outerContainerEl.offsetWidth / 2) - arrowHeight;
|
|
1070
|
-
var transformMetadata = {
|
|
1071
|
-
left: {
|
|
1072
|
-
translateX: arrowHeight / 2,
|
|
1073
|
-
translateY: vertDiff,
|
|
1074
|
-
rotate: 90
|
|
662
|
+
// CONCATENATED MODULE: ./src/utils/ssrWindow.ts
|
|
663
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
664
|
+
var pe = {
|
|
665
|
+
document: se,
|
|
666
|
+
navigator: {
|
|
667
|
+
userAgent: ""
|
|
668
|
+
},
|
|
669
|
+
location: {
|
|
670
|
+
hash: "",
|
|
671
|
+
host: "",
|
|
672
|
+
hostname: "",
|
|
673
|
+
href: "",
|
|
674
|
+
origin: "",
|
|
675
|
+
pathname: "",
|
|
676
|
+
protocol: "",
|
|
677
|
+
search: ""
|
|
1075
678
|
},
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
679
|
+
history: {
|
|
680
|
+
replaceState: function e() {},
|
|
681
|
+
pushState: function e() {},
|
|
682
|
+
go: function e() {},
|
|
683
|
+
back: function e() {}
|
|
1080
684
|
},
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
685
|
+
CustomEvent: function e() {
|
|
686
|
+
return this;
|
|
687
|
+
},
|
|
688
|
+
addEventListener: function e() {},
|
|
689
|
+
removeEventListener: function e() {},
|
|
690
|
+
getComputedStyle: function e() {
|
|
691
|
+
return {
|
|
692
|
+
getPropertyValue: function e() {
|
|
693
|
+
return "";
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
},
|
|
697
|
+
Image: function e() {},
|
|
698
|
+
Date: function e() {},
|
|
699
|
+
screen: {},
|
|
700
|
+
setTimeout: function e() {},
|
|
701
|
+
clearTimeout: function e() {},
|
|
702
|
+
matchMedia: function e() {
|
|
703
|
+
return {};
|
|
704
|
+
},
|
|
705
|
+
requestAnimationFrame: function e(t) {
|
|
706
|
+
if (typeof setTimeout === "undefined") {
|
|
707
|
+
t();
|
|
708
|
+
return null;
|
|
709
|
+
}
|
|
710
|
+
return setTimeout(t, 0);
|
|
1085
711
|
},
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
712
|
+
cancelAnimationFrame: function e(t) {
|
|
713
|
+
if (typeof setTimeout === "undefined") {
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
clearTimeout(t);
|
|
1090
717
|
}
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
var origin1 = {
|
|
1096
|
-
left: 'right',
|
|
1097
|
-
right: 'left',
|
|
1098
|
-
above: 'bottom',
|
|
1099
|
-
below: 'top'
|
|
1100
|
-
};
|
|
1101
|
-
style[origin1[placement]] = '1px';
|
|
1102
|
-
var origin2 = {
|
|
1103
|
-
left: 'top',
|
|
1104
|
-
right: 'top',
|
|
1105
|
-
above: 'left',
|
|
1106
|
-
below: 'left'
|
|
1107
|
-
};
|
|
1108
|
-
style[origin2[placement]] = '50%';
|
|
1109
|
-
return [style, transformMeta];
|
|
718
|
+
};
|
|
719
|
+
function he() {
|
|
720
|
+
var e = typeof window !== "undefined" ? window : pe;
|
|
721
|
+
return e;
|
|
1110
722
|
}
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
Popover_defineProperty(_assertThisInitialized(_this), "outerContainerEl", null);
|
|
1121
|
-
|
|
1122
|
-
Popover_defineProperty(_assertThisInitialized(_this), "innerContainerEl", null);
|
|
1123
|
-
|
|
1124
|
-
Popover_defineProperty(_assertThisInitialized(_this), "arrow", null);
|
|
1125
|
-
|
|
1126
|
-
Popover_defineProperty(_assertThisInitialized(_this), "windowSizeMeasurementEl", null);
|
|
1127
|
-
|
|
1128
|
-
Popover_defineProperty(_assertThisInitialized(_this), "handleScroll", void 0);
|
|
1129
|
-
|
|
1130
|
-
Popover_defineProperty(_assertThisInitialized(_this), "handleWindowScroll", void 0);
|
|
1131
|
-
|
|
1132
|
-
Popover_defineProperty(_assertThisInitialized(_this), "allowAnimationUpdates", true);
|
|
1133
|
-
|
|
1134
|
-
Popover_defineProperty(_assertThisInitialized(_this), "getElPosition", function (anchorEl) {
|
|
1135
|
-
var offsets = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1136
|
-
var rect = getBoundingClientRect(anchorEl, offsets);
|
|
1137
|
-
var a = {
|
|
1138
|
-
width: anchorEl.offsetWidth,
|
|
1139
|
-
height: anchorEl.offsetHeight
|
|
1140
|
-
};
|
|
1141
|
-
var pointTo = _this.props.pointTo;
|
|
1142
|
-
var pointToHorizontal = pointTo && has_default()(pointTo, 'x');
|
|
1143
|
-
var pointToVertical = pointTo && has_default()(pointTo, 'y');
|
|
1144
|
-
a.left = pointToHorizontal ? rect.left + ((pointTo === null || pointTo === void 0 ? void 0 : pointTo.x) || 0) : rect.left;
|
|
1145
|
-
a.top = pointToVertical ? rect.top + ((pointTo === null || pointTo === void 0 ? void 0 : pointTo.y) || 0) : rect.top;
|
|
1146
|
-
a.right = pointToHorizontal ? a.left + a.width : rect.left + a.width || rect.right;
|
|
1147
|
-
a.bottom = pointToVertical ? a.top + a.height : rect.top + a.height || rect.bottom;
|
|
1148
|
-
a.middle = pointToHorizontal ? a.left : rect.left + (a.right - rect.left) / 2;
|
|
1149
|
-
a.center = pointToVertical ? a.top : rect.top + (a.bottom - rect.top) / 2;
|
|
1150
|
-
return a;
|
|
1151
|
-
});
|
|
1152
|
-
|
|
1153
|
-
Popover_defineProperty(_assertThisInitialized(_this), "setPlacement", function (scrolling) {
|
|
1154
|
-
var window = Object(ssrWindow["a" /* getWindow */])();
|
|
1155
|
-
|
|
1156
|
-
_this.setState(function (state) {
|
|
1157
|
-
var _state$arrowStyleTran;
|
|
1158
|
-
|
|
1159
|
-
var _this$props = _this.props,
|
|
1160
|
-
align = _this$props.align,
|
|
1161
|
-
anchor = _this$props.anchor,
|
|
1162
|
-
autoCloseWhenOffScreen = _this$props.autoCloseWhenOffScreen,
|
|
1163
|
-
canCoverAnchor = _this$props.canCoverAnchor,
|
|
1164
|
-
defaultPlacement = _this$props.defaultPlacement,
|
|
1165
|
-
open = _this$props.open,
|
|
1166
|
-
repositionMode = _this$props.repositionMode,
|
|
1167
|
-
splunkTheme = _this$props.splunkTheme;
|
|
1168
|
-
var scrollContainer = _this.context || window;
|
|
1169
|
-
var isPrisma = splunkTheme.isPrisma; // If these conditions are not met, we cannot set the popover.
|
|
1170
|
-
|
|
1171
|
-
if (!open || !_this.outerContainerEl || !anchor || !state.anchorEl || !_this.windowSizeMeasurementEl) {
|
|
1172
|
-
if (false) {}
|
|
1173
|
-
|
|
1174
|
-
return null;
|
|
723
|
+
// CONCATENATED MODULE: ./src/utils/getBoundingClientRect.ts
|
|
724
|
+
function de(e, t) {
|
|
725
|
+
var r = Object.keys(e);
|
|
726
|
+
if (Object.getOwnPropertySymbols) {
|
|
727
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
728
|
+
if (t) n = n.filter((function(t) {
|
|
729
|
+
return Object.getOwnPropertyDescriptor(e, t).enumerable;
|
|
730
|
+
}));
|
|
731
|
+
r.push.apply(r, n);
|
|
1175
732
|
}
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
var
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
733
|
+
return r;
|
|
734
|
+
}
|
|
735
|
+
function ve(e) {
|
|
736
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
737
|
+
var r = arguments[t] != null ? arguments[t] : {};
|
|
738
|
+
if (t % 2) {
|
|
739
|
+
de(Object(r), true).forEach((function(t) {
|
|
740
|
+
me(e, t, r[t]);
|
|
741
|
+
}));
|
|
742
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
743
|
+
Object.defineProperties(e, Object.getOwnPropertyDescriptors(r));
|
|
744
|
+
} else {
|
|
745
|
+
de(Object(r)).forEach((function(t) {
|
|
746
|
+
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
|
|
747
|
+
}));
|
|
748
|
+
}
|
|
1187
749
|
}
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
outerContainerEl: _this.outerContainerEl,
|
|
1201
|
-
padding: padding,
|
|
1202
|
-
windowWidth: _this.windowSizeMeasurementEl.offsetLeft,
|
|
1203
|
-
windowHeight: _this.windowSizeMeasurementEl.offsetTop
|
|
1204
|
-
}),
|
|
1205
|
-
placement = _getPlacement.placement,
|
|
1206
|
-
outerContainerStyle = _getPlacement.outerContainerStyle,
|
|
1207
|
-
maxHeight = _getPlacement.maxHeight,
|
|
1208
|
-
maxWidth = _getPlacement.maxWidth;
|
|
1209
|
-
|
|
1210
|
-
var _ref2 = _this.arrow ? Popover.getArrowStyle({
|
|
1211
|
-
anchorPos: anchorPos,
|
|
1212
|
-
arrowHeight: arrowHeight,
|
|
1213
|
-
outerContainerStyle: outerContainerStyle,
|
|
1214
|
-
placement: placement,
|
|
1215
|
-
outerContainerEl: _this.outerContainerEl
|
|
1216
|
-
}) : [],
|
|
1217
|
-
_ref3 = Popover_slicedToArray(_ref2, 2),
|
|
1218
|
-
arrowStyle = _ref3[0],
|
|
1219
|
-
arrowStyleTransformMeta = _ref3[1];
|
|
1220
|
-
|
|
1221
|
-
var hasArrow = _this.props.appearance !== 'none' && !isPrisma;
|
|
1222
|
-
var baseCheck = everyApproxEqual(anchorPos, state.anchorPos) && everyApproxEqual(outerContainerStyle, state.outerContainerStyle) && placement === state.placement && maxHeight === state.maxHeight && maxWidth === state.maxWidth;
|
|
1223
|
-
var arrowCheck = everyApproxEqual(omit_default()(arrowStyle, 'transform'), omit_default()(state.arrowStyle, 'transform')) && everyApproxEqual(arrowStyleTransformMeta !== null && arrowStyleTransformMeta !== void 0 ? arrowStyleTransformMeta : {}, (_state$arrowStyleTran = state.arrowStyleTransformMeta) !== null && _state$arrowStyleTran !== void 0 ? _state$arrowStyleTran : {}); // If none of the position data has changed, do not set state.
|
|
1224
|
-
|
|
1225
|
-
if (baseCheck && (!hasArrow || hasArrow && arrowCheck)) {
|
|
1226
|
-
return null;
|
|
750
|
+
return e;
|
|
751
|
+
}
|
|
752
|
+
function me(e, t, r) {
|
|
753
|
+
if (t in e) {
|
|
754
|
+
Object.defineProperty(e, t, {
|
|
755
|
+
value: r,
|
|
756
|
+
enumerable: true,
|
|
757
|
+
configurable: true,
|
|
758
|
+
writable: true
|
|
759
|
+
});
|
|
760
|
+
} else {
|
|
761
|
+
e[t] = r;
|
|
1227
762
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
763
|
+
return e;
|
|
764
|
+
}
|
|
765
|
+
// Checks if browser is Safari
|
|
766
|
+
function be() {
|
|
767
|
+
return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
768
|
+
}
|
|
769
|
+
// Formats return value to DOMRect
|
|
770
|
+
function ye(e) {
|
|
771
|
+
return ve(ve({}, e), {}, {
|
|
772
|
+
top: e.y,
|
|
773
|
+
left: e.x,
|
|
774
|
+
right: e.x + e.width,
|
|
775
|
+
bottom: e.y + e.height
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* Provides DOMRect information about the size of an element and its position relative to the viewport.
|
|
780
|
+
* Accounts for Safari's use of visual viewport and adds offsets to set as layout viewport.
|
|
781
|
+
* @param {Element} element - The element to be evaluated
|
|
782
|
+
* @param {boolean} offsets - Use when position of element relative to the layout viewport offsets are needed for Safari.
|
|
783
|
+
* @returns {Omit<DOMRect, 'toJSON'>}
|
|
784
|
+
* @public
|
|
785
|
+
*/ function ge(e, t) {
|
|
786
|
+
var r, n;
|
|
787
|
+
var o = e.getBoundingClientRect();
|
|
788
|
+
var a = be();
|
|
789
|
+
if (!t || !a) {
|
|
790
|
+
return o;
|
|
791
|
+
}
|
|
792
|
+
var i = he();
|
|
793
|
+
var l = o.left + (((r = i.visualViewport) === null || r === void 0 ? void 0 : r.offsetLeft) || 0);
|
|
794
|
+
var c = o.top + (((n = i.visualViewport) === null || n === void 0 ? void 0 : n.offsetTop) || 0);
|
|
795
|
+
var f = o.width, s = o.height;
|
|
796
|
+
return ye({
|
|
797
|
+
width: f,
|
|
798
|
+
height: s,
|
|
799
|
+
x: l,
|
|
800
|
+
y: c
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
// CONCATENATED MODULE: ./src/utils/updateReactRef.ts
|
|
804
|
+
/**
|
|
805
|
+
* Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
|
|
806
|
+
*
|
|
807
|
+
* @param ref - The React callback or object ref. Can be `null` or `undefined`.
|
|
808
|
+
* @param current - The new value of the ref.
|
|
809
|
+
*/
|
|
810
|
+
function we(e, t) {
|
|
811
|
+
if (e) {
|
|
812
|
+
if (typeof e === "function") {
|
|
813
|
+
e(t);
|
|
814
|
+
} else {
|
|
815
|
+
// the public signature of this util uses React.Ref<T> to mirror the way React types refs.
|
|
816
|
+
// the intention here is to signal "we will take care of setting 'current', not you".
|
|
817
|
+
e.current = t;
|
|
818
|
+
// eslint-disable-line no-param-reassign
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
// CONCATENATED MODULE: ./src/Popover/Popover.tsx
|
|
823
|
+
function Se(e) {
|
|
824
|
+
"@babel/helpers - typeof";
|
|
825
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
826
|
+
Se = function e(t) {
|
|
827
|
+
return typeof t;
|
|
828
|
+
};
|
|
829
|
+
} else {
|
|
830
|
+
Se = function e(t) {
|
|
831
|
+
return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
return Se(e);
|
|
835
|
+
}
|
|
836
|
+
function Oe() {
|
|
837
|
+
Oe = Object.assign || function(e) {
|
|
838
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
839
|
+
var r = arguments[t];
|
|
840
|
+
for (var n in r) {
|
|
841
|
+
if (Object.prototype.hasOwnProperty.call(r, n)) {
|
|
842
|
+
e[n] = r[n];
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
return e;
|
|
1237
847
|
};
|
|
1238
|
-
|
|
1239
|
-
}
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
Popover_defineProperty(_assertThisInitialized(_this), "handleTab", function (e) {
|
|
1277
|
-
if (_this.innerContainerEl) {
|
|
1278
|
-
if (_this.props.retainFocus) {
|
|
1279
|
-
Object(focus_["handleTab"])(_this.innerContainerEl, e);
|
|
1280
|
-
} else if (Object(focus_["isTabKey"])(e)) {
|
|
1281
|
-
var tabbableElements = Object(focus_["getSortedTabbableElements"])(_this.innerContainerEl);
|
|
1282
|
-
|
|
1283
|
-
if (tabbableElements.length > 0) {
|
|
1284
|
-
var finalTabbale = e.shiftKey ? tabbableElements[0] : tabbableElements[tabbableElements.length - 1];
|
|
1285
|
-
|
|
1286
|
-
if (finalTabbale === e.target) {
|
|
1287
|
-
_this.handleRequestClose({
|
|
1288
|
-
event: e,
|
|
1289
|
-
reason: 'tabKey'
|
|
1290
|
-
});
|
|
848
|
+
return Oe.apply(this, arguments);
|
|
849
|
+
}
|
|
850
|
+
function Pe(e) {
|
|
851
|
+
return je(e) || Ce(e) || Re(e) || Ee();
|
|
852
|
+
}
|
|
853
|
+
function Ee() {
|
|
854
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
855
|
+
}
|
|
856
|
+
function Ce(e) {
|
|
857
|
+
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(e)) return Array.from(e);
|
|
858
|
+
}
|
|
859
|
+
function je(e) {
|
|
860
|
+
if (Array.isArray(e)) return qe(e);
|
|
861
|
+
}
|
|
862
|
+
function ke(e, t) {
|
|
863
|
+
var r = Object.keys(e);
|
|
864
|
+
if (Object.getOwnPropertySymbols) {
|
|
865
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
866
|
+
if (t) n = n.filter((function(t) {
|
|
867
|
+
return Object.getOwnPropertyDescriptor(e, t).enumerable;
|
|
868
|
+
}));
|
|
869
|
+
r.push.apply(r, n);
|
|
870
|
+
}
|
|
871
|
+
return r;
|
|
872
|
+
}
|
|
873
|
+
function xe(e) {
|
|
874
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
875
|
+
var r = arguments[t] != null ? arguments[t] : {};
|
|
876
|
+
if (t % 2) {
|
|
877
|
+
ke(Object(r), true).forEach((function(t) {
|
|
878
|
+
Ke(e, t, r[t]);
|
|
879
|
+
}));
|
|
880
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
881
|
+
Object.defineProperties(e, Object.getOwnPropertyDescriptors(r));
|
|
882
|
+
} else {
|
|
883
|
+
ke(Object(r)).forEach((function(t) {
|
|
884
|
+
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
|
|
885
|
+
}));
|
|
1291
886
|
}
|
|
1292
|
-
}
|
|
1293
887
|
}
|
|
1294
|
-
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
}
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
animationConfig = _this$props2.animationConfig,
|
|
1315
|
-
appearance = _this$props2.appearance,
|
|
1316
|
-
children = _this$props2.children,
|
|
1317
|
-
id = _this$props2.id,
|
|
1318
|
-
open = _this$props2.open,
|
|
1319
|
-
retainFocus = _this$props2.retainFocus,
|
|
1320
|
-
splunkTheme = _this$props2.splunkTheme;
|
|
1321
|
-
var _this$state = _this.state,
|
|
1322
|
-
anchorPos = _this$state.anchorPos,
|
|
1323
|
-
arrowStyle = _this$state.arrowStyle,
|
|
1324
|
-
outerContainerStyle = _this$state.outerContainerStyle,
|
|
1325
|
-
placement = _this$state.placement;
|
|
1326
|
-
var isPrisma = splunkTheme.isPrisma;
|
|
1327
|
-
var displayAppearance = isPrisma && appearance === 'inverted' ? 'normal' : appearance;
|
|
1328
|
-
var _this$state2 = _this.state,
|
|
1329
|
-
maxHeight = _this$state2.maxHeight,
|
|
1330
|
-
maxWidth = _this$state2.maxWidth; // eslint-disable-line prefer-const
|
|
1331
|
-
// Accommodate the arrow in the maxHeight and maxWidth.
|
|
1332
|
-
|
|
1333
|
-
if (appearance !== 'none') {
|
|
1334
|
-
if (isFinite_default()(maxHeight)) {
|
|
1335
|
-
maxHeight -= 20;
|
|
888
|
+
return e;
|
|
889
|
+
}
|
|
890
|
+
function Ae(e, t) {
|
|
891
|
+
return Me(e) || We(e, t) || Re(e, t) || Te();
|
|
892
|
+
}
|
|
893
|
+
function Te() {
|
|
894
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
895
|
+
}
|
|
896
|
+
function Re(e, t) {
|
|
897
|
+
if (!e) return;
|
|
898
|
+
if (typeof e === "string") return qe(e, t);
|
|
899
|
+
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
900
|
+
if (r === "Object" && e.constructor) r = e.constructor.name;
|
|
901
|
+
if (r === "Map" || r === "Set") return Array.from(e);
|
|
902
|
+
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return qe(e, t);
|
|
903
|
+
}
|
|
904
|
+
function qe(e, t) {
|
|
905
|
+
if (t == null || t > e.length) t = e.length;
|
|
906
|
+
for (var r = 0, n = new Array(t); r < t; r++) {
|
|
907
|
+
n[r] = e[r];
|
|
1336
908
|
}
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
909
|
+
return n;
|
|
910
|
+
}
|
|
911
|
+
function We(e, t) {
|
|
912
|
+
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(e))) return;
|
|
913
|
+
var r = [];
|
|
914
|
+
var n = true;
|
|
915
|
+
var o = false;
|
|
916
|
+
var a = undefined;
|
|
917
|
+
try {
|
|
918
|
+
for (var i = e[Symbol.iterator](), l; !(n = (l = i.next()).done); n = true) {
|
|
919
|
+
r.push(l.value);
|
|
920
|
+
if (t && r.length === t) break;
|
|
921
|
+
}
|
|
922
|
+
} catch (e) {
|
|
923
|
+
o = true;
|
|
924
|
+
a = e;
|
|
925
|
+
} finally {
|
|
926
|
+
try {
|
|
927
|
+
if (!n && i["return"] != null) i["return"]();
|
|
928
|
+
} finally {
|
|
929
|
+
if (o) throw a;
|
|
930
|
+
}
|
|
1340
931
|
}
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
var childData = {
|
|
1344
|
-
anchorHeight: anchorPos ? anchorPos.height : null,
|
|
1345
|
-
anchorWidth: anchorPos ? anchorPos.width : null,
|
|
1346
|
-
placement: placement || null,
|
|
1347
|
-
maxHeight: maxHeight || null,
|
|
1348
|
-
maxWidth: maxWidth || null
|
|
1349
|
-
};
|
|
1350
|
-
var motionStyle = animation ? {
|
|
1351
|
-
opacity: open ? 1 : 0
|
|
1352
|
-
} : {
|
|
1353
|
-
opacity: 1
|
|
1354
|
-
};
|
|
1355
|
-
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
1356
|
-
|
|
1357
|
-
return /*#__PURE__*/external_react_default.a.createElement(Animation_["Spring"], {
|
|
1358
|
-
from: {
|
|
1359
|
-
opacity: animation ? 0 : 1
|
|
1360
|
-
},
|
|
1361
|
-
to: motionStyle,
|
|
1362
|
-
config: Popover_objectSpread({
|
|
1363
|
-
tension: 300,
|
|
1364
|
-
friction: 40
|
|
1365
|
-
}, animationConfig),
|
|
1366
|
-
onRest: _this.handleAnimationEnd
|
|
1367
|
-
}, function (interpolatedStyles) {
|
|
1368
|
-
return /*#__PURE__*/external_react_default.a.createElement(Styled, {
|
|
1369
|
-
"data-test": "outer-popover",
|
|
1370
|
-
style: Popover_objectSpread(Popover_objectSpread({}, outerContainerStyle), interpolatedStyles),
|
|
1371
|
-
ref: _this.handleOuterContainerMount
|
|
1372
|
-
}, (open || _this.state.animating) && /*#__PURE__*/external_react_default.a.createElement(StyledBox, _extends({
|
|
1373
|
-
$appearance: displayAppearance,
|
|
1374
|
-
$open: open,
|
|
1375
|
-
"data-test": "popover",
|
|
1376
|
-
ref: _this.handleInnerContainerMount,
|
|
1377
|
-
tabIndex: -1,
|
|
1378
|
-
id: id,
|
|
1379
|
-
onKeyDown: _this.handleTab // TODO: remove anchor once prop type generation is fixed
|
|
1380
|
-
|
|
1381
|
-
}, omit_default()(_this.props, ['anchor'].concat(_toConsumableArray(keys_default()(Popover.propTypes))))), /*#__PURE__*/external_react_default.a.createElement(PopoverContext.Provider, {
|
|
1382
|
-
value: {
|
|
1383
|
-
retainFocus: retainFocus
|
|
1384
|
-
}
|
|
1385
|
-
}, /*#__PURE__*/external_react_default.a.createElement(external_react_default.a.Fragment, null, appearance === 'none' && children, appearance !== 'none' && !isPrisma && /*#__PURE__*/external_react_default.a.createElement(StyledArrow, {
|
|
1386
|
-
$appearance: displayAppearance,
|
|
1387
|
-
ref: function ref(arrow) {
|
|
1388
|
-
_this.arrow = arrow;
|
|
1389
|
-
},
|
|
1390
|
-
style: arrowStyle
|
|
1391
|
-
}), appearance !== 'none' && /*#__PURE__*/external_react_default.a.createElement(StyledContent, {
|
|
1392
|
-
$appearance: displayAppearance
|
|
1393
|
-
}, isFunction_default()(children) ? children(childData) : children)))), /*#__PURE__*/external_react_default.a.createElement(StyledLowerRightCorner, {
|
|
1394
|
-
ref: function ref(el) {
|
|
1395
|
-
_this.windowSizeMeasurementEl = el;
|
|
1396
|
-
}
|
|
1397
|
-
}));
|
|
1398
|
-
});
|
|
1399
|
-
/* eslint-enable jsx-a11y/no-static-element-interactions */
|
|
1400
|
-
});
|
|
1401
|
-
|
|
1402
|
-
_this.handleScroll = throttle_default()(_this.setPlacement.bind(_assertThisInitialized(_this), true), 0);
|
|
1403
|
-
_this.handleWindowScroll = throttle_default()(_this.setPlacement.bind(_assertThisInitialized(_this), true), 0);
|
|
1404
|
-
_this.setPlacement = throttle_default()(_this.setPlacement, 0, {
|
|
1405
|
-
leading: false
|
|
1406
|
-
});
|
|
1407
|
-
_this.state = {
|
|
1408
|
-
animating: false,
|
|
1409
|
-
prevOpen: props.open // eslint-disable-line react/no-unused-state
|
|
1410
|
-
|
|
1411
|
-
};
|
|
1412
|
-
return _this;
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
|
-
_createClass(Popover, [{
|
|
1416
|
-
key: "componentDidMount",
|
|
1417
|
-
value: function componentDidMount() {
|
|
1418
|
-
this.handleNewAnchor(this.props.anchor);
|
|
932
|
+
return r;
|
|
1419
933
|
}
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
if (!this.innerContainerEl) {
|
|
1428
|
-
return;
|
|
1429
|
-
}
|
|
1430
|
-
|
|
1431
|
-
if (this.props.open || this.state.animating) {
|
|
1432
|
-
this.setPlacement(); // make sure that the popover both was not open before and is actually open now
|
|
1433
|
-
// this prevents bugs like #4 in SUI-2054 where popover contents re-rendering due to animation
|
|
1434
|
-
// causes the popover contents to receive focus even though the popover closing
|
|
1435
|
-
|
|
1436
|
-
if (!prevProps.open && this.props.open && this.props.takeFocus) {
|
|
1437
|
-
Object(focus_["takeFocus"])(this.innerContainerEl);
|
|
934
|
+
function Me(e) {
|
|
935
|
+
if (Array.isArray(e)) return e;
|
|
936
|
+
}
|
|
937
|
+
function He(e, t) {
|
|
938
|
+
if (!(e instanceof t)) {
|
|
939
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1438
940
|
}
|
|
1439
|
-
}
|
|
1440
941
|
}
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
942
|
+
function _e(e, t) {
|
|
943
|
+
for (var r = 0; r < t.length; r++) {
|
|
944
|
+
var n = t[r];
|
|
945
|
+
n.enumerable = n.enumerable || false;
|
|
946
|
+
n.configurable = true;
|
|
947
|
+
if ("value" in n) n.writable = true;
|
|
948
|
+
Object.defineProperty(e, n.key, n);
|
|
949
|
+
}
|
|
1448
950
|
}
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
951
|
+
function Le(e, t, r) {
|
|
952
|
+
if (t) _e(e.prototype, t);
|
|
953
|
+
if (r) _e(e, r);
|
|
954
|
+
return e;
|
|
955
|
+
}
|
|
956
|
+
function De(e, t) {
|
|
957
|
+
if (typeof t !== "function" && t !== null) {
|
|
958
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
959
|
+
}
|
|
960
|
+
e.prototype = Object.create(t && t.prototype, {
|
|
961
|
+
constructor: {
|
|
962
|
+
value: e,
|
|
963
|
+
writable: true,
|
|
964
|
+
configurable: true
|
|
965
|
+
}
|
|
1457
966
|
});
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
967
|
+
if (t) Ie(e, t);
|
|
968
|
+
}
|
|
969
|
+
function Ie(e, t) {
|
|
970
|
+
Ie = Object.setPrototypeOf || function e(t, r) {
|
|
971
|
+
t.__proto__ = r;
|
|
972
|
+
return t;
|
|
973
|
+
};
|
|
974
|
+
return Ie(e, t);
|
|
975
|
+
}
|
|
976
|
+
function Fe(e) {
|
|
977
|
+
var t = $e();
|
|
978
|
+
return function r() {
|
|
979
|
+
var n = Ue(e), o;
|
|
980
|
+
if (t) {
|
|
981
|
+
var a = Ue(this).constructor;
|
|
982
|
+
o = Reflect.construct(n, arguments, a);
|
|
983
|
+
} else {
|
|
984
|
+
o = n.apply(this, arguments);
|
|
985
|
+
}
|
|
986
|
+
return Ne(this, o);
|
|
987
|
+
};
|
|
988
|
+
}
|
|
989
|
+
function Ne(e, t) {
|
|
990
|
+
if (t && (Se(t) === "object" || typeof t === "function")) {
|
|
991
|
+
return t;
|
|
1467
992
|
}
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
return false;
|
|
993
|
+
return ze(e);
|
|
1471
994
|
}
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
(_this$props$onRequest = (_this$props3 = this.props).onRequestClose) === null || _this$props$onRequest === void 0 ? void 0 : _this$props$onRequest.call(_this$props3, data);
|
|
1479
|
-
}
|
|
995
|
+
function ze(e) {
|
|
996
|
+
if (e === void 0) {
|
|
997
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
998
|
+
}
|
|
999
|
+
return e;
|
|
1480
1000
|
}
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
// otherwise leads to negative performance impacts
|
|
1492
|
-
|
|
1493
|
-
var eventListeners = open ? [hasCustomizedScrollContainer && /*#__PURE__*/external_react_default.a.createElement(EventListener_default.a, {
|
|
1494
|
-
target: scrollContainer,
|
|
1495
|
-
eventType: "scroll",
|
|
1496
|
-
listener: this.handleScroll,
|
|
1497
|
-
options: {
|
|
1498
|
-
passive: false,
|
|
1499
|
-
capture: true
|
|
1500
|
-
},
|
|
1501
|
-
key: "eventListener"
|
|
1502
|
-
}), /*#__PURE__*/external_react_default.a.createElement(EventListener_default.a, {
|
|
1503
|
-
target: window,
|
|
1504
|
-
eventType: "resize",
|
|
1505
|
-
listener: this.setPlacement,
|
|
1506
|
-
key: "eventListenerOnWindowResize"
|
|
1507
|
-
}), /*#__PURE__*/external_react_default.a.createElement(EventListener_default.a, {
|
|
1508
|
-
target: window,
|
|
1509
|
-
eventType: "scroll",
|
|
1510
|
-
listener: this.handleWindowScroll,
|
|
1511
|
-
options: {
|
|
1512
|
-
passive: false,
|
|
1513
|
-
capture: true
|
|
1514
|
-
},
|
|
1515
|
-
key: "eventListenerOnWindowScroll"
|
|
1516
|
-
})] : [];
|
|
1517
|
-
return [].concat(eventListeners, [/*#__PURE__*/external_react_default.a.createElement(Layer_default.a, {
|
|
1518
|
-
closeReasons: intersection_default()(this.props.closeReasons.filter(function (reason) {
|
|
1519
|
-
return reason !== 'offScreen';
|
|
1520
|
-
}), Layer_default.a.possibleCloseReasons),
|
|
1521
|
-
open: open,
|
|
1522
|
-
onRequestClose: this.handleRequestClose,
|
|
1523
|
-
key: "Layer"
|
|
1524
|
-
}, open && this.innerContainerEl && this.props.hitAreaRef && /*#__PURE__*/external_react_default.a.createElement(Popover_PopoverHitArea, {
|
|
1525
|
-
anchorRect: anchorPos,
|
|
1526
|
-
popoverEl: this.innerContainerEl,
|
|
1527
|
-
popoverPlacement: placement,
|
|
1528
|
-
ref: this.props.hitAreaRef
|
|
1529
|
-
}), open && this.renderLayer())]);
|
|
1001
|
+
function $e() {
|
|
1002
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
1003
|
+
if (Reflect.construct.sham) return false;
|
|
1004
|
+
if (typeof Proxy === "function") return true;
|
|
1005
|
+
try {
|
|
1006
|
+
Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
|
|
1007
|
+
return true;
|
|
1008
|
+
} catch (e) {
|
|
1009
|
+
return false;
|
|
1010
|
+
}
|
|
1530
1011
|
}
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
}
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
return null;
|
|
1551
|
-
});
|
|
1552
|
-
|
|
1553
|
-
var PopoverWithTheme = Object(themes_["withSplunkTheme"])(Popover_Popover);
|
|
1554
|
-
PopoverWithTheme.propTypes = Popover_Popover.propTypes;
|
|
1555
|
-
/* harmony default export */ var src_Popover_Popover = (PopoverWithTheme);
|
|
1556
|
-
// CONCATENATED MODULE: ./src/Popover/index.ts
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
/***/ }),
|
|
1562
|
-
|
|
1563
|
-
/***/ 19:
|
|
1564
|
-
/***/ (function(module, exports) {
|
|
1565
|
-
|
|
1566
|
-
module.exports = require("lodash/isFinite");
|
|
1567
|
-
|
|
1568
|
-
/***/ }),
|
|
1569
|
-
|
|
1570
|
-
/***/ 2:
|
|
1571
|
-
/***/ (function(module, exports) {
|
|
1572
|
-
|
|
1573
|
-
module.exports = require("react");
|
|
1574
|
-
|
|
1575
|
-
/***/ }),
|
|
1576
|
-
|
|
1577
|
-
/***/ 24:
|
|
1578
|
-
/***/ (function(module, exports) {
|
|
1579
|
-
|
|
1580
|
-
module.exports = require("react-spring");
|
|
1581
|
-
|
|
1582
|
-
/***/ }),
|
|
1583
|
-
|
|
1584
|
-
/***/ 28:
|
|
1585
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1586
|
-
|
|
1587
|
-
"use strict";
|
|
1588
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getDocument; });
|
|
1589
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ssrDocument; });
|
|
1590
|
-
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
1591
|
-
var ssrDocument = {
|
|
1592
|
-
body: {
|
|
1593
|
-
appendChild: function appendChild() {
|
|
1594
|
-
return [];
|
|
1012
|
+
function Ue(e) {
|
|
1013
|
+
Ue = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
|
|
1014
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
1015
|
+
};
|
|
1016
|
+
return Ue(e);
|
|
1017
|
+
}
|
|
1018
|
+
function Ke(e, t, r) {
|
|
1019
|
+
if (t in e) {
|
|
1020
|
+
Object.defineProperty(e, t, {
|
|
1021
|
+
value: r,
|
|
1022
|
+
enumerable: true,
|
|
1023
|
+
configurable: true,
|
|
1024
|
+
writable: true
|
|
1025
|
+
});
|
|
1026
|
+
} else {
|
|
1027
|
+
e[t] = r;
|
|
1028
|
+
}
|
|
1029
|
+
return e;
|
|
1595
1030
|
}
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1031
|
+
/** @public */ var Ve = [ "clickAway", "escapeKey", "offScreen", "tabKey" ];
|
|
1032
|
+
var Be = {
|
|
1033
|
+
align: a().oneOf([ "center", "edge", "theme", "end" ]),
|
|
1034
|
+
anchor: a().object,
|
|
1035
|
+
animation: a().bool,
|
|
1036
|
+
animationConfig: a().object,
|
|
1037
|
+
appearance: a().oneOf([ "normal", "inverted", "none" ]),
|
|
1038
|
+
autoCloseWhenOffScreen: a().bool,
|
|
1039
|
+
canCoverAnchor: a().bool,
|
|
1040
|
+
children: a().oneOfType([ a().node, a().func ]),
|
|
1041
|
+
closeReasons: a().arrayOf(a().oneOf(Ve)),
|
|
1042
|
+
defaultPlacement: a().oneOf([ "above", "below", "left", "right", "vertical", "horizontal" ]),
|
|
1043
|
+
elementRef: a().oneOfType([ a().func, a().object ]),
|
|
1044
|
+
id: a().string,
|
|
1045
|
+
hitAreaRef: a().oneOfType([ a().func, a().object ]),
|
|
1046
|
+
onRequestClose: a().func,
|
|
1047
|
+
open: a().bool,
|
|
1048
|
+
outerRef: a().oneOfType([ a().func, a().object ]),
|
|
1049
|
+
pointTo: a().shape({
|
|
1050
|
+
x: a().number,
|
|
1051
|
+
y: a().number
|
|
1052
|
+
}),
|
|
1053
|
+
repositionMode: a().oneOf([ "none", "flip", "any" ]),
|
|
1054
|
+
retainFocus: a().bool,
|
|
1055
|
+
takeFocus: a().bool,
|
|
1056
|
+
splunkTheme: a().object
|
|
1615
1057
|
};
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1058
|
+
var Xe = {
|
|
1059
|
+
align: "theme",
|
|
1060
|
+
animation: true,
|
|
1061
|
+
animationConfig: {},
|
|
1062
|
+
appearance: "normal",
|
|
1063
|
+
autoCloseWhenOffScreen: true,
|
|
1064
|
+
canCoverAnchor: false,
|
|
1065
|
+
closeReasons: Ve,
|
|
1066
|
+
defaultPlacement: "below",
|
|
1067
|
+
open: false,
|
|
1068
|
+
repositionMode: "flip",
|
|
1069
|
+
retainFocus: true,
|
|
1070
|
+
takeFocus: false
|
|
1626
1071
|
};
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1072
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
1073
|
+
function Ye(e, t) {
|
|
1074
|
+
var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
1075
|
+
return !!e && !!t && p()(e, (function(e, n) {
|
|
1076
|
+
if (w()(e)) {
|
|
1077
|
+
return Math.abs(t[n] - e) <= r;
|
|
1078
|
+
}
|
|
1079
|
+
return t[n] === e;
|
|
1080
|
+
}));
|
|
1081
|
+
}
|
|
1082
|
+
function Ge(e) {
|
|
1083
|
+
return e !== window && e !== window.document;
|
|
1084
|
+
}
|
|
1085
|
+
/**
|
|
1086
|
+
* `Popover` is used to create layovers such as dropdowns, contextual menus, or tooltips. Use
|
|
1087
|
+
* this only when the other components don't provide sufficient functionality or control. A controlled
|
|
1088
|
+
* `Dropdown` covers use cases where you might consider using `Popover` directly.
|
|
1089
|
+
*/ var Je = function(e) {
|
|
1090
|
+
De(r, e);
|
|
1091
|
+
var t = Fe(r);
|
|
1092
|
+
Le(r, null, [ {
|
|
1093
|
+
key: "getArrowStyle",
|
|
1094
|
+
// @docs-props-type PopoverPropsBase
|
|
1095
|
+
value: function e(t) {
|
|
1096
|
+
var r = t.anchorPos, n = t.arrowHeight, o = t.placement, a = t.outerContainerStyle, i = t.outerContainerEl;
|
|
1097
|
+
if (o === "misaligned") {
|
|
1098
|
+
return [ {
|
|
1099
|
+
display: "none"
|
|
1100
|
+
} ];
|
|
1101
|
+
}
|
|
1102
|
+
var l = {
|
|
1103
|
+
display: "block"
|
|
1104
|
+
};
|
|
1105
|
+
var f = i.offsetHeight / 2 - 22;
|
|
1106
|
+
var s = -(i.offsetHeight / 2 - 15);
|
|
1107
|
+
var u = r.center - (a.top + i.offsetHeight / 2) - n / 2;
|
|
1108
|
+
var p = c()(u, s, f);
|
|
1109
|
+
var h = r.middle - (a.left + i.offsetWidth / 2) - n;
|
|
1110
|
+
var d = {
|
|
1111
|
+
left: {
|
|
1112
|
+
translateX: n / 2,
|
|
1113
|
+
translateY: p,
|
|
1114
|
+
rotate: 90
|
|
1115
|
+
},
|
|
1116
|
+
right: {
|
|
1117
|
+
translateX: -n / 2,
|
|
1118
|
+
translateY: p,
|
|
1119
|
+
rotate: -90
|
|
1120
|
+
},
|
|
1121
|
+
above: {
|
|
1122
|
+
translateX: h,
|
|
1123
|
+
translateY: 0,
|
|
1124
|
+
rotate: 180
|
|
1125
|
+
},
|
|
1126
|
+
below: {
|
|
1127
|
+
translateX: h,
|
|
1128
|
+
translateY: 0,
|
|
1129
|
+
rotate: 0
|
|
1130
|
+
}
|
|
1131
|
+
};
|
|
1132
|
+
var v = d[o];
|
|
1133
|
+
l.transform = "translate(".concat(v.translateX, "px, ").concat(v.translateY, "px) rotate(").concat(v.rotate, "deg)");
|
|
1134
|
+
// set new positions
|
|
1135
|
+
var m = {
|
|
1136
|
+
left: "right",
|
|
1137
|
+
right: "left",
|
|
1138
|
+
above: "bottom",
|
|
1139
|
+
below: "top"
|
|
1140
|
+
};
|
|
1141
|
+
l[m[o]] = "1px";
|
|
1142
|
+
var b = {
|
|
1143
|
+
left: "top",
|
|
1144
|
+
right: "top",
|
|
1145
|
+
above: "left",
|
|
1146
|
+
below: "left"
|
|
1147
|
+
};
|
|
1148
|
+
l[b[o]] = "50%";
|
|
1149
|
+
return [ l, v ];
|
|
1150
|
+
}
|
|
1151
|
+
} ]);
|
|
1152
|
+
function r(e) {
|
|
1153
|
+
var o;
|
|
1154
|
+
He(this, r);
|
|
1155
|
+
o = t.call(this, e);
|
|
1156
|
+
Ke(ze(o), "outerContainerEl", null);
|
|
1157
|
+
Ke(ze(o), "innerContainerEl", null);
|
|
1158
|
+
Ke(ze(o), "arrow", null);
|
|
1159
|
+
Ke(ze(o), "windowSizeMeasurementEl", null);
|
|
1160
|
+
Ke(ze(o), "handleScroll", void 0);
|
|
1161
|
+
Ke(ze(o), "handleWindowScroll", void 0);
|
|
1162
|
+
Ke(ze(o), "allowAnimationUpdates", true);
|
|
1163
|
+
Ke(ze(o), "getElPosition", (function(e) {
|
|
1164
|
+
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1165
|
+
var r = ge(e, t);
|
|
1166
|
+
var n = {
|
|
1167
|
+
width: e.offsetWidth,
|
|
1168
|
+
height: e.offsetHeight
|
|
1169
|
+
};
|
|
1170
|
+
var a = o.props.pointTo;
|
|
1171
|
+
var i = a && d()(a, "x");
|
|
1172
|
+
var l = a && d()(a, "y");
|
|
1173
|
+
n.left = i ? r.left + ((a === null || a === void 0 ? void 0 : a.x) || 0) : r.left;
|
|
1174
|
+
n.top = l ? r.top + ((a === null || a === void 0 ? void 0 : a.y) || 0) : r.top;
|
|
1175
|
+
n.right = i ? n.left + n.width : r.left + n.width || r.right;
|
|
1176
|
+
n.bottom = l ? n.top + n.height : r.top + n.height || r.bottom;
|
|
1177
|
+
n.middle = i ? n.left : r.left + (n.right - r.left) / 2;
|
|
1178
|
+
n.center = l ? n.top : r.top + (n.bottom - r.top) / 2;
|
|
1179
|
+
return n;
|
|
1180
|
+
}));
|
|
1181
|
+
Ke(ze(o), "setPlacement", (function(e) {
|
|
1182
|
+
var t = he();
|
|
1183
|
+
o.setState((function(n) {
|
|
1184
|
+
var a;
|
|
1185
|
+
var i = o.props, l = i.align, c = i.anchor, f = i.autoCloseWhenOffScreen, s = i.canCoverAnchor, u = i.defaultPlacement, p = i.open, h = i.repositionMode, d = i.splunkTheme;
|
|
1186
|
+
var v = o.context || t;
|
|
1187
|
+
var m = d.isPrisma;
|
|
1188
|
+
// If these conditions are not met, we cannot set the popover.
|
|
1189
|
+
if (!p || !o.outerContainerEl || !c || !n.anchorEl || !o.windowSizeMeasurementEl) {
|
|
1190
|
+
if (false) {}
|
|
1191
|
+
return null;
|
|
1192
|
+
}
|
|
1193
|
+
var b = o.getElPosition(n.anchorEl);
|
|
1194
|
+
var y = o.getElPosition(n.anchorEl, true);
|
|
1195
|
+
var g = Ge(v) ? o.getElPosition(v) : undefined;
|
|
1196
|
+
if (e && f) {
|
|
1197
|
+
if (o.autoCloseWhenOffScreen(b, g)) {
|
|
1198
|
+
return null;
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
var w = m ? 0 : 8;
|
|
1202
|
+
var S = 8;
|
|
1203
|
+
var O = m ? "edge" : "center";
|
|
1204
|
+
var P = z({
|
|
1205
|
+
align: l === "theme" ? O : l,
|
|
1206
|
+
anchorPos: y,
|
|
1207
|
+
scrollContainerPos: g,
|
|
1208
|
+
canCoverAnchor: s,
|
|
1209
|
+
defaultPlacement: u,
|
|
1210
|
+
repositionMode: h,
|
|
1211
|
+
outerContainerEl: o.outerContainerEl,
|
|
1212
|
+
padding: S,
|
|
1213
|
+
windowWidth: o.windowSizeMeasurementEl.offsetLeft,
|
|
1214
|
+
windowHeight: o.windowSizeMeasurementEl.offsetTop
|
|
1215
|
+
}), E = P.placement, C = P.outerContainerStyle, k = P.maxHeight, x = P.maxWidth;
|
|
1216
|
+
var A = o.arrow ? r.getArrowStyle({
|
|
1217
|
+
anchorPos: y,
|
|
1218
|
+
arrowHeight: w,
|
|
1219
|
+
outerContainerStyle: C,
|
|
1220
|
+
placement: E,
|
|
1221
|
+
outerContainerEl: o.outerContainerEl
|
|
1222
|
+
}) : [], T = Ae(A, 2), R = T[0], q = T[1];
|
|
1223
|
+
var W = o.props.appearance !== "none" && !m;
|
|
1224
|
+
var M = Ye(y, n.anchorPos) && Ye(C, n.outerContainerStyle) && E === n.placement && k === n.maxHeight && x === n.maxWidth;
|
|
1225
|
+
var H = Ye(j()(R, "transform"), j()(n.arrowStyle, "transform")) && Ye(q !== null && q !== void 0 ? q : {}, (a = n.arrowStyleTransformMeta) !== null && a !== void 0 ? a : {});
|
|
1226
|
+
// If none of the position data has changed, do not set state.
|
|
1227
|
+
if (M && (!W || W && H)) {
|
|
1228
|
+
return null;
|
|
1229
|
+
}
|
|
1230
|
+
return {
|
|
1231
|
+
anchorPos: y,
|
|
1232
|
+
arrowStyle: R,
|
|
1233
|
+
arrowStyleTransformMeta: q,
|
|
1234
|
+
outerContainerStyle: C,
|
|
1235
|
+
placement: E,
|
|
1236
|
+
maxHeight: k,
|
|
1237
|
+
maxWidth: x
|
|
1238
|
+
};
|
|
1239
|
+
}));
|
|
1240
|
+
}));
|
|
1241
|
+
Ke(ze(o), "handleNewAnchor", (function(e) {
|
|
1242
|
+
var t;
|
|
1243
|
+
if (e && !(e instanceof HTMLElement)) {
|
|
1244
|
+
if (false) {}
|
|
1245
|
+
t = (0, i.findDOMNode)(e);
|
|
1246
|
+
// eslint-disable-line react/no-find-dom-node
|
|
1247
|
+
} else {
|
|
1248
|
+
t = e !== null && e !== void 0 ? e : undefined;
|
|
1249
|
+
}
|
|
1250
|
+
var r = t ? o.getElPosition(t) : undefined;
|
|
1251
|
+
o.setState({
|
|
1252
|
+
anchorEl: t,
|
|
1253
|
+
anchorPos: r
|
|
1254
|
+
});
|
|
1255
|
+
// eslint-disable-line react/no-unused-state
|
|
1256
|
+
}));
|
|
1257
|
+
Ke(ze(o), "handleInnerContainerMount", (function(e) {
|
|
1258
|
+
o.innerContainerEl = e;
|
|
1259
|
+
if (e && o.props.takeFocus) {
|
|
1260
|
+
s()(L.takeFocus, e);
|
|
1261
|
+
}
|
|
1262
|
+
we(o.props.elementRef, e);
|
|
1263
|
+
}));
|
|
1264
|
+
Ke(ze(o), "handleOuterContainerMount", (function(e) {
|
|
1265
|
+
o.outerContainerEl = e;
|
|
1266
|
+
we(o.props.outerRef, e);
|
|
1267
|
+
}));
|
|
1268
|
+
Ke(ze(o), "handleTab", (function(e) {
|
|
1269
|
+
if (o.innerContainerEl) {
|
|
1270
|
+
if (o.props.retainFocus) {
|
|
1271
|
+
(0, L.handleTab)(o.innerContainerEl, e);
|
|
1272
|
+
} else if ((0, L.isTabKey)(e)) {
|
|
1273
|
+
var t = (0, L.getSortedTabbableElements)(o.innerContainerEl);
|
|
1274
|
+
if (t.length > 0) {
|
|
1275
|
+
var r = e.shiftKey ? t[0] : t[t.length - 1];
|
|
1276
|
+
if (r === e.target) {
|
|
1277
|
+
o.handleRequestClose({
|
|
1278
|
+
event: e,
|
|
1279
|
+
reason: "tabKey"
|
|
1280
|
+
});
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
}));
|
|
1286
|
+
Ke(ze(o), "handleRequestClose", (function(e) {
|
|
1287
|
+
if (o.props.open) {
|
|
1288
|
+
o.requestClose(e);
|
|
1289
|
+
}
|
|
1290
|
+
}));
|
|
1291
|
+
Ke(ze(o), "handleAnimationEnd", (function() {
|
|
1292
|
+
if (o.allowAnimationUpdates) {
|
|
1293
|
+
o.setState({
|
|
1294
|
+
animating: false
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
}));
|
|
1298
|
+
Ke(ze(o), "renderLayer", (function() {
|
|
1299
|
+
var e = o.props, t = e.animation, a = e.animationConfig, i = e.appearance, l = e.children, c = e.id, f = e.open, s = e.retainFocus, u = e.splunkTheme;
|
|
1300
|
+
var p = o.state, h = p.anchorPos, d = p.arrowStyle, v = p.outerContainerStyle, m = p.placement;
|
|
1301
|
+
var b = u.isPrisma;
|
|
1302
|
+
var y = b && i === "inverted" ? "normal" : i;
|
|
1303
|
+
var g = o.state, S = g.maxHeight, P = g.maxWidth;
|
|
1304
|
+
// eslint-disable-line prefer-const
|
|
1305
|
+
// Accommodate the arrow in the maxHeight and maxWidth.
|
|
1306
|
+
if (i !== "none") {
|
|
1307
|
+
if (w()(S)) {
|
|
1308
|
+
S -= 20;
|
|
1309
|
+
}
|
|
1310
|
+
if (w()(P)) {
|
|
1311
|
+
P -= 20;
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
var C = {
|
|
1315
|
+
anchorHeight: h ? h.height : null,
|
|
1316
|
+
anchorWidth: h ? h.width : null,
|
|
1317
|
+
placement: m || null,
|
|
1318
|
+
maxHeight: S || null,
|
|
1319
|
+
maxWidth: P || null
|
|
1320
|
+
};
|
|
1321
|
+
var k = t ? {
|
|
1322
|
+
opacity: f ? 1 : 0
|
|
1323
|
+
} : {
|
|
1324
|
+
opacity: 1
|
|
1325
|
+
};
|
|
1326
|
+
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
1327
|
+
return n().createElement(T.Spring, {
|
|
1328
|
+
from: {
|
|
1329
|
+
opacity: t ? 0 : 1
|
|
1330
|
+
},
|
|
1331
|
+
to: k,
|
|
1332
|
+
config: xe({
|
|
1333
|
+
tension: 300,
|
|
1334
|
+
friction: 40
|
|
1335
|
+
}, a),
|
|
1336
|
+
onRest: o.handleAnimationEnd
|
|
1337
|
+
}, (function(e) {
|
|
1338
|
+
|
|
1339
|
+
return n().createElement(X, {
|
|
1340
|
+
"data-test": "outer-popover",
|
|
1341
|
+
style: xe(xe({}, v), e),
|
|
1342
|
+
ref: o.handleOuterContainerMount
|
|
1343
|
+
}, (f || o.state.animating) && n().createElement(Y, Oe({
|
|
1344
|
+
$appearance: y,
|
|
1345
|
+
$open: f,
|
|
1346
|
+
"data-test": "popover",
|
|
1347
|
+
ref: o.handleInnerContainerMount,
|
|
1348
|
+
tabIndex: -1,
|
|
1349
|
+
id: c,
|
|
1350
|
+
onKeyDown: o.handleTab
|
|
1351
|
+
}, j()(o.props, [ "anchor" ].concat(Pe(E()(r.propTypes))))), n().createElement($.Provider, {
|
|
1352
|
+
value: {
|
|
1353
|
+
retainFocus: s
|
|
1354
|
+
}
|
|
1355
|
+
}, n().createElement(n().Fragment, null, i === "none" && l, i !== "none" && !b && n().createElement(J, {
|
|
1356
|
+
$appearance: y,
|
|
1357
|
+
ref: function e(t) {
|
|
1358
|
+
o.arrow = t;
|
|
1359
|
+
},
|
|
1360
|
+
style: d
|
|
1361
|
+
}), i !== "none" && n().createElement(G, {
|
|
1362
|
+
$appearance: y
|
|
1363
|
+
}, O()(l) ? l(C) : l)))), n().createElement(Q, {
|
|
1364
|
+
ref: function e(t) {
|
|
1365
|
+
o.windowSizeMeasurementEl = t;
|
|
1366
|
+
}
|
|
1367
|
+
}));
|
|
1368
|
+
}));
|
|
1369
|
+
/* eslint-enable jsx-a11y/no-static-element-interactions */ }));
|
|
1370
|
+
o.handleScroll = x()(o.setPlacement.bind(ze(o), true), 0);
|
|
1371
|
+
o.handleWindowScroll = x()(o.setPlacement.bind(ze(o), true), 0);
|
|
1372
|
+
o.setPlacement = x()(o.setPlacement, 0, {
|
|
1373
|
+
leading: false
|
|
1374
|
+
});
|
|
1375
|
+
o.state = {
|
|
1376
|
+
animating: false,
|
|
1377
|
+
prevOpen: e.open
|
|
1378
|
+
};
|
|
1379
|
+
return o;
|
|
1380
|
+
}
|
|
1381
|
+
Le(r, [ {
|
|
1382
|
+
key: "componentDidMount",
|
|
1383
|
+
value: function e() {
|
|
1384
|
+
this.handleNewAnchor(this.props.anchor);
|
|
1385
|
+
}
|
|
1386
|
+
}, {
|
|
1387
|
+
key: "componentDidUpdate",
|
|
1388
|
+
value: function e(t) {
|
|
1389
|
+
if (t.anchor !== this.props.anchor) {
|
|
1390
|
+
this.handleNewAnchor(this.props.anchor);
|
|
1391
|
+
}
|
|
1392
|
+
if (!this.innerContainerEl) {
|
|
1393
|
+
return;
|
|
1394
|
+
}
|
|
1395
|
+
if (this.props.open || this.state.animating) {
|
|
1396
|
+
this.setPlacement();
|
|
1397
|
+
// make sure that the popover both was not open before and is actually open now
|
|
1398
|
+
// this prevents bugs like #4 in SUI-2054 where popover contents re-rendering due to animation
|
|
1399
|
+
// causes the popover contents to receive focus even though the popover closing
|
|
1400
|
+
if (!t.open && this.props.open && this.props.takeFocus) {
|
|
1401
|
+
(0, L.takeFocus)(this.innerContainerEl);
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
}, {
|
|
1406
|
+
key: "componentWillUnmount",
|
|
1407
|
+
value: function e() {
|
|
1408
|
+
this.setPlacement.cancel();
|
|
1409
|
+
// guaranteed by constructor
|
|
1410
|
+
this.handleScroll.cancel();
|
|
1411
|
+
this.allowAnimationUpdates = false;
|
|
1412
|
+
}
|
|
1413
|
+
}, {
|
|
1414
|
+
key: "autoCloseWhenOffScreen",
|
|
1415
|
+
value: function e(t, r) {
|
|
1416
|
+
var n = he();
|
|
1417
|
+
if (t.top < 0 || t.top > n.innerHeight || t.left < 0 || t.left > n.innerWidth) {
|
|
1418
|
+
this.requestClose({
|
|
1419
|
+
reason: "offScreen"
|
|
1420
|
+
});
|
|
1421
|
+
return true;
|
|
1422
|
+
}
|
|
1423
|
+
if (r) {
|
|
1424
|
+
if (t.height + t.top < r.top || t.top > r.bottom || t.width + t.left < r.left || t.left > r.right) {
|
|
1425
|
+
this.requestClose({
|
|
1426
|
+
reason: "offScreen"
|
|
1427
|
+
});
|
|
1428
|
+
return true;
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
return false;
|
|
1432
|
+
}
|
|
1433
|
+
}, {
|
|
1434
|
+
key: "requestClose",
|
|
1435
|
+
value: function e(t) {
|
|
1436
|
+
if (m()(this.props.closeReasons, t.reason)) {
|
|
1437
|
+
var r, n;
|
|
1438
|
+
(r = (n = this.props).onRequestClose) === null || r === void 0 ? void 0 : r.call(n, t);
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
}, {
|
|
1442
|
+
key: "render",
|
|
1443
|
+
value: function e() {
|
|
1444
|
+
var t = he();
|
|
1445
|
+
var r = this.props.open || this.state.animating;
|
|
1446
|
+
var o = this.context || t;
|
|
1447
|
+
var a = o !== t;
|
|
1448
|
+
var i = this.state, l = i.anchorPos, c = i.placement;
|
|
1449
|
+
// EventListeners only need to be rendered when open,
|
|
1450
|
+
// otherwise leads to negative performance impacts
|
|
1451
|
+
var f = r ? [ a && n().createElement(q(), {
|
|
1452
|
+
target: o,
|
|
1453
|
+
eventType: "scroll",
|
|
1454
|
+
listener: this.handleScroll,
|
|
1455
|
+
options: {
|
|
1456
|
+
passive: false,
|
|
1457
|
+
capture: true
|
|
1458
|
+
},
|
|
1459
|
+
key: "eventListener"
|
|
1460
|
+
}), n().createElement(q(), {
|
|
1461
|
+
target: t,
|
|
1462
|
+
eventType: "resize",
|
|
1463
|
+
listener: this.setPlacement,
|
|
1464
|
+
key: "eventListenerOnWindowResize"
|
|
1465
|
+
}), n().createElement(q(), {
|
|
1466
|
+
target: t,
|
|
1467
|
+
eventType: "scroll",
|
|
1468
|
+
listener: this.handleWindowScroll,
|
|
1469
|
+
options: {
|
|
1470
|
+
passive: false,
|
|
1471
|
+
capture: true
|
|
1472
|
+
},
|
|
1473
|
+
key: "eventListenerOnWindowScroll"
|
|
1474
|
+
}) ] : [];
|
|
1475
|
+
return [].concat(f, [ n().createElement(M(), {
|
|
1476
|
+
closeReasons: y()(this.props.closeReasons.filter((function(e) {
|
|
1477
|
+
return e !== "offScreen";
|
|
1478
|
+
})), M().possibleCloseReasons),
|
|
1479
|
+
open: r,
|
|
1480
|
+
onRequestClose: this.handleRequestClose,
|
|
1481
|
+
key: "Layer"
|
|
1482
|
+
}, r && this.innerContainerEl && this.props.hitAreaRef && n().createElement(fe, {
|
|
1483
|
+
anchorRect: l,
|
|
1484
|
+
popoverEl: this.innerContainerEl,
|
|
1485
|
+
popoverPlacement: c,
|
|
1486
|
+
ref: this.props.hitAreaRef
|
|
1487
|
+
}), r && this.renderLayer()) ]);
|
|
1488
|
+
}
|
|
1489
|
+
} ]);
|
|
1490
|
+
return r;
|
|
1491
|
+
}(r.Component);
|
|
1492
|
+
Ke(Je, "contextType", _());
|
|
1493
|
+
Ke(Je, "defaultProps", Xe);
|
|
1494
|
+
Ke(Je, "propTypes", Be);
|
|
1495
|
+
Ke(Je, "getDerivedStateFromProps", (function(e, t) {
|
|
1496
|
+
if (e.open !== t.prevOpen) {
|
|
1497
|
+
return {
|
|
1498
|
+
animating: e.animation,
|
|
1499
|
+
prevOpen: e.open
|
|
1500
|
+
};
|
|
1501
|
+
}
|
|
1502
|
+
return null;
|
|
1503
|
+
}));
|
|
1504
|
+
var Qe = (0, A.withSplunkTheme)(Je);
|
|
1505
|
+
Qe.propTypes = Je.propTypes;
|
|
1506
|
+
/* harmony default export */ const Ze = Qe;
|
|
1507
|
+
// CONCATENATED MODULE: ./src/Popover/index.ts
|
|
1508
|
+
module.exports = t;
|
|
1509
|
+
/******/})();
|