@splunk/react-ui 5.4.0 → 5.6.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/AnchorMenu.d.ts +2 -0
- package/AnchorMenu.js +286 -0
- package/Badge.d.ts +2 -0
- package/Badge.js +154 -0
- package/CHANGELOG.md +42 -0
- package/Code.js +1097 -500
- package/Color.js +142 -141
- package/ComboBox.js +6 -5
- package/Link.js +74 -44
- package/MIGRATION.md +32 -1
- package/Menu.js +41 -43
- package/Multiselect.js +615 -2156
- package/Number.js +3 -3
- package/PhoneNumber.d.ts +2 -0
- package/PhoneNumber.js +769 -0
- package/Popover.js +73 -75
- package/RadioList.js +166 -151
- package/ResultsMenu.js +27 -29
- package/Select.js +179 -1768
- package/SelectBase.d.ts +2 -0
- package/SelectBase.js +1714 -0
- package/Slider.js +358 -302
- package/SlidingPanels.js +55 -62
- package/Switch.js +42 -27
- package/TabBar.js +295 -294
- package/TabLayout.js +14 -14
- package/Table.js +1087 -1040
- package/TransitionOpen.js +65 -58
- package/cypress/support/commands.ts +40 -0
- package/cypress/support/component.ts +1 -1
- package/cypress/support/index.d.ts +22 -0
- package/docker-compose.yml +99 -52
- package/package.json +9 -5
- package/stubs-splunkui.d.ts +0 -86
- package/test-runner-jest.config.js +1 -0
- package/types/src/AnchorMenu/AnchorMenu.d.ts +36 -0
- package/types/src/AnchorMenu/AnchorMenuContext.d.ts +6 -0
- package/types/src/AnchorMenu/Item.d.ts +35 -0
- package/types/src/AnchorMenu/docs/examples/Basic.d.ts +6 -0
- package/types/src/AnchorMenu/index.d.ts +3 -0
- package/types/src/Badge/Badge.d.ts +29 -0
- package/types/src/Badge/docs/examples/Basic.d.ts +5 -0
- package/types/src/Badge/docs/examples/Count.d.ts +6 -0
- package/types/src/Badge/docs/examples/CustomColors.d.ts +8 -0
- package/types/src/Badge/docs/examples/Icon.d.ts +6 -0
- package/types/src/Badge/index.d.ts +2 -0
- package/types/src/Code/Code.d.ts +4 -3
- package/types/src/Code/index.d.ts +1 -0
- package/types/src/Link/Link.d.ts +4 -0
- package/types/src/Link/LinkContext.d.ts +14 -0
- package/types/src/Link/docs/examples/Visited.d.ts +7 -0
- package/types/src/Link/index.d.ts +1 -0
- package/types/src/Menu/Item.d.ts +1 -1
- package/types/src/Multiselect/Compact.d.ts +8 -1
- package/types/src/Multiselect/Multiselect.d.ts +8 -1
- package/types/src/PhoneNumber/PhoneNumber.d.ts +139 -0
- package/types/src/PhoneNumber/docs/examples/Controlled.d.ts +7 -0
- package/types/src/PhoneNumber/docs/examples/DefaultCountry.d.ts +7 -0
- package/types/src/PhoneNumber/docs/examples/Disabled.d.ts +6 -0
- package/types/src/PhoneNumber/docs/examples/Error.d.ts +6 -0
- package/types/src/PhoneNumber/docs/examples/Inline.d.ts +7 -0
- package/types/src/PhoneNumber/docs/examples/Uncontrolled.d.ts +7 -0
- package/types/src/PhoneNumber/index.d.ts +2 -0
- package/types/src/PhoneNumber/utils.d.ts +47 -0
- package/types/src/RadioList/Option.d.ts +6 -1
- package/types/src/RadioList/docs/examples/Description.d.ts +6 -0
- package/types/src/Select/Option.d.ts +8 -3
- package/types/src/Select/Select.d.ts +1 -1
- package/types/src/{Select → SelectBase}/OptionBase.d.ts +8 -2
- package/types/src/{Select → SelectBase}/SelectBase.d.ts +11 -2
- package/types/src/SelectBase/index.d.ts +2 -0
- package/types/src/Slider/Slider.d.ts +7 -1
- package/types/src/Switch/Switch.d.ts +4 -1
- package/types/src/Table/Body.d.ts +6 -1
- package/types/src/Table/Cell.d.ts +5 -1
- package/types/src/Table/Head.d.ts +6 -2
- package/types/src/Table/HeadCell.d.ts +5 -1
- package/types/src/Table/Row.d.ts +5 -1
- package/types/src/Table/Table.d.ts +20 -1
- package/types/src/Table/TableContext.d.ts +1 -0
- package/types/src/Table/docs/examples/HorizontalOverflowScroll.d.ts +8 -0
- package/types/src/Table/docs/examples/PinActionColumn.d.ts +7 -0
- package/types/src/TransitionOpen/TransitionOpen.d.ts +3 -1
- package/types/src/useResizeObserver/useResizeObserver.d.ts +2 -0
- package/types/src/useRovingFocus/useRovingFocus.d.ts +8 -1
- package/usePrevious.d.ts +2 -0
- package/useResizeObserver.js +59 -92
- package/useRovingFocus.js +96 -41
- /package/types/src/{Select → SelectBase}/SelectAllOption.d.ts +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { ComponentProps } from '../utils/types';
|
|
4
|
+
interface AnchorMenuItemPropsBase {
|
|
5
|
+
/**
|
|
6
|
+
* Content to render inside the anchor link menu item.
|
|
7
|
+
*/
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* A React ref which is set to the DOM element when the component mounts and null when it unmounts.
|
|
11
|
+
*/
|
|
12
|
+
elementRef?: React.Ref<HTMLLIElement>;
|
|
13
|
+
/**
|
|
14
|
+
* A unique id for the item, used with the `AnchorMenu's` activeItemId prop.
|
|
15
|
+
* If not set, defaults to the `to` prop if present.
|
|
16
|
+
*/
|
|
17
|
+
itemId?: string;
|
|
18
|
+
label?: string;
|
|
19
|
+
onClick?: React.MouseEventHandler<HTMLAnchorElement | HTMLButtonElement>;
|
|
20
|
+
to?: string;
|
|
21
|
+
}
|
|
22
|
+
type AnchorMenuItemProps = ComponentProps<AnchorMenuItemPropsBase, 'li'>;
|
|
23
|
+
declare function Item({ children, elementRef, itemId: itemIdProp, label, onClick, to, ...otherProps }: AnchorMenuItemProps): React.JSX.Element;
|
|
24
|
+
declare namespace Item {
|
|
25
|
+
var propTypes: {
|
|
26
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
27
|
+
elementRef: PropTypes.Requireable<object>;
|
|
28
|
+
itemId: PropTypes.Requireable<string>;
|
|
29
|
+
label: PropTypes.Requireable<string>;
|
|
30
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
31
|
+
to: PropTypes.Requireable<string>;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export type { AnchorMenuItemProps, AnchorMenuItemPropsBase };
|
|
35
|
+
export default Item;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { AnyTheme, Interpolation, OptionalThemedProps } from '@splunk/themes';
|
|
4
|
+
import { ComponentProps } from '../utils/types';
|
|
5
|
+
interface BadgePropsBase {
|
|
6
|
+
/** Changes the background color. Accepts `@splunk/themes` variable or any valid `color` value. */
|
|
7
|
+
backgroundColor?: React.CSSProperties['color'] | Interpolation<AnyTheme, OptionalThemedProps<AnyTheme>>;
|
|
8
|
+
children?: never;
|
|
9
|
+
/** A React ref which is set to the DOM element when the component mounts and null when it unmounts. */
|
|
10
|
+
elementRef?: React.Ref<HTMLSpanElement>;
|
|
11
|
+
/** The content of the badge. */
|
|
12
|
+
label: string;
|
|
13
|
+
/** Icon before the label. */
|
|
14
|
+
icon?: React.ReactNode;
|
|
15
|
+
/** Changes the text and icon color. Accepts `@splunk/themes` variable or any valid `color` value. */
|
|
16
|
+
foregroundColor?: React.CSSProperties['color'] | Interpolation<AnyTheme, OptionalThemedProps<AnyTheme>>;
|
|
17
|
+
}
|
|
18
|
+
type BadgeProps = ComponentProps<BadgePropsBase, 'span'>;
|
|
19
|
+
declare function Badge({ backgroundColor, elementRef, label, icon, foregroundColor, ...otherProps }: BadgeProps): React.JSX.Element;
|
|
20
|
+
declare namespace Badge {
|
|
21
|
+
var propTypes: {
|
|
22
|
+
backgroundColor: PropTypes.Requireable<NonNullable<string | ((...args: any[]) => any) | null | undefined>>;
|
|
23
|
+
elementRef: PropTypes.Requireable<object>;
|
|
24
|
+
label: PropTypes.Validator<string>;
|
|
25
|
+
icon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
26
|
+
foregroundColor: PropTypes.Requireable<NonNullable<string | ((...args: any[]) => any) | null | undefined>>;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export default Badge;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @name Custom colors
|
|
4
|
+
* @description The background and text of Badge can be customized with the `backgroundColor` and `foregroundColor` props. Prefer using variables from `@splunk/themes`, but other valid CSS color values are supported.
|
|
5
|
+
*
|
|
6
|
+
* In all cases, you must check that the chosen colors meet [contrast minimum for text of 4.5:1](https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html#user%20interface%20component).
|
|
7
|
+
*/
|
|
8
|
+
export default function CustomColors(): React.JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @name With icon
|
|
4
|
+
* @description Use the `icon` prop with an icon component (e.g., `@splunk/react-icons`) to add visual context or emphasis alongside the badge's `label`. When using an icon, a label must also be provided.
|
|
5
|
+
*/
|
|
6
|
+
export default function Icon(): React.JSX.Element;
|
package/types/src/Code/Code.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { ComponentProps } from '../utils/types';
|
|
4
|
-
type CodeSupportedLanguages = 'bash' | 'clike' | '
|
|
4
|
+
type CodeSupportedLanguages = 'bash' | 'c' | 'clike' | 'cpp' | 'cs' | 'csharp' | 'css' | 'html' | 'javascript' | 'js' | 'json' | 'jsx' | 'markup' | 'mathml' | 'plain' | 'plaintext' | 'powershell' | 'py' | 'python' | 'sh' | 'shell' | 'splunk-spl' | 'sql' | 'svg' | 'text' | 'ts' | 'tsx' | 'txt' | 'typescript' | 'xml' | 'yaml' | 'yml';
|
|
5
5
|
interface CodePropsBase {
|
|
6
6
|
/** Change the style of the Code container. */
|
|
7
7
|
containerAppearance?: 'none' | 'section';
|
|
@@ -51,8 +51,8 @@ declare namespace Code {
|
|
|
51
51
|
containerAppearance: PropTypes.Requireable<string>;
|
|
52
52
|
elementRef: PropTypes.Requireable<object>;
|
|
53
53
|
indentChars: PropTypes.Requireable<number>;
|
|
54
|
-
language: PropTypes.Requireable<
|
|
55
|
-
languageFallback: PropTypes.Requireable<
|
|
54
|
+
language: PropTypes.Requireable<CodeSupportedLanguages>;
|
|
55
|
+
languageFallback: PropTypes.Requireable<CodeSupportedLanguages>;
|
|
56
56
|
lineHighlights: PropTypes.Requireable<string>;
|
|
57
57
|
lineNumberStart: PropTypes.Requireable<number>;
|
|
58
58
|
showIndentGuide: PropTypes.Requireable<boolean>;
|
|
@@ -61,3 +61,4 @@ declare namespace Code {
|
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
export default Code;
|
|
64
|
+
export type { CodeSupportedLanguages };
|
package/types/src/Link/Link.d.ts
CHANGED
|
@@ -10,6 +10,10 @@ interface LinkPropsBase {
|
|
|
10
10
|
* Adds an aria-disabled attribute and prevents clicking.
|
|
11
11
|
*/
|
|
12
12
|
disabled?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
enableVisitedStyling?: boolean;
|
|
13
17
|
/**
|
|
14
18
|
* A React ref which is set to the DOM element when the component mounts and null when it unmounts.
|
|
15
19
|
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface LinkProviderProps {
|
|
3
|
+
enableVisitedStyling?: boolean;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
type LinkContextValue = {
|
|
7
|
+
enableVisitedStyling: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const LinkContext: React.Context<LinkContextValue>;
|
|
10
|
+
/**
|
|
11
|
+
* Control behavior for all children Link components.
|
|
12
|
+
*/
|
|
13
|
+
declare const LinkProvider: ({ enableVisitedStyling, children, }: LinkProviderProps) => React.ReactElement;
|
|
14
|
+
export { LinkContext, LinkProvider, LinkContextValue, LinkProviderProps };
|
package/types/src/Menu/Item.d.ts
CHANGED
|
@@ -72,7 +72,7 @@ interface ItemPropsBase {
|
|
|
72
72
|
* `selectableAppearance` of 'checkbox' defaults to `menuitemcheckbox`. Otherwise, the role defaults
|
|
73
73
|
* to `menuitem`.
|
|
74
74
|
*/
|
|
75
|
-
role?: 'menuitem' | 'menuitemradio' | 'menuitemcheckbox' | 'listboxitem' | 'option';
|
|
75
|
+
role?: 'menuitem' | 'menuitemradio' | 'menuitemcheckbox' | 'listboxitem' | 'link' | 'option';
|
|
76
76
|
/**
|
|
77
77
|
* Enables selection for this item and reserves space for the control.
|
|
78
78
|
* Required when using `selected` or `selectableAppearance`.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { MultiselectChangeHandler, MultiselectFilterChangeHandler, MultiselectScrollBottomHandler } from '@splunk/react-ui/Multiselect';
|
|
4
|
-
import { SelectBaseProps } from '
|
|
4
|
+
import { SelectBaseProps } from '@splunk/react-ui/SelectBase';
|
|
5
5
|
import { ComponentProps } from '../utils/types';
|
|
6
6
|
interface CompactPropsBase {
|
|
7
7
|
animateLoading?: boolean;
|
|
@@ -74,6 +74,11 @@ interface CompactPropsBase {
|
|
|
74
74
|
/**
|
|
75
75
|
* The loading message to show when isLoadingOptions. */
|
|
76
76
|
loadingMessage?: React.ReactNode;
|
|
77
|
+
/**
|
|
78
|
+
* @private
|
|
79
|
+
* Escape hatch override of the maximum number of values before the toggle label will truncate to `X items selected`
|
|
80
|
+
*/
|
|
81
|
+
maxLabelItems?: number;
|
|
77
82
|
/**
|
|
78
83
|
* Style properties to apply to the Menu. */
|
|
79
84
|
menuStyle?: React.CSSProperties;
|
|
@@ -177,6 +182,8 @@ declare namespace Compact {
|
|
|
177
182
|
isLoadingOptions: PropTypes.Requireable<boolean>;
|
|
178
183
|
labelledBy: PropTypes.Requireable<string>;
|
|
179
184
|
loadingMessage: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
185
|
+
/** @private. */
|
|
186
|
+
maxLabelItems: PropTypes.Requireable<number>;
|
|
180
187
|
menuStyle: PropTypes.Requireable<object>;
|
|
181
188
|
name: PropTypes.Requireable<string>;
|
|
182
189
|
noOptionsMessage: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { Heading, Divider } from '@splunk/react-ui/Menu';
|
|
4
|
-
import { SelectBaseChangeReason } from '@splunk/react-ui/
|
|
4
|
+
import { SelectBaseChangeReason } from '@splunk/react-ui/SelectBase';
|
|
5
5
|
import { CompactPropsBase } from './Compact';
|
|
6
6
|
import Option from './Option';
|
|
7
7
|
import { ComponentProps } from '../utils/types';
|
|
@@ -95,6 +95,11 @@ interface MultiselectPropsBase {
|
|
|
95
95
|
/**
|
|
96
96
|
* The loading message to show when isLoadingOptions. */
|
|
97
97
|
loadingMessage?: React.ReactNode;
|
|
98
|
+
/**
|
|
99
|
+
* @private
|
|
100
|
+
* Escape hatch override of the maximum number of values before the toggle label will truncate to `X items selected`
|
|
101
|
+
*/
|
|
102
|
+
maxLabelItems?: number;
|
|
98
103
|
/**
|
|
99
104
|
* Style properties to apply to the Menu. This is primarily used to override the width of
|
|
100
105
|
* the menu should it need to be wider than the toggle Button. */
|
|
@@ -229,6 +234,8 @@ declare namespace Multiselect {
|
|
|
229
234
|
isLoadingOptions: PropTypes.Requireable<boolean>;
|
|
230
235
|
labelledBy: PropTypes.Requireable<string>;
|
|
231
236
|
loadingMessage: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
237
|
+
/** @private. */
|
|
238
|
+
maxLabelItems: PropTypes.Requireable<number>;
|
|
232
239
|
menuStyle: PropTypes.Requireable<object>;
|
|
233
240
|
name: PropTypes.Requireable<string>;
|
|
234
241
|
noOptionsMessage: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { ComponentProps } from '../utils/types';
|
|
4
|
+
/** @public */
|
|
5
|
+
type PhoneNumberChangeHandler = (event: React.ChangeEvent<HTMLInputElement> | React.KeyboardEvent<HTMLInputElement> | React.MouseEvent<HTMLButtonElement | HTMLSpanElement>, data: {
|
|
6
|
+
name?: string;
|
|
7
|
+
value: string;
|
|
8
|
+
displayValue: string;
|
|
9
|
+
country?: string;
|
|
10
|
+
isPossibleNumber: boolean;
|
|
11
|
+
isValidNumber: boolean;
|
|
12
|
+
internationalFormat: string;
|
|
13
|
+
}) => void;
|
|
14
|
+
/** @public */
|
|
15
|
+
type PhoneNumberBlurHandler = (event: React.FocusEvent<HTMLInputElement>, data: {
|
|
16
|
+
name?: string;
|
|
17
|
+
value: string;
|
|
18
|
+
displayValue: string;
|
|
19
|
+
country?: string;
|
|
20
|
+
isPossibleNumber: boolean;
|
|
21
|
+
isValidNumber: boolean;
|
|
22
|
+
internationalFormat: string;
|
|
23
|
+
}) => void;
|
|
24
|
+
/** @public */
|
|
25
|
+
type PhoneNumberFocusHandler = (event: React.FocusEvent<HTMLInputElement>, data: {
|
|
26
|
+
name?: string;
|
|
27
|
+
value: string;
|
|
28
|
+
displayValue: string;
|
|
29
|
+
country?: string;
|
|
30
|
+
isPossibleNumber: boolean;
|
|
31
|
+
isValidNumber: boolean;
|
|
32
|
+
internationalFormat: string;
|
|
33
|
+
}) => void;
|
|
34
|
+
interface PhoneNumberPropsBase {
|
|
35
|
+
/** Append removes rounded corners and the border from the right side. */
|
|
36
|
+
append?: boolean;
|
|
37
|
+
/** Include an "X" button to clear the value. */
|
|
38
|
+
canClear?: boolean;
|
|
39
|
+
/** The iso2 country code to use for the phone number input. */
|
|
40
|
+
defaultCountry?: string;
|
|
41
|
+
/** Set this property instead of value to make the value uncontrolled. */
|
|
42
|
+
defaultValue?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The id of the description. When placed in a ControlGroup, this is automatically set to the
|
|
45
|
+
* ControlGroup's help component.
|
|
46
|
+
*/
|
|
47
|
+
describedBy?: string;
|
|
48
|
+
/** Determines whether or not the input is disabled. */
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* A React ref which is set to the DOM element when the component mounts, and null when it unmounts.
|
|
52
|
+
*/
|
|
53
|
+
elementRef?: React.Ref<HTMLDivElement>;
|
|
54
|
+
/** Highlight the field as having an error. */
|
|
55
|
+
error?: boolean;
|
|
56
|
+
/** When true, displays inline with a default width. */
|
|
57
|
+
inline?: boolean;
|
|
58
|
+
/** An id for the text input. */
|
|
59
|
+
inputId?: string;
|
|
60
|
+
/**
|
|
61
|
+
* A React ref which is set to the text input element when the component mounts, and null when it unmounts.
|
|
62
|
+
*/
|
|
63
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
64
|
+
/**
|
|
65
|
+
* The id of the label. When placed in a ControlGroup, this is automatically set to the
|
|
66
|
+
* ControlGroup's label.
|
|
67
|
+
*/
|
|
68
|
+
labelledBy?: string;
|
|
69
|
+
name?: string;
|
|
70
|
+
/** A callback for when the input loses focus. */
|
|
71
|
+
onBlur?: PhoneNumberBlurHandler;
|
|
72
|
+
/**
|
|
73
|
+
* Called whenever the value changes.
|
|
74
|
+
* If the value prop is set, this callback is required.
|
|
75
|
+
*/
|
|
76
|
+
onChange?: PhoneNumberChangeHandler;
|
|
77
|
+
/** A callback for when the input is clicked. */
|
|
78
|
+
onClick?: React.MouseEventHandler<HTMLInputElement>;
|
|
79
|
+
/** A callback for when the input takes focus. */
|
|
80
|
+
onFocus?: PhoneNumberFocusHandler;
|
|
81
|
+
/** A callback for when the user selects text. */
|
|
82
|
+
onSelect?: React.ReactEventHandler<HTMLInputElement>;
|
|
83
|
+
/** Prepend removes rounded borders from the left side. */
|
|
84
|
+
prepend?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* @private
|
|
87
|
+
* Do not format the number as the user types.
|
|
88
|
+
*/
|
|
89
|
+
skipFormatting?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* A React ref which is set to the dropdown toggle when the component mounts and null when it unmounts.
|
|
92
|
+
*/
|
|
93
|
+
toggleRef?: React.Ref<HTMLButtonElement>;
|
|
94
|
+
/**
|
|
95
|
+
* The contents of the input. Setting this value makes the input controlled. A callback is required.
|
|
96
|
+
*/
|
|
97
|
+
value?: string;
|
|
98
|
+
}
|
|
99
|
+
interface PhoneNumberPropsBaseControlled extends PhoneNumberPropsBase {
|
|
100
|
+
defaultValue?: never;
|
|
101
|
+
onChange: PhoneNumberChangeHandler;
|
|
102
|
+
value?: string;
|
|
103
|
+
}
|
|
104
|
+
interface PhoneNumberPropsBaseUncontrolled extends PhoneNumberPropsBase {
|
|
105
|
+
defaultValue?: string;
|
|
106
|
+
value?: never;
|
|
107
|
+
}
|
|
108
|
+
type PhoneNumberProps = ComponentProps<PhoneNumberPropsBaseControlled | PhoneNumberPropsBaseUncontrolled, 'div'>;
|
|
109
|
+
declare function PhoneNumber({ append, canClear, defaultCountry, defaultValue, describedBy, disabled, elementRef, error, inline, inputRef, name, onBlur, onChange, onFocus, prepend, skipFormatting, toggleRef, value, ...otherProps }: PhoneNumberProps): React.JSX.Element;
|
|
110
|
+
declare namespace PhoneNumber {
|
|
111
|
+
var componentType: string;
|
|
112
|
+
var propTypes: {
|
|
113
|
+
append: PropTypes.Requireable<boolean>;
|
|
114
|
+
canClear: PropTypes.Requireable<boolean>;
|
|
115
|
+
defaultCountry: PropTypes.Requireable<string>;
|
|
116
|
+
defaultValue: PropTypes.Requireable<string>;
|
|
117
|
+
describedBy: PropTypes.Requireable<string>;
|
|
118
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
119
|
+
elementRef: PropTypes.Requireable<object>;
|
|
120
|
+
error: PropTypes.Requireable<boolean>;
|
|
121
|
+
inline: PropTypes.Requireable<boolean>;
|
|
122
|
+
inputId: PropTypes.Requireable<string>;
|
|
123
|
+
inputRef: PropTypes.Requireable<object>;
|
|
124
|
+
labelledBy: PropTypes.Requireable<string>;
|
|
125
|
+
name: PropTypes.Requireable<string>;
|
|
126
|
+
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
127
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
128
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
129
|
+
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
130
|
+
onSelect: PropTypes.Requireable<(...args: any[]) => any>;
|
|
131
|
+
prepend: PropTypes.Requireable<boolean>;
|
|
132
|
+
/** @private */
|
|
133
|
+
skipFormatting: PropTypes.Requireable<boolean>;
|
|
134
|
+
value: PropTypes.Requireable<string>;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
export default PhoneNumber;
|
|
138
|
+
export { PhoneNumberBlurHandler, PhoneNumberChangeHandler, PhoneNumberFocusHandler };
|
|
139
|
+
export type { PhoneNumberProps, PhoneNumberPropsBase, PhoneNumberPropsBaseControlled, PhoneNumberPropsBaseUncontrolled, };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @name Uncontrolled
|
|
4
|
+
* @description Alternatively, Phone Number can be uncontrolled and optionally provided a `defaultValue`. The `onChange` callback still fires. The `value` prop cannot be set or updated externally.
|
|
5
|
+
*/
|
|
6
|
+
declare function Uncontrolled(): React.JSX.Element;
|
|
7
|
+
export default Uncontrolled;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
type IntlTelInputUtils = typeof import('intl-tel-input/intlTelInputWithUtils').default.utils;
|
|
2
|
+
type CountryData = {
|
|
3
|
+
areaCodes: string[] | null;
|
|
4
|
+
countryName: string;
|
|
5
|
+
dialCode: string;
|
|
6
|
+
flag: string;
|
|
7
|
+
iso2: string;
|
|
8
|
+
iso2Upper: string;
|
|
9
|
+
nationalPrefix: string | null;
|
|
10
|
+
priority?: number;
|
|
11
|
+
};
|
|
12
|
+
declare const PHONE_NUMBER_INVALID_CHAR_REGEX: RegExp;
|
|
13
|
+
declare const UNKNOWN_FLAG = "\uD83C\uDF10";
|
|
14
|
+
declare const loadUtils: () => Promise<{
|
|
15
|
+
formatNumber(number: string, iso2: string | undefined, format?: number): string;
|
|
16
|
+
formatNumberAsYouType(number: string, iso2: string | undefined): string;
|
|
17
|
+
getCoreNumber(number: string, iso2: string | undefined): string;
|
|
18
|
+
getExampleNumber(iso2: string | undefined, nationalMode: boolean, numberType: number, useE164?: boolean): string;
|
|
19
|
+
getExtension(number: string, iso2: string | undefined): string;
|
|
20
|
+
getNumberType(number: string, iso2: string | undefined): number;
|
|
21
|
+
getValidationError(number: string, iso2: string | undefined): number;
|
|
22
|
+
isPossibleNumber(number: string, iso2: string | undefined, numberType?: ("FIXED_LINE_OR_MOBILE" | "FIXED_LINE" | "MOBILE" | "PAGER" | "PERSONAL_NUMBER" | "PREMIUM_RATE" | "SHARED_COST" | "TOLL_FREE" | "UAN" | "UNKNOWN" | "VOICEMAIL" | "VOIP")[] | null): boolean;
|
|
23
|
+
isValidNumber(number: string, iso2: string | undefined, numberType?: ("FIXED_LINE_OR_MOBILE" | "FIXED_LINE" | "MOBILE" | "PAGER" | "PERSONAL_NUMBER" | "PREMIUM_RATE" | "SHARED_COST" | "TOLL_FREE" | "UAN" | "UNKNOWN" | "VOICEMAIL" | "VOIP")[] | null): boolean;
|
|
24
|
+
numberFormat: {
|
|
25
|
+
NATIONAL: number;
|
|
26
|
+
INTERNATIONAL: number;
|
|
27
|
+
E164: number;
|
|
28
|
+
RFC3966: number;
|
|
29
|
+
};
|
|
30
|
+
numberType: object;
|
|
31
|
+
} | null | undefined>;
|
|
32
|
+
declare const getCountryFlag: (countryCode: string) => string;
|
|
33
|
+
declare const getCountries: () => CountryData[];
|
|
34
|
+
/**
|
|
35
|
+
* Main function to process phone input using intl-tel-input utilities
|
|
36
|
+
*/
|
|
37
|
+
declare const processPhoneInput: (utils: IntlTelInputUtils | null, inputValue: string, country?: string, countries?: CountryData[]) => {
|
|
38
|
+
displayValue: string;
|
|
39
|
+
value: string;
|
|
40
|
+
internationalFormat: string;
|
|
41
|
+
country: string;
|
|
42
|
+
isPossibleNumber: boolean;
|
|
43
|
+
isValidNumber: boolean;
|
|
44
|
+
};
|
|
45
|
+
declare const replaceDialCode: (inputValue: string, previousCountry: string, newCountry: string, countries: CountryData[]) => string;
|
|
46
|
+
export { getCountries, getCountryFlag, loadUtils, processPhoneInput, replaceDialCode, PHONE_NUMBER_INVALID_CHAR_REGEX, UNKNOWN_FLAG, };
|
|
47
|
+
export type { IntlTelInputUtils };
|
|
@@ -4,6 +4,10 @@ import { RadioListChangeHandler, RadioListValueTypes } from '@splunk/react-ui/Ra
|
|
|
4
4
|
import { ComponentProps } from '../utils/types';
|
|
5
5
|
interface OptionPropsBase {
|
|
6
6
|
children?: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Additional information to explain the option.
|
|
9
|
+
*/
|
|
10
|
+
description?: string;
|
|
7
11
|
disabled?: boolean;
|
|
8
12
|
error?: boolean;
|
|
9
13
|
id?: string;
|
|
@@ -14,10 +18,11 @@ interface OptionPropsBase {
|
|
|
14
18
|
value: RadioListValueTypes;
|
|
15
19
|
}
|
|
16
20
|
type OptionProps = ComponentProps<OptionPropsBase, 'div'>;
|
|
17
|
-
declare function Option({ children, disabled: disabledProp, error: errorProp, id: idProp, onChange, value, ...otherProps }: OptionProps): React.JSX.Element;
|
|
21
|
+
declare function Option({ children, description, disabled: disabledProp, error: errorProp, id: idProp, onChange, value, ...otherProps }: OptionProps): React.JSX.Element;
|
|
18
22
|
declare namespace Option {
|
|
19
23
|
var propTypes: {
|
|
20
24
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
25
|
+
description: PropTypes.Requireable<string>;
|
|
21
26
|
disabled: PropTypes.Requireable<boolean>;
|
|
22
27
|
error: PropTypes.Requireable<boolean>;
|
|
23
28
|
id: PropTypes.Requireable<string>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { OptionClickHandler as OptionBaseClickHandler } from '@splunk/react-ui/SelectBase';
|
|
2
3
|
import { ComponentProps } from '../utils/types';
|
|
3
|
-
import type { OptionClickHandler } from './OptionBase';
|
|
4
4
|
interface OptionPropsBase {
|
|
5
5
|
/** @private */
|
|
6
6
|
active?: boolean;
|
|
@@ -26,6 +26,11 @@ interface OptionPropsBase {
|
|
|
26
26
|
* A React ref which is set to the DOM element when the component mounts, and null when it unmounts.
|
|
27
27
|
*/
|
|
28
28
|
elementRef?: React.Ref<HTMLAnchorElement | HTMLButtonElement>;
|
|
29
|
+
/**
|
|
30
|
+
* Allow the endAdornment to be passed to the underlying Menu.Item.
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
endAdornment?: React.ReactNode;
|
|
29
34
|
/**
|
|
30
35
|
* Adding hidden options can be useful for resolving the selected display label and icon,
|
|
31
36
|
* when the option should not be in the list. This scenario can arise when Select's filter is
|
|
@@ -55,7 +60,7 @@ interface OptionPropsBase {
|
|
|
55
60
|
end: number;
|
|
56
61
|
}[];
|
|
57
62
|
/** @private */
|
|
58
|
-
onClick?:
|
|
63
|
+
onClick?: OptionBaseClickHandler;
|
|
59
64
|
/** @private */
|
|
60
65
|
role?: 'menuitemcheckbox' | 'option';
|
|
61
66
|
/** @private */
|
|
@@ -76,4 +81,4 @@ type OptionProps = ComponentProps<OptionPropsBase, 'button'>;
|
|
|
76
81
|
declare function Option({ children, descriptionPosition, elementRef, label, ...otherProps }: OptionProps): React.JSX.Element;
|
|
77
82
|
declare const OptionMemoized: React.MemoExoticComponent<typeof Option>;
|
|
78
83
|
export default OptionMemoized;
|
|
79
|
-
export type {
|
|
84
|
+
export type { OptionBaseClickHandler, OptionPropsBase };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import { Divider as BaseDivider, Heading as BaseHeading, SelectBaseProps } from '@splunk/react-ui/SelectBase';
|
|
3
4
|
import Option from './Option';
|
|
4
|
-
import { Divider as BaseDivider, Heading as BaseHeading, SelectBaseProps } from './SelectBase';
|
|
5
5
|
import { ComponentProps } from '../utils/types';
|
|
6
6
|
/** @public */
|
|
7
7
|
type SelectChangeHandler = (event: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLInputElement>, data: {
|
|
@@ -30,6 +30,11 @@ interface OptionPropsBase {
|
|
|
30
30
|
* A React ref which is set to the DOM element when the component mounts, and null when it unmounts.
|
|
31
31
|
*/
|
|
32
32
|
elementRef?: React.Ref<HTMLAnchorElement | HTMLButtonElement>;
|
|
33
|
+
/**
|
|
34
|
+
* Allow the endAdornment to be passed to the underlying Menu.Item.
|
|
35
|
+
* @private
|
|
36
|
+
*/
|
|
37
|
+
endAdornment?: React.ReactNode;
|
|
33
38
|
/**
|
|
34
39
|
* Adding hidden options can be useful for resolving the selected display label and icon,
|
|
35
40
|
* when the option should not be in the list. This scenario can arise when Select's filter is
|
|
@@ -81,7 +86,7 @@ type OptionProps = ComponentProps<OptionPropsBase, 'button'>;
|
|
|
81
86
|
/**
|
|
82
87
|
* An option within a `Multiselect`.
|
|
83
88
|
*/
|
|
84
|
-
declare function Option({ children, descriptionPosition, disabled, elementRef, icon, label, multiple, onClick, role, value, ...otherProps }: OptionProps): React.JSX.Element;
|
|
89
|
+
declare function Option({ children, descriptionPosition, disabled, elementRef, endAdornment, icon, label, multiple, onClick, role, value, ...otherProps }: OptionProps): React.JSX.Element;
|
|
85
90
|
declare namespace Option {
|
|
86
91
|
var propTypes: {
|
|
87
92
|
/** @private */
|
|
@@ -91,6 +96,7 @@ declare namespace Option {
|
|
|
91
96
|
descriptionPosition: PropTypes.Requireable<string>;
|
|
92
97
|
disabled: PropTypes.Requireable<boolean>;
|
|
93
98
|
elementRef: PropTypes.Requireable<object>;
|
|
99
|
+
endAdornment: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
94
100
|
hidden: PropTypes.Requireable<boolean>;
|
|
95
101
|
icon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
96
102
|
label: PropTypes.Validator<string>;
|
|
@@ -114,4 +120,4 @@ declare namespace Option {
|
|
|
114
120
|
var type: typeof Item;
|
|
115
121
|
}
|
|
116
122
|
export default Option;
|
|
117
|
-
export { OptionClickHandler };
|
|
123
|
+
export type { OptionClickHandler };
|