@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
|
@@ -21,7 +21,6 @@ import ListBoxSelection from '../ListBox/next/ListBoxSelection.js';
|
|
|
21
21
|
import ListBoxTrigger from '../ListBox/next/ListBoxTrigger.js';
|
|
22
22
|
import { Space, Enter, Delete, Escape, Tab, Home, End } from '../../internal/keyboard/keys.js';
|
|
23
23
|
import { match } from '../../internal/keyboard/match.js';
|
|
24
|
-
import { defaultItemToString } from './tools/itemToString.js';
|
|
25
24
|
import mergeRefs from '../../tools/mergeRefs.js';
|
|
26
25
|
import { deprecate } from '../../prop-types/deprecate.js';
|
|
27
26
|
import { useId } from '../../internal/useId.js';
|
|
@@ -32,6 +31,7 @@ import { FormContext } from '../FluidForm/FormContext.js';
|
|
|
32
31
|
import { useSelection } from '../../internal/Selection.js';
|
|
33
32
|
import { useFloating, autoUpdate, flip, size, hide } from '@floating-ui/react';
|
|
34
33
|
import { AILabel } from '../AILabel/index.js';
|
|
34
|
+
import { defaultItemToString } from '../../internal/defaultItemToString.js';
|
|
35
35
|
import { isComponentElement } from '../../internal/utils.js';
|
|
36
36
|
import { ListBoxTypePropType, ListBoxSizePropType } from '../ListBox/ListBoxPropTypes.js';
|
|
37
37
|
|
|
@@ -111,6 +111,7 @@ const FilterableMultiSelect = /*#__PURE__*/forwardRef(function FilterableMultiSe
|
|
|
111
111
|
isFluid
|
|
112
112
|
} = useContext(FormContext);
|
|
113
113
|
const isFirstRender = useRef(true);
|
|
114
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
114
115
|
const [isFocused, setIsFocused] = useState(false);
|
|
115
116
|
const [isOpen, setIsOpen] = useState(!!open);
|
|
116
117
|
const [prevOpen, setPrevOpen] = useState(!!open);
|
|
@@ -121,7 +122,10 @@ const FilterableMultiSelect = /*#__PURE__*/forwardRef(function FilterableMultiSe
|
|
|
121
122
|
itemToString,
|
|
122
123
|
inputValue
|
|
123
124
|
}), [items, inputValue, itemToString, filterItems]);
|
|
124
|
-
const nonSelectAllItems = useMemo(
|
|
125
|
+
const nonSelectAllItems = useMemo(
|
|
126
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
127
|
+
() => filteredItems.filter(item => !item.isSelectAll), [filteredItems]);
|
|
128
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
125
129
|
const selectAll = filteredItems.some(item => item.isSelectAll);
|
|
126
130
|
const {
|
|
127
131
|
selectedItems: controlledSelectedItems,
|
|
@@ -137,7 +141,9 @@ const FilterableMultiSelect = /*#__PURE__*/forwardRef(function FilterableMultiSe
|
|
|
137
141
|
filteredItems
|
|
138
142
|
});
|
|
139
143
|
const selectAllStatus = useMemo(() => {
|
|
140
|
-
const selectable = nonSelectAllItems.filter(
|
|
144
|
+
const selectable = nonSelectAllItems.filter(
|
|
145
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
146
|
+
item => !item.disabled);
|
|
141
147
|
const nonSelectedCount = selectable.filter(item => !controlledSelectedItems.some(sel => isEqual(sel, item))).length;
|
|
142
148
|
const totalCount = selectable.length;
|
|
143
149
|
return {
|
|
@@ -146,6 +152,7 @@ const FilterableMultiSelect = /*#__PURE__*/forwardRef(function FilterableMultiSe
|
|
|
146
152
|
};
|
|
147
153
|
}, [controlledSelectedItems, nonSelectAllItems]);
|
|
148
154
|
const handleSelectAllClick = useCallback(() => {
|
|
155
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
149
156
|
const selectable = nonSelectAllItems.filter(i => !i.disabled);
|
|
150
157
|
const {
|
|
151
158
|
checked,
|
|
@@ -162,6 +169,7 @@ const FilterableMultiSelect = /*#__PURE__*/forwardRef(function FilterableMultiSe
|
|
|
162
169
|
const toSelect = selectable.filter(e => !controlledSelectedItems.some(sel => isEqual(sel, e)));
|
|
163
170
|
toggleAll([...controlledSelectedItems, ...toSelect]);
|
|
164
171
|
}
|
|
172
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
165
173
|
}, [nonSelectAllItems, selectAllStatus, controlledSelectedItems, toggleAll]);
|
|
166
174
|
const {
|
|
167
175
|
refs,
|
|
@@ -212,11 +220,14 @@ const FilterableMultiSelect = /*#__PURE__*/forwardRef(function FilterableMultiSe
|
|
|
212
220
|
|
|
213
221
|
// memoize sorted items to reduce unnecessary expensive sort on rerender
|
|
214
222
|
const sortedItems = useMemo(() => {
|
|
215
|
-
// eslint-disable-next-line @typescript-eslint/no-
|
|
223
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
216
224
|
const selectAllItem = items.find(item => item.isSelectAll);
|
|
217
|
-
const selectableRealItems = nonSelectAllItems.filter(
|
|
225
|
+
const selectableRealItems = nonSelectAllItems.filter(
|
|
226
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
227
|
+
item => !item.disabled);
|
|
218
228
|
|
|
219
229
|
// Sort only non-select-all items, select-all item must stay at the top
|
|
230
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
220
231
|
const sortedReal = sortItems(nonSelectAllItems, {
|
|
221
232
|
selectedItems: {
|
|
222
233
|
top: controlledSelectedItems,
|
|
@@ -233,6 +244,7 @@ const FilterableMultiSelect = /*#__PURE__*/forwardRef(function FilterableMultiSe
|
|
|
233
244
|
return [selectAllItem, ...sortedReal];
|
|
234
245
|
}
|
|
235
246
|
return sortedReal;
|
|
247
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
236
248
|
}, [items, inputValue, controlledSelectedItems, topItems, selectionFeedback, itemToString, compareItems, locale, sortItems, nonSelectAllItems]);
|
|
237
249
|
const inline = type === 'inline';
|
|
238
250
|
const showWarning = !invalid && warn;
|
|
@@ -316,6 +328,7 @@ const FilterableMultiSelect = /*#__PURE__*/forwardRef(function FilterableMultiSe
|
|
|
316
328
|
return () => {
|
|
317
329
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
318
330
|
};
|
|
331
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
319
332
|
}, [isOpen, inputFocused]);
|
|
320
333
|
const {
|
|
321
334
|
getToggleButtonProps,
|
|
@@ -338,7 +351,9 @@ const FilterableMultiSelect = /*#__PURE__*/forwardRef(function FilterableMultiSe
|
|
|
338
351
|
inputId,
|
|
339
352
|
inputValue,
|
|
340
353
|
stateReducer,
|
|
354
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
341
355
|
isItemDisabled(item, _index) {
|
|
356
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
342
357
|
return item?.disabled;
|
|
343
358
|
}
|
|
344
359
|
});
|
|
@@ -509,7 +524,9 @@ const FilterableMultiSelect = /*#__PURE__*/forwardRef(function FilterableMultiSe
|
|
|
509
524
|
}) : null;
|
|
510
525
|
|
|
511
526
|
// exclude the select-all item from the count
|
|
512
|
-
const selectedItemsLength = controlledSelectedItems.filter(
|
|
527
|
+
const selectedItemsLength = controlledSelectedItems.filter(
|
|
528
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
529
|
+
item => !item.isSelectAll).length;
|
|
513
530
|
const className = cx(`${prefix}--multi-select`, `${prefix}--combo-box`, `${prefix}--multi-select--filterable`, {
|
|
514
531
|
[`${prefix}--multi-select--invalid`]: invalid,
|
|
515
532
|
[`${prefix}--multi-select--invalid--focused`]: invalid && inputFocused,
|
|
@@ -690,6 +707,7 @@ const FilterableMultiSelect = /*#__PURE__*/forwardRef(function FilterableMultiSe
|
|
|
690
707
|
}, normalizedDecorator) : '', /*#__PURE__*/React.createElement(ListBox.Menu, menuProps, isOpen ? sortedItems.map((item, index) => {
|
|
691
708
|
let isChecked;
|
|
692
709
|
let isIndeterminate = false;
|
|
710
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
693
711
|
if (item.isSelectAll) {
|
|
694
712
|
isChecked = selectAllStatus.checked;
|
|
695
713
|
isIndeterminate = selectAllStatus.indeterminate;
|
|
@@ -787,6 +805,7 @@ FilterableMultiSelect.propTypes = {
|
|
|
787
805
|
* change, and in some cases they can not be shimmed by Carbon to shield you
|
|
788
806
|
* from potentially breaking changes.
|
|
789
807
|
*/
|
|
808
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
790
809
|
// @ts-ignore
|
|
791
810
|
downshiftProps: PropTypes.shape(Downshift.propTypes),
|
|
792
811
|
/**
|
|
@@ -30,6 +30,7 @@ import { noopFn } from '../../internal/noopFn.js';
|
|
|
30
30
|
import { useFloating, autoUpdate, flip, size, hide } from '@floating-ui/react';
|
|
31
31
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
32
32
|
import { AILabel } from '../AILabel/index.js';
|
|
33
|
+
import { defaultItemToString } from '../../internal/defaultItemToString.js';
|
|
33
34
|
import { isComponentElement } from '../../internal/utils.js';
|
|
34
35
|
import { ListBoxTypePropType, ListBoxSizePropType } from '../ListBox/ListBoxPropTypes.js';
|
|
35
36
|
|
|
@@ -48,18 +49,6 @@ const {
|
|
|
48
49
|
ToggleButtonKeyDownPageUp,
|
|
49
50
|
FunctionSetHighlightedIndex
|
|
50
51
|
} = useSelect.stateChangeTypes;
|
|
51
|
-
const defaultItemToString = item => {
|
|
52
|
-
if (typeof item === 'string') {
|
|
53
|
-
return item;
|
|
54
|
-
}
|
|
55
|
-
if (typeof item === 'number') {
|
|
56
|
-
return `${item}`;
|
|
57
|
-
}
|
|
58
|
-
if (item !== null && typeof item === 'object' && 'label' in item && typeof item['label'] === 'string') {
|
|
59
|
-
return item['label'];
|
|
60
|
-
}
|
|
61
|
-
return '';
|
|
62
|
-
};
|
|
63
52
|
const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
64
53
|
autoAlign = false,
|
|
65
54
|
className: containerClassName,
|
|
@@ -111,12 +100,15 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
111
100
|
return true; // Return true if item is not an object with undefined values
|
|
112
101
|
});
|
|
113
102
|
}, [items]);
|
|
103
|
+
|
|
104
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
114
105
|
const selectAll = filteredItems.some(item => item.isSelectAll);
|
|
115
106
|
const prefix = usePrefix();
|
|
116
107
|
const {
|
|
117
108
|
isFluid
|
|
118
109
|
} = useContext(FormContext);
|
|
119
110
|
const multiSelectInstanceId = useId();
|
|
111
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
120
112
|
const [isFocused, setIsFocused] = useState(false);
|
|
121
113
|
const [inputFocused, setInputFocused] = useState(false);
|
|
122
114
|
const [isOpen, setIsOpen] = useState(open || false);
|
|
@@ -185,13 +177,15 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
185
177
|
stateReducer,
|
|
186
178
|
isOpen,
|
|
187
179
|
itemToString: filteredItems => {
|
|
188
|
-
return Array.isArray(filteredItems) && filteredItems.map(
|
|
180
|
+
return Array.isArray(filteredItems) && filteredItems.map(item => {
|
|
189
181
|
return itemToString(item);
|
|
190
182
|
}).join(', ') || '';
|
|
191
183
|
},
|
|
192
184
|
selectedItem: controlledSelectedItems,
|
|
193
185
|
items: filteredItems,
|
|
186
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
194
187
|
isItemDisabled(item, _index) {
|
|
188
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
195
189
|
return item?.disabled;
|
|
196
190
|
},
|
|
197
191
|
...downshiftProps
|
|
@@ -386,6 +380,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
386
380
|
[`${prefix}--list-box__field--wrapper--input-focused`]: inputFocused
|
|
387
381
|
});
|
|
388
382
|
const handleFocus = evt => {
|
|
383
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
389
384
|
evt.target.classList.contains(`${prefix}--tag__close-icon`) ? setIsFocused(false) : setIsFocused(evt.type === 'focus' ? true : false);
|
|
390
385
|
};
|
|
391
386
|
const readOnlyEventHandlers = readOnly ? {
|
|
@@ -413,7 +408,9 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
413
408
|
size: 'mini'
|
|
414
409
|
}) : null;
|
|
415
410
|
const itemsSelectedText = selectedItems.length > 0 && selectedItems.map(item => item?.text);
|
|
416
|
-
const selectedItemsLength = selectAll ?
|
|
411
|
+
const selectedItemsLength = selectAll ?
|
|
412
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
413
|
+
selectedItems.filter(item => !item.isSelectAll).length : selectedItems.length;
|
|
417
414
|
|
|
418
415
|
// Memoize the value of getMenuProps to avoid an infinite loop
|
|
419
416
|
const menuProps = useMemo(() => getMenuProps({
|
|
@@ -432,7 +429,9 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
432
429
|
nonSelectAllSelectedCount,
|
|
433
430
|
totalSelectableCount
|
|
434
431
|
};
|
|
435
|
-
},
|
|
432
|
+
},
|
|
433
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
434
|
+
[selectedItems, filteredItems]);
|
|
436
435
|
return /*#__PURE__*/React.createElement("div", {
|
|
437
436
|
className: wrapperClasses
|
|
438
437
|
}, /*#__PURE__*/React.createElement("label", _extends({
|
|
@@ -484,14 +483,20 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
484
483
|
translateWithId: translateWithId
|
|
485
484
|
})), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React.createElement("div", {
|
|
486
485
|
className: `${prefix}--list-box__inner-wrapper--decorator`
|
|
487
|
-
}, normalizedDecorator) : ''), /*#__PURE__*/React.createElement(ListBox.Menu, menuProps, isOpen &&
|
|
486
|
+
}, normalizedDecorator) : ''), /*#__PURE__*/React.createElement(ListBox.Menu, menuProps, isOpen &&
|
|
487
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
488
|
+
sortItems(filteredItems, sortOptions).map((item, index) => {
|
|
488
489
|
const {
|
|
489
490
|
hasIndividualSelections,
|
|
490
491
|
nonSelectAllSelectedCount,
|
|
491
492
|
totalSelectableCount
|
|
492
493
|
} = getSelectionStats(selectedItems, filteredItems);
|
|
494
|
+
|
|
495
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
493
496
|
const isChecked = item.isSelectAll ? nonSelectAllSelectedCount === totalSelectableCount && totalSelectableCount > 0 : selectedItems.some(selected => isEqual(selected, item));
|
|
494
|
-
const isIndeterminate =
|
|
497
|
+
const isIndeterminate =
|
|
498
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
499
|
+
item.isSelectAll && hasIndividualSelections && nonSelectAllSelectedCount < totalSelectableCount;
|
|
495
500
|
const itemProps = getItemProps({
|
|
496
501
|
item,
|
|
497
502
|
// 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
|
*/
|
|
@@ -24,7 +24,7 @@ import { noopFn } from '../../internal/noopFn.js';
|
|
|
24
24
|
import { wrapFocusWithoutSentinels, wrapFocus } from '../../internal/wrapFocus.js';
|
|
25
25
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
26
26
|
import { warning } from '../../internal/warning.js';
|
|
27
|
-
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
27
|
+
import { deprecateValuesWithin } from '../../prop-types/deprecateValuesWithin.js';
|
|
28
28
|
import { Text } from '../Text/Text.js';
|
|
29
29
|
|
|
30
30
|
/**
|
|
@@ -108,7 +108,6 @@ function NotificationButton({
|
|
|
108
108
|
[`${prefix}--${notificationType}-notification__close-icon`]: notificationType
|
|
109
109
|
});
|
|
110
110
|
return /*#__PURE__*/React.createElement("button", _extends({}, rest, {
|
|
111
|
-
// eslint-disable-next-line react/button-has-type
|
|
112
111
|
type: type,
|
|
113
112
|
"aria-label": deprecatedAriaLabel || ariaLabel,
|
|
114
113
|
title: deprecatedAriaLabel || ariaLabel,
|
|
@@ -700,12 +699,12 @@ ActionableNotification.propTypes = {
|
|
|
700
699
|
* @deprecated Use NewKindProps instead.
|
|
701
700
|
*/
|
|
702
701
|
|
|
702
|
+
const mapping = {
|
|
703
|
+
error: 'warning',
|
|
704
|
+
// only redirect error -> warning
|
|
705
|
+
success: 'info' // only redirect success -> info
|
|
706
|
+
};
|
|
703
707
|
const propMappingFunction = deprecatedValue => {
|
|
704
|
-
const mapping = {
|
|
705
|
-
error: 'warning',
|
|
706
|
-
// only redirect error -> warning
|
|
707
|
-
success: 'info' // only redirect success -> info
|
|
708
|
-
};
|
|
709
708
|
return mapping[deprecatedValue];
|
|
710
709
|
};
|
|
711
710
|
function Callout({
|
|
@@ -808,6 +807,7 @@ Callout.propTypes = {
|
|
|
808
807
|
/**
|
|
809
808
|
* @deprecated Use `CalloutProps` instead.
|
|
810
809
|
*/
|
|
810
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
811
811
|
|
|
812
812
|
let didWarnAboutDeprecation = false;
|
|
813
813
|
const StaticNotification = props => {
|
|
@@ -41,7 +41,8 @@ const defaultTranslations = {
|
|
|
41
41
|
[translationIds['increment.number']]: 'Increment number',
|
|
42
42
|
[translationIds['decrement.number']]: 'Decrement number'
|
|
43
43
|
};
|
|
44
|
-
|
|
44
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
45
|
+
const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
|
|
45
46
|
const {
|
|
46
47
|
allowEmpty = false,
|
|
47
48
|
className: customClassName,
|
|
@@ -101,6 +102,7 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
|
|
|
101
102
|
}
|
|
102
103
|
return 0;
|
|
103
104
|
});
|
|
105
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
104
106
|
const [prevControlledValue, setPrevControlledValue] = useState(controlledValue);
|
|
105
107
|
const numberParser = useMemo(() => new NumberParser(locale, formatOptions), [locale, formatOptions]);
|
|
106
108
|
/**
|
|
@@ -233,6 +235,8 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
|
|
|
233
235
|
[`${prefix}--number-input--fluid--focus`]: isFluid && isFocused,
|
|
234
236
|
[`${prefix}--number-input--fluid--disabled`]: isFluid && disabled
|
|
235
237
|
});
|
|
238
|
+
|
|
239
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
236
240
|
const Icon = normalizedProps.icon;
|
|
237
241
|
const getDecimalPlaces = num => {
|
|
238
242
|
const parts = num.toString().split('.');
|
|
@@ -342,7 +346,9 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
|
|
|
342
346
|
onKeyUp: onKeyUp,
|
|
343
347
|
onKeyDown: e => {
|
|
344
348
|
if (type === 'text') {
|
|
349
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
345
350
|
match(e, ArrowUp) && handleStep(e, 'up');
|
|
351
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
346
352
|
match(e, ArrowDown) && handleStep(e, 'down');
|
|
347
353
|
}
|
|
348
354
|
if (rest?.onKeyDown) {
|
|
@@ -21,7 +21,7 @@ import mergeRefs from '../../tools/mergeRefs.js';
|
|
|
21
21
|
import { setupGetInstanceId } from '../../tools/setupGetInstanceId.js';
|
|
22
22
|
import { IconButton } from '../IconButton/index.js';
|
|
23
23
|
import { useOutsideClick } from '../../internal/useOutsideClick.js';
|
|
24
|
-
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
24
|
+
import { deprecateValuesWithin } from '../../prop-types/deprecateValuesWithin.js';
|
|
25
25
|
import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
|
|
26
26
|
|
|
27
27
|
const getInstanceId = setupGetInstanceId();
|
|
@@ -66,6 +66,7 @@ const getMenuOffset = (menuBody, direction, trigger, flip) => {
|
|
|
66
66
|
if (process.env.NODE_ENV !== 'production') {
|
|
67
67
|
!(triggerButtonPositionProp && triggerButtonPositionFactor) ? process.env.NODE_ENV !== "production" ? invariant(false, '[OverflowMenu] wrong floating menu direction: `%s`', direction) : invariant(false) : void 0;
|
|
68
68
|
}
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
69
70
|
const {
|
|
70
71
|
offsetWidth: menuWidth,
|
|
71
72
|
offsetHeight: menuHeight
|
|
@@ -88,6 +89,7 @@ const getMenuOffset = (menuBody, direction, trigger, flip) => {
|
|
|
88
89
|
};
|
|
89
90
|
}
|
|
90
91
|
};
|
|
92
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
91
93
|
const OverflowMenu = /*#__PURE__*/forwardRef(({
|
|
92
94
|
align,
|
|
93
95
|
['aria-label']: ariaLabel = null,
|
|
@@ -19,11 +19,12 @@ import mergeRefs from '../../../tools/mergeRefs.js';
|
|
|
19
19
|
import { useId } from '../../../internal/useId.js';
|
|
20
20
|
import { usePrefix } from '../../../internal/usePrefix.js';
|
|
21
21
|
import { useAttachedMenu } from '../../../internal/useAttachedMenu.js';
|
|
22
|
-
import deprecateValuesWithin from '../../../prop-types/deprecateValuesWithin.js';
|
|
22
|
+
import { deprecateValuesWithin } from '../../../prop-types/deprecateValuesWithin.js';
|
|
23
23
|
import { mapPopoverAlign } from '../../../tools/mapPopoverAlign.js';
|
|
24
24
|
|
|
25
25
|
const defaultSize = 'md';
|
|
26
|
-
|
|
26
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
27
|
+
const OverflowMenu = /*#__PURE__*/React.forwardRef(({
|
|
27
28
|
autoAlign = false,
|
|
28
29
|
children,
|
|
29
30
|
className,
|
|
@@ -34,7 +35,7 @@ const OverflowMenu = /*#__PURE__*/React.forwardRef(function OverflowMenu({
|
|
|
34
35
|
tooltipAlignment,
|
|
35
36
|
menuTarget,
|
|
36
37
|
...rest
|
|
37
|
-
}, forwardRef) {
|
|
38
|
+
}, forwardRef) => {
|
|
38
39
|
const enableFloatingStyles = useFeatureFlag('enable-v12-dynamic-floating-styles') || autoAlign;
|
|
39
40
|
const {
|
|
40
41
|
refs,
|
|
@@ -89,12 +89,14 @@ const OverflowMenuItem = frFn((props, ref) => {
|
|
|
89
89
|
// ref as any: the type of `ref` is `ForwardedRef<HTMLButtonElement>` in `Button` component
|
|
90
90
|
// but `OverflowMenuItem` can be rendered as `a` tag as well, which is `HTMLAnchorElement`
|
|
91
91
|
// so we have to use `any` here
|
|
92
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
92
93
|
,
|
|
93
94
|
ref: ref,
|
|
94
95
|
tabIndex: -1
|
|
95
96
|
// itemText as any: itemText may be a ReactNode, but `title` only accepts string
|
|
96
97
|
// to avoid compatibility issue, we use `any` here. Consider to enforce `itemText` to be `string?`
|
|
97
98
|
// in the next major release
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
98
100
|
,
|
|
99
101
|
title: requireTitle ? title || itemText : undefined
|
|
100
102
|
}, 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
|
/**
|
|
@@ -42,11 +42,11 @@ import { Text } from '../Text/Text.js';
|
|
|
42
42
|
* ----------
|
|
43
43
|
*/
|
|
44
44
|
|
|
45
|
-
const PageHeader = /*#__PURE__*/React.forwardRef(
|
|
45
|
+
const PageHeader = /*#__PURE__*/React.forwardRef(({
|
|
46
46
|
className,
|
|
47
47
|
children,
|
|
48
48
|
...other
|
|
49
|
-
}, ref) {
|
|
49
|
+
}, ref) => {
|
|
50
50
|
const prefix = usePrefix();
|
|
51
51
|
const classNames = cx({
|
|
52
52
|
[`${prefix}--page-header`]: true
|
|
@@ -64,7 +64,7 @@ PageHeader.displayName = 'PageHeader';
|
|
|
64
64
|
* -----------------------
|
|
65
65
|
*/
|
|
66
66
|
|
|
67
|
-
const PageHeaderBreadcrumbBar = /*#__PURE__*/React.forwardRef(
|
|
67
|
+
const PageHeaderBreadcrumbBar = /*#__PURE__*/React.forwardRef(({
|
|
68
68
|
border = true,
|
|
69
69
|
className,
|
|
70
70
|
children,
|
|
@@ -74,7 +74,7 @@ const PageHeaderBreadcrumbBar = /*#__PURE__*/React.forwardRef(function PageHeade
|
|
|
74
74
|
pageActions,
|
|
75
75
|
pageActionsFlush,
|
|
76
76
|
...other
|
|
77
|
-
}, ref) {
|
|
77
|
+
}, ref) => {
|
|
78
78
|
const prefix = usePrefix();
|
|
79
79
|
const classNames = cx({
|
|
80
80
|
[`${prefix}--page-header__breadcrumb-bar`]: true,
|
|
@@ -111,7 +111,7 @@ PageHeaderBreadcrumbBar.displayName = 'PageHeaderBreadcrumbBar';
|
|
|
111
111
|
* -----------------
|
|
112
112
|
*/
|
|
113
113
|
|
|
114
|
-
const PageHeaderContent = /*#__PURE__*/React.forwardRef(
|
|
114
|
+
const PageHeaderContent = /*#__PURE__*/React.forwardRef(({
|
|
115
115
|
className,
|
|
116
116
|
children,
|
|
117
117
|
title,
|
|
@@ -119,7 +119,7 @@ const PageHeaderContent = /*#__PURE__*/React.forwardRef(function PageHeaderConte
|
|
|
119
119
|
contextualActions,
|
|
120
120
|
pageActions,
|
|
121
121
|
...other
|
|
122
|
-
}, ref) {
|
|
122
|
+
}, ref) => {
|
|
123
123
|
const prefix = usePrefix();
|
|
124
124
|
const classNames = cx({
|
|
125
125
|
[`${prefix}--page-header__content`]: true
|
|
@@ -131,6 +131,7 @@ const PageHeaderContent = /*#__PURE__*/React.forwardRef(function PageHeaderConte
|
|
|
131
131
|
return element.offsetHeight < element.scrollHeight;
|
|
132
132
|
};
|
|
133
133
|
useLayoutEffect(() => {
|
|
134
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
134
135
|
titleRef.current && isEllipsisActive(titleRef.current);
|
|
135
136
|
}, [title]);
|
|
136
137
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
@@ -202,6 +203,7 @@ PageHeaderContent.propTypes = {
|
|
|
202
203
|
|
|
203
204
|
const PageHeaderContentPageActions = ({
|
|
204
205
|
className,
|
|
206
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
205
207
|
children,
|
|
206
208
|
menuButtonLabel = 'Actions',
|
|
207
209
|
actions,
|
|
@@ -237,6 +239,7 @@ const PageHeaderContentPageActions = ({
|
|
|
237
239
|
}
|
|
238
240
|
}
|
|
239
241
|
});
|
|
242
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
240
243
|
}, []);
|
|
241
244
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
242
245
|
className: classNames,
|
|
@@ -359,12 +362,12 @@ PageHeaderHeroImage.propTypes = {
|
|
|
359
362
|
* ----------------
|
|
360
363
|
*/
|
|
361
364
|
|
|
362
|
-
const PageHeaderTabBar = /*#__PURE__*/React.forwardRef(
|
|
365
|
+
const PageHeaderTabBar = /*#__PURE__*/React.forwardRef(({
|
|
363
366
|
className,
|
|
364
367
|
children,
|
|
365
368
|
tags = [],
|
|
366
369
|
...other
|
|
367
|
-
}, ref) {
|
|
370
|
+
}, ref) => {
|
|
368
371
|
const prefix = usePrefix();
|
|
369
372
|
const classNames = cx({
|
|
370
373
|
[`${prefix}--page-header__tab-bar`]: true
|
|
@@ -380,18 +383,26 @@ const PageHeaderTabBar = /*#__PURE__*/React.forwardRef(function PageHeaderTabBar
|
|
|
380
383
|
sm: 4
|
|
381
384
|
}, children)));
|
|
382
385
|
}
|
|
386
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
383
387
|
const [openPopover, setOpenPopover] = useState(false);
|
|
384
388
|
const tagSize = tags[0]?.size || 'md';
|
|
389
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
385
390
|
const instanceId = useId('PageHeaderTabBar');
|
|
391
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
386
392
|
const tagsWithIds = useMemo(() => {
|
|
387
393
|
return tags.map((tag, index) => ({
|
|
388
394
|
...tag,
|
|
389
395
|
id: tag.id || `tag-${index}-${instanceId}`
|
|
390
396
|
}));
|
|
397
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
391
398
|
}, [tags]);
|
|
399
|
+
|
|
400
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
392
401
|
const tagsContainerRef = useRef(null);
|
|
402
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
393
403
|
const offsetRef = useRef(null);
|
|
394
404
|
// To close popover when window resizes
|
|
405
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
395
406
|
useEffect(() => {
|
|
396
407
|
const handleResize = () => {
|
|
397
408
|
// Close the popover when window resizes to prevent unwanted opens
|
|
@@ -408,11 +419,14 @@ const PageHeaderTabBar = /*#__PURE__*/React.forwardRef(function PageHeaderTabBar
|
|
|
408
419
|
visibleItems = [],
|
|
409
420
|
hiddenItems = [],
|
|
410
421
|
itemRefHandler = () => {}
|
|
422
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
411
423
|
} = useOverflowItems(tagsWithIds, tagsContainerRef, offsetRef) || {
|
|
412
424
|
visibleItems: [],
|
|
413
425
|
hiddenItems: [],
|
|
414
426
|
itemRefHandler: () => {}
|
|
415
427
|
};
|
|
428
|
+
|
|
429
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
416
430
|
const handleOverflowClick = useCallback(event => {
|
|
417
431
|
event.stopPropagation();
|
|
418
432
|
setOpenPopover(prev => !prev);
|
|
@@ -49,7 +49,9 @@ function getPageSize(pageSizes, pageSize) {
|
|
|
49
49
|
}
|
|
50
50
|
return pageSizes[0].value;
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
|
|
53
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
54
|
+
const Pagination = /*#__PURE__*/React.forwardRef(({
|
|
53
55
|
backwardText = 'Previous page',
|
|
54
56
|
className: customClassName = '',
|
|
55
57
|
disabled = false,
|
|
@@ -60,6 +62,7 @@ const Pagination = /*#__PURE__*/React.forwardRef(function Pagination({
|
|
|
60
62
|
itemRangeText = (min, max, total) => `${min}–${max} of ${total} items`,
|
|
61
63
|
itemsPerPageText = 'Items per page:',
|
|
62
64
|
onChange,
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
63
66
|
pageNumberText: _pageNumberText = 'Page Number',
|
|
64
67
|
pageRangeText = (_current, total) => `of ${total} ${total === 1 ? 'page' : 'pages'}`,
|
|
65
68
|
page: controlledPage = 1,
|
|
@@ -72,7 +75,7 @@ const Pagination = /*#__PURE__*/React.forwardRef(function Pagination({
|
|
|
72
75
|
size = 'md',
|
|
73
76
|
totalItems,
|
|
74
77
|
...rest
|
|
75
|
-
}, ref) {
|
|
78
|
+
}, ref) => {
|
|
76
79
|
const prefix = usePrefix();
|
|
77
80
|
const inputId = useFallbackId(id?.toString());
|
|
78
81
|
const backBtnRef = useRef(null);
|
|
@@ -122,6 +125,7 @@ const Pagination = /*#__PURE__*/React.forwardRef(function Pagination({
|
|
|
122
125
|
handleFocus(focusTarget);
|
|
123
126
|
setFocusTarget(null);
|
|
124
127
|
}
|
|
128
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
125
129
|
}, [focusTarget]);
|
|
126
130
|
|
|
127
131
|
// Sync state with props
|