@carbon/react 1.78.1 → 1.78.2
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 +764 -764
- package/es/components/Accordion/AccordionItem.js +2 -2
- package/es/components/Button/Button.d.ts +3 -2
- package/es/components/Button/Button.js +2 -1
- package/es/components/Button/ButtonBase.js +1 -1
- package/es/components/ChatButton/ChatButton.d.ts +3 -2
- package/es/components/ChatButton/ChatButton.js +2 -1
- package/es/components/ComboBox/ComboBox.js +24 -34
- package/es/components/ComposedModal/ComposedModal.js +51 -65
- 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 +3 -3
- package/es/components/DataTable/TableExpandHeader.d.ts +5 -6
- 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 +4 -42
- package/es/components/ExpandableSearch/ExpandableSearch.js +2 -2
- package/es/components/FeatureFlags/index.d.ts +1 -3
- package/es/components/FeatureFlags/index.js +0 -3
- 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 +4 -6
- package/es/components/FileUploader/FileUploaderItem.d.ts +1 -1
- package/es/components/FileUploader/FileUploaderItem.js +2 -2
- package/es/components/Grid/CSSGrid.js +14 -18
- package/es/components/Grid/FlexGrid.js +6 -7
- package/es/components/Grid/GridTypes.d.ts +3 -5
- package/es/components/IconButton/index.js +3 -3
- package/es/components/Layer/index.d.ts +6 -4
- package/es/components/Layer/index.js +6 -5
- package/es/components/Link/Link.d.ts +3 -2
- package/es/components/Link/Link.js +2 -1
- package/es/components/ListBox/ListBoxMenuItem.d.ts +3 -3
- package/es/components/ListBox/ListBoxMenuItem.js +15 -37
- 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 +49 -121
- package/es/components/Modal/next/index.d.ts +171 -0
- 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/Notification/Notification.d.ts +13 -5
- package/es/components/Notification/Notification.js +4 -3
- package/es/components/OverflowMenu/OverflowMenu.d.ts +8 -4
- package/es/components/OverflowMenu/OverflowMenu.js +3 -3
- package/es/components/OverflowMenu/next/index.d.ts +2 -2
- 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 +3 -2
- package/es/components/Search/Search.js +6 -4
- package/es/components/Slider/Slider.d.ts +15 -16
- package/es/components/Slider/Slider.js +22 -22
- package/es/components/Tabs/Tabs.d.ts +6 -3
- package/es/components/Tabs/Tabs.js +9 -8
- package/es/components/Tag/DismissibleTag.d.ts +5 -3
- package/es/components/Tag/DismissibleTag.js +2 -1
- package/es/components/Tag/OperationalTag.d.ts +3 -2
- package/es/components/Tag/OperationalTag.js +2 -1
- package/es/components/Tag/SelectableTag.d.ts +5 -3
- package/es/components/Tag/SelectableTag.js +2 -1
- package/es/components/Tag/Tag.d.ts +3 -2
- package/es/components/Tag/Tag.js +2 -1
- package/es/components/Tile/Tile.d.ts +5 -3
- package/es/components/Tile/Tile.js +6 -8
- 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 +5 -3
- package/es/components/TreeView/TreeNode.js +4 -3
- 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 +3 -2
- package/es/components/UIShell/SideNavHeader.js +2 -1
- 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/internal/FloatingMenu.js +4 -4
- package/es/internal/OptimizedResize.js +24 -21
- package/es/internal/focus/index.js +15 -0
- package/es/internal/keyboard/keys.js +2 -2
- package/es/internal/keyboard/match.js +41 -17
- package/es/internal/keyboard/navigation.js +27 -15
- package/es/internal/useMergedRefs.js +0 -3
- package/lib/components/Accordion/AccordionItem.js +2 -2
- package/lib/components/Button/Button.d.ts +3 -2
- package/lib/components/Button/Button.js +2 -1
- package/lib/components/Button/ButtonBase.js +1 -1
- package/lib/components/ChatButton/ChatButton.d.ts +3 -2
- package/lib/components/ChatButton/ChatButton.js +2 -1
- package/lib/components/ComboBox/ComboBox.js +24 -34
- package/lib/components/ComposedModal/ComposedModal.js +50 -64
- 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 +3 -3
- package/lib/components/DataTable/TableExpandHeader.d.ts +5 -6
- 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 +4 -42
- package/lib/components/ExpandableSearch/ExpandableSearch.js +2 -2
- package/lib/components/FeatureFlags/index.d.ts +1 -3
- package/lib/components/FeatureFlags/index.js +0 -3
- 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 +4 -6
- package/lib/components/FileUploader/FileUploaderItem.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderItem.js +2 -2
- package/lib/components/Grid/CSSGrid.js +14 -18
- package/lib/components/Grid/FlexGrid.js +6 -7
- package/lib/components/Grid/GridTypes.d.ts +3 -5
- package/lib/components/IconButton/index.js +3 -3
- package/lib/components/Layer/index.d.ts +6 -4
- package/lib/components/Layer/index.js +6 -5
- package/lib/components/Link/Link.d.ts +3 -2
- package/lib/components/Link/Link.js +2 -1
- package/lib/components/ListBox/ListBoxMenuItem.d.ts +3 -3
- package/lib/components/ListBox/ListBoxMenuItem.js +14 -36
- 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 +51 -123
- package/lib/components/Modal/next/index.d.ts +171 -0
- 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/Notification/Notification.d.ts +13 -5
- package/lib/components/Notification/Notification.js +4 -3
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +8 -4
- package/lib/components/OverflowMenu/OverflowMenu.js +3 -3
- package/lib/components/OverflowMenu/next/index.d.ts +2 -2
- 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 +3 -2
- package/lib/components/Search/Search.js +6 -4
- package/lib/components/Slider/Slider.d.ts +15 -16
- package/lib/components/Slider/Slider.js +22 -22
- package/lib/components/Tabs/Tabs.d.ts +6 -3
- package/lib/components/Tabs/Tabs.js +9 -8
- package/lib/components/Tag/DismissibleTag.d.ts +5 -3
- package/lib/components/Tag/DismissibleTag.js +2 -1
- package/lib/components/Tag/OperationalTag.d.ts +3 -2
- package/lib/components/Tag/OperationalTag.js +2 -1
- package/lib/components/Tag/SelectableTag.d.ts +5 -3
- package/lib/components/Tag/SelectableTag.js +2 -1
- package/lib/components/Tag/Tag.d.ts +3 -2
- package/lib/components/Tag/Tag.js +2 -1
- package/lib/components/Tile/Tile.d.ts +5 -3
- package/lib/components/Tile/Tile.js +6 -8
- 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 +5 -3
- package/lib/components/TreeView/TreeNode.js +4 -3
- 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 +3 -2
- package/lib/components/UIShell/SideNavHeader.js +2 -1
- 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/internal/FloatingMenu.js +5 -5
- package/lib/internal/OptimizedResize.js +24 -21
- package/lib/internal/focus/index.js +19 -0
- package/lib/internal/keyboard/keys.js +2 -2
- package/lib/internal/keyboard/match.js +41 -17
- package/lib/internal/keyboard/navigation.js +27 -15
- package/lib/internal/useMergedRefs.js +0 -3
- package/package.json +6 -6
- package/telemetry.yml +0 -1
- package/es/components/Dialog/index.js +0 -177
- package/es/internal/OptimizedResize.d.ts +0 -18
- package/es/internal/keyboard/index.d.ts +0 -9
- package/es/internal/keyboard/keys.d.ts +0 -23
- package/es/internal/keyboard/match.d.ts +0 -26
- package/es/internal/keyboard/navigation.d.ts +0 -37
- package/lib/components/Dialog/index.js +0 -190
- package/lib/internal/OptimizedResize.d.ts +0 -18
- package/lib/internal/keyboard/index.d.ts +0 -9
- package/lib/internal/keyboard/keys.d.ts +0 -23
- package/lib/internal/keyboard/match.d.ts +0 -26
- package/lib/internal/keyboard/navigation.d.ts +0 -37
- package/scss/components/dialog/_dialog.scss +0 -9
- package/scss/components/dialog/_index.scss +0 -9
|
@@ -12,9 +12,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
13
|
var PropTypes = require('prop-types');
|
|
14
14
|
var React = require('react');
|
|
15
|
-
var keys = require('../../internal/keyboard/keys.js');
|
|
16
|
-
var match = require('../../internal/keyboard/match.js');
|
|
17
15
|
var useEvent = require('../../internal/useEvent.js');
|
|
16
|
+
var match = require('../../internal/keyboard/match.js');
|
|
17
|
+
var keys = require('../../internal/keyboard/keys.js');
|
|
18
18
|
|
|
19
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
20
|
|
|
@@ -14,12 +14,12 @@ var iconsReact = require('@carbon/icons-react');
|
|
|
14
14
|
var cx = require('classnames');
|
|
15
15
|
var React = require('react');
|
|
16
16
|
var PropTypes = require('prop-types');
|
|
17
|
-
var keys = require('../../internal/keyboard/keys.js');
|
|
18
|
-
var match = require('../../internal/keyboard/match.js');
|
|
19
17
|
var AriaPropTypes = require('../../prop-types/AriaPropTypes.js');
|
|
20
18
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
21
19
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
22
20
|
var events = require('../../tools/events.js');
|
|
21
|
+
var match = require('../../internal/keyboard/match.js');
|
|
22
|
+
var keys = require('../../internal/keyboard/keys.js');
|
|
23
23
|
|
|
24
24
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
25
25
|
|
|
@@ -14,10 +14,10 @@ var cx = require('classnames');
|
|
|
14
14
|
var PropTypes = require('prop-types');
|
|
15
15
|
var React = require('react');
|
|
16
16
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
17
|
-
var keys = require('../../internal/keyboard/keys.js');
|
|
18
|
-
var match = require('../../internal/keyboard/match.js');
|
|
19
17
|
var useEvent = require('../../internal/useEvent.js');
|
|
20
18
|
var useMergedRefs = require('../../internal/useMergedRefs.js');
|
|
19
|
+
var match = require('../../internal/keyboard/match.js');
|
|
20
|
+
var keys = require('../../internal/keyboard/keys.js');
|
|
21
21
|
|
|
22
22
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
23
|
|
|
@@ -16,13 +16,13 @@ var PropTypes = require('prop-types');
|
|
|
16
16
|
var AriaPropTypes = require('../../prop-types/AriaPropTypes.js');
|
|
17
17
|
var _utils = require('./_utils.js');
|
|
18
18
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
19
|
-
var keys = require('../../internal/keyboard/keys.js');
|
|
20
|
-
var match = require('../../internal/keyboard/match.js');
|
|
21
19
|
var useMergedRefs = require('../../internal/useMergedRefs.js');
|
|
22
20
|
var useEvent = require('../../internal/useEvent.js');
|
|
23
21
|
var useDelayedState = require('../../internal/useDelayedState.js');
|
|
24
22
|
var layout = require('@carbon/layout');
|
|
25
23
|
var useMatchMedia = require('../../internal/useMatchMedia.js');
|
|
24
|
+
var match = require('../../internal/keyboard/match.js');
|
|
25
|
+
var keys = require('../../internal/keyboard/keys.js');
|
|
26
26
|
|
|
27
27
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
28
28
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -20,7 +20,8 @@ export interface SideNavHeaderProps {
|
|
|
20
20
|
*/
|
|
21
21
|
isSideNavExpanded?: boolean;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Provide an icon to render in the header of the side navigation. Should be
|
|
24
|
+
* a React class.
|
|
24
25
|
*/
|
|
25
26
|
renderIcon: React.ComponentType;
|
|
26
27
|
}
|
|
@@ -49,7 +49,8 @@ SideNavHeader.propTypes = {
|
|
|
49
49
|
*/
|
|
50
50
|
isSideNavExpanded: PropTypes__default["default"].bool,
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
52
|
+
* Provide an icon to render in the header of the side navigation. Should be
|
|
53
|
+
* a React class.
|
|
53
54
|
*/
|
|
54
55
|
// @ts-expect-error - PropTypes are unable to cover this case.
|
|
55
56
|
renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object]).isRequired
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -37,7 +37,7 @@ export type SideNavLinkProps<E extends ElementType> = LinkProps<E> & {
|
|
|
37
37
|
*/
|
|
38
38
|
large?: boolean;
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* Provide an icon to render in the side navigation link. Should be a React class.
|
|
41
41
|
*/
|
|
42
42
|
renderIcon?: ComponentType;
|
|
43
43
|
/**
|
|
@@ -79,7 +79,7 @@ SideNavLink.propTypes = {
|
|
|
79
79
|
*/
|
|
80
80
|
large: PropTypes__default["default"].bool,
|
|
81
81
|
/**
|
|
82
|
-
*
|
|
82
|
+
* Provide an icon to render in the side navigation link. Should be a React class.
|
|
83
83
|
*/
|
|
84
84
|
// @ts-expect-error - PropTypes are unable to cover this case.
|
|
85
85
|
renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object]),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -27,7 +27,7 @@ export interface SideNavMenuProps {
|
|
|
27
27
|
*/
|
|
28
28
|
large?: boolean;
|
|
29
29
|
/**
|
|
30
|
-
* A
|
|
30
|
+
* A custom icon to render next to the SideNavMenu title. This can be a function returning JSX or JSX itself.
|
|
31
31
|
*/
|
|
32
32
|
renderIcon?: React.ComponentType;
|
|
33
33
|
/**
|
|
@@ -14,10 +14,10 @@ var cx = require('classnames');
|
|
|
14
14
|
var PropTypes = require('prop-types');
|
|
15
15
|
var React = require('react');
|
|
16
16
|
var SideNavIcon = require('./SideNavIcon.js');
|
|
17
|
-
var keys = require('../../internal/keyboard/keys.js');
|
|
18
|
-
var match = require('../../internal/keyboard/match.js');
|
|
19
17
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
20
18
|
var SideNav = require('./SideNav.js');
|
|
19
|
+
var match = require('../../internal/keyboard/match.js');
|
|
20
|
+
var keys = require('../../internal/keyboard/keys.js');
|
|
21
21
|
|
|
22
22
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
23
|
|
|
@@ -120,7 +120,7 @@ SideNavMenu.propTypes = {
|
|
|
120
120
|
*/
|
|
121
121
|
large: PropTypes__default["default"].bool,
|
|
122
122
|
/**
|
|
123
|
-
*
|
|
123
|
+
* Pass in a custom icon to render next to the `SideNavMenu` title
|
|
124
124
|
*/
|
|
125
125
|
// @ts-expect-error - PropTypes are unable to cover this case.
|
|
126
126
|
renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object]),
|
|
@@ -15,9 +15,9 @@ var cx = require('classnames');
|
|
|
15
15
|
var PropTypes = require('prop-types');
|
|
16
16
|
var Link = require('./Link.js');
|
|
17
17
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
|
-
var keys = require('../../internal/keyboard/keys.js');
|
|
19
|
-
var match = require('../../internal/keyboard/match.js');
|
|
20
18
|
var AriaPropTypes = require('../../prop-types/AriaPropTypes.js');
|
|
19
|
+
var match = require('../../internal/keyboard/match.js');
|
|
20
|
+
var keys = require('../../internal/keyboard/keys.js');
|
|
21
21
|
|
|
22
22
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
23
|
|
|
@@ -13,13 +13,13 @@ var React = require('react');
|
|
|
13
13
|
var FeatureFlags = require('@carbon/feature-flags');
|
|
14
14
|
var ReactDOM = require('react-dom');
|
|
15
15
|
var window = require('window-or-global');
|
|
16
|
-
var keys = require('./keyboard/keys.js');
|
|
17
|
-
var match = require('./keyboard/match.js');
|
|
18
|
-
var navigation = require('./keyboard/navigation.js');
|
|
19
16
|
var OptimizedResize = require('./OptimizedResize.js');
|
|
17
|
+
var navigation = require('./keyboard/navigation.js');
|
|
20
18
|
var usePrefix = require('./usePrefix.js');
|
|
21
19
|
var warning = require('./warning.js');
|
|
22
20
|
var wrapFocus = require('./wrapFocus.js');
|
|
21
|
+
var match = require('./keyboard/match.js');
|
|
22
|
+
var keys = require('./keyboard/keys.js');
|
|
23
23
|
|
|
24
24
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
25
25
|
|
|
@@ -230,11 +230,11 @@ const FloatingMenu = _ref2 => {
|
|
|
230
230
|
|
|
231
231
|
// Attach a resize listener.
|
|
232
232
|
React.useEffect(() => {
|
|
233
|
-
const resizeHandler = OptimizedResize.
|
|
233
|
+
const resizeHandler = OptimizedResize["default"].add(() => {
|
|
234
234
|
updateMenuPosition();
|
|
235
235
|
});
|
|
236
236
|
return () => {
|
|
237
|
-
resizeHandler.
|
|
237
|
+
resizeHandler.release();
|
|
238
238
|
};
|
|
239
239
|
}, [triggerRef, menuOffset, menuDirection, flipped, target, updateOrientation]);
|
|
240
240
|
|
|
@@ -16,42 +16,44 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
16
16
|
var window__default = /*#__PURE__*/_interopDefaultLegacy(window);
|
|
17
17
|
|
|
18
18
|
// mdn resize function
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* A callback function to be executed on `resize`.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
const OptimizedResize = (() => {
|
|
19
|
+
const OptimizedResize = function optimizedResize() {
|
|
25
20
|
const callbacks = [];
|
|
26
21
|
let running = false;
|
|
27
|
-
|
|
22
|
+
|
|
23
|
+
// run the actual callbacks
|
|
24
|
+
function runCallbacks() {
|
|
28
25
|
callbacks.forEach(callback => {
|
|
29
26
|
callback();
|
|
30
27
|
});
|
|
31
28
|
running = false;
|
|
32
|
-
}
|
|
33
|
-
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// fired on resize event
|
|
32
|
+
function resize() {
|
|
34
33
|
if (!running) {
|
|
35
34
|
running = true;
|
|
36
35
|
window__default["default"].requestAnimationFrame(runCallbacks);
|
|
37
36
|
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// adds callback to loop
|
|
40
|
+
function addCallback(callback) {
|
|
41
|
+
if (callback) {
|
|
42
|
+
const index = callbacks.indexOf(callback);
|
|
43
|
+
if (index < 0) {
|
|
44
|
+
callbacks.push(callback);
|
|
45
|
+
}
|
|
43
46
|
}
|
|
44
|
-
}
|
|
47
|
+
}
|
|
45
48
|
return {
|
|
46
|
-
|
|
49
|
+
// public method to add additional callback
|
|
47
50
|
add: callback => {
|
|
48
51
|
if (!callbacks.length) {
|
|
49
|
-
window__default["default"].addEventListener('resize',
|
|
52
|
+
window__default["default"].addEventListener('resize', resize);
|
|
50
53
|
}
|
|
51
54
|
addCallback(callback);
|
|
52
55
|
return {
|
|
53
|
-
|
|
54
|
-
remove: () => {
|
|
56
|
+
release() {
|
|
55
57
|
const index = callbacks.indexOf(callback);
|
|
56
58
|
if (index >= 0) {
|
|
57
59
|
callbacks.splice(index, 1);
|
|
@@ -60,6 +62,7 @@ const OptimizedResize = (() => {
|
|
|
60
62
|
};
|
|
61
63
|
}
|
|
62
64
|
};
|
|
63
|
-
}
|
|
65
|
+
}();
|
|
66
|
+
var OptimizedResize$1 = OptimizedResize;
|
|
64
67
|
|
|
65
|
-
exports
|
|
68
|
+
exports["default"] = OptimizedResize$1;
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
+
|
|
12
|
+
function focus(elementOrRef) {
|
|
13
|
+
const element = elementOrRef.current || elementOrRef;
|
|
14
|
+
if (element && element.focus && document.activeElement !== element) {
|
|
15
|
+
element.focus();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
exports.focus = focus;
|
|
@@ -9,38 +9,65 @@
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @typedef Key
|
|
14
|
+
* @property key {Array<string>|string}
|
|
15
|
+
* @property which {number}
|
|
16
|
+
* @property keyCode {number}
|
|
17
|
+
*/
|
|
18
|
+
|
|
12
19
|
/**
|
|
13
20
|
* Check to see if at least one key code matches the key code of the
|
|
14
21
|
* given event.
|
|
15
22
|
*
|
|
16
|
-
* @
|
|
17
|
-
*
|
|
18
|
-
*
|
|
23
|
+
* @example
|
|
24
|
+
* import * as keys from '../keys';
|
|
25
|
+
* import { matches } from '../match';
|
|
26
|
+
*
|
|
27
|
+
* function handleOnKeyDown(event) {
|
|
28
|
+
* if (matches(event, [keys.Enter, keys.Space]) {
|
|
29
|
+
* // ...
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
*
|
|
33
|
+
* @param {Event|React.SyntheticEvent} event
|
|
34
|
+
* @param {Array<Key>} keysToMatch
|
|
35
|
+
* @returns {boolean}
|
|
19
36
|
*/
|
|
20
|
-
|
|
37
|
+
function matches(event, keysToMatch) {
|
|
21
38
|
for (let i = 0; i < keysToMatch.length; i++) {
|
|
22
39
|
if (match(event, keysToMatch[i])) {
|
|
23
40
|
return true;
|
|
24
41
|
}
|
|
25
42
|
}
|
|
26
43
|
return false;
|
|
27
|
-
}
|
|
44
|
+
}
|
|
28
45
|
|
|
29
46
|
/**
|
|
30
47
|
* Check to see if the given key matches the corresponding keyboard event. Also
|
|
31
|
-
* supports passing in the value directly if you can't
|
|
48
|
+
* supports passing in the value directly if you can't used the given event.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* import * as keys from '../keys';
|
|
52
|
+
* import { matches } from '../match';
|
|
53
|
+
*
|
|
54
|
+
* function handleOnKeyDown(event) {
|
|
55
|
+
* if (match(event, keys.Enter) {
|
|
56
|
+
* // ...
|
|
57
|
+
* }
|
|
58
|
+
* }
|
|
32
59
|
*
|
|
33
|
-
* @param
|
|
34
|
-
* @param
|
|
35
|
-
* @returns
|
|
60
|
+
* @param {React.SyntheticEvent|Event|number|string} eventOrCode
|
|
61
|
+
* @param {Key} key
|
|
62
|
+
* @returns {boolean}
|
|
36
63
|
*/
|
|
37
|
-
|
|
64
|
+
function match(eventOrCode) {
|
|
38
65
|
let {
|
|
39
66
|
key,
|
|
40
67
|
which,
|
|
41
68
|
keyCode,
|
|
42
69
|
code
|
|
43
|
-
} =
|
|
70
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
44
71
|
if (typeof eventOrCode === 'string') {
|
|
45
72
|
return eventOrCode === key;
|
|
46
73
|
}
|
|
@@ -48,13 +75,10 @@ const match = (eventOrCode, _ref) => {
|
|
|
48
75
|
return eventOrCode === which || eventOrCode === keyCode;
|
|
49
76
|
}
|
|
50
77
|
if (eventOrCode.key && Array.isArray(key)) {
|
|
51
|
-
return key.
|
|
78
|
+
return key.indexOf(eventOrCode.key) !== -1;
|
|
52
79
|
}
|
|
53
|
-
return eventOrCode.key === key ||
|
|
54
|
-
|
|
55
|
-
// Presumably, the `Key` type should also be pruned of these properties.
|
|
56
|
-
eventOrCode.which === which || eventOrCode.keyCode === keyCode || eventOrCode.code === code;
|
|
57
|
-
};
|
|
80
|
+
return eventOrCode.key === key || eventOrCode.which === which || eventOrCode.keyCode === keyCode || eventOrCode.code === code;
|
|
81
|
+
}
|
|
58
82
|
|
|
59
83
|
exports.match = match;
|
|
60
84
|
exports.matches = matches;
|
|
@@ -13,16 +13,21 @@ var keys = require('./keys.js');
|
|
|
13
13
|
var match = require('./match.js');
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
|
|
16
|
+
* Various utilities to help with a11y work
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A "ring buffer" function that takes an array and depending on an ArrowRight
|
|
21
|
+
* or ArrowLeft key input loops from last index to first or first index to last.
|
|
18
22
|
*
|
|
19
|
-
* @param key - the left or right arrow
|
|
20
|
-
* @param index - the current index in
|
|
21
|
-
* @param arrayLength - the total length of the array
|
|
23
|
+
* @param {string} key - the left or right arrow keys
|
|
24
|
+
* @param {number} index - the current index in a given array
|
|
25
|
+
* @param {number} arrayLength - the total length of the array
|
|
22
26
|
*
|
|
23
27
|
* @example
|
|
24
|
-
*
|
|
28
|
+
* getNextIndex(keyCodes.RIGHT, 0, 4)
|
|
25
29
|
*/
|
|
30
|
+
|
|
26
31
|
const getNextIndex = (key, index, arrayLength) => {
|
|
27
32
|
if (match.match(key, keys.ArrowRight)) {
|
|
28
33
|
return (index + 1) % arrayLength;
|
|
@@ -30,23 +35,30 @@ const getNextIndex = (key, index, arrayLength) => {
|
|
|
30
35
|
if (match.match(key, keys.ArrowLeft)) {
|
|
31
36
|
return (index + arrayLength - 1) % arrayLength;
|
|
32
37
|
}
|
|
33
|
-
return;
|
|
34
38
|
};
|
|
35
39
|
|
|
36
40
|
/**
|
|
37
|
-
* A flag `node.compareDocumentPosition(target)` returns
|
|
38
|
-
* `target` is located earlier than `node` in the document or `target` contains `node`.
|
|
41
|
+
* A flag `node.compareDocumentPosition(target)` returns,
|
|
42
|
+
* that indicates `target` is located earlier than `node` in the document or `target` contains `node`.
|
|
39
43
|
*/
|
|
40
|
-
const DOCUMENT_POSITION_BROAD_PRECEDING =
|
|
44
|
+
const DOCUMENT_POSITION_BROAD_PRECEDING =
|
|
45
|
+
// Checks `typeof Node` for `react-docgen`
|
|
46
|
+
typeof Node !== 'undefined' &&
|
|
47
|
+
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
|
|
48
|
+
Node.DOCUMENT_POSITION_PRECEDING | Node.DOCUMENT_POSITION_CONTAINS;
|
|
41
49
|
|
|
42
50
|
/**
|
|
43
|
-
* A flag `node.compareDocumentPosition(target)` returns
|
|
44
|
-
* `target` is located later than `node` in the document or `node` contains `target`.
|
|
51
|
+
* A flag `node.compareDocumentPosition(target)` returns,
|
|
52
|
+
* that indicates `target` is located later than `node` in the document or `node` contains `target`.
|
|
45
53
|
*/
|
|
46
|
-
const DOCUMENT_POSITION_BROAD_FOLLOWING =
|
|
54
|
+
const DOCUMENT_POSITION_BROAD_FOLLOWING =
|
|
55
|
+
// Checks `typeof Node` for `react-docgen`
|
|
56
|
+
typeof Node !== 'undefined' &&
|
|
57
|
+
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
|
|
58
|
+
Node.DOCUMENT_POSITION_FOLLOWING | Node.DOCUMENT_POSITION_CONTAINED_BY;
|
|
47
59
|
|
|
48
60
|
/**
|
|
49
|
-
* CSS selector that selects major nodes that are
|
|
61
|
+
* CSS selector that selects major nodes that are sequential-focusable.
|
|
50
62
|
*/
|
|
51
63
|
const selectorTabbable = `
|
|
52
64
|
a[href], area[href], input:not([disabled]):not([tabindex='-1']),
|
|
@@ -56,7 +68,7 @@ const selectorTabbable = `
|
|
|
56
68
|
`;
|
|
57
69
|
|
|
58
70
|
/**
|
|
59
|
-
* CSS selector that selects major nodes that are click focusable
|
|
71
|
+
* CSS selector that selects major nodes that are click focusable
|
|
60
72
|
*/
|
|
61
73
|
const selectorFocusable = `
|
|
62
74
|
a[href], area[href], input:not([disabled]),
|
|
@@ -11,9 +11,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
11
11
|
|
|
12
12
|
var React = require('react');
|
|
13
13
|
|
|
14
|
-
// TODO: Investigate updating this hook based on the following code from
|
|
15
|
-
// https://github.com/carbon-design-system/carbon/pull/18611:
|
|
16
|
-
// https://github.com/adamalston/carbon/blob/dd403b6b10de3d8a6ccd8d2e21174c908c1e890a/packages/react/src/components/ListBox/ListBoxMenuItem.tsx#L23-L46
|
|
17
14
|
/**
|
|
18
15
|
* Combine multiple refs into a single ref. This use useful when you have two
|
|
19
16
|
* refs from both `React.forwardRef` and `useRef` that you would like to add to
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/react",
|
|
3
3
|
"description": "React components for the Carbon Design System",
|
|
4
|
-
"version": "1.78.
|
|
4
|
+
"version": "1.78.2",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@babel/runtime": "^7.24.7",
|
|
54
|
-
"@carbon/feature-flags": "^0.24.
|
|
54
|
+
"@carbon/feature-flags": "^0.24.0",
|
|
55
55
|
"@carbon/icons-react": "^11.57.0",
|
|
56
|
-
"@carbon/layout": "^11.30.
|
|
57
|
-
"@carbon/styles": "^1.77.
|
|
56
|
+
"@carbon/layout": "^11.30.2",
|
|
57
|
+
"@carbon/styles": "^1.77.2",
|
|
58
58
|
"@floating-ui/react": "^0.27.4",
|
|
59
59
|
"@ibm/telemetry-js": "^1.5.0",
|
|
60
60
|
"classnames": "2.5.1",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@babel/preset-react": "^7.24.7",
|
|
80
80
|
"@babel/preset-typescript": "^7.24.7",
|
|
81
81
|
"@carbon/test-utils": "^10.35.0",
|
|
82
|
-
"@carbon/themes": "^11.48.
|
|
82
|
+
"@carbon/themes": "^11.48.2",
|
|
83
83
|
"@figma/code-connect": "^1.2.4",
|
|
84
84
|
"@rollup/plugin-babel": "^6.0.0",
|
|
85
85
|
"@rollup/plugin-commonjs": "^28.0.0",
|
|
@@ -146,5 +146,5 @@
|
|
|
146
146
|
"**/*.scss",
|
|
147
147
|
"**/*.css"
|
|
148
148
|
],
|
|
149
|
-
"gitHead": "
|
|
149
|
+
"gitHead": "5c8f7e2a47c2bfb2865f1f2f4efe55b26f45ad5c"
|
|
150
150
|
}
|