@splunk/react-ui 4.17.1 → 4.19.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 (122) hide show
  1. package/Accordion.js +6 -6
  2. package/Anchor.js +2 -2
  3. package/Animation.js +2 -2
  4. package/AnimationToggle.js +5 -5
  5. package/Box.js +2 -2
  6. package/Button.js +4 -4
  7. package/ButtonGroup.js +2 -2
  8. package/ButtonSimple.js +2 -2
  9. package/CHANGELOG.md +28 -2
  10. package/Calendar.js +8 -8
  11. package/Card.js +8 -8
  12. package/CardLayout.js +2 -2
  13. package/Chip.js +23 -16
  14. package/Clickable.js +11 -11
  15. package/CloseButton.js +2 -2
  16. package/Code.js +12 -12
  17. package/CollapsiblePanel.js +4 -4
  18. package/Color.js +209 -182
  19. package/ColumnLayout.js +6 -6
  20. package/ComboBox.js +14 -14
  21. package/Concertina.js +10 -10
  22. package/ControlGroup.js +2 -2
  23. package/Date.js +13 -13
  24. package/DefinitionList.js +2 -2
  25. package/Divider.js +2 -2
  26. package/Dropdown.js +13 -13
  27. package/DualListbox.js +9 -6
  28. package/EventListener.js +4 -4
  29. package/File.js +13 -13
  30. package/FormRows.js +264 -103
  31. package/Heading.js +50 -50
  32. package/Image.js +15 -15
  33. package/JSONTree.js +38 -36
  34. package/Layer.js +10 -10
  35. package/Link.js +2 -2
  36. package/List.js +9 -6
  37. package/MIGRATION.mdx +295 -0
  38. package/Markdown.js +24 -19
  39. package/Menu.js +12 -12
  40. package/Message.js +4 -4
  41. package/MessageBar.js +2 -2
  42. package/Modal.js +4 -4
  43. package/ModalLayer.js +4 -4
  44. package/Monogram.js +3 -3
  45. package/Multiselect.js +33 -33
  46. package/Number.js +7 -6
  47. package/Paginator.js +6 -6
  48. package/Paragraph.js +2 -2
  49. package/Popover.js +31 -27
  50. package/Progress.js +4 -4
  51. package/RadioBar.js +4 -4
  52. package/RadioList.js +2 -2
  53. package/Resize.js +6 -6
  54. package/ResultsMenu.js +8 -8
  55. package/ScreenReaderContent.js +2 -2
  56. package/Scroll.js +6 -6
  57. package/ScrollContainerContext.js +2 -2
  58. package/Search.js +14 -14
  59. package/Select.js +12 -12
  60. package/SidePanel.js +2 -2
  61. package/Slider.js +10 -10
  62. package/SlidingPanels.js +8 -8
  63. package/SplitButton.js +4 -4
  64. package/StaticContent.js +2 -2
  65. package/StepBar.js +2 -2
  66. package/Switch.js +2 -2
  67. package/TabBar.js +68 -51
  68. package/TabLayout.js +6 -6
  69. package/Table.js +51 -50
  70. package/Text.js +25 -23
  71. package/TextArea.js +24 -22
  72. package/Tooltip.js +11 -11
  73. package/TransitionOpen.js +2 -2
  74. package/Typography.js +4 -4
  75. package/WaitSpinner.js +2 -2
  76. package/cypress/support/component-index.html +12 -0
  77. package/cypress/support/component.ts +27 -0
  78. package/cypress.config.ts +19 -0
  79. package/package.json +14 -19
  80. package/stubs-dependencies.d.ts +0 -9
  81. package/types/src/Button/Button.d.ts +5 -3
  82. package/types/src/Clickable/Clickable.d.ts +2 -1
  83. package/types/src/Clickable/docs/examples/Basic.d.ts +2 -2
  84. package/types/src/CollapsiblePanel/CollapsiblePanel.d.ts +1 -0
  85. package/types/src/Color/Color.d.ts +6 -6
  86. package/types/src/Color/Palette.d.ts +46 -0
  87. package/types/src/Concertina/Panel.d.ts +1 -0
  88. package/types/src/FormRows/FormRows.d.ts +1 -2
  89. package/types/src/FormRows/Row.d.ts +3 -12
  90. package/types/src/FormRows/RowInternal.d.ts +19 -0
  91. package/types/src/FormRows/SortableList.d.ts +8 -2
  92. package/types/src/FormRows/SortableRow.d.ts +20 -0
  93. package/types/src/Heading/Heading.d.ts +8 -3
  94. package/types/src/JSONTree/JSONTree.d.ts +2 -1
  95. package/types/src/Layer/Layer.d.ts +2 -0
  96. package/types/src/List/List.d.ts +9 -1
  97. package/types/src/List/docs/examples/CustomizedList.d.ts +2 -0
  98. package/types/src/List/docs/examples/OrderedList.d.ts +2 -0
  99. package/types/src/List/docs/examples/UnorderedList.d.ts +2 -0
  100. package/types/src/Markdown/Markdown.d.ts +1 -0
  101. package/types/src/Markdown/renderers/MarkdownList.d.ts +2 -0
  102. package/types/src/Number/Number.d.ts +9 -4
  103. package/types/src/Popover/Popover.d.ts +2 -0
  104. package/types/src/TabBar/Tab.d.ts +2 -0
  105. package/types/src/Table/Head.d.ts +1 -0
  106. package/types/src/Table/HeadCell.d.ts +1 -0
  107. package/types/src/Table/HeadDropdownCell.d.ts +1 -0
  108. package/types/src/Table/Table.d.ts +3 -1
  109. package/types/src/Text/Text.d.ts +3 -1
  110. package/types/src/TextArea/TextArea.d.ts +2 -0
  111. package/useForceUpdate.js +2 -2
  112. package/useKeyPress.js +2 -2
  113. package/usePrevious.js +2 -2
  114. package/useRovingFocus.js +2 -2
  115. package/MIGRATION.md +0 -49
  116. package/cypress/plugins/index.ts +0 -15
  117. package/cypress/support/index.ts +0 -10
  118. package/cypress.json +0 -13
  119. package/types/src/List/docs/examples/Decimal.d.ts +0 -2
  120. package/types/src/List/docs/examples/Disc.d.ts +0 -2
  121. package/types/src/List/docs/examples/LowerAlpha.d.ts +0 -2
  122. package/types/src/List/docs/examples/UpperAlpha.d.ts +0 -2
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ import Clickable from '@splunk/react-ui/Clickable';
3
+ interface PaletteProps {
4
+ /**
5
+ * In the prisma theme, controls if the palette is expanded
6
+ */
7
+ expanded: boolean;
8
+ /**
9
+ * Complete list of palettes values to be rendered as swatches
10
+ * In enterprise themes this list is always shown.
11
+ * In prisma themes the entire list is only shown when the palette is `expanded`
12
+ */
13
+ palette: (string | null)[];
14
+ /**
15
+ * Current value of the Color input
16
+ */
17
+ value?: string | null;
18
+ /**
19
+ * This ref is passed to the swatch that should be focused for Color to control focus
20
+ */
21
+ swatchToFocusRef: React.RefObject<Clickable & HTMLInputElement> | null;
22
+ /**
23
+ * Callback for handling when a swatch is selected
24
+ */
25
+ onSwatchClick: (event: React.MouseEvent<HTMLButtonElement>, data: {
26
+ value?: string | null;
27
+ }) => void;
28
+ /**
29
+ * ref for the expandButton so Color can control the state
30
+ */
31
+ expandButtonRef: React.RefObject<Clickable> | null;
32
+ /**
33
+ * Callback for handling when the expand button is pressed
34
+ */
35
+ onPaletteExpand: (event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void;
36
+ /**
37
+ * Render function for injecting the toolbar and input below the rendered swatches
38
+ */
39
+ renderInput?: () => JSX.Element;
40
+ /**
41
+ * Callback for handling activation of the system color picker, only used in prisma themes.
42
+ */
43
+ onSystemColorPickerChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
44
+ }
45
+ declare function Palette({ expanded, palette, value, swatchToFocusRef, onSwatchClick, expandButtonRef, onPaletteExpand, onSystemColorPickerChange, renderInput, }: PaletteProps): JSX.Element;
46
+ export default Palette;
@@ -42,6 +42,7 @@ declare class Panel extends Component<PanelProps, PanelState> {
42
42
  private lastHeight?;
43
43
  static propTypes: React.WeakValidationMap<ClassComponentProps<PanelPropsBase, Required<Pick<PanelPropsBase, "status">>, "div", never>>;
44
44
  static defaultProps: Required<Pick<PanelPropsBase, "status">>;
45
+ context: React.ContextType<typeof ConcertinaContext>;
45
46
  static contextType: React.Context<ConcertinaContext>;
46
47
  constructor(props: Readonly<PanelProps>);
47
48
  componentDidUpdate(prevProps: Readonly<PanelProps>, prevState: Readonly<PanelState>): void;
@@ -1,5 +1,4 @@
1
1
  import React, { Component } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import Row from './Row';
4
3
  import type { RowRequestRemoveHandler, RowWithoutSortable } from './Row';
5
4
  import { ClassComponentProps } from '../utils/types';
@@ -33,7 +32,7 @@ declare type FormRowsProps = ClassComponentProps<FormRowsPropsBase, typeof defau
33
32
  declare class FormRows extends Component<FormRowsProps, {}> {
34
33
  static propTypes: React.WeakValidationMap<ClassComponentProps<FormRowsPropsBase, Required<Pick<FormRowsPropsBase, "header" | "disabled" | "addLabel">>, "div", never>>;
35
34
  static defaultProps: Required<Pick<FormRowsPropsBase, "header" | "disabled" | "addLabel">>;
36
- static Row: React.ComponentClass<Pick<import("./Row").RowPropsBase, "children" | "value" | "elementRef" | "index" | "onRequestRemove" | "rowIndex"> & Pick<PropTypes.InferProps<React.WeakValidationMap<import("./Row").RowPropsBase>>, never> & Pick<import("./Row").RowPropsBase, never>, any>;
35
+ static Row: typeof Row;
37
36
  /**
38
37
  * Static function for adding a row.
39
38
  *
@@ -1,5 +1,4 @@
1
1
  import React, { Component } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import FormRowsContext from './FormRowsContext';
4
3
  declare type RowKeyDownHandler = (event: React.KeyboardEvent<HTMLDivElement>, data: {
5
4
  index: number;
@@ -14,26 +13,18 @@ interface RowPropsBase {
14
13
  * A React ref which is set to the DOM element when the component mounts and null when it unmounts.
15
14
  */
16
15
  elementRef?: React.Ref<HTMLDivElement>;
17
- /** Index of the row */
16
+ /** Index of the row. This is required if the rows are sortable. */
18
17
  index?: number;
19
18
  /** Callback when remove button is clicked. */
20
19
  onRequestRemove?: RowRequestRemoveHandler;
21
- /**
22
- * @private
23
- * Sortable HOC consumes and removes `index`, so we have `rowIndex` to keep
24
- * track of it internally.
25
- */
26
- rowIndex?: number;
27
20
  /** The contents of Row */
28
21
  value?: React.ReactNode;
29
22
  }
30
23
  declare class Row extends Component<RowPropsBase, {}> {
31
24
  static propTypes: React.WeakValidationMap<RowPropsBase>;
25
+ context: React.ContextType<typeof FormRowsContext>;
32
26
  static contextType: React.Context<FormRowsContext>;
33
- private handleKeyDown;
34
- private handleRequestRemove;
35
27
  render(): JSX.Element;
36
28
  }
37
- declare const SortableRow: React.ComponentClass<Pick<RowPropsBase, "children" | "value" | "elementRef" | "index" | "onRequestRemove" | "rowIndex"> & Pick<PropTypes.InferProps<React.WeakValidationMap<RowPropsBase>>, never> & Pick<RowPropsBase, never>, any>;
38
- export default SortableRow;
29
+ export default Row;
39
30
  export type { Row as RowWithoutSortable, RowKeyDownHandler, RowPropsBase, RowRequestRemoveHandler };
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ /** @public */
3
+ declare type RowRequestRemoveHandler = (event: React.MouseEvent<HTMLButtonElement>, data: {
4
+ index: number;
5
+ }) => void;
6
+ interface RowInternalPropsBase {
7
+ children?: React.ReactNode;
8
+ /** Index of the row. This is required if the rows are sortable. */
9
+ index?: number;
10
+ /** Callback when remove button is clicked. */
11
+ onRequestRemove?: RowRequestRemoveHandler;
12
+ renderDragHandle?: () => React.ReactNode;
13
+ style?: React.CSSProperties;
14
+ /** The contents of Row */
15
+ value?: React.ReactNode;
16
+ }
17
+ declare const RowInternal: React.ForwardRefExoticComponent<RowInternalPropsBase & React.RefAttributes<HTMLDivElement>>;
18
+ export default RowInternal;
19
+ export type { RowInternalPropsBase, RowRequestRemoveHandler };
@@ -1,5 +1,11 @@
1
1
  import React from 'react';
2
- declare const SortableList: React.ComponentClass<{
2
+ declare type SortEndHandler = ({ oldIndex, newIndex }: {
3
+ oldIndex: number;
4
+ newIndex: number;
5
+ }) => void;
6
+ declare const SortableList: ({ children, onSortEnd, }: {
3
7
  children?: React.ReactNode;
4
- } & import("react-sortable-hoc").SortableContainerProps, any>;
8
+ onSortEnd: SortEndHandler;
9
+ }) => JSX.Element;
5
10
  export default SortableList;
11
+ export { SortEndHandler };
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ declare type RowKeyDownHandler = (event: React.KeyboardEvent<HTMLDivElement>, data: {
3
+ index: number;
4
+ }) => void;
5
+ /** @public */
6
+ declare type RowRequestRemoveHandler = (event: React.MouseEvent<HTMLButtonElement>, data: {
7
+ index: number;
8
+ }) => void;
9
+ interface RowPropsBase {
10
+ children?: React.ReactNode;
11
+ /** Index of the row. */
12
+ index?: number;
13
+ /** Callback when remove button is clicked. */
14
+ onRequestRemove?: RowRequestRemoveHandler;
15
+ /** The contents of Row */
16
+ value?: React.ReactNode;
17
+ }
18
+ declare const Row: React.ForwardRefExoticComponent<RowPropsBase & React.RefAttributes<HTMLDivElement>>;
19
+ export default Row;
20
+ export type { Row as RowWithoutSortable, RowKeyDownHandler, RowPropsBase, RowRequestRemoveHandler };
@@ -9,8 +9,12 @@ interface HeadingPropsBase {
9
9
  */
10
10
  elementRef?: React.Ref<HTMLHeadingElement>;
11
11
  /**
12
- * Corresponds to the respective `<hX>` HTML tags and `typography(titleX)` `@splunk/themes` typography variant. Use `s` for section-style headings
13
- * and `ss` for small section-style headings. Styles will be set corresponding to level if variant is not provided: e.g. `level=3` will default to using `title3` from `mixins`.
12
+ * Corresponds to the respective `<hX>` HTML tags and `typography(titleX)` `@splunk/themes` typography variant.
13
+ * Styles will be set corresponding to level if variant is not provided: e.g. `level=3` will default to using `title3` from `mixins`.
14
+ *
15
+ * @deprecatedValue 's' and 'ss'
16
+ * The `s` and `ss` values are deprecated and will be removed in a future major version.
17
+ * See the migration guide for how to maintain the same styling as `level="s"` and `level="ss"`.
14
18
  */
15
19
  level?: 1 | 2 | 3 | 4 | 's' | 'ss' | 5 | 6;
16
20
  /**
@@ -30,12 +34,13 @@ declare const levelToElement: {
30
34
  readonly '5': "h5";
31
35
  readonly '6': "h6";
32
36
  };
33
- declare function Heading({ level, children, variant, ...otherProps }: HeadingProps): JSX.Element;
37
+ declare function Heading({ children, elementRef, level, variant, ...otherProps }: HeadingProps): JSX.Element;
34
38
  declare namespace Heading {
35
39
  var propTypes: {
36
40
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
37
41
  elementRef: PropTypes.Requireable<object>;
38
42
  level: PropTypes.Requireable<React.ReactText>;
43
+ variant: PropTypes.Requireable<string>;
39
44
  };
40
45
  }
41
46
  export default Heading;
@@ -46,7 +46,8 @@ interface JSONTreePropsBase {
46
46
  onClickValue?: JSONTreeClickValueHandler;
47
47
  /**
48
48
  * Starts with all nodes expanded if set to `true`. The default is `false`, which expands only the first
49
- * level of properties.
49
+ * level of properties. If set to `withShiftModifier`, using `SHIFT + CLICK” or `SHIFT + ENTER` will expand or collapse all
50
+ * levels of the tree at once.
50
51
  */
51
52
  expandChildren?: boolean | 'withShiftModifier';
52
53
  /**
@@ -1,4 +1,5 @@
1
1
  import React, { Component } from 'react';
2
+ import { LayerStackContext } from './LayerStack';
2
3
  /** @public */
3
4
  declare type LayerPossibleCloseReason = 'clickAway' | 'escapeKey';
4
5
  /** @public */
@@ -30,6 +31,7 @@ declare class Layer extends Component<LayerProps, {}> {
30
31
  static possibleCloseReasons: LayerPossibleCloseReason[];
31
32
  static propTypes: React.WeakValidationMap<LayerProps>;
32
33
  static defaultProps: Required<Pick<LayerPropsBase, "open" | "closeReasons">>;
34
+ context: React.ContextType<typeof LayerStackContext>;
33
35
  static contextType: React.Context<Layer[]>;
34
36
  constructor(props: Readonly<LayerProps>);
35
37
  componentDidMount(): void;
@@ -10,10 +10,17 @@ interface ListPropsBase {
10
10
  * `HTMLUListElement` if type is 'disc', `HTMLOListElement` otherwise.
11
11
  */
12
12
  elementRef?: React.Ref<HTMLOListElement | HTMLUListElement>;
13
+ /** Sets the element as an `HTMLOListElement` otherwise it defaults to `HTMLUListElement`. */
14
+ ordered?: boolean;
15
+ /**
16
+ * @deprecated
17
+ * This prop is deprecated and will be removed in a future major version. List will default to `HTMLUListElement`. Use `ordered` prop to set list to `HTMLOListElement`. Use CSS to style the `list-style-type` property.
18
+ */
13
19
  type?: 'disc' | 'decimal' | 'lower-alpha' | 'upper-alpha';
14
20
  }
15
21
  interface ListOrderedPropsBase extends ListPropsBase {
16
22
  elementRef?: React.Ref<HTMLOListElement>;
23
+ ordered?: boolean;
17
24
  type: 'decimal' | 'lower-alpha' | 'upper-alpha';
18
25
  }
19
26
  interface ListUnorderedPropsBase extends ListPropsBase {
@@ -23,11 +30,12 @@ interface ListUnorderedPropsBase extends ListPropsBase {
23
30
  declare type ListOrderedProps = ComponentProps<ListOrderedPropsBase, 'ol'>;
24
31
  declare type ListUnorderedProps = ComponentProps<ListUnorderedPropsBase, 'ul'>;
25
32
  declare type ListProps = ListOrderedProps | ListUnorderedProps;
26
- declare function List({ children, elementRef, type, ...otherProps }: ListProps): JSX.Element;
33
+ declare function List({ children, elementRef, type, ordered, ...otherProps }: ListProps): JSX.Element;
27
34
  declare namespace List {
28
35
  var propTypes: {
29
36
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
30
37
  elementRef: PropTypes.Requireable<object>;
38
+ ordered: PropTypes.Requireable<boolean>;
31
39
  type: PropTypes.Requireable<string>;
32
40
  };
33
41
  var Item: typeof import("./Item").default;
@@ -0,0 +1,2 @@
1
+ declare function CustomizedList(): JSX.Element;
2
+ export default CustomizedList;
@@ -0,0 +1,2 @@
1
+ declare function Ordered(): JSX.Element;
2
+ export default Ordered;
@@ -0,0 +1,2 @@
1
+ declare function UnorderedList(): JSX.Element;
2
+ export default UnorderedList;
@@ -57,6 +57,7 @@ declare type ListRenderer = (data: {
57
57
  start: number | null;
58
58
  tight: boolean;
59
59
  type: 'bullet' | 'ordered';
60
+ ordered: boolean;
60
61
  }) => React.ReactNode;
61
62
  /** @public */
62
63
  declare type ParagraphRenderer = (data: {
@@ -6,9 +6,11 @@ interface MarkdownListPropsBase {
6
6
  start: number | null;
7
7
  tight: boolean;
8
8
  type: 'bullet' | 'ordered';
9
+ ordered: boolean;
9
10
  }
10
11
  interface MarkdownListOrderedPropsBase extends MarkdownListPropsBase {
11
12
  type: 'ordered';
13
+ ordered: boolean;
12
14
  }
13
15
  interface MarkdownListUnorderedPropsBase extends MarkdownListPropsBase {
14
16
  type: 'bullet';