@carbon/react 1.90.0-rc.0 → 1.91.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 +923 -964
- package/es/components/AILabel/index.js +8 -6
- package/es/components/Breadcrumb/BreadcrumbItem.js +2 -0
- package/es/components/Button/Button.js +3 -0
- package/es/components/ChatButton/ChatButton.js +1 -0
- package/es/components/CheckboxGroup/CheckboxGroup.js +21 -2
- package/es/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/es/components/CodeSnippet/CodeSnippet.js +1 -1
- package/es/components/ComboBox/ComboBox.js +18 -13
- package/es/components/ComboButton/index.js +2 -1
- package/es/components/ComposedModal/ComposedModal.js +5 -2
- package/es/components/Copy/Copy.d.ts +1 -1
- package/es/components/Copy/Copy.js +1 -1
- package/es/components/CopyButton/CopyButton.d.ts +1 -1
- package/es/components/CopyButton/CopyButton.js +1 -1
- package/es/components/DataTable/DataTable.d.ts +60 -15
- package/es/components/DataTable/DataTable.js +119 -178
- package/es/components/DataTable/Table.d.ts +2 -2
- package/es/components/DataTable/Table.js +4 -4
- package/es/components/DataTable/TableExpandHeader.d.ts +1 -1
- package/es/components/DataTable/TableExpandHeader.js +6 -2
- package/es/components/DataTable/TableExpandRow.js +1 -0
- package/es/components/DataTable/TableHeader.js +2 -0
- package/es/components/DataTable/TableRow.js +5 -0
- package/es/components/DataTable/TableSlugRow.js +1 -0
- package/es/components/DataTable/TableToolbarMenu.js +3 -0
- package/es/components/DataTable/state/sorting.d.ts +3 -1
- package/es/components/DataTable/state/sorting.js +2 -0
- package/es/components/DataTable/tools/sorting.js +1 -0
- package/es/components/DatePicker/DatePicker.d.ts +0 -12
- package/es/components/DatePicker/DatePicker.js +17 -6
- package/es/components/DatePicker/plugins/rangePlugin.d.ts +19 -2
- package/es/components/DatePicker/plugins/rangePlugin.js +18 -14
- package/es/components/DatePickerInput/DatePickerInput.js +6 -0
- package/es/components/Dialog/Dialog.js +10 -2
- package/es/components/Dropdown/Dropdown.js +17 -16
- package/es/components/ErrorBoundary/ErrorBoundaryContext.js +1 -0
- package/es/components/FeatureFlags/index.js +1 -0
- package/es/components/FileUploader/FileUploader.js +9 -2
- package/es/components/FileUploader/FileUploaderButton.js +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/es/components/FileUploader/FileUploaderItem.js +3 -0
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +2 -0
- package/es/components/FluidNumberInput/FluidNumberInput.js +3 -2
- package/es/components/FluidSearch/FluidSearch.js +3 -2
- package/es/components/FluidSelect/FluidSelect.js +3 -2
- package/es/components/FluidTextInput/FluidTextInput.js +3 -2
- package/es/components/FluidTimePicker/FluidTimePicker.js +11 -4
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +3 -2
- package/es/components/Grid/CSSGrid.js +5 -0
- package/es/components/Grid/Column.js +3 -0
- package/es/components/Grid/ColumnHang.js +1 -0
- package/es/components/Grid/FlexGrid.js +1 -0
- package/es/components/Grid/Row.js +1 -0
- package/es/components/Heading/index.js +3 -1
- package/es/components/IconButton/index.js +5 -3
- package/es/components/IconIndicator/index.js +4 -2
- package/es/components/InlineCheckbox/InlineCheckbox.js +3 -2
- package/es/components/Layout/index.js +6 -4
- package/es/components/LayoutDirection/LayoutDirection.js +2 -0
- package/es/components/Link/Link.js +3 -0
- package/es/components/ListBox/ListBoxMenuItem.js +4 -1
- package/es/components/ListBox/next/ListBoxTrigger.js +3 -2
- package/es/components/Menu/Menu.js +6 -9
- package/es/components/Menu/MenuContext.js +1 -0
- package/es/components/Menu/MenuItem.d.ts +1 -1
- package/es/components/Menu/MenuItem.js +10 -18
- package/es/components/MenuButton/index.js +7 -2
- package/es/components/Modal/Modal.js +4 -1
- package/es/components/ModalWrapper/ModalWrapper.js +2 -0
- package/es/components/MultiSelect/FilterableMultiSelect.js +25 -6
- package/es/components/MultiSelect/MultiSelect.js +22 -17
- package/es/components/Notification/Notification.d.ts +6 -6
- package/es/components/Notification/Notification.js +7 -7
- package/es/components/NumberInput/NumberInput.js +7 -1
- package/es/components/OverflowMenu/OverflowMenu.js +3 -1
- package/es/components/OverflowMenu/next/index.js +4 -3
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +2 -0
- package/es/components/PageHeader/PageHeader.d.ts +3 -3
- package/es/components/PageHeader/PageHeader.js +22 -8
- package/es/components/Pagination/Pagination.js +6 -2
- package/es/components/PaginationNav/PaginationNav.js +2 -5
- package/es/components/Popover/index.js +15 -5
- package/es/components/ProgressBar/ProgressBar.js +4 -2
- package/es/components/RadioTile/RadioTile.js +2 -2
- package/es/components/Search/Search.d.ts +4 -2
- package/es/components/Search/Search.js +7 -6
- package/es/components/Select/Select.js +2 -3
- package/es/components/ShapeIndicator/index.js +4 -2
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.d.ts +4 -4
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +1 -2
- package/es/components/SkeletonText/SkeletonText.js +0 -2
- package/es/components/Slider/Slider.d.ts +144 -188
- package/es/components/Slider/Slider.js +798 -726
- package/es/components/Slider/index.d.ts +2 -2
- package/es/components/Stack/HStack.js +1 -0
- package/es/components/Stack/Stack.js +6 -9
- package/es/components/Stack/VStack.js +1 -0
- package/es/components/StructuredList/StructuredList.js +3 -0
- package/es/components/Switch/Switch.js +1 -1
- package/es/components/Tabs/Tabs.d.ts +4 -0
- package/es/components/Tabs/Tabs.js +28 -17
- package/es/components/Tag/DismissibleTag.js +2 -0
- package/es/components/Tag/OperationalTag.js +2 -0
- package/es/components/Tag/SelectableTag.js +2 -0
- package/es/components/Tag/Tag.js +4 -0
- package/es/components/Tag/isEllipsisActive.js +1 -0
- package/es/components/Text/Text.js +1 -0
- package/es/components/TextArea/TextArea.js +13 -6
- package/es/components/TextInput/ControlledPasswordInput.js +4 -6
- package/es/components/TextInput/PasswordInput.js +9 -4
- package/es/components/TextInput/TextInput.js +6 -4
- package/es/components/TextInput/util.d.ts +17 -5
- package/es/components/TextInput/util.js +2 -7
- package/es/components/Theme/index.js +8 -3
- package/es/components/Tile/Tile.js +14 -17
- package/es/components/TimePicker/TimePicker.js +1 -0
- package/es/components/Toggle/Toggle.js +1 -1
- package/es/components/Toggletip/index.js +4 -0
- package/es/components/Tooltip/DefinitionTooltip.js +1 -0
- package/es/components/Tooltip/Tooltip.js +30 -23
- package/es/components/TreeView/TreeNode.js +13 -5
- package/es/components/TreeView/TreeView.js +7 -0
- package/es/components/UIShell/HeaderContainer.js +3 -1
- package/es/components/UIShell/HeaderGlobalAction.js +2 -2
- package/es/components/UIShell/HeaderMenu.js +3 -3
- package/es/components/UIShell/HeaderPanel.d.ts +1 -1
- package/es/components/UIShell/HeaderPanel.js +2 -2
- package/es/components/UIShell/Link.js +2 -0
- package/es/components/UIShell/SideNavItems.js +1 -0
- package/es/components/UIShell/SideNavMenu.js +2 -2
- package/es/components/UIShell/SideNavMenuItem.js +1 -1
- package/es/components/UIShell/SideNavSwitcher.js +1 -1
- package/es/components/UIShell/Switcher.js +2 -1
- package/es/components/UIShell/SwitcherItem.js +4 -2
- package/es/index.d.ts +12 -13
- package/es/index.js +25 -24
- package/es/internal/FloatingMenu.js +7 -1
- package/es/internal/Selection.js +12 -3
- package/es/internal/defaultItemToString.d.ts +7 -0
- package/es/internal/defaultItemToString.js +17 -0
- package/es/internal/index.d.ts +1 -0
- package/es/internal/useMergedRefs.js +1 -0
- package/es/internal/useNoInteractiveChildren.js +4 -0
- package/es/internal/useOutsideClick.js +1 -0
- package/es/internal/useOverflowItems.js +6 -0
- package/es/internal/useResizeObserver.js +4 -0
- package/es/internal/useSavedCallback.js +1 -0
- package/es/internal/warning.js +1 -0
- package/es/prop-types/deprecateValuesWithin.d.ts +8 -1
- package/es/prop-types/deprecateValuesWithin.js +6 -6
- package/es/prop-types/isRequiredOneOf.js +4 -1
- package/es/prop-types/requiredIfGivenPropIsTruthy.d.ts +8 -7
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +10 -10
- package/es/tools/events.js +3 -1
- package/es/tools/wrapComponent.js +1 -0
- package/lib/components/AILabel/index.js +8 -6
- package/lib/components/Breadcrumb/BreadcrumbItem.js +2 -0
- package/lib/components/Button/Button.js +3 -0
- package/lib/components/ChatButton/ChatButton.js +1 -0
- package/lib/components/CheckboxGroup/CheckboxGroup.js +20 -1
- package/lib/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/lib/components/CodeSnippet/CodeSnippet.js +1 -1
- package/lib/components/ComboBox/ComboBox.js +20 -15
- package/lib/components/ComboButton/index.js +2 -1
- package/lib/components/ComposedModal/ComposedModal.js +5 -2
- package/lib/components/Copy/Copy.d.ts +1 -1
- package/lib/components/Copy/Copy.js +1 -1
- package/lib/components/CopyButton/CopyButton.d.ts +1 -1
- package/lib/components/CopyButton/CopyButton.js +1 -1
- package/lib/components/DataTable/DataTable.d.ts +60 -15
- package/lib/components/DataTable/DataTable.js +119 -178
- package/lib/components/DataTable/Table.d.ts +2 -2
- package/lib/components/DataTable/Table.js +4 -4
- package/lib/components/DataTable/TableExpandHeader.d.ts +1 -1
- package/lib/components/DataTable/TableExpandHeader.js +6 -2
- package/lib/components/DataTable/TableExpandRow.js +1 -0
- package/lib/components/DataTable/TableHeader.js +2 -0
- package/lib/components/DataTable/TableRow.js +5 -0
- package/lib/components/DataTable/TableSlugRow.js +1 -0
- package/lib/components/DataTable/TableToolbarMenu.js +3 -0
- package/lib/components/DataTable/state/sorting.d.ts +3 -1
- package/lib/components/DataTable/state/sorting.js +2 -0
- package/lib/components/DataTable/tools/sorting.js +1 -0
- package/lib/components/DatePicker/DatePicker.d.ts +0 -12
- package/lib/components/DatePicker/DatePicker.js +16 -5
- package/lib/components/DatePicker/plugins/rangePlugin.d.ts +19 -2
- package/lib/components/DatePicker/plugins/rangePlugin.js +18 -16
- package/lib/components/DatePickerInput/DatePickerInput.js +6 -0
- package/lib/components/Dialog/Dialog.js +10 -2
- package/lib/components/Dropdown/Dropdown.js +19 -18
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +1 -0
- package/lib/components/FeatureFlags/index.js +1 -0
- package/lib/components/FileUploader/FileUploader.js +9 -2
- package/lib/components/FileUploader/FileUploaderButton.js +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/lib/components/FileUploader/FileUploaderItem.js +3 -0
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +2 -0
- package/lib/components/FluidNumberInput/FluidNumberInput.js +3 -2
- package/lib/components/FluidSearch/FluidSearch.js +3 -2
- package/lib/components/FluidSelect/FluidSelect.js +3 -2
- package/lib/components/FluidTextInput/FluidTextInput.js +3 -2
- package/lib/components/FluidTimePicker/FluidTimePicker.js +11 -4
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +3 -2
- package/lib/components/Grid/CSSGrid.js +5 -0
- package/lib/components/Grid/Column.js +3 -0
- package/lib/components/Grid/ColumnHang.js +1 -0
- package/lib/components/Grid/FlexGrid.js +1 -0
- package/lib/components/Grid/Row.js +1 -0
- package/lib/components/Heading/index.js +3 -1
- package/lib/components/IconButton/index.js +5 -3
- package/lib/components/IconIndicator/index.js +4 -2
- package/lib/components/InlineCheckbox/InlineCheckbox.js +3 -2
- package/lib/components/Layout/index.js +6 -4
- package/lib/components/LayoutDirection/LayoutDirection.js +2 -0
- package/lib/components/Link/Link.js +3 -0
- package/lib/components/ListBox/ListBoxMenuItem.js +4 -1
- package/lib/components/ListBox/next/ListBoxTrigger.js +3 -2
- package/lib/components/Menu/Menu.js +6 -9
- package/lib/components/Menu/MenuContext.js +1 -0
- package/lib/components/Menu/MenuItem.d.ts +1 -1
- package/lib/components/Menu/MenuItem.js +11 -19
- package/lib/components/MenuButton/index.js +7 -2
- package/lib/components/Modal/Modal.js +4 -1
- package/lib/components/ModalWrapper/ModalWrapper.js +2 -0
- package/lib/components/MultiSelect/FilterableMultiSelect.js +32 -13
- package/lib/components/MultiSelect/MultiSelect.js +23 -18
- package/lib/components/Notification/Notification.d.ts +6 -6
- package/lib/components/Notification/Notification.js +7 -7
- package/lib/components/NumberInput/NumberInput.js +7 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +3 -1
- package/lib/components/OverflowMenu/next/index.js +4 -3
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +2 -0
- package/lib/components/PageHeader/PageHeader.d.ts +3 -3
- package/lib/components/PageHeader/PageHeader.js +22 -8
- package/lib/components/Pagination/Pagination.js +6 -2
- package/lib/components/PaginationNav/PaginationNav.js +2 -5
- package/lib/components/Popover/index.js +15 -5
- package/lib/components/ProgressBar/ProgressBar.js +4 -2
- package/lib/components/RadioTile/RadioTile.js +2 -2
- package/lib/components/Search/Search.d.ts +4 -2
- package/lib/components/Search/Search.js +7 -6
- package/lib/components/Select/Select.js +2 -3
- package/lib/components/ShapeIndicator/index.js +4 -2
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.d.ts +4 -4
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +1 -2
- package/lib/components/SkeletonText/SkeletonText.js +0 -2
- package/lib/components/Slider/Slider.d.ts +144 -188
- package/lib/components/Slider/Slider.js +795 -725
- package/lib/components/Slider/index.d.ts +2 -2
- package/lib/components/Stack/HStack.js +1 -0
- package/lib/components/Stack/Stack.js +6 -9
- package/lib/components/Stack/VStack.js +1 -0
- package/lib/components/StructuredList/StructuredList.js +3 -0
- package/lib/components/Switch/Switch.js +1 -1
- package/lib/components/Tabs/Tabs.d.ts +4 -0
- package/lib/components/Tabs/Tabs.js +28 -17
- package/lib/components/Tag/DismissibleTag.js +2 -0
- package/lib/components/Tag/OperationalTag.js +2 -0
- package/lib/components/Tag/SelectableTag.js +2 -0
- package/lib/components/Tag/Tag.js +4 -0
- package/lib/components/Tag/isEllipsisActive.js +1 -0
- package/lib/components/Text/Text.js +1 -0
- package/lib/components/TextArea/TextArea.js +13 -6
- package/lib/components/TextInput/ControlledPasswordInput.js +3 -5
- package/lib/components/TextInput/PasswordInput.js +8 -3
- package/lib/components/TextInput/TextInput.js +5 -3
- package/lib/components/TextInput/util.d.ts +17 -5
- package/lib/components/TextInput/util.js +2 -7
- package/lib/components/Theme/index.js +8 -3
- package/lib/components/Tile/Tile.js +14 -17
- package/lib/components/TimePicker/TimePicker.js +1 -0
- package/lib/components/Toggle/Toggle.js +1 -1
- package/lib/components/Toggletip/index.js +4 -0
- package/lib/components/Tooltip/DefinitionTooltip.js +1 -0
- package/lib/components/Tooltip/Tooltip.js +30 -23
- package/lib/components/TreeView/TreeNode.js +13 -5
- package/lib/components/TreeView/TreeView.js +7 -0
- package/lib/components/UIShell/HeaderContainer.js +3 -1
- package/lib/components/UIShell/HeaderGlobalAction.js +2 -2
- package/lib/components/UIShell/HeaderMenu.js +3 -3
- package/lib/components/UIShell/HeaderPanel.d.ts +1 -1
- package/lib/components/UIShell/HeaderPanel.js +2 -2
- package/lib/components/UIShell/Link.js +2 -0
- package/lib/components/UIShell/SideNavItems.js +1 -0
- package/lib/components/UIShell/SideNavMenu.js +2 -2
- package/lib/components/UIShell/SideNavMenuItem.js +1 -1
- package/lib/components/UIShell/SideNavSwitcher.js +1 -1
- package/lib/components/UIShell/Switcher.js +2 -1
- package/lib/components/UIShell/SwitcherItem.js +4 -2
- package/lib/index.d.ts +12 -13
- package/lib/index.js +51 -28
- package/lib/internal/FloatingMenu.js +7 -1
- package/lib/internal/Selection.js +12 -3
- package/lib/internal/defaultItemToString.d.ts +7 -0
- package/lib/internal/defaultItemToString.js +19 -0
- package/lib/internal/index.d.ts +1 -0
- package/lib/internal/useMergedRefs.js +1 -0
- package/lib/internal/useNoInteractiveChildren.js +4 -0
- package/lib/internal/useOutsideClick.js +1 -0
- package/lib/internal/useOverflowItems.js +6 -0
- package/lib/internal/useResizeObserver.js +4 -0
- package/lib/internal/useSavedCallback.js +1 -0
- package/lib/internal/warning.js +1 -0
- package/lib/prop-types/deprecateValuesWithin.d.ts +8 -1
- package/lib/prop-types/deprecateValuesWithin.js +6 -8
- package/lib/prop-types/isRequiredOneOf.js +4 -1
- package/lib/prop-types/requiredIfGivenPropIsTruthy.d.ts +8 -7
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +10 -12
- package/lib/tools/events.js +3 -1
- package/lib/tools/wrapComponent.js +1 -0
- package/package.json +10 -9
- package/es/components/MultiSelect/tools/itemToString.d.ts +0 -1
- package/es/components/MultiSelect/tools/itemToString.js +0 -21
- package/es/components/Slider/index.js +0 -14
- package/es/internal/createClassWrapper.js +0 -23
- package/lib/components/MultiSelect/tools/itemToString.d.ts +0 -1
- package/lib/components/MultiSelect/tools/itemToString.js +0 -23
- package/lib/components/Slider/index.js +0 -20
- package/lib/internal/createClassWrapper.js +0 -25
|
@@ -23,7 +23,6 @@ var ListBoxSelection = require('../ListBox/next/ListBoxSelection.js');
|
|
|
23
23
|
var ListBoxTrigger = require('../ListBox/next/ListBoxTrigger.js');
|
|
24
24
|
var keys = require('../../internal/keyboard/keys.js');
|
|
25
25
|
var match = require('../../internal/keyboard/match.js');
|
|
26
|
-
var itemToString = require('./tools/itemToString.js');
|
|
27
26
|
var mergeRefs = require('../../tools/mergeRefs.js');
|
|
28
27
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
29
28
|
var useId = require('../../internal/useId.js');
|
|
@@ -34,6 +33,7 @@ var FormContext = require('../FluidForm/FormContext.js');
|
|
|
34
33
|
var Selection = require('../../internal/Selection.js');
|
|
35
34
|
var react = require('@floating-ui/react');
|
|
36
35
|
var index = require('../AILabel/index.js');
|
|
36
|
+
var defaultItemToString = require('../../internal/defaultItemToString.js');
|
|
37
37
|
var utils = require('../../internal/utils.js');
|
|
38
38
|
var ListBoxPropTypes = require('../ListBox/ListBoxPropTypes.js');
|
|
39
39
|
|
|
@@ -87,7 +87,7 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
87
87
|
items,
|
|
88
88
|
itemToElement: ItemToElement,
|
|
89
89
|
// needs to be capitalized for react to render it correctly
|
|
90
|
-
itemToString
|
|
90
|
+
itemToString = defaultItemToString.defaultItemToString,
|
|
91
91
|
light,
|
|
92
92
|
locale = 'en',
|
|
93
93
|
onInputValueChange,
|
|
@@ -113,6 +113,7 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
113
113
|
isFluid
|
|
114
114
|
} = React.useContext(FormContext.FormContext);
|
|
115
115
|
const isFirstRender = React.useRef(true);
|
|
116
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
116
117
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
117
118
|
const [isOpen, setIsOpen] = React.useState(!!open);
|
|
118
119
|
const [prevOpen, setPrevOpen] = React.useState(!!open);
|
|
@@ -120,10 +121,13 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
120
121
|
const [topItems, setTopItems] = React.useState(initialSelectedItems ?? []);
|
|
121
122
|
const [inputFocused, setInputFocused] = React.useState(false);
|
|
122
123
|
const filteredItems = React.useMemo(() => filterItems(items, {
|
|
123
|
-
itemToString
|
|
124
|
+
itemToString,
|
|
124
125
|
inputValue
|
|
125
|
-
}), [items, inputValue, itemToString
|
|
126
|
-
const nonSelectAllItems = React.useMemo(
|
|
126
|
+
}), [items, inputValue, itemToString, filterItems]);
|
|
127
|
+
const nonSelectAllItems = React.useMemo(
|
|
128
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
129
|
+
() => filteredItems.filter(item => !item.isSelectAll), [filteredItems]);
|
|
130
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
127
131
|
const selectAll = filteredItems.some(item => item.isSelectAll);
|
|
128
132
|
const {
|
|
129
133
|
selectedItems: controlledSelectedItems,
|
|
@@ -139,7 +143,9 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
139
143
|
filteredItems
|
|
140
144
|
});
|
|
141
145
|
const selectAllStatus = React.useMemo(() => {
|
|
142
|
-
const selectable = nonSelectAllItems.filter(
|
|
146
|
+
const selectable = nonSelectAllItems.filter(
|
|
147
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
148
|
+
item => !item.disabled);
|
|
143
149
|
const nonSelectedCount = selectable.filter(item => !controlledSelectedItems.some(sel => isEqual(sel, item))).length;
|
|
144
150
|
const totalCount = selectable.length;
|
|
145
151
|
return {
|
|
@@ -148,6 +154,7 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
148
154
|
};
|
|
149
155
|
}, [controlledSelectedItems, nonSelectAllItems]);
|
|
150
156
|
const handleSelectAllClick = React.useCallback(() => {
|
|
157
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
151
158
|
const selectable = nonSelectAllItems.filter(i => !i.disabled);
|
|
152
159
|
const {
|
|
153
160
|
checked,
|
|
@@ -164,6 +171,7 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
164
171
|
const toSelect = selectable.filter(e => !controlledSelectedItems.some(sel => isEqual(sel, e)));
|
|
165
172
|
toggleAll([...controlledSelectedItems, ...toSelect]);
|
|
166
173
|
}
|
|
174
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
167
175
|
}, [nonSelectAllItems, selectAllStatus, controlledSelectedItems, toggleAll]);
|
|
168
176
|
const {
|
|
169
177
|
refs,
|
|
@@ -214,18 +222,21 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
214
222
|
|
|
215
223
|
// memoize sorted items to reduce unnecessary expensive sort on rerender
|
|
216
224
|
const sortedItems = React.useMemo(() => {
|
|
217
|
-
// eslint-disable-next-line @typescript-eslint/no-
|
|
225
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
218
226
|
const selectAllItem = items.find(item => item.isSelectAll);
|
|
219
|
-
const selectableRealItems = nonSelectAllItems.filter(
|
|
227
|
+
const selectableRealItems = nonSelectAllItems.filter(
|
|
228
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
229
|
+
item => !item.disabled);
|
|
220
230
|
|
|
221
231
|
// Sort only non-select-all items, select-all item must stay at the top
|
|
232
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
222
233
|
const sortedReal = sortItems(nonSelectAllItems, {
|
|
223
234
|
selectedItems: {
|
|
224
235
|
top: controlledSelectedItems,
|
|
225
236
|
fixed: [],
|
|
226
237
|
'top-after-reopen': topItems
|
|
227
238
|
}[selectionFeedback],
|
|
228
|
-
itemToString
|
|
239
|
+
itemToString,
|
|
229
240
|
compareItems,
|
|
230
241
|
locale
|
|
231
242
|
});
|
|
@@ -235,7 +246,8 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
235
246
|
return [selectAllItem, ...sortedReal];
|
|
236
247
|
}
|
|
237
248
|
return sortedReal;
|
|
238
|
-
|
|
249
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
250
|
+
}, [items, inputValue, controlledSelectedItems, topItems, selectionFeedback, itemToString, compareItems, locale, sortItems, nonSelectAllItems]);
|
|
239
251
|
const inline = type === 'inline';
|
|
240
252
|
const showWarning = !invalid && warn;
|
|
241
253
|
const wrapperClasses = cx(`${prefix}--multi-select__wrapper`, `${prefix}--multi-select--filterable__wrapper`, `${prefix}--list-box__wrapper`, containerClassName, {
|
|
@@ -318,6 +330,7 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
318
330
|
return () => {
|
|
319
331
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
320
332
|
};
|
|
333
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
321
334
|
}, [isOpen, inputFocused]);
|
|
322
335
|
const {
|
|
323
336
|
getToggleButtonProps,
|
|
@@ -333,14 +346,16 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
333
346
|
isOpen,
|
|
334
347
|
items: sortedItems,
|
|
335
348
|
// defaultHighlightedIndex: 0, // after selection, highlight the first item.
|
|
336
|
-
itemToString
|
|
349
|
+
itemToString,
|
|
337
350
|
id,
|
|
338
351
|
labelId,
|
|
339
352
|
menuId,
|
|
340
353
|
inputId,
|
|
341
354
|
inputValue,
|
|
342
355
|
stateReducer,
|
|
356
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
343
357
|
isItemDisabled(item, _index) {
|
|
358
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
344
359
|
return item?.disabled;
|
|
345
360
|
}
|
|
346
361
|
});
|
|
@@ -511,7 +526,9 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
511
526
|
}) : null;
|
|
512
527
|
|
|
513
528
|
// exclude the select-all item from the count
|
|
514
|
-
const selectedItemsLength = controlledSelectedItems.filter(
|
|
529
|
+
const selectedItemsLength = controlledSelectedItems.filter(
|
|
530
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
531
|
+
item => !item.isSelectAll).length;
|
|
515
532
|
const className = cx(`${prefix}--multi-select`, `${prefix}--combo-box`, `${prefix}--multi-select--filterable`, {
|
|
516
533
|
[`${prefix}--multi-select--invalid`]: invalid,
|
|
517
534
|
[`${prefix}--multi-select--invalid--focused`]: invalid && inputFocused,
|
|
@@ -692,6 +709,7 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
692
709
|
}, normalizedDecorator) : '', /*#__PURE__*/React.createElement(index$1.default.Menu, menuProps, isOpen ? sortedItems.map((item, index) => {
|
|
693
710
|
let isChecked;
|
|
694
711
|
let isIndeterminate = false;
|
|
712
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
695
713
|
if (item.isSelectAll) {
|
|
696
714
|
isChecked = selectAllStatus.checked;
|
|
697
715
|
isIndeterminate = selectAllStatus.indeterminate;
|
|
@@ -702,7 +720,7 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
702
720
|
item,
|
|
703
721
|
['aria-selected']: isChecked
|
|
704
722
|
});
|
|
705
|
-
const itemText = itemToString
|
|
723
|
+
const itemText = itemToString(item);
|
|
706
724
|
|
|
707
725
|
// The initial implementation using <Downshift> would place the disabled attribute
|
|
708
726
|
// on disabled menu items. Conversely, useCombobox places aria-disabled instead.
|
|
@@ -789,6 +807,7 @@ FilterableMultiSelect.propTypes = {
|
|
|
789
807
|
* change, and in some cases they can not be shimmed by Carbon to shield you
|
|
790
808
|
* from potentially breaking changes.
|
|
791
809
|
*/
|
|
810
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
792
811
|
// @ts-ignore
|
|
793
812
|
downshiftProps: PropTypes.shape(Downshift.propTypes),
|
|
794
813
|
/**
|
|
@@ -32,6 +32,7 @@ var noopFn = require('../../internal/noopFn.js');
|
|
|
32
32
|
var react = require('@floating-ui/react');
|
|
33
33
|
var index = require('../FeatureFlags/index.js');
|
|
34
34
|
var index$1 = require('../AILabel/index.js');
|
|
35
|
+
var defaultItemToString = require('../../internal/defaultItemToString.js');
|
|
35
36
|
var utils = require('../../internal/utils.js');
|
|
36
37
|
var ListBoxPropTypes = require('../ListBox/ListBoxPropTypes.js');
|
|
37
38
|
|
|
@@ -50,18 +51,6 @@ const {
|
|
|
50
51
|
ToggleButtonKeyDownPageUp,
|
|
51
52
|
FunctionSetHighlightedIndex
|
|
52
53
|
} = Downshift.useSelect.stateChangeTypes;
|
|
53
|
-
const defaultItemToString = item => {
|
|
54
|
-
if (typeof item === 'string') {
|
|
55
|
-
return item;
|
|
56
|
-
}
|
|
57
|
-
if (typeof item === 'number') {
|
|
58
|
-
return `${item}`;
|
|
59
|
-
}
|
|
60
|
-
if (item !== null && typeof item === 'object' && 'label' in item && typeof item['label'] === 'string') {
|
|
61
|
-
return item['label'];
|
|
62
|
-
}
|
|
63
|
-
return '';
|
|
64
|
-
};
|
|
65
54
|
const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
66
55
|
autoAlign = false,
|
|
67
56
|
className: containerClassName,
|
|
@@ -69,7 +58,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
69
58
|
id,
|
|
70
59
|
items,
|
|
71
60
|
itemToElement,
|
|
72
|
-
itemToString = defaultItemToString,
|
|
61
|
+
itemToString = defaultItemToString.defaultItemToString,
|
|
73
62
|
titleText = false,
|
|
74
63
|
hideLabel,
|
|
75
64
|
helperText,
|
|
@@ -113,12 +102,15 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
113
102
|
return true; // Return true if item is not an object with undefined values
|
|
114
103
|
});
|
|
115
104
|
}, [items]);
|
|
105
|
+
|
|
106
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
116
107
|
const selectAll = filteredItems.some(item => item.isSelectAll);
|
|
117
108
|
const prefix = usePrefix.usePrefix();
|
|
118
109
|
const {
|
|
119
110
|
isFluid
|
|
120
111
|
} = React.useContext(FormContext.FormContext);
|
|
121
112
|
const multiSelectInstanceId = useId.useId();
|
|
113
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
122
114
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
123
115
|
const [inputFocused, setInputFocused] = React.useState(false);
|
|
124
116
|
const [isOpen, setIsOpen] = React.useState(open || false);
|
|
@@ -187,13 +179,15 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
187
179
|
stateReducer,
|
|
188
180
|
isOpen,
|
|
189
181
|
itemToString: filteredItems => {
|
|
190
|
-
return Array.isArray(filteredItems) && filteredItems.map(
|
|
182
|
+
return Array.isArray(filteredItems) && filteredItems.map(item => {
|
|
191
183
|
return itemToString(item);
|
|
192
184
|
}).join(', ') || '';
|
|
193
185
|
},
|
|
194
186
|
selectedItem: controlledSelectedItems,
|
|
195
187
|
items: filteredItems,
|
|
188
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
196
189
|
isItemDisabled(item, _index) {
|
|
190
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
197
191
|
return item?.disabled;
|
|
198
192
|
},
|
|
199
193
|
...downshiftProps
|
|
@@ -388,6 +382,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
388
382
|
[`${prefix}--list-box__field--wrapper--input-focused`]: inputFocused
|
|
389
383
|
});
|
|
390
384
|
const handleFocus = evt => {
|
|
385
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
391
386
|
evt.target.classList.contains(`${prefix}--tag__close-icon`) ? setIsFocused(false) : setIsFocused(evt.type === 'focus' ? true : false);
|
|
392
387
|
};
|
|
393
388
|
const readOnlyEventHandlers = readOnly ? {
|
|
@@ -415,7 +410,9 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
415
410
|
size: 'mini'
|
|
416
411
|
}) : null;
|
|
417
412
|
const itemsSelectedText = selectedItems.length > 0 && selectedItems.map(item => item?.text);
|
|
418
|
-
const selectedItemsLength = selectAll ?
|
|
413
|
+
const selectedItemsLength = selectAll ?
|
|
414
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
415
|
+
selectedItems.filter(item => !item.isSelectAll).length : selectedItems.length;
|
|
419
416
|
|
|
420
417
|
// Memoize the value of getMenuProps to avoid an infinite loop
|
|
421
418
|
const menuProps = React.useMemo(() => getMenuProps({
|
|
@@ -434,7 +431,9 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
434
431
|
nonSelectAllSelectedCount,
|
|
435
432
|
totalSelectableCount
|
|
436
433
|
};
|
|
437
|
-
},
|
|
434
|
+
},
|
|
435
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
436
|
+
[selectedItems, filteredItems]);
|
|
438
437
|
return /*#__PURE__*/React.createElement("div", {
|
|
439
438
|
className: wrapperClasses
|
|
440
439
|
}, /*#__PURE__*/React.createElement("label", _rollupPluginBabelHelpers.extends({
|
|
@@ -486,14 +485,20 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
486
485
|
translateWithId: translateWithId
|
|
487
486
|
})), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React.createElement("div", {
|
|
488
487
|
className: `${prefix}--list-box__inner-wrapper--decorator`
|
|
489
|
-
}, normalizedDecorator) : ''), /*#__PURE__*/React.createElement(index$2.default.Menu, menuProps, isOpen &&
|
|
488
|
+
}, normalizedDecorator) : ''), /*#__PURE__*/React.createElement(index$2.default.Menu, menuProps, isOpen &&
|
|
489
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
490
|
+
sortItems(filteredItems, sortOptions).map((item, index) => {
|
|
490
491
|
const {
|
|
491
492
|
hasIndividualSelections,
|
|
492
493
|
nonSelectAllSelectedCount,
|
|
493
494
|
totalSelectableCount
|
|
494
495
|
} = getSelectionStats(selectedItems, filteredItems);
|
|
496
|
+
|
|
497
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
495
498
|
const isChecked = item.isSelectAll ? nonSelectAllSelectedCount === totalSelectableCount && totalSelectableCount > 0 : selectedItems.some(selected => isEqual(selected, item));
|
|
496
|
-
const isIndeterminate =
|
|
499
|
+
const isIndeterminate =
|
|
500
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
501
|
+
item.isSelectAll && hasIndividualSelections && nonSelectAllSelectedCount < totalSelectableCount;
|
|
497
502
|
const itemProps = getItemProps({
|
|
498
503
|
item,
|
|
499
504
|
// we don't want Downshift to set aria-selected for us
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import React, { type ReactNode, type MouseEvent, type ButtonHTMLAttributes, type HTMLAttributes } from 'react';
|
|
9
|
-
import { type ButtonProps } from '../Button';
|
|
8
|
+
import React, { type ReactNode, type MouseEvent, type ButtonHTMLAttributes, type HTMLAttributes, type ComponentProps } from 'react';
|
|
9
|
+
import Button, { type ButtonProps } from '../Button';
|
|
10
10
|
export interface NotificationActionButtonProps extends ButtonProps<'button'> {
|
|
11
11
|
/**
|
|
12
12
|
* Specify the content of the notification action button.
|
|
@@ -23,7 +23,7 @@ export interface NotificationActionButtonProps extends ButtonProps<'button'> {
|
|
|
23
23
|
/**
|
|
24
24
|
* Optionally specify a click handler for the notification action button.
|
|
25
25
|
*/
|
|
26
|
-
onClick
|
|
26
|
+
onClick?: ComponentProps<typeof Button>['onClick'];
|
|
27
27
|
}
|
|
28
28
|
export declare function NotificationActionButton({ children, className: customClassName, onClick, inline, ...rest }: NotificationActionButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
29
29
|
export declare namespace NotificationActionButton {
|
|
@@ -404,7 +404,7 @@ export interface ActionableNotificationProps extends HTMLAttributes<HTMLDivEleme
|
|
|
404
404
|
/**
|
|
405
405
|
* Provide a function that is called when the action is clicked
|
|
406
406
|
*/
|
|
407
|
-
onActionButtonClick
|
|
407
|
+
onActionButtonClick?: ComponentProps<typeof NotificationActionButton>['onClick'];
|
|
408
408
|
/**
|
|
409
409
|
* Provide a function that is called when menu is closed.
|
|
410
410
|
* Default behavior of hiding the notification is prevented if this function returns false.
|
|
@@ -551,7 +551,7 @@ export interface CalloutProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
551
551
|
/**
|
|
552
552
|
* Provide a function that is called when the action is clicked
|
|
553
553
|
*/
|
|
554
|
-
onActionButtonClick
|
|
554
|
+
onActionButtonClick?: ComponentProps<typeof NotificationActionButton>['onClick'];
|
|
555
555
|
/**
|
|
556
556
|
* Provide a description for "status" icon that can be read by screen readers
|
|
557
557
|
*/
|
|
@@ -587,7 +587,7 @@ export declare namespace Callout {
|
|
|
587
587
|
/**
|
|
588
588
|
* Specify what state the notification represents
|
|
589
589
|
*/
|
|
590
|
-
kind:
|
|
590
|
+
kind: PropTypes.Requireable<string> | PropTypes.Validator<string>;
|
|
591
591
|
/**
|
|
592
592
|
* Specify whether you are using the low contrast variant of the Callout.
|
|
593
593
|
*/
|
|
@@ -110,7 +110,6 @@ function NotificationButton({
|
|
|
110
110
|
[`${prefix}--${notificationType}-notification__close-icon`]: notificationType
|
|
111
111
|
});
|
|
112
112
|
return /*#__PURE__*/React.createElement("button", _rollupPluginBabelHelpers.extends({}, rest, {
|
|
113
|
-
// eslint-disable-next-line react/button-has-type
|
|
114
113
|
type: type,
|
|
115
114
|
"aria-label": deprecatedAriaLabel || ariaLabel,
|
|
116
115
|
title: deprecatedAriaLabel || ariaLabel,
|
|
@@ -702,12 +701,12 @@ ActionableNotification.propTypes = {
|
|
|
702
701
|
* @deprecated Use NewKindProps instead.
|
|
703
702
|
*/
|
|
704
703
|
|
|
704
|
+
const mapping = {
|
|
705
|
+
error: 'warning',
|
|
706
|
+
// only redirect error -> warning
|
|
707
|
+
success: 'info' // only redirect success -> info
|
|
708
|
+
};
|
|
705
709
|
const propMappingFunction = deprecatedValue => {
|
|
706
|
-
const mapping = {
|
|
707
|
-
error: 'warning',
|
|
708
|
-
// only redirect error -> warning
|
|
709
|
-
success: 'info' // only redirect success -> info
|
|
710
|
-
};
|
|
711
710
|
return mapping[deprecatedValue];
|
|
712
711
|
};
|
|
713
712
|
function Callout({
|
|
@@ -774,7 +773,7 @@ Callout.propTypes = {
|
|
|
774
773
|
/**
|
|
775
774
|
* Specify what state the notification represents
|
|
776
775
|
*/
|
|
777
|
-
kind: deprecateValuesWithin.
|
|
776
|
+
kind: deprecateValuesWithin.deprecateValuesWithin(PropTypes.oneOf(['error', 'info', 'info-square', 'success', 'warning', 'warning-alt']), ['warning', 'info'], propMappingFunction),
|
|
778
777
|
/**
|
|
779
778
|
* Specify whether you are using the low contrast variant of the Callout.
|
|
780
779
|
*/
|
|
@@ -810,6 +809,7 @@ Callout.propTypes = {
|
|
|
810
809
|
/**
|
|
811
810
|
* @deprecated Use `CalloutProps` instead.
|
|
812
811
|
*/
|
|
812
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
813
813
|
|
|
814
814
|
let didWarnAboutDeprecation = false;
|
|
815
815
|
const StaticNotification = props => {
|
|
@@ -43,7 +43,8 @@ const defaultTranslations = {
|
|
|
43
43
|
[translationIds['increment.number']]: 'Increment number',
|
|
44
44
|
[translationIds['decrement.number']]: 'Decrement number'
|
|
45
45
|
};
|
|
46
|
-
|
|
46
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
47
|
+
const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
|
|
47
48
|
const {
|
|
48
49
|
allowEmpty = false,
|
|
49
50
|
className: customClassName,
|
|
@@ -103,6 +104,7 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
|
|
|
103
104
|
}
|
|
104
105
|
return 0;
|
|
105
106
|
});
|
|
107
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
106
108
|
const [prevControlledValue, setPrevControlledValue] = React.useState(controlledValue);
|
|
107
109
|
const numberParser = React.useMemo(() => new utilities.NumberParser(locale, formatOptions), [locale, formatOptions]);
|
|
108
110
|
/**
|
|
@@ -235,6 +237,8 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
|
|
|
235
237
|
[`${prefix}--number-input--fluid--focus`]: isFluid && isFocused,
|
|
236
238
|
[`${prefix}--number-input--fluid--disabled`]: isFluid && disabled
|
|
237
239
|
});
|
|
240
|
+
|
|
241
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
238
242
|
const Icon = normalizedProps.icon;
|
|
239
243
|
const getDecimalPlaces = num => {
|
|
240
244
|
const parts = num.toString().split('.');
|
|
@@ -344,7 +348,9 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
|
|
|
344
348
|
onKeyUp: onKeyUp,
|
|
345
349
|
onKeyDown: e => {
|
|
346
350
|
if (type === 'text') {
|
|
351
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
347
352
|
match.match(e, keys.ArrowUp) && handleStep(e, 'up');
|
|
353
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
348
354
|
match.match(e, keys.ArrowDown) && handleStep(e, 'down');
|
|
349
355
|
}
|
|
350
356
|
if (rest?.onKeyDown) {
|
|
@@ -70,6 +70,7 @@ const getMenuOffset = (menuBody, direction, trigger, flip) => {
|
|
|
70
70
|
if (process.env.NODE_ENV !== 'production') {
|
|
71
71
|
!(triggerButtonPositionProp && triggerButtonPositionFactor) ? process.env.NODE_ENV !== "production" ? invariant(false, '[OverflowMenu] wrong floating menu direction: `%s`', direction) : invariant(false) : void 0;
|
|
72
72
|
}
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
73
74
|
const {
|
|
74
75
|
offsetWidth: menuWidth,
|
|
75
76
|
offsetHeight: menuHeight
|
|
@@ -92,6 +93,7 @@ const getMenuOffset = (menuBody, direction, trigger, flip) => {
|
|
|
92
93
|
};
|
|
93
94
|
}
|
|
94
95
|
};
|
|
96
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
95
97
|
const OverflowMenu = /*#__PURE__*/React.forwardRef(({
|
|
96
98
|
align,
|
|
97
99
|
['aria-label']: ariaLabel = null,
|
|
@@ -346,7 +348,7 @@ OverflowMenu.propTypes = {
|
|
|
346
348
|
/**
|
|
347
349
|
* Specify how the trigger should align with the tooltip
|
|
348
350
|
*/
|
|
349
|
-
align: deprecateValuesWithin.
|
|
351
|
+
align: deprecateValuesWithin.deprecateValuesWithin(PropTypes.oneOf(['top', 'top-left',
|
|
350
352
|
// deprecated use top-start instead
|
|
351
353
|
'top-right',
|
|
352
354
|
// deprecated use top-end instead
|
|
@@ -25,7 +25,8 @@ var deprecateValuesWithin = require('../../../prop-types/deprecateValuesWithin.j
|
|
|
25
25
|
var mapPopoverAlign = require('../../../tools/mapPopoverAlign.js');
|
|
26
26
|
|
|
27
27
|
const defaultSize = 'md';
|
|
28
|
-
|
|
28
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
29
|
+
const OverflowMenu = /*#__PURE__*/React.forwardRef(({
|
|
29
30
|
autoAlign = false,
|
|
30
31
|
children,
|
|
31
32
|
className,
|
|
@@ -36,7 +37,7 @@ const OverflowMenu = /*#__PURE__*/React.forwardRef(function OverflowMenu({
|
|
|
36
37
|
tooltipAlignment,
|
|
37
38
|
menuTarget,
|
|
38
39
|
...rest
|
|
39
|
-
}, forwardRef) {
|
|
40
|
+
}, forwardRef) => {
|
|
40
41
|
const enableFloatingStyles = index.useFeatureFlag('enable-v12-dynamic-floating-styles') || autoAlign;
|
|
41
42
|
const {
|
|
42
43
|
refs,
|
|
@@ -167,7 +168,7 @@ OverflowMenu.propTypes = {
|
|
|
167
168
|
/**
|
|
168
169
|
* Specify how the trigger tooltip should be aligned.
|
|
169
170
|
*/
|
|
170
|
-
tooltipAlignment: deprecateValuesWithin.
|
|
171
|
+
tooltipAlignment: deprecateValuesWithin.deprecateValuesWithin(PropTypes.oneOf(['top', 'top-left',
|
|
171
172
|
// deprecated use top-start instead
|
|
172
173
|
'top-right',
|
|
173
174
|
// deprecated use top-end instead
|
|
@@ -93,12 +93,14 @@ const OverflowMenuItem = frFn((props, ref) => {
|
|
|
93
93
|
// ref as any: the type of `ref` is `ForwardedRef<HTMLButtonElement>` in `Button` component
|
|
94
94
|
// but `OverflowMenuItem` can be rendered as `a` tag as well, which is `HTMLAnchorElement`
|
|
95
95
|
// so we have to use `any` here
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
96
97
|
,
|
|
97
98
|
ref: ref,
|
|
98
99
|
tabIndex: -1
|
|
99
100
|
// itemText as any: itemText may be a ReactNode, but `title` only accepts string
|
|
100
101
|
// to avoid compatibility issue, we use `any` here. Consider to enforce `itemText` to be `string?`
|
|
101
102
|
// in the next major release
|
|
103
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
102
104
|
,
|
|
103
105
|
title: requireTitle ? title || itemText : undefined
|
|
104
106
|
}, rest), OverflowMenuItemContent));
|
|
@@ -26,7 +26,7 @@ interface PageHeaderBreadcrumbBarProps {
|
|
|
26
26
|
/**
|
|
27
27
|
* `true` by default to render BreadcrumbBar bottom border.
|
|
28
28
|
*/
|
|
29
|
-
border?:
|
|
29
|
+
border?: boolean;
|
|
30
30
|
children?: React.ReactNode;
|
|
31
31
|
className?: string;
|
|
32
32
|
/**
|
|
@@ -40,7 +40,7 @@ interface PageHeaderBreadcrumbBarProps {
|
|
|
40
40
|
/**
|
|
41
41
|
* `true` to set content actions flush against page actions
|
|
42
42
|
*/
|
|
43
|
-
contentActionsFlush?:
|
|
43
|
+
contentActionsFlush?: boolean;
|
|
44
44
|
/**
|
|
45
45
|
* The PageHeaderContent's page actions
|
|
46
46
|
*/
|
|
@@ -48,7 +48,7 @@ interface PageHeaderBreadcrumbBarProps {
|
|
|
48
48
|
/**
|
|
49
49
|
* `true` to set page actions flush with page
|
|
50
50
|
*/
|
|
51
|
-
pageActionsFlush?:
|
|
51
|
+
pageActionsFlush?: boolean;
|
|
52
52
|
}
|
|
53
53
|
declare const PageHeaderBreadcrumbBar: React.ForwardRefExoticComponent<PageHeaderBreadcrumbBarProps & React.RefAttributes<HTMLDivElement>>;
|
|
54
54
|
/**
|
|
@@ -44,11 +44,11 @@ var Text = require('../Text/Text.js');
|
|
|
44
44
|
* ----------
|
|
45
45
|
*/
|
|
46
46
|
|
|
47
|
-
const PageHeader = /*#__PURE__*/React.forwardRef(
|
|
47
|
+
const PageHeader = /*#__PURE__*/React.forwardRef(({
|
|
48
48
|
className,
|
|
49
49
|
children,
|
|
50
50
|
...other
|
|
51
|
-
}, ref) {
|
|
51
|
+
}, ref) => {
|
|
52
52
|
const prefix = usePrefix.usePrefix();
|
|
53
53
|
const classNames = cx({
|
|
54
54
|
[`${prefix}--page-header`]: true
|
|
@@ -66,7 +66,7 @@ PageHeader.displayName = 'PageHeader';
|
|
|
66
66
|
* -----------------------
|
|
67
67
|
*/
|
|
68
68
|
|
|
69
|
-
const PageHeaderBreadcrumbBar = /*#__PURE__*/React.forwardRef(
|
|
69
|
+
const PageHeaderBreadcrumbBar = /*#__PURE__*/React.forwardRef(({
|
|
70
70
|
border = true,
|
|
71
71
|
className,
|
|
72
72
|
children,
|
|
@@ -76,7 +76,7 @@ const PageHeaderBreadcrumbBar = /*#__PURE__*/React.forwardRef(function PageHeade
|
|
|
76
76
|
pageActions,
|
|
77
77
|
pageActionsFlush,
|
|
78
78
|
...other
|
|
79
|
-
}, ref) {
|
|
79
|
+
}, ref) => {
|
|
80
80
|
const prefix = usePrefix.usePrefix();
|
|
81
81
|
const classNames = cx({
|
|
82
82
|
[`${prefix}--page-header__breadcrumb-bar`]: true,
|
|
@@ -113,7 +113,7 @@ PageHeaderBreadcrumbBar.displayName = 'PageHeaderBreadcrumbBar';
|
|
|
113
113
|
* -----------------
|
|
114
114
|
*/
|
|
115
115
|
|
|
116
|
-
const PageHeaderContent = /*#__PURE__*/React.forwardRef(
|
|
116
|
+
const PageHeaderContent = /*#__PURE__*/React.forwardRef(({
|
|
117
117
|
className,
|
|
118
118
|
children,
|
|
119
119
|
title,
|
|
@@ -121,7 +121,7 @@ const PageHeaderContent = /*#__PURE__*/React.forwardRef(function PageHeaderConte
|
|
|
121
121
|
contextualActions,
|
|
122
122
|
pageActions,
|
|
123
123
|
...other
|
|
124
|
-
}, ref) {
|
|
124
|
+
}, ref) => {
|
|
125
125
|
const prefix = usePrefix.usePrefix();
|
|
126
126
|
const classNames = cx({
|
|
127
127
|
[`${prefix}--page-header__content`]: true
|
|
@@ -133,6 +133,7 @@ const PageHeaderContent = /*#__PURE__*/React.forwardRef(function PageHeaderConte
|
|
|
133
133
|
return element.offsetHeight < element.scrollHeight;
|
|
134
134
|
};
|
|
135
135
|
React.useLayoutEffect(() => {
|
|
136
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
136
137
|
titleRef.current && isEllipsisActive(titleRef.current);
|
|
137
138
|
}, [title]);
|
|
138
139
|
return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({
|
|
@@ -204,6 +205,7 @@ PageHeaderContent.propTypes = {
|
|
|
204
205
|
|
|
205
206
|
const PageHeaderContentPageActions = ({
|
|
206
207
|
className,
|
|
208
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
207
209
|
children,
|
|
208
210
|
menuButtonLabel = 'Actions',
|
|
209
211
|
actions,
|
|
@@ -239,6 +241,7 @@ const PageHeaderContentPageActions = ({
|
|
|
239
241
|
}
|
|
240
242
|
}
|
|
241
243
|
});
|
|
244
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
242
245
|
}, []);
|
|
243
246
|
return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({
|
|
244
247
|
className: classNames,
|
|
@@ -361,12 +364,12 @@ PageHeaderHeroImage.propTypes = {
|
|
|
361
364
|
* ----------------
|
|
362
365
|
*/
|
|
363
366
|
|
|
364
|
-
const PageHeaderTabBar = /*#__PURE__*/React.forwardRef(
|
|
367
|
+
const PageHeaderTabBar = /*#__PURE__*/React.forwardRef(({
|
|
365
368
|
className,
|
|
366
369
|
children,
|
|
367
370
|
tags = [],
|
|
368
371
|
...other
|
|
369
|
-
}, ref) {
|
|
372
|
+
}, ref) => {
|
|
370
373
|
const prefix = usePrefix.usePrefix();
|
|
371
374
|
const classNames = cx({
|
|
372
375
|
[`${prefix}--page-header__tab-bar`]: true
|
|
@@ -382,18 +385,26 @@ const PageHeaderTabBar = /*#__PURE__*/React.forwardRef(function PageHeaderTabBar
|
|
|
382
385
|
sm: 4
|
|
383
386
|
}, children)));
|
|
384
387
|
}
|
|
388
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
385
389
|
const [openPopover, setOpenPopover] = React.useState(false);
|
|
386
390
|
const tagSize = tags[0]?.size || 'md';
|
|
391
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
387
392
|
const instanceId = useId.useId('PageHeaderTabBar');
|
|
393
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
388
394
|
const tagsWithIds = React.useMemo(() => {
|
|
389
395
|
return tags.map((tag, index) => ({
|
|
390
396
|
...tag,
|
|
391
397
|
id: tag.id || `tag-${index}-${instanceId}`
|
|
392
398
|
}));
|
|
399
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
393
400
|
}, [tags]);
|
|
401
|
+
|
|
402
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
394
403
|
const tagsContainerRef = React.useRef(null);
|
|
404
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
395
405
|
const offsetRef = React.useRef(null);
|
|
396
406
|
// To close popover when window resizes
|
|
407
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
397
408
|
React.useEffect(() => {
|
|
398
409
|
const handleResize = () => {
|
|
399
410
|
// Close the popover when window resizes to prevent unwanted opens
|
|
@@ -410,11 +421,14 @@ const PageHeaderTabBar = /*#__PURE__*/React.forwardRef(function PageHeaderTabBar
|
|
|
410
421
|
visibleItems = [],
|
|
411
422
|
hiddenItems = [],
|
|
412
423
|
itemRefHandler = () => {}
|
|
424
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
413
425
|
} = useOverflowItems.default(tagsWithIds, tagsContainerRef, offsetRef) || {
|
|
414
426
|
visibleItems: [],
|
|
415
427
|
hiddenItems: [],
|
|
416
428
|
itemRefHandler: () => {}
|
|
417
429
|
};
|
|
430
|
+
|
|
431
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
418
432
|
const handleOverflowClick = React.useCallback(event => {
|
|
419
433
|
event.stopPropagation();
|
|
420
434
|
setOpenPopover(prev => !prev);
|