@splunk/react-ui 4.21.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 -325
- package/Anchor.js +147 -117
- package/Animation.js +142 -94
- package/AnimationToggle.js +197 -193
- package/Box.js +145 -118
- package/Breadcrumbs.js +288 -206
- package/Button.js +488 -465
- package/ButtonGroup.js +160 -128
- package/ButtonSimple.js +543 -462
- package/CHANGELOG.md +7 -2
- package/Calendar.js +1111 -1001
- package/Card.js +771 -598
- package/CardLayout.js +205 -147
- package/Chip.js +509 -488
- package/Clickable.js +414 -352
- package/CloseButton.js +165 -142
- package/Code.js +1808 -2084
- package/Code.js.LICENSE.txt +8 -0
- package/CollapsiblePanel.js +586 -519
- package/Color.js +1066 -1069
- package/ColumnLayout.js +402 -363
- package/ComboBox.js +891 -794
- package/Concertina.js +997 -802
- package/ControlGroup.js +687 -594
- package/Date.js +567 -547
- package/DefinitionList.js +308 -234
- package/Divider.js +149 -118
- package/Dropdown.js +459 -416
- package/DualListbox.js +1479 -1541
- package/EventListener.js +94 -97
- package/File.js +1051 -969
- package/FormRows.js +883 -696
- package/Heading.js +216 -193
- package/Image.js +446 -402
- package/JSONTree.js +690 -551
- package/Layer.js +437 -410
- package/Link.js +336 -255
- package/List.js +213 -161
- package/Markdown.js +509 -487
- package/Menu.js +1105 -1056
- package/Message.js +475 -441
- package/MessageBar.js +387 -373
- package/Modal.js +810 -634
- package/ModalLayer.js +326 -243
- package/Monogram.js +308 -276
- package/Multiselect.js +3550 -3364
- package/Number.js +729 -687
- package/Paginator.js +510 -449
- package/Paragraph.js +145 -112
- package/Popover.js +1459 -1432
- package/Progress.js +301 -246
- package/RadioBar.js +610 -527
- package/RadioList.js +483 -444
- package/Resize.js +530 -489
- package/ResultsMenu.js +494 -455
- package/ScreenReaderContent.js +142 -111
- package/Scroll.js +595 -456
- package/ScrollContainerContext.js +197 -206
- package/Search.js +744 -650
- package/Select.js +2442 -2345
- package/SidePanel.js +390 -284
- package/Slider.js +669 -676
- package/SlidingPanels.js +639 -503
- package/SplitButton.js +464 -367
- package/StaticContent.js +161 -133
- package/StepBar.js +386 -358
- package/Switch.js +710 -640
- package/TabBar.js +726 -680
- package/TabLayout.js +406 -322
- package/Table.js +4842 -4616
- package/Text.js +1170 -1138
- package/TextArea.js +1102 -1090
- package/Tooltip.js +624 -581
- package/TransitionOpen.js +489 -422
- package/Typography.js +176 -153
- package/WaitSpinner.js +230 -206
- package/package.json +5 -5
- package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
- package/types/src/JSONTree/TreeNode.d.ts +5 -0
- package/useForceUpdate.js +112 -82
- package/useKeyPress.js +74 -71
- package/usePrevious.js +65 -65
- package/useRovingFocus.js +122 -138
package/Layer.js
CHANGED
|
@@ -1,426 +1,453 @@
|
|
|
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
|
-
const
|
|
88
|
-
var
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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 n = t && t.__esModule ?
|
|
13
|
+
/******/ () => t["default"]
|
|
14
|
+
/******/ : () => t
|
|
15
|
+
/******/;
|
|
16
|
+
e.d(n, {
|
|
17
|
+
a: n
|
|
18
|
+
});
|
|
19
|
+
/******/ return n;
|
|
20
|
+
/******/ };
|
|
21
|
+
/******/ })();
|
|
22
|
+
/******/
|
|
23
|
+
/******/ /* webpack/runtime/define property getters */
|
|
24
|
+
/******/ (() => {
|
|
25
|
+
/******/ // define getter functions for harmony exports
|
|
26
|
+
/******/ e.d = (t, n) => {
|
|
27
|
+
/******/ for (var r in n) {
|
|
28
|
+
/******/ if (e.o(n, r) && !e.o(t, r)) {
|
|
29
|
+
/******/ Object.defineProperty(t, r, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: n[r]
|
|
32
|
+
});
|
|
33
|
+
/******/ }
|
|
34
|
+
/******/ }
|
|
35
|
+
/******/ };
|
|
36
|
+
/******/ })();
|
|
37
|
+
/******/
|
|
38
|
+
/******/ /* webpack/runtime/global */
|
|
39
|
+
/******/ (() => {
|
|
40
|
+
/******/ e.g = function() {
|
|
41
|
+
/******/ if (typeof globalThis === "object") return globalThis;
|
|
42
|
+
/******/ try {
|
|
43
|
+
/******/ return this || new Function("return this")();
|
|
44
|
+
/******/ } catch (e) {
|
|
45
|
+
/******/ if (typeof window === "object") return window;
|
|
46
|
+
/******/ }
|
|
47
|
+
/******/ }();
|
|
48
|
+
/******/ })();
|
|
49
|
+
/******/
|
|
50
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
51
|
+
/******/ (() => {
|
|
52
|
+
/******/ e.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)
|
|
53
|
+
/******/;
|
|
54
|
+
})();
|
|
55
|
+
/******/
|
|
56
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
57
|
+
/******/ (() => {
|
|
58
|
+
/******/ // define __esModule on exports
|
|
59
|
+
/******/ e.r = e => {
|
|
60
|
+
/******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
|
|
61
|
+
/******/ Object.defineProperty(e, Symbol.toStringTag, {
|
|
62
|
+
value: "Module"
|
|
63
|
+
});
|
|
64
|
+
/******/ }
|
|
65
|
+
/******/ Object.defineProperty(e, "__esModule", {
|
|
66
|
+
value: true
|
|
67
|
+
});
|
|
68
|
+
/******/ };
|
|
69
|
+
/******/ })();
|
|
70
|
+
/******/
|
|
71
|
+
/************************************************************************/ var t = {};
|
|
72
|
+
// ESM COMPAT FLAG
|
|
73
|
+
e.r(t);
|
|
74
|
+
// EXPORTS
|
|
75
|
+
e.d(t, {
|
|
76
|
+
LayerContext: () => /* reexport */ m,
|
|
77
|
+
LayerStackContext: () => /* reexport */ h,
|
|
78
|
+
LayerStackGlobalProvider: () => /* reexport */ k,
|
|
79
|
+
default: () => /* reexport */ F
|
|
80
|
+
});
|
|
81
|
+
// CONCATENATED MODULE: external "react"
|
|
82
|
+
const n = require("react");
|
|
83
|
+
var r = e.n(n);
|
|
84
|
+
// CONCATENATED MODULE: external "react-dom"
|
|
85
|
+
const o = require("react-dom");
|
|
86
|
+
// CONCATENATED MODULE: external "prop-types"
|
|
87
|
+
const i = require("prop-types");
|
|
88
|
+
var a = e.n(i);
|
|
89
|
+
// CONCATENATED MODULE: external "lodash/includes"
|
|
90
|
+
const c = require("lodash/includes");
|
|
91
|
+
var u = e.n(c);
|
|
92
|
+
// CONCATENATED MODULE: external "lodash/last"
|
|
93
|
+
const l = require("lodash/last");
|
|
94
|
+
var s = e.n(l);
|
|
95
|
+
// CONCATENATED MODULE: external "lodash/pull"
|
|
96
|
+
const f = require("lodash/pull");
|
|
97
|
+
var p = e.n(f);
|
|
98
|
+
// CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
|
|
99
|
+
const y = require("@splunk/ui-utils/keyboard");
|
|
100
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/EventListener"
|
|
101
|
+
const d = require("@splunk/react-ui/EventListener");
|
|
102
|
+
var v = e.n(d);
|
|
103
|
+
// CONCATENATED MODULE: ./src/Layer/LayerStack.tsx
|
|
104
|
+
/**
|
|
99
105
|
* `LayerStackContext` is used to manage the array that `Layer` (and components that
|
|
100
106
|
* depend on it, such as `Modal`) uses to determine the order of open layers.
|
|
101
107
|
* @public
|
|
102
108
|
*/
|
|
103
|
-
var
|
|
104
|
-
var
|
|
105
|
-
var
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
};
|
|
111
|
-
/* global global */
|
|
112
|
-
|
|
113
|
-
/**
|
|
109
|
+
var h = r().createContext([]);
|
|
110
|
+
var m = r().createContext({});
|
|
111
|
+
var b = {
|
|
112
|
+
children: a().node,
|
|
113
|
+
name: a().string,
|
|
114
|
+
scope: a().object,
|
|
115
|
+
separateStackingContexts: a().bool
|
|
116
|
+
};
|
|
117
|
+
/* global global */
|
|
118
|
+
/**
|
|
114
119
|
* A `LayerStackContext` provider that stores a shared layer stack using a global variable.
|
|
115
120
|
* Applications should only use this provider if there's a known need to support multiple
|
|
116
121
|
* instances of this library on the same page.
|
|
117
|
-
*/
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return /*#__PURE__*/external_react_default().createElement(LayerStackContext.Provider, {
|
|
133
|
-
value: scope[name]
|
|
134
|
-
}, /*#__PURE__*/external_react_default().createElement(LayerContext.Provider, {
|
|
135
|
-
value: {
|
|
136
|
-
separateStackingContexts: separateStackingContexts
|
|
122
|
+
*/ function k(t) {
|
|
123
|
+
var n = t.children, o = t.name, i = o === void 0 ? "__splunkui_layer_instances__" : o, a = t.scope, c = a === void 0 ? typeof window !== "undefined" ? window : e.g : a, u = t.separateStackingContexts, l = u === void 0 ? false : u;
|
|
124
|
+
if (!c[i]) {
|
|
125
|
+
c[i] = [];
|
|
126
|
+
// eslint-disable-line no-param-reassign
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return r().createElement(h.Provider, {
|
|
130
|
+
value: c[i]
|
|
131
|
+
}, r().createElement(m.Provider, {
|
|
132
|
+
value: {
|
|
133
|
+
separateStackingContexts: l
|
|
134
|
+
}
|
|
135
|
+
}, n));
|
|
137
136
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
var
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
137
|
+
k.propTypes = b;
|
|
138
|
+
// CONCATENATED MODULE: external "styled-components"
|
|
139
|
+
const w = require("styled-components");
|
|
140
|
+
var g = e.n(w);
|
|
141
|
+
// CONCATENATED MODULE: external "@splunk/themes"
|
|
142
|
+
const C = require("@splunk/themes");
|
|
143
|
+
// CONCATENATED MODULE: ./src/Layer/LayerStyles.ts
|
|
144
|
+
var S = g().div.withConfig({
|
|
145
|
+
displayName: "LayerStyles__StyledLayer",
|
|
146
|
+
componentId: "ii6psl-0"
|
|
147
|
+
})([ "", "" ], (function(e) {
|
|
148
|
+
var t = e.$separateStackingContexts;
|
|
149
|
+
return t && (0, w.css)([ "isolation:isolate;z-index:", ";" ], C.variables.zindexLayer);
|
|
150
|
+
}));
|
|
151
|
+
// CONCATENATED MODULE: ./src/utils/ssrDocument.ts
|
|
152
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
153
|
+
var E = {
|
|
154
|
+
body: {
|
|
155
|
+
appendChild: function e() {
|
|
156
|
+
return [];
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
addEventListener: function e() {},
|
|
160
|
+
removeEventListener: function e() {},
|
|
161
|
+
activeElement: {
|
|
162
|
+
blur: function e() {},
|
|
163
|
+
nodeName: ""
|
|
164
|
+
},
|
|
165
|
+
querySelector: function e() {
|
|
166
|
+
return null;
|
|
167
|
+
},
|
|
168
|
+
querySelectorAll: function e() {
|
|
169
|
+
return [];
|
|
170
|
+
},
|
|
171
|
+
getElementById: function e() {
|
|
172
|
+
return null;
|
|
173
|
+
},
|
|
174
|
+
createEvent: function e() {
|
|
175
|
+
return {
|
|
176
|
+
initEvent: function e() {}
|
|
177
|
+
};
|
|
178
|
+
},
|
|
179
|
+
createElement: function e() {
|
|
180
|
+
return {
|
|
181
|
+
children: [],
|
|
182
|
+
childNodes: [],
|
|
183
|
+
style: {},
|
|
184
|
+
setAttribute: function e() {},
|
|
185
|
+
getElementsByTagName: function e() {
|
|
186
|
+
return [];
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
},
|
|
190
|
+
createElementNS: function e() {
|
|
191
|
+
return {};
|
|
192
|
+
},
|
|
193
|
+
importNode: function e() {
|
|
194
|
+
return null;
|
|
195
|
+
},
|
|
196
|
+
location: {
|
|
197
|
+
hash: "",
|
|
198
|
+
host: "",
|
|
199
|
+
hostname: "",
|
|
200
|
+
href: "",
|
|
201
|
+
origin: "",
|
|
202
|
+
pathname: "",
|
|
203
|
+
protocol: "",
|
|
204
|
+
search: ""
|
|
205
|
+
}
|
|
196
206
|
};
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
function
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
function _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; }
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
/** @public */
|
|
259
|
-
|
|
260
|
-
var possibleCloseReasons = ['clickAway', 'escapeKey'];
|
|
261
|
-
var Layer_propTypes = {
|
|
262
|
-
children: (external_prop_types_default()).node,
|
|
263
|
-
closeReasons: external_prop_types_default().arrayOf(external_prop_types_default().oneOf(possibleCloseReasons)),
|
|
264
|
-
onRequestClose: (external_prop_types_default()).func,
|
|
265
|
-
open: (external_prop_types_default()).bool
|
|
266
|
-
};
|
|
267
|
-
var defaultProps = {
|
|
268
|
-
closeReasons: possibleCloseReasons,
|
|
269
|
-
open: false
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
var Layer = /*#__PURE__*/function (_Component) {
|
|
273
|
-
_inherits(Layer, _Component);
|
|
274
|
-
|
|
275
|
-
var _super = _createSuper(Layer);
|
|
276
|
-
|
|
277
|
-
// @docs-props-type LayerPropsBase
|
|
278
|
-
// eslint-disable-next-line react/sort-comp
|
|
279
|
-
// LayerStackContext (an array) keeps track of the current instances of Layer. This is
|
|
280
|
-
// used by Layer#handleKeyDown to determine if the escapeKey event should be handled by
|
|
281
|
-
// the current instance. Only the topmost Layer instance should honor the escapeKey.
|
|
282
|
-
// TODO: enable once this is sorted out within the babel/ts ecosystem
|
|
283
|
-
// declare context: React.ContextType<typeof LayerStackContext>;
|
|
284
|
-
function Layer(props) {
|
|
285
|
-
var _this;
|
|
286
|
-
|
|
287
|
-
_classCallCheck(this, Layer);
|
|
288
|
-
|
|
289
|
-
_this = _super.call(this, props);
|
|
290
|
-
|
|
291
|
-
_defineProperty(_assertThisInitialized(_this), "layerClickEvent", null);
|
|
292
|
-
|
|
293
|
-
_defineProperty(_assertThisInitialized(_this), "handleClickOnLayer", function (_ref) {
|
|
294
|
-
var nativeEvent = _ref.nativeEvent;
|
|
295
|
-
_this.layerClickEvent = nativeEvent;
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
_defineProperty(_assertThisInitialized(_this), "handleClickOnWindow", function (event) {
|
|
299
|
-
var _this$props$onRequest, _this$props;
|
|
300
|
-
|
|
301
|
-
// clicks inside the layer should not be considered clickAways
|
|
302
|
-
if (!_this.props.open || !includes_default()(_this.props.closeReasons, 'clickAway') || _this.layerClickEvent === event) {
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
(_this$props$onRequest = (_this$props = _this.props).onRequestClose) === null || _this$props$onRequest === void 0 ? void 0 : _this$props$onRequest.call(_this$props, {
|
|
307
|
-
event: event,
|
|
308
|
-
reason: 'clickAway'
|
|
309
|
-
});
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
_defineProperty(_assertThisInitialized(_this), "handleKeyDownOnWindow", function (event) {
|
|
313
|
-
if (_this.props.open && (0,keyboard_namespaceObject.keycode)(event) === 'esc' && last_default()(_this.getLayerStack()) === _assertThisInitialized(_this) && includes_default()(_this.props.closeReasons, 'escapeKey')) {
|
|
314
|
-
var _this$props$onRequest2, _this$props2;
|
|
315
|
-
|
|
316
|
-
(_this$props$onRequest2 = (_this$props2 = _this.props).onRequestClose) === null || _this$props$onRequest2 === void 0 ? void 0 : _this$props$onRequest2.call(_this$props2, {
|
|
317
|
-
event: event,
|
|
318
|
-
reason: 'escapeKey'
|
|
207
|
+
function O() {
|
|
208
|
+
var e = typeof document !== "undefined" ? document : E;
|
|
209
|
+
return e;
|
|
210
|
+
}
|
|
211
|
+
// CONCATENATED MODULE: ./src/Layer/Layer.tsx
|
|
212
|
+
function L(e) {
|
|
213
|
+
"@babel/helpers - typeof";
|
|
214
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
215
|
+
L = function e(t) {
|
|
216
|
+
return typeof t;
|
|
217
|
+
};
|
|
218
|
+
} else {
|
|
219
|
+
L = function e(t) {
|
|
220
|
+
return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
return L(e);
|
|
224
|
+
}
|
|
225
|
+
function _(e, t) {
|
|
226
|
+
if (!(e instanceof t)) {
|
|
227
|
+
throw new TypeError("Cannot call a class as a function");
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
function x(e, t) {
|
|
231
|
+
for (var n = 0; n < t.length; n++) {
|
|
232
|
+
var r = t[n];
|
|
233
|
+
r.enumerable = r.enumerable || false;
|
|
234
|
+
r.configurable = true;
|
|
235
|
+
if ("value" in r) r.writable = true;
|
|
236
|
+
Object.defineProperty(e, r.key, r);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function P(e, t, n) {
|
|
240
|
+
if (t) x(e.prototype, t);
|
|
241
|
+
if (n) x(e, n);
|
|
242
|
+
return e;
|
|
243
|
+
}
|
|
244
|
+
function j(e, t) {
|
|
245
|
+
if (typeof t !== "function" && t !== null) {
|
|
246
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
247
|
+
}
|
|
248
|
+
e.prototype = Object.create(t && t.prototype, {
|
|
249
|
+
constructor: {
|
|
250
|
+
value: e,
|
|
251
|
+
writable: true,
|
|
252
|
+
configurable: true
|
|
253
|
+
}
|
|
319
254
|
});
|
|
320
|
-
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
var document = getDocument();
|
|
324
|
-
|
|
325
|
-
if (!Layer.layerContainer) {
|
|
326
|
-
Layer.layerContainer = document.createElement('div');
|
|
327
|
-
Layer.layerContainer.setAttribute('data-test', 'layer-container');
|
|
328
|
-
document.body.appendChild(Layer.layerContainer);
|
|
255
|
+
if (t) q(e, t);
|
|
329
256
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
value: function componentDidMount() {
|
|
337
|
-
if (this.props.open) {
|
|
338
|
-
this.getLayerStack().push(this);
|
|
339
|
-
}
|
|
257
|
+
function q(e, t) {
|
|
258
|
+
q = Object.setPrototypeOf || function e(t, n) {
|
|
259
|
+
t.__proto__ = n;
|
|
260
|
+
return t;
|
|
261
|
+
};
|
|
262
|
+
return q(e, t);
|
|
340
263
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
264
|
+
function T(e) {
|
|
265
|
+
var t = A();
|
|
266
|
+
return function n() {
|
|
267
|
+
var r = K(e), o;
|
|
268
|
+
if (t) {
|
|
269
|
+
var i = K(this).constructor;
|
|
270
|
+
o = Reflect.construct(r, arguments, i);
|
|
271
|
+
} else {
|
|
272
|
+
o = r.apply(this, arguments);
|
|
273
|
+
}
|
|
274
|
+
return R(this, o);
|
|
275
|
+
};
|
|
349
276
|
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
277
|
+
function R(e, t) {
|
|
278
|
+
if (t && (L(t) === "object" || typeof t === "function")) {
|
|
279
|
+
return t;
|
|
280
|
+
}
|
|
281
|
+
return D(e);
|
|
354
282
|
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
283
|
+
function D(e) {
|
|
284
|
+
if (e === void 0) {
|
|
285
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
286
|
+
}
|
|
287
|
+
return e;
|
|
359
288
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
var layerPortal = /*#__PURE__*/(0,external_react_dom_namespaceObject.createPortal)( /*#__PURE__*/external_react_default().createElement(LayerContext.Consumer, null, function (_ref2) {
|
|
371
|
-
var _ref2$separateStackin = _ref2.separateStackingContexts,
|
|
372
|
-
separateStackingContexts = _ref2$separateStackin === void 0 ? false : _ref2$separateStackin;
|
|
373
|
-
return /*#__PURE__*/external_react_default().createElement(StyledLayer // eslint-disable-line jsx-a11y/no-static-element-interactions
|
|
374
|
-
, {
|
|
375
|
-
$separateStackingContexts: separateStackingContexts,
|
|
376
|
-
"data-test": "layer",
|
|
377
|
-
onMouseDown: _this2.handleClickOnLayer,
|
|
378
|
-
onTouchStart: _this2.handleClickOnLayer
|
|
379
|
-
}, children);
|
|
380
|
-
}), Layer.layerContainer // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
|
381
|
-
);
|
|
382
|
-
return /*#__PURE__*/external_react_default().createElement((external_react_default()).Fragment, null, /*#__PURE__*/external_react_default().createElement((EventListener_default()), {
|
|
383
|
-
target: window,
|
|
384
|
-
eventType: "keydown",
|
|
385
|
-
listener: this.handleKeyDownOnWindow,
|
|
386
|
-
key: "eventListenerKeydown"
|
|
387
|
-
}), /*#__PURE__*/external_react_default().createElement((EventListener_default()), {
|
|
388
|
-
target: window,
|
|
389
|
-
eventType: "mousedown",
|
|
390
|
-
listener: this.handleClickOnWindow,
|
|
391
|
-
key: "eventListenerMouseDown"
|
|
392
|
-
}), /*#__PURE__*/external_react_default().createElement((EventListener_default()), {
|
|
393
|
-
target: window,
|
|
394
|
-
eventType: "touchstart",
|
|
395
|
-
listener: this.handleClickOnWindow,
|
|
396
|
-
key: "eventListenerTouchStart",
|
|
397
|
-
options: {
|
|
398
|
-
passive: true
|
|
399
|
-
}
|
|
400
|
-
}), layerPortal);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
return null;
|
|
289
|
+
function A() {
|
|
290
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
291
|
+
if (Reflect.construct.sham) return false;
|
|
292
|
+
if (typeof Proxy === "function") return true;
|
|
293
|
+
try {
|
|
294
|
+
Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
|
|
295
|
+
return true;
|
|
296
|
+
} catch (e) {
|
|
297
|
+
return false;
|
|
298
|
+
}
|
|
404
299
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
300
|
+
function K(e) {
|
|
301
|
+
K = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
|
|
302
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
303
|
+
};
|
|
304
|
+
return K(e);
|
|
305
|
+
}
|
|
306
|
+
function M(e, t, n) {
|
|
307
|
+
if (t in e) {
|
|
308
|
+
Object.defineProperty(e, t, {
|
|
309
|
+
value: n,
|
|
310
|
+
enumerable: true,
|
|
311
|
+
configurable: true,
|
|
312
|
+
writable: true
|
|
313
|
+
});
|
|
314
|
+
} else {
|
|
315
|
+
e[t] = n;
|
|
316
|
+
}
|
|
317
|
+
return e;
|
|
318
|
+
}
|
|
319
|
+
/** @public */ var N = [ "clickAway", "escapeKey" ];
|
|
320
|
+
var W = {
|
|
321
|
+
children: a().node,
|
|
322
|
+
closeReasons: a().arrayOf(a().oneOf(N)),
|
|
323
|
+
onRequestClose: a().func,
|
|
324
|
+
open: a().bool
|
|
325
|
+
};
|
|
326
|
+
var z = {
|
|
327
|
+
closeReasons: N,
|
|
328
|
+
open: false
|
|
329
|
+
};
|
|
330
|
+
var B = function(e) {
|
|
331
|
+
j(n, e);
|
|
332
|
+
var t = T(n);
|
|
333
|
+
// @docs-props-type LayerPropsBase
|
|
334
|
+
// eslint-disable-next-line react/sort-comp
|
|
335
|
+
// LayerStackContext (an array) keeps track of the current instances of Layer. This is
|
|
336
|
+
// used by Layer#handleKeyDown to determine if the escapeKey event should be handled by
|
|
337
|
+
// the current instance. Only the topmost Layer instance should honor the escapeKey.
|
|
338
|
+
// TODO: enable once this is sorted out within the babel/ts ecosystem
|
|
339
|
+
// declare context: React.ContextType<typeof LayerStackContext>;
|
|
340
|
+
function n(e) {
|
|
341
|
+
var r;
|
|
342
|
+
_(this, n);
|
|
343
|
+
r = t.call(this, e);
|
|
344
|
+
M(D(r), "layerClickEvent", null);
|
|
345
|
+
M(D(r), "handleClickOnLayer", (function(e) {
|
|
346
|
+
var t = e.nativeEvent;
|
|
347
|
+
r.layerClickEvent = t;
|
|
348
|
+
}));
|
|
349
|
+
M(D(r), "handleClickOnWindow", (function(e) {
|
|
350
|
+
var t, n;
|
|
351
|
+
// clicks inside the layer should not be considered clickAways
|
|
352
|
+
if (!r.props.open || !u()(r.props.closeReasons, "clickAway") || r.layerClickEvent === e) {
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
(t = (n = r.props).onRequestClose) === null || t === void 0 ? void 0 : t.call(n, {
|
|
356
|
+
event: e,
|
|
357
|
+
reason: "clickAway"
|
|
358
|
+
});
|
|
359
|
+
}));
|
|
360
|
+
M(D(r), "handleKeyDownOnWindow", (function(e) {
|
|
361
|
+
if (r.props.open && (0, y.keycode)(e) === "esc" && s()(r.getLayerStack()) === D(r) && u()(r.props.closeReasons, "escapeKey")) {
|
|
362
|
+
var t, n;
|
|
363
|
+
(t = (n = r.props).onRequestClose) === null || t === void 0 ? void 0 : t.call(n, {
|
|
364
|
+
event: e,
|
|
365
|
+
reason: "escapeKey"
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
}));
|
|
369
|
+
var o = O();
|
|
370
|
+
if (!n.layerContainer) {
|
|
371
|
+
n.layerContainer = o.createElement("div");
|
|
372
|
+
n.layerContainer.setAttribute("data-test", "layer-container");
|
|
373
|
+
o.body.appendChild(n.layerContainer);
|
|
374
|
+
}
|
|
375
|
+
return r;
|
|
376
|
+
}
|
|
377
|
+
P(n, [ {
|
|
378
|
+
key: "componentDidMount",
|
|
379
|
+
value: function e() {
|
|
380
|
+
if (this.props.open) {
|
|
381
|
+
this.getLayerStack().push(this);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}, {
|
|
385
|
+
key: "componentDidUpdate",
|
|
386
|
+
value: function e(t) {
|
|
387
|
+
if (!t.open && this.props.open) {
|
|
388
|
+
this.getLayerStack().push(this);
|
|
389
|
+
} else if (t.open && !this.props.open) {
|
|
390
|
+
p()(this.getLayerStack(), this);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}, {
|
|
394
|
+
key: "componentWillUnmount",
|
|
395
|
+
value: function e() {
|
|
396
|
+
p()(this.getLayerStack(), this);
|
|
397
|
+
}
|
|
398
|
+
}, {
|
|
399
|
+
key: "getLayerStack",
|
|
400
|
+
value: function e() {
|
|
401
|
+
return this.context;
|
|
402
|
+
}
|
|
403
|
+
}, {
|
|
404
|
+
key: "render",
|
|
405
|
+
value: function e() {
|
|
406
|
+
var t = this;
|
|
407
|
+
var i = this.props, a = i.children, c = i.open;
|
|
408
|
+
if (c) {
|
|
409
|
+
var u = (0, o.createPortal)( r().createElement(m.Consumer, null, (function(e) {
|
|
410
|
+
var n = e.separateStackingContexts, o = n === void 0 ? false : n;
|
|
411
|
+
|
|
412
|
+
return r().createElement(S, {
|
|
413
|
+
$separateStackingContexts: o,
|
|
414
|
+
"data-test": "layer",
|
|
415
|
+
onMouseDown: t.handleClickOnLayer,
|
|
416
|
+
onTouchStart: t.handleClickOnLayer
|
|
417
|
+
}, a);
|
|
418
|
+
})), n.layerContainer);
|
|
419
|
+
|
|
420
|
+
return r().createElement(r().Fragment, null, r().createElement(v(), {
|
|
421
|
+
target: window,
|
|
422
|
+
eventType: "keydown",
|
|
423
|
+
listener: this.handleKeyDownOnWindow,
|
|
424
|
+
key: "eventListenerKeydown"
|
|
425
|
+
}), r().createElement(v(), {
|
|
426
|
+
target: window,
|
|
427
|
+
eventType: "mousedown",
|
|
428
|
+
listener: this.handleClickOnWindow,
|
|
429
|
+
key: "eventListenerMouseDown"
|
|
430
|
+
}), r().createElement(v(), {
|
|
431
|
+
target: window,
|
|
432
|
+
eventType: "touchstart",
|
|
433
|
+
listener: this.handleClickOnWindow,
|
|
434
|
+
key: "eventListenerTouchStart",
|
|
435
|
+
options: {
|
|
436
|
+
passive: true
|
|
437
|
+
}
|
|
438
|
+
}), u);
|
|
439
|
+
}
|
|
440
|
+
return null;
|
|
441
|
+
}
|
|
442
|
+
} ]);
|
|
443
|
+
return n;
|
|
444
|
+
}(n.Component);
|
|
445
|
+
M(B, "layerContainer", null);
|
|
446
|
+
M(B, "possibleCloseReasons", N);
|
|
447
|
+
M(B, "propTypes", W);
|
|
448
|
+
M(B, "defaultProps", z);
|
|
449
|
+
M(B, "contextType", h);
|
|
450
|
+
/* harmony default export */ const F = B;
|
|
451
|
+
// CONCATENATED MODULE: ./src/Layer/index.ts
|
|
452
|
+
module.exports = t;
|
|
453
|
+
/******/})();
|