@splunk/react-ui 4.39.0 → 4.41.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 (105) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/Calendar.js +548 -744
  3. package/Card.js +3 -1
  4. package/Chip.js +133 -125
  5. package/ControlGroup.js +27 -30
  6. package/Date.js +158 -161
  7. package/FormRows.js +93 -97
  8. package/Link.js +21 -19
  9. package/MIGRATION.mdx +54 -2
  10. package/Menu.js +1 -1
  11. package/Message.js +136 -123
  12. package/MessageBar.js +59 -57
  13. package/Multiselect.js +2985 -3085
  14. package/Number.js +23 -18
  15. package/Popover.js +2 -1
  16. package/RadioBar.js +19 -15
  17. package/ResultsMenu.js +1208 -1028
  18. package/Select.js +1906 -1998
  19. package/Slider.js +346 -300
  20. package/SlidingPanels.js +166 -148
  21. package/SplitButton.d.ts +2 -0
  22. package/TabBar.js +193 -175
  23. package/TabLayout.js +16 -10
  24. package/Table.js +236 -227
  25. package/TransitionOpen.js +44 -65
  26. package/WaitSpinner.js +1 -1
  27. package/package.json +2 -2
  28. package/types/src/ButtonSimple/ButtonSimple.d.ts +1 -1
  29. package/types/src/Calendar/Calendar.d.ts +28 -30
  30. package/types/src/Calendar/MonthHeader.d.ts +12 -22
  31. package/types/src/Card/Card.d.ts +1 -0
  32. package/types/src/Card/Footer.d.ts +1 -0
  33. package/types/src/Chip/Chip.d.ts +3 -6
  34. package/types/src/Color/Color.d.ts +2 -2
  35. package/types/src/ComboBox/ComboBox.d.ts +1 -1
  36. package/types/src/Date/Date.d.ts +18 -19
  37. package/types/src/File/File.d.ts +1 -1
  38. package/types/src/FormRows/FormRows.d.ts +5 -60
  39. package/types/src/FormRows/Row.d.ts +1 -1
  40. package/types/src/Link/Link.d.ts +7 -0
  41. package/types/src/Link/index.d.ts +1 -0
  42. package/types/src/Menu/Item.d.ts +1 -1
  43. package/types/src/Menu/Menu.d.ts +1 -1
  44. package/types/src/Multiselect/Compact.d.ts +1 -1
  45. package/types/src/Multiselect/Multiselect.d.ts +1 -1
  46. package/types/src/Multiselect/Normal.d.ts +1 -1
  47. package/types/src/Multiselect/Option.d.ts +1 -1
  48. package/types/src/Number/Number.d.ts +2 -2
  49. package/types/src/RadioBar/RadioBar.d.ts +2 -2
  50. package/types/src/ResultsMenu/VirtualizedResultsMenu/VirtualizedResultsMenu.d.ts +1 -1
  51. package/types/src/ResultsMenu/VirtualizedResultsMenu/injectVirtualizedItem.d.ts +2 -0
  52. package/types/src/Search/Option.d.ts +1 -1
  53. package/types/src/Select/Option.d.ts +5 -1
  54. package/types/src/Select/OptionBase.d.ts +41 -23
  55. package/types/src/Select/Select.d.ts +3 -1
  56. package/types/src/Select/SelectAllOption.d.ts +8 -4
  57. package/types/src/Select/SelectBase.d.ts +76 -66
  58. package/types/src/Select/docs/examples/Appearance.d.ts +0 -2
  59. package/types/src/Slider/Slider.d.ts +7 -16
  60. package/types/src/SlidingPanels/SlidingPanels.d.ts +4 -3
  61. package/types/src/TabBar/TabBar.d.ts +10 -2
  62. package/types/src/TabBar/TabBarContext.d.ts +1 -0
  63. package/types/src/TabBar/docs/examples/IconsAbove.d.ts +2 -0
  64. package/types/src/TabBar/docs/examples/IconsLeft.d.ts +2 -0
  65. package/types/src/TabBar/docs/examples/VerticalIconsAbove.d.ts +2 -0
  66. package/types/src/TabBar/docs/examples/VerticalIconsLeft.d.ts +2 -0
  67. package/types/src/TabLayout/TabLayout.d.ts +4 -2
  68. package/types/src/Table/Cell.d.ts +0 -2
  69. package/types/src/Table/HeadInner.d.ts +5 -1
  70. package/types/src/Table/Row.d.ts +0 -2
  71. package/types/src/Table/Table.d.ts +0 -2
  72. package/types/src/Table/docs/examples/Complex.d.ts +14 -3
  73. package/types/src/Text/Text.d.ts +2 -2
  74. package/types/src/TextArea/TextArea.d.ts +2 -2
  75. package/types/src/Typography/Typography.d.ts +4 -2
  76. package/types/src/WaitSpinner/WaitSpinner.d.ts +0 -1
  77. package/types/src/useControlled/index.d.ts +2 -0
  78. package/types/src/useControlled/useControlled.d.ts +21 -0
  79. package/types/src/useResizeObserver/index.d.ts +2 -0
  80. package/types/src/useResizeObserver/useResizeObserver.d.ts +12 -0
  81. package/useControlled.js +112 -0
  82. package/useKeyPress.d.ts +2 -0
  83. package/useResizeObserver.d.ts +2 -0
  84. package/useResizeObserver.js +137 -0
  85. package/types/src/Chip/docs/examples/Basic.d.ts +0 -2
  86. package/types/src/Chip/docs/examples/prisma/Appearance.d.ts +0 -2
  87. package/types/src/Color/docs/examples/prisma/Controlled.d.ts +0 -2
  88. package/types/src/Color/docs/examples/prisma/ThemeVariables.d.ts +0 -1
  89. package/types/src/Color/docs/examples/prisma/Uncontrolled.d.ts +0 -2
  90. package/types/src/Dropdown/docs/examples/prisma/Basic.d.ts +0 -2
  91. package/types/src/Dropdown/docs/examples/prisma/BasicMenu.d.ts +0 -2
  92. package/types/src/Dropdown/docs/examples/prisma/ControlledDropdown.d.ts +0 -2
  93. package/types/src/Dropdown/docs/examples/prisma/Dialog.d.ts +0 -2
  94. package/types/src/Dropdown/docs/examples/prisma/OtherToggles.d.ts +0 -2
  95. package/types/src/Dropdown/docs/examples/prisma/ScrollingMenu.d.ts +0 -2
  96. package/types/src/File/docs/examples/prisma/Disabled.d.ts +0 -12
  97. package/types/src/Message/docs/examples/Title.d.ts +0 -2
  98. package/types/src/TabBar/docs/examples/IconsInline.d.ts +0 -2
  99. package/types/src/TabBar/docs/examples/IconsSmall.d.ts +0 -2
  100. package/types/src/TabBar/docs/examples/VerticalSmallIcons.d.ts +0 -2
  101. package/types/src/Table/docs/examples/prisma/Complex.d.ts +0 -48
  102. package/types/src/WaitSpinner/docs/examples/prisma/Basic.d.ts +0 -2
  103. /package/types/src/Color/docs/examples/{prisma/CustomizedPalette.d.ts → CustomizedPalette.d.ts} +0 -0
  104. /package/types/src/Color/docs/examples/{prisma/HideInput.d.ts → HideInput.d.ts} +0 -0
  105. /package/types/src/Table/docs/examples/{prisma/RowActions.d.ts → RowActions.d.ts} +0 -0
package/FormRows.js CHANGED
@@ -62,7 +62,7 @@
62
62
  // EXPORTS
63
63
  e.d(t, {
64
64
  Row: () => /* reexport */ Oe,
65
- default: () => /* reexport */ Ge
65
+ default: () => /* reexport */ Ue
66
66
  });
67
67
  // CONCATENATED MODULE: external "react"
68
68
  const r = require("react");
@@ -737,13 +737,90 @@
737
737
  disabled: false,
738
738
  header: null
739
739
  };
740
- var Ve = function(e) {
741
- De(o, e);
742
- var t = Be(o);
743
- function o() {
740
+ /**
741
+ * Static function for adding a row.
742
+ *
743
+ * Example Use:
744
+ *
745
+ * onRequestAdd() => {
746
+ * this.setState(state => ({
747
+ * items: FormRows.addRow(
748
+ * <FormRows.Row
749
+ * index={state.items.length}
750
+ * key={createDOMID()}
751
+ * onRequestRemove={this.handleRequestRemove}
752
+ * >
753
+ * <Text />
754
+ * </FormRows.Row>,
755
+ * state.items
756
+ * ),
757
+ * }));
758
+ * };
759
+ *
760
+ * @param element Row element to add.
761
+ * @param items Array of current FormRows to add to.
762
+ * @return New array of FormRows with new Row added.
763
+ */ var Ve = function e(t, r) {
764
+ return r.concat(t);
765
+ };
766
+ /**
767
+ * Static function for moving a row.
768
+ *
769
+ * Example Use:
770
+ *
771
+ * onRequestMove({ fromIndex, toIndex }) => {
772
+ * this.setState(state => ({
773
+ * items: FormRows.moveRow(fromIndex, toIndex, state.items),
774
+ * }));
775
+ * };
776
+ *
777
+ * @param fromIndex Current index of row to move.
778
+ * @param toIndex New index to move row to.
779
+ * @param items Array of current FormRows.
780
+ * @return New array of FormRows arranged in new order.
781
+ */ var Ge = function e(t, n, o) {
782
+ var i = o.filter((function(e, r) {
783
+ return r !== t;
784
+ }));
785
+ i.splice(n, 0, o[t]);
786
+ return i.map((function(e, t) {
787
+
788
+ return (0, r.cloneElement)(e, {
789
+ index: t
790
+ });
791
+ }));
792
+ };
793
+ /**
794
+ * Static function for removing a row.
795
+ *
796
+ * Example Use:
797
+ *
798
+ * onRequestRemove(e, { index }) => {
799
+ * this.setState(state => ({
800
+ * items: FormRows.removeRow(index, state.items),
801
+ * }));
802
+ * };
803
+ *
804
+ * @param index Index of Row to delete.
805
+ * @param items Array of current FormRows.
806
+ * @return New array of FormRows with Row of given index deleted.
807
+ */ var Je = function e(t, n) {
808
+ return n.filter((function(e, r) {
809
+ return r !== t;
810
+ })).map((function(e, t) {
811
+
812
+ return (0, r.cloneElement)(e, {
813
+ index: t
814
+ });
815
+ }));
816
+ };
817
+ var Qe = function(e) {
818
+ De(r, e);
819
+ var t = Be(r);
820
+ function r() {
744
821
  var e;
745
- qe(this, o);
746
- for (var r = arguments.length, i = new Array(r), a = 0; a < r; a++) {
822
+ qe(this, r);
823
+ for (var o = arguments.length, i = new Array(o), a = 0; a < o; a++) {
747
824
  i[a] = arguments[a];
748
825
  }
749
826
  e = t.call.apply(t, [ this ].concat(i));
@@ -783,7 +860,7 @@
783
860
  return e;
784
861
  }
785
862
  // @docs-props-type FormRowsPropsBase
786
- Te(o, [ {
863
+ Te(r, [ {
787
864
  key: "render",
788
865
  value: function e() {
789
866
  var t = this.props, r = t.addLabel, o = t.children, i = t.disabled, a = t.header, l = t.menu, u = t.onRequestAdd, s = t.onRequestMove, p = ke(t, [ "addLabel", "children", "disabled", "header", "menu", "onRequestAdd", "onRequestMove" ]);
@@ -813,97 +890,16 @@
813
890
  $sortable: f
814
891
  })));
815
892
  }
816
- } ], [ {
817
- key: "addRow",
818
- /**
819
- * Static function for adding a row.
820
- *
821
- * Example Use:
822
- *
823
- * onRequestAdd() => {
824
- * this.setState(state => ({
825
- * items: FormRows.addRow(
826
- * <FormRows.Row
827
- * index={state.items.length}
828
- * key={createDOMID()}
829
- * onRequestRemove={this.handleRequestRemove}
830
- * >
831
- * <Text />
832
- * </FormRows.Row>,
833
- * state.items
834
- * ),
835
- * }));
836
- * };
837
- *
838
- * @param element Row element to add.
839
- * @param items Array of current FormRows to add to.
840
- * @return New array of FormRows with new Row added.
841
- */
842
- value: function e(t, r) {
843
- return r.concat(t);
844
- }
845
- /**
846
- * Static function for moving a row.
847
- *
848
- * Example Use:
849
- *
850
- * onRequestMove({ fromIndex, toIndex }) => {
851
- * this.setState(state => ({
852
- * items: FormRows.moveRow(fromIndex, toIndex, state.items),
853
- * }));
854
- * };
855
- *
856
- * @param fromIndex Current index of row to move.
857
- * @param toIndex New index to move row to.
858
- * @param items Array of current FormRows.
859
- * @return New array of FormRows arranged in new order.
860
- */ }, {
861
- key: "moveRow",
862
- value: function e(t, n, o) {
863
- var i = o.filter((function(e, r) {
864
- return r !== t;
865
- }));
866
- i.splice(n, 0, o[t]);
867
- return i.map((function(e, t) {
868
-
869
- return (0, r.cloneElement)(e, {
870
- index: t
871
- });
872
- }));
873
- }
874
- /**
875
- * Static function for removing a row.
876
- *
877
- * Example Use:
878
- *
879
- * onRequestRemove(e, { index }) => {
880
- * this.setState(state => ({
881
- * items: FormRows.removeRow(index, state.items),
882
- * }));
883
- * };
884
- *
885
- * @param index Index of Row to delete.
886
- * @param items Array of current FormRows.
887
- * @return New array of FormRows with Row of given index deleted.
888
- */ }, {
889
- key: "removeRow",
890
- value: function e(t, n) {
891
- return n.filter((function(e, r) {
892
- return r !== t;
893
- })).map((function(e, t) {
894
-
895
- return (0, r.cloneElement)(e, {
896
- index: t
897
- });
898
- }));
899
- }
900
893
  } ]);
901
- return o;
894
+ return r;
902
895
  }(r.Component);
903
- Fe(Ve, "propTypes", $e);
904
- Fe(Ve, "defaultProps", ze);
905
- Fe(Ve, "Row", Oe);
906
- /* harmony default export */ const Ge = Ve;
896
+ Fe(Qe, "propTypes", $e);
897
+ Fe(Qe, "defaultProps", ze);
898
+ Fe(Qe, "Row", Oe);
899
+ Fe(Qe, "addRow", Ve);
900
+ Fe(Qe, "moveRow", Ge);
901
+ Fe(Qe, "removeRow", Je);
902
+ /* harmony default export */ const Ue = Qe;
907
903
  // CONCATENATED MODULE: ./src/FormRows/index.ts
908
904
  module.exports = t;
909
905
  /******/})();
package/Link.js CHANGED
@@ -61,6 +61,7 @@
61
61
  e.r(t);
62
62
  // EXPORTS
63
63
  e.d(t, {
64
+ StyledLink: () => /* reexport */ x,
64
65
  default: () => /* reexport */ Q
65
66
  });
66
67
  // CONCATENATED MODULE: external "react"
@@ -105,10 +106,10 @@
105
106
  }
106
107
  /* harmony default export */ const O = g;
107
108
  // CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
108
- const j = require("@splunk/react-ui/Clickable");
109
- var x = e.n(j);
109
+ const S = require("@splunk/react-ui/Clickable");
110
+ var j = e.n(S);
110
111
  // CONCATENATED MODULE: ./src/Link/LinkStyles.ts
111
- var S = p()(x()).withConfig({
112
+ var x = p()(j()).withConfig({
112
113
  displayName: "LinkStyles__StyledClickable",
113
114
  componentId: "sc-1hhltcf-0"
114
115
  })([ "", ";color:", ";text-decoration:none;font-size:inherit;font-weight:inherit;line-height:inherit;border-radius:", ";&:not([disabled],[aria-disabled='true']){cursor:pointer;", ";&:focus{box-shadow:", ";outline:0;&:active{box-shadow:none;}}}&[disabled],&[aria-disabled='true']{color:", ";}" ], v.mixins.reset("inline"), (0,
@@ -197,11 +198,11 @@
197
198
  }, N(e, t);
198
199
  }
199
200
  function R(e) {
200
- var t = A();
201
+ var t = L();
201
202
  return function() {
202
- var r, n = B(e);
203
+ var r, n = A(e);
203
204
  if (t) {
204
- var o = B(this).constructor;
205
+ var o = A(this).constructor;
205
206
  r = Reflect.construct(n, arguments, o);
206
207
  } else r = n.apply(this, arguments);
207
208
  return M(this, r);
@@ -216,20 +217,20 @@
216
217
  if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
217
218
  return e;
218
219
  }
219
- function A() {
220
+ function L() {
220
221
  try {
221
222
  var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
222
223
  } catch (e) {}
223
- return (A = function t() {
224
+ return (L = function t() {
224
225
  return !!e;
225
226
  })();
226
227
  }
227
- function B(e) {
228
- return B = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
228
+ function A(e) {
229
+ return A = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
229
230
  return e.__proto__ || Object.getPrototypeOf(e);
230
- }, B(e);
231
+ }, A(e);
231
232
  }
232
- function L(e, t, r) {
233
+ function B(e, t, r) {
233
234
  return (t = z(t)) in e ? Object.defineProperty(e, t, {
234
235
  value: r,
235
236
  enumerable: !0,
@@ -278,8 +279,8 @@
278
279
  o[i] = arguments[i];
279
280
  }
280
281
  e = t.call.apply(t, [ this ].concat(o));
281
- L(D(e), "component", null);
282
- L(D(e), "handleMount", (function(t) {
282
+ B(D(e), "component", null);
283
+ B(D(e), "handleMount", (function(t) {
283
284
  e.component = t;
284
285
  }));
285
286
  return e;
@@ -306,7 +307,7 @@
306
307
  u = typeof o === "string" ? o : J;
307
308
  }
308
309
 
309
- return n().createElement(S, k({
310
+ return n().createElement(x, k({
310
311
  "data-test": "link",
311
312
  ref: this.handleMount,
312
313
  openInNewContext: a
@@ -315,10 +316,11 @@
315
316
  } ]);
316
317
  return r;
317
318
  }(r.Component);
318
- L(K, "propTypes", H);
319
- L(K, "defaultProps", G);
320
- L(K, u.legacyRefMode, true);
319
+ B(K, "propTypes", H);
320
+ B(K, "defaultProps", G);
321
+ B(K, u.legacyRefMode, true);
321
322
  /* harmony default export */ const Q = K;
322
- // CONCATENATED MODULE: ./src/Link/index.ts
323
+ // exported so that we can style both <a> and <button> tags in MessageBar
324
+ // CONCATENATED MODULE: ./src/Link/index.ts
323
325
  module.exports = t;
324
326
  /******/})();
package/MIGRATION.mdx CHANGED
@@ -5,6 +5,45 @@ import Table from '@splunk/react-ui/Table';
5
5
 
6
6
  This document lists migration guidance for new features and breaking changes.
7
7
 
8
+ ## 4.40.0
9
+
10
+ ### Deprecated `Select`'s `appearance="primary"` value
11
+
12
+ #### Change
13
+
14
+ `Select`'s `appearance="primary"` value has been deprecated and will be removed in the next major version.
15
+
16
+ #### Context
17
+
18
+ The `primary` appearance is no longer supported as primary actions are generally intended for tasks like submitting a form or page, whereas `Select` should be used to make a choice that then gets submitted with a primary `Button`.
19
+ Including both a primary `Select` and `Button` conflicts with the visual importance and hierarchy of the page.
20
+
21
+ #### Migration steps
22
+
23
+ * If `Select` was being used as a primary action but there are some variants for how that primary action works (e.g. Save vs. Save As), use `SplitButton`.
24
+ * Otherwise use `Select` with the `default` appearance paired with a primary `Button` to submit.
25
+
26
+ ### Deprecated `TabBar` and `TabLayout`'s `iconSize` prop
27
+
28
+ #### Context
29
+
30
+ The `iconSize` prop has two major issues:
31
+
32
+ * Despite its name, it controls both size and position, which is both confusing to users and makes it difficult to control those independently.
33
+ * It does not correctly set the icon size for the new icons introduced in `@splunk/react-icons@4`.
34
+
35
+ To eliminate these issues, we have deprecated the `iconSize` prop.
36
+
37
+ #### Migration steps
38
+
39
+ Remove usages of the `iconSize` prop.
40
+
41
+ * Icon position can now be controlled with the new `iconPosition` prop.
42
+ * Icon size can be set using `@splunk/react-icons` APIs.
43
+ * If you are using the new icons in `react-icons@4`, you can set size with the `height` and `width` props.
44
+ * If you are using `react-icons@3` or using the `/enterprise` path in `react-icons@4`,
45
+ the `size` prop can be set to `"18px"` to match `iconSize="small"` or `"36px"` to match `iconSize="large"`.
46
+
8
47
  ## 4.39.0
9
48
 
10
49
  ### Deprecated `TabBar` and `TabLayout`'s `appearance` prop
@@ -31,8 +70,8 @@ To eliminate these issues, we have deprecated the `appearance` prop.
31
70
 
32
71
  Remove usages of the `appearance` prop:
33
72
 
34
- 1) If you were using `appearance="navigation"`, that is the default appearance and removing the prop will have no effect.
35
- 2) If you were using `appearance="context"`, the tabs will render with the default appearance.
73
+ * If you were using `appearance="navigation"`, that is the default appearance and removing the prop will have no effect.
74
+ * If you were using `appearance="context"`, the tabs will render with the default appearance.
36
75
 
37
76
  ### Deprecated `Button`'s `selected` prop
38
77
 
@@ -719,3 +758,16 @@ The `size` prop currently does not do anything in `ComboBox`, `ControlGroup`, or
719
758
 
720
759
  Remove all usage of `ComboBox`, `ControlGroup`, and `StaticContent`'s `size` prop. To change the size of components, use the `SplunkThemeProvider`'s `density` prop.
721
760
 
761
+ ## 4.39.0
762
+
763
+ ### Deprecated `Menu.Item`'s `icon` prop
764
+
765
+ #### Change
766
+ `Menu.Item`'s `icon` prop is deprecated and will be removed in a future major version.
767
+
768
+ #### Context
769
+ The `Menu.Item` icon should not be used as `Menu.Item` as that restricted the location of the icon and it is now possible to place an adornment at the start or the end of the `Menu.Item` content.
770
+
771
+ #### Migration steps
772
+ Replace all usage of `Menu.Item`'s `icon` prop with `startAdornment` and/or `endAdornment`.
773
+
package/Menu.js CHANGED
@@ -282,7 +282,7 @@
282
282
  // so we set them to aria-hidden to prevent that
283
283
 
284
284
  return n().createElement(E, {
285
- "aria-hidden": s === "listbox"
285
+ "aria-hidden": s === "listbox" ? true : undefined
286
286
  }, d);
287
287
  }
288
288
  $.propTypes = H;