@splunk/react-ui 4.44.1 → 4.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Layer.js CHANGED
@@ -76,7 +76,7 @@
76
76
  LayerContext: () => /* reexport */ h,
77
77
  LayerStackContext: () => /* reexport */ v,
78
78
  LayerStackGlobalProvider: () => /* reexport */ b,
79
- default: () => /* reexport */ I
79
+ default: () => /* reexport */ J
80
80
  });
81
81
  // CONCATENATED MODULE: external "react"
82
82
  const n = require("react");
@@ -87,14 +87,14 @@
87
87
  const i = require("prop-types");
88
88
  var a = e.n(i);
89
89
  // CONCATENATED MODULE: external "lodash/includes"
90
- const l = require("lodash/includes");
91
- var c = e.n(l);
90
+ const u = require("lodash/includes");
91
+ var c = e.n(u);
92
92
  // CONCATENATED MODULE: external "lodash/last"
93
- const u = require("lodash/last");
94
- var s = e.n(u);
93
+ const l = require("lodash/last");
94
+ var s = e.n(l);
95
95
  // CONCATENATED MODULE: external "lodash/pull"
96
- const p = require("lodash/pull");
97
- var f = e.n(p);
96
+ const f = require("lodash/pull");
97
+ var p = e.n(f);
98
98
  // CONCATENATED MODULE: external "@splunk/react-ui/EventListener"
99
99
  const y = require("@splunk/react-ui/EventListener");
100
100
  var d = e.n(y);
@@ -118,12 +118,12 @@
118
118
  * Applications should only use this provider if there's a known need to support multiple
119
119
  * instances of this library on the same page.
120
120
  */ function b(t) {
121
- var o = t.children, i = t.name, a = i === void 0 ? "__splunkui_layer_instances__" : i, l = t.scope, c = l === void 0 ? typeof window !== "undefined" ? window : e.g : l, u = t.separateStackingContexts, s = u === void 0 ? false : u;
121
+ var o = t.children, i = t.name, a = i === void 0 ? "__splunkui_layer_instances__" : i, u = t.scope, c = u === void 0 ? typeof window !== "undefined" ? window : e.g : u, l = t.separateStackingContexts, s = l === void 0 ? false : l;
122
122
  if (!c[a]) {
123
123
  c[a] = [];
124
124
  // eslint-disable-line no-param-reassign
125
125
  }
126
- var p = (0, n.useMemo)((function() {
126
+ var f = (0, n.useMemo)((function() {
127
127
  return {
128
128
  separateStackingContexts: s
129
129
  };
@@ -132,22 +132,22 @@
132
132
  return r().createElement(v.Provider, {
133
133
  value: c[a]
134
134
  }, r().createElement(h.Provider, {
135
- value: p
135
+ value: f
136
136
  }, o));
137
137
  }
138
138
  b.propTypes = m;
139
139
  // CONCATENATED MODULE: external "styled-components"
140
- const w = require("styled-components");
141
- var g = e.n(w);
140
+ const g = require("styled-components");
141
+ var w = e.n(g);
142
142
  // CONCATENATED MODULE: external "@splunk/themes"
143
143
  const C = require("@splunk/themes");
144
144
  // CONCATENATED MODULE: ./src/Layer/LayerStyles.ts
145
- var k = g().div.withConfig({
145
+ var k = w().div.withConfig({
146
146
  displayName: "LayerStyles__StyledLayer",
147
147
  componentId: "ii6psl-0"
148
148
  })([ "", "" ], (function(e) {
149
149
  var t = e.$separateStackingContexts;
150
- return t && (0, w.css)([ "isolation:isolate;z-index:", ";" ], C.variables.zindexLayer);
150
+ return t && (0, g.css)([ "isolation:isolate;position:relative;z-index:", ";" ], C.variables.zindexLayer);
151
151
  }));
152
152
  // CONCATENATED MODULE: ./src/utils/ssrDocument.ts
153
153
  /* eslint-disable @typescript-eslint/no-empty-function */
@@ -209,31 +209,96 @@
209
209
  var e = typeof document !== "undefined" ? document : S;
210
210
  return e;
211
211
  }
212
+ var O = E();
213
+ /* harmony default export */ const T = /* unused pure expression or super */ null && O;
214
+ // CONCATENATED MODULE: ./src/utils/ssrWindow.ts
215
+ /* eslint-disable @typescript-eslint/no-empty-function */
216
+ var L = {
217
+ document: S,
218
+ navigator: {
219
+ userAgent: ""
220
+ },
221
+ location: {
222
+ hash: "",
223
+ host: "",
224
+ hostname: "",
225
+ href: "",
226
+ origin: "",
227
+ pathname: "",
228
+ protocol: "",
229
+ search: ""
230
+ },
231
+ history: {
232
+ replaceState: function e() {},
233
+ pushState: function e() {},
234
+ go: function e() {},
235
+ back: function e() {}
236
+ },
237
+ CustomEvent: function e() {
238
+ return this;
239
+ },
240
+ addEventListener: function e() {},
241
+ removeEventListener: function e() {},
242
+ getComputedStyle: function e() {
243
+ return {
244
+ getPropertyValue: function e() {
245
+ return "";
246
+ }
247
+ };
248
+ },
249
+ Image: function e() {},
250
+ Date: function e() {},
251
+ screen: {},
252
+ setTimeout: function e() {},
253
+ clearTimeout: function e() {},
254
+ matchMedia: function e() {
255
+ return {};
256
+ },
257
+ requestAnimationFrame: function e(t) {
258
+ if (typeof setTimeout === "undefined") {
259
+ t();
260
+ return null;
261
+ }
262
+ return setTimeout(t, 0);
263
+ },
264
+ cancelAnimationFrame: function e(t) {
265
+ if (typeof setTimeout === "undefined") {
266
+ return;
267
+ }
268
+ clearTimeout(t);
269
+ }
270
+ };
271
+ function j() {
272
+ var e = typeof window !== "undefined" ? window : L;
273
+ return e;
274
+ }
275
+ var P = j();
276
+ /* harmony default export */ const _ = P;
212
277
  // CONCATENATED MODULE: ./src/Layer/Layer.tsx
213
- function O(e) {
278
+ function x(e) {
214
279
  "@babel/helpers - typeof";
215
- return O = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
280
+ return x = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
216
281
  return typeof e;
217
282
  } : function(e) {
218
283
  return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
219
- }, O(e);
284
+ }, x(e);
220
285
  }
221
- function j(e, t) {
286
+ function q(e, t) {
222
287
  if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
223
288
  }
224
- function L(e, t) {
289
+ function R(e, t) {
225
290
  for (var n = 0; n < t.length; n++) {
226
291
  var r = t[n];
227
292
  r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
228
- Object.defineProperty(e, A(r.key), r);
293
+ Object.defineProperty(e, z(r.key), r);
229
294
  }
230
295
  }
231
- function P(e, t, n) {
232
- return t && L(e.prototype, t), n && L(e, n), Object.defineProperty(e, "prototype", {
296
+ function A(e, t, n) {
297
+ return t && R(e.prototype, t), n && R(e, n), Object.defineProperty(e, "prototype", {
233
298
  writable: !1
234
299
  }), e;
235
300
  }
236
- function _(e, t) {
301
+ function D(e, t) {
237
302
  if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
238
303
  e.prototype = Object.create(t && t.prototype, {
239
304
  constructor: {
@@ -243,83 +308,83 @@
243
308
  }
244
309
  }), Object.defineProperty(e, "prototype", {
245
310
  writable: !1
246
- }), t && T(e, t);
311
+ }), t && M(e, t);
247
312
  }
248
- function T(e, t) {
249
- return T = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
313
+ function M(e, t) {
314
+ return M = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
250
315
  return e.__proto__ = t, e;
251
- }, T(e, t);
316
+ }, M(e, t);
252
317
  }
253
- function x(e) {
254
- var t = D();
318
+ function F(e) {
319
+ var t = W();
255
320
  return function() {
256
- var n, r = M(e);
321
+ var n, r = B(e);
257
322
  if (t) {
258
- var o = M(this).constructor;
323
+ var o = B(this).constructor;
259
324
  n = Reflect.construct(r, arguments, o);
260
325
  } else n = r.apply(this, arguments);
261
- return q(this, n);
326
+ return N(this, n);
262
327
  };
263
328
  }
264
- function q(e, t) {
265
- if (t && ("object" == O(t) || "function" == typeof t)) return t;
329
+ function N(e, t) {
330
+ if (t && ("object" == x(t) || "function" == typeof t)) return t;
266
331
  if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
267
- return R(e);
332
+ return K(e);
268
333
  }
269
- function R(e) {
334
+ function K(e) {
270
335
  if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
271
336
  return e;
272
337
  }
273
- function D() {
338
+ function W() {
274
339
  try {
275
340
  var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
276
341
  } catch (e) {}
277
- return (D = function t() {
342
+ return (W = function t() {
278
343
  return !!e;
279
344
  })();
280
345
  }
281
- function M(e) {
282
- return M = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
346
+ function B(e) {
347
+ return B = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
283
348
  return e.__proto__ || Object.getPrototypeOf(e);
284
- }, M(e);
349
+ }, B(e);
285
350
  }
286
- function N(e, t, n) {
287
- return (t = A(t)) in e ? Object.defineProperty(e, t, {
351
+ function I(e, t, n) {
352
+ return (t = z(t)) in e ? Object.defineProperty(e, t, {
288
353
  value: n,
289
354
  enumerable: !0,
290
355
  configurable: !0,
291
356
  writable: !0
292
357
  }) : e[t] = n, e;
293
358
  }
294
- function A(e) {
295
- var t = K(e, "string");
296
- return "symbol" == O(t) ? t : t + "";
359
+ function z(e) {
360
+ var t = U(e, "string");
361
+ return "symbol" == x(t) ? t : t + "";
297
362
  }
298
- function K(e, t) {
299
- if ("object" != O(e) || !e) return e;
363
+ function U(e, t) {
364
+ if ("object" != x(e) || !e) return e;
300
365
  var n = e[Symbol.toPrimitive];
301
366
  if (void 0 !== n) {
302
367
  var r = n.call(e, t || "default");
303
- if ("object" != O(r)) return r;
368
+ if ("object" != x(r)) return r;
304
369
  throw new TypeError("@@toPrimitive must return a primitive value.");
305
370
  }
306
371
  return ("string" === t ? String : Number)(e);
307
372
  }
308
373
  /** @public */
309
- /** @public */ var W = [ "clickAway", "escapeKey" ];
310
- var F = {
374
+ /** @public */ var $ = [ "clickAway", "escapeKey" ];
375
+ var G = {
311
376
  children: a().node,
312
- closeReasons: a().arrayOf(a().oneOf(W)),
377
+ closeReasons: a().arrayOf(a().oneOf($)),
313
378
  onRequestClose: a().func,
314
379
  open: a().bool
315
380
  };
316
- var B = {
317
- closeReasons: W,
381
+ var V = {
382
+ closeReasons: $,
318
383
  open: false
319
384
  };
320
- var z = function(e) {
321
- _(n, e);
322
- var t = x(n);
385
+ var H = function(e) {
386
+ D(n, e);
387
+ var t = F(n);
323
388
  // @docs-props-type LayerPropsBase
324
389
  // eslint-disable-next-line react/sort-comp
325
390
  // LayerStackContext (an array) keeps track of the current instances of Layer. This is
@@ -327,14 +392,14 @@
327
392
  // the current instance. Only the topmost Layer instance should honor the escapeKey.
328
393
  function n(e) {
329
394
  var r;
330
- j(this, n);
395
+ q(this, n);
331
396
  r = t.call(this, e);
332
- N(R(r), "layerClickEvent", null);
333
- N(R(r), "handleClickOnLayer", (function(e) {
397
+ I(K(r), "layerClickEvent", null);
398
+ I(K(r), "handleClickOnLayer", (function(e) {
334
399
  var t = e.nativeEvent;
335
400
  r.layerClickEvent = t;
336
401
  }));
337
- N(R(r), "handleClickOnWindow", (function(e) {
402
+ I(K(r), "handleClickOnWindow", (function(e) {
338
403
  var t, n;
339
404
  // clicks inside the layer should not be considered clickAways
340
405
  if (!r.props.open || !c()(r.props.closeReasons, "clickAway") || r.layerClickEvent === e) {
@@ -345,8 +410,8 @@
345
410
  reason: "clickAway"
346
411
  });
347
412
  }));
348
- N(R(r), "handleKeyDownOnWindow", (function(e) {
349
- if (r.props.open && e.key === "Escape" && s()(r.getLayerStack()) === R(r) && c()(r.props.closeReasons, "escapeKey")) {
413
+ I(K(r), "handleKeyDownOnWindow", (function(e) {
414
+ if (r.props.open && e.key === "Escape" && s()(r.getLayerStack()) === K(r) && c()(r.props.closeReasons, "escapeKey")) {
350
415
  var t, n;
351
416
  (t = (n = r.props).onRequestClose) === null || t === void 0 ? void 0 : t.call(n, {
352
417
  event: e,
@@ -362,7 +427,7 @@
362
427
  }
363
428
  return r;
364
429
  }
365
- P(n, [ {
430
+ A(n, [ {
366
431
  key: "componentDidMount",
367
432
  value: function e() {
368
433
  if (this.props.open) {
@@ -375,13 +440,13 @@
375
440
  if (!t.open && this.props.open) {
376
441
  this.getLayerStack().push(this);
377
442
  } else if (t.open && !this.props.open) {
378
- f()(this.getLayerStack(), this);
443
+ p()(this.getLayerStack(), this);
379
444
  }
380
445
  }
381
446
  }, {
382
447
  key: "componentWillUnmount",
383
448
  value: function e() {
384
- f()(this.getLayerStack(), this);
449
+ p()(this.getLayerStack(), this);
385
450
  }
386
451
  }, {
387
452
  key: "getLayerStack",
@@ -395,15 +460,15 @@
395
460
  key: "render",
396
461
  value: function e() {
397
462
  var t = this;
398
- var i = this.props, a = i.children, l = i.open;
463
+ var i = this.props, a = i.children, u = i.open;
399
464
  var c = r().createElement(d(), {
400
- target: window,
465
+ target: _,
401
466
  eventType: "fullscreenchange",
402
467
  listener: n.handleFullScreenChange,
403
468
  key: "fullScreenChange"
404
469
  });
405
- if (l) {
406
- var u = (0, o.createPortal)( r().createElement(h.Consumer, null, (function(e) {
470
+ if (u) {
471
+ var l = (0, o.createPortal)( r().createElement(h.Consumer, null, (function(e) {
407
472
  var n = e.separateStackingContexts, o = n === void 0 ? false : n;
408
473
 
409
474
  return r().createElement(k, {
@@ -415,24 +480,24 @@
415
480
  })), n.layerContainer);
416
481
 
417
482
  return r().createElement(r().Fragment, null, r().createElement(d(), {
418
- target: window,
483
+ target: _,
419
484
  eventType: "keydown",
420
485
  listener: this.handleKeyDownOnWindow,
421
486
  key: "eventListenerKeydown"
422
487
  }), r().createElement(d(), {
423
- target: window,
488
+ target: _,
424
489
  eventType: "mousedown",
425
490
  listener: this.handleClickOnWindow,
426
491
  key: "eventListenerMouseDown"
427
492
  }), r().createElement(d(), {
428
- target: window,
493
+ target: _,
429
494
  eventType: "touchstart",
430
495
  listener: this.handleClickOnWindow,
431
496
  key: "eventListenerTouchStart",
432
497
  options: {
433
498
  passive: true
434
499
  }
435
- }), c, u);
500
+ }), c, l);
436
501
  }
437
502
  // the fragment has to be present to avoid type issues with React 18
438
503
  // eslint-disable-next-line react/jsx-no-useless-fragment
@@ -442,22 +507,22 @@
442
507
  } ]);
443
508
  return n;
444
509
  }(n.Component);
445
- N(z, "layerContainer", null);
446
- N(z, "possibleCloseReasons", W);
447
- N(z, "propTypes", F);
448
- N(z, "defaultProps", B);
449
- N(z, "contextType", v);
450
- N(z, "handleFullScreenChange", (function() {
451
- if (z.layerContainer) {
510
+ I(H, "layerContainer", null);
511
+ I(H, "possibleCloseReasons", $);
512
+ I(H, "propTypes", G);
513
+ I(H, "defaultProps", V);
514
+ I(H, "contextType", v);
515
+ I(H, "handleFullScreenChange", (function() {
516
+ if (H.layerContainer) {
452
517
  var e = E();
453
518
  if (e.fullscreenElement != null) {
454
- e.fullscreenElement.appendChild(z.layerContainer);
519
+ e.fullscreenElement.appendChild(H.layerContainer);
455
520
  } else {
456
- e.body.appendChild(z.layerContainer);
521
+ e.body.appendChild(H.layerContainer);
457
522
  }
458
523
  }
459
524
  }));
460
- /* harmony default export */ const I = z;
525
+ /* harmony default export */ const J = H;
461
526
  // CONCATENATED MODULE: ./src/Layer/index.ts
462
527
  module.exports = t;
463
528
  /******/})();