@carbon/react 1.78.2 → 1.79.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 +882 -882
- package/es/components/Accordion/AccordionItem.js +2 -2
- package/es/components/Button/Button.d.ts +2 -3
- package/es/components/Button/Button.js +29 -19
- package/es/components/Button/ButtonBase.js +3 -1
- package/es/components/ChatButton/ChatButton.d.ts +2 -3
- package/es/components/ChatButton/ChatButton.js +1 -2
- package/es/components/ComboBox/ComboBox.js +34 -24
- package/es/components/ComposedModal/ComposedModal.js +65 -51
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +2 -2
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +1 -1
- package/es/components/ContentSwitcher/ContentSwitcher.js +3 -3
- package/es/components/DataTable/TableBatchAction.d.ts +3 -3
- package/es/components/DataTable/TableBatchAction.js +1 -1
- package/es/components/DataTable/TableContainer.d.ts +1 -1
- package/es/components/DataTable/TableContainer.js +5 -4
- package/es/components/DataTable/TableExpandHeader.d.ts +6 -5
- package/es/components/DataTable/TableToolbarMenu.d.ts +2 -2
- package/es/components/DataTable/TableToolbarMenu.js +1 -1
- package/es/components/DatePicker/DatePicker.js +2 -2
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +1 -1
- package/es/components/Dialog/index.d.ts +42 -4
- package/es/components/Dialog/index.js +177 -0
- package/es/components/ExpandableSearch/ExpandableSearch.js +2 -2
- package/es/components/FeatureFlags/index.d.ts +3 -1
- package/es/components/FeatureFlags/index.js +3 -0
- package/es/components/FileUploader/FileUploader.d.ts +1 -1
- package/es/components/FileUploader/FileUploader.js +2 -2
- package/es/components/FileUploader/FileUploaderButton.js +2 -2
- package/es/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +6 -4
- package/es/components/FileUploader/FileUploaderItem.d.ts +1 -1
- package/es/components/FileUploader/FileUploaderItem.js +2 -2
- package/es/components/Grid/CSSGrid.js +18 -14
- package/es/components/Grid/Column.d.ts +2 -2
- package/es/components/Grid/Column.js +7 -8
- package/es/components/Grid/FlexGrid.js +7 -6
- package/es/components/Grid/GridTypes.d.ts +5 -3
- package/es/components/IconButton/index.d.ts +2 -2
- package/es/components/IconButton/index.js +4 -4
- package/es/components/Layer/index.d.ts +4 -6
- package/es/components/Layer/index.js +5 -6
- package/es/components/Link/Link.d.ts +2 -3
- package/es/components/Link/Link.js +1 -2
- package/es/components/ListBox/ListBoxMenuItem.d.ts +3 -3
- package/es/components/ListBox/ListBoxMenuItem.js +37 -15
- package/es/components/Menu/Menu.js +2 -2
- package/es/components/Menu/MenuItem.d.ts +2 -2
- package/es/components/Menu/MenuItem.js +3 -3
- package/es/components/Modal/Modal.js +121 -49
- package/es/components/ModalWrapper/ModalWrapper.js +1 -1
- package/es/components/MultiSelect/FilterableMultiSelect.js +3 -3
- package/es/components/MultiSelect/MultiSelect.js +2 -2
- package/es/components/MultiSelect/index.d.ts +1 -1
- package/es/components/MultiSelect/index.js +1 -8
- package/es/components/Notification/Notification.d.ts +5 -13
- package/es/components/Notification/Notification.js +3 -4
- package/es/components/OverflowMenu/OverflowMenu.d.ts +22 -201
- package/es/components/OverflowMenu/OverflowMenu.js +269 -338
- package/es/components/OverflowMenu/index.d.ts +5 -5
- package/es/components/OverflowMenu/index.js +2 -2
- package/es/components/OverflowMenu/next/index.d.ts +4 -4
- package/es/components/OverflowMenu/next/index.js +1 -1
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
- package/es/components/ProgressIndicator/ProgressIndicator.js +2 -2
- package/es/components/RadioTile/RadioTile.js +2 -2
- package/es/components/Search/Search.d.ts +2 -3
- package/es/components/Search/Search.js +4 -6
- package/es/components/Slider/Slider.d.ts +39 -44
- package/es/components/Slider/Slider.js +57 -59
- package/es/components/Tabs/Tabs.d.ts +3 -6
- package/es/components/Tabs/Tabs.js +16 -18
- package/es/components/Tag/DismissibleTag.d.ts +3 -5
- package/es/components/Tag/DismissibleTag.js +1 -2
- package/es/components/Tag/OperationalTag.d.ts +2 -3
- package/es/components/Tag/OperationalTag.js +1 -2
- package/es/components/Tag/SelectableTag.d.ts +3 -5
- package/es/components/Tag/SelectableTag.js +1 -2
- package/es/components/Tag/Tag.d.ts +2 -3
- package/es/components/Tag/Tag.js +1 -2
- package/es/components/Tile/Tile.d.ts +3 -5
- package/es/components/Tile/Tile.js +16 -10
- package/es/components/Toggletip/index.js +2 -2
- package/es/components/Tooltip/DefinitionTooltip.js +2 -2
- package/es/components/Tooltip/Tooltip.d.ts +1 -1
- package/es/components/Tooltip/Tooltip.js +2 -2
- package/es/components/TreeView/TreeNode.d.ts +3 -5
- package/es/components/TreeView/TreeNode.js +3 -4
- package/es/components/TreeView/TreeView.js +2 -2
- package/es/components/UIShell/HeaderContainer.js +2 -2
- package/es/components/UIShell/HeaderMenu.js +2 -2
- package/es/components/UIShell/HeaderPanel.js +2 -2
- package/es/components/UIShell/SideNav.d.ts +1 -1
- package/es/components/UIShell/SideNav.js +2 -2
- package/es/components/UIShell/SideNavHeader.d.ts +2 -3
- package/es/components/UIShell/SideNavHeader.js +1 -2
- package/es/components/UIShell/SideNavLink.d.ts +2 -2
- package/es/components/UIShell/SideNavLink.js +1 -1
- package/es/components/UIShell/SideNavMenu.d.ts +2 -2
- package/es/components/UIShell/SideNavMenu.js +3 -3
- package/es/components/UIShell/SwitcherItem.js +2 -2
- package/es/index.js +1 -1
- package/es/internal/FloatingMenu.d.ts +2 -2
- package/es/internal/FloatingMenu.js +8 -5
- package/es/internal/OptimizedResize.d.ts +18 -0
- package/es/internal/OptimizedResize.js +21 -24
- package/es/internal/createClassWrapper.d.ts +3 -3
- package/es/internal/createClassWrapper.js +4 -4
- package/es/internal/keyboard/index.d.ts +9 -0
- package/es/internal/keyboard/keys.d.ts +23 -0
- package/es/internal/keyboard/keys.js +2 -2
- package/es/internal/keyboard/match.d.ts +26 -0
- package/es/internal/keyboard/match.js +17 -41
- package/es/internal/keyboard/navigation.d.ts +37 -0
- package/es/internal/keyboard/navigation.js +15 -27
- package/es/internal/useIsomorphicEffect.d.ts +10 -0
- package/es/internal/useIsomorphicEffect.js +2 -3
- package/es/internal/useMatchMedia.d.ts +8 -0
- package/es/internal/useMatchMedia.js +10 -20
- package/es/internal/useMergedRefs.js +3 -0
- package/es/internal/useNormalizedInputProps.d.ts +52 -0
- package/es/internal/useNormalizedInputProps.js +9 -36
- package/lib/components/Accordion/AccordionItem.js +2 -2
- package/lib/components/Button/Button.d.ts +2 -3
- package/lib/components/Button/Button.js +29 -19
- package/lib/components/Button/ButtonBase.js +3 -1
- package/lib/components/ChatButton/ChatButton.d.ts +2 -3
- package/lib/components/ChatButton/ChatButton.js +1 -2
- package/lib/components/ComboBox/ComboBox.js +34 -24
- package/lib/components/ComposedModal/ComposedModal.js +64 -50
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +2 -2
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +1 -1
- package/lib/components/ContentSwitcher/ContentSwitcher.js +3 -3
- package/lib/components/DataTable/TableBatchAction.d.ts +3 -3
- package/lib/components/DataTable/TableBatchAction.js +1 -1
- package/lib/components/DataTable/TableContainer.d.ts +1 -1
- package/lib/components/DataTable/TableContainer.js +5 -4
- package/lib/components/DataTable/TableExpandHeader.d.ts +6 -5
- package/lib/components/DataTable/TableToolbarMenu.d.ts +2 -2
- package/lib/components/DataTable/TableToolbarMenu.js +1 -1
- package/lib/components/DatePicker/DatePicker.js +2 -2
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +1 -1
- package/lib/components/Dialog/index.d.ts +42 -4
- package/lib/components/Dialog/index.js +190 -0
- package/lib/components/ExpandableSearch/ExpandableSearch.js +2 -2
- package/lib/components/FeatureFlags/index.d.ts +3 -1
- package/lib/components/FeatureFlags/index.js +3 -0
- package/lib/components/FileUploader/FileUploader.d.ts +1 -1
- package/lib/components/FileUploader/FileUploader.js +2 -2
- package/lib/components/FileUploader/FileUploaderButton.js +2 -2
- package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +6 -4
- package/lib/components/FileUploader/FileUploaderItem.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderItem.js +2 -2
- package/lib/components/Grid/CSSGrid.js +18 -14
- package/lib/components/Grid/Column.d.ts +2 -2
- package/lib/components/Grid/Column.js +7 -8
- package/lib/components/Grid/FlexGrid.js +7 -6
- package/lib/components/Grid/GridTypes.d.ts +5 -3
- package/lib/components/IconButton/index.d.ts +2 -2
- package/lib/components/IconButton/index.js +4 -4
- package/lib/components/Layer/index.d.ts +4 -6
- package/lib/components/Layer/index.js +5 -6
- package/lib/components/Link/Link.d.ts +2 -3
- package/lib/components/Link/Link.js +1 -2
- package/lib/components/ListBox/ListBoxMenuItem.d.ts +3 -3
- package/lib/components/ListBox/ListBoxMenuItem.js +36 -14
- package/lib/components/Menu/Menu.js +2 -2
- package/lib/components/Menu/MenuItem.d.ts +2 -2
- package/lib/components/Menu/MenuItem.js +3 -3
- package/lib/components/Modal/Modal.js +123 -51
- package/lib/components/ModalWrapper/ModalWrapper.js +1 -1
- package/lib/components/MultiSelect/FilterableMultiSelect.js +3 -3
- package/lib/components/MultiSelect/MultiSelect.js +2 -2
- package/lib/components/MultiSelect/index.d.ts +1 -1
- package/lib/components/MultiSelect/index.js +1 -8
- package/lib/components/Notification/Notification.d.ts +5 -13
- package/lib/components/Notification/Notification.js +3 -4
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +22 -201
- package/lib/components/OverflowMenu/OverflowMenu.js +268 -336
- package/lib/components/OverflowMenu/index.d.ts +5 -5
- package/lib/components/OverflowMenu/index.js +2 -2
- package/lib/components/OverflowMenu/next/index.d.ts +4 -4
- package/lib/components/OverflowMenu/next/index.js +1 -1
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
- package/lib/components/ProgressIndicator/ProgressIndicator.js +2 -2
- package/lib/components/RadioTile/RadioTile.js +2 -2
- package/lib/components/Search/Search.d.ts +2 -3
- package/lib/components/Search/Search.js +4 -6
- package/lib/components/Slider/Slider.d.ts +39 -44
- package/lib/components/Slider/Slider.js +57 -59
- package/lib/components/Tabs/Tabs.d.ts +3 -6
- package/lib/components/Tabs/Tabs.js +16 -18
- package/lib/components/Tag/DismissibleTag.d.ts +3 -5
- package/lib/components/Tag/DismissibleTag.js +1 -2
- package/lib/components/Tag/OperationalTag.d.ts +2 -3
- package/lib/components/Tag/OperationalTag.js +1 -2
- package/lib/components/Tag/SelectableTag.d.ts +3 -5
- package/lib/components/Tag/SelectableTag.js +1 -2
- package/lib/components/Tag/Tag.d.ts +2 -3
- package/lib/components/Tag/Tag.js +1 -2
- package/lib/components/Tile/Tile.d.ts +3 -5
- package/lib/components/Tile/Tile.js +16 -10
- package/lib/components/Toggletip/index.js +2 -2
- package/lib/components/Tooltip/DefinitionTooltip.js +2 -2
- package/lib/components/Tooltip/Tooltip.d.ts +1 -1
- package/lib/components/Tooltip/Tooltip.js +2 -2
- package/lib/components/TreeView/TreeNode.d.ts +3 -5
- package/lib/components/TreeView/TreeNode.js +3 -4
- package/lib/components/TreeView/TreeView.js +2 -2
- package/lib/components/UIShell/HeaderContainer.js +2 -2
- package/lib/components/UIShell/HeaderMenu.js +2 -2
- package/lib/components/UIShell/HeaderPanel.js +2 -2
- package/lib/components/UIShell/SideNav.d.ts +1 -1
- package/lib/components/UIShell/SideNav.js +2 -2
- package/lib/components/UIShell/SideNavHeader.d.ts +2 -3
- package/lib/components/UIShell/SideNavHeader.js +1 -2
- package/lib/components/UIShell/SideNavLink.d.ts +2 -2
- package/lib/components/UIShell/SideNavLink.js +1 -1
- package/lib/components/UIShell/SideNavMenu.d.ts +2 -2
- package/lib/components/UIShell/SideNavMenu.js +3 -3
- package/lib/components/UIShell/SwitcherItem.js +2 -2
- package/lib/index.js +2 -2
- package/lib/internal/FloatingMenu.d.ts +2 -2
- package/lib/internal/FloatingMenu.js +9 -6
- package/lib/internal/OptimizedResize.d.ts +18 -0
- package/lib/internal/OptimizedResize.js +21 -24
- package/lib/internal/createClassWrapper.d.ts +3 -3
- package/lib/internal/createClassWrapper.js +4 -4
- package/lib/internal/keyboard/index.d.ts +9 -0
- package/lib/internal/keyboard/keys.d.ts +23 -0
- package/lib/internal/keyboard/keys.js +2 -2
- package/lib/internal/keyboard/match.d.ts +26 -0
- package/lib/internal/keyboard/match.js +17 -41
- package/lib/internal/keyboard/navigation.d.ts +37 -0
- package/lib/internal/keyboard/navigation.js +15 -27
- package/lib/internal/useIsomorphicEffect.d.ts +10 -0
- package/lib/internal/useIsomorphicEffect.js +2 -3
- package/lib/internal/useMatchMedia.d.ts +8 -0
- package/lib/internal/useMatchMedia.js +10 -20
- package/lib/internal/useMergedRefs.js +3 -0
- package/lib/internal/useNormalizedInputProps.d.ts +52 -0
- package/lib/internal/useNormalizedInputProps.js +9 -36
- package/package.json +6 -6
- package/scss/components/dialog/_dialog.scss +9 -0
- package/scss/components/dialog/_index.scss +9 -0
- package/telemetry.yml +1 -0
- package/es/components/Modal/next/index.d.ts +0 -171
- package/es/internal/focus/index.js +0 -15
- package/es/internal/useEffectOnce.js +0 -30
- package/lib/components/Modal/next/index.d.ts +0 -171
- package/lib/internal/focus/index.js +0 -19
- package/lib/internal/useEffectOnce.js +0 -34
|
@@ -5,32 +5,32 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import React__default from 'react';
|
|
11
|
-
import ClickListener from '../../internal/ClickListener.js';
|
|
12
|
-
import { IconButton } from '../IconButton/index.js';
|
|
8
|
+
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
+
import React__default, { forwardRef, useContext, useState, useRef, useEffect, useCallback, Children, isValidElement, cloneElement } from 'react';
|
|
13
10
|
import { OverflowMenuVertical } from '@carbon/icons-react';
|
|
14
|
-
import { PrefixContext } from '../../internal/usePrefix.js';
|
|
15
|
-
import PropTypes from 'prop-types';
|
|
16
11
|
import cx from 'classnames';
|
|
17
|
-
import deprecate from '../../prop-types/deprecate.js';
|
|
18
12
|
import invariant from 'invariant';
|
|
19
|
-
import
|
|
13
|
+
import PropTypes from 'prop-types';
|
|
14
|
+
import ClickListener from '../../internal/ClickListener.js';
|
|
15
|
+
import { DIRECTION_TOP, DIRECTION_BOTTOM, FloatingMenu } from '../../internal/FloatingMenu.js';
|
|
16
|
+
import { ArrowUp, ArrowRight, ArrowDown, ArrowLeft, Escape } from '../../internal/keyboard/keys.js';
|
|
17
|
+
import { matches } from '../../internal/keyboard/match.js';
|
|
20
18
|
import { noopFn } from '../../internal/noopFn.js';
|
|
19
|
+
import { PrefixContext } from '../../internal/usePrefix.js';
|
|
20
|
+
import deprecate from '../../prop-types/deprecate.js';
|
|
21
|
+
import mergeRefs from '../../tools/mergeRefs.js';
|
|
21
22
|
import setupGetInstanceId from '../../tools/setupGetInstanceId.js';
|
|
22
|
-
import {
|
|
23
|
-
import { ArrowUp, ArrowRight, ArrowDown, ArrowLeft, Escape } from '../../internal/keyboard/keys.js';
|
|
23
|
+
import { IconButton } from '../IconButton/index.js';
|
|
24
24
|
|
|
25
25
|
const getInstanceId = setupGetInstanceId();
|
|
26
|
-
const on = function (
|
|
26
|
+
const on = function (target) {
|
|
27
27
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
28
28
|
args[_key - 1] = arguments[_key];
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
target.addEventListener(...args);
|
|
31
31
|
return {
|
|
32
32
|
release() {
|
|
33
|
-
|
|
33
|
+
target.removeEventListener(...args);
|
|
34
34
|
return null;
|
|
35
35
|
}
|
|
36
36
|
};
|
|
@@ -38,7 +38,6 @@ const on = function (element) {
|
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* The CSS property names of the arrow keyed by the floating menu direction.
|
|
41
|
-
* @type {[key: string]: string}
|
|
42
41
|
*/
|
|
43
42
|
const triggerButtonPositionProps = {
|
|
44
43
|
[DIRECTION_TOP]: 'bottom',
|
|
@@ -46,13 +45,22 @@ const triggerButtonPositionProps = {
|
|
|
46
45
|
};
|
|
47
46
|
|
|
48
47
|
/**
|
|
49
|
-
* Determines how the position of arrow should affect the floating menu
|
|
50
|
-
*
|
|
48
|
+
* Determines how the position of the arrow should affect the floating menu
|
|
49
|
+
* position.
|
|
51
50
|
*/
|
|
52
51
|
const triggerButtonPositionFactors = {
|
|
53
52
|
[DIRECTION_TOP]: -2,
|
|
54
53
|
[DIRECTION_BOTTOM]: -1
|
|
55
54
|
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Calculates the offset for the floating menu.
|
|
58
|
+
*
|
|
59
|
+
* @param menuBody - The menu body with the menu arrow.
|
|
60
|
+
* @param direction - The floating menu direction.
|
|
61
|
+
* @returns The adjustment of the floating menu position, upon the position of
|
|
62
|
+
* the menu arrow.
|
|
63
|
+
*/
|
|
56
64
|
const getMenuOffset = (menuBody, direction, trigger, flip) => {
|
|
57
65
|
const triggerButtonPositionProp = triggerButtonPositionProps[direction];
|
|
58
66
|
const triggerButtonPositionFactor = triggerButtonPositionFactors[direction];
|
|
@@ -81,324 +89,254 @@ const getMenuOffset = (menuBody, direction, trigger, flip) => {
|
|
|
81
89
|
};
|
|
82
90
|
}
|
|
83
91
|
};
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
onClick(evt);
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
_defineProperty(this, "closeMenuAndFocus", () => {
|
|
126
|
-
const wasClicked = this.state.click;
|
|
127
|
-
const wasOpen = this.state.open;
|
|
128
|
-
this.closeMenu(() => {
|
|
129
|
-
if (wasOpen && !wasClicked) {
|
|
130
|
-
this.focusMenuEl();
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
_defineProperty(this, "closeMenuOnEscape", () => {
|
|
135
|
-
const wasOpen = this.state.open;
|
|
136
|
-
this.closeMenu(() => {
|
|
137
|
-
if (wasOpen) {
|
|
138
|
-
this.focusMenuEl();
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
_defineProperty(this, "handleKeyPress", evt => {
|
|
143
|
-
if (this.state.open && matches(evt, [ArrowUp, ArrowRight, ArrowDown, ArrowLeft])) {
|
|
144
|
-
evt.preventDefault();
|
|
145
|
-
}
|
|
92
|
+
const OverflowMenu = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
93
|
+
let {
|
|
94
|
+
['aria-label']: ariaLabel = null,
|
|
95
|
+
ariaLabel: deprecatedAriaLabel,
|
|
96
|
+
children,
|
|
97
|
+
className,
|
|
98
|
+
direction = DIRECTION_BOTTOM,
|
|
99
|
+
flipped = false,
|
|
100
|
+
focusTrap = true,
|
|
101
|
+
iconClass,
|
|
102
|
+
iconDescription = 'Options',
|
|
103
|
+
id,
|
|
104
|
+
light,
|
|
105
|
+
menuOffset = getMenuOffset,
|
|
106
|
+
menuOffsetFlip = getMenuOffset,
|
|
107
|
+
menuOptionsClass,
|
|
108
|
+
onClick = noopFn,
|
|
109
|
+
onClose = noopFn,
|
|
110
|
+
onOpen = noopFn,
|
|
111
|
+
open: openProp,
|
|
112
|
+
renderIcon: IconElement = OverflowMenuVertical,
|
|
113
|
+
selectorPrimaryFocus = '[data-floating-menu-primary-focus]',
|
|
114
|
+
size = 'md',
|
|
115
|
+
...other
|
|
116
|
+
} = _ref;
|
|
117
|
+
const prefix = useContext(PrefixContext);
|
|
118
|
+
const [open, setOpen] = useState(openProp ?? false);
|
|
119
|
+
const [click, setClick] = useState(false);
|
|
120
|
+
const [hasMountedTrigger, setHasMountedTrigger] = useState(false);
|
|
121
|
+
/** The handle of `onfocusin` or `focus` event handler. */
|
|
122
|
+
const hFocusIn = useRef(null);
|
|
123
|
+
const instanceId = useRef(getInstanceId());
|
|
124
|
+
const menuBodyRef = useRef(null);
|
|
125
|
+
const menuItemRefs = useRef({});
|
|
126
|
+
const prevOpenProp = useRef(openProp);
|
|
127
|
+
const prevOpenState = useRef(open);
|
|
128
|
+
/** The element ref of the tooltip's trigger button. */
|
|
129
|
+
const triggerRef = useRef(null);
|
|
146
130
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
131
|
+
// Sync open prop changes.
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
if (prevOpenProp.current !== openProp) {
|
|
134
|
+
setOpen(!!openProp);
|
|
135
|
+
prevOpenProp.current = openProp;
|
|
136
|
+
}
|
|
137
|
+
}, [openProp]);
|
|
150
138
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
139
|
+
// Mark trigger as mounted.
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
if (triggerRef.current) {
|
|
142
|
+
setHasMountedTrigger(true);
|
|
143
|
+
}
|
|
144
|
+
}, []);
|
|
145
|
+
|
|
146
|
+
// Call `onClose` when menu closes.
|
|
147
|
+
useEffect(() => {
|
|
148
|
+
if (!open && prevOpenState.current) {
|
|
149
|
+
onClose();
|
|
150
|
+
}
|
|
151
|
+
prevOpenState.current = open;
|
|
152
|
+
}, [open, onClose]);
|
|
153
|
+
const focusMenuEl = useCallback(() => {
|
|
154
|
+
if (triggerRef.current) {
|
|
155
|
+
triggerRef.current.focus();
|
|
156
|
+
}
|
|
157
|
+
}, []);
|
|
158
|
+
const closeMenu = useCallback(onCloseMenu => {
|
|
159
|
+
setOpen(false);
|
|
160
|
+
// Optional callback to be executed after the state as been set to close
|
|
161
|
+
if (onCloseMenu) {
|
|
162
|
+
onCloseMenu();
|
|
163
|
+
}
|
|
164
|
+
onClose();
|
|
165
|
+
}, [onClose]);
|
|
166
|
+
const closeMenuAndFocus = useCallback(() => {
|
|
167
|
+
const wasClicked = click;
|
|
168
|
+
const wasOpen = open;
|
|
169
|
+
closeMenu(() => {
|
|
170
|
+
if (wasOpen && !wasClicked) {
|
|
171
|
+
focusMenuEl();
|
|
158
172
|
}
|
|
159
173
|
});
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}, () => {
|
|
167
|
-
// Optional callback to be executed after the state as been set to close
|
|
168
|
-
if (onCloseMenu) {
|
|
169
|
-
onCloseMenu();
|
|
170
|
-
}
|
|
171
|
-
onClose();
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
_defineProperty(this, "focusMenuEl", () => {
|
|
175
|
-
const {
|
|
176
|
-
current: triggerEl
|
|
177
|
-
} = this._triggerRef;
|
|
178
|
-
if (triggerEl) {
|
|
179
|
-
triggerEl.focus();
|
|
174
|
+
}, [click, open, closeMenu, focusMenuEl]);
|
|
175
|
+
const closeMenuOnEscape = useCallback(() => {
|
|
176
|
+
const wasOpen = open;
|
|
177
|
+
closeMenu(() => {
|
|
178
|
+
if (wasOpen) {
|
|
179
|
+
focusMenuEl();
|
|
180
180
|
}
|
|
181
181
|
});
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
*/
|
|
222
|
-
_defineProperty(this, "_menuBody", null);
|
|
223
|
-
_defineProperty(this, "_bindMenuBody", menuBody => {
|
|
224
|
-
if (!menuBody) {
|
|
225
|
-
this._menuBody = menuBody;
|
|
182
|
+
}, [open, closeMenu, focusMenuEl]);
|
|
183
|
+
const handleClick = evt => {
|
|
184
|
+
setClick(true);
|
|
185
|
+
if (!menuBodyRef.current || !menuBodyRef.current.contains(evt.target)) {
|
|
186
|
+
setOpen(prev => !prev);
|
|
187
|
+
onClick(evt);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
const handleKeyPress = evt => {
|
|
191
|
+
if (open && matches(evt, [ArrowUp, ArrowRight, ArrowDown, ArrowLeft])) {
|
|
192
|
+
evt.preventDefault();
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Close the overflow menu on escape
|
|
196
|
+
if (matches(evt, [Escape])) {
|
|
197
|
+
closeMenuOnEscape();
|
|
198
|
+
|
|
199
|
+
// Stop the esc keypress from bubbling out and closing something it shouldn't
|
|
200
|
+
evt.stopPropagation();
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
const handleClickOutside = evt => {
|
|
204
|
+
if (open && (!menuBodyRef.current || !menuBodyRef.current.contains(evt.target))) {
|
|
205
|
+
closeMenu();
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Focuses the next enabled overflow menu item given the currently focused
|
|
211
|
+
* item index and direction to move.
|
|
212
|
+
*/
|
|
213
|
+
const handleOverflowMenuItemFocus = _ref2 => {
|
|
214
|
+
let {
|
|
215
|
+
currentIndex,
|
|
216
|
+
direction
|
|
217
|
+
} = _ref2;
|
|
218
|
+
const enabledIndices = Children.toArray(children).reduce((acc, curr, i) => {
|
|
219
|
+
if (/*#__PURE__*/isValidElement(curr) && !curr.props.disabled) {
|
|
220
|
+
acc.push(i);
|
|
226
221
|
}
|
|
227
|
-
|
|
228
|
-
|
|
222
|
+
return acc;
|
|
223
|
+
}, []);
|
|
224
|
+
const nextValidIndex = (() => {
|
|
225
|
+
const nextIndex = enabledIndices.indexOf(currentIndex) + direction;
|
|
226
|
+
switch (nextIndex) {
|
|
227
|
+
case -1:
|
|
228
|
+
return enabledIndices.length - 1;
|
|
229
|
+
case enabledIndices.length:
|
|
230
|
+
return 0;
|
|
231
|
+
default:
|
|
232
|
+
return nextIndex;
|
|
229
233
|
}
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}, !hasFocusin);
|
|
255
|
-
onOpen();
|
|
234
|
+
})();
|
|
235
|
+
const overflowMenuItem = menuItemRefs.current[enabledIndices[nextValidIndex]];
|
|
236
|
+
overflowMenuItem?.focus();
|
|
237
|
+
};
|
|
238
|
+
const bindMenuBody = menuBody => {
|
|
239
|
+
if (!menuBody) {
|
|
240
|
+
menuBodyRef.current = menuBody;
|
|
241
|
+
}
|
|
242
|
+
if (!menuBody && hFocusIn.current) {
|
|
243
|
+
hFocusIn.current = hFocusIn.current.release();
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
const handlePlace = menuBody => {
|
|
247
|
+
if (!menuBody) return;
|
|
248
|
+
menuBodyRef.current = menuBody;
|
|
249
|
+
const hasFocusin = 'onfocusin' in window;
|
|
250
|
+
const focusinEventName = hasFocusin ? 'focusin' : 'focus';
|
|
251
|
+
hFocusIn.current = on(menuBody.ownerDocument, focusinEventName, event => {
|
|
252
|
+
const target = event.target;
|
|
253
|
+
const triggerEl = triggerRef.current;
|
|
254
|
+
if (typeof target.matches === 'function') {
|
|
255
|
+
if (!menuBody.contains(target) && triggerEl && !target.matches(`.${prefix}--overflow-menu:first-child, .${prefix}--overflow-menu-options:first-child`)) {
|
|
256
|
+
closeMenuAndFocus();
|
|
257
|
+
}
|
|
256
258
|
}
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
} = this._triggerRef;
|
|
265
|
-
return triggerEl instanceof Element && triggerEl.closest('[data-floating-menu-container]') || document.body;
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
componentDidUpdate(_, prevState) {
|
|
269
|
-
const {
|
|
270
|
-
onClose = noopFn
|
|
271
|
-
} = this.props;
|
|
272
|
-
if (!this.state.open && prevState.open) {
|
|
273
|
-
onClose();
|
|
259
|
+
}, !hasFocusin);
|
|
260
|
+
onOpen();
|
|
261
|
+
};
|
|
262
|
+
const getTarget = () => {
|
|
263
|
+
const triggerEl = triggerRef.current;
|
|
264
|
+
if (triggerEl instanceof Element) {
|
|
265
|
+
return triggerEl.closest('[data-floating-menu-container]') || document.body;
|
|
274
266
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
267
|
+
return document.body;
|
|
268
|
+
};
|
|
269
|
+
const menuBodyId = `overflow-menu-${instanceId.current}__menu-body`;
|
|
270
|
+
const overflowMenuClasses = cx(className, `${prefix}--overflow-menu`, {
|
|
271
|
+
[`${prefix}--overflow-menu--open`]: open,
|
|
272
|
+
[`${prefix}--overflow-menu--light`]: light,
|
|
273
|
+
[`${prefix}--overflow-menu--${size}`]: size
|
|
274
|
+
});
|
|
275
|
+
const overflowMenuOptionsClasses = cx(menuOptionsClass, `${prefix}--overflow-menu-options`, {
|
|
276
|
+
[`${prefix}--overflow-menu--flip`]: flipped,
|
|
277
|
+
[`${prefix}--overflow-menu-options--open`]: open,
|
|
278
|
+
[`${prefix}--overflow-menu-options--light`]: light,
|
|
279
|
+
[`${prefix}--overflow-menu-options--${size}`]: size
|
|
280
|
+
});
|
|
281
|
+
const overflowMenuIconClasses = cx(`${prefix}--overflow-menu__icon`, iconClass);
|
|
282
|
+
const childrenWithProps = Children.toArray(children).map((child, index) => {
|
|
283
|
+
if (/*#__PURE__*/isValidElement(child)) {
|
|
284
|
+
const childElement = child;
|
|
285
|
+
return /*#__PURE__*/cloneElement(childElement, {
|
|
286
|
+
closeMenu: childElement.props.closeMenu || closeMenuAndFocus,
|
|
287
|
+
handleOverflowMenuItemFocus,
|
|
288
|
+
ref: el => {
|
|
289
|
+
menuItemRefs.current[index] = el;
|
|
290
|
+
},
|
|
291
|
+
index
|
|
282
292
|
});
|
|
283
293
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
} = this.props;
|
|
331
|
-
const {
|
|
332
|
-
open = false
|
|
333
|
-
} = this.state;
|
|
334
|
-
const overflowMenuClasses = cx(this.props.className, `${prefix}--overflow-menu`, {
|
|
335
|
-
[`${prefix}--overflow-menu--open`]: open,
|
|
336
|
-
[`${prefix}--overflow-menu--light`]: light,
|
|
337
|
-
[`${prefix}--overflow-menu--${size}`]: size
|
|
338
|
-
});
|
|
339
|
-
const overflowMenuOptionsClasses = cx(menuOptionsClass, `${prefix}--overflow-menu-options`, {
|
|
340
|
-
[`${prefix}--overflow-menu--flip`]: this.props.flipped,
|
|
341
|
-
[`${prefix}--overflow-menu-options--open`]: open,
|
|
342
|
-
[`${prefix}--overflow-menu-options--light`]: light,
|
|
343
|
-
[`${prefix}--overflow-menu-options--${size}`]: size
|
|
344
|
-
});
|
|
345
|
-
const overflowMenuIconClasses = cx(`${prefix}--overflow-menu__icon`, iconClass);
|
|
346
|
-
const childrenWithProps = React__default.Children.toArray(children).map((child, index) => /*#__PURE__*/React__default.isValidElement(child) ? /*#__PURE__*/React__default.cloneElement(child, {
|
|
347
|
-
// @ts-expect-error: PropTypes are not expressive enough to cover this case
|
|
348
|
-
closeMenu: child.props.closeMenu || this.closeMenuAndFocus,
|
|
349
|
-
handleOverflowMenuItemFocus: this.handleOverflowMenuItemFocus,
|
|
350
|
-
ref: e => {
|
|
351
|
-
this[`overflowMenuItem${index}`] = e;
|
|
352
|
-
},
|
|
353
|
-
index
|
|
354
|
-
}) : null);
|
|
355
|
-
const menuBodyId = `overflow-menu-${this.instanceId}__menu-body`;
|
|
356
|
-
const menuBody = /*#__PURE__*/React__default.createElement("ul", {
|
|
357
|
-
className: overflowMenuOptionsClasses,
|
|
358
|
-
tabIndex: -1,
|
|
359
|
-
role: "menu",
|
|
360
|
-
"aria-label": ariaLabel || deprecatedAriaLabel,
|
|
361
|
-
onKeyDown: this.handleKeyPress,
|
|
362
|
-
id: menuBodyId
|
|
363
|
-
}, childrenWithProps);
|
|
364
|
-
const wrappedMenuBody = /*#__PURE__*/React__default.createElement(FloatingMenu, {
|
|
365
|
-
focusTrap: focusTrap,
|
|
366
|
-
triggerRef: this._triggerRef,
|
|
367
|
-
menuDirection: direction,
|
|
368
|
-
menuOffset: flipped ? menuOffsetFlip : menuOffset,
|
|
369
|
-
menuRef: this._bindMenuBody,
|
|
370
|
-
flipped: this.props.flipped,
|
|
371
|
-
target: this._getTarget,
|
|
372
|
-
onPlace: this._handlePlace,
|
|
373
|
-
selectorPrimaryFocus: this.props.selectorPrimaryFocus
|
|
374
|
-
}, /*#__PURE__*/React__default.cloneElement(menuBody, {
|
|
375
|
-
'data-floating-menu-direction': direction
|
|
376
|
-
}));
|
|
377
|
-
const iconProps = {
|
|
378
|
-
className: overflowMenuIconClasses,
|
|
379
|
-
'aria-label': iconDescription
|
|
380
|
-
};
|
|
381
|
-
return /*#__PURE__*/React__default.createElement(ClickListener, {
|
|
382
|
-
onClickOutside: this.handleClickOutside
|
|
383
|
-
}, /*#__PURE__*/React__default.createElement("span", {
|
|
384
|
-
className: `${prefix}--overflow-menu__wrapper`,
|
|
385
|
-
"aria-owns": open ? menuBodyId : undefined
|
|
386
|
-
}, /*#__PURE__*/React__default.createElement(IconButton, _extends({}, other, {
|
|
387
|
-
type: "button",
|
|
388
|
-
"aria-haspopup": true,
|
|
389
|
-
"aria-expanded": open,
|
|
390
|
-
"aria-controls": open ? menuBodyId : undefined,
|
|
391
|
-
className: overflowMenuClasses,
|
|
392
|
-
onClick: this.handleClick,
|
|
393
|
-
id: id,
|
|
394
|
-
ref: mergeRefs(this._triggerRef, ref),
|
|
395
|
-
size: size,
|
|
396
|
-
label: iconDescription,
|
|
397
|
-
kind: "ghost"
|
|
398
|
-
}), /*#__PURE__*/React__default.createElement(IconElement, iconProps)), open && this.state.hasMountedTrigger && wrappedMenuBody));
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
_defineProperty(OverflowMenu, "propTypes", {
|
|
294
|
+
return null;
|
|
295
|
+
});
|
|
296
|
+
const menuBody = /*#__PURE__*/React__default.createElement("ul", {
|
|
297
|
+
className: overflowMenuOptionsClasses,
|
|
298
|
+
tabIndex: -1,
|
|
299
|
+
role: "menu",
|
|
300
|
+
"aria-label": ariaLabel || deprecatedAriaLabel,
|
|
301
|
+
onKeyDown: handleKeyPress,
|
|
302
|
+
id: menuBodyId
|
|
303
|
+
}, childrenWithProps);
|
|
304
|
+
const wrappedMenuBody = /*#__PURE__*/React__default.createElement(FloatingMenu, {
|
|
305
|
+
focusTrap: focusTrap,
|
|
306
|
+
triggerRef: triggerRef,
|
|
307
|
+
menuDirection: direction,
|
|
308
|
+
menuOffset: flipped ? menuOffsetFlip : menuOffset,
|
|
309
|
+
menuRef: bindMenuBody,
|
|
310
|
+
flipped: flipped,
|
|
311
|
+
target: getTarget,
|
|
312
|
+
onPlace: handlePlace,
|
|
313
|
+
selectorPrimaryFocus: selectorPrimaryFocus
|
|
314
|
+
}, /*#__PURE__*/cloneElement(menuBody, {
|
|
315
|
+
'data-floating-menu-direction': direction
|
|
316
|
+
}));
|
|
317
|
+
return /*#__PURE__*/React__default.createElement(ClickListener, {
|
|
318
|
+
onClickOutside: handleClickOutside
|
|
319
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
320
|
+
className: `${prefix}--overflow-menu__wrapper`,
|
|
321
|
+
"aria-owns": open ? menuBodyId : undefined
|
|
322
|
+
}, /*#__PURE__*/React__default.createElement(IconButton, _extends({}, other, {
|
|
323
|
+
type: "button",
|
|
324
|
+
"aria-haspopup": true,
|
|
325
|
+
"aria-expanded": open,
|
|
326
|
+
"aria-controls": open ? menuBodyId : undefined,
|
|
327
|
+
className: overflowMenuClasses,
|
|
328
|
+
onClick: handleClick,
|
|
329
|
+
id: id,
|
|
330
|
+
ref: mergeRefs(triggerRef, ref),
|
|
331
|
+
size: size,
|
|
332
|
+
label: iconDescription,
|
|
333
|
+
kind: "ghost"
|
|
334
|
+
}), /*#__PURE__*/React__default.createElement(IconElement, {
|
|
335
|
+
className: overflowMenuIconClasses,
|
|
336
|
+
"aria-label": iconDescription
|
|
337
|
+
})), open && hasMountedTrigger && wrappedMenuBody));
|
|
338
|
+
});
|
|
339
|
+
OverflowMenu.propTypes = {
|
|
402
340
|
/**
|
|
403
341
|
* Specify a label to be read by screen readers on the container node
|
|
404
342
|
*/
|
|
@@ -449,15 +387,15 @@ _defineProperty(OverflowMenu, "propTypes", {
|
|
|
449
387
|
* The adjustment in position applied to the floating menu.
|
|
450
388
|
*/
|
|
451
389
|
menuOffset: PropTypes.oneOfType([PropTypes.shape({
|
|
452
|
-
top: PropTypes.number,
|
|
453
|
-
left: PropTypes.number
|
|
390
|
+
top: PropTypes.number.isRequired,
|
|
391
|
+
left: PropTypes.number.isRequired
|
|
454
392
|
}), PropTypes.func]),
|
|
455
393
|
/**
|
|
456
394
|
* The adjustment in position applied to the floating menu.
|
|
457
395
|
*/
|
|
458
396
|
menuOffsetFlip: PropTypes.oneOfType([PropTypes.shape({
|
|
459
|
-
top: PropTypes.number,
|
|
460
|
-
left: PropTypes.number
|
|
397
|
+
top: PropTypes.number.isRequired,
|
|
398
|
+
left: PropTypes.number.isRequired
|
|
461
399
|
}), PropTypes.func]),
|
|
462
400
|
/**
|
|
463
401
|
* The class to apply to the menu options
|
|
@@ -488,8 +426,9 @@ _defineProperty(OverflowMenu, "propTypes", {
|
|
|
488
426
|
*/
|
|
489
427
|
open: PropTypes.bool,
|
|
490
428
|
/**
|
|
491
|
-
*
|
|
429
|
+
* A component used to render an icon.
|
|
492
430
|
*/
|
|
431
|
+
// @ts-expect-error: PropTypes are not expressive enough to cover this case
|
|
493
432
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
494
433
|
/**
|
|
495
434
|
* Specify a CSS selector that matches the DOM element that should
|
|
@@ -500,14 +439,6 @@ _defineProperty(OverflowMenu, "propTypes", {
|
|
|
500
439
|
* Specify the size of the OverflowMenu. Currently supports either `sm`, 'md' (default) or 'lg` as an option.
|
|
501
440
|
*/
|
|
502
441
|
size: PropTypes.oneOf(['sm', 'md', 'lg'])
|
|
503
|
-
}
|
|
504
|
-
_defineProperty(OverflowMenu, "contextType", PrefixContext);
|
|
505
|
-
(() => {
|
|
506
|
-
const forwardRef = (props, ref) => /*#__PURE__*/React__default.createElement(OverflowMenu, _extends({}, props, {
|
|
507
|
-
innerRef: ref
|
|
508
|
-
}));
|
|
509
|
-
forwardRef.displayName = 'OverflowMenu';
|
|
510
|
-
return /*#__PURE__*/React__default.forwardRef(forwardRef);
|
|
511
|
-
})();
|
|
442
|
+
};
|
|
512
443
|
|
|
513
|
-
export { OverflowMenu, getMenuOffset };
|
|
444
|
+
export { OverflowMenu, OverflowMenu as default, getMenuOffset };
|