@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.
Files changed (83) hide show
  1. package/Accordion.js +425 -325
  2. package/Anchor.js +147 -117
  3. package/Animation.js +142 -94
  4. package/AnimationToggle.js +197 -193
  5. package/Box.js +145 -118
  6. package/Breadcrumbs.js +288 -206
  7. package/Button.js +488 -465
  8. package/ButtonGroup.js +160 -128
  9. package/ButtonSimple.js +543 -462
  10. package/CHANGELOG.md +7 -2
  11. package/Calendar.js +1111 -1001
  12. package/Card.js +771 -598
  13. package/CardLayout.js +205 -147
  14. package/Chip.js +509 -488
  15. package/Clickable.js +414 -352
  16. package/CloseButton.js +165 -142
  17. package/Code.js +1808 -2084
  18. package/Code.js.LICENSE.txt +8 -0
  19. package/CollapsiblePanel.js +586 -519
  20. package/Color.js +1066 -1069
  21. package/ColumnLayout.js +402 -363
  22. package/ComboBox.js +891 -794
  23. package/Concertina.js +997 -802
  24. package/ControlGroup.js +687 -594
  25. package/Date.js +567 -547
  26. package/DefinitionList.js +308 -234
  27. package/Divider.js +149 -118
  28. package/Dropdown.js +459 -416
  29. package/DualListbox.js +1479 -1541
  30. package/EventListener.js +94 -97
  31. package/File.js +1051 -969
  32. package/FormRows.js +883 -696
  33. package/Heading.js +216 -193
  34. package/Image.js +446 -402
  35. package/JSONTree.js +690 -551
  36. package/Layer.js +437 -410
  37. package/Link.js +336 -255
  38. package/List.js +213 -161
  39. package/Markdown.js +509 -487
  40. package/Menu.js +1105 -1056
  41. package/Message.js +475 -441
  42. package/MessageBar.js +387 -373
  43. package/Modal.js +810 -634
  44. package/ModalLayer.js +326 -243
  45. package/Monogram.js +308 -276
  46. package/Multiselect.js +3550 -3364
  47. package/Number.js +729 -687
  48. package/Paginator.js +510 -449
  49. package/Paragraph.js +145 -112
  50. package/Popover.js +1459 -1432
  51. package/Progress.js +301 -246
  52. package/RadioBar.js +610 -527
  53. package/RadioList.js +483 -444
  54. package/Resize.js +530 -489
  55. package/ResultsMenu.js +494 -455
  56. package/ScreenReaderContent.js +142 -111
  57. package/Scroll.js +595 -456
  58. package/ScrollContainerContext.js +197 -206
  59. package/Search.js +744 -650
  60. package/Select.js +2442 -2345
  61. package/SidePanel.js +390 -284
  62. package/Slider.js +669 -676
  63. package/SlidingPanels.js +639 -503
  64. package/SplitButton.js +464 -367
  65. package/StaticContent.js +161 -133
  66. package/StepBar.js +386 -358
  67. package/Switch.js +710 -640
  68. package/TabBar.js +726 -680
  69. package/TabLayout.js +406 -322
  70. package/Table.js +4842 -4616
  71. package/Text.js +1170 -1138
  72. package/TextArea.js +1102 -1090
  73. package/Tooltip.js +624 -581
  74. package/TransitionOpen.js +489 -422
  75. package/Typography.js +176 -153
  76. package/WaitSpinner.js +230 -206
  77. package/package.json +5 -5
  78. package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
  79. package/types/src/JSONTree/TreeNode.d.ts +5 -0
  80. package/useForceUpdate.js +112 -82
  81. package/useKeyPress.js +74 -71
  82. package/usePrevious.js +65 -65
  83. package/useRovingFocus.js +122 -138
package/Layer.js CHANGED
@@ -1,426 +1,453 @@
1
- /******/ (() => { // webpackBootstrap
2
- /******/ "use strict";
3
- /******/ // The require scope
4
- /******/ var __webpack_require__ = {};
5
- /******/
6
- /************************************************************************/
7
- /******/ /* webpack/runtime/compat get default export */
8
- /******/ (() => {
9
- /******/ // getDefaultExport function for compatibility with non-harmony modules
10
- /******/ __webpack_require__.n = (module) => {
11
- /******/ var getter = module && module.__esModule ?
12
- /******/ () => (module['default']) :
13
- /******/ () => (module);
14
- /******/ __webpack_require__.d(getter, { a: getter });
15
- /******/ return getter;
16
- /******/ };
17
- /******/ })();
18
- /******/
19
- /******/ /* webpack/runtime/define property getters */
20
- /******/ (() => {
21
- /******/ // define getter functions for harmony exports
22
- /******/ __webpack_require__.d = (exports, definition) => {
23
- /******/ for(var key in definition) {
24
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
25
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
26
- /******/ }
27
- /******/ }
28
- /******/ };
29
- /******/ })();
30
- /******/
31
- /******/ /* webpack/runtime/global */
32
- /******/ (() => {
33
- /******/ __webpack_require__.g = (function() {
34
- /******/ if (typeof globalThis === 'object') return globalThis;
35
- /******/ try {
36
- /******/ return this || new Function('return this')();
37
- /******/ } catch (e) {
38
- /******/ if (typeof window === 'object') return window;
39
- /******/ }
40
- /******/ })();
41
- /******/ })();
42
- /******/
43
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
44
- /******/ (() => {
45
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
46
- /******/ })();
47
- /******/
48
- /******/ /* webpack/runtime/make namespace object */
49
- /******/ (() => {
50
- /******/ // define __esModule on exports
51
- /******/ __webpack_require__.r = (exports) => {
52
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
53
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
54
- /******/ }
55
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
56
- /******/ };
57
- /******/ })();
58
- /******/
59
- /************************************************************************/
60
- var __webpack_exports__ = {};
61
- // ESM COMPAT FLAG
62
- __webpack_require__.r(__webpack_exports__);
63
-
64
- // EXPORTS
65
- __webpack_require__.d(__webpack_exports__, {
66
- LayerContext: () => (/* reexport */ LayerContext),
67
- LayerStackContext: () => (/* reexport */ LayerStackContext),
68
- LayerStackGlobalProvider: () => (/* reexport */ LayerStackGlobalProvider),
69
- "default": () => (/* reexport */ Layer_Layer)
70
- });
71
-
72
- ;// CONCATENATED MODULE: external "react"
73
- const external_react_namespaceObject = require("react");
74
- var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_namespaceObject);
75
- ;// CONCATENATED MODULE: external "react-dom"
76
- const external_react_dom_namespaceObject = require("react-dom");
77
- ;// CONCATENATED MODULE: external "prop-types"
78
- const external_prop_types_namespaceObject = require("prop-types");
79
- var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_namespaceObject);
80
- ;// CONCATENATED MODULE: external "lodash/includes"
81
- const includes_namespaceObject = require("lodash/includes");
82
- var includes_default = /*#__PURE__*/__webpack_require__.n(includes_namespaceObject);
83
- ;// CONCATENATED MODULE: external "lodash/last"
84
- const last_namespaceObject = require("lodash/last");
85
- var last_default = /*#__PURE__*/__webpack_require__.n(last_namespaceObject);
86
- ;// CONCATENATED MODULE: external "lodash/pull"
87
- const pull_namespaceObject = require("lodash/pull");
88
- var pull_default = /*#__PURE__*/__webpack_require__.n(pull_namespaceObject);
89
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
90
- const keyboard_namespaceObject = require("@splunk/ui-utils/keyboard");
91
- ;// CONCATENATED MODULE: external "@splunk/react-ui/EventListener"
92
- const EventListener_namespaceObject = require("@splunk/react-ui/EventListener");
93
- var EventListener_default = /*#__PURE__*/__webpack_require__.n(EventListener_namespaceObject);
94
- ;// CONCATENATED MODULE: ./src/Layer/LayerStack.tsx
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 LayerStackContext = /*#__PURE__*/external_react_default().createContext([]);
104
- var LayerContext = /*#__PURE__*/external_react_default().createContext({});
105
- var propTypes = {
106
- children: (external_prop_types_default()).node,
107
- name: (external_prop_types_default()).string,
108
- scope: (external_prop_types_default()).object,
109
- separateStackingContexts: (external_prop_types_default()).bool
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
- function LayerStackGlobalProvider(_ref) {
120
- var children = _ref.children,
121
- _ref$name = _ref.name,
122
- name = _ref$name === void 0 ? '__splunkui_layer_instances__' : _ref$name,
123
- _ref$scope = _ref.scope,
124
- scope = _ref$scope === void 0 ? typeof window !== 'undefined' ? window : __webpack_require__.g : _ref$scope,
125
- _ref$separateStacking = _ref.separateStackingContexts,
126
- separateStackingContexts = _ref$separateStacking === void 0 ? false : _ref$separateStacking;
127
-
128
- if (!scope[name]) {
129
- scope[name] = []; // eslint-disable-line no-param-reassign
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
- }, children));
139
- }
140
-
141
- LayerStackGlobalProvider.propTypes = propTypes;
142
-
143
- ;// CONCATENATED MODULE: external "styled-components"
144
- const external_styled_components_namespaceObject = require("styled-components");
145
- var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_namespaceObject);
146
- ;// CONCATENATED MODULE: external "@splunk/themes"
147
- const themes_namespaceObject = require("@splunk/themes");
148
- ;// CONCATENATED MODULE: ./src/Layer/LayerStyles.ts
149
-
150
-
151
- var StyledLayer = external_styled_components_default().div.withConfig({
152
- displayName: "LayerStyles__StyledLayer",
153
- componentId: "ii6psl-0"
154
- })(["", ""], function (_ref) {
155
- var $separateStackingContexts = _ref.$separateStackingContexts;
156
- return $separateStackingContexts && (0,external_styled_components_namespaceObject.css)(["isolation:isolate;z-index:", ";"], themes_namespaceObject.variables.zindexLayer);
157
- });
158
-
159
- ;// CONCATENATED MODULE: ./src/utils/ssrDocument.ts
160
- /* eslint-disable @typescript-eslint/no-empty-function */
161
- var ssrDocument = {
162
- body: {
163
- appendChild: function appendChild() {
164
- return [];
165
- }
166
- },
167
- addEventListener: function addEventListener() {},
168
- removeEventListener: function removeEventListener() {},
169
- activeElement: {
170
- blur: function blur() {},
171
- nodeName: ''
172
- },
173
- querySelector: function querySelector() {
174
- return null;
175
- },
176
- querySelectorAll: function querySelectorAll() {
177
- return [];
178
- },
179
- getElementById: function getElementById() {
180
- return null;
181
- },
182
- createEvent: function createEvent() {
183
- return {
184
- initEvent: function initEvent() {}
185
- };
186
- },
187
- createElement: function createElement() {
188
- return {
189
- children: [],
190
- childNodes: [],
191
- style: {},
192
- setAttribute: function setAttribute() {},
193
- getElementsByTagName: function getElementsByTagName() {
194
- return [];
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
- createElementNS: function createElementNS() {
199
- return {};
200
- },
201
- importNode: function importNode() {
202
- return null;
203
- },
204
- location: {
205
- hash: '',
206
- host: '',
207
- hostname: '',
208
- href: '',
209
- origin: '',
210
- pathname: '',
211
- protocol: '',
212
- search: ''
213
- }
214
- };
215
-
216
- function getDocument() {
217
- var doc = typeof document !== 'undefined' ? document : ssrDocument;
218
- return doc;
219
- }
220
-
221
-
222
- ;// CONCATENATED MODULE: ./src/Layer/Layer.tsx
223
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
224
-
225
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
226
-
227
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
228
-
229
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
230
-
231
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
232
-
233
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
234
-
235
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
236
-
237
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
238
-
239
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
240
-
241
- 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; } }
242
-
243
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
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
- return _this;
332
- }
333
-
334
- _createClass(Layer, [{
335
- key: "componentDidMount",
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
- key: "componentDidUpdate",
343
- value: function componentDidUpdate(prevProps) {
344
- if (!prevProps.open && this.props.open) {
345
- this.getLayerStack().push(this);
346
- } else if (prevProps.open && !this.props.open) {
347
- pull_default()(this.getLayerStack(), this);
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
- key: "componentWillUnmount",
352
- value: function componentWillUnmount() {
353
- pull_default()(this.getLayerStack(), this);
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
- key: "getLayerStack",
357
- value: function getLayerStack() {
358
- return this.context;
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
- key: "render",
362
- value: function render() {
363
- var _this2 = this;
364
-
365
- var _this$props3 = this.props,
366
- children = _this$props3.children,
367
- open = _this$props3.open;
368
-
369
- if (open) {
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
- return Layer;
408
- }(external_react_namespaceObject.Component);
409
-
410
- _defineProperty(Layer, "layerContainer", null);
411
-
412
- _defineProperty(Layer, "possibleCloseReasons", possibleCloseReasons);
413
-
414
- _defineProperty(Layer, "propTypes", Layer_propTypes);
415
-
416
- _defineProperty(Layer, "defaultProps", defaultProps);
417
-
418
- _defineProperty(Layer, "contextType", LayerStackContext);
419
-
420
- /* harmony default export */ const Layer_Layer = (Layer);
421
- ;// CONCATENATED MODULE: ./src/Layer/index.ts
422
-
423
-
424
- module.exports = __webpack_exports__;
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
+ /******/})();