@carbon/react 1.56.0 → 1.57.0-rc.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/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +912 -953
- package/es/components/ContainedList/ContainedList.d.ts +41 -0
- package/es/components/ContainedList/ContainedList.js +18 -4
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +35 -0
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +5 -3
- package/es/components/DataTable/TableToolbarSearch.js +1 -1
- package/es/components/OverflowMenu/OverflowMenu.d.ts +300 -0
- package/es/components/OverflowMenu/OverflowMenu.js +22 -14
- package/es/components/OverflowMenu/next/index.d.ts +39 -0
- package/es/components/OverflowMenu/next/index.js +4 -3
- package/es/components/RadioTile/RadioTile.d.ts +4 -0
- package/es/components/RadioTile/RadioTile.js +7 -1
- package/es/components/Slider/Slider.js +3 -3
- package/es/components/StructuredList/StructuredList.js +6 -2
- package/es/components/TileGroup/TileGroup.d.ts +8 -0
- package/es/components/TileGroup/TileGroup.js +7 -1
- package/es/index.js +1 -1
- package/es/internal/Selection.js +4 -1
- package/lib/components/ContainedList/ContainedList.d.ts +41 -0
- package/lib/components/ContainedList/ContainedList.js +18 -4
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +35 -0
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +5 -3
- package/lib/components/DataTable/TableToolbarSearch.js +1 -1
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +300 -0
- package/lib/components/OverflowMenu/OverflowMenu.js +21 -13
- package/lib/components/OverflowMenu/next/index.d.ts +39 -0
- package/lib/components/OverflowMenu/next/index.js +4 -3
- package/lib/components/RadioTile/RadioTile.d.ts +4 -0
- package/lib/components/RadioTile/RadioTile.js +7 -1
- package/lib/components/Slider/Slider.js +3 -3
- package/lib/components/StructuredList/StructuredList.js +6 -2
- package/lib/components/TileGroup/TileGroup.d.ts +8 -0
- package/lib/components/TileGroup/TileGroup.js +7 -1
- package/lib/index.js +2 -2
- package/lib/internal/Selection.js +4 -1
- package/package.json +8 -8
- package/telemetry.yml +1 -1
|
@@ -511,7 +511,7 @@ class Slider extends PureComponent {
|
|
|
511
511
|
if (clientX) {
|
|
512
512
|
const leftOffset = this.state.isRtl ? (boundingRect?.right ?? 0) - clientX : clientX - (boundingRect?.left ?? 0);
|
|
513
513
|
return leftOffset / width;
|
|
514
|
-
} else if (value && range) {
|
|
514
|
+
} else if (value !== null && value !== undefined && range) {
|
|
515
515
|
// Prevent NaN calculation if the range is 0.
|
|
516
516
|
return range === 0 ? 0 : (value - this.props.min) / range;
|
|
517
517
|
}
|
|
@@ -1093,7 +1093,7 @@ class Slider extends PureComponent {
|
|
|
1093
1093
|
hasTooltip: hideTextInput,
|
|
1094
1094
|
className: lowerThumbWrapperClasses,
|
|
1095
1095
|
label: `${value}`,
|
|
1096
|
-
align:
|
|
1096
|
+
align: "top"
|
|
1097
1097
|
}, lowerThumbWrapperProps), /*#__PURE__*/React__default.createElement("div", {
|
|
1098
1098
|
className: lowerThumbClasses,
|
|
1099
1099
|
role: "slider",
|
|
@@ -1112,7 +1112,7 @@ class Slider extends PureComponent {
|
|
|
1112
1112
|
hasTooltip: hideTextInput,
|
|
1113
1113
|
className: upperThumbWrapperClasses,
|
|
1114
1114
|
label: `${valueUpper}`,
|
|
1115
|
-
align: "top
|
|
1115
|
+
align: "top"
|
|
1116
1116
|
}, upperThumbWrapperProps), /*#__PURE__*/React__default.createElement("div", {
|
|
1117
1117
|
className: upperThumbClasses,
|
|
1118
1118
|
role: "slider",
|
|
@@ -17,7 +17,7 @@ import { RadioButtonChecked, RadioButton } from '@carbon/icons-react';
|
|
|
17
17
|
import { useOutsideClick } from '../../internal/useOutsideClick.js';
|
|
18
18
|
import { Text } from '../Text/Text.js';
|
|
19
19
|
|
|
20
|
-
var _StructuredListCell
|
|
20
|
+
var _StructuredListCell;
|
|
21
21
|
const GridSelectedRowStateContext = /*#__PURE__*/React__default.createContext(null);
|
|
22
22
|
const GridSelectedRowDispatchContext = /*#__PURE__*/React__default.createContext(null);
|
|
23
23
|
function StructuredListWrapper(props) {
|
|
@@ -192,7 +192,11 @@ function StructuredListRow(props) {
|
|
|
192
192
|
onKeyDown: onKeyDown
|
|
193
193
|
}), /*#__PURE__*/React__default.createElement(GridRowContext.Provider, {
|
|
194
194
|
value: value
|
|
195
|
-
}, selection && /*#__PURE__*/React__default.createElement(StructuredListCell, null, selectedRow === id ?
|
|
195
|
+
}, selection && /*#__PURE__*/React__default.createElement(StructuredListCell, null, selectedRow === id ? /*#__PURE__*/React__default.createElement(RadioButtonChecked, {
|
|
196
|
+
className: `${prefix}--structured-list__icon`
|
|
197
|
+
}) : /*#__PURE__*/React__default.createElement(RadioButton, {
|
|
198
|
+
className: `${prefix}--structured-list__icon`
|
|
199
|
+
})), children));
|
|
196
200
|
}
|
|
197
201
|
StructuredListRow.propTypes = {
|
|
198
202
|
/**
|
|
@@ -40,6 +40,10 @@ export interface TileGroupProps extends Omit<ReactAttr<HTMLFieldSetElement>, Exc
|
|
|
40
40
|
* Specify the value that is currently selected in the group
|
|
41
41
|
*/
|
|
42
42
|
valueSelected?: string | number;
|
|
43
|
+
/**
|
|
44
|
+
* `true` to specify if input selection in group is required.
|
|
45
|
+
*/
|
|
46
|
+
required?: boolean;
|
|
43
47
|
}
|
|
44
48
|
declare const TileGroup: {
|
|
45
49
|
(props: any): import("react/jsx-runtime").JSX.Element;
|
|
@@ -73,6 +77,10 @@ declare const TileGroup: {
|
|
|
73
77
|
* the group changes
|
|
74
78
|
*/
|
|
75
79
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
80
|
+
/**
|
|
81
|
+
* `true` to specify if input selection in group is required.
|
|
82
|
+
*/
|
|
83
|
+
required: PropTypes.Requireable<boolean>;
|
|
76
84
|
/**
|
|
77
85
|
* Specify the value that is currently selected in the group
|
|
78
86
|
*/
|
|
@@ -21,7 +21,8 @@ const TileGroup = props => {
|
|
|
21
21
|
legend,
|
|
22
22
|
name,
|
|
23
23
|
onChange = noopFn,
|
|
24
|
-
valueSelected
|
|
24
|
+
valueSelected,
|
|
25
|
+
required
|
|
25
26
|
} = props;
|
|
26
27
|
const prefix = usePrefix();
|
|
27
28
|
const [selected, setSelected] = useState(valueSelected ?? defaultSelected);
|
|
@@ -45,6 +46,7 @@ const TileGroup = props => {
|
|
|
45
46
|
...otherProps
|
|
46
47
|
} = child.props;
|
|
47
48
|
return /*#__PURE__*/React__default.createElement(RadioTile, _extends({}, otherProps, {
|
|
49
|
+
required: required,
|
|
48
50
|
name: name,
|
|
49
51
|
key: value,
|
|
50
52
|
value: value,
|
|
@@ -113,6 +115,10 @@ TileGroup.propTypes = {
|
|
|
113
115
|
* the group changes
|
|
114
116
|
*/
|
|
115
117
|
onChange: PropTypes.func,
|
|
118
|
+
/**
|
|
119
|
+
* `true` to specify if input selection in group is required.
|
|
120
|
+
*/
|
|
121
|
+
required: PropTypes.bool,
|
|
116
122
|
/**
|
|
117
123
|
* Specify the value that is currently selected in the group
|
|
118
124
|
*/
|
package/es/index.js
CHANGED
|
@@ -179,7 +179,6 @@ export { default as unstable_PageSelector } from './components/Pagination/experi
|
|
|
179
179
|
export { default as unstable_Pagination } from './components/Pagination/experimental/Pagination.js';
|
|
180
180
|
export { default as CheckboxGroup } from './components/CheckboxGroup/CheckboxGroup.js';
|
|
181
181
|
export { default as ContainedListItem } from './components/ContainedList/ContainedListItem/ContainedListItem.js';
|
|
182
|
-
export { default as ContainedList } from './components/ContainedList/ContainedList.js';
|
|
183
182
|
export { default as useContextMenu } from './components/ContextMenu/useContextMenu.js';
|
|
184
183
|
export { default as SliderSkeleton } from './components/Slider/Slider.Skeleton.js';
|
|
185
184
|
export { default as TextInputSkeleton } from './components/TextInput/TextInput.Skeleton.js';
|
|
@@ -204,6 +203,7 @@ export { default as unstable__ChatButton } from './components/ChatButton/ChatBut
|
|
|
204
203
|
export { default as unstable__ChatButtonSkeleton } from './components/ChatButton/ChatButton.Skeleton.js';
|
|
205
204
|
export { Text as unstable_Text } from './components/Text/Text.js';
|
|
206
205
|
export { TextDirection as unstable_TextDirection } from './components/Text/TextDirection.js';
|
|
206
|
+
export { default as ContainedList } from './components/ContainedList/ContainedList.js';
|
|
207
207
|
export { default as DataTable } from './components/DataTable/DataTable.js';
|
|
208
208
|
export { Table } from './components/DataTable/Table.js';
|
|
209
209
|
export { default as TableActionList } from './components/DataTable/TableActionList.js';
|
package/es/internal/Selection.js
CHANGED
|
@@ -40,6 +40,9 @@ function useSelection(_ref2) {
|
|
|
40
40
|
const [uncontrolledItems, setUncontrolledItems] = useState(initialSelectedItems);
|
|
41
41
|
const isControlled = !!controlledItems;
|
|
42
42
|
const [selectedItems, setSelectedItems] = useState(isControlled ? controlledItems : uncontrolledItems);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
setSelectedItems(isControlled ? controlledItems : uncontrolledItems);
|
|
45
|
+
}, [isControlled, controlledItems, uncontrolledItems]);
|
|
43
46
|
useEffect(() => {
|
|
44
47
|
callOnChangeHandler({
|
|
45
48
|
isControlled,
|
|
@@ -74,7 +77,7 @@ function useSelection(_ref2) {
|
|
|
74
77
|
isMounted: isMounted.current,
|
|
75
78
|
onChangeHandlerControlled: savedOnChange.current,
|
|
76
79
|
onChangeHandlerUncontrolled: setUncontrolledItems,
|
|
77
|
-
selectedItems:
|
|
80
|
+
selectedItems: []
|
|
78
81
|
});
|
|
79
82
|
}, [disabled, isControlled]);
|
|
80
83
|
useEffect(() => {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2022
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React, { ReactNode } from 'react';
|
|
8
|
+
declare const variants: readonly ["on-page", "disclosed"];
|
|
9
|
+
type Variants = (typeof variants)[number];
|
|
10
|
+
interface ContainedListProps {
|
|
11
|
+
/**
|
|
12
|
+
* A slot for a possible interactive element to render.
|
|
13
|
+
*/
|
|
14
|
+
action?: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* A collection of ContainedListItems to be rendered in the ContainedList
|
|
17
|
+
*/
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Additional CSS class names.
|
|
21
|
+
*/
|
|
22
|
+
className?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Specify whether the dividing lines in between list items should be inset.
|
|
25
|
+
*/
|
|
26
|
+
isInset?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The kind of ContainedList you want to display
|
|
29
|
+
*/
|
|
30
|
+
kind?: Variants;
|
|
31
|
+
/**
|
|
32
|
+
* A label describing the contained list.
|
|
33
|
+
*/
|
|
34
|
+
label: string | ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* Specify the size of the contained list.
|
|
37
|
+
*/
|
|
38
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
39
|
+
}
|
|
40
|
+
declare const ContainedList: React.FC<ContainedListProps>;
|
|
41
|
+
export default ContainedList;
|
|
@@ -47,7 +47,7 @@ function renderChildren(children) {
|
|
|
47
47
|
}
|
|
48
48
|
return children;
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
const ContainedList = _ref => {
|
|
51
51
|
let {
|
|
52
52
|
action,
|
|
53
53
|
children,
|
|
@@ -67,7 +67,20 @@ function ContainedList(_ref) {
|
|
|
67
67
|
[`${prefix}--layout--size-${size}`]: size
|
|
68
68
|
}, `${prefix}--contained-list--${kind}`, className);
|
|
69
69
|
const filteredChildren = filterChildren(children);
|
|
70
|
-
|
|
70
|
+
function isSearchAction(action) {
|
|
71
|
+
if (! /*#__PURE__*/React__default["default"].isValidElement(action)) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
const actionTypes = ['Search', 'ExpandableSearch'];
|
|
75
|
+
let actionType = '';
|
|
76
|
+
if (typeof action.type === 'string') {
|
|
77
|
+
actionType = action.type;
|
|
78
|
+
} else {
|
|
79
|
+
actionType = action.type.displayName || '';
|
|
80
|
+
}
|
|
81
|
+
return actionTypes.includes(actionType);
|
|
82
|
+
}
|
|
83
|
+
const isActionSearch = isSearchAction(action);
|
|
71
84
|
const renderedChildren = renderChildren(children);
|
|
72
85
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
73
86
|
className: classes
|
|
@@ -96,7 +109,7 @@ function ContainedList(_ref) {
|
|
|
96
109
|
role: "list",
|
|
97
110
|
"aria-labelledby": labelId
|
|
98
111
|
}, isActionSearch ? filteredChildren : renderedChildren));
|
|
99
|
-
}
|
|
112
|
+
};
|
|
100
113
|
ContainedList.propTypes = {
|
|
101
114
|
/**
|
|
102
115
|
* A slot for a possible interactive element to render.
|
|
@@ -127,5 +140,6 @@ ContainedList.propTypes = {
|
|
|
127
140
|
*/
|
|
128
141
|
size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg', 'xl'])
|
|
129
142
|
};
|
|
143
|
+
var ContainedList$1 = ContainedList;
|
|
130
144
|
|
|
131
|
-
exports["default"] = ContainedList;
|
|
145
|
+
exports["default"] = ContainedList$1;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2022
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React, { type ComponentType, type FunctionComponent, ReactNode } from 'react';
|
|
8
|
+
interface ContainedListItemProps {
|
|
9
|
+
/**
|
|
10
|
+
* A slot for a possible interactive element to render within the item.
|
|
11
|
+
*/
|
|
12
|
+
action?: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* The content of this item. Must not contain any interactive elements. Use props.action to include those.
|
|
15
|
+
*/
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Additional CSS class names.
|
|
19
|
+
*/
|
|
20
|
+
className?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Whether this item is disabled.
|
|
23
|
+
*/
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Provide an optional function to be called when the item is clicked.
|
|
27
|
+
*/
|
|
28
|
+
onClick?: () => void;
|
|
29
|
+
/**
|
|
30
|
+
* Provide an optional icon to render in front of the item's content.
|
|
31
|
+
*/
|
|
32
|
+
renderIcon?: ComponentType | FunctionComponent;
|
|
33
|
+
}
|
|
34
|
+
declare const ContainedListItem: React.FC<ContainedListItemProps>;
|
|
35
|
+
export default ContainedListItem;
|
|
@@ -22,7 +22,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
22
22
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
23
23
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
const ContainedListItem = _ref => {
|
|
26
26
|
let {
|
|
27
27
|
action,
|
|
28
28
|
children,
|
|
@@ -58,7 +58,7 @@ function ContainedListItem(_ref) {
|
|
|
58
58
|
},
|
|
59
59
|
className: `${prefix}--contained-list-item__action`
|
|
60
60
|
}, action));
|
|
61
|
-
}
|
|
61
|
+
};
|
|
62
62
|
ContainedListItem.propTypes = {
|
|
63
63
|
/**
|
|
64
64
|
* A slot for a possible interactive element to render within the item.
|
|
@@ -83,7 +83,9 @@ ContainedListItem.propTypes = {
|
|
|
83
83
|
/**
|
|
84
84
|
* Provide an optional icon to render in front of the item's content.
|
|
85
85
|
*/
|
|
86
|
+
// @ts-expect-error: PropTypes are not expressive enough to cover this case
|
|
86
87
|
renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object])
|
|
87
88
|
};
|
|
89
|
+
var ContainedListItem$1 = ContainedListItem;
|
|
88
90
|
|
|
89
|
-
exports["default"] = ContainedListItem;
|
|
91
|
+
exports["default"] = ContainedListItem$1;
|
|
@@ -108,7 +108,7 @@ const TableToolbarSearch = _ref => {
|
|
|
108
108
|
disabled: disabled,
|
|
109
109
|
className: searchClasses,
|
|
110
110
|
value: value,
|
|
111
|
-
id: typeof id !== 'undefined' ? id : uniqueId.toString()
|
|
111
|
+
id: typeof id !== 'undefined' ? id : `table-toolbar-search-${uniqueId.toString()}`,
|
|
112
112
|
labelText: labelText || t('carbon.table.toolbar.search.label'),
|
|
113
113
|
placeholder: placeholder || t('carbon.table.toolbar.search.placeholder'),
|
|
114
114
|
onChange: onChange,
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
/**
|
|
10
|
+
* @param {Element} menuBody The menu body with the menu arrow.
|
|
11
|
+
* @param {string} direction The floating menu direction.
|
|
12
|
+
* @returns {FloatingMenu~offset} The adjustment of the floating menu position, upon the position of the menu arrow.
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
export declare const getMenuOffset: (menuBody: any, direction: any, trigger: any, flip: any) => {
|
|
16
|
+
left: number;
|
|
17
|
+
top: number;
|
|
18
|
+
} | undefined;
|
|
19
|
+
interface Offset {
|
|
20
|
+
top: number;
|
|
21
|
+
left: number;
|
|
22
|
+
}
|
|
23
|
+
interface OverflowMenuProps {
|
|
24
|
+
/**
|
|
25
|
+
* Specify a label to be read by screen readers on the container node
|
|
26
|
+
*/
|
|
27
|
+
['aria-label']: string;
|
|
28
|
+
/**
|
|
29
|
+
* Deprecated, please use `aria-label` instead.
|
|
30
|
+
* Specify a label to be read by screen readers on the container note.
|
|
31
|
+
* @deprecated
|
|
32
|
+
* */
|
|
33
|
+
ariaLabel: string;
|
|
34
|
+
/**
|
|
35
|
+
* The child nodes.
|
|
36
|
+
* */
|
|
37
|
+
children: React.ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* The CSS class names.
|
|
40
|
+
* */
|
|
41
|
+
className?: string;
|
|
42
|
+
/**
|
|
43
|
+
* The menu direction.
|
|
44
|
+
*/
|
|
45
|
+
direction?: string;
|
|
46
|
+
/**
|
|
47
|
+
* `true` if the menu alignment should be flipped.
|
|
48
|
+
*/
|
|
49
|
+
flipped?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Enable or disable focus trap behavior
|
|
52
|
+
*/
|
|
53
|
+
focusTrap?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* The CSS class for the icon.
|
|
56
|
+
*/
|
|
57
|
+
iconClass?: string;
|
|
58
|
+
/**
|
|
59
|
+
* The element ID.
|
|
60
|
+
*/
|
|
61
|
+
id?: string;
|
|
62
|
+
/**
|
|
63
|
+
* The icon description.
|
|
64
|
+
*/
|
|
65
|
+
iconDescription?: string;
|
|
66
|
+
/**
|
|
67
|
+
* `true` to use the light version. For use on $ui-01 backgrounds only.
|
|
68
|
+
* Don't use this to make OverflowMenu background color same as container background color.
|
|
69
|
+
*/
|
|
70
|
+
light?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* The adjustment in position applied to the floating menu.
|
|
73
|
+
*/
|
|
74
|
+
menuOffset?: Offset | (() => void);
|
|
75
|
+
/**
|
|
76
|
+
* The adjustment in position applied to the floating menu.
|
|
77
|
+
*/
|
|
78
|
+
menuOffsetFlip?: Offset | (() => void);
|
|
79
|
+
/**
|
|
80
|
+
* The class to apply to the menu options
|
|
81
|
+
*/
|
|
82
|
+
menuOptionsClass?: string;
|
|
83
|
+
/**
|
|
84
|
+
* The event handler for the `click` event.
|
|
85
|
+
*/
|
|
86
|
+
onClick?: (evt?: any) => void;
|
|
87
|
+
/**
|
|
88
|
+
* Function called when menu is closed
|
|
89
|
+
*/
|
|
90
|
+
onClose?: () => void;
|
|
91
|
+
/**
|
|
92
|
+
* Function called when menu is opened
|
|
93
|
+
*/
|
|
94
|
+
onOpen?: () => void;
|
|
95
|
+
/**
|
|
96
|
+
* `true` if the menu should be open.
|
|
97
|
+
*/
|
|
98
|
+
open?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Function called to override icon rendering.
|
|
101
|
+
*/
|
|
102
|
+
renderIcon?: React.ElementType;
|
|
103
|
+
/**
|
|
104
|
+
* Specify a CSS selector that matches the DOM element that should
|
|
105
|
+
* be focused when the OverflowMenu opens
|
|
106
|
+
*/
|
|
107
|
+
selectorPrimaryFocus?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Specify the size of the OverflowMenu. Currently supports either `sm`, 'md' (default) or 'lg` as an option.
|
|
110
|
+
*/
|
|
111
|
+
size?: 'sm' | 'md' | 'lg';
|
|
112
|
+
/**
|
|
113
|
+
* The ref to the HTML element that should receive focus when the OverflowMenu opens
|
|
114
|
+
*/
|
|
115
|
+
innerRef?: React.Ref<any>;
|
|
116
|
+
}
|
|
117
|
+
interface OverflowMenuState {
|
|
118
|
+
open: boolean;
|
|
119
|
+
prevOpen?: boolean;
|
|
120
|
+
hasMountedTrigger: boolean;
|
|
121
|
+
click: boolean;
|
|
122
|
+
}
|
|
123
|
+
interface ReleaseHandle {
|
|
124
|
+
release: () => null;
|
|
125
|
+
}
|
|
126
|
+
declare class OverflowMenu extends React.Component<OverflowMenuProps, OverflowMenuState> {
|
|
127
|
+
state: OverflowMenuState;
|
|
128
|
+
instanceId: number;
|
|
129
|
+
static propTypes: {
|
|
130
|
+
/**
|
|
131
|
+
* Specify a label to be read by screen readers on the container node
|
|
132
|
+
*/
|
|
133
|
+
"aria-label": PropTypes.Requireable<string>;
|
|
134
|
+
/**
|
|
135
|
+
* Deprecated, please use `aria-label` instead.
|
|
136
|
+
* Specify a label to be read by screen readers on the container note.
|
|
137
|
+
*/
|
|
138
|
+
ariaLabel: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
139
|
+
/**
|
|
140
|
+
* The child nodes.
|
|
141
|
+
*/
|
|
142
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
143
|
+
/**
|
|
144
|
+
* The CSS class names.
|
|
145
|
+
*/
|
|
146
|
+
className: PropTypes.Requireable<string>;
|
|
147
|
+
/**
|
|
148
|
+
* The menu direction.
|
|
149
|
+
*/
|
|
150
|
+
direction: PropTypes.Requireable<string>;
|
|
151
|
+
/**
|
|
152
|
+
* `true` if the menu alignment should be flipped.
|
|
153
|
+
*/
|
|
154
|
+
flipped: PropTypes.Requireable<boolean>;
|
|
155
|
+
/**
|
|
156
|
+
* Enable or disable focus trap behavior
|
|
157
|
+
*/
|
|
158
|
+
focusTrap: PropTypes.Requireable<boolean>;
|
|
159
|
+
/**
|
|
160
|
+
* The CSS class for the icon.
|
|
161
|
+
*/
|
|
162
|
+
iconClass: PropTypes.Requireable<string>;
|
|
163
|
+
/**
|
|
164
|
+
* The icon description.
|
|
165
|
+
*/
|
|
166
|
+
iconDescription: PropTypes.Requireable<string>;
|
|
167
|
+
/**
|
|
168
|
+
* The element ID.
|
|
169
|
+
*/
|
|
170
|
+
id: PropTypes.Requireable<string>;
|
|
171
|
+
/**
|
|
172
|
+
* `true` to use the light version. For use on $ui-01 backgrounds only.
|
|
173
|
+
* Don't use this to make OverflowMenu background color same as container background color.
|
|
174
|
+
*/
|
|
175
|
+
light: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
176
|
+
/**
|
|
177
|
+
* The adjustment in position applied to the floating menu.
|
|
178
|
+
*/
|
|
179
|
+
menuOffset: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | PropTypes.InferProps<{
|
|
180
|
+
top: PropTypes.Requireable<number>;
|
|
181
|
+
left: PropTypes.Requireable<number>;
|
|
182
|
+
}> | null | undefined>>;
|
|
183
|
+
/**
|
|
184
|
+
* The adjustment in position applied to the floating menu.
|
|
185
|
+
*/
|
|
186
|
+
menuOffsetFlip: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | PropTypes.InferProps<{
|
|
187
|
+
top: PropTypes.Requireable<number>;
|
|
188
|
+
left: PropTypes.Requireable<number>;
|
|
189
|
+
}> | null | undefined>>;
|
|
190
|
+
/**
|
|
191
|
+
* The class to apply to the menu options
|
|
192
|
+
*/
|
|
193
|
+
menuOptionsClass: PropTypes.Requireable<string>;
|
|
194
|
+
/**
|
|
195
|
+
* The event handler for the `click` event.
|
|
196
|
+
*/
|
|
197
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
198
|
+
/**
|
|
199
|
+
* Function called when menu is closed
|
|
200
|
+
*/
|
|
201
|
+
onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
202
|
+
/**
|
|
203
|
+
* The event handler for the `focus` event.
|
|
204
|
+
*/
|
|
205
|
+
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
206
|
+
/**
|
|
207
|
+
* The event handler for the `keydown` event.
|
|
208
|
+
*/
|
|
209
|
+
onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
210
|
+
/**
|
|
211
|
+
* Function called when menu is opened
|
|
212
|
+
*/
|
|
213
|
+
onOpen: PropTypes.Requireable<(...args: any[]) => any>;
|
|
214
|
+
/**
|
|
215
|
+
* `true` if the menu should be open.
|
|
216
|
+
*/
|
|
217
|
+
open: PropTypes.Requireable<boolean>;
|
|
218
|
+
/**
|
|
219
|
+
* Function called to override icon rendering.
|
|
220
|
+
*/
|
|
221
|
+
renderIcon: PropTypes.Requireable<object>;
|
|
222
|
+
/**
|
|
223
|
+
* Specify a CSS selector that matches the DOM element that should
|
|
224
|
+
* be focused when the OverflowMenu opens
|
|
225
|
+
*/
|
|
226
|
+
selectorPrimaryFocus: PropTypes.Requireable<string>;
|
|
227
|
+
/**
|
|
228
|
+
* Specify the size of the OverflowMenu. Currently supports either `sm`, 'md' (default) or 'lg` as an option.
|
|
229
|
+
*/
|
|
230
|
+
size: PropTypes.Requireable<string>;
|
|
231
|
+
};
|
|
232
|
+
static contextType: React.Context<string>;
|
|
233
|
+
/**
|
|
234
|
+
* The handle of `onfocusin` or `focus` event handler.
|
|
235
|
+
* @private
|
|
236
|
+
*/
|
|
237
|
+
_hFocusIn: ReleaseHandle | null;
|
|
238
|
+
/**
|
|
239
|
+
* The timeout handle for handling `blur` event.
|
|
240
|
+
* @private
|
|
241
|
+
*/
|
|
242
|
+
_hBlurTimeout: any;
|
|
243
|
+
/**
|
|
244
|
+
* The element ref of the tooltip's trigger button.
|
|
245
|
+
* @type {React.RefObject<Element>}
|
|
246
|
+
* @private
|
|
247
|
+
*/
|
|
248
|
+
_triggerRef: React.RefObject<unknown>;
|
|
249
|
+
componentDidUpdate(_: any, prevState: any): void;
|
|
250
|
+
componentDidMount(): void;
|
|
251
|
+
static getDerivedStateFromProps({ open }: {
|
|
252
|
+
open: any;
|
|
253
|
+
}, state: any): {
|
|
254
|
+
open: any;
|
|
255
|
+
prevOpen: any;
|
|
256
|
+
} | null;
|
|
257
|
+
componentWillUnmount(): void;
|
|
258
|
+
handleClick: (evt: any) => void;
|
|
259
|
+
closeMenuAndFocus: () => void;
|
|
260
|
+
closeMenuOnEscape: () => void;
|
|
261
|
+
handleKeyPress: (evt: any) => void;
|
|
262
|
+
handleClickOutside: (evt: any) => void;
|
|
263
|
+
closeMenu: (onCloseMenu?: any) => void;
|
|
264
|
+
focusMenuEl: () => void;
|
|
265
|
+
/**
|
|
266
|
+
* Focuses the next enabled overflow menu item given the currently focused
|
|
267
|
+
* item index and direction to move
|
|
268
|
+
* @param {object} params
|
|
269
|
+
* @param {number} params.currentIndex - the index of the currently focused
|
|
270
|
+
* overflow menu item in the list of overflow menu items
|
|
271
|
+
* @param {number} params.direction - number denoting the direction to move
|
|
272
|
+
* focus (1 for forwards, -1 for backwards)
|
|
273
|
+
*/
|
|
274
|
+
handleOverflowMenuItemFocus: ({ currentIndex, direction }: {
|
|
275
|
+
currentIndex: any;
|
|
276
|
+
direction: any;
|
|
277
|
+
}) => void;
|
|
278
|
+
/**
|
|
279
|
+
* Handles the floating menu being unmounted or non-floating menu being
|
|
280
|
+
* mounted or unmounted.
|
|
281
|
+
* @param {Element} menuBody The DOM element of the menu body.
|
|
282
|
+
* @private
|
|
283
|
+
*/
|
|
284
|
+
_menuBody: HTMLElement | null;
|
|
285
|
+
_bindMenuBody: (menuBody: HTMLElement | null) => void;
|
|
286
|
+
/**
|
|
287
|
+
* Handles the floating menu being placed.
|
|
288
|
+
* @param {Element} menuBody The DOM element of the menu body.
|
|
289
|
+
* @private
|
|
290
|
+
*/
|
|
291
|
+
_handlePlace: (menuBody: any) => void;
|
|
292
|
+
/**
|
|
293
|
+
* @returns {Element} The DOM element where the floating menu is placed in.
|
|
294
|
+
*/
|
|
295
|
+
_getTarget: () => Element;
|
|
296
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
297
|
+
}
|
|
298
|
+
export { OverflowMenu };
|
|
299
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
300
|
+
export default _default;
|