@splunk/react-ui 4.36.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.
Files changed (39) hide show
  1. package/Button.js +139 -132
  2. package/CHANGELOG.md +32 -0
  3. package/Color.js +1145 -977
  4. package/ComboBox.js +1 -2
  5. package/Date.js +21 -24
  6. package/Menu.js +161 -153
  7. package/Multiselect.js +17 -27
  8. package/Progress.js +202 -149
  9. package/RadioBar.js +18 -14
  10. package/ScreenReaderContent.js +138 -94
  11. package/Search.js +45 -42
  12. package/Select.js +89 -99
  13. package/Slider.js +128 -145
  14. package/Switch.js +123 -119
  15. package/Text.js +202 -199
  16. package/TextArea.js +21 -19
  17. package/package.json +4 -4
  18. package/types/src/Button/Button.d.ts +15 -5
  19. package/types/src/Color/Color.d.ts +3 -0
  20. package/types/src/Color/Palette.d.ts +4 -2
  21. package/types/src/ControlGroup/docs/examples/Error.d.ts +2 -2
  22. package/types/src/Date/Date.d.ts +0 -1
  23. package/types/src/Date/docs/examples/Error.d.ts +2 -0
  24. package/types/src/Link/Link.d.ts +3 -4
  25. package/types/src/Menu/Item.d.ts +6 -3
  26. package/types/src/Progress/Progress.d.ts +1 -1
  27. package/types/src/Search/Option.d.ts +7 -0
  28. package/types/src/Select/Select.d.ts +1 -1
  29. package/types/src/Select/SelectBase.d.ts +0 -1
  30. package/types/src/Slider/Slider.d.ts +0 -1
  31. package/types/src/Slider/docs/examples/Error.d.ts +2 -0
  32. package/types/src/Switch/Switch.d.ts +1 -0
  33. package/types/src/Text/Text.d.ts +6 -4
  34. package/types/src/Text/docs/examples/Dimmed.d.ts +2 -0
  35. package/types/src/TextArea/TextArea.d.ts +2 -2
  36. package/types/src/Button/docs/examples/Selected.d.ts +0 -2
  37. package/types/src/Slider/docs/examples/prisma/Error.d.ts +0 -2
  38. /package/types/src/Date/docs/examples/{prisma/WithoutCalendar.d.ts → WithoutCalendar.d.ts} +0 -0
  39. /package/types/src/Progress/docs/examples/{prisma/Type.d.ts → Type.d.ts} +0 -0
package/TextArea.js CHANGED
@@ -76,8 +76,8 @@
76
76
  const s = require("lodash/has");
77
77
  var c = e.n(s);
78
78
  // CONCATENATED MODULE: external "lodash/keys"
79
- const d = require("lodash/keys");
80
- var p = e.n(d);
79
+ const p = require("lodash/keys");
80
+ var d = e.n(p);
81
81
  // CONCATENATED MODULE: external "lodash/noop"
82
82
  const u = require("lodash/noop");
83
83
  var f = e.n(u);
@@ -269,9 +269,11 @@
269
269
  var V = M()(H).withConfig({
270
270
  displayName: "TextAreaStyles__StyledTextAreaShadow",
271
271
  componentId: "gfy8yp-5"
272
- })([ "position:absolute;overflow:hidden;left:-10000px;top:-10000px;visibility:hidden;pointer-events:none;", ";" ], (function(e) {
272
+ })([ "position:absolute;overflow:hidden;left:-10000px;top:-10000px;visibility:hidden;pointer-events:none;", "" ], (function(e) {
273
273
  var t = e.$startAdornmentWidth, r = e.$endAdornmentWidth;
274
- return (0, T.css)([ "width:calc( 100% - ", " - ", " );" ], t || B, r || z);
274
+ var n = t ? "".concat(t, "px") : B;
275
+ var a = r ? "".concat(r, "px") : z;
276
+ return (0, T.css)([ "width:calc(100% - ", " - ", ");" ], n, a);
275
277
  }));
276
278
  var K = (0, k.pick)({
277
279
  enterprise: {
@@ -423,9 +425,9 @@
423
425
  var l = parseInt(o, 10);
424
426
  var s = parseInt(i.getPropertyValue("padding-top"), 10);
425
427
  var c = parseInt(i.getPropertyValue("padding-bottom"), 10);
426
- var d = parseInt(i.getPropertyValue("border-top-width"), 10);
427
- var p = parseInt(i.getPropertyValue("border-bottom-width"), 10);
428
- var u = a.scrollHeight + d + p + 1;
428
+ var p = parseInt(i.getPropertyValue("border-top-width"), 10);
429
+ var d = parseInt(i.getPropertyValue("border-bottom-width"), 10);
430
+ var u = a.scrollHeight + p + d + 1;
429
431
  // need one extra.
430
432
  /* eslint-disable no-restricted-globals */
431
433
  // Leverage the global `isNaN` here for IE support, rather than Number.isNaN.
@@ -434,11 +436,11 @@
434
436
  return false;
435
437
  }
436
438
  /* eslint-enable no-restricted-globals */ if (r >= n) {
437
- var f = r * l + s + c + d + p + 1;
439
+ var f = r * l + s + c + p + d + 1;
438
440
  // need one extra.
439
441
  u = Math.min(f, u);
440
442
  }
441
- var h = n * l + s + c + d + p + 1;
443
+ var h = n * l + s + c + p + d + 1;
442
444
  // need one extra.
443
445
  u = Math.max(h, u);
444
446
  if (t !== u) {
@@ -495,7 +497,7 @@
495
497
  return oe.apply(this, arguments);
496
498
  }
497
499
  function le(e) {
498
- return pe(e) || de(e) || ce(e) || se();
500
+ return de(e) || pe(e) || ce(e) || se();
499
501
  }
500
502
  function se() {
501
503
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
@@ -508,10 +510,10 @@
508
510
  if (r === "Map" || r === "Set") return Array.from(e);
509
511
  if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return ue(e, t);
510
512
  }
511
- function de(e) {
513
+ function pe(e) {
512
514
  if (typeof Symbol !== "undefined" && Symbol.iterator in Object(e)) return Array.from(e);
513
515
  }
514
- function pe(e) {
516
+ function de(e) {
515
517
  if (Array.isArray(e)) return ue(e);
516
518
  }
517
519
  function ue(e, t) {
@@ -868,14 +870,14 @@
868
870
  Ie(Se(a), "renderEndAdornment", (function() {
869
871
  var e;
870
872
  var t = a.props, r = t.appearance, i = t.endAdornment, o = t.disabled, l = t.canClear, s = t.splunkTheme;
871
- var c = s.isPrisma, d = s.isEnterprise;
873
+ var c = s.isPrisma, p = s.isEnterprise;
872
874
  if (i) {
873
875
  return a.renderAdornment(i, "end");
874
876
  }
875
- var p = a.context;
876
- var u = (e = p.labelAttrs) === null || e === void 0 ? void 0 : e.text;
877
+ var d = a.context;
878
+ var u = (e = d.labelAttrs) === null || e === void 0 ? void 0 : e.text;
877
879
  var f = u ? (0, S._)("Clear ".concat(u, " text field")) : (0, S._)("Clear text field");
878
- if (d && r === "search") {
880
+ if (p && r === "search") {
879
881
  /* Both icons are rendered, and StyledBox toggles visibility based on :focus-within */
880
882
  return a.renderAdornment( n().createElement(n().Fragment, null, n().createElement(Q, {
881
883
  "aria-label": f,
@@ -965,7 +967,7 @@
965
967
  }, {
966
968
  key: "render",
967
969
  value: function e() {
968
- var t = this.props, r = t.append, a = t.autoCapitalize, i = t.autoComplete, o = t.autoCorrect, l = t.autoFocus, s = t.children, c = t.className, d = t.classNamePrivate, u = t.disabled, h = t.describedBy, m = t.elementRef, y = t.error, g = t.inline, x = t.inputClassName, w = t.inputId, k = t.labelledBy, S = t.maxLength, O = t.name, I = t.placeholder, j = t.prepend, E = t.required, T = t.rowsMin, M = t.spellCheck, P = t.tabIndex, $ = t.title, _ = ve(t, [ "append", "autoCapitalize", "autoComplete", "autoCorrect", "autoFocus", "children", "className", "classNamePrivate", "disabled", "describedBy", "elementRef", "error", "inline", "inputClassName", "inputId", "labelledBy", "maxLength", "name", "placeholder", "prepend", "required", "rowsMin", "spellCheck", "tabIndex", "title" ]);
970
+ var t = this.props, r = t.append, a = t.autoCapitalize, i = t.autoComplete, o = t.autoCorrect, l = t.autoFocus, s = t.children, c = t.className, p = t.classNamePrivate, u = t.disabled, h = t.describedBy, m = t.elementRef, y = t.error, g = t.inline, x = t.inputClassName, w = t.inputId, k = t.labelledBy, S = t.maxLength, O = t.name, I = t.placeholder, j = t.prepend, E = t.required, T = t.rowsMin, M = t.spellCheck, P = t.tabIndex, $ = t.title, _ = ve(t, [ "append", "autoCapitalize", "autoComplete", "autoCorrect", "autoFocus", "children", "className", "classNamePrivate", "disabled", "describedBy", "elementRef", "error", "inline", "inputClassName", "inputId", "labelledBy", "maxLength", "name", "placeholder", "prepend", "required", "rowsMin", "spellCheck", "tabIndex", "title" ]);
969
971
  var D = he(he({}, b()(_, (function(e, t) {
970
972
  return t === "role" || t.indexOf("aria-") === 0;
971
973
  }))), {}, {
@@ -973,7 +975,7 @@
973
975
  "aria-labelledby": k,
974
976
  "aria-invalid": y || undefined
975
977
  });
976
- var q = v()(_, [ "inputRef", "onBlur", "onChange", "onFocus", "onKeyDown", "onSelect", "onInputClick" ].concat(le(p()(D))));
978
+ var q = v()(_, [ "inputRef", "onBlur", "onChange", "onFocus", "onKeyDown", "onSelect", "onInputClick" ].concat(le(d()(D))));
977
979
  var W = this.getDisplayValue();
978
980
  var N = {
979
981
  className: (0, A.toClassName)(c, x),
@@ -1016,7 +1018,7 @@
1016
1018
 
1017
1019
  return n().createElement(R, oe({
1018
1020
  tabIndex: -1,
1019
- className: (0, A.toClassName)(c, d),
1021
+ className: (0, A.toClassName)(c, p),
1020
1022
  "data-test": "text-area",
1021
1023
  "data-test-value": W,
1022
1024
  elementRef: m,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splunk/react-ui",
3
- "version": "4.36.0",
3
+ "version": "4.38.0",
4
4
  "description": "Library of React components that implement the Splunk design language",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Splunk Inc.",
@@ -44,8 +44,8 @@
44
44
  "@dnd-kit/modifiers": "^7.0.0",
45
45
  "@dnd-kit/sortable": "^8.0.0",
46
46
  "@dnd-kit/utilities": "^3.2.2",
47
- "@splunk/react-icons": "^4.7.0",
48
- "@splunk/themes": "^0.21.0",
47
+ "@splunk/react-icons": "^4.8.0",
48
+ "@splunk/themes": "^0.22.0",
49
49
  "@splunk/ui-utils": "^1.7.1",
50
50
  "commonmark": "^0.30.0",
51
51
  "commonmark-react-renderer": "^4.3.2",
@@ -64,7 +64,7 @@
64
64
  "@splunk/babel-preset": "^4.0.0",
65
65
  "@splunk/docs-gen": "1.0.0-beta.13",
66
66
  "@splunk/eslint-config": "^4.0.0",
67
- "@splunk/react-docs": "1.0.0-beta.17",
67
+ "@splunk/react-docs": "1.0.0-beta.19",
68
68
  "@splunk/stylelint-config": "^5.0.0",
69
69
  "@splunk/test-runner-utils": "^0.4.1",
70
70
  "@splunk/webpack-configs": "^7.0.2",
@@ -34,7 +34,6 @@ interface ButtonPropsBase {
34
34
  * Turns the button red. If you use this prop, apply other error
35
35
  * indicators, such as an error message, to meet accessibility
36
36
  * requirements.
37
- *
38
37
  * */
39
38
  error?: boolean;
40
39
  /** Applies the text that displays on the button. */
@@ -47,13 +46,24 @@ interface ButtonPropsBase {
47
46
  * remove the right margin and stretch the button to the full width of
48
47
  * its container. */
49
48
  inline?: boolean;
50
- /** Displays the chevron-down icon to indicate that the button behaves
51
- * as a menu. */
49
+ /**
50
+ * Displays the chevron-down icon to indicate that the button behaves as a menu.
51
+ *
52
+ * To meet accessibility requirements, this prop should be used together with the `Dropdown` component.
53
+ *
54
+ * If `Dropdown` is not used, this prop should be used together with `aria-controls` and `aria-expanded`.
55
+ */
52
56
  isMenu?: boolean;
53
57
  /** Prevents callback when the button is disabled. */
54
58
  onClick?: ButtonClickHandler;
55
- /** Opens the 'to' link in a new browser tab. */
56
- openInNewContext?: boolean;
59
+ /**
60
+ * Open the "to" link in a new context, which is usually a new tab or window based on browser settings.
61
+ *
62
+ * An icon and a screen reader message is added to indicate this behavior to users.
63
+ * The default message is "(Opens new window)"; this can be customized by passing
64
+ * a string instead of boolean to `openInNewContext`.
65
+ */
66
+ openInNewContext?: boolean | string;
57
67
  /** Removes the left border and border-radius of the button so you can
58
68
  * prepend elements to it. */
59
69
  prepend?: boolean;
@@ -27,6 +27,7 @@ interface ColorPropsBase {
27
27
  error?: boolean;
28
28
  /**
29
29
  * Set this property to hide the hex value text input in the initial appearance.
30
+ * The input will still appear inside the dropdown when opened.
30
31
  * @themeNotes Defaults to `false` in Prisma and `true` in Enterprise themes.
31
32
  */
32
33
  hideInput?: boolean;
@@ -81,6 +82,8 @@ declare class Color extends Component<ColorProps, ColorState> {
81
82
  private focusExpandButton;
82
83
  private controlledExternally;
83
84
  private dropdown;
85
+ private swatchToggleReaderContentId;
86
+ private hexInputReaderContentId;
84
87
  static propTypes: React.WeakValidationMap<ColorProps>;
85
88
  static defaultProps: Required<Pick<ColorPropsBase, "disabled" | "error" | "append" | "prepend" | "palette">>;
86
89
  static hasNull(palette: (string | null)[]): boolean;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import Clickable from '@splunk/react-ui/Clickable';
3
- interface PaletteProps {
3
+ import { ComponentProps } from '../utils/types';
4
+ interface PalettePropsBase {
4
5
  /**
5
6
  * In the prisma theme, controls if the palette is expanded
6
7
  */
@@ -42,5 +43,6 @@ interface PaletteProps {
42
43
  */
43
44
  onSystemColorPickerChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
44
45
  }
45
- declare function Palette({ expanded, palette, value, swatchToFocusRef, onSwatchClick, expandButtonRef, onPaletteExpand, onSystemColorPickerChange, renderInput, }: PaletteProps): JSX.Element;
46
+ type PaletteProps = ComponentProps<PalettePropsBase, 'div'>;
47
+ declare function Palette({ expanded, palette, value, swatchToFocusRef, onSwatchClick, expandButtonRef, onPaletteExpand, onSystemColorPickerChange, renderInput, ...otherProps }: PaletteProps): JSX.Element;
46
48
  export default Palette;
@@ -1,2 +1,2 @@
1
- declare function ControlGroupError(): JSX.Element;
2
- export default ControlGroupError;
1
+ declare function Error(): JSX.Element;
2
+ export default Error;
@@ -51,7 +51,6 @@ interface DatePropsBase {
51
51
  inputId?: string;
52
52
  /**
53
53
  * Whether or not to display the calendar menu.
54
- * @includeTheme prisma
55
54
  */
56
55
  inputOnly?: boolean;
57
56
  /** Locale set by language and localization specifiers. */
@@ -0,0 +1,2 @@
1
+ declare function Error(): JSX.Element;
2
+ export default Error;
@@ -17,11 +17,10 @@ interface LinkPropsBase {
17
17
  */
18
18
  elementRef?: React.Ref<HTMLButtonElement | HTMLAnchorElement>;
19
19
  /**
20
- * Open the link in a new context. Usually this will open the location in a new tab,
21
- * but may open in a new window depending on the user's browser and settings.
20
+ * Open the "to" link in a new context, which is usually a new tab or window based on browser settings.
22
21
  *
23
- * An icon and a message is added to indicate this behavior to users.
24
- * "(Opens new window)" is the default message. This can be customized by passing
22
+ * An icon and a screen reader message is added to indicate this behavior to users.
23
+ * The default message is "(Opens new window)"; this can be customized by passing
25
24
  * a string instead of boolean to `openInNewContext`.
26
25
  */
27
26
  openInNewContext?: boolean | string;
@@ -57,10 +57,13 @@ interface ItemPropsBase {
57
57
  onClick?: React.MouseEventHandler<HTMLAnchorElement | HTMLButtonElement>;
58
58
  onFocus?: ItemFocusHandler;
59
59
  /**
60
- * To open the link in a new window, set `openInNewContext` to `true`. An icon is added
61
- * indicating the behavior.
60
+ * Open the "to" link in a new context, which is usually a new tab or window based on browser settings.
61
+ *
62
+ * An icon and a screen reader message is added to indicate this behavior to users.
63
+ * The default message is "(Opens new window)"; this can be customized by passing
64
+ * a string instead of boolean to `openInNewContext`.
62
65
  */
63
- openInNewContext?: boolean;
66
+ openInNewContext?: boolean | string;
64
67
  /**
65
68
  * @private
66
69
  * Prevents the element from becoming focused. Used to keep the focus inside the filter box
@@ -17,7 +17,7 @@ interface ProgressPropsBase {
17
17
  * Sets the appearance of the `Progress` component.
18
18
  *
19
19
  * The `warning` appearance is deprecated and will be removed in the next major version.
20
- * @excludeTheme enterprise
20
+ * @themeNotes Enterprise themes do not support `warning` and will fall back to `info`
21
21
  */
22
22
  type?: 'info' | 'success' | 'warning' | 'error';
23
23
  }
@@ -32,6 +32,13 @@ interface OptionPropsBase {
32
32
  * Caution: The element(s) passed here must be pure. All icons in the react-icons package are pure.
33
33
  */
34
34
  icon?: React.ReactNode;
35
+ /**
36
+ * Sections of the label string to highlight as a match.
37
+ */
38
+ matchRanges?: {
39
+ start: number;
40
+ end: number;
41
+ }[];
35
42
  /**
36
43
  * Callback for click events.
37
44
  * Returning "false" from the callback will prevent the parent Search component from updating its value,
@@ -12,7 +12,7 @@ type SelectFilterChangeHandler = (event: React.ChangeEvent<HTMLInputElement | HT
12
12
  keyword: string;
13
13
  }) => void;
14
14
  /** @public */
15
- type SelectScrollBottomHandler = (event: React.UIEvent<HTMLDivElement> | React.KeyboardEvent<HTMLInputElement> | null) => void;
15
+ type SelectScrollBottomHandler = (event: React.UIEvent<HTMLDivElement> | React.KeyboardEvent<HTMLInputElement> | React.KeyboardEvent<HTMLButtonElement> | null) => void;
16
16
  interface SelectPropsBase {
17
17
  /**
18
18
  * Whether or not to allow entered keyboard printable characters to match options.
@@ -228,7 +228,6 @@ declare class SelectBase extends Component<SelectBaseProps, SelectBaseState> {
228
228
  private dropdown;
229
229
  private firstSelectedEnabledOption;
230
230
  private firstSelectedOptionIndex?;
231
- private menuId;
232
231
  private menuListboxId;
233
232
  private previousActiveIndex;
234
233
  private selectedOptionCount;
@@ -25,7 +25,6 @@ interface SliderPropsBase {
25
25
  elementRef?: React.Ref<HTMLDivElement>;
26
26
  /**
27
27
  * Highlight the Slider as having an error. The thumb and bar background-color turn to accent negative.
28
- * @excludeTheme enterprise
29
28
  */
30
29
  error: boolean;
31
30
  /** When false, display as inline-block with the default width. */
@@ -0,0 +1,2 @@
1
+ declare function Error(): JSX.Element;
2
+ export default Error;
@@ -29,6 +29,7 @@ interface SwitchPropsBase {
29
29
  id?: string;
30
30
  /** Make the control an inline block with variable width. */
31
31
  inline?: boolean;
32
+ inputClassName?: string;
32
33
  /**
33
34
  * In a couple of cases, the switch is to show state, but is not interactive in itself.
34
35
  * The parent takes focus and handles click. Set interactive to false to prevent focus and