@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.
- package/Accordion.js +4 -4
- package/Anchor.js +2 -2
- package/Animation.js +4 -4
- package/AnimationToggle.js +2 -2
- package/Box.js +2 -2
- package/Button.js +24 -48
- package/ButtonGroup.js +6 -27
- package/ButtonSimple.js +4 -4
- package/CHANGELOG.md +63 -6
- package/Calendar.js +39 -39
- package/Card.js +54 -68
- package/CardLayout.js +14 -35
- package/Chip.js +19 -19
- package/Clickable.js +28 -13
- package/CloseButton.js +15 -15
- package/Code.js +8 -5
- package/CollapsiblePanel.js +6 -6
- package/Color.js +21 -21
- package/ColumnLayout.js +7 -7
- package/ComboBox.js +19 -14
- package/Concertina.js +13 -13
- package/ControlGroup.js +28 -18
- package/Date.js +10 -10
- package/DefinitionList.js +2 -2
- package/Dropdown.js +6 -6
- package/EventListener.js +4 -4
- package/File.js +31 -31
- package/FormRows.js +11 -11
- package/Heading.js +2 -2
- package/Image.js +21 -21
- package/JSONTree.js +40 -22
- package/Layer.js +72 -22
- package/Link.js +9 -9
- package/List.js +2 -2
- package/Markdown.js +26 -29
- package/Menu.js +53 -53
- package/Message.js +33 -33
- package/MessageBar.js +46 -39
- package/Modal.js +8 -8
- package/ModalLayer.js +16 -7
- package/Monogram.js +27 -15
- package/Multiselect.js +101 -97
- package/Number.js +6 -6
- package/Paginator.js +46 -49
- package/Paragraph.js +2 -2
- package/Popover.js +18 -13
- package/Progress.js +8 -8
- package/RadioBar.js +145 -41
- package/RadioList.js +2 -2
- package/Resize.js +4 -4
- package/ResultsMenu.js +62 -41
- package/ScreenReaderContent.js +2 -2
- package/Scroll.js +6 -6
- package/ScrollContainerContext.js +2 -2
- package/Search.js +19 -18
- package/Select.js +81 -79
- package/SidePanel.js +4 -4
- package/Slider.js +8 -8
- package/SlidingPanels.js +16 -7
- package/StaticContent.js +2 -2
- package/StepBar.js +8 -8
- package/Switch.js +8 -8
- package/TabBar.js +15 -15
- package/TabLayout.js +4 -4
- package/Table.js +119 -92
- package/Text.js +121 -241
- package/TextArea.js +1444 -0
- package/Tooltip.js +17 -6
- package/TransitionOpen.js +20 -10
- package/Typography.js +225 -0
- package/WaitSpinner.js +4 -4
- package/cypress.json +1 -0
- package/package.json +21 -8
- package/stubs-splunkui.d.ts +13 -0
- package/test-runner-jest.config.js +38 -0
- package/types/src/Accordion/AccordionContext.d.ts +0 -1
- package/types/src/Button/Button.d.ts +0 -2
- package/types/src/ButtonGroup/ButtonGroupContext.d.ts +0 -1
- package/types/src/Card/Body.d.ts +6 -1
- package/types/src/Card/Card.d.ts +0 -2
- package/types/src/CardLayout/CardLayoutContext.d.ts +0 -1
- package/types/src/Clickable/Clickable.d.ts +5 -0
- package/types/src/ComboBox/ComboBox.d.ts +15 -5
- package/types/src/Concertina/ConcertinaContext.d.ts +0 -1
- package/types/src/ControlGroup/ControlGroup.d.ts +9 -2
- package/types/src/Date/Date.d.ts +3 -3
- package/types/src/File/FileContext.d.ts +0 -1
- package/types/src/FormRows/FormRows.d.ts +1 -1
- package/types/src/FormRows/FormRowsContext.d.ts +0 -1
- package/types/src/FormRows/Row.d.ts +1 -1
- package/types/src/JSONTree/JSONTree.d.ts +2 -2
- package/types/src/JSONTree/TreeNode.d.ts +1 -1
- package/types/src/JSONTree/docs/examples/WithShiftModifier.d.ts +1 -0
- package/types/src/Layer/LayerStack.d.ts +8 -2
- package/types/src/Markdown/Markdown.d.ts +2 -3
- package/types/src/Menu/MenuContext.d.ts +0 -1
- package/types/src/Modal/ModalContext.d.ts +0 -1
- package/types/src/ModalLayer/ModalLayer.d.ts +2 -0
- package/types/src/Monogram/Monogram.d.ts +2 -2
- package/types/src/Multiselect/Compact.d.ts +11 -4
- package/types/src/Multiselect/Multiselect.d.ts +14 -5
- package/types/src/Multiselect/Normal.d.ts +11 -4
- package/types/src/Number/Number.d.ts +3 -3
- package/types/src/Popover/Popover.d.ts +1 -0
- package/types/src/Popover/PopoverContext.d.ts +0 -1
- package/types/src/RadioBar/Option.d.ts +10 -2
- package/types/src/RadioBar/RadioBar.d.ts +4 -1
- package/types/src/RadioBar/RadioBarContext.d.ts +4 -2
- package/types/src/RadioList/RadioListContext.d.ts +0 -1
- package/types/src/ResultsMenu/ResultsMenu.d.ts +8 -2
- package/types/src/Search/Search.d.ts +4 -0
- package/types/src/Select/Select.d.ts +13 -4
- package/types/src/Select/SelectBase.d.ts +12 -4
- package/types/src/SidePanel/SidePanel.d.ts +2 -1
- package/types/src/Slider/Slider.d.ts +3 -3
- package/types/src/SlidingPanels/SlidingPanels.d.ts +2 -0
- package/types/src/StepBar/StepBarContext.d.ts +0 -1
- package/types/src/TabBar/TabBarContext.d.ts +0 -1
- package/types/src/Table/HeadCell.d.ts +7 -3
- package/types/src/Table/Table.d.ts +2 -3
- package/types/src/Table/TableContext.d.ts +5 -0
- package/types/src/Text/Text.d.ts +22 -12
- package/types/src/TextArea/TextArea.d.ts +190 -0
- package/types/src/TextArea/docs/examples/Basic.d.ts +2 -0
- package/types/src/TextArea/docs/examples/Disabled.d.ts +2 -0
- package/types/src/TextArea/docs/examples/Error.d.ts +2 -0
- package/types/src/TextArea/docs/examples/Inline.d.ts +2 -0
- package/types/src/TextArea/docs/examples/Uncontrolled.d.ts +2 -0
- package/types/src/TextArea/index.d.ts +2 -0
- package/types/src/{Text → TextArea}/syncHeightWithShadow.d.ts +1 -2
- package/types/src/Tooltip/Tooltip.d.ts +8 -5
- package/types/src/TransitionOpen/TransitionOpen.d.ts +3 -0
- package/types/src/TransitionOpen/index.d.ts +1 -0
- package/types/src/Typography/Typography.d.ts +78 -0
- package/types/src/Typography/docs/examples/Basic.d.ts +2 -0
- package/types/src/Typography/docs/examples/Variants.d.ts +2 -0
- package/types/src/Typography/index.d.ts +2 -0
- package/types/src/Typography/test/Typography.unit.d.ts +1 -0
- package/types/src/fixtures/FetchOptions.d.ts +82 -2
- package/usePrevious.js +2 -2
- package/FetchOptions.js +0 -359
- package/types/src/FetchOptions/FetchOptions.d.ts +0 -82
- package/types/src/FetchOptions/index.d.ts +0 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export default function syncHeightWithShadow({ height,
|
|
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
|
|
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.
|
|
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.
|
|
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 };
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,2 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 =
|
|
85
|
+
/******/ return __webpack_require__(__webpack_require__.s = 180);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ({
|
|
89
89
|
|
|
90
|
-
/***/
|
|
90
|
+
/***/ 180:
|
|
91
91
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
92
92
|
|
|
93
93
|
"use strict";
|