@carbon/react 1.92.1 → 1.93.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 +874 -838
- package/es/components/AILabel/index.js +4 -4
- package/es/components/Breadcrumb/BreadcrumbItem.js +1 -1
- package/es/components/Button/Button.js +2 -2
- package/es/components/ChatButton/ChatButton.js +1 -1
- package/es/components/Checkbox/Checkbox.js +1 -1
- package/es/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/es/components/CodeSnippet/CodeSnippet.js +9 -50
- package/es/components/ComboBox/ComboBox.d.ts +3 -11
- package/es/components/ComboBox/ComboBox.js +15 -25
- package/es/components/ComboButton/index.d.ts +5 -8
- package/es/components/ComboButton/index.js +9 -12
- package/es/components/ComposedModal/ComposedModal.js +19 -25
- package/es/components/DataTable/DataTable.d.ts +27 -16
- package/es/components/DataTable/DataTable.js +40 -39
- package/es/components/DataTable/Table.js +2 -2
- package/es/components/DataTable/TableBatchActions.d.ts +49 -10
- package/es/components/DataTable/TableBatchActions.js +26 -21
- package/es/components/DataTable/TableExpandHeader.js +2 -2
- package/es/components/DataTable/TableExpandRow.d.ts +4 -0
- package/es/components/DataTable/TableExpandRow.js +1 -1
- package/es/components/DataTable/TableHeader.d.ts +8 -10
- package/es/components/DataTable/TableHeader.js +11 -13
- package/es/components/DataTable/TableRow.js +7 -5
- package/es/components/DataTable/TableSlugRow.js +1 -1
- package/es/components/DataTable/TableToolbarMenu.js +1 -1
- package/es/components/DataTable/TableToolbarSearch.d.ts +8 -7
- package/es/components/DataTable/TableToolbarSearch.js +11 -11
- package/es/components/DataTable/index.d.ts +2 -2
- package/es/components/DataTable/state/sorting.d.ts +2 -2
- package/es/components/DataTable/state/sorting.js +1 -1
- package/es/components/DataTable/tools/sorting.js +1 -1
- package/es/components/DatePicker/DatePicker.js +9 -9
- package/es/components/DatePickerInput/DatePickerInput.js +5 -5
- package/es/components/Dialog/Dialog.js +6 -6
- package/es/components/Dropdown/Dropdown.d.ts +1 -1
- package/es/components/Dropdown/Dropdown.js +8 -8
- package/es/components/ErrorBoundary/ErrorBoundaryContext.js +1 -1
- package/es/components/FileUploader/FileUploader.js +4 -4
- package/es/components/FileUploader/FileUploaderButton.js +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/es/components/FileUploader/FileUploaderItem.js +2 -2
- package/es/components/FluidComboBox/FluidComboBox.d.ts +4 -7
- package/es/components/FluidComboBox/FluidComboBox.js +1 -1
- package/es/components/FluidDropdown/FluidDropdown.d.ts +4 -8
- package/es/components/FluidDropdown/FluidDropdown.js +1 -1
- package/es/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +3 -7
- package/es/components/FluidMultiSelect/FluidMultiSelect.d.ts +3 -7
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +3 -3
- package/es/components/FluidNumberInput/FluidNumberInput.d.ts +4 -7
- package/es/components/FluidNumberInput/FluidNumberInput.js +2 -2
- package/es/components/FluidSearch/FluidSearch.js +1 -1
- package/es/components/FluidSelect/FluidSelect.js +1 -1
- package/es/components/FluidTextInput/FluidTextInput.js +1 -1
- package/es/components/FluidTimePicker/FluidTimePicker.js +3 -3
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +1 -1
- package/es/components/Grid/CSSGrid.js +3 -3
- package/es/components/Grid/Column.js +2 -2
- package/es/components/Grid/ColumnHang.js +1 -1
- package/es/components/Grid/FlexGrid.js +1 -1
- package/es/components/Grid/Row.js +1 -1
- package/es/components/Heading/index.js +2 -2
- package/es/components/IconButton/index.js +2 -2
- package/es/components/IconIndicator/index.js +2 -2
- package/es/components/InlineCheckbox/InlineCheckbox.js +1 -1
- package/es/components/Layout/index.js +2 -2
- package/es/components/LayoutDirection/LayoutDirection.js +1 -1
- package/es/components/Link/Link.js +2 -2
- package/es/components/ListBox/ListBoxField.d.ts +0 -1
- package/es/components/ListBox/ListBoxMenuIcon.d.ts +8 -4
- package/es/components/ListBox/ListBoxMenuIcon.js +10 -6
- package/es/components/ListBox/ListBoxMenuItem.js +2 -2
- package/es/components/ListBox/ListBoxSelection.d.ts +3 -6
- package/es/components/ListBox/ListBoxSelection.js +5 -10
- package/es/components/ListBox/index.d.ts +5 -3
- package/es/components/ListBox/next/ListBoxSelection.d.ts +6 -13
- package/es/components/ListBox/next/ListBoxSelection.js +16 -8
- package/es/components/ListBox/next/ListBoxTrigger.d.ts +5 -10
- package/es/components/ListBox/next/ListBoxTrigger.js +6 -6
- package/es/components/Menu/MenuContext.js +1 -1
- package/es/components/Menu/MenuItem.js +1 -1
- package/es/components/MenuButton/index.js +5 -5
- package/es/components/Modal/Modal.js +17 -23
- package/es/components/ModalWrapper/ModalWrapper.js +2 -2
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +3 -12
- package/es/components/MultiSelect/FilterableMultiSelect.js +18 -27
- package/es/components/MultiSelect/MultiSelect.d.ts +2 -2
- package/es/components/MultiSelect/MultiSelect.js +12 -12
- package/es/components/Notification/Notification.js +1 -1
- package/es/components/NumberInput/NumberInput.d.ts +2 -5
- package/es/components/NumberInput/NumberInput.js +13 -18
- package/es/components/OverflowMenu/OverflowMenu.d.ts +2 -2
- package/es/components/OverflowMenu/OverflowMenu.js +4 -4
- package/es/components/OverflowMenu/next/index.d.ts +1 -1
- package/es/components/OverflowMenu/next/index.js +2 -2
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
- package/es/components/PageHeader/PageHeader.js +12 -12
- package/es/components/Pagination/Pagination.js +3 -3
- package/es/components/PaginationNav/PaginationNav.d.ts +6 -9
- package/es/components/PaginationNav/PaginationNav.js +21 -22
- package/es/components/Popover/index.js +10 -9
- package/es/components/ProgressBar/ProgressBar.js +2 -2
- package/es/components/ProgressIndicator/ProgressIndicator.d.ts +11 -15
- package/es/components/ProgressIndicator/ProgressIndicator.js +15 -15
- package/es/components/RadioButton/RadioButton.js +1 -1
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/es/components/RadioTile/RadioTile.js +1 -1
- package/es/components/Select/Select.js +7 -5
- package/es/components/ShapeIndicator/index.js +2 -2
- package/es/components/Slider/Slider.d.ts +7 -9
- package/es/components/Slider/Slider.js +16 -20
- package/es/components/Stack/HStack.js +1 -1
- package/es/components/Stack/Stack.js +1 -1
- package/es/components/Stack/VStack.js +1 -1
- package/es/components/StructuredList/StructuredList.js +3 -3
- package/es/components/Tabs/Tabs.js +12 -12
- package/es/components/Tag/DismissibleTag.js +3 -3
- package/es/components/Tag/OperationalTag.js +2 -2
- package/es/components/Tag/SelectableTag.js +2 -2
- package/es/components/Tag/Tag.js +4 -4
- package/es/components/Tag/isEllipsisActive.js +1 -1
- package/es/components/Text/Text.js +1 -1
- package/es/components/TextArea/TextArea.js +1 -1
- package/es/components/TextInput/PasswordInput.js +4 -4
- package/es/components/TextInput/TextInput.js +3 -3
- package/es/components/Theme/index.js +3 -3
- package/es/components/Tile/Tile.js +3 -3
- package/es/components/TimePicker/TimePicker.js +1 -1
- package/es/components/Toggletip/index.js +4 -4
- package/es/components/Tooltip/DefinitionTooltip.js +1 -1
- package/es/components/Tooltip/Tooltip.js +3 -3
- package/es/components/TreeView/TreeNode.js +6 -6
- package/es/components/TreeView/TreeView.js +5 -5
- package/es/components/UIShell/HeaderContainer.js +1 -1
- package/es/components/UIShell/HeaderMenu.js +1 -1
- package/es/components/UIShell/Link.js +2 -2
- package/es/components/UIShell/SideNavItems.js +1 -1
- package/es/components/UIShell/Switcher.js +1 -1
- package/es/components/UIShell/SwitcherItem.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/internal/FloatingMenu.js +4 -4
- package/es/internal/Selection.js +6 -6
- package/es/internal/useMergedRefs.js +1 -1
- package/es/internal/useNoInteractiveChildren.js +4 -4
- package/es/internal/useOutsideClick.js +1 -1
- package/es/internal/useOverflowItems.js +6 -6
- package/es/internal/useResizeObserver.js +3 -3
- package/es/internal/useSavedCallback.js +1 -1
- package/es/internal/warning.js +1 -1
- package/es/prop-types/isRequiredOneOf.js +2 -2
- package/es/tools/events.js +1 -1
- package/es/tools/wrapComponent.js +1 -1
- package/es/types/common.d.ts +6 -2
- package/lib/components/AILabel/index.js +4 -4
- package/lib/components/Breadcrumb/BreadcrumbItem.js +1 -1
- package/lib/components/Button/Button.js +2 -2
- package/lib/components/ChatButton/ChatButton.js +1 -1
- package/lib/components/Checkbox/Checkbox.js +1 -1
- package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/lib/components/CodeSnippet/CodeSnippet.js +8 -49
- package/lib/components/ComboBox/ComboBox.d.ts +3 -11
- package/lib/components/ComboBox/ComboBox.js +15 -25
- package/lib/components/ComboButton/index.d.ts +5 -8
- package/lib/components/ComboButton/index.js +9 -12
- package/lib/components/ComposedModal/ComposedModal.js +18 -24
- package/lib/components/DataTable/DataTable.d.ts +27 -16
- package/lib/components/DataTable/DataTable.js +40 -39
- package/lib/components/DataTable/Table.js +2 -2
- package/lib/components/DataTable/TableBatchActions.d.ts +49 -10
- package/lib/components/DataTable/TableBatchActions.js +26 -21
- package/lib/components/DataTable/TableExpandHeader.js +2 -2
- package/lib/components/DataTable/TableExpandRow.d.ts +4 -0
- package/lib/components/DataTable/TableExpandRow.js +1 -1
- package/lib/components/DataTable/TableHeader.d.ts +8 -10
- package/lib/components/DataTable/TableHeader.js +11 -13
- package/lib/components/DataTable/TableRow.js +7 -5
- package/lib/components/DataTable/TableSlugRow.js +1 -1
- package/lib/components/DataTable/TableToolbarMenu.js +1 -1
- package/lib/components/DataTable/TableToolbarSearch.d.ts +8 -7
- package/lib/components/DataTable/TableToolbarSearch.js +11 -11
- package/lib/components/DataTable/index.d.ts +2 -2
- package/lib/components/DataTable/state/sorting.d.ts +2 -2
- package/lib/components/DataTable/state/sorting.js +1 -1
- package/lib/components/DataTable/tools/sorting.js +1 -1
- package/lib/components/DatePicker/DatePicker.js +9 -9
- package/lib/components/DatePickerInput/DatePickerInput.js +5 -5
- package/lib/components/Dialog/Dialog.js +6 -6
- package/lib/components/Dropdown/Dropdown.d.ts +1 -1
- package/lib/components/Dropdown/Dropdown.js +8 -8
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +1 -1
- package/lib/components/FileUploader/FileUploader.js +4 -4
- package/lib/components/FileUploader/FileUploaderButton.js +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/lib/components/FileUploader/FileUploaderItem.js +2 -2
- package/lib/components/FluidComboBox/FluidComboBox.d.ts +4 -7
- package/lib/components/FluidComboBox/FluidComboBox.js +1 -1
- package/lib/components/FluidDropdown/FluidDropdown.d.ts +4 -8
- package/lib/components/FluidDropdown/FluidDropdown.js +1 -1
- package/lib/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +3 -7
- package/lib/components/FluidMultiSelect/FluidMultiSelect.d.ts +3 -7
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +3 -3
- package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +4 -7
- package/lib/components/FluidNumberInput/FluidNumberInput.js +2 -2
- package/lib/components/FluidSearch/FluidSearch.js +1 -1
- package/lib/components/FluidSelect/FluidSelect.js +1 -1
- package/lib/components/FluidTextInput/FluidTextInput.js +1 -1
- package/lib/components/FluidTimePicker/FluidTimePicker.js +3 -3
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +1 -1
- package/lib/components/Grid/CSSGrid.js +3 -3
- package/lib/components/Grid/Column.js +2 -2
- package/lib/components/Grid/ColumnHang.js +1 -1
- package/lib/components/Grid/FlexGrid.js +1 -1
- package/lib/components/Grid/Row.js +1 -1
- package/lib/components/Heading/index.js +2 -2
- package/lib/components/IconButton/index.js +2 -2
- package/lib/components/IconIndicator/index.js +2 -2
- package/lib/components/InlineCheckbox/InlineCheckbox.js +1 -1
- package/lib/components/Layout/index.js +2 -2
- package/lib/components/LayoutDirection/LayoutDirection.js +1 -1
- package/lib/components/Link/Link.js +2 -2
- package/lib/components/ListBox/ListBoxField.d.ts +0 -1
- package/lib/components/ListBox/ListBoxMenuIcon.d.ts +8 -4
- package/lib/components/ListBox/ListBoxMenuIcon.js +10 -6
- package/lib/components/ListBox/ListBoxMenuItem.js +2 -2
- package/lib/components/ListBox/ListBoxSelection.d.ts +3 -6
- package/lib/components/ListBox/ListBoxSelection.js +4 -10
- package/lib/components/ListBox/index.d.ts +5 -3
- package/lib/components/ListBox/next/ListBoxSelection.d.ts +6 -13
- package/lib/components/ListBox/next/ListBoxSelection.js +16 -8
- package/lib/components/ListBox/next/ListBoxTrigger.d.ts +5 -10
- package/lib/components/ListBox/next/ListBoxTrigger.js +5 -6
- package/lib/components/Menu/MenuContext.js +1 -1
- package/lib/components/Menu/MenuItem.js +1 -1
- package/lib/components/MenuButton/index.js +5 -5
- package/lib/components/Modal/Modal.js +16 -22
- package/lib/components/ModalWrapper/ModalWrapper.js +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +3 -12
- package/lib/components/MultiSelect/FilterableMultiSelect.js +18 -27
- package/lib/components/MultiSelect/MultiSelect.d.ts +2 -2
- package/lib/components/MultiSelect/MultiSelect.js +12 -12
- package/lib/components/Notification/Notification.js +1 -1
- package/lib/components/NumberInput/NumberInput.d.ts +2 -5
- package/lib/components/NumberInput/NumberInput.js +12 -18
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +2 -2
- package/lib/components/OverflowMenu/OverflowMenu.js +4 -4
- package/lib/components/OverflowMenu/next/index.d.ts +1 -1
- package/lib/components/OverflowMenu/next/index.js +2 -2
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
- package/lib/components/PageHeader/PageHeader.js +12 -12
- package/lib/components/Pagination/Pagination.js +3 -3
- package/lib/components/PaginationNav/PaginationNav.d.ts +6 -9
- package/lib/components/PaginationNav/PaginationNav.js +21 -22
- package/lib/components/Popover/index.js +10 -9
- package/lib/components/ProgressBar/ProgressBar.js +2 -2
- package/lib/components/ProgressIndicator/ProgressIndicator.d.ts +11 -15
- package/lib/components/ProgressIndicator/ProgressIndicator.js +15 -15
- package/lib/components/RadioButton/RadioButton.js +1 -1
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/lib/components/RadioTile/RadioTile.js +1 -1
- package/lib/components/Select/Select.js +7 -5
- package/lib/components/ShapeIndicator/index.js +2 -2
- package/lib/components/Slider/Slider.d.ts +7 -9
- package/lib/components/Slider/Slider.js +16 -20
- package/lib/components/Stack/HStack.js +1 -1
- package/lib/components/Stack/Stack.js +1 -1
- package/lib/components/Stack/VStack.js +1 -1
- package/lib/components/StructuredList/StructuredList.js +3 -3
- package/lib/components/Tabs/Tabs.js +12 -12
- package/lib/components/Tag/DismissibleTag.js +3 -3
- package/lib/components/Tag/OperationalTag.js +2 -2
- package/lib/components/Tag/SelectableTag.js +2 -2
- package/lib/components/Tag/Tag.js +4 -4
- package/lib/components/Tag/isEllipsisActive.js +1 -1
- package/lib/components/Text/Text.js +1 -1
- package/lib/components/TextArea/TextArea.js +1 -1
- package/lib/components/TextInput/PasswordInput.js +4 -4
- package/lib/components/TextInput/TextInput.js +3 -3
- package/lib/components/Theme/index.js +3 -3
- package/lib/components/Tile/Tile.js +3 -3
- package/lib/components/TimePicker/TimePicker.js +1 -1
- package/lib/components/Toggletip/index.js +4 -4
- package/lib/components/Tooltip/DefinitionTooltip.js +1 -1
- package/lib/components/Tooltip/Tooltip.js +3 -3
- package/lib/components/TreeView/TreeNode.js +6 -6
- package/lib/components/TreeView/TreeView.js +5 -5
- package/lib/components/UIShell/HeaderContainer.js +1 -1
- package/lib/components/UIShell/HeaderMenu.js +1 -1
- package/lib/components/UIShell/Link.js +2 -2
- package/lib/components/UIShell/SideNavItems.js +1 -1
- package/lib/components/UIShell/Switcher.js +1 -1
- package/lib/components/UIShell/SwitcherItem.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/internal/FloatingMenu.js +4 -4
- package/lib/internal/Selection.js +6 -6
- package/lib/internal/useMergedRefs.js +1 -1
- package/lib/internal/useNoInteractiveChildren.js +4 -4
- package/lib/internal/useOutsideClick.js +1 -1
- package/lib/internal/useOverflowItems.js +6 -6
- package/lib/internal/useResizeObserver.js +3 -3
- package/lib/internal/useSavedCallback.js +1 -1
- package/lib/internal/warning.js +1 -1
- package/lib/prop-types/isRequiredOneOf.js +2 -2
- package/lib/tools/events.js +1 -1
- package/lib/tools/wrapComponent.js +1 -1
- package/lib/types/common.d.ts +6 -2
- package/package.json +9 -9
|
@@ -15,7 +15,7 @@ import '../FluidTextInput/FluidTextInput.Skeleton.js';
|
|
|
15
15
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
16
16
|
import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
|
|
17
17
|
|
|
18
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
18
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
19
19
|
const FluidTimePicker = /*#__PURE__*/React.forwardRef(({
|
|
20
20
|
className,
|
|
21
21
|
children,
|
|
@@ -48,7 +48,7 @@ const FluidTimePicker = /*#__PURE__*/React.forwardRef(({
|
|
|
48
48
|
if (disabled) {
|
|
49
49
|
return React.Children.toArray(children).map(child =>
|
|
50
50
|
/*#__PURE__*/
|
|
51
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
52
52
|
React.cloneElement(child, {
|
|
53
53
|
disabled: true
|
|
54
54
|
}));
|
|
@@ -56,7 +56,7 @@ const FluidTimePicker = /*#__PURE__*/React.forwardRef(({
|
|
|
56
56
|
if (readOnly) {
|
|
57
57
|
return React.Children.toArray(children).map(child =>
|
|
58
58
|
/*#__PURE__*/
|
|
59
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
60
60
|
React.cloneElement(child, {
|
|
61
61
|
readOnly: true
|
|
62
62
|
}));
|
|
@@ -11,7 +11,7 @@ import PropTypes from 'prop-types';
|
|
|
11
11
|
import FluidSelect from '../FluidSelect/FluidSelect.js';
|
|
12
12
|
import '../FluidSelect/FluidSelect.Skeleton.js';
|
|
13
13
|
|
|
14
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
14
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
15
15
|
const FluidTimePickerSelect = /*#__PURE__*/React.forwardRef(({
|
|
16
16
|
children,
|
|
17
17
|
className,
|
|
@@ -12,7 +12,7 @@ import React from 'react';
|
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
import { useGridSettings, GridSettings } from './GridContext.js';
|
|
14
14
|
|
|
15
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
15
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
16
16
|
const CSSGrid = /*#__PURE__*/React.forwardRef(({
|
|
17
17
|
align,
|
|
18
18
|
as,
|
|
@@ -96,9 +96,9 @@ CSSGrid.propTypes = {
|
|
|
96
96
|
narrow: PropTypes.bool
|
|
97
97
|
};
|
|
98
98
|
|
|
99
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
100
100
|
|
|
101
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
101
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
102
102
|
const Subgrid = /*#__PURE__*/React.forwardRef(({
|
|
103
103
|
as,
|
|
104
104
|
className: customClassName,
|
|
@@ -13,7 +13,7 @@ import React from 'react';
|
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
14
|
import { useGridSettings } from './GridContext.js';
|
|
15
15
|
|
|
16
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
16
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
17
17
|
const Column = /*#__PURE__*/React.forwardRef(({
|
|
18
18
|
as,
|
|
19
19
|
children,
|
|
@@ -116,7 +116,7 @@ Column.propTypes = {
|
|
|
116
116
|
xlg: spanPropType
|
|
117
117
|
};
|
|
118
118
|
|
|
119
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any , react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
119
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any , react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
120
120
|
const CSSGridColumn = /*#__PURE__*/React.forwardRef(({
|
|
121
121
|
as: BaseComponent = 'div',
|
|
122
122
|
children,
|
|
@@ -24,7 +24,7 @@ function ColumnHang({
|
|
|
24
24
|
const prefix = usePrefix();
|
|
25
25
|
const className = cx(customClassName, `${prefix}--grid-column-hang`);
|
|
26
26
|
// cast as any to let TypeScript allow passing in attributes to base component
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
28
28
|
const BaseComponentAsAny = BaseComponent;
|
|
29
29
|
return /*#__PURE__*/React.createElement(BaseComponentAsAny, _extends({}, rest, {
|
|
30
30
|
className: className
|
|
@@ -12,7 +12,7 @@ import React from 'react';
|
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
import { GridSettings } from './GridContext.js';
|
|
14
14
|
|
|
15
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
15
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
16
16
|
const FlexGrid = /*#__PURE__*/React.forwardRef(({
|
|
17
17
|
as,
|
|
18
18
|
condensed = false,
|
|
@@ -26,7 +26,7 @@ function Row({
|
|
|
26
26
|
[`${prefix}--row--narrow`]: narrow
|
|
27
27
|
});
|
|
28
28
|
// TypeScript type validation reports conflicts on different instances of keyof JSX.IntrinsicElements
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
30
30
|
const BaseComponentAsAny = BaseComponent;
|
|
31
31
|
return /*#__PURE__*/React.createElement(BaseComponentAsAny, _extends({
|
|
32
32
|
className: className
|
|
@@ -17,7 +17,7 @@ const Section = /*#__PURE__*/React.forwardRef(function Section({
|
|
|
17
17
|
}, ref) {
|
|
18
18
|
const parentLevel = React.useContext(HeadingContext);
|
|
19
19
|
const level = levelOverride ?? parentLevel + 1;
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
21
21
|
const BaseComponentAsAny = BaseComponent;
|
|
22
22
|
return /*#__PURE__*/React.createElement(HeadingContext.Provider, {
|
|
23
23
|
value: Math.min(level, 6)
|
|
@@ -44,7 +44,7 @@ Section.propTypes = {
|
|
|
44
44
|
*/
|
|
45
45
|
level: PropTypes.number
|
|
46
46
|
};
|
|
47
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
47
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
48
48
|
const Heading = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
49
49
|
const HeadingIntrinsic = `h${React.useContext(HeadingContext)}`;
|
|
50
50
|
return /*#__PURE__*/React.createElement(HeadingIntrinsic, _extends({
|
|
@@ -19,7 +19,7 @@ import { BadgeIndicator } from '../BadgeIndicator/index.js';
|
|
|
19
19
|
import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
|
|
20
20
|
|
|
21
21
|
const IconButtonKinds = ['primary', 'secondary', 'ghost', 'tertiary'];
|
|
22
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
22
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
23
23
|
const IconButton = /*#__PURE__*/React.forwardRef(({
|
|
24
24
|
align,
|
|
25
25
|
autoAlign = false,
|
|
@@ -45,7 +45,7 @@ const IconButton = /*#__PURE__*/React.forwardRef(({
|
|
|
45
45
|
[`${prefix}--icon-tooltip--disabled`]: disabled
|
|
46
46
|
});
|
|
47
47
|
if (badgeCount && (kind !== 'ghost' || size !== 'lg')) {
|
|
48
|
-
// eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/
|
|
48
|
+
// eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
49
49
|
console.warn("The prop BadgeCount must be used with hasIconOnly=true, kind='ghost' and size='lg'");
|
|
50
50
|
}
|
|
51
51
|
const badgeId = useId('badge-indicator');
|
|
@@ -26,13 +26,13 @@ const iconTypes = {
|
|
|
26
26
|
unknown: UnknownFilled,
|
|
27
27
|
informative: WarningSquareFilled
|
|
28
28
|
};
|
|
29
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
29
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
30
30
|
const IconIndicator = /*#__PURE__*/React.forwardRef(({
|
|
31
31
|
className: customClassName,
|
|
32
32
|
kind,
|
|
33
33
|
label,
|
|
34
34
|
size = 16,
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
36
36
|
...rest
|
|
37
37
|
}, ref) => {
|
|
38
38
|
const prefix = usePrefix();
|
|
@@ -11,7 +11,7 @@ import { deprecate } from '../../prop-types/deprecate.js';
|
|
|
11
11
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
12
12
|
import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
13
13
|
|
|
14
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
14
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
15
15
|
const InlineCheckbox = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
|
|
16
16
|
const {
|
|
17
17
|
['aria-label']: ariaLabel,
|
|
@@ -22,7 +22,7 @@ const densities = ['condensed', 'normal'];
|
|
|
22
22
|
* Size of components within this layout
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
25
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
26
26
|
const Layout = /*#__PURE__*/React.forwardRef(({
|
|
27
27
|
as: BaseComponent = 'div',
|
|
28
28
|
children,
|
|
@@ -65,7 +65,7 @@ Layout.propTypes = {
|
|
|
65
65
|
*/
|
|
66
66
|
size: PropTypes.oneOf(sizes)
|
|
67
67
|
};
|
|
68
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
68
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
69
69
|
const LayoutConstraint = /*#__PURE__*/React.forwardRef(({
|
|
70
70
|
as: BaseComponent = 'div',
|
|
71
71
|
children,
|
|
@@ -10,7 +10,7 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import { LayoutDirectionContext } from './LayoutDirectionContext.js';
|
|
12
12
|
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
14
14
|
|
|
15
15
|
function LayoutDirection({
|
|
16
16
|
as: BaseComponent = 'div',
|
|
@@ -12,7 +12,7 @@ import React from 'react';
|
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
|
|
14
14
|
// First create the component with basic types
|
|
15
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
15
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
16
16
|
const LinkBase = /*#__PURE__*/React.forwardRef(({
|
|
17
17
|
as: BaseComponent,
|
|
18
18
|
children,
|
|
@@ -49,7 +49,7 @@ const LinkBase = /*#__PURE__*/React.forwardRef(({
|
|
|
49
49
|
linkProps['aria-disabled'] = true;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
53
53
|
const BaseComponentAsAny = BaseComponent ?? 'a';
|
|
54
54
|
const handleOnClick = event => {
|
|
55
55
|
if (disabled) {
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React, { type HTMLAttributes } from 'react';
|
|
8
|
-
export declare const translationIds: {};
|
|
9
8
|
export interface ListBoxFieldProps extends HTMLAttributes<HTMLDivElement> {
|
|
10
9
|
/**
|
|
11
10
|
* Specify if the parent <ListBox> is disabled
|
|
@@ -1,13 +1,17 @@
|
|
|
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 React from 'react';
|
|
8
|
-
import { TranslateWithId } from '../../types/common';
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
import type { TranslateWithId } from '../../types/common';
|
|
9
|
+
declare const translationIds: {
|
|
10
|
+
readonly 'close.menu': "close.menu";
|
|
11
|
+
readonly 'open.menu': "open.menu";
|
|
12
|
+
};
|
|
13
|
+
type TranslationKey = keyof typeof translationIds;
|
|
14
|
+
export interface ListBoxMenuIconProps extends TranslateWithId<TranslationKey> {
|
|
11
15
|
/**
|
|
12
16
|
* Specify whether the menu is currently open, which will influence the
|
|
13
17
|
* direction of the menu icon
|
|
@@ -11,11 +11,17 @@ import PropTypes from 'prop-types';
|
|
|
11
11
|
import { ChevronDown } from '@carbon/icons-react';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
|
|
14
|
+
const translationIds = {
|
|
15
|
+
'close.menu': 'close.menu',
|
|
16
|
+
'open.menu': 'open.menu'
|
|
17
|
+
};
|
|
14
18
|
const defaultTranslations = {
|
|
15
|
-
'close.menu': 'Close menu',
|
|
16
|
-
'open.menu': 'Open menu'
|
|
19
|
+
[translationIds['close.menu']]: 'Close menu',
|
|
20
|
+
[translationIds['open.menu']]: 'Open menu'
|
|
21
|
+
};
|
|
22
|
+
const defaultTranslateWithId = messageId => {
|
|
23
|
+
return defaultTranslations[messageId];
|
|
17
24
|
};
|
|
18
|
-
const defaultTranslateWithId = id => defaultTranslations[id];
|
|
19
25
|
/**
|
|
20
26
|
* `ListBoxMenuIcon` is used to orient the icon up or down depending on the
|
|
21
27
|
* state of the menu for a given `ListBox`
|
|
@@ -43,9 +49,7 @@ ListBoxMenuIcon.propTypes = {
|
|
|
43
49
|
*/
|
|
44
50
|
isOpen: PropTypes.bool.isRequired,
|
|
45
51
|
/**
|
|
46
|
-
*
|
|
47
|
-
* icon. This function takes a ListBoxMenuIconTranslationKey and should
|
|
48
|
-
* return a string message for that given message id.
|
|
52
|
+
* Translates component strings using your i18n tool.
|
|
49
53
|
*/
|
|
50
54
|
translateWithId: PropTypes.func
|
|
51
55
|
};
|
|
@@ -23,7 +23,7 @@ import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
|
23
23
|
* @returns An object containing the truncation state and the merged ref.
|
|
24
24
|
*/
|
|
25
25
|
const useIsTruncated = (forwardedRef,
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
27
27
|
deps = []) => {
|
|
28
28
|
const localRef = useRef(null);
|
|
29
29
|
const mergedRef = useMergedRefs([...(forwardedRef ? [forwardedRef] : []), localRef]);
|
|
@@ -37,7 +37,7 @@ deps = []) => {
|
|
|
37
37
|
} = element;
|
|
38
38
|
setIsTruncated(offsetWidth < scrollWidth);
|
|
39
39
|
}
|
|
40
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
40
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
41
41
|
}, [localRef, ...deps]);
|
|
42
42
|
return {
|
|
43
43
|
isTruncated,
|
|
@@ -1,12 +1,12 @@
|
|
|
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 React from 'react';
|
|
8
8
|
import { KeyboardEvent, MouseEvent } from 'react';
|
|
9
|
-
import { TranslateWithId } from '../../types/common';
|
|
9
|
+
import type { TranslateWithId } from '../../types/common';
|
|
10
10
|
export interface ListBoxSelectionProps extends TranslateWithId<TranslationKey> {
|
|
11
11
|
/**
|
|
12
12
|
* Specify a function to be invoked when a user interacts with the clear
|
|
@@ -33,13 +33,10 @@ export interface ListBoxSelectionProps extends TranslateWithId<TranslationKey> {
|
|
|
33
33
|
selectionCount?: number;
|
|
34
34
|
}
|
|
35
35
|
export type ListBoxSelectionComponent = React.FC<ListBoxSelectionProps>;
|
|
36
|
-
|
|
36
|
+
declare const translationIds: {
|
|
37
37
|
readonly 'clear.all': "clear.all";
|
|
38
38
|
readonly 'clear.selection': "clear.selection";
|
|
39
39
|
};
|
|
40
|
-
/**
|
|
41
|
-
* Message ids that will be passed to translateWithId().
|
|
42
|
-
*/
|
|
43
40
|
type TranslationKey = keyof typeof translationIds;
|
|
44
41
|
/**
|
|
45
42
|
* `ListBoxSelection` is used to provide controls for clearing a selection, in
|
|
@@ -16,16 +16,13 @@ const translationIds = {
|
|
|
16
16
|
'clear.all': 'clear.all',
|
|
17
17
|
'clear.selection': 'clear.selection'
|
|
18
18
|
};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Message ids that will be passed to translateWithId().
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
19
|
const defaultTranslations = {
|
|
25
20
|
[translationIds['clear.all']]: 'Clear all selected items',
|
|
26
21
|
[translationIds['clear.selection']]: 'Clear selected item'
|
|
27
22
|
};
|
|
28
|
-
const defaultTranslateWithId =
|
|
23
|
+
const defaultTranslateWithId = messageId => {
|
|
24
|
+
return defaultTranslations[messageId];
|
|
25
|
+
};
|
|
29
26
|
|
|
30
27
|
/**
|
|
31
28
|
* `ListBoxSelection` is used to provide controls for clearing a selection, in
|
|
@@ -108,11 +105,9 @@ ListBoxSelection.propTypes = {
|
|
|
108
105
|
*/
|
|
109
106
|
selectionCount: PropTypes.number,
|
|
110
107
|
/**
|
|
111
|
-
*
|
|
112
|
-
* icon. This function takes in an id defined in `translationIds` and should
|
|
113
|
-
* return a string message for that given message id.
|
|
108
|
+
* Translates component strings using your i18n tool.
|
|
114
109
|
*/
|
|
115
110
|
translateWithId: PropTypes.func
|
|
116
111
|
};
|
|
117
112
|
|
|
118
|
-
export { ListBoxSelection as default
|
|
113
|
+
export { ListBoxSelection as default };
|
|
@@ -5,12 +5,13 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
export * from './ListBoxPropTypes';
|
|
8
|
+
import type { ComponentProps } from 'react';
|
|
8
9
|
import ListBoxInternal from './ListBox';
|
|
9
10
|
import { ListBoxFieldComponent } from './ListBoxField';
|
|
10
11
|
import ListBoxMenu from './ListBoxMenu';
|
|
11
|
-
import { ListBoxMenuIconComponent } from './ListBoxMenuIcon';
|
|
12
|
+
import ListBoxMenuIcon, { ListBoxMenuIconComponent } from './ListBoxMenuIcon';
|
|
12
13
|
import ListBoxMenuItem from './ListBoxMenuItem';
|
|
13
|
-
import { ListBoxSelectionComponent } from './ListBoxSelection';
|
|
14
|
+
import ListBoxSelection, { ListBoxSelectionComponent } from './ListBoxSelection';
|
|
14
15
|
type ListBoxMenuComponent = typeof ListBoxMenu;
|
|
15
16
|
type ListBoxMenuItemComponent = typeof ListBoxMenuItem;
|
|
16
17
|
type ListBoxPartialComponent = typeof ListBoxInternal;
|
|
@@ -23,4 +24,5 @@ export interface ListBoxComponent extends ListBoxPartialComponent {
|
|
|
23
24
|
}
|
|
24
25
|
declare const ListBox: ListBoxComponent;
|
|
25
26
|
export default ListBox;
|
|
26
|
-
export type
|
|
27
|
+
export type ListBoxMenuIconTranslationKey = Parameters<NonNullable<ComponentProps<typeof ListBoxMenuIcon>['translateWithId']>>[0];
|
|
28
|
+
export type ListBoxSelectionTranslationKey = Parameters<NonNullable<ComponentProps<typeof ListBoxSelection>['translateWithId']>>[0];
|
|
@@ -1,22 +1,23 @@
|
|
|
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 React from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
|
+
import type { TranslateWithId } from '../../../types/common';
|
|
9
10
|
/**
|
|
10
11
|
* `ListBoxSelection` is used to provide controls for clearing a selection, in
|
|
11
12
|
* addition to conditionally rendering a badge if the control has more than one
|
|
12
13
|
* selection.
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
|
+
declare const translationIds: {
|
|
15
16
|
readonly 'clear.all': "clear.all";
|
|
16
17
|
readonly 'clear.selection': "clear.selection";
|
|
17
18
|
};
|
|
18
|
-
|
|
19
|
-
export interface ListBoxSelectionProps {
|
|
19
|
+
type TranslationKey = keyof typeof translationIds;
|
|
20
|
+
export interface ListBoxSelectionProps extends TranslateWithId<TranslationKey> {
|
|
20
21
|
/**
|
|
21
22
|
* Specify a function to be invoked when a user interacts with the clear
|
|
22
23
|
* selection element.
|
|
@@ -27,12 +28,6 @@ export interface ListBoxSelectionProps {
|
|
|
27
28
|
* whether the selection should display a badge or a single clear icon.
|
|
28
29
|
*/
|
|
29
30
|
selectionCount?: number;
|
|
30
|
-
/**
|
|
31
|
-
* i18n hook used to provide the appropriate description for the given menu
|
|
32
|
-
* icon. This function takes in an id defined in `translationIds` and should
|
|
33
|
-
* return a string message for that given message id.
|
|
34
|
-
*/
|
|
35
|
-
translateWithId?: (id: TranslationKey) => string;
|
|
36
31
|
/**
|
|
37
32
|
* Specify whether or not the clear selection element should be disabled
|
|
38
33
|
*/
|
|
@@ -104,9 +99,7 @@ declare namespace ListBoxSelection {
|
|
|
104
99
|
*/
|
|
105
100
|
selectionCount: PropTypes.Requireable<number>;
|
|
106
101
|
/**
|
|
107
|
-
*
|
|
108
|
-
* icon. This function takes in an id defined in `translationIds` and should
|
|
109
|
-
* return a string message for that given message id.
|
|
102
|
+
* Translates component strings using your i18n tool.
|
|
110
103
|
*/
|
|
111
104
|
translateWithId: PropTypes.Requireable<(...args: any[]) => any>;
|
|
112
105
|
};
|
|
@@ -13,13 +13,23 @@ import { Close } from '@carbon/icons-react';
|
|
|
13
13
|
import { usePrefix } from '../../../internal/usePrefix.js';
|
|
14
14
|
|
|
15
15
|
var _Close, _Close2;
|
|
16
|
+
/**
|
|
17
|
+
* `ListBoxSelection` is used to provide controls for clearing a selection, in
|
|
18
|
+
* addition to conditionally rendering a badge if the control has more than one
|
|
19
|
+
* selection.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const translationIds = {
|
|
23
|
+
'clear.all': 'clear.all',
|
|
24
|
+
'clear.selection': 'clear.selection'
|
|
25
|
+
};
|
|
16
26
|
const defaultTranslations = {
|
|
17
|
-
'clear.all': 'Clear all selected items',
|
|
18
|
-
'clear.selection': 'Clear selected item'
|
|
27
|
+
[translationIds['clear.all']]: 'Clear all selected items',
|
|
28
|
+
[translationIds['clear.selection']]: 'Clear selected item'
|
|
29
|
+
};
|
|
30
|
+
const defaultTranslateWithId = messageId => {
|
|
31
|
+
return defaultTranslations[messageId];
|
|
19
32
|
};
|
|
20
|
-
function defaultTranslateWithId(id) {
|
|
21
|
-
return defaultTranslations[id];
|
|
22
|
-
}
|
|
23
33
|
function ListBoxSelection({
|
|
24
34
|
clearSelection,
|
|
25
35
|
selectionCount,
|
|
@@ -116,9 +126,7 @@ ListBoxSelection.propTypes = {
|
|
|
116
126
|
*/
|
|
117
127
|
selectionCount: PropTypes.number,
|
|
118
128
|
/**
|
|
119
|
-
*
|
|
120
|
-
* icon. This function takes in an id defined in `translationIds` and should
|
|
121
|
-
* return a string message for that given message id.
|
|
129
|
+
* Translates component strings using your i18n tool.
|
|
122
130
|
*/
|
|
123
131
|
translateWithId: PropTypes.func
|
|
124
132
|
};
|
|
@@ -1,27 +1,22 @@
|
|
|
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 React from 'react';
|
|
8
|
-
|
|
8
|
+
import type { TranslateWithId } from '../../../types/common';
|
|
9
|
+
declare const translationIds: {
|
|
9
10
|
readonly 'close.menu': "close.menu";
|
|
10
11
|
readonly 'open.menu': "open.menu";
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
-
export interface ListBoxTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
13
|
+
type TranslationKey = keyof typeof translationIds;
|
|
14
|
+
export interface ListBoxTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, TranslateWithId<TranslationKey> {
|
|
14
15
|
/**
|
|
15
16
|
* Specify whether the menu is currently open, which will influence the
|
|
16
17
|
* direction of the menu icon
|
|
17
18
|
*/
|
|
18
19
|
isOpen: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* i18n hook used to provide the appropriate description for the given menu
|
|
21
|
-
* icon. This function takes in an id defined in `translationIds` and should
|
|
22
|
-
* return a string message for that given message id.
|
|
23
|
-
*/
|
|
24
|
-
translateWithId?: (id: TranslationKey) => string;
|
|
25
20
|
}
|
|
26
21
|
/**
|
|
27
22
|
* `ListBoxTrigger` is used to orient the icon up or down depending on the
|
|
@@ -21,13 +21,15 @@ const defaultTranslations = {
|
|
|
21
21
|
[translationIds['close.menu']]: 'Close',
|
|
22
22
|
[translationIds['open.menu']]: 'Open'
|
|
23
23
|
};
|
|
24
|
-
const defaultTranslateWithId =
|
|
24
|
+
const defaultTranslateWithId = messageId => {
|
|
25
|
+
return defaultTranslations[messageId];
|
|
26
|
+
};
|
|
25
27
|
/**
|
|
26
28
|
* `ListBoxTrigger` is used to orient the icon up or down depending on the
|
|
27
29
|
* state of the menu for a given `ListBox`
|
|
28
30
|
*/
|
|
29
31
|
|
|
30
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
32
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
31
33
|
const ListBoxTrigger = /*#__PURE__*/React.forwardRef(({
|
|
32
34
|
isOpen,
|
|
33
35
|
translateWithId: t = defaultTranslateWithId,
|
|
@@ -55,11 +57,9 @@ ListBoxTrigger.propTypes = {
|
|
|
55
57
|
*/
|
|
56
58
|
isOpen: PropTypes.bool.isRequired,
|
|
57
59
|
/**
|
|
58
|
-
*
|
|
59
|
-
* icon. This function takes in an id defined in `translationIds` and should
|
|
60
|
-
* return a string message for that given message id.
|
|
60
|
+
* Translates component strings using your i18n tool.
|
|
61
61
|
*/
|
|
62
62
|
translateWithId: PropTypes.func
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
-
export { ListBoxTrigger as default
|
|
65
|
+
export { ListBoxTrigger as default };
|
|
@@ -44,7 +44,7 @@ function menuReducer(state, action) {
|
|
|
44
44
|
const MenuContext = /*#__PURE__*/createContext({
|
|
45
45
|
state: menuDefaultState,
|
|
46
46
|
// 'dispatch' is populated by the root menu
|
|
47
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
48
48
|
dispatch: _ => {}
|
|
49
49
|
});
|
|
50
50
|
|
|
@@ -342,7 +342,7 @@ const MenuItemRadioGroup = /*#__PURE__*/forwardRef(function MenuItemRadioGroup({
|
|
|
342
342
|
onChange,
|
|
343
343
|
defaultValue: defaultSelectedItem ?? {}
|
|
344
344
|
});
|
|
345
|
-
//eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
345
|
+
//eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
346
346
|
function handleClick(item, e) {
|
|
347
347
|
setSelection(item);
|
|
348
348
|
}
|
|
@@ -23,7 +23,7 @@ import { mergeRefs } from '../../tools/mergeRefs.js';
|
|
|
23
23
|
|
|
24
24
|
const validButtonKinds = ['primary', 'tertiary', 'ghost'];
|
|
25
25
|
const defaultButtonKind = 'primary';
|
|
26
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
26
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
27
27
|
const MenuButton = /*#__PURE__*/forwardRef(({
|
|
28
28
|
children,
|
|
29
29
|
className,
|
|
@@ -42,7 +42,7 @@ const MenuButton = /*#__PURE__*/forwardRef(({
|
|
|
42
42
|
const id = useId('MenuButton');
|
|
43
43
|
const prefix = usePrefix();
|
|
44
44
|
const triggerRef = useRef(null);
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
46
46
|
let middlewares = [];
|
|
47
47
|
if (!enableOnlyFloatingStyles) {
|
|
48
48
|
middlewares = [flip({
|
|
@@ -161,7 +161,7 @@ MenuButton.propTypes = {
|
|
|
161
161
|
/**
|
|
162
162
|
* Specify the type of button to be used as the base for the trigger button.
|
|
163
163
|
*/
|
|
164
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/
|
|
164
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
165
165
|
// @ts-ignore-next-line -- avoid spurious (?) TS2322 error
|
|
166
166
|
kind: PropTypes.oneOf(validButtonKinds),
|
|
167
167
|
/**
|
|
@@ -175,13 +175,13 @@ MenuButton.propTypes = {
|
|
|
175
175
|
/**
|
|
176
176
|
* Specify the size of the button and menu.
|
|
177
177
|
*/
|
|
178
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/
|
|
178
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
179
179
|
// @ts-ignore-next-line -- avoid spurious (?) TS2322 error
|
|
180
180
|
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg']),
|
|
181
181
|
/**
|
|
182
182
|
* Specify the tabIndex of the button.
|
|
183
183
|
*/
|
|
184
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/
|
|
184
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
185
185
|
// @ts-ignore-next-line -- avoid spurious (?) TS2322 error
|
|
186
186
|
tabIndex: PropTypes.number,
|
|
187
187
|
/**
|