@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
|
@@ -3,7 +3,9 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { Divider, Heading } from '@splunk/react-ui/Menu';
|
|
4
4
|
import { TextBlurHandler, TextChangeHandler, TextFocusHandler } from '@splunk/react-ui/Text';
|
|
5
5
|
import Option from './OptionBase';
|
|
6
|
+
import SelectAllOption from './SelectAllOption';
|
|
6
7
|
import { ComponentProps } from '../utils/types';
|
|
8
|
+
import type { OptionClickHandler } from './OptionBase';
|
|
7
9
|
type SelectBaseFilterChangeHandler = (event: React.ChangeEvent<HTMLInputElement> | React.FocusEvent<HTMLInputElement> | React.MouseEvent<HTMLSpanElement> | React.KeyboardEvent, data: {
|
|
8
10
|
keyword: string;
|
|
9
11
|
}) => void;
|
|
@@ -96,6 +98,11 @@ interface SelectBasePropsBase {
|
|
|
96
98
|
/**
|
|
97
99
|
* The loading message to show when isLoadingOptions. */
|
|
98
100
|
loadingMessage?: React.ReactNode;
|
|
101
|
+
/**
|
|
102
|
+
* @private
|
|
103
|
+
* Escape hatch override of the maximum number of values before the toggle label will truncate to `X items selected`
|
|
104
|
+
*/
|
|
105
|
+
maxLabelItems?: number;
|
|
99
106
|
/**
|
|
100
107
|
* Style properties to apply to the Menu. */
|
|
101
108
|
menuStyle?: React.CSSProperties;
|
|
@@ -229,7 +236,7 @@ interface ControlsProps extends Pick<SelectBaseProps, 'inputId' | 'inputRef' | '
|
|
|
229
236
|
textHasFocus: boolean;
|
|
230
237
|
}
|
|
231
238
|
declare const Controls: ({ activeItemId, filterA11yId, filterKeyword, hasChildren, inputId, inputRef, menuListboxId, multiple, onClearAll, onSelectAll, onTextBlur, onTextChange, onTextFocus, onTextKeyDown, optionSelection, placement, selectAllAppearance, textHasFocus, }: ControlsProps) => React.JSX.Element;
|
|
232
|
-
declare function SelectBase({ allowKeyMatching, animateLoading, appearance, append, allowNewValues, children, defaultPlacement, defaultValues, describedBy, disabled, elementRef, error, filter, footerMessage, inline, inputId, inputRef, isLoadingOptions, labelledBy, labelText, loadingMessage, menuStyle, multiple, name, noOptionsMessage, onChange, onScroll, onScrollBottom, onFilterChange, onClick, onClose, onOpen, required, placeholder, prefixLabel, prepend, repositionMode, selectAllAppearance, showSelectedValuesFirst, suffixLabel, tabConfirmsNewValue, values, virtualization, toggle, toggleContent, ...otherProps }: SelectBaseProps): React.JSX.Element;
|
|
239
|
+
declare function SelectBase({ allowKeyMatching, animateLoading, appearance, append, allowNewValues, children, defaultPlacement, defaultValues, describedBy, disabled, elementRef, error, filter, footerMessage, inline, inputId, inputRef, isLoadingOptions, labelledBy, labelText, loadingMessage, menuStyle, multiple, name, noOptionsMessage, onChange, onScroll, onScrollBottom, onFilterChange, onClick, onClose, onOpen, required, placeholder, prefixLabel, prepend, repositionMode, selectAllAppearance, showSelectedValuesFirst, suffixLabel, tabConfirmsNewValue, values, virtualization, toggle, toggleContent, maxLabelItems, ...otherProps }: SelectBaseProps): React.JSX.Element;
|
|
233
240
|
declare namespace SelectBase {
|
|
234
241
|
var propTypes: {
|
|
235
242
|
allowKeyMatching: PropTypes.Requireable<boolean>;
|
|
@@ -253,6 +260,8 @@ declare namespace SelectBase {
|
|
|
253
260
|
labelledBy: PropTypes.Requireable<string>;
|
|
254
261
|
labelText: PropTypes.Requireable<string>;
|
|
255
262
|
loadingMessage: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
263
|
+
/** @private. */
|
|
264
|
+
maxLabelItems: PropTypes.Requireable<number>;
|
|
256
265
|
menuStyle: PropTypes.Requireable<object>;
|
|
257
266
|
multiple: PropTypes.Requireable<boolean>;
|
|
258
267
|
name: PropTypes.Requireable<string>;
|
|
@@ -286,4 +295,4 @@ declare namespace SelectBase {
|
|
|
286
295
|
var Heading: typeof import("@splunk/react-ui/Menu").Heading;
|
|
287
296
|
}
|
|
288
297
|
export default SelectBase;
|
|
289
|
-
export { Controls, ChildrenElement, Divider, Heading, Option, SelectBaseChangeHandler, SelectBaseChangeReason, SelectBaseFilterChangeHandler, SelectBaseProps, isOption, };
|
|
298
|
+
export { Controls, ChildrenElement, Divider, Heading, Option, SelectAllOption, OptionClickHandler, SelectBaseChangeHandler, SelectBaseChangeReason, SelectBaseFilterChangeHandler, SelectBaseProps, isOption, };
|
|
@@ -28,6 +28,11 @@ interface SliderPropsBase {
|
|
|
28
28
|
error?: boolean;
|
|
29
29
|
/** When false, display as inline-block with the default width. */
|
|
30
30
|
inline?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* An id for the input, which may be necessary for accessibility, such as for aria
|
|
33
|
+
* attributes.
|
|
34
|
+
*/
|
|
35
|
+
inputId?: string;
|
|
31
36
|
/**
|
|
32
37
|
* The id of the label. When placed in a ControlGroup, this is automatically set to the
|
|
33
38
|
* ControlGroup's label.
|
|
@@ -80,7 +85,7 @@ interface SliderPropsBaseUncontrolled extends SliderPropsBase {
|
|
|
80
85
|
value?: never;
|
|
81
86
|
}
|
|
82
87
|
type SliderProps = ComponentProps<SliderPropsBaseControlled | SliderPropsBaseUncontrolled, 'div'>;
|
|
83
|
-
declare function Slider({ defaultValue, describedBy, disabled, displayValue, elementRef, error, inline, labelledBy, max, maxLabel, min, minLabel, name, onChange, required, step, stepMarks, thumbRef, value, ...otherProps }: SliderProps): React.JSX.Element;
|
|
88
|
+
declare function Slider({ defaultValue, describedBy, disabled, displayValue, elementRef, error, inline, inputId, labelledBy, max, maxLabel, min, minLabel, name, onChange, required, step, stepMarks, thumbRef, value, ...otherProps }: SliderProps): React.JSX.Element;
|
|
84
89
|
declare namespace Slider {
|
|
85
90
|
var propTypes: {
|
|
86
91
|
defaultValue: PropTypes.Requireable<number>;
|
|
@@ -90,6 +95,7 @@ declare namespace Slider {
|
|
|
90
95
|
elementRef: PropTypes.Requireable<object>;
|
|
91
96
|
error: PropTypes.Requireable<boolean>;
|
|
92
97
|
inline: PropTypes.Requireable<boolean>;
|
|
98
|
+
inputId: PropTypes.Requireable<string>;
|
|
93
99
|
labelledBy: PropTypes.Requireable<string>;
|
|
94
100
|
max: PropTypes.Requireable<number>;
|
|
95
101
|
maxLabel: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
@@ -15,7 +15,7 @@ interface SwitchPropsBase {
|
|
|
15
15
|
/**
|
|
16
16
|
* Determines if the component renders as a checkbox or toggle.
|
|
17
17
|
*
|
|
18
|
-
* @deprecatedValue 'checkbox'
|
|
18
|
+
* @deprecatedValue 'checkbox'. Consider using the `Checkbox` component instead.
|
|
19
19
|
* The 'checkbox' value is deprecated and will be removed in a future major version.
|
|
20
20
|
*/
|
|
21
21
|
appearance?: 'checkbox' | 'toggle';
|
|
@@ -57,10 +57,12 @@ interface SwitchPropsBase {
|
|
|
57
57
|
*/
|
|
58
58
|
selected?: boolean | 'some';
|
|
59
59
|
/**
|
|
60
|
+
* @deprecated This prop is deprecated and will be removed in the next major version.
|
|
60
61
|
* The customized content presented to screen readers when selected.
|
|
61
62
|
*/
|
|
62
63
|
selectedLabel?: string;
|
|
63
64
|
/**
|
|
65
|
+
* @deprecated This prop is deprecated and will be removed in the next major version.
|
|
64
66
|
* The customized content presented to screen readers when selected="some".
|
|
65
67
|
*/
|
|
66
68
|
someSelectedLabel?: string;
|
|
@@ -69,6 +71,7 @@ interface SwitchPropsBase {
|
|
|
69
71
|
*/
|
|
70
72
|
toggleRef?: React.Ref<HTMLAnchorElement | HTMLButtonElement | HTMLSpanElement>;
|
|
71
73
|
/**
|
|
74
|
+
* @deprecated This prop is deprecated and will be removed in the next major version.
|
|
72
75
|
* The customized content presented to screen readers when unselected.
|
|
73
76
|
*/
|
|
74
77
|
unselectedLabel?: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import { PinnedColumnsProp } from '@splunk/react-ui/Table';
|
|
3
4
|
import { RowRequestMoveRowHandler } from './Row';
|
|
4
5
|
import { ComponentProps } from '../utils/types';
|
|
5
6
|
type BodyRequestMoveRowHandler = RowRequestMoveRowHandler;
|
|
@@ -20,13 +21,15 @@ interface BodyPropsBase {
|
|
|
20
21
|
rowExpansion?: 'single' | 'multi' | 'none' | 'controlled';
|
|
21
22
|
/** @private. Generally passed by Table rather than added directly. */
|
|
22
23
|
onRequestMoveRow?: BodyRequestMoveRowHandler;
|
|
24
|
+
/** @private. */
|
|
25
|
+
pinnedColumns?: PinnedColumnsProp;
|
|
23
26
|
/** Indicates the column to use as the primary label for each row. */
|
|
24
27
|
primaryColumnIndex?: number;
|
|
25
28
|
/** @private. Generally passed by Table rather than added directly. */
|
|
26
29
|
stripeRows?: boolean;
|
|
27
30
|
}
|
|
28
31
|
type BodyProps = ComponentProps<BodyPropsBase, 'tbody'>;
|
|
29
|
-
declare function Body({ actions, children, elementRef, movableColumns, onRequestMoveRow, rowExpansion, primaryColumnIndex, stripeRows, ...otherProps }: BodyProps): React.JSX.Element | null;
|
|
32
|
+
declare function Body({ actions, children, elementRef, pinnedColumns, movableColumns, onRequestMoveRow, rowExpansion, primaryColumnIndex, stripeRows, ...otherProps }: BodyProps): React.JSX.Element | null;
|
|
30
33
|
declare namespace Body {
|
|
31
34
|
var propTypes: {
|
|
32
35
|
/** @private. Generally passed by Table rather than added directly. */
|
|
@@ -39,6 +42,8 @@ declare namespace Body {
|
|
|
39
42
|
rowExpansion: PropTypes.Requireable<string>;
|
|
40
43
|
/** @private. Generally passed by Table rather than added directly. */
|
|
41
44
|
onRequestMoveRow: PropTypes.Requireable<(...args: any[]) => any>;
|
|
45
|
+
/** @private. */
|
|
46
|
+
pinnedColumns: PropTypes.Requireable<object>;
|
|
42
47
|
/** @private. Generally passed by Table rather than added directly. */
|
|
43
48
|
primaryColumnIndex: PropTypes.Requireable<number>;
|
|
44
49
|
/** @private. Generally passed by Table rather than added directly. */
|
|
@@ -24,6 +24,8 @@ interface CellPropsBase {
|
|
|
24
24
|
* A React ref which is set to the DOM element when the component mounts and null when it unmounts.
|
|
25
25
|
*/
|
|
26
26
|
elementRef?: React.Ref<HTMLTableCellElement>;
|
|
27
|
+
/** @private. */
|
|
28
|
+
isPinned?: boolean;
|
|
27
29
|
/**
|
|
28
30
|
* @private
|
|
29
31
|
* Used to style the primary cell when row is clickable
|
|
@@ -44,7 +46,7 @@ interface CellPropsBase {
|
|
|
44
46
|
variant?: 'toggle' | 'expand' | 'drag' | 'actions';
|
|
45
47
|
}
|
|
46
48
|
type CellProps = ComponentProps<CellPropsBase, 'td'>;
|
|
47
|
-
declare function Cell({ align, appearance, appearClickable, children, data, disabled, elementRef, isPrimaryCell, onClick, onKeyDown, stripe, variant, ...otherProps }: CellProps): React.JSX.Element;
|
|
49
|
+
declare function Cell({ align, appearance, appearClickable, children, data, disabled, elementRef, isPinned, isPrimaryCell, onClick, onKeyDown, stripe, variant, ...otherProps }: CellProps): React.JSX.Element;
|
|
48
50
|
declare namespace Cell {
|
|
49
51
|
var propTypes: {
|
|
50
52
|
align: PropTypes.Requireable<string>;
|
|
@@ -57,6 +59,8 @@ declare namespace Cell {
|
|
|
57
59
|
elementRef: PropTypes.Requireable<object>;
|
|
58
60
|
/** @private */
|
|
59
61
|
isPrimaryCell: PropTypes.Requireable<boolean>;
|
|
62
|
+
/** @private */
|
|
63
|
+
isPinned: PropTypes.Requireable<boolean>;
|
|
60
64
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
61
65
|
/** @private */
|
|
62
66
|
onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { TableRequestMoveColumnHandler } from '@splunk/react-ui/Table';
|
|
3
|
+
import { PinnedColumnsProp, TableRequestMoveColumnHandler } from '@splunk/react-ui/Table';
|
|
4
4
|
import { ComponentProps } from '../utils/types';
|
|
5
5
|
type HeadAutosizeColumnHandler = (event: React.MouseEvent<HTMLHRElement>, data: {
|
|
6
6
|
columnId?: string;
|
|
@@ -42,11 +42,13 @@ interface HeadPropsBase {
|
|
|
42
42
|
/** @private. */
|
|
43
43
|
onRequestToggleAllRows?: () => void;
|
|
44
44
|
/** @private. */
|
|
45
|
+
pinnedColumns?: PinnedColumnsProp;
|
|
46
|
+
/** @private. */
|
|
45
47
|
rowSelection?: 'all' | 'some' | 'none';
|
|
46
48
|
}
|
|
47
49
|
type HeadProps = ComponentProps<HeadPropsBase, 'thead'>;
|
|
48
50
|
declare const getCellWidths: (headEl: HTMLTableSectionElement | null) => number[];
|
|
49
|
-
declare function Head({ actions, actionsColumnWidth, cellMinWidth, children, elementRef, hasDragColumn, hasInfoColumn, onAutosizeColumn, onRequestMoveColumn, onRequestResizeColumn, onRequestToggleAllRows, rowSelection, ...otherProps }: HeadProps): React.JSX.Element;
|
|
51
|
+
declare function Head({ actions, actionsColumnWidth, cellMinWidth, children, elementRef, hasDragColumn, hasInfoColumn, pinnedColumns, onAutosizeColumn, onRequestMoveColumn, onRequestResizeColumn, onRequestToggleAllRows, rowSelection, ...otherProps }: HeadProps): React.JSX.Element;
|
|
50
52
|
declare namespace Head {
|
|
51
53
|
var propTypes: {
|
|
52
54
|
/** @private. */
|
|
@@ -70,6 +72,8 @@ declare namespace Head {
|
|
|
70
72
|
/** @private. */
|
|
71
73
|
onRequestToggleAllRows: PropTypes.Requireable<(...args: any[]) => any>;
|
|
72
74
|
/** @private. */
|
|
75
|
+
pinnedColumns: PropTypes.Requireable<object>;
|
|
76
|
+
/** @private. */
|
|
73
77
|
rowSelection: PropTypes.Requireable<string>;
|
|
74
78
|
};
|
|
75
79
|
var splunkUiType: string;
|
|
@@ -46,6 +46,8 @@ interface HeadCellPropsBase {
|
|
|
46
46
|
/** @private The index of the cell, skipping the info column. */
|
|
47
47
|
index?: number;
|
|
48
48
|
/** @private. */
|
|
49
|
+
isPinned?: boolean;
|
|
50
|
+
/** @private. */
|
|
49
51
|
onAutosizeColumn?: HeadCellAutosizeColumnHandler;
|
|
50
52
|
/**
|
|
51
53
|
* A callback invoked when this head cell is clicked. If provided, this HeadCell is
|
|
@@ -97,7 +99,7 @@ interface HeadCellPropsBase {
|
|
|
97
99
|
variant?: 'toggleAll' | 'info' | 'actions';
|
|
98
100
|
}
|
|
99
101
|
type HeadCellProps = ComponentProps<HeadCellPropsBase, 'th'>;
|
|
100
|
-
declare function HeadCell({ align, appearClickable, children, columnId, elementRef, dragId, headCellScreenReaderText, id, index, onAutosizeColumn, onClick, onKeyDown, onRequestMoveColumn, onRequestResize, onSort, resizable, sortDir, sortKey, style, tooltip, truncate: truncateProp, variant, visible, width, ...otherProps }: HeadCellProps): React.JSX.Element;
|
|
102
|
+
declare function HeadCell({ align, appearClickable, children, columnId, elementRef, dragId, headCellScreenReaderText, id, index, isPinned, onAutosizeColumn, onClick, onKeyDown, onRequestMoveColumn, onRequestResize, onSort, resizable, sortDir, sortKey, style, tooltip, truncate: truncateProp, variant, visible, width, ...otherProps }: HeadCellProps): React.JSX.Element;
|
|
101
103
|
declare namespace HeadCell {
|
|
102
104
|
var propTypes: {
|
|
103
105
|
align: PropTypes.Requireable<string>;
|
|
@@ -112,6 +114,8 @@ declare namespace HeadCell {
|
|
|
112
114
|
/** @private The index of the cell, skipping the info column. */
|
|
113
115
|
index: PropTypes.Requireable<number>;
|
|
114
116
|
/** @private. */
|
|
117
|
+
isPinned: PropTypes.Requireable<boolean>;
|
|
118
|
+
/** @private. */
|
|
115
119
|
onAutosizeColumn: PropTypes.Requireable<(...args: any[]) => any>;
|
|
116
120
|
/** @private. */
|
|
117
121
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
package/types/src/Table/Row.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { TableRequestMoveRowHandler } from '@splunk/react-ui/Table';
|
|
3
|
+
import { PinnedColumnsProp, TableRequestMoveRowHandler } from '@splunk/react-ui/Table';
|
|
4
4
|
import { ComponentProps } from '../utils/types';
|
|
5
5
|
/** @public */
|
|
6
6
|
type RowActionPrimaryClickHandler = (event: React.MouseEvent, data?: any) => void;
|
|
@@ -77,6 +77,8 @@ interface RowPropsBase {
|
|
|
77
77
|
* An event handler for toggle of the row. resize of columns. The function is passed the event and the `data` prop for this row.
|
|
78
78
|
*/
|
|
79
79
|
onRequestToggle?: RowRequestToggleHandler;
|
|
80
|
+
/** @private. */
|
|
81
|
+
pinnedColumns?: PinnedColumnsProp;
|
|
80
82
|
/**
|
|
81
83
|
* @private. Generally passed by Table rather than added directly. Indicates the column to use as the primary label for each row.
|
|
82
84
|
*/
|
|
@@ -128,6 +130,8 @@ declare namespace Row {
|
|
|
128
130
|
/** @private. Generally passed by `Table` rather than added directly. */
|
|
129
131
|
onRequestMoveRow: PropTypes.Requireable<(...args: any[]) => any>;
|
|
130
132
|
onRequestToggle: PropTypes.Requireable<(...args: any[]) => any>;
|
|
133
|
+
/** @private. */
|
|
134
|
+
pinnedColumns: PropTypes.Requireable<object>;
|
|
131
135
|
/** @private. Generally passed by `Table` rather than added directly. */
|
|
132
136
|
primaryColumnIndex: PropTypes.Requireable<number>;
|
|
133
137
|
rowScreenReaderText: PropTypes.Requireable<string>;
|
|
@@ -25,6 +25,10 @@ type TableRequestResizeColumnHandler = (event: React.MouseEvent<HTMLHRElement> |
|
|
|
25
25
|
index: number;
|
|
26
26
|
width: number;
|
|
27
27
|
}) => void;
|
|
28
|
+
/** @public */
|
|
29
|
+
type PinnedColumnsProp = {
|
|
30
|
+
actions?: boolean;
|
|
31
|
+
};
|
|
28
32
|
interface TablePropsBase {
|
|
29
33
|
/**
|
|
30
34
|
* Adds table-level actions. Not compatible with `onRequestResize`.
|
|
@@ -63,6 +67,14 @@ interface TablePropsBase {
|
|
|
63
67
|
* the table.
|
|
64
68
|
*/
|
|
65
69
|
headType?: 'docked' | 'fixed' | 'inline';
|
|
70
|
+
/**
|
|
71
|
+
* Controls how the Table handles horizontal content overflow:
|
|
72
|
+
*
|
|
73
|
+
* * `auto`: The default behavior for overflow. `HeadCell` content will truncate and `Cell` content will wrap.
|
|
74
|
+
* The Table will scroll horizontally when the container's width exceeds the Table's width.
|
|
75
|
+
* * `scroll`: The Table will scroll horizontally. `HeadCell` content will not truncate and `Cell` content will wrap only for word breaks.
|
|
76
|
+
*/
|
|
77
|
+
horizontalOverflow?: 'auto' | 'scroll';
|
|
66
78
|
/**
|
|
67
79
|
* Style specification for the inner container, which is the scrolling container.
|
|
68
80
|
*/
|
|
@@ -79,6 +91,11 @@ interface TablePropsBase {
|
|
|
79
91
|
* Style specification for the outer container.
|
|
80
92
|
*/
|
|
81
93
|
outerStyle?: React.CSSProperties;
|
|
94
|
+
/**
|
|
95
|
+
* Optionally pin the actions column to the end of the table by passing `pinnedColumns={{ actions: true }}.`
|
|
96
|
+
* When using pinned columns `horizontalOverflow` should be set to `scroll`.
|
|
97
|
+
*/
|
|
98
|
+
pinnedColumns?: PinnedColumnsProp;
|
|
82
99
|
/**
|
|
83
100
|
* Adds a column to the table with an expansion button for each row that has expansion
|
|
84
101
|
* content. Supported values:
|
|
@@ -138,10 +155,12 @@ declare namespace Table {
|
|
|
138
155
|
dockScrollBar: PropTypes.Requireable<boolean>;
|
|
139
156
|
elementRef: PropTypes.Requireable<object>;
|
|
140
157
|
headType: PropTypes.Requireable<string>;
|
|
158
|
+
horizontalOverflow: PropTypes.Requireable<string>;
|
|
141
159
|
innerStyle: PropTypes.Requireable<object>;
|
|
142
160
|
onRequestToggleAllRows: PropTypes.Requireable<(...args: any[]) => any>;
|
|
143
161
|
onScroll: PropTypes.Requireable<(...args: any[]) => any>;
|
|
144
162
|
outerStyle: PropTypes.Requireable<object>;
|
|
163
|
+
pinnedColumns: PropTypes.Requireable<object>;
|
|
145
164
|
primaryColumnIndex: PropTypes.Requireable<number>;
|
|
146
165
|
rowExpansion: PropTypes.Requireable<string>;
|
|
147
166
|
rowSelection: PropTypes.Requireable<string>;
|
|
@@ -162,4 +181,4 @@ declare namespace Table {
|
|
|
162
181
|
}
|
|
163
182
|
export default Table;
|
|
164
183
|
export { Body, Caption, Cell, Head, HeadCell, HeadDropdownCell, Row };
|
|
165
|
-
export type { CellClickHandler, HeadCellSortHandler, HeadDropdownCellPossibleCloseReason, HeadDropdownCellRequestCloseHandler, HeadDropdownCellRequestOpenHandler, RowActionPrimaryClickHandler, RowActionSecondaryClickHandler, RowClickHandler, RowRequestToggleHandler, TableRequestMoveColumnHandler, TableRequestMoveRowHandler, TableRequestResizeColumnHandler, };
|
|
184
|
+
export type { CellClickHandler, HeadCellSortHandler, HeadDropdownCellPossibleCloseReason, HeadDropdownCellRequestCloseHandler, HeadDropdownCellRequestOpenHandler, RowActionPrimaryClickHandler, RowActionSecondaryClickHandler, RowClickHandler, RowRequestToggleHandler, TableRequestMoveColumnHandler, TableRequestMoveRowHandler, TableRequestResizeColumnHandler, PinnedColumnsProp, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @name Horizontal overflow scroll
|
|
4
|
+
* @description Table handles overflow by horizontally scrolling.
|
|
5
|
+
* Set `horizontalOverflow="scroll"` for `HeadCell` content to not truncate or `Cell` content to wrap for word breaks.
|
|
6
|
+
*/
|
|
7
|
+
declare function HorizontalOverflowScroll(): React.JSX.Element;
|
|
8
|
+
export default HorizontalOverflowScroll;
|
|
@@ -17,6 +17,7 @@ interface TransitionOpenPropsBase {
|
|
|
17
17
|
innerClassName?: string;
|
|
18
18
|
innerStyle?: React.CSSProperties;
|
|
19
19
|
onAnimationEnd?: () => void;
|
|
20
|
+
onAnimationStart?: () => void;
|
|
20
21
|
/** Whether the component is currently open or not. */
|
|
21
22
|
open?: boolean;
|
|
22
23
|
/** An additional className to outer container. */
|
|
@@ -38,7 +39,7 @@ interface TransitionOpenPropsBase {
|
|
|
38
39
|
takeFocus?: boolean;
|
|
39
40
|
}
|
|
40
41
|
type TransitionOpenProps = ComponentProps<TransitionOpenPropsBase, 'div'>;
|
|
41
|
-
declare function TransitionOpen({ animation, animateOnMount, children, className, elementRef, id, innerClassName, innerStyle, onAnimationEnd, open, outerClassName, outerId, outerStyle, renderChildrenWhenCollapsed, retainFocus, takeFocus: takeFocusProp, ...otherProps }: TransitionOpenProps): React.JSX.Element;
|
|
42
|
+
declare function TransitionOpen({ animation, animateOnMount, children, className, elementRef, id, innerClassName, innerStyle, onAnimationEnd, onAnimationStart, open, outerClassName, outerId, outerStyle, renderChildrenWhenCollapsed, retainFocus, takeFocus: takeFocusProp, ...otherProps }: TransitionOpenProps): React.JSX.Element;
|
|
42
43
|
declare namespace TransitionOpen {
|
|
43
44
|
var propTypes: {
|
|
44
45
|
animation: PropTypes.Requireable<string>;
|
|
@@ -50,6 +51,7 @@ declare namespace TransitionOpen {
|
|
|
50
51
|
innerClassName: PropTypes.Requireable<string>;
|
|
51
52
|
innerStyle: PropTypes.Requireable<object>;
|
|
52
53
|
onAnimationEnd: PropTypes.Requireable<(...args: any[]) => any>;
|
|
54
|
+
onAnimationStart: PropTypes.Requireable<(...args: any[]) => any>;
|
|
53
55
|
open: PropTypes.Requireable<boolean>;
|
|
54
56
|
outerClassName: PropTypes.Requireable<string>;
|
|
55
57
|
outerId: PropTypes.Requireable<string>;
|
|
@@ -6,8 +6,10 @@ type Dimensions = {
|
|
|
6
6
|
type ResizeHandler = (data: Dimensions) => void;
|
|
7
7
|
/**
|
|
8
8
|
* Watches a React ref element for changes in size.
|
|
9
|
+
* Uses useSyncExternalStore for better React 18 concurrent rendering support.
|
|
9
10
|
*
|
|
10
11
|
* @param ref - The React ref to observe size changes on
|
|
12
|
+
* @param onResize - Callback function that receives the new dimensions
|
|
11
13
|
*/
|
|
12
14
|
declare const useResizeObserver: (ref: React.MutableRefObject<HTMLElement | null>, onResize?: ResizeHandler) => Dimensions;
|
|
13
15
|
export default useResizeObserver;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
type RovingFocusOptions = {
|
|
2
|
+
enableLoop?: boolean;
|
|
3
|
+
orientation?: 'horizontal' | 'vertical';
|
|
4
|
+
enableTab?: boolean;
|
|
5
|
+
enableHomeEnd?: boolean;
|
|
6
|
+
};
|
|
1
7
|
/**
|
|
2
8
|
* This is a private hook not intended for use outside @splunk/react-ui
|
|
3
9
|
*
|
|
@@ -18,10 +24,11 @@
|
|
|
18
24
|
* </div>
|
|
19
25
|
* ```
|
|
20
26
|
*/
|
|
21
|
-
declare function useRovingFocus(): {
|
|
27
|
+
declare function useRovingFocus(options?: {}): {
|
|
22
28
|
ref: (element: HTMLDivElement | null) => void;
|
|
23
29
|
onBlur: (e: React.FocusEvent) => void;
|
|
24
30
|
onFocus: (e: React.FocusEvent) => void;
|
|
25
31
|
onKeyDown: (e: React.KeyboardEvent<HTMLDivElement>) => void;
|
|
26
32
|
};
|
|
27
33
|
export default useRovingFocus;
|
|
34
|
+
export type { RovingFocusOptions };
|
package/usePrevious.d.ts
ADDED
package/useResizeObserver.js
CHANGED
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
/******/ /* webpack/runtime/define property getters */
|
|
9
9
|
/******/ (() => {
|
|
10
10
|
/******/ // define getter functions for harmony exports
|
|
11
|
-
/******/ e.d = (
|
|
12
|
-
/******/ for (var n in
|
|
13
|
-
/******/ if (e.o(
|
|
14
|
-
/******/ Object.defineProperty(
|
|
11
|
+
/******/ e.d = (r, t) => {
|
|
12
|
+
/******/ for (var n in t) {
|
|
13
|
+
/******/ if (e.o(t, n) && !e.o(r, n)) {
|
|
14
|
+
/******/ Object.defineProperty(r, n, {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get:
|
|
16
|
+
get: t[n]
|
|
17
17
|
});
|
|
18
18
|
/******/ }
|
|
19
19
|
/******/ }
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
/******/
|
|
23
23
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
24
24
|
/******/ (() => {
|
|
25
|
-
/******/ e.o = (e,
|
|
25
|
+
/******/ e.o = (e, r) => Object.prototype.hasOwnProperty.call(e, r)
|
|
26
26
|
/******/;
|
|
27
27
|
})();
|
|
28
28
|
/******/
|
|
@@ -41,104 +41,71 @@
|
|
|
41
41
|
/******/ };
|
|
42
42
|
/******/ })();
|
|
43
43
|
/******/
|
|
44
|
-
/************************************************************************/ var
|
|
44
|
+
/************************************************************************/ var r = {};
|
|
45
45
|
// ESM COMPAT FLAG
|
|
46
|
-
e.r(
|
|
46
|
+
e.r(r);
|
|
47
47
|
// EXPORTS
|
|
48
|
-
e.d(
|
|
49
|
-
default: () => /* reexport */
|
|
48
|
+
e.d(r, {
|
|
49
|
+
default: () => /* reexport */ u
|
|
50
50
|
});
|
|
51
51
|
// CONCATENATED MODULE: external "react"
|
|
52
|
-
const
|
|
52
|
+
const t = require("react");
|
|
53
|
+
// CONCATENATED MODULE: external "use-sync-external-store/shim"
|
|
54
|
+
const n = require("use-sync-external-store/shim");
|
|
53
55
|
// CONCATENATED MODULE: ./src/useResizeObserver/useResizeObserver.ts
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
function o(e, t) {
|
|
61
|
-
if (e) {
|
|
62
|
-
if ("string" == typeof e) return u(e, t);
|
|
63
|
-
var r = {}.toString.call(e).slice(8, -1);
|
|
64
|
-
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? u(e, t) : void 0;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
function u(e, t) {
|
|
68
|
-
(null == t || t > e.length) && (t = e.length);
|
|
69
|
-
for (var r = 0, n = Array(t); r < t; r++) {
|
|
70
|
-
n[r] = e[r];
|
|
71
|
-
}
|
|
72
|
-
return n;
|
|
73
|
-
}
|
|
74
|
-
function l(e, t) {
|
|
75
|
-
var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
76
|
-
if (null != r) {
|
|
77
|
-
var n, i, o, u, l = [], a = !0, f = !1;
|
|
78
|
-
try {
|
|
79
|
-
if (o = (r = r.call(e)).next, 0 === t) {
|
|
80
|
-
if (Object(r) !== r) return;
|
|
81
|
-
a = !1;
|
|
82
|
-
} else for (;!(a = (n = o.call(r)).done) && (l.push(n.value), l.length !== t); a = !0) {
|
|
83
|
-
}
|
|
84
|
-
} catch (e) {
|
|
85
|
-
f = !0, i = e;
|
|
86
|
-
} finally {
|
|
87
|
-
try {
|
|
88
|
-
if (!a && null != r["return"] && (u = r["return"](), Object(u) !== u)) return;
|
|
89
|
-
} finally {
|
|
90
|
-
if (f) throw i;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return l;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
function a(e) {
|
|
97
|
-
if (Array.isArray(e)) return e;
|
|
98
|
-
}
|
|
56
|
+
// This shim is here for React 16 support
|
|
57
|
+
// Cache the server snapshot to avoid creating new objects on every render
|
|
58
|
+
var i = {
|
|
59
|
+
width: 0,
|
|
60
|
+
height: 0
|
|
61
|
+
};
|
|
99
62
|
/**
|
|
100
63
|
* Watches a React ref element for changes in size.
|
|
64
|
+
* Uses useSyncExternalStore for better React 18 concurrent rendering support.
|
|
101
65
|
*
|
|
102
66
|
* @param ref - The React ref to observe size changes on
|
|
103
|
-
|
|
104
|
-
|
|
67
|
+
* @param onResize - Callback function that receives the new dimensions
|
|
68
|
+
*/ var o = function e(r, o) {
|
|
69
|
+
var u = (0, t.useRef)({
|
|
105
70
|
width: 0,
|
|
106
71
|
height: 0
|
|
107
|
-
})
|
|
108
|
-
(0,
|
|
109
|
-
var
|
|
110
|
-
if (typeof window
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (e.height !== o.height || e.width !== o.width) {
|
|
120
|
-
i === null || i === void 0 ? void 0 : i(o);
|
|
121
|
-
return o;
|
|
122
|
-
}
|
|
123
|
-
return e;
|
|
124
|
-
}));
|
|
125
|
-
}
|
|
126
|
-
}));
|
|
127
|
-
if (e) {
|
|
128
|
-
r.observe(e);
|
|
129
|
-
}
|
|
130
|
-
return function() {
|
|
131
|
-
if (e) {
|
|
132
|
-
r.unobserve(e);
|
|
133
|
-
}
|
|
72
|
+
});
|
|
73
|
+
var d = (0, t.useCallback)((function(e) {
|
|
74
|
+
var t = r.current;
|
|
75
|
+
if (!t || typeof window === "undefined" || !window.ResizeObserver) {
|
|
76
|
+
return function() {};
|
|
77
|
+
// No-op if not in browser or no ResizeObserver support
|
|
78
|
+
}
|
|
79
|
+
var n = function t() {
|
|
80
|
+
var n, i;
|
|
81
|
+
var d = {
|
|
82
|
+
width: (r === null || r === void 0 ? void 0 : (n = r.current) === null || n === void 0 ? void 0 : n.getBoundingClientRect().width) || 0,
|
|
83
|
+
height: (r === null || r === void 0 ? void 0 : (i = r.current) === null || i === void 0 ? void 0 : i.getBoundingClientRect().height) || 0
|
|
134
84
|
};
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
85
|
+
if (u.current.width !== d.width || u.current.height !== d.height) {
|
|
86
|
+
u.current = d;
|
|
87
|
+
o === null || o === void 0 ? void 0 : o(d);
|
|
88
|
+
e();
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
var i = new ResizeObserver(n);
|
|
92
|
+
i.observe(t);
|
|
93
|
+
// Initial measurement
|
|
94
|
+
n();
|
|
95
|
+
return function() {
|
|
96
|
+
i.disconnect();
|
|
97
|
+
};
|
|
98
|
+
}), [ r, o ]);
|
|
99
|
+
// Use useSyncExternalStore to handle the subscription to ensure proper synchronization with
|
|
100
|
+
// Reacts concurrent rendering, it handles cases where the resize event might be interrupted
|
|
101
|
+
// or batched with other updates
|
|
102
|
+
return (0, n.useSyncExternalStore)(d, (function() {
|
|
103
|
+
return u.current;
|
|
104
|
+
}), (function() {
|
|
105
|
+
return i;
|
|
106
|
+
}));
|
|
140
107
|
};
|
|
141
|
-
/* harmony default export */ const
|
|
108
|
+
/* harmony default export */ const u = o;
|
|
142
109
|
// CONCATENATED MODULE: ./src/useResizeObserver/index.ts
|
|
143
|
-
module.exports =
|
|
110
|
+
module.exports = r;
|
|
144
111
|
/******/})();
|