@splunk/react-ui 4.22.1 → 4.24.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.
Files changed (45) hide show
  1. package/Breadcrumbs.js +99 -124
  2. package/CHANGELOG.md +26 -0
  3. package/Color.js +289 -293
  4. package/ComboBox.js +49 -37
  5. package/DualListbox.js +2 -2
  6. package/File.js +15 -15
  7. package/JSONTree.js +268 -250
  8. package/MIGRATION.mdx +14 -0
  9. package/Menu.js +643 -472
  10. package/Modal.js +261 -222
  11. package/Multiselect.js +793 -779
  12. package/ResultsMenu.js +863 -148
  13. package/Search.js +3 -1
  14. package/Select.js +47 -36
  15. package/TabBar.js +2 -2
  16. package/Table.js +2 -2
  17. package/Tree.js +617 -0
  18. package/package.json +5 -4
  19. package/types/src/Breadcrumbs/Breadcrumbs.d.ts +7 -1
  20. package/types/src/Breadcrumbs/Item.d.ts +8 -2
  21. package/types/src/ComboBox/ComboBox.d.ts +6 -0
  22. package/types/src/Dropdown/Dropdown.d.ts +2 -2
  23. package/types/src/JSONTree/JSONTree.d.ts +23 -13
  24. package/types/src/JSONTree/TreeNode.d.ts +4 -3
  25. package/types/src/JSONTree/docs/examples/ExpandChildrenOnShiftKey.d.ts +1 -0
  26. package/types/src/Menu/Menu.d.ts +14 -1
  27. package/types/src/Modal/Modal.d.ts +6 -0
  28. package/types/src/Multiselect/Compact.d.ts +7 -1
  29. package/types/src/Multiselect/Multiselect.d.ts +8 -1
  30. package/types/src/ResultsMenu/ResultsMenu.d.ts +53 -1
  31. package/types/src/ResultsMenu/VirtualizedResultsMenu/VirtualizedItem.d.ts +9 -0
  32. package/types/src/ResultsMenu/VirtualizedResultsMenu/VirtualizedResultsMenu.d.ts +33 -0
  33. package/types/src/ResultsMenu/VirtualizedResultsMenu/groupChildren.d.ts +16 -0
  34. package/types/src/ResultsMenu/VirtualizedResultsMenu/index.d.ts +3 -0
  35. package/types/src/ResultsMenu/VirtualizedResultsMenu/injectVirtualizedItem.d.ts +21 -0
  36. package/types/src/ResultsMenu/index.d.ts +2 -1
  37. package/types/src/Select/Select.d.ts +2 -0
  38. package/types/src/Select/SelectBase.d.ts +7 -1
  39. package/types/src/Tree/Tree.d.ts +24 -0
  40. package/types/src/Tree/TreeContext.d.ts +13 -0
  41. package/types/src/Tree/TreeItem.d.ts +31 -0
  42. package/types/src/Tree/index.d.ts +3 -0
  43. package/types/src/Tree/treeUtils.d.ts +29 -0
  44. package/types/src/JSONTree/docs/examples/WithShiftModifier.d.ts +0 -1
  45. /package/types/src/Card/docs/examples/{prisma/Actions.d.ts → Actions.d.ts} +0 -0
package/ComboBox.js CHANGED
@@ -206,9 +206,9 @@
206
206
  function T(e) {
207
207
  var t = H();
208
208
  return function n() {
209
- var o = K(e), r;
209
+ var o = z(e), r;
210
210
  if (t) {
211
- var i = K(this).constructor;
211
+ var i = z(this).constructor;
212
212
  r = Reflect.construct(o, arguments, i);
213
213
  } else {
214
214
  r = o.apply(this, arguments);
@@ -239,13 +239,13 @@
239
239
  return false;
240
240
  }
241
241
  }
242
- function K(e) {
243
- K = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
242
+ function z(e) {
243
+ z = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
244
244
  return t.__proto__ || Object.getPrototypeOf(t);
245
245
  };
246
- return K(e);
246
+ return z(e);
247
247
  }
248
- function N(e, t, n) {
248
+ function K(e, t, n) {
249
249
  if (t in e) {
250
250
  Object.defineProperty(e, t, {
251
251
  value: n,
@@ -258,7 +258,7 @@
258
258
  }
259
259
  return e;
260
260
  }
261
- var z = {
261
+ var N = {
262
262
  /** @private */
263
263
  active: i().bool,
264
264
  description: i().string,
@@ -295,8 +295,8 @@
295
295
  r[i] = arguments[i];
296
296
  }
297
297
  e = t.call.apply(t, [ this ].concat(r));
298
- N(F(e), "item", null);
299
- N(F(e), "handleClick", (function(t) {
298
+ K(F(e), "item", null);
299
+ K(F(e), "handleClick", (function(t) {
300
300
  var n = e.props, o = n.disabled, r = n.onClick, i = n.value;
301
301
  if (!o) {
302
302
  r === null || r === void 0 ? void 0 : r(t, {
@@ -335,8 +335,8 @@
335
335
  } ]);
336
336
  return n;
337
337
  }(n.PureComponent);
338
- N(U, "propTypes", z);
339
- N(U, "defaultProps", W);
338
+ K(U, "propTypes", N);
339
+ K(U, "defaultProps", W);
340
340
  /* harmony default export */ const X = U;
341
341
  // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
342
342
  /**
@@ -537,7 +537,9 @@
537
537
  placeholder: i().string,
538
538
  prepend: i().bool,
539
539
  size: i().oneOf([ "small", "medium", "large" ]),
540
- value: i().string
540
+ value: i().string,
541
+ /** @private. */
542
+ virtualization: i().number
541
543
  };
542
544
  var fe = {
543
545
  animateLoading: false,
@@ -614,6 +616,7 @@
614
616
  ce(ae(i), "handleChange", (function(e, t) {
615
617
  var n, o;
616
618
  var r = t.value, a = t.selectedOption;
619
+ e.stopPropagation();
617
620
  var l = i.props.name;
618
621
  var u = a ? undefined : r;
619
622
  if (i.isControlled()) {
@@ -713,41 +716,41 @@
713
716
  }));
714
717
  ce(ae(i), "renderMenu", (function(e) {
715
718
  var t = e.anchorWidth, r = e.maxHeight;
716
- var a = i.props, l = a.children, u = a.controlledFilter, s = a.isLoadingOptions, f = a.menuStyle, p = a.onScrollBottom;
717
- var d = i.state, v = d.activeIndex, y = d.typedValue;
718
- var g = i.getValue();
719
- var S = n.Children.toArray(l).filter(n.isValidElement);
720
- var C = b()(S, (function(e) {
719
+ var a = i.props, l = a.children, u = a.controlledFilter, s = a.isLoadingOptions, f = a.menuStyle, p = a.onScrollBottom, d = a.virtualization;
720
+ var v = i.state, y = v.activeIndex, g = v.typedValue;
721
+ var S = i.getValue();
722
+ var C = n.Children.toArray(l).filter(n.isValidElement);
723
+ var w = b()(C, (function(e) {
721
724
  if (e.type === I.Heading) {
722
725
  return false;
723
726
  }
724
727
  if (e.props.label === undefined) {
725
- return e.props.value === g;
728
+ return e.props.value === S;
726
729
  }
727
- if (e.props.label !== undefined && y !== undefined) {
728
- return e.props.label === g;
730
+ if (e.props.label !== undefined && g !== undefined) {
731
+ return e.props.label === S;
729
732
  }
730
- return e.props.value === g;
733
+ return e.props.value === S;
731
734
  }));
732
- if (!C && g) {
733
- S.unshift( o().createElement(X, {
735
+ if (!w && S) {
736
+ C.unshift( o().createElement(X, {
734
737
  description: (0, O._)("(New value)"),
735
738
  descriptionPosition: "right",
736
739
  key: "currentValueOption",
737
- value: g,
738
- "data-test-current-value-option": g
740
+ value: S,
741
+ "data-test-current-value-option": S
739
742
  }));
740
743
  }
741
744
  // Highlight Active
742
745
  i.availableOptionCount = 0;
743
746
  i.activeValue = undefined;
744
- var w = (0, m.stringToKeywords)(y ? g : i.getDisplayValue());
745
- i.options = (u ? S : S.filter((function(e) {
747
+ var j = (0, m.stringToKeywords)(g ? S : i.getDisplayValue());
748
+ i.options = (u ? C : C.filter((function(e) {
746
749
  if (e.props.label !== undefined) {
747
- return (0, m.testPhrase)(e.props.label, w);
750
+ return (0, m.testPhrase)(e.props.label, j);
748
751
  }
749
752
  if (e.props.value !== undefined) {
750
- return (0, m.testPhrase)(e.props.value, w);
753
+ return (0, m.testPhrase)(e.props.value, j);
751
754
  }
752
755
  return true;
753
756
  // Keep all headers and non-interactive options
@@ -756,13 +759,15 @@
756
759
  // ignore Headings and Dividers
757
760
  return e;
758
761
  }
759
- var o = i.availableOptionCount === v;
762
+ var o = i.availableOptionCount === y;
760
763
  i.availableOptionCount += 1;
761
764
  var r = e.props.label !== undefined ? e.props.label : e.props.value;
762
765
  var a = e.props.matchRanges;
763
- var l = !u && g && (C || t > 0) ? (0, m.keywordLocations)(r, w) || undefined : undefined;
766
+ var l = !u && S && (w || t > 0) ? (0, m.keywordLocations)(r, j) || undefined : undefined;
764
767
  if (o) {
765
- i.activeValue = e.props.value;
768
+ if (!e.props.disabled) {
769
+ i.activeValue = e.props.value;
770
+ }
766
771
 
767
772
  return (0, n.cloneElement)(e, {
768
773
  ref: i.handleActiveOptionMount,
@@ -778,18 +783,25 @@
778
783
  matchRanges: a || l
779
784
  });
780
785
  }));
781
- var k = de({
786
+ var x = de({
782
787
  anchorWidth: t,
783
788
  maxHeight: r,
784
789
  menuStyle: f
785
790
  });
786
-
787
- return o().createElement(P(), J({
788
- style: k,
791
+ var R = Z({
792
+ style: x,
789
793
  controlledExternally: true,
790
794
  onScrollBottom: p ? i.handleScrollBottom : undefined,
791
795
  isLoading: s
792
- }, h()(i.props, "className", "noOptionsMessage", "footerMessage", "animateLoading", "loadingMessage", "onScroll")), i.options);
796
+ }, h()(i.props, "className", "noOptionsMessage", "footerMessage", "animateLoading", "loadingMessage", "onScroll"));
797
+ if (d) {
798
+
799
+ return o().createElement(k.VirtualizedResultsMenu, J({
800
+ virtualization: d
801
+ }, R), i.options);
802
+ }
803
+
804
+ return o().createElement(P(), R, i.options);
793
805
  }));
794
806
  i.state = {
795
807
  activeIndex: 0,
package/DualListbox.js CHANGED
@@ -574,7 +574,7 @@
574
574
  }, n().createElement(m(), {
575
575
  "aria-hidden": true,
576
576
  id: f.current
577
- }, (0, d.sprintf)((0, l._)("Select All %(listName)s Options"), {
577
+ }, (0, d.sprintf)((0, l._)("Select all %(listName)s Options"), {
578
578
  listName: c
579
579
  })), n().createElement(U(), {
580
580
  appearance: "checkbox",
@@ -589,7 +589,7 @@
589
589
  htmlFor: i
590
590
  }, c), n().createElement("span", {
591
591
  "aria-hidden": true
592
- }, "".concat(C, "/").concat(x, " Selected"))));
592
+ }, "".concat(C, "/").concat(x, " selected"))));
593
593
  }
594
594
  ce.propTypes = ue;
595
595
  /* harmony default export */ const se = ce;
package/File.js CHANGED
@@ -101,8 +101,8 @@
101
101
  const w = require("@splunk/react-icons/enterprise/Close");
102
102
  var L = e.n(w);
103
103
  // CONCATENATED MODULE: external "@splunk/react-ui/Progress"
104
- const S = require("@splunk/react-ui/Progress");
105
- var O = e.n(S);
104
+ const O = require("@splunk/react-ui/Progress");
105
+ var S = e.n(O);
106
106
  // CONCATENATED MODULE: external "@splunk/ui-utils/format"
107
107
  const I = require("@splunk/ui-utils/format");
108
108
  // CONCATENATED MODULE: ./src/File/FileContext.tsx
@@ -426,7 +426,7 @@
426
426
  index: c
427
427
  });
428
428
  }
429
- var S = (0, t.useContext)(_), E = S.onRequestRetry;
429
+ var O = (0, t.useContext)(_), E = O.onRequestRetry;
430
430
  function R(e) {
431
431
  e.preventDefault();
432
432
  E === null || E === void 0 ? void 0 : E({
@@ -502,7 +502,7 @@
502
502
  "aria-valuenow": p,
503
503
  "aria-valuemin": 0,
504
504
  "aria-valuemax": 100
505
- }) : a().createElement(O(), {
505
+ }) : a().createElement(S(), {
506
506
  style: {
507
507
  position: "absolute",
508
508
  left: 0,
@@ -756,12 +756,12 @@
756
756
  Object.defineProperty(e, a.key, a);
757
757
  }
758
758
  }
759
- function Se(e, r, t) {
759
+ function Oe(e, r, t) {
760
760
  if (r) Le(e.prototype, r);
761
761
  if (t) Le(e, t);
762
762
  return e;
763
763
  }
764
- function Oe(e, r) {
764
+ function Se(e, r) {
765
765
  if (typeof r !== "function" && r !== null) {
766
766
  throw new TypeError("Super expression must either be null or a function");
767
767
  }
@@ -867,7 +867,7 @@
867
867
  * file readers, only a reference to the file. This can be used to post binary content, or
868
868
  * upload using an array buffer.
869
869
  */ var $e = function(e) {
870
- Oe(n, e);
870
+ Se(n, e);
871
871
  var r = _e(n);
872
872
  // @docs-props-type FilePropsBase
873
873
  function n(e) {
@@ -919,7 +919,7 @@
919
919
  t.handleDragLeave = l()(t.handleDragLeave, 300);
920
920
  return t;
921
921
  }
922
- Se(n, [ {
922
+ Oe(n, [ {
923
923
  key: "addFiles",
924
924
  value: function e(r) {
925
925
  var t = this.props.name;
@@ -943,7 +943,7 @@
943
943
  var r = this.props, n = r.accept, i = r.allowMultiple, o = r.children, l = r.disabled, s = r.dropAnywhere, p = r.error, u = r.fullscreen, f = r.help, b = r.name, y = r.onRequestRemove, g = r.onRequestRetry, C = r.required, x = r.splunkTheme, k = xe(r, [ "accept", "allowMultiple", "children", "disabled", "dropAnywhere", "error", "fullscreen", "help", "name", "onRequestRemove", "onRequestRetry", "required", "splunkTheme" ]);
944
944
  var w = x.isPrisma;
945
945
  var L = 0;
946
- var S = t.Children.toArray(o).filter(t.isValidElement).map((function(e, r) {
946
+ var O = t.Children.toArray(o).filter(t.isValidElement).map((function(e, r) {
947
947
  L += 1;
948
948
 
949
949
  return (0, t.cloneElement)(e, {
@@ -951,9 +951,9 @@
951
951
  key: e.key || e.props.itemId || "item-".concat(r)
952
952
  });
953
953
  }));
954
- var O = u || s;
955
- var I = O || l;
956
- var _ = O && !l;
954
+ var S = u || s;
955
+ var I = S || l;
956
+ var _ = S && !l;
957
957
  var R = u ? ye : he;
958
958
  var D = u ? ve : ue;
959
959
  var q = u ? pe : ce;
@@ -1010,8 +1010,8 @@
1010
1010
  $error: p
1011
1011
  }), " ", a().createElement("span", {
1012
1012
  "data-test": "file-label"
1013
- }, !O && !l && (0, h._)("Drop your file here or"), _ && (0, h._)("Drop your file anywhere or"), " ", L === 0 && l && (0,
1014
- h._)("No Files Selected"), a().createElement(de, {
1013
+ }, !S && !l && (0, h._)("Drop your file here or"), _ && (0, h._)("Drop your file anywhere or"), " ", L === 0 && l && (0,
1014
+ h._)("No files selected"), a().createElement(de, {
1015
1015
  htmlFor: this.inputId,
1016
1016
  "data-test": "file-link",
1017
1017
  "data-focused": this.state.focusedInput || null
@@ -1046,7 +1046,7 @@
1046
1046
  onRequestRemove: y ? $ : undefined,
1047
1047
  onRequestRetry: g ? T : undefined
1048
1048
  }
1049
- }, S));
1049
+ }, O));
1050
1050
  }
1051
1051
  } ]);
1052
1052
  return n;