@splunk/react-ui 4.37.0 → 4.38.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/Switch.js CHANGED
@@ -9,26 +9,26 @@
9
9
  /******/ (() => {
10
10
  /******/ // getDefaultExport function for compatibility with non-harmony modules
11
11
  /******/ e.n = r => {
12
- /******/ var t = r && r.__esModule ?
12
+ /******/ var a = r && r.__esModule ?
13
13
  /******/ () => r["default"]
14
14
  /******/ : () => r
15
15
  /******/;
16
- e.d(t, {
17
- a: t
16
+ e.d(a, {
17
+ a
18
18
  });
19
- /******/ return t;
19
+ /******/ return a;
20
20
  /******/ };
21
21
  /******/ })();
22
22
  /******/
23
23
  /******/ /* webpack/runtime/define property getters */
24
24
  /******/ (() => {
25
25
  /******/ // define getter functions for harmony exports
26
- /******/ e.d = (r, t) => {
27
- /******/ for (var a in t) {
28
- /******/ if (e.o(t, a) && !e.o(r, a)) {
29
- /******/ Object.defineProperty(r, a, {
26
+ /******/ e.d = (r, a) => {
27
+ /******/ for (var t in a) {
28
+ /******/ if (e.o(a, t) && !e.o(r, t)) {
29
+ /******/ Object.defineProperty(r, t, {
30
30
  enumerable: true,
31
- get: t[a]
31
+ get: a[t]
32
32
  });
33
33
  /******/ }
34
34
  /******/ }
@@ -64,8 +64,8 @@
64
64
  default: () => /* reexport */ ee
65
65
  });
66
66
  // CONCATENATED MODULE: external "react"
67
- const t = require("react");
68
- var a = e.n(t);
67
+ const a = require("react");
68
+ var t = e.n(a);
69
69
  // CONCATENATED MODULE: external "prop-types"
70
70
  const i = require("prop-types");
71
71
  var o = e.n(i);
@@ -87,7 +87,7 @@
87
87
  var e = (0, b.useSplunkTheme)(), r = e.family;
88
88
  if (r === "enterprise") {
89
89
 
90
- return a().createElement(u(), {
90
+ return t().createElement(u(), {
91
91
  inline: false,
92
92
  size: "12px",
93
93
  screenReaderText: null,
@@ -98,7 +98,7 @@
98
98
  });
99
99
  }
100
100
 
101
- return a().createElement("svg", {
101
+ return t().createElement("svg", {
102
102
  width: "12",
103
103
  height: "12",
104
104
  viewBox: "-1 -2 11 10",
@@ -106,7 +106,7 @@
106
106
  display: "block"
107
107
  },
108
108
  xmlns: "http://www.w3.org/2000/svg"
109
- }, a().createElement("path", {
109
+ }, t().createElement("path", {
110
110
  d: "M8.70711 0.292893C9.09763 0.683417 9.09763 1.31658 8.70711 1.70711L4.32132 6.0929C3.73559 6.67862 2.78596 6.67869 2.20015 6.09305L0.292997 4.18646C-0.0975845 3.79599 -0.0976776 3.16282 0.292789 2.77224C0.683256 2.38166 1.31642 2.38157 1.707 2.77203L3.26061 4.32518L7.29289 0.292893C7.68342 -0.0976311 8.31658 -0.0976311 8.70711 0.292893Z",
111
111
  fill: "currentColor"
112
112
  }));
@@ -376,7 +376,7 @@
376
376
  displayName: "SwitchStyles__StyledToggleSpan",
377
377
  componentId: "sc-844ieu-7"
378
378
  })([ "", "" ], L);
379
- var D = h().label.withConfig({
379
+ var N = h().label.withConfig({
380
380
  displayName: "SwitchStyles__StyledLabel",
381
381
  componentId: "sc-844ieu-8"
382
382
  })([ "", " flex:1 1 auto;padding-left:", ";color:inherit;", ";" ], b.mixins.reset("inline-block"), (0,
@@ -388,59 +388,59 @@
388
388
  return !r && (0, f.css)([ "cursor:pointer;" ]);
389
389
  }));
390
390
  // CONCATENATED MODULE: ./src/Switch/Switch.tsx
391
- function q(e) {
391
+ function D(e) {
392
392
  "@babel/helpers - typeof";
393
393
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
394
- q = function e(r) {
394
+ D = function e(r) {
395
395
  return typeof r;
396
396
  };
397
397
  } else {
398
- q = function e(r) {
398
+ D = function e(r) {
399
399
  return r && typeof Symbol === "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
400
400
  };
401
401
  }
402
- return q(e);
402
+ return D(e);
403
403
  }
404
- function T() {
405
- T = Object.assign || function(e) {
404
+ function q() {
405
+ q = Object.assign || function(e) {
406
406
  for (var r = 1; r < arguments.length; r++) {
407
- var t = arguments[r];
408
- for (var a in t) {
409
- if (Object.prototype.hasOwnProperty.call(t, a)) {
410
- e[a] = t[a];
407
+ var a = arguments[r];
408
+ for (var t in a) {
409
+ if (Object.prototype.hasOwnProperty.call(a, t)) {
410
+ e[t] = a[t];
411
411
  }
412
412
  }
413
413
  }
414
414
  return e;
415
415
  };
416
- return T.apply(this, arguments);
416
+ return q.apply(this, arguments);
417
417
  }
418
- function N(e, r) {
418
+ function T(e, r) {
419
419
  if (e == null) return {};
420
- var t = R(e, r);
421
- var a, i;
420
+ var a = R(e, r);
421
+ var t, i;
422
422
  if (Object.getOwnPropertySymbols) {
423
423
  var o = Object.getOwnPropertySymbols(e);
424
424
  for (i = 0; i < o.length; i++) {
425
- a = o[i];
426
- if (r.indexOf(a) >= 0) continue;
427
- if (!Object.prototype.propertyIsEnumerable.call(e, a)) continue;
428
- t[a] = e[a];
425
+ t = o[i];
426
+ if (r.indexOf(t) >= 0) continue;
427
+ if (!Object.prototype.propertyIsEnumerable.call(e, t)) continue;
428
+ a[t] = e[t];
429
429
  }
430
430
  }
431
- return t;
431
+ return a;
432
432
  }
433
433
  function R(e, r) {
434
434
  if (e == null) return {};
435
- var t = {};
436
- var a = Object.keys(e);
435
+ var a = {};
436
+ var t = Object.keys(e);
437
437
  var i, o;
438
- for (o = 0; o < a.length; o++) {
439
- i = a[o];
438
+ for (o = 0; o < t.length; o++) {
439
+ i = t[o];
440
440
  if (r.indexOf(i) >= 0) continue;
441
- t[i] = e[i];
441
+ a[i] = e[i];
442
442
  }
443
- return t;
443
+ return a;
444
444
  }
445
445
  function B(e, r) {
446
446
  if (!(e instanceof r)) {
@@ -448,17 +448,17 @@
448
448
  }
449
449
  }
450
450
  function M(e, r) {
451
- for (var t = 0; t < r.length; t++) {
452
- var a = r[t];
453
- a.enumerable = a.enumerable || false;
454
- a.configurable = true;
455
- if ("value" in a) a.writable = true;
456
- Object.defineProperty(e, a.key, a);
451
+ for (var a = 0; a < r.length; a++) {
452
+ var t = r[a];
453
+ t.enumerable = t.enumerable || false;
454
+ t.configurable = true;
455
+ if ("value" in t) t.writable = true;
456
+ Object.defineProperty(e, t.key, t);
457
457
  }
458
458
  }
459
- function A(e, r, t) {
459
+ function A(e, r, a) {
460
460
  if (r) M(e.prototype, r);
461
- if (t) M(e, t);
461
+ if (a) M(e, a);
462
462
  return e;
463
463
  }
464
464
  function W(e, r) {
@@ -475,27 +475,27 @@
475
475
  if (r) z(e, r);
476
476
  }
477
477
  function z(e, r) {
478
- z = Object.setPrototypeOf || function e(r, t) {
479
- r.__proto__ = t;
478
+ z = Object.setPrototypeOf || function e(r, a) {
479
+ r.__proto__ = a;
480
480
  return r;
481
481
  };
482
482
  return z(e, r);
483
483
  }
484
484
  function F(e) {
485
485
  var r = V();
486
- return function t() {
487
- var a = X(e), i;
486
+ return function a() {
487
+ var t = X(e), i;
488
488
  if (r) {
489
489
  var o = X(this).constructor;
490
- i = Reflect.construct(a, arguments, o);
490
+ i = Reflect.construct(t, arguments, o);
491
491
  } else {
492
- i = a.apply(this, arguments);
492
+ i = t.apply(this, arguments);
493
493
  }
494
494
  return H(this, i);
495
495
  };
496
496
  }
497
497
  function H(e, r) {
498
- if (r && (q(r) === "object" || typeof r === "function")) {
498
+ if (r && (D(r) === "object" || typeof r === "function")) {
499
499
  return r;
500
500
  }
501
501
  return U(e);
@@ -523,16 +523,16 @@
523
523
  };
524
524
  return X(e);
525
525
  }
526
- function Z(e, r, t) {
526
+ function Z(e, r, a) {
527
527
  if (r in e) {
528
528
  Object.defineProperty(e, r, {
529
- value: t,
529
+ value: a,
530
530
  enumerable: true,
531
531
  configurable: true,
532
532
  writable: true
533
533
  });
534
534
  } else {
535
- e[r] = t;
535
+ e[r] = a;
536
536
  }
537
537
  return e;
538
538
  }
@@ -545,6 +545,8 @@
545
545
  id: o().string,
546
546
  inline: o().bool,
547
547
  /** @private */
548
+ inputClassName: o().string,
549
+ /** @private */
548
550
  interactive: o().bool,
549
551
  labelledBy: o().string,
550
552
  onClick: o().func,
@@ -576,39 +578,39 @@
576
578
  /**
577
579
  * `Switch` is a basic form control with an on/off state.
578
580
  */ var Y = function(e) {
579
- W(t, e);
580
- var r = F(t);
581
- A(t, null, [ {
581
+ W(a, e);
582
+ var r = F(a);
583
+ A(a, null, [ {
582
584
  key: "validateProps",
583
585
  // @docs-props-type SwitchPropsBase
584
586
  value: function e(r) {
585
- var t = r.selected, a = r.appearance;
587
+ var a = r.selected, t = r.appearance;
586
588
  if (false) {}
587
589
  }
588
590
  } ]);
589
- function t(e) {
590
- var a;
591
- B(this, t);
592
- a = r.call(this, e);
593
- Z(U(a), "clickableId", void 0);
594
- Z(U(a), "labelId", void 0);
595
- Z(U(a), "toggle", null);
596
- Z(U(a), "componentDidUpdate", t.validateProps);
597
- Z(U(a), "handleContainerClick", (function(e) {
598
- var r, t;
599
- var i = a.props, o = i.value, n = i.selected;
600
- (r = (t = a.props).onClick) === null || r === void 0 ? void 0 : r.call(t, e, {
591
+ function a(e) {
592
+ var t;
593
+ B(this, a);
594
+ t = r.call(this, e);
595
+ Z(U(t), "clickableId", void 0);
596
+ Z(U(t), "labelId", void 0);
597
+ Z(U(t), "toggle", null);
598
+ Z(U(t), "componentDidUpdate", a.validateProps);
599
+ Z(U(t), "handleContainerClick", (function(e) {
600
+ var r, a;
601
+ var i = t.props, o = i.value, n = i.selected;
602
+ (r = (a = t.props).onClick) === null || r === void 0 ? void 0 : r.call(a, e, {
601
603
  value: o,
602
604
  // @ts-expect-error - safe due to individual prop interfaces
603
605
  selected: n
604
606
  });
605
607
  }));
606
- a.labelId = (0, d.createDOMID)("label");
607
- a.clickableId = (0, d.createDOMID)("clickable");
608
- t.validateProps(e);
609
- return a;
608
+ t.labelId = (0, d.createDOMID)("label");
609
+ t.clickableId = (0, d.createDOMID)("clickable");
610
+ a.validateProps(e);
611
+ return t;
610
612
  }
611
- A(t, [ {
613
+ A(a, [ {
612
614
  key: "focus",
613
615
  /**
614
616
  * Place focus on the toggle.
@@ -621,74 +623,76 @@
621
623
  key: "render",
622
624
  value: function e() {
623
625
  var r = this;
624
- var t = this.props, i = t.appearance, o = t.children, n = t.disabled, s = t.elementRef, d = t.error, p = t.id, u = t.inline, b = t.interactive, f = t.labelledBy, h = t.onClick, g = t.required, m = t.selected, y = t.selectedLabel, k = t.someSelectedLabel, x = t.unselectedLabel, C = t.value, S = N(t, [ "appearance", "children", "disabled", "elementRef", "error", "id", "inline", "interactive", "labelledBy", "onClick", "required", "selected", "selectedLabel", "someSelectedLabel", "unselectedLabel", "value" ]);
625
- var O = f;
626
+ var a = this.props, i = a.appearance, o = a.children, n = a.disabled, s = a.elementRef, d = a.error, p = a.id, u = a.inline, b = a.interactive, f = a.labelledBy, h = a.onClick, g = a.required, m = a.selected, y = a.selectedLabel, k = a.someSelectedLabel, x = a.unselectedLabel, C = a.value, S = a.inputClassName, O = T(a, [ "appearance", "children", "disabled", "elementRef", "error", "id", "inline", "interactive", "labelledBy", "onClick", "required", "selected", "selectedLabel", "someSelectedLabel", "unselectedLabel", "value", "inputClassName" ]);
627
+ var $ = f;
626
628
  // consumer defined external label
627
- var $ = p;
629
+ var L = p;
628
630
  // consumer defined id
629
631
  // if has internal label defined with children....
630
632
  if (o) {
631
- O = this.labelId;
633
+ $ = this.labelId;
632
634
  // must use generated labelId
633
- $ = p || this.clickableId;
635
+ L = p || this.clickableId;
634
636
  // must have an id
635
637
  }
636
- var L = m === "some" ? "mixed" : m;
637
- var j = {
638
+ var j = m === "some" ? "mixed" : m;
639
+ var I = {
638
640
  true: y,
639
641
  false: x,
640
642
  some: k
641
643
  };
642
- var I = {
644
+ var D = {
643
645
  disabled: n,
644
646
  $interactive: b,
645
647
  $error: d,
646
648
  $selected: m === "some" || m,
647
- "aria-labelledby": b ? O : undefined,
648
- "aria-checked": b ? L : undefined,
649
+ "aria-labelledby": b ? $ : undefined,
650
+ "aria-checked": b ? j : undefined,
649
651
  "aria-invalid": d ? true : undefined,
650
652
  "aria-required": g,
651
- id: $,
652
- ref: function e(t) {
653
- r.toggle = t;
653
+ id: L,
654
+ ref: function e(a) {
655
+ r.toggle = a;
654
656
  },
655
657
  onClick: n || !b ? undefined : this.handleContainerClick,
656
658
  "data-test": "button",
657
659
  "data-selected": m
658
660
  };
659
- var q = K[i];
660
- var R = Q[i];
661
- var B = function e(r) {
661
+ var R = K[i];
662
+ var B = Q[i];
663
+ var M = function e(r) {
662
664
  return function() {
663
- var e = a().createElement(a().Fragment, null, a().createElement(P, {
665
+ var e = t().createElement(t().Fragment, null, t().createElement(P, {
664
666
  $delay: r,
665
667
  $disabled: n,
666
668
  $error: !n && d,
667
669
  $selected: m
668
- }), a().createElement(E, {
670
+ }), t().createElement(E, {
669
671
  $delay: r,
670
672
  $error: !n && d
671
673
  }));
672
- return b ? a().createElement(q, T({
673
- role: "switch"
674
- }, I, {
674
+ return b ? t().createElement(R, q({
675
+ role: "switch",
676
+ className: S
677
+ }, D, {
675
678
  $delay: r
676
- }), e) : a().createElement(R, T({}, I, {
679
+ }), e) : t().createElement(B, q({}, D, {
677
680
  $delay: r
678
681
  }), e);
679
682
  };
680
683
  };
681
- var M = function e() {
682
- var r = a().createElement(a().Fragment, null, m === true && i === "checkbox" && a().createElement(v, null), m === "some" && i === "checkbox" && a().createElement(_, null));
683
- return b ? a().createElement(q, T({
684
+ var A = function e() {
685
+ var r = t().createElement(t().Fragment, null, m === true && i === "checkbox" && t().createElement(v, null), m === "some" && i === "checkbox" && t().createElement(_, null));
686
+ return b ? t().createElement(R, q({
684
687
  "data-clickable": true,
685
- role: i
686
- }, I), r) : a().createElement(R, I, r);
688
+ role: i,
689
+ className: S
690
+ }, D), r) : t().createElement(B, D, r);
687
691
  };
688
- var A = n && "disabled" || d && "error" || null;
689
- var W = !!y || !!k || !!x;
692
+ var W = n && "disabled" || d && "error" || null;
693
+ var z = !!y || !!k || !!x;
690
694
 
691
- return a().createElement(w, T({
695
+ return t().createElement(w, q({
692
696
  flex: true,
693
697
  inline: u,
694
698
  "data-test": "switch",
@@ -698,21 +702,21 @@
698
702
  "data-error": d ? true : undefined,
699
703
  "data-disabled": n ? true : undefined,
700
704
  elementRef: s,
701
- $switchState: A
702
- }, S), i === "toggle" && a().createElement(l(), {
703
- on: B("200ms"),
704
- off: B()
705
- }), i !== "toggle" && M(), b && W && a().createElement(c(), null, j["".concat(m)]), o && a().createElement(D, {
705
+ $switchState: W
706
+ }, O), i === "toggle" && t().createElement(l(), {
707
+ on: M("200ms"),
708
+ off: M()
709
+ }), i !== "toggle" && A(), b && z && t().createElement(c(), null, I["".concat(m)]), o && t().createElement(N, {
706
710
  $disabled: n,
707
711
  "data-test": "label",
708
- id: O,
709
- htmlFor: $,
712
+ id: $,
713
+ htmlFor: L,
710
714
  "data-disabled": n || null
711
715
  }, o));
712
716
  }
713
717
  } ]);
714
- return t;
715
- }(t.Component);
718
+ return a;
719
+ }(a.Component);
716
720
  Z(Y, "propTypes", G);
717
721
  Z(Y, "defaultProps", J);
718
722
  /* harmony default export */ const ee = Y;