@carbon/react 1.78.2 → 1.79.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 +835 -835
- 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/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/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
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
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.
|
|
6
6
|
*/
|
|
7
7
|
import { type OverflowMenuProps } from './OverflowMenu';
|
|
8
|
-
declare
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
8
|
+
declare const OverflowMenu: {
|
|
9
|
+
(props: OverflowMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
12
|
export default OverflowMenu;
|
|
13
13
|
export { OverflowMenu, type OverflowMenuProps };
|
|
@@ -12,10 +12,10 @@ import { OverflowMenu as OverflowMenu$1 } from './OverflowMenu.js';
|
|
|
12
12
|
import { createClassWrapper } from '../../internal/createClassWrapper.js';
|
|
13
13
|
|
|
14
14
|
const OverflowMenuV11 = createClassWrapper(OverflowMenu$1);
|
|
15
|
-
|
|
15
|
+
const OverflowMenu = props => {
|
|
16
16
|
const enableV12OverflowMenu = useFeatureFlag('enable-v12-overflowmenu');
|
|
17
17
|
return enableV12OverflowMenu ? /*#__PURE__*/React__default.createElement(OverflowMenu$2, props) : /*#__PURE__*/React__default.createElement(OverflowMenuV11, props);
|
|
18
|
-
}
|
|
18
|
+
};
|
|
19
19
|
OverflowMenu.displayName = 'OverflowMenu';
|
|
20
20
|
|
|
21
21
|
export { OverflowMenu, OverflowMenu as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2020,
|
|
2
|
+
* Copyright IBM Corp. 2020, 2025
|
|
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.
|
|
6
6
|
*/
|
|
7
|
-
import React, { type
|
|
7
|
+
import React, { type ElementType } from 'react';
|
|
8
8
|
interface OverflowMenuProps {
|
|
9
9
|
/**
|
|
10
10
|
* **Experimental**: Will attempt to automatically align the floating element to avoid collisions with the viewport and being clipped by ancestor elements.
|
|
@@ -27,9 +27,9 @@ interface OverflowMenuProps {
|
|
|
27
27
|
*/
|
|
28
28
|
menuAlignment?: 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* A component used to render an icon.
|
|
31
31
|
*/
|
|
32
|
-
renderIcon?:
|
|
32
|
+
renderIcon?: ElementType;
|
|
33
33
|
/**
|
|
34
34
|
* Specify the size of the menu, from a list of available sizes.
|
|
35
35
|
*/
|
|
@@ -165,7 +165,7 @@ OverflowMenu.propTypes = {
|
|
|
165
165
|
*/
|
|
166
166
|
menuAlignment: PropTypes.oneOf(['top-start', 'top-end', 'bottom-start', 'bottom-end']),
|
|
167
167
|
/**
|
|
168
|
-
*
|
|
168
|
+
* A component used to render an icon.
|
|
169
169
|
*/
|
|
170
170
|
// @ts-expect-error: PropTypes are not expressive enough to cover this case
|
|
171
171
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
@@ -9,12 +9,12 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import React__default from 'react';
|
|
12
|
+
import { ArrowDown, ArrowUp } from '../../internal/keyboard/keys.js';
|
|
13
|
+
import { match } from '../../internal/keyboard/match.js';
|
|
12
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
15
|
import { warning } from '../../internal/warning.js';
|
|
14
16
|
import '../Text/index.js';
|
|
15
|
-
import { match } from '../../internal/keyboard/match.js';
|
|
16
17
|
import { Text } from '../Text/Text.js';
|
|
17
|
-
import { ArrowDown, ArrowUp } from '../../internal/keyboard/keys.js';
|
|
18
18
|
|
|
19
19
|
const OverflowMenuItem = /*#__PURE__*/React__default.forwardRef(function OverflowMenuItem(_ref, ref) {
|
|
20
20
|
let {
|
|
@@ -9,12 +9,12 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import React__default, { useState } from 'react';
|
|
12
|
+
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
13
|
+
import { matches } from '../../internal/keyboard/match.js';
|
|
12
14
|
import { Warning, Incomplete, CheckmarkOutline, CircleDash } from '@carbon/icons-react';
|
|
13
15
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
16
|
import '../Text/index.js';
|
|
15
|
-
import { matches } from '../../internal/keyboard/match.js';
|
|
16
17
|
import { Text } from '../Text/Text.js';
|
|
17
|
-
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
18
18
|
|
|
19
19
|
const defaultTranslations = {
|
|
20
20
|
'carbon.progress-step.complete': 'Complete',
|
|
@@ -10,15 +10,15 @@ import { RadioButtonChecked, RadioButton, CheckmarkFilled } from '@carbon/icons-
|
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
12
|
import React__default from 'react';
|
|
13
|
+
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
14
|
+
import { matches } from '../../internal/keyboard/match.js';
|
|
13
15
|
import { useFallbackId } from '../../internal/useId.js';
|
|
14
16
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
17
|
import deprecate from '../../prop-types/deprecate.js';
|
|
16
18
|
import { noopFn } from '../../internal/noopFn.js';
|
|
17
19
|
import '../Text/index.js';
|
|
18
20
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
19
|
-
import { matches } from '../../internal/keyboard/match.js';
|
|
20
21
|
import { Text } from '../Text/Text.js';
|
|
21
|
-
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
22
22
|
|
|
23
23
|
var _RadioButtonChecked, _RadioButton, _CheckmarkFilled;
|
|
24
24
|
const RadioTile = /*#__PURE__*/React__default.forwardRef(function RadioTile(_ref, ref) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
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.
|
|
@@ -62,8 +62,7 @@ export interface SearchProps extends InputPropsBase {
|
|
|
62
62
|
*/
|
|
63
63
|
placeholder?: string;
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
66
|
-
* Can be a React component class
|
|
65
|
+
* A component used to render an icon.
|
|
67
66
|
*/
|
|
68
67
|
renderIcon?: ComponentType | FunctionComponent;
|
|
69
68
|
/**
|
|
@@ -10,7 +10,8 @@ import { Close, Search as Search$1 } from '@carbon/icons-react';
|
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
12
|
import React__default, { useContext, useRef, useState } from 'react';
|
|
13
|
-
import {
|
|
13
|
+
import { Escape, Enter, Space } from '../../internal/keyboard/keys.js';
|
|
14
|
+
import { match } from '../../internal/keyboard/match.js';
|
|
14
15
|
import { useId } from '../../internal/useId.js';
|
|
15
16
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
16
17
|
import { composeEventHandlers } from '../../tools/events.js';
|
|
@@ -18,8 +19,6 @@ import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
|
18
19
|
import deprecate from '../../prop-types/deprecate.js';
|
|
19
20
|
import '../FluidForm/FluidForm.js';
|
|
20
21
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
21
|
-
import { match } from '../../internal/keyboard/match.js';
|
|
22
|
-
import { Escape, Enter, Space } from '../../internal/keyboard/keys.js';
|
|
23
22
|
|
|
24
23
|
var _Close;
|
|
25
24
|
const Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forwardRef) {
|
|
@@ -90,7 +89,7 @@ const Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forw
|
|
|
90
89
|
onChange(clearedEvt);
|
|
91
90
|
onClear();
|
|
92
91
|
setHasContent(false);
|
|
93
|
-
focus(
|
|
92
|
+
inputRef.current?.focus();
|
|
94
93
|
}
|
|
95
94
|
function handleChange(event) {
|
|
96
95
|
setHasContent(event.target.value !== '');
|
|
@@ -221,8 +220,7 @@ Search.propTypes = {
|
|
|
221
220
|
*/
|
|
222
221
|
placeholder: PropTypes.string,
|
|
223
222
|
/**
|
|
224
|
-
*
|
|
225
|
-
* Can be a React component class
|
|
223
|
+
* A component used to render an icon.
|
|
226
224
|
*/
|
|
227
225
|
// @ts-expect-error: PropTypes are not expressive enough to cover this case
|
|
228
226
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
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.
|
|
@@ -164,11 +164,6 @@ export interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
|
|
|
164
164
|
*/
|
|
165
165
|
warnText?: React.ReactNode;
|
|
166
166
|
}
|
|
167
|
-
interface CalcValueProps {
|
|
168
|
-
clientX?: number;
|
|
169
|
-
value?: number;
|
|
170
|
-
useRawValue?: boolean;
|
|
171
|
-
}
|
|
172
167
|
interface CalcLeftPercentProps {
|
|
173
168
|
clientX?: number;
|
|
174
169
|
value?: number;
|
|
@@ -355,11 +350,13 @@ declare class Slider extends PureComponent<SliderProps> {
|
|
|
355
350
|
*/
|
|
356
351
|
clamp(val: any, min: any, max: any): number;
|
|
357
352
|
/**
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
*
|
|
353
|
+
* Rounds a given value to the nearest step defined by the slider's `step`
|
|
354
|
+
* prop.
|
|
355
|
+
*
|
|
356
|
+
* @param value - The value to adjust to the nearest step. Defaults to `0`.
|
|
357
|
+
* @returns The value rounded to the precision determined by the step.
|
|
361
358
|
*/
|
|
362
|
-
nearestStepValue(value
|
|
359
|
+
nearestStepValue(value?: number): number;
|
|
363
360
|
/**
|
|
364
361
|
* Sets up "drag" event handlers and calls `this.onDrag` in case dragging
|
|
365
362
|
* started on somewhere other than the thumb without a corresponding "move"
|
|
@@ -413,46 +410,44 @@ declare class Slider extends PureComponent<SliderProps> {
|
|
|
413
410
|
onInputKeyDown: (evt: any) => void;
|
|
414
411
|
processNewInputValue: (input: HTMLInputElement) => void;
|
|
415
412
|
calcLeftPercent: ({ clientX, value, range }: CalcLeftPercentProps) => number;
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
calcValue: ({ clientX, value, useRawValue }: CalcValueProps) => {
|
|
413
|
+
/**
|
|
414
|
+
* Calculates the discrete value (snapped to the nearest step) along
|
|
415
|
+
* with the corresponding handle position percentage.
|
|
416
|
+
*/
|
|
417
|
+
calcDiscreteValueAndPercent: ({ leftPercent, }: {
|
|
418
|
+
/** The percentage representing the position on the track. */
|
|
419
|
+
leftPercent: number;
|
|
420
|
+
}) => {
|
|
421
|
+
discreteValue: number;
|
|
422
|
+
discretePercent: number;
|
|
423
|
+
};
|
|
424
|
+
/**
|
|
425
|
+
* Calculates the slider's value and handle position based on either a
|
|
426
|
+
* mouse/touch event or an explicit value.
|
|
427
|
+
*/
|
|
428
|
+
calcValue: ({ clientX, value, useRawValue, }: {
|
|
429
|
+
/** The x-coordinate from a mouse/touch event. */
|
|
430
|
+
clientX?: number;
|
|
431
|
+
/** Value to base the calculations on (if no `clientX`). */
|
|
432
|
+
value?: number;
|
|
433
|
+
/** Whether to bypass the stepping logic and use the raw value. */
|
|
434
|
+
useRawValue?: boolean;
|
|
435
|
+
}) => {
|
|
440
436
|
value: number | undefined;
|
|
441
437
|
left: number;
|
|
442
438
|
};
|
|
443
439
|
calcDistanceToHandle: (handle: HandlePosition, clientX: any) => number;
|
|
444
440
|
/**
|
|
445
|
-
*
|
|
441
|
+
* Calculates a new slider value based on the current value, a change delta,
|
|
442
|
+
* and a step.
|
|
446
443
|
*
|
|
447
|
-
* @param
|
|
448
|
-
*
|
|
449
|
-
* @param
|
|
450
|
-
*
|
|
451
|
-
*
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
*/
|
|
455
|
-
calcValueForDelta: (currentValue: any, delta: any, step?: number) => any;
|
|
444
|
+
* @param currentValue - The starting value from which the slider is moving.
|
|
445
|
+
* @param delta - The amount to adjust the current value by.
|
|
446
|
+
* @param step - The step. Defaults to `1`.
|
|
447
|
+
* @returns The new slider value, rounded to the same number of decimal places
|
|
448
|
+
* as the step.
|
|
449
|
+
*/
|
|
450
|
+
calcValueForDelta: (currentValue: number, delta: number, step?: number) => number;
|
|
456
451
|
/**
|
|
457
452
|
* Sets state relevant to the given handle position.
|
|
458
453
|
*
|
|
@@ -10,6 +10,7 @@ import React__default, { PureComponent } from 'react';
|
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { ArrowDown, ArrowLeft, ArrowUp, ArrowRight, Enter } from '../../internal/keyboard/keys.js';
|
|
13
|
+
import { matches } from '../../internal/keyboard/match.js';
|
|
13
14
|
import { PrefixContext } from '../../internal/usePrefix.js';
|
|
14
15
|
import deprecate from '../../prop-types/deprecate.js';
|
|
15
16
|
import { FeatureFlagContext } from '../FeatureFlags/index.js';
|
|
@@ -19,7 +20,6 @@ import '../Tooltip/DefinitionTooltip.js';
|
|
|
19
20
|
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
20
21
|
import { LowerHandle, LowerHandleFocus, UpperHandle, UpperHandleFocus } from './SliderHandles.js';
|
|
21
22
|
import { throttle } from '../../node_modules/es-toolkit/dist/compat/function/throttle.mjs.js';
|
|
22
|
-
import { matches } from '../../internal/keyboard/match.js';
|
|
23
23
|
import { Text } from '../Text/Text.js';
|
|
24
24
|
|
|
25
25
|
const ThumbWrapper = _ref => {
|
|
@@ -316,7 +316,7 @@ class Slider extends PureComponent {
|
|
|
316
316
|
value,
|
|
317
317
|
left
|
|
318
318
|
} = this.calcValue({
|
|
319
|
-
value: this.calcValueForDelta(currentValue, delta, this.props.step)
|
|
319
|
+
value: this.calcValueForDelta(currentValue ?? this.props.min, delta, this.props.step)
|
|
320
320
|
});
|
|
321
321
|
this.setValueLeftForHandle(this.state.activeHandle, {
|
|
322
322
|
value: this.nearestStepValue(value),
|
|
@@ -523,67 +523,65 @@ class Slider extends PureComponent {
|
|
|
523
523
|
// re-assure Typescript, return 0.
|
|
524
524
|
return 0;
|
|
525
525
|
});
|
|
526
|
-
|
|
526
|
+
/**
|
|
527
|
+
* Calculates the discrete value (snapped to the nearest step) along
|
|
528
|
+
* with the corresponding handle position percentage.
|
|
529
|
+
*/
|
|
530
|
+
_defineProperty(this, "calcDiscreteValueAndPercent", _ref3 => {
|
|
527
531
|
let {
|
|
528
|
-
leftPercent
|
|
529
|
-
range
|
|
532
|
+
leftPercent
|
|
530
533
|
} = _ref3;
|
|
531
534
|
const {
|
|
532
|
-
step = 1
|
|
535
|
+
step = 1,
|
|
536
|
+
min,
|
|
537
|
+
max
|
|
533
538
|
} = this.props;
|
|
534
|
-
const
|
|
535
|
-
|
|
536
|
-
const
|
|
537
|
-
|
|
538
|
-
|
|
539
|
+
const numSteps = Math.floor((max - min) / step) + ((max - min) % step === 0 ? 1 : 2);
|
|
540
|
+
/** Index of the step that corresponds to `leftPercent`. */
|
|
541
|
+
const stepIndex = Math.round(leftPercent * (numSteps - 1));
|
|
542
|
+
const discreteValue = stepIndex === numSteps - 1 ? max : min + step * stepIndex;
|
|
543
|
+
/** Percentage corresponding to the step index. */
|
|
544
|
+
const discretePercent = stepIndex / (numSteps - 1);
|
|
545
|
+
return {
|
|
546
|
+
discreteValue,
|
|
547
|
+
discretePercent
|
|
548
|
+
};
|
|
539
549
|
});
|
|
540
550
|
/**
|
|
541
|
-
* Calculates
|
|
542
|
-
*
|
|
543
|
-
* - If `clientX` is specified, it will be used in
|
|
544
|
-
* conjunction with the Slider's bounding rectangle to calculate the new
|
|
545
|
-
* values.
|
|
546
|
-
* - If `clientX` is not specified and `value` is, it will be used to
|
|
547
|
-
* calculate new values as though it were the current value of the Slider.
|
|
548
|
-
* - If neither `clientX` nor `value` are specified, `this.props.value` will
|
|
549
|
-
* be used to calculate the new values as though it were the current value
|
|
550
|
-
* of the Slider.
|
|
551
|
-
*
|
|
552
|
-
* @param {object} params
|
|
553
|
-
* @param {number} [params.clientX] Optional clientX value expected to be from
|
|
554
|
-
* an event fired by one of the Slider's `DRAG_EVENT_TYPES` events.
|
|
555
|
-
* @param {number} [params.value] Optional value use during calculations if
|
|
556
|
-
* clientX is not provided.
|
|
557
|
-
* @param {boolean} [params.useRawValue=false] `true` to use the given value as-is.
|
|
551
|
+
* Calculates the slider's value and handle position based on either a
|
|
552
|
+
* mouse/touch event or an explicit value.
|
|
558
553
|
*/
|
|
559
554
|
_defineProperty(this, "calcValue", _ref4 => {
|
|
560
555
|
let {
|
|
561
556
|
clientX,
|
|
562
557
|
value,
|
|
563
|
-
useRawValue
|
|
558
|
+
useRawValue
|
|
564
559
|
} = _ref4;
|
|
565
560
|
const range = this.props.max - this.props.min;
|
|
566
|
-
|
|
567
|
-
// @todo solve for rtl.
|
|
568
|
-
const leftPercent = this.calcLeftPercent({
|
|
561
|
+
const leftPercentRaw = this.calcLeftPercent({
|
|
569
562
|
clientX,
|
|
570
563
|
value,
|
|
571
564
|
range
|
|
572
565
|
});
|
|
566
|
+
/** `leftPercentRaw` clamped between 0 and 1. */
|
|
567
|
+
const leftPercent = Math.min(1, Math.max(0, leftPercentRaw));
|
|
573
568
|
if (useRawValue) {
|
|
574
|
-
// Adjusts only for min/max of thumb position
|
|
575
569
|
return {
|
|
576
570
|
value,
|
|
577
|
-
left:
|
|
571
|
+
left: leftPercent * 100
|
|
578
572
|
};
|
|
579
573
|
}
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
574
|
+
|
|
575
|
+
// Use the discrete value and percentage for snapping.
|
|
576
|
+
const {
|
|
577
|
+
discreteValue,
|
|
578
|
+
discretePercent
|
|
579
|
+
} = this.calcDiscreteValueAndPercent({
|
|
580
|
+
leftPercent
|
|
583
581
|
});
|
|
584
582
|
return {
|
|
585
|
-
value:
|
|
586
|
-
left:
|
|
583
|
+
value: discreteValue,
|
|
584
|
+
left: discretePercent * 100
|
|
587
585
|
};
|
|
588
586
|
});
|
|
589
587
|
_defineProperty(this, "calcDistanceToHandle", (handle, clientX) => {
|
|
@@ -593,19 +591,21 @@ class Slider extends PureComponent {
|
|
|
593
591
|
return Math.abs(handleX - clientX);
|
|
594
592
|
});
|
|
595
593
|
/**
|
|
596
|
-
*
|
|
594
|
+
* Calculates a new slider value based on the current value, a change delta,
|
|
595
|
+
* and a step.
|
|
597
596
|
*
|
|
598
|
-
* @param
|
|
599
|
-
*
|
|
600
|
-
* @param
|
|
601
|
-
*
|
|
602
|
-
*
|
|
603
|
-
* A value determining how much the value should increase/decrease by moving
|
|
604
|
-
* the thumb by mouse.
|
|
597
|
+
* @param currentValue - The starting value from which the slider is moving.
|
|
598
|
+
* @param delta - The amount to adjust the current value by.
|
|
599
|
+
* @param step - The step. Defaults to `1`.
|
|
600
|
+
* @returns The new slider value, rounded to the same number of decimal places
|
|
601
|
+
* as the step.
|
|
605
602
|
*/
|
|
606
603
|
_defineProperty(this, "calcValueForDelta", function (currentValue, delta) {
|
|
607
604
|
let step = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
608
|
-
|
|
605
|
+
const base = delta > 0 ? Math.floor(currentValue / step) * step : currentValue;
|
|
606
|
+
const newValue = base + delta;
|
|
607
|
+
const decimals = (step.toString().split('.')[1] || '').length;
|
|
608
|
+
return Number(newValue.toFixed(decimals));
|
|
609
609
|
});
|
|
610
610
|
/**
|
|
611
611
|
* Sets state relevant to the given handle position.
|
|
@@ -869,18 +869,16 @@ class Slider extends PureComponent {
|
|
|
869
869
|
}
|
|
870
870
|
|
|
871
871
|
/**
|
|
872
|
-
*
|
|
873
|
-
*
|
|
874
|
-
*
|
|
872
|
+
* Rounds a given value to the nearest step defined by the slider's `step`
|
|
873
|
+
* prop.
|
|
874
|
+
*
|
|
875
|
+
* @param value - The value to adjust to the nearest step. Defaults to `0`.
|
|
876
|
+
* @returns The value rounded to the precision determined by the step.
|
|
875
877
|
*/
|
|
876
|
-
nearestStepValue(
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
tempInput.max = `${this.props.max}`;
|
|
881
|
-
tempInput.step = `${this.props.step}`;
|
|
882
|
-
tempInput.value = `${value}`;
|
|
883
|
-
return parseFloat(tempInput.value);
|
|
878
|
+
nearestStepValue() {
|
|
879
|
+
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
880
|
+
const decimals = (this.props.step?.toString().split('.')[1] || '').length;
|
|
881
|
+
return Number(value.toFixed(decimals));
|
|
884
882
|
}
|
|
885
883
|
getClientXFromEvent(event) {
|
|
886
884
|
let clientX;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
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.
|
|
@@ -340,12 +340,9 @@ export interface TabProps extends HTMLAttributes<HTMLElement> {
|
|
|
340
340
|
*/
|
|
341
341
|
renderButton?(): ReactNode;
|
|
342
342
|
/**
|
|
343
|
-
*
|
|
344
|
-
* Can be a React component class
|
|
343
|
+
* A component used to render an icon.
|
|
345
344
|
*/
|
|
346
|
-
renderIcon?:
|
|
347
|
-
size: number;
|
|
348
|
-
}>;
|
|
345
|
+
renderIcon?: React.ElementType;
|
|
349
346
|
/**
|
|
350
347
|
* An optional label to render under the primary tab label.
|
|
351
348
|
* Only useful for contained tabs.
|
|
@@ -21,12 +21,13 @@ import { isElement } from 'react-is';
|
|
|
21
21
|
import '../Tooltip/DefinitionTooltip.js';
|
|
22
22
|
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
23
23
|
import { useControllableState } from '../../internal/useControllableState.js';
|
|
24
|
-
import { useEffectOnce } from '../../internal/useEffectOnce.js';
|
|
25
24
|
import { useId } from '../../internal/useId.js';
|
|
26
25
|
import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
|
|
27
26
|
import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
28
27
|
import { getInteractiveContent } from '../../internal/useNoInteractiveChildren.js';
|
|
29
28
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
29
|
+
import { ArrowRight, ArrowLeft, Home, End, ArrowDown, ArrowUp, Delete } from '../../internal/keyboard/keys.js';
|
|
30
|
+
import { matches, match } from '../../internal/keyboard/match.js';
|
|
30
31
|
import { usePressable } from './usePressable.js';
|
|
31
32
|
import deprecate from '../../prop-types/deprecate.js';
|
|
32
33
|
import { useEvent } from '../../internal/useEvent.js';
|
|
@@ -34,9 +35,7 @@ import { useMatchMedia } from '../../internal/useMatchMedia.js';
|
|
|
34
35
|
import '../Text/index.js';
|
|
35
36
|
import { BadgeIndicator } from '../BadgeIndicator/index.js';
|
|
36
37
|
import { debounce } from '../../node_modules/es-toolkit/dist/compat/function/debounce.mjs.js';
|
|
37
|
-
import { matches, match } from '../../internal/keyboard/match.js';
|
|
38
38
|
import { Text } from '../Text/Text.js';
|
|
39
|
-
import { ArrowRight, ArrowLeft, Home, End, ArrowDown, ArrowUp, Delete } from '../../internal/keyboard/keys.js';
|
|
40
39
|
|
|
41
40
|
var _ChevronLeft, _ChevronRight, _BadgeIndicator;
|
|
42
41
|
const verticalTabHeight = 64;
|
|
@@ -382,7 +381,7 @@ function TabList(_ref4) {
|
|
|
382
381
|
}
|
|
383
382
|
}
|
|
384
383
|
}
|
|
385
|
-
|
|
384
|
+
useEffect(() => {
|
|
386
385
|
const tab = tabs.current[selectedIndex];
|
|
387
386
|
if (scrollIntoView && tab) {
|
|
388
387
|
tab.scrollIntoView({
|
|
@@ -390,7 +389,7 @@ function TabList(_ref4) {
|
|
|
390
389
|
inline: 'nearest'
|
|
391
390
|
});
|
|
392
391
|
}
|
|
393
|
-
});
|
|
392
|
+
}, []);
|
|
394
393
|
useEffect(() => {
|
|
395
394
|
//adding 1 in calculation for firefox support
|
|
396
395
|
setIsNextButtonVisible(ref.current ? scrollLeft + buttonWidth + ref.current.clientWidth + 1 < ref.current.scrollWidth : false);
|
|
@@ -400,7 +399,7 @@ function TabList(_ref4) {
|
|
|
400
399
|
}
|
|
401
400
|
}
|
|
402
401
|
}, [scrollLeft, children, dismissable, isScrollable]);
|
|
403
|
-
|
|
402
|
+
useEffect(() => {
|
|
404
403
|
if (tabs.current[selectedIndex]?.disabled) {
|
|
405
404
|
const activeTabs = tabs.current.filter(tab => {
|
|
406
405
|
return !tab.disabled;
|
|
@@ -410,7 +409,7 @@ function TabList(_ref4) {
|
|
|
410
409
|
setSelectedIndex(tabs.current.indexOf(tab));
|
|
411
410
|
}
|
|
412
411
|
}
|
|
413
|
-
});
|
|
412
|
+
}, []);
|
|
414
413
|
useIsomorphicEffect(() => {
|
|
415
414
|
if (ref.current) {
|
|
416
415
|
// adding 1 in calculation for firefox support
|
|
@@ -624,7 +623,7 @@ function TabListVertical(_ref8) {
|
|
|
624
623
|
setActiveIndex(selectedIndex);
|
|
625
624
|
}
|
|
626
625
|
}
|
|
627
|
-
|
|
626
|
+
useEffect(() => {
|
|
628
627
|
if (tabs.current[selectedIndex]?.disabled) {
|
|
629
628
|
const activeTabs = tabs.current.filter(tab => {
|
|
630
629
|
return !tab.disabled;
|
|
@@ -634,7 +633,7 @@ function TabListVertical(_ref8) {
|
|
|
634
633
|
setSelectedIndex(tabs.current.indexOf(tab));
|
|
635
634
|
}
|
|
636
635
|
}
|
|
637
|
-
});
|
|
636
|
+
}, []);
|
|
638
637
|
useEffect(() => {
|
|
639
638
|
function handler() {
|
|
640
639
|
const containerHeight = ref.current?.offsetHeight;
|
|
@@ -1007,22 +1006,21 @@ Tab.propTypes = {
|
|
|
1007
1006
|
* Provide a handler that is invoked on the key down event for the control
|
|
1008
1007
|
*/
|
|
1009
1008
|
onKeyDown: PropTypes.func,
|
|
1010
|
-
|
|
1009
|
+
/**
|
|
1011
1010
|
* An optional parameter to allow overriding the anchor rendering.
|
|
1012
1011
|
* Useful for using Tab along with react-router or other client
|
|
1013
1012
|
* side router libraries.
|
|
1014
|
-
|
|
1013
|
+
*/
|
|
1015
1014
|
renderButton: PropTypes.func,
|
|
1016
1015
|
/**
|
|
1017
|
-
*
|
|
1018
|
-
* Can be a React component class
|
|
1016
|
+
* A component used to render an icon.
|
|
1019
1017
|
*/
|
|
1020
1018
|
// @ts-expect-error: Invalid prop type derivation
|
|
1021
1019
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
1022
|
-
|
|
1020
|
+
/**
|
|
1023
1021
|
* An optional label to render under the primary tab label.
|
|
1024
|
-
|
|
1025
|
-
|
|
1022
|
+
* Only useful for contained tabs.
|
|
1023
|
+
*/
|
|
1026
1024
|
secondaryLabel: PropTypes.string
|
|
1027
1025
|
};
|
|
1028
1026
|
|
|
@@ -1124,7 +1122,7 @@ const TabPanel = /*#__PURE__*/React__default.forwardRef(function TabPanel(_ref12
|
|
|
1124
1122
|
const className = cx(`${prefix}--tab-content`, customClassName, {
|
|
1125
1123
|
[`${prefix}--tab-content--interactive`]: interactiveContent
|
|
1126
1124
|
});
|
|
1127
|
-
|
|
1125
|
+
useEffect(() => {
|
|
1128
1126
|
if (!panel.current) {
|
|
1129
1127
|
return;
|
|
1130
1128
|
}
|
|
@@ -1133,7 +1131,7 @@ const TabPanel = /*#__PURE__*/React__default.forwardRef(function TabPanel(_ref12
|
|
|
1133
1131
|
setInteractiveContent(true);
|
|
1134
1132
|
setTabIndex(-1);
|
|
1135
1133
|
}
|
|
1136
|
-
});
|
|
1134
|
+
}, []);
|
|
1137
1135
|
|
|
1138
1136
|
// tabindex should only be 0 if no interactive content in children
|
|
1139
1137
|
useEffect(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
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.
|
|
@@ -30,8 +30,7 @@ export interface DismissibleTagBaseProps {
|
|
|
30
30
|
*/
|
|
31
31
|
onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
34
|
-
* Can be a React component class
|
|
33
|
+
* A component used to render an icon.
|
|
35
34
|
*/
|
|
36
35
|
renderIcon?: React.ElementType;
|
|
37
36
|
/**
|
|
@@ -86,8 +85,7 @@ declare const DismissibleTag: {
|
|
|
86
85
|
*/
|
|
87
86
|
onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
88
87
|
/**
|
|
89
|
-
*
|
|
90
|
-
* Can be a React component class
|
|
88
|
+
* A component used to render an icon.
|
|
91
89
|
*/
|
|
92
90
|
renderIcon: PropTypes.Requireable<object>;
|
|
93
91
|
/**
|