@splunk/react-ui 4.9.0 → 4.12.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 (143) hide show
  1. package/Accordion.js +4 -4
  2. package/Anchor.js +2 -2
  3. package/Animation.js +4 -4
  4. package/AnimationToggle.js +2 -2
  5. package/Box.js +2 -2
  6. package/Button.js +24 -48
  7. package/ButtonGroup.js +6 -27
  8. package/ButtonSimple.js +4 -4
  9. package/CHANGELOG.md +63 -6
  10. package/Calendar.js +39 -39
  11. package/Card.js +54 -68
  12. package/CardLayout.js +14 -35
  13. package/Chip.js +19 -19
  14. package/Clickable.js +28 -13
  15. package/CloseButton.js +15 -15
  16. package/Code.js +8 -5
  17. package/CollapsiblePanel.js +6 -6
  18. package/Color.js +21 -21
  19. package/ColumnLayout.js +7 -7
  20. package/ComboBox.js +19 -14
  21. package/Concertina.js +13 -13
  22. package/ControlGroup.js +28 -18
  23. package/Date.js +10 -10
  24. package/DefinitionList.js +2 -2
  25. package/Dropdown.js +6 -6
  26. package/EventListener.js +4 -4
  27. package/File.js +31 -31
  28. package/FormRows.js +11 -11
  29. package/Heading.js +2 -2
  30. package/Image.js +21 -21
  31. package/JSONTree.js +40 -22
  32. package/Layer.js +72 -22
  33. package/Link.js +9 -9
  34. package/List.js +2 -2
  35. package/Markdown.js +26 -29
  36. package/Menu.js +53 -53
  37. package/Message.js +33 -33
  38. package/MessageBar.js +46 -39
  39. package/Modal.js +8 -8
  40. package/ModalLayer.js +16 -7
  41. package/Monogram.js +27 -15
  42. package/Multiselect.js +101 -97
  43. package/Number.js +6 -6
  44. package/Paginator.js +46 -49
  45. package/Paragraph.js +2 -2
  46. package/Popover.js +18 -13
  47. package/Progress.js +8 -8
  48. package/RadioBar.js +145 -41
  49. package/RadioList.js +2 -2
  50. package/Resize.js +4 -4
  51. package/ResultsMenu.js +62 -41
  52. package/ScreenReaderContent.js +2 -2
  53. package/Scroll.js +6 -6
  54. package/ScrollContainerContext.js +2 -2
  55. package/Search.js +19 -18
  56. package/Select.js +81 -79
  57. package/SidePanel.js +4 -4
  58. package/Slider.js +8 -8
  59. package/SlidingPanels.js +16 -7
  60. package/StaticContent.js +2 -2
  61. package/StepBar.js +8 -8
  62. package/Switch.js +8 -8
  63. package/TabBar.js +15 -15
  64. package/TabLayout.js +4 -4
  65. package/Table.js +119 -92
  66. package/Text.js +121 -241
  67. package/TextArea.js +1444 -0
  68. package/Tooltip.js +17 -6
  69. package/TransitionOpen.js +20 -10
  70. package/Typography.js +225 -0
  71. package/WaitSpinner.js +4 -4
  72. package/cypress.json +1 -0
  73. package/package.json +21 -8
  74. package/stubs-splunkui.d.ts +13 -0
  75. package/test-runner-jest.config.js +38 -0
  76. package/types/src/Accordion/AccordionContext.d.ts +0 -1
  77. package/types/src/Button/Button.d.ts +0 -2
  78. package/types/src/ButtonGroup/ButtonGroupContext.d.ts +0 -1
  79. package/types/src/Card/Body.d.ts +6 -1
  80. package/types/src/Card/Card.d.ts +0 -2
  81. package/types/src/CardLayout/CardLayoutContext.d.ts +0 -1
  82. package/types/src/Clickable/Clickable.d.ts +5 -0
  83. package/types/src/ComboBox/ComboBox.d.ts +15 -5
  84. package/types/src/Concertina/ConcertinaContext.d.ts +0 -1
  85. package/types/src/ControlGroup/ControlGroup.d.ts +9 -2
  86. package/types/src/Date/Date.d.ts +3 -3
  87. package/types/src/File/FileContext.d.ts +0 -1
  88. package/types/src/FormRows/FormRows.d.ts +1 -1
  89. package/types/src/FormRows/FormRowsContext.d.ts +0 -1
  90. package/types/src/FormRows/Row.d.ts +1 -1
  91. package/types/src/JSONTree/JSONTree.d.ts +2 -2
  92. package/types/src/JSONTree/TreeNode.d.ts +1 -1
  93. package/types/src/JSONTree/docs/examples/WithShiftModifier.d.ts +1 -0
  94. package/types/src/Layer/LayerStack.d.ts +8 -2
  95. package/types/src/Markdown/Markdown.d.ts +2 -3
  96. package/types/src/Menu/MenuContext.d.ts +0 -1
  97. package/types/src/Modal/ModalContext.d.ts +0 -1
  98. package/types/src/ModalLayer/ModalLayer.d.ts +2 -0
  99. package/types/src/Monogram/Monogram.d.ts +2 -2
  100. package/types/src/Multiselect/Compact.d.ts +11 -4
  101. package/types/src/Multiselect/Multiselect.d.ts +14 -5
  102. package/types/src/Multiselect/Normal.d.ts +11 -4
  103. package/types/src/Number/Number.d.ts +3 -3
  104. package/types/src/Popover/Popover.d.ts +1 -0
  105. package/types/src/Popover/PopoverContext.d.ts +0 -1
  106. package/types/src/RadioBar/Option.d.ts +10 -2
  107. package/types/src/RadioBar/RadioBar.d.ts +4 -1
  108. package/types/src/RadioBar/RadioBarContext.d.ts +4 -2
  109. package/types/src/RadioList/RadioListContext.d.ts +0 -1
  110. package/types/src/ResultsMenu/ResultsMenu.d.ts +8 -2
  111. package/types/src/Search/Search.d.ts +4 -0
  112. package/types/src/Select/Select.d.ts +13 -4
  113. package/types/src/Select/SelectBase.d.ts +12 -4
  114. package/types/src/SidePanel/SidePanel.d.ts +2 -1
  115. package/types/src/Slider/Slider.d.ts +3 -3
  116. package/types/src/SlidingPanels/SlidingPanels.d.ts +2 -0
  117. package/types/src/StepBar/StepBarContext.d.ts +0 -1
  118. package/types/src/TabBar/TabBarContext.d.ts +0 -1
  119. package/types/src/Table/HeadCell.d.ts +7 -3
  120. package/types/src/Table/Table.d.ts +2 -3
  121. package/types/src/Table/TableContext.d.ts +5 -0
  122. package/types/src/Text/Text.d.ts +22 -12
  123. package/types/src/TextArea/TextArea.d.ts +190 -0
  124. package/types/src/TextArea/docs/examples/Basic.d.ts +2 -0
  125. package/types/src/TextArea/docs/examples/Disabled.d.ts +2 -0
  126. package/types/src/TextArea/docs/examples/Error.d.ts +2 -0
  127. package/types/src/TextArea/docs/examples/Inline.d.ts +2 -0
  128. package/types/src/TextArea/docs/examples/Uncontrolled.d.ts +2 -0
  129. package/types/src/TextArea/index.d.ts +2 -0
  130. package/types/src/{Text → TextArea}/syncHeightWithShadow.d.ts +1 -2
  131. package/types/src/Tooltip/Tooltip.d.ts +8 -5
  132. package/types/src/TransitionOpen/TransitionOpen.d.ts +3 -0
  133. package/types/src/TransitionOpen/index.d.ts +1 -0
  134. package/types/src/Typography/Typography.d.ts +78 -0
  135. package/types/src/Typography/docs/examples/Basic.d.ts +2 -0
  136. package/types/src/Typography/docs/examples/Variants.d.ts +2 -0
  137. package/types/src/Typography/index.d.ts +2 -0
  138. package/types/src/Typography/test/Typography.unit.d.ts +1 -0
  139. package/types/src/fixtures/FetchOptions.d.ts +82 -2
  140. package/usePrevious.js +2 -2
  141. package/FetchOptions.js +0 -359
  142. package/types/src/FetchOptions/FetchOptions.d.ts +0 -82
  143. package/types/src/FetchOptions/index.d.ts +0 -2
@@ -0,0 +1,2 @@
1
+ declare const Basic: () => JSX.Element;
2
+ export default Basic;
@@ -0,0 +1,2 @@
1
+ declare const Disabled: () => JSX.Element;
2
+ export default Disabled;
@@ -0,0 +1,2 @@
1
+ declare const Error: () => JSX.Element;
2
+ export default Error;
@@ -0,0 +1,2 @@
1
+ declare const Inline: () => JSX.Element;
2
+ export default Inline;
@@ -0,0 +1,2 @@
1
+ declare function Uncontrolled(): JSX.Element;
2
+ export default Uncontrolled;
@@ -0,0 +1,2 @@
1
+ export { default } from './TextArea';
2
+ export * from './TextArea';
@@ -1,6 +1,5 @@
1
- export default function syncHeightWithShadow({ height, multiline, rowsMax, rowsMin, shadow, }: {
1
+ export default function syncHeightWithShadow({ height, rowsMax, rowsMin, shadow, }: {
2
2
  height?: number;
3
- multiline: boolean;
4
3
  rowsMax: number;
5
4
  rowsMin: number;
6
5
  shadow: HTMLInputElement | HTMLTextAreaElement | null;
@@ -2,10 +2,12 @@ import React, { Component } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { AnyTheme } from '@splunk/themes';
4
4
  import { ClassComponentProps } from '../utils/types';
5
+ /** @public */
5
6
  declare type openReasons = 'focusToggle' | 'mouseEnterPopover' | 'mouseEnterToggle';
6
- declare type closeReasons = 'blurToggle' | 'clickAway' | 'escapeKey' | 'mouseLeavePopover' | 'mouseLeaveToggle' | 'offScreen' | 'tabKey';
7
7
  /** @public */
8
- declare type TooltipRequestCloseHandler = (event: React.FocusEvent<HTMLSpanElement> | MouseEvent | null, data: {
8
+ declare type closeReasons = 'blurToggle' | 'clickAway' | 'escapeKey' | 'mouseLeavePopover' | 'mouseLeaveToggle' | 'offScreen' | 'tabKey' | 'toggleClick';
9
+ /** @public */
10
+ declare type TooltipRequestCloseHandler = (event: React.FocusEvent<HTMLSpanElement> | React.MouseEvent | MouseEvent | null, data: {
9
11
  reason: closeReasons;
10
12
  }) => void;
11
13
  /** @public */
@@ -62,7 +64,7 @@ interface TooltipPropsBase {
62
64
  *
63
65
  * @param {event} event Can be `null` depending on the reason the tooltip is closing.
64
66
  * @param {object} data
65
- * @param {string} data.reason The reason for the close request. One of the following `Tooltip.possibleCloseReasons`: `mouseLeaveToggle`, `mouseLeavePopover`, or `blurToggle`.
67
+ * @param {string} data.reason The reason for the close request.
66
68
  */
67
69
  onRequestClose?: TooltipRequestCloseHandler;
68
70
  /**
@@ -70,7 +72,7 @@ interface TooltipPropsBase {
70
72
  *
71
73
  * @param {event} event
72
74
  * @param {object} data
73
- * @param {string} data.reason The reason for the open request. One of the following `Tooltip.possibleOpenReasons`: `mouseEnterToggle`, `mouseEnterPopover`, or `focusToggle`.
75
+ * @param {string} data.reason The reason for the open request.
74
76
  */
75
77
  onRequestOpen?: TooltipRequestOpenHandler;
76
78
  /**
@@ -87,7 +89,7 @@ interface TooltipState {
87
89
  open: boolean;
88
90
  anchor: HTMLSpanElement | null;
89
91
  popoverEl: HTMLDivElement | null;
90
- lastCloseReason: null;
92
+ lastCloseReason: closeReasons | null;
91
93
  }
92
94
  /**
93
95
  * The Tooltip component wraps arbitrary content to be displayed when the target element is hovered
@@ -109,6 +111,7 @@ declare class Tooltip extends Component<TooltipProps, TooltipState> {
109
111
  private handleMouseEnterPopover;
110
112
  private handleMouseLeave;
111
113
  private handleMouseLeavePopover;
114
+ private handleClick;
112
115
  private handleFocus;
113
116
  private handleBlur;
114
117
  private handlePopoverOnRequestClose;
@@ -40,8 +40,10 @@ declare class TransitionOpen extends Component<TransitionOpenProps, TransitionOp
40
40
  static propTypes: React.WeakValidationMap<ClassComponentProps<TransitionOpenPropsBase, Required<Pick<TransitionOpenPropsBase, "open" | "animation" | "animateOnMount" | "innerStyle" | "outerStyle" | "retainFocus" | "takeFocus">>, "div", never>>;
41
41
  static defaultProps: Required<Pick<TransitionOpenPropsBase, "open" | "animation" | "animateOnMount" | "innerStyle" | "outerStyle" | "retainFocus" | "takeFocus">>;
42
42
  static getDerivedStateFromProps: React.GetDerivedStateFromProps<TransitionOpenProps, TransitionOpenState>;
43
+ private allowAnimationUpdates;
43
44
  constructor(props: Readonly<TransitionOpenProps>);
44
45
  componentDidUpdate(): void;
46
+ componentWillUnmount(): void;
45
47
  private getValue;
46
48
  private handleMount;
47
49
  private handleRest;
@@ -51,3 +53,4 @@ declare class TransitionOpen extends Component<TransitionOpenProps, TransitionOp
51
53
  render(): JSX.Element;
52
54
  }
53
55
  export default TransitionOpen;
56
+ export { TransitionOpenPropsBase };
@@ -1 +1,2 @@
1
1
  export { default } from './TransitionOpen';
2
+ export * from './TransitionOpen';
@@ -0,0 +1,78 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { TypographyVariant, TypographyParams } from '@splunk/themes/mixins';
4
+ import { ComponentProps } from '../utils/types';
5
+ declare type TypographyElementTypes = 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span' | 'blockquote' | 'dd' | 'dl' | 'dt' | 'figcaption' | 'figure' | 'li' | 'ol' | 'ul' | 'pre' | 'abbr' | 'cite' | 'code' | 'data' | 'dfn' | 'em' | 'u' | 'time' | 'sup' | 'sub' | 'strong' | 'small' | 'samp' | 's' | 'var' | 'ruby' | 'rt' | 'rp';
6
+ interface TypographyPropsBase extends TypographyParams {
7
+ /**
8
+ * Text and inline icons
9
+ * */
10
+ children: React.ReactNode;
11
+ /**
12
+ * A React ref which is set to the DOM element when the component mounts, and null when it unmounts.
13
+ */
14
+ elementRef?: React.Ref<HTMLElement>;
15
+ /**
16
+ * Tag for the element to render children content into.
17
+ * Use the most semantically appropriate tag.
18
+ * Layout elements like `div` are not allowed; use the `typography` mixin from `@splunk/themes` instead.
19
+ */
20
+ as: TypographyElementTypes;
21
+ /**
22
+ * A variant from the Splunk Design System's Type: 'body', 'title1', 'title2', 'title3',
23
+ * 'title4', 'title5', 'title6', 'title7', 'largeBody', 'smallBody',
24
+ * 'footnote', 'monoBody', or 'monoSmallBody'.
25
+ */
26
+ variant?: TypographyVariant;
27
+ /**
28
+ * Set the font-family to sans-serif or monospace based on current theme.
29
+ */
30
+ family?: 'sansSerif' | 'monospace';
31
+ /**
32
+ * Set the size to a system-standard size.
33
+ */
34
+ size?: 56 | 36 | 32 | 24 | 20 | 18 | 16 | 14 | 12 | 10;
35
+ /**
36
+ * Set the line-height to a system-standard size.
37
+ */
38
+ lineHeight?: 64 | 40 | 32 | 28 | 24 | 22 | 20 | 16 | 13;
39
+ /**
40
+ * Set the color to a system-standard color: e.g. `active` for `@splunk/themes/variables.contentColorActive`.
41
+ */
42
+ color?: 'active' | 'default' | 'disabled' | 'inverted' | 'muted';
43
+ /**
44
+ * Set the font-weight to a system-standard value.
45
+ *
46
+ * Number or equivalent string can be used.
47
+ * See: [font-weight | MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight)
48
+ */
49
+ weight?: 300 | 400 | 500 | 600 | 700 | 800 | 900 | 'light' | 'normal' | 'semiBold' | 'bold' | 'extraBold' | 'heavy';
50
+ /**
51
+ * Apply a reset to the element's margin and padding. This defaults to true if using a `variant`.
52
+ */
53
+ withReset?: boolean;
54
+ }
55
+ declare type TypographyProps = ComponentProps<TypographyPropsBase, TypographyElementTypes>;
56
+ declare type AllTypographyParams = {
57
+ [P in keyof TypographyParams]-?: boolean;
58
+ };
59
+ /**
60
+ * Typography renders text content with styling based on the Splunk Design System.
61
+ */
62
+ export declare function Typography({ children, as, elementRef, ...otherProps }: TypographyProps): JSX.Element;
63
+ export declare namespace Typography {
64
+ var propTypes: {
65
+ children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
66
+ as: PropTypes.Validator<string>;
67
+ elementRef: PropTypes.Requireable<object>;
68
+ family: PropTypes.Requireable<string>;
69
+ variant: PropTypes.Requireable<"body" | "title1" | "title2" | "title3" | "title4" | "title5" | "title6" | "title7" | "largeBody" | "smallBody" | "footnote" | "monoBody" | "monoSmallBody">;
70
+ size: PropTypes.Requireable<number>;
71
+ lineHeight: PropTypes.Requireable<number>;
72
+ color: PropTypes.Requireable<string>;
73
+ weight: PropTypes.Requireable<React.ReactText>;
74
+ withReset: PropTypes.Requireable<boolean>;
75
+ };
76
+ }
77
+ export default Typography;
78
+ export { AllTypographyParams };
@@ -0,0 +1,2 @@
1
+ declare function Basic(): JSX.Element;
2
+ export default Basic;
@@ -0,0 +1,2 @@
1
+ declare function Variants(): JSX.Element;
2
+ export default Variants;
@@ -0,0 +1,2 @@
1
+ export { default } from './Typography';
2
+ export * from './Typography';
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,82 @@
1
- export { default } from '@splunk/react-ui/FetchOptions';
2
- export * from '@splunk/react-ui/FetchOptions';
1
+ import 'core-js/es/promise';
2
+ declare type Movie = {
3
+ id: number;
4
+ title: string;
5
+ };
6
+ declare type MovieOption = Movie & {
7
+ matchRanges?: {
8
+ start: number;
9
+ end: number;
10
+ }[];
11
+ };
12
+ declare function isMovieOption(movie: Movie | MovieOption): movie is MovieOption;
13
+ /**
14
+ * @param fetchTimeout: number - The number of milliseconds to defer fetching of options.
15
+ * @param fetchMoreTimeout: number - The number of milliseconds to defer fetching additional options.
16
+ * @param numberOfResults: number - Then mumber of options to retrieve per fetch.
17
+ */
18
+ export default class FetchOptions {
19
+ private currentFetch;
20
+ private currentOptions;
21
+ private fetching;
22
+ private fetchMoreTimeout;
23
+ private fetchPromise?;
24
+ private fetchTimeout;
25
+ private filter?;
26
+ private firstIndex;
27
+ private lastIndex;
28
+ private list;
29
+ private numberOfResults;
30
+ private timer?;
31
+ constructor({ fetchTimeout, fetchMoreTimeout, numberOfResults }?: {
32
+ fetchTimeout?: number | undefined;
33
+ fetchMoreTimeout?: number | undefined;
34
+ numberOfResults?: number | undefined;
35
+ });
36
+ /**
37
+ * Fake fetches options from a server.
38
+ * @param filter: string - filter options.
39
+ * @param timeout: number - Number of milliseconds to defer fetch.
40
+ * @return A promise that will resolve based on the fetchTimeout value.
41
+ * Returns array of new options.
42
+ */
43
+ fetch(filter?: string, timeout?: number): Promise<MovieOption[]>;
44
+ /**
45
+ * Increases searching index for new options and runs fetch.
46
+ * @param currentOptions: array - Append options to given array.
47
+ * @return A promise that will resolve based on the fetchTimeout value.
48
+ * Returns array of new options appended to currentOptions.
49
+ */
50
+ fetchMore(currentOptions?: MovieOption[]): Promise<MovieOption[]>;
51
+ private concatAndFilter;
52
+ private filterResults;
53
+ /**
54
+ * Resets firstIndex, LastIndex, currentOptions and list to default values.
55
+ */
56
+ reset(): void;
57
+ /** Cancels pending fetch promises. */
58
+ stop(): void;
59
+ /**
60
+ * @return Option of given value;
61
+ */
62
+ getOption: (value: number) => {
63
+ id: number;
64
+ title: string;
65
+ } | undefined;
66
+ /**
67
+ * @return Options of given values;
68
+ */
69
+ getSelectedOptions: (values: number[]) => {
70
+ id: number;
71
+ title: string;
72
+ }[];
73
+ /**
74
+ * Get current length of indexes fetched.
75
+ */
76
+ getCurrentCount: () => number;
77
+ /**
78
+ * Get full count of all possible items fetched.
79
+ */
80
+ getFullCount: () => number;
81
+ }
82
+ export { isMovieOption, Movie, MovieOption };
package/usePrevious.js CHANGED
@@ -82,12 +82,12 @@ module.exports =
82
82
  /******/
83
83
  /******/
84
84
  /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 183);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 180);
86
86
  /******/ })
87
87
  /************************************************************************/
88
88
  /******/ ({
89
89
 
90
- /***/ 183:
90
+ /***/ 180:
91
91
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
92
92
 
93
93
  "use strict";