@carbon/react 1.92.1 → 1.93.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +874 -838
- package/es/components/AILabel/index.js +4 -4
- package/es/components/Breadcrumb/BreadcrumbItem.js +1 -1
- package/es/components/Button/Button.js +2 -2
- package/es/components/ChatButton/ChatButton.js +1 -1
- package/es/components/Checkbox/Checkbox.js +1 -1
- package/es/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/es/components/CodeSnippet/CodeSnippet.js +9 -50
- package/es/components/ComboBox/ComboBox.d.ts +3 -11
- package/es/components/ComboBox/ComboBox.js +15 -25
- package/es/components/ComboButton/index.d.ts +5 -8
- package/es/components/ComboButton/index.js +9 -12
- package/es/components/ComposedModal/ComposedModal.js +19 -25
- package/es/components/DataTable/DataTable.d.ts +27 -16
- package/es/components/DataTable/DataTable.js +40 -39
- package/es/components/DataTable/Table.js +2 -2
- package/es/components/DataTable/TableBatchActions.d.ts +49 -10
- package/es/components/DataTable/TableBatchActions.js +26 -21
- package/es/components/DataTable/TableExpandHeader.js +2 -2
- package/es/components/DataTable/TableExpandRow.d.ts +4 -0
- package/es/components/DataTable/TableExpandRow.js +1 -1
- package/es/components/DataTable/TableHeader.d.ts +8 -10
- package/es/components/DataTable/TableHeader.js +11 -13
- package/es/components/DataTable/TableRow.js +7 -5
- package/es/components/DataTable/TableSlugRow.js +1 -1
- package/es/components/DataTable/TableToolbarMenu.js +1 -1
- package/es/components/DataTable/TableToolbarSearch.d.ts +8 -7
- package/es/components/DataTable/TableToolbarSearch.js +11 -11
- package/es/components/DataTable/index.d.ts +2 -2
- package/es/components/DataTable/state/sorting.d.ts +2 -2
- package/es/components/DataTable/state/sorting.js +1 -1
- package/es/components/DataTable/tools/sorting.js +1 -1
- package/es/components/DatePicker/DatePicker.js +9 -9
- package/es/components/DatePickerInput/DatePickerInput.js +5 -5
- package/es/components/Dialog/Dialog.js +6 -6
- package/es/components/Dropdown/Dropdown.d.ts +1 -1
- package/es/components/Dropdown/Dropdown.js +8 -8
- package/es/components/ErrorBoundary/ErrorBoundaryContext.js +1 -1
- package/es/components/FileUploader/FileUploader.js +4 -4
- package/es/components/FileUploader/FileUploaderButton.js +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/es/components/FileUploader/FileUploaderItem.js +2 -2
- package/es/components/FluidComboBox/FluidComboBox.d.ts +4 -7
- package/es/components/FluidComboBox/FluidComboBox.js +1 -1
- package/es/components/FluidDropdown/FluidDropdown.d.ts +4 -8
- package/es/components/FluidDropdown/FluidDropdown.js +1 -1
- package/es/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +3 -7
- package/es/components/FluidMultiSelect/FluidMultiSelect.d.ts +3 -7
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +3 -3
- package/es/components/FluidNumberInput/FluidNumberInput.d.ts +4 -7
- package/es/components/FluidNumberInput/FluidNumberInput.js +2 -2
- package/es/components/FluidSearch/FluidSearch.js +1 -1
- package/es/components/FluidSelect/FluidSelect.js +1 -1
- package/es/components/FluidTextInput/FluidTextInput.js +1 -1
- package/es/components/FluidTimePicker/FluidTimePicker.js +3 -3
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +1 -1
- package/es/components/Grid/CSSGrid.js +3 -3
- package/es/components/Grid/Column.js +2 -2
- package/es/components/Grid/ColumnHang.js +1 -1
- package/es/components/Grid/FlexGrid.js +1 -1
- package/es/components/Grid/Row.js +1 -1
- package/es/components/Heading/index.js +2 -2
- package/es/components/IconButton/index.js +2 -2
- package/es/components/IconIndicator/index.js +2 -2
- package/es/components/InlineCheckbox/InlineCheckbox.js +1 -1
- package/es/components/Layout/index.js +2 -2
- package/es/components/LayoutDirection/LayoutDirection.js +1 -1
- package/es/components/Link/Link.js +2 -2
- package/es/components/ListBox/ListBoxField.d.ts +0 -1
- package/es/components/ListBox/ListBoxMenuIcon.d.ts +8 -4
- package/es/components/ListBox/ListBoxMenuIcon.js +10 -6
- package/es/components/ListBox/ListBoxMenuItem.js +2 -2
- package/es/components/ListBox/ListBoxSelection.d.ts +3 -6
- package/es/components/ListBox/ListBoxSelection.js +5 -10
- package/es/components/ListBox/index.d.ts +5 -3
- package/es/components/ListBox/next/ListBoxSelection.d.ts +6 -13
- package/es/components/ListBox/next/ListBoxSelection.js +16 -8
- package/es/components/ListBox/next/ListBoxTrigger.d.ts +5 -10
- package/es/components/ListBox/next/ListBoxTrigger.js +6 -6
- package/es/components/Menu/MenuContext.js +1 -1
- package/es/components/Menu/MenuItem.js +1 -1
- package/es/components/MenuButton/index.js +5 -5
- package/es/components/Modal/Modal.js +17 -23
- package/es/components/ModalWrapper/ModalWrapper.js +2 -2
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +3 -12
- package/es/components/MultiSelect/FilterableMultiSelect.js +18 -27
- package/es/components/MultiSelect/MultiSelect.d.ts +2 -2
- package/es/components/MultiSelect/MultiSelect.js +12 -12
- package/es/components/Notification/Notification.js +1 -1
- package/es/components/NumberInput/NumberInput.d.ts +2 -5
- package/es/components/NumberInput/NumberInput.js +13 -18
- package/es/components/OverflowMenu/OverflowMenu.d.ts +2 -2
- package/es/components/OverflowMenu/OverflowMenu.js +4 -4
- package/es/components/OverflowMenu/next/index.d.ts +1 -1
- package/es/components/OverflowMenu/next/index.js +2 -2
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
- package/es/components/PageHeader/PageHeader.js +12 -12
- package/es/components/Pagination/Pagination.js +3 -3
- package/es/components/PaginationNav/PaginationNav.d.ts +6 -9
- package/es/components/PaginationNav/PaginationNav.js +21 -22
- package/es/components/Popover/index.js +10 -9
- package/es/components/ProgressBar/ProgressBar.js +2 -2
- package/es/components/ProgressIndicator/ProgressIndicator.d.ts +11 -15
- package/es/components/ProgressIndicator/ProgressIndicator.js +15 -15
- package/es/components/RadioButton/RadioButton.js +1 -1
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/es/components/RadioTile/RadioTile.js +1 -1
- package/es/components/Select/Select.js +7 -5
- package/es/components/ShapeIndicator/index.js +2 -2
- package/es/components/Slider/Slider.d.ts +7 -9
- package/es/components/Slider/Slider.js +16 -20
- package/es/components/Stack/HStack.js +1 -1
- package/es/components/Stack/Stack.js +1 -1
- package/es/components/Stack/VStack.js +1 -1
- package/es/components/StructuredList/StructuredList.js +3 -3
- package/es/components/Tabs/Tabs.js +12 -12
- package/es/components/Tag/DismissibleTag.js +3 -3
- package/es/components/Tag/OperationalTag.js +2 -2
- package/es/components/Tag/SelectableTag.js +2 -2
- package/es/components/Tag/Tag.js +4 -4
- package/es/components/Tag/isEllipsisActive.js +1 -1
- package/es/components/Text/Text.js +1 -1
- package/es/components/TextArea/TextArea.js +1 -1
- package/es/components/TextInput/PasswordInput.js +4 -4
- package/es/components/TextInput/TextInput.js +3 -3
- package/es/components/Theme/index.js +3 -3
- package/es/components/Tile/Tile.js +3 -3
- package/es/components/TimePicker/TimePicker.js +1 -1
- package/es/components/Toggletip/index.js +4 -4
- package/es/components/Tooltip/DefinitionTooltip.js +1 -1
- package/es/components/Tooltip/Tooltip.js +3 -3
- package/es/components/TreeView/TreeNode.js +6 -6
- package/es/components/TreeView/TreeView.js +5 -5
- package/es/components/UIShell/HeaderContainer.js +1 -1
- package/es/components/UIShell/HeaderMenu.js +1 -1
- package/es/components/UIShell/Link.js +2 -2
- package/es/components/UIShell/SideNavItems.js +1 -1
- package/es/components/UIShell/Switcher.js +1 -1
- package/es/components/UIShell/SwitcherItem.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/internal/FloatingMenu.js +4 -4
- package/es/internal/Selection.js +6 -6
- package/es/internal/useMergedRefs.js +1 -1
- package/es/internal/useNoInteractiveChildren.js +4 -4
- package/es/internal/useOutsideClick.js +1 -1
- package/es/internal/useOverflowItems.js +6 -6
- package/es/internal/useResizeObserver.js +3 -3
- package/es/internal/useSavedCallback.js +1 -1
- package/es/internal/warning.js +1 -1
- package/es/prop-types/isRequiredOneOf.js +2 -2
- package/es/tools/events.js +1 -1
- package/es/tools/wrapComponent.js +1 -1
- package/es/types/common.d.ts +6 -2
- package/lib/components/AILabel/index.js +4 -4
- package/lib/components/Breadcrumb/BreadcrumbItem.js +1 -1
- package/lib/components/Button/Button.js +2 -2
- package/lib/components/ChatButton/ChatButton.js +1 -1
- package/lib/components/Checkbox/Checkbox.js +1 -1
- package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/lib/components/CodeSnippet/CodeSnippet.js +8 -49
- package/lib/components/ComboBox/ComboBox.d.ts +3 -11
- package/lib/components/ComboBox/ComboBox.js +15 -25
- package/lib/components/ComboButton/index.d.ts +5 -8
- package/lib/components/ComboButton/index.js +9 -12
- package/lib/components/ComposedModal/ComposedModal.js +18 -24
- package/lib/components/DataTable/DataTable.d.ts +27 -16
- package/lib/components/DataTable/DataTable.js +40 -39
- package/lib/components/DataTable/Table.js +2 -2
- package/lib/components/DataTable/TableBatchActions.d.ts +49 -10
- package/lib/components/DataTable/TableBatchActions.js +26 -21
- package/lib/components/DataTable/TableExpandHeader.js +2 -2
- package/lib/components/DataTable/TableExpandRow.d.ts +4 -0
- package/lib/components/DataTable/TableExpandRow.js +1 -1
- package/lib/components/DataTable/TableHeader.d.ts +8 -10
- package/lib/components/DataTable/TableHeader.js +11 -13
- package/lib/components/DataTable/TableRow.js +7 -5
- package/lib/components/DataTable/TableSlugRow.js +1 -1
- package/lib/components/DataTable/TableToolbarMenu.js +1 -1
- package/lib/components/DataTable/TableToolbarSearch.d.ts +8 -7
- package/lib/components/DataTable/TableToolbarSearch.js +11 -11
- package/lib/components/DataTable/index.d.ts +2 -2
- package/lib/components/DataTable/state/sorting.d.ts +2 -2
- package/lib/components/DataTable/state/sorting.js +1 -1
- package/lib/components/DataTable/tools/sorting.js +1 -1
- package/lib/components/DatePicker/DatePicker.js +9 -9
- package/lib/components/DatePickerInput/DatePickerInput.js +5 -5
- package/lib/components/Dialog/Dialog.js +6 -6
- package/lib/components/Dropdown/Dropdown.d.ts +1 -1
- package/lib/components/Dropdown/Dropdown.js +8 -8
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +1 -1
- package/lib/components/FileUploader/FileUploader.js +4 -4
- package/lib/components/FileUploader/FileUploaderButton.js +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/lib/components/FileUploader/FileUploaderItem.js +2 -2
- package/lib/components/FluidComboBox/FluidComboBox.d.ts +4 -7
- package/lib/components/FluidComboBox/FluidComboBox.js +1 -1
- package/lib/components/FluidDropdown/FluidDropdown.d.ts +4 -8
- package/lib/components/FluidDropdown/FluidDropdown.js +1 -1
- package/lib/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +3 -7
- package/lib/components/FluidMultiSelect/FluidMultiSelect.d.ts +3 -7
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +3 -3
- package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +4 -7
- package/lib/components/FluidNumberInput/FluidNumberInput.js +2 -2
- package/lib/components/FluidSearch/FluidSearch.js +1 -1
- package/lib/components/FluidSelect/FluidSelect.js +1 -1
- package/lib/components/FluidTextInput/FluidTextInput.js +1 -1
- package/lib/components/FluidTimePicker/FluidTimePicker.js +3 -3
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +1 -1
- package/lib/components/Grid/CSSGrid.js +3 -3
- package/lib/components/Grid/Column.js +2 -2
- package/lib/components/Grid/ColumnHang.js +1 -1
- package/lib/components/Grid/FlexGrid.js +1 -1
- package/lib/components/Grid/Row.js +1 -1
- package/lib/components/Heading/index.js +2 -2
- package/lib/components/IconButton/index.js +2 -2
- package/lib/components/IconIndicator/index.js +2 -2
- package/lib/components/InlineCheckbox/InlineCheckbox.js +1 -1
- package/lib/components/Layout/index.js +2 -2
- package/lib/components/LayoutDirection/LayoutDirection.js +1 -1
- package/lib/components/Link/Link.js +2 -2
- package/lib/components/ListBox/ListBoxField.d.ts +0 -1
- package/lib/components/ListBox/ListBoxMenuIcon.d.ts +8 -4
- package/lib/components/ListBox/ListBoxMenuIcon.js +10 -6
- package/lib/components/ListBox/ListBoxMenuItem.js +2 -2
- package/lib/components/ListBox/ListBoxSelection.d.ts +3 -6
- package/lib/components/ListBox/ListBoxSelection.js +4 -10
- package/lib/components/ListBox/index.d.ts +5 -3
- package/lib/components/ListBox/next/ListBoxSelection.d.ts +6 -13
- package/lib/components/ListBox/next/ListBoxSelection.js +16 -8
- package/lib/components/ListBox/next/ListBoxTrigger.d.ts +5 -10
- package/lib/components/ListBox/next/ListBoxTrigger.js +5 -6
- package/lib/components/Menu/MenuContext.js +1 -1
- package/lib/components/Menu/MenuItem.js +1 -1
- package/lib/components/MenuButton/index.js +5 -5
- package/lib/components/Modal/Modal.js +16 -22
- package/lib/components/ModalWrapper/ModalWrapper.js +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +3 -12
- package/lib/components/MultiSelect/FilterableMultiSelect.js +18 -27
- package/lib/components/MultiSelect/MultiSelect.d.ts +2 -2
- package/lib/components/MultiSelect/MultiSelect.js +12 -12
- package/lib/components/Notification/Notification.js +1 -1
- package/lib/components/NumberInput/NumberInput.d.ts +2 -5
- package/lib/components/NumberInput/NumberInput.js +12 -18
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +2 -2
- package/lib/components/OverflowMenu/OverflowMenu.js +4 -4
- package/lib/components/OverflowMenu/next/index.d.ts +1 -1
- package/lib/components/OverflowMenu/next/index.js +2 -2
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
- package/lib/components/PageHeader/PageHeader.js +12 -12
- package/lib/components/Pagination/Pagination.js +3 -3
- package/lib/components/PaginationNav/PaginationNav.d.ts +6 -9
- package/lib/components/PaginationNav/PaginationNav.js +21 -22
- package/lib/components/Popover/index.js +10 -9
- package/lib/components/ProgressBar/ProgressBar.js +2 -2
- package/lib/components/ProgressIndicator/ProgressIndicator.d.ts +11 -15
- package/lib/components/ProgressIndicator/ProgressIndicator.js +15 -15
- package/lib/components/RadioButton/RadioButton.js +1 -1
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/lib/components/RadioTile/RadioTile.js +1 -1
- package/lib/components/Select/Select.js +7 -5
- package/lib/components/ShapeIndicator/index.js +2 -2
- package/lib/components/Slider/Slider.d.ts +7 -9
- package/lib/components/Slider/Slider.js +16 -20
- package/lib/components/Stack/HStack.js +1 -1
- package/lib/components/Stack/Stack.js +1 -1
- package/lib/components/Stack/VStack.js +1 -1
- package/lib/components/StructuredList/StructuredList.js +3 -3
- package/lib/components/Tabs/Tabs.js +12 -12
- package/lib/components/Tag/DismissibleTag.js +3 -3
- package/lib/components/Tag/OperationalTag.js +2 -2
- package/lib/components/Tag/SelectableTag.js +2 -2
- package/lib/components/Tag/Tag.js +4 -4
- package/lib/components/Tag/isEllipsisActive.js +1 -1
- package/lib/components/Text/Text.js +1 -1
- package/lib/components/TextArea/TextArea.js +1 -1
- package/lib/components/TextInput/PasswordInput.js +4 -4
- package/lib/components/TextInput/TextInput.js +3 -3
- package/lib/components/Theme/index.js +3 -3
- package/lib/components/Tile/Tile.js +3 -3
- package/lib/components/TimePicker/TimePicker.js +1 -1
- package/lib/components/Toggletip/index.js +4 -4
- package/lib/components/Tooltip/DefinitionTooltip.js +1 -1
- package/lib/components/Tooltip/Tooltip.js +3 -3
- package/lib/components/TreeView/TreeNode.js +6 -6
- package/lib/components/TreeView/TreeView.js +5 -5
- package/lib/components/UIShell/HeaderContainer.js +1 -1
- package/lib/components/UIShell/HeaderMenu.js +1 -1
- package/lib/components/UIShell/Link.js +2 -2
- package/lib/components/UIShell/SideNavItems.js +1 -1
- package/lib/components/UIShell/Switcher.js +1 -1
- package/lib/components/UIShell/SwitcherItem.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/internal/FloatingMenu.js +4 -4
- package/lib/internal/Selection.js +6 -6
- package/lib/internal/useMergedRefs.js +1 -1
- package/lib/internal/useNoInteractiveChildren.js +4 -4
- package/lib/internal/useOutsideClick.js +1 -1
- package/lib/internal/useOverflowItems.js +6 -6
- package/lib/internal/useResizeObserver.js +3 -3
- package/lib/internal/useSavedCallback.js +1 -1
- package/lib/internal/warning.js +1 -1
- package/lib/prop-types/isRequiredOneOf.js +2 -2
- package/lib/tools/events.js +1 -1
- package/lib/tools/wrapComponent.js +1 -1
- package/lib/types/common.d.ts +6 -2
- package/package.json +9 -9
|
@@ -58,15 +58,6 @@ const {
|
|
|
58
58
|
DropdownKeyDownBackspace,
|
|
59
59
|
FunctionRemoveSelectedItem
|
|
60
60
|
} = Downshift.useMultipleSelection.stateChangeTypes;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Message ids that will be passed to translateWithId().
|
|
64
|
-
* Combination of message ids from ListBox/next/ListBoxSelection.js and
|
|
65
|
-
* ListBox/next/ListBoxTrigger.js, but we can't access those values directly
|
|
66
|
-
* because those components aren't Typescript. (If you try, TranslationKey
|
|
67
|
-
* ends up just being defined as "string".)
|
|
68
|
-
*/
|
|
69
|
-
|
|
70
61
|
const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableMultiSelect({
|
|
71
62
|
autoAlign = false,
|
|
72
63
|
className: containerClassName,
|
|
@@ -113,7 +104,7 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
113
104
|
isFluid
|
|
114
105
|
} = React.useContext(FormContext.FormContext);
|
|
115
106
|
const isFirstRender = React.useRef(true);
|
|
116
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
107
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
117
108
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
118
109
|
const [isOpen, setIsOpen] = React.useState(!!open);
|
|
119
110
|
const [prevOpen, setPrevOpen] = React.useState(!!open);
|
|
@@ -125,9 +116,9 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
125
116
|
inputValue
|
|
126
117
|
}), [items, inputValue, itemToString, filterItems]);
|
|
127
118
|
const nonSelectAllItems = React.useMemo(
|
|
128
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
119
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
129
120
|
() => filteredItems.filter(item => !item.isSelectAll), [filteredItems]);
|
|
130
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
121
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
131
122
|
const selectAll = filteredItems.some(item => item.isSelectAll);
|
|
132
123
|
const {
|
|
133
124
|
selectedItems: controlledSelectedItems,
|
|
@@ -144,7 +135,7 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
144
135
|
});
|
|
145
136
|
const selectAllStatus = React.useMemo(() => {
|
|
146
137
|
const selectable = nonSelectAllItems.filter(
|
|
147
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
138
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
148
139
|
item => !item.disabled);
|
|
149
140
|
const nonSelectedCount = selectable.filter(item => !controlledSelectedItems.some(sel => isEqual(sel, item))).length;
|
|
150
141
|
const totalCount = selectable.length;
|
|
@@ -154,7 +145,7 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
154
145
|
};
|
|
155
146
|
}, [controlledSelectedItems, nonSelectAllItems]);
|
|
156
147
|
const handleSelectAllClick = React.useCallback(() => {
|
|
157
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
148
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
158
149
|
const selectable = nonSelectAllItems.filter(i => !i.disabled);
|
|
159
150
|
const {
|
|
160
151
|
checked,
|
|
@@ -171,7 +162,7 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
171
162
|
const toSelect = selectable.filter(e => !controlledSelectedItems.some(sel => isEqual(sel, e)));
|
|
172
163
|
toggleAll([...controlledSelectedItems, ...toSelect]);
|
|
173
164
|
}
|
|
174
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
165
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
175
166
|
}, [nonSelectAllItems, selectAllStatus, controlledSelectedItems, toggleAll]);
|
|
176
167
|
const {
|
|
177
168
|
refs,
|
|
@@ -222,14 +213,14 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
222
213
|
|
|
223
214
|
// memoize sorted items to reduce unnecessary expensive sort on rerender
|
|
224
215
|
const sortedItems = React.useMemo(() => {
|
|
225
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
216
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
226
217
|
const selectAllItem = items.find(item => item.isSelectAll);
|
|
227
218
|
const selectableRealItems = nonSelectAllItems.filter(
|
|
228
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
219
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
229
220
|
item => !item.disabled);
|
|
230
221
|
|
|
231
222
|
// 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/
|
|
223
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
233
224
|
const sortedReal = sortItems(nonSelectAllItems, {
|
|
234
225
|
selectedItems: {
|
|
235
226
|
top: controlledSelectedItems,
|
|
@@ -246,7 +237,7 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
246
237
|
return [selectAllItem, ...sortedReal];
|
|
247
238
|
}
|
|
248
239
|
return sortedReal;
|
|
249
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
240
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
250
241
|
}, [items, inputValue, controlledSelectedItems, topItems, selectionFeedback, itemToString, compareItems, locale, sortItems, nonSelectAllItems]);
|
|
251
242
|
const inline = type === 'inline';
|
|
252
243
|
const showWarning = !invalid && warn;
|
|
@@ -330,7 +321,7 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
330
321
|
return () => {
|
|
331
322
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
332
323
|
};
|
|
333
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
324
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
334
325
|
}, [isOpen, inputFocused]);
|
|
335
326
|
const {
|
|
336
327
|
getToggleButtonProps,
|
|
@@ -353,9 +344,9 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
353
344
|
inputId,
|
|
354
345
|
inputValue,
|
|
355
346
|
stateReducer,
|
|
356
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
347
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
357
348
|
isItemDisabled(item, _index) {
|
|
358
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
349
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
359
350
|
return item?.disabled;
|
|
360
351
|
}
|
|
361
352
|
});
|
|
@@ -523,11 +514,11 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
523
514
|
const candidateIsAILabel = utils.isComponentElement(candidate, index.AILabel);
|
|
524
515
|
const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/React.cloneElement(candidate, {
|
|
525
516
|
size: 'mini'
|
|
526
|
-
}) :
|
|
517
|
+
}) : candidate;
|
|
527
518
|
|
|
528
519
|
// exclude the select-all item from the count
|
|
529
520
|
const selectedItemsLength = controlledSelectedItems.filter(
|
|
530
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
521
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
531
522
|
item => !item.isSelectAll).length;
|
|
532
523
|
const className = cx(`${prefix}--multi-select`, `${prefix}--combo-box`, `${prefix}--multi-select--filterable`, {
|
|
533
524
|
[`${prefix}--multi-select--invalid`]: invalid,
|
|
@@ -709,7 +700,7 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
|
|
|
709
700
|
}, normalizedDecorator) : '', /*#__PURE__*/React.createElement(index$1.default.Menu, menuProps, isOpen ? sortedItems.map((item, index) => {
|
|
710
701
|
let isChecked;
|
|
711
702
|
let isIndeterminate = false;
|
|
712
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
703
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
713
704
|
if (item.isSelectAll) {
|
|
714
705
|
isChecked = selectAllStatus.checked;
|
|
715
706
|
isIndeterminate = selectAllStatus.indeterminate;
|
|
@@ -807,7 +798,7 @@ FilterableMultiSelect.propTypes = {
|
|
|
807
798
|
* change, and in some cases they can not be shimmed by Carbon to shield you
|
|
808
799
|
* from potentially breaking changes.
|
|
809
800
|
*/
|
|
810
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/
|
|
801
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
811
802
|
// @ts-ignore
|
|
812
803
|
downshiftProps: PropTypes.shape(Downshift.propTypes),
|
|
813
804
|
/**
|
|
@@ -899,7 +890,7 @@ FilterableMultiSelect.propTypes = {
|
|
|
899
890
|
*/
|
|
900
891
|
titleText: PropTypes.node,
|
|
901
892
|
/**
|
|
902
|
-
*
|
|
893
|
+
* Translates component strings using your i18n tool.
|
|
903
894
|
*/
|
|
904
895
|
translateWithId: PropTypes.func,
|
|
905
896
|
type: ListBoxPropTypes.ListBoxTypePropType,
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { UseSelectProps } from 'downshift';
|
|
8
8
|
import React, { type ReactNode } from 'react';
|
|
9
|
-
import { type ListBoxSize, type ListBoxType } from '../ListBox';
|
|
9
|
+
import { type ListBoxMenuIconTranslationKey, type ListBoxSelectionTranslationKey, type ListBoxSize, type ListBoxType } from '../ListBox';
|
|
10
10
|
import { MultiSelectSortingProps } from './MultiSelectPropTypes';
|
|
11
11
|
import { ListBoxProps } from '../ListBox/ListBox';
|
|
12
12
|
import type { TranslateWithId } from '../../types/common';
|
|
13
13
|
interface OnChangeData<ItemType> {
|
|
14
14
|
selectedItems: ItemType[] | null;
|
|
15
15
|
}
|
|
16
|
-
export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<ItemType>, TranslateWithId<
|
|
16
|
+
export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<ItemType>, TranslateWithId<ListBoxMenuIconTranslationKey | ListBoxSelectionTranslationKey> {
|
|
17
17
|
/**
|
|
18
18
|
* **Experimental**: Will attempt to automatically align the floating
|
|
19
19
|
* element to avoid collisions with the viewport and being clipped by
|
|
@@ -103,14 +103,14 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
103
103
|
});
|
|
104
104
|
}, [items]);
|
|
105
105
|
|
|
106
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
106
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
107
107
|
const selectAll = filteredItems.some(item => item.isSelectAll);
|
|
108
108
|
const prefix = usePrefix.usePrefix();
|
|
109
109
|
const {
|
|
110
110
|
isFluid
|
|
111
111
|
} = React.useContext(FormContext.FormContext);
|
|
112
112
|
const multiSelectInstanceId = useId.useId();
|
|
113
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
113
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
114
114
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
115
115
|
const [inputFocused, setInputFocused] = React.useState(false);
|
|
116
116
|
const [isOpen, setIsOpen] = React.useState(open || false);
|
|
@@ -185,9 +185,9 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
185
185
|
},
|
|
186
186
|
selectedItem: controlledSelectedItems,
|
|
187
187
|
items: filteredItems,
|
|
188
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
188
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
189
189
|
isItemDisabled(item, _index) {
|
|
190
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
190
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
191
191
|
return item?.disabled;
|
|
192
192
|
},
|
|
193
193
|
...downshiftProps
|
|
@@ -383,7 +383,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
383
383
|
[`${prefix}--list-box__field--wrapper--input-focused`]: inputFocused
|
|
384
384
|
});
|
|
385
385
|
const handleFocus = evt => {
|
|
386
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/
|
|
386
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
387
387
|
evt.target.classList.contains(`${prefix}--tag__close-icon`) ? setIsFocused(false) : setIsFocused(evt.type === 'focus' ? true : false);
|
|
388
388
|
};
|
|
389
389
|
const readOnlyEventHandlers = readOnly ? {
|
|
@@ -409,10 +409,10 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
409
409
|
const candidateIsAILabel = utils.isComponentElement(candidate, index$1.AILabel);
|
|
410
410
|
const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/React.cloneElement(candidate, {
|
|
411
411
|
size: 'mini'
|
|
412
|
-
}) :
|
|
412
|
+
}) : candidate;
|
|
413
413
|
const itemsSelectedText = selectedItems.length > 0 && selectedItems.map(item => item?.text);
|
|
414
414
|
const selectedItemsLength = selectAll ?
|
|
415
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
415
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
416
416
|
selectedItems.filter(item => !item.isSelectAll).length : selectedItems.length;
|
|
417
417
|
|
|
418
418
|
// Memoize the value of getMenuProps to avoid an infinite loop
|
|
@@ -433,7 +433,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
433
433
|
totalSelectableCount
|
|
434
434
|
};
|
|
435
435
|
},
|
|
436
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
436
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
437
437
|
[selectedItems, filteredItems]);
|
|
438
438
|
return /*#__PURE__*/React.createElement("div", {
|
|
439
439
|
className: wrapperClasses
|
|
@@ -487,7 +487,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
487
487
|
})), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React.createElement("div", {
|
|
488
488
|
className: `${prefix}--list-box__inner-wrapper--decorator`
|
|
489
489
|
}, normalizedDecorator) : ''), /*#__PURE__*/React.createElement(index$2.default.Menu, menuProps, isOpen &&
|
|
490
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/
|
|
490
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
491
491
|
sortItems(filteredItems, sortOptions).map((item, index) => {
|
|
492
492
|
const {
|
|
493
493
|
hasIndividualSelections,
|
|
@@ -495,10 +495,10 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
495
495
|
totalSelectableCount
|
|
496
496
|
} = getSelectionStats(selectedItems, filteredItems);
|
|
497
497
|
|
|
498
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
498
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
499
499
|
const isChecked = item.isSelectAll ? nonSelectAllSelectedCount === totalSelectableCount && totalSelectableCount > 0 : selectedItems.some(selected => isEqual(selected, item));
|
|
500
500
|
const isIndeterminate =
|
|
501
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
501
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
502
502
|
item.isSelectAll && hasIndividualSelections && nonSelectAllSelectedCount < totalSelectableCount;
|
|
503
503
|
const itemProps = getItemProps({
|
|
504
504
|
item,
|
|
@@ -702,7 +702,7 @@ MultiSelect.propTypes = {
|
|
|
702
702
|
*/
|
|
703
703
|
titleText: PropTypes.node,
|
|
704
704
|
/**
|
|
705
|
-
*
|
|
705
|
+
* Translates component strings using your i18n tool.
|
|
706
706
|
*/
|
|
707
707
|
translateWithId: PropTypes.func,
|
|
708
708
|
/**
|
|
@@ -809,7 +809,7 @@ Callout.propTypes = {
|
|
|
809
809
|
/**
|
|
810
810
|
* @deprecated Use `CalloutProps` instead.
|
|
811
811
|
*/
|
|
812
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- https://github.com/carbon-design-system/carbon/issues/
|
|
812
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
813
813
|
|
|
814
814
|
let didWarnAboutDeprecation = false;
|
|
815
815
|
const StaticNotification = props => {
|
|
@@ -5,15 +5,12 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React, { type ReactNode } from 'react';
|
|
8
|
-
import { TranslateWithId } from '../../types/common';
|
|
8
|
+
import type { TranslateWithId } from '../../types/common';
|
|
9
9
|
import { type NumberFormatOptions } from '@carbon/utilities';
|
|
10
|
-
|
|
10
|
+
declare const translationIds: {
|
|
11
11
|
readonly 'increment.number': "increment.number";
|
|
12
12
|
readonly 'decrement.number': "decrement.number";
|
|
13
13
|
};
|
|
14
|
-
/**
|
|
15
|
-
* Message ids that will be passed to translateWithId().
|
|
16
|
-
*/
|
|
17
14
|
type TranslationKey = keyof typeof translationIds;
|
|
18
15
|
type ExcludedAttributes = 'defaultValue' | 'id' | 'min' | 'max' | 'onChange' | 'onClick' | 'size' | 'step' | 'value';
|
|
19
16
|
export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes>, TranslateWithId<TranslationKey> {
|
|
@@ -34,17 +34,15 @@ const translationIds = {
|
|
|
34
34
|
'increment.number': 'increment.number',
|
|
35
35
|
'decrement.number': 'decrement.number'
|
|
36
36
|
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Message ids that will be passed to translateWithId().
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
37
|
const defaultTranslations = {
|
|
43
38
|
[translationIds['increment.number']]: 'Increment number',
|
|
44
39
|
[translationIds['decrement.number']]: 'Decrement number'
|
|
45
40
|
};
|
|
41
|
+
const defaultTranslateWithId = messageId => {
|
|
42
|
+
return defaultTranslations[messageId];
|
|
43
|
+
};
|
|
46
44
|
|
|
47
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
45
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
48
46
|
const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
|
|
49
47
|
const {
|
|
50
48
|
allowEmpty = false,
|
|
@@ -75,7 +73,7 @@ const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
|
|
|
75
73
|
size = 'md',
|
|
76
74
|
slug,
|
|
77
75
|
step = 1,
|
|
78
|
-
translateWithId: t =
|
|
76
|
+
translateWithId: t = defaultTranslateWithId,
|
|
79
77
|
type = 'number',
|
|
80
78
|
defaultValue = type === 'number' ? 0 : NaN,
|
|
81
79
|
validate,
|
|
@@ -106,7 +104,7 @@ const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
|
|
|
106
104
|
}
|
|
107
105
|
return 0;
|
|
108
106
|
});
|
|
109
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
107
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
110
108
|
const [prevControlledValue, setPrevControlledValue] = React.useState(controlledValue);
|
|
111
109
|
const numberParser = React.useMemo(() => new utilities.NumberParser(locale, formatOptions), [locale, formatOptions]);
|
|
112
110
|
/**
|
|
@@ -239,7 +237,7 @@ const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
|
|
|
239
237
|
[`${prefix}--number-input--fluid--disabled`]: isFluid && disabled
|
|
240
238
|
});
|
|
241
239
|
|
|
242
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
240
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
243
241
|
const Icon = normalizedProps.icon;
|
|
244
242
|
const getDecimalPlaces = num => {
|
|
245
243
|
const parts = num.toString().split('.');
|
|
@@ -308,13 +306,10 @@ const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
|
|
|
308
306
|
const candidateIsAILabel = utils.isComponentElement(candidate, index.AILabel);
|
|
309
307
|
const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/React.cloneElement(candidate, {
|
|
310
308
|
size: 'mini'
|
|
311
|
-
}) :
|
|
309
|
+
}) : candidate;
|
|
312
310
|
|
|
313
311
|
// Need to update the internal value when the revert button is clicked
|
|
314
|
-
|
|
315
|
-
if (normalizedDecorator?.type === index.AILabel) {
|
|
316
|
-
isRevertActive = normalizedDecorator.props.revertActive;
|
|
317
|
-
}
|
|
312
|
+
const isRevertActive = utils.isComponentElement(normalizedDecorator, index.AILabel) ? normalizedDecorator.props.revertActive : undefined;
|
|
318
313
|
React.useEffect(() => {
|
|
319
314
|
if (!isRevertActive && slug && defaultValue) {
|
|
320
315
|
setValue(defaultValue);
|
|
@@ -349,9 +344,9 @@ const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
|
|
|
349
344
|
onKeyUp: onKeyUp,
|
|
350
345
|
onKeyDown: e => {
|
|
351
346
|
if (type === 'text') {
|
|
352
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/
|
|
347
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
353
348
|
match.match(e, keys.ArrowUp) && handleStep(e, 'up');
|
|
354
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/
|
|
349
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
355
350
|
match.match(e, keys.ArrowDown) && handleStep(e, 'down');
|
|
356
351
|
}
|
|
357
352
|
if (rest?.onKeyDown) {
|
|
@@ -599,7 +594,7 @@ NumberInput.propTypes = {
|
|
|
599
594
|
*/
|
|
600
595
|
step: PropTypes.number,
|
|
601
596
|
/**
|
|
602
|
-
*
|
|
597
|
+
* Translates component strings using your i18n tool.
|
|
603
598
|
*/
|
|
604
599
|
translateWithId: PropTypes.func,
|
|
605
600
|
/**
|
|
@@ -734,4 +729,3 @@ function disableWheel(e) {
|
|
|
734
729
|
}
|
|
735
730
|
|
|
736
731
|
exports.NumberInput = NumberInput;
|
|
737
|
-
exports.translationIds = translationIds;
|
|
@@ -102,9 +102,9 @@ export interface OverflowMenuProps extends Omit<IconButtonProps, 'type' | 'aria-
|
|
|
102
102
|
*/
|
|
103
103
|
selectorPrimaryFocus?: string;
|
|
104
104
|
/**
|
|
105
|
-
* Specify the size of the OverflowMenu. Currently supports either `sm`, `md` (default) or `lg` as an option.
|
|
105
|
+
* Specify the size of the OverflowMenu. Currently supports either `xs`, `sm`, `md` (default) or `lg` as an option.
|
|
106
106
|
*/
|
|
107
|
-
size?: 'sm' | 'md' | 'lg';
|
|
107
|
+
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
108
108
|
/**
|
|
109
109
|
* The ref to the overflow menu's trigger button element.
|
|
110
110
|
* @deprecated Use the standard React `ref` prop instead.
|
|
@@ -70,7 +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/
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
74
74
|
const {
|
|
75
75
|
offsetWidth: menuWidth,
|
|
76
76
|
offsetHeight: menuHeight
|
|
@@ -93,7 +93,7 @@ const getMenuOffset = (menuBody, direction, trigger, flip) => {
|
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
96
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
97
97
|
const OverflowMenu = /*#__PURE__*/React.forwardRef(({
|
|
98
98
|
align,
|
|
99
99
|
['aria-label']: ariaLabel = null,
|
|
@@ -467,9 +467,9 @@ OverflowMenu.propTypes = {
|
|
|
467
467
|
*/
|
|
468
468
|
selectorPrimaryFocus: PropTypes.string,
|
|
469
469
|
/**
|
|
470
|
-
* Specify the size of the OverflowMenu. Currently supports either `sm`, `md` (default) or `lg` as an option.
|
|
470
|
+
* Specify the size of the OverflowMenu. Currently supports either `xs`, `sm`, `md` (default) or `lg` as an option.
|
|
471
471
|
*/
|
|
472
|
-
size: PropTypes.oneOf(['sm', 'md', 'lg'])
|
|
472
|
+
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg'])
|
|
473
473
|
};
|
|
474
474
|
|
|
475
475
|
exports.OverflowMenu = OverflowMenu;
|
|
@@ -25,7 +25,7 @@ var deprecateValuesWithin = require('../../../prop-types/deprecateValuesWithin.j
|
|
|
25
25
|
var mapPopoverAlign = require('../../../tools/mapPopoverAlign.js');
|
|
26
26
|
|
|
27
27
|
const defaultSize = 'md';
|
|
28
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
28
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
29
29
|
const OverflowMenu = /*#__PURE__*/React.forwardRef(({
|
|
30
30
|
autoAlign = false,
|
|
31
31
|
children,
|
|
@@ -164,7 +164,7 @@ OverflowMenu.propTypes = {
|
|
|
164
164
|
/**
|
|
165
165
|
* Specify the size of the menu, from a list of available sizes.
|
|
166
166
|
*/
|
|
167
|
-
size: PropTypes.oneOf(['sm', 'md', 'lg']),
|
|
167
|
+
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg']),
|
|
168
168
|
/**
|
|
169
169
|
* Specify how the trigger tooltip should be aligned.
|
|
170
170
|
*/
|
|
@@ -93,14 +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/
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
97
97
|
,
|
|
98
98
|
ref: ref,
|
|
99
99
|
tabIndex: -1
|
|
100
100
|
// itemText as any: itemText may be a ReactNode, but `title` only accepts string
|
|
101
101
|
// to avoid compatibility issue, we use `any` here. Consider to enforce `itemText` to be `string?`
|
|
102
102
|
// in the next major release
|
|
103
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
103
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
104
104
|
,
|
|
105
105
|
title: requireTitle ? title || itemText : undefined
|
|
106
106
|
}, rest), OverflowMenuItemContent));
|
|
@@ -133,7 +133,7 @@ const PageHeaderContent = /*#__PURE__*/React.forwardRef(({
|
|
|
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/
|
|
136
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
137
137
|
titleRef.current && isEllipsisActive(titleRef.current);
|
|
138
138
|
}, [title]);
|
|
139
139
|
return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({
|
|
@@ -205,7 +205,7 @@ PageHeaderContent.propTypes = {
|
|
|
205
205
|
|
|
206
206
|
const PageHeaderContentPageActions = ({
|
|
207
207
|
className,
|
|
208
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
208
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
209
209
|
children,
|
|
210
210
|
menuButtonLabel = 'Actions',
|
|
211
211
|
actions,
|
|
@@ -241,7 +241,7 @@ const PageHeaderContentPageActions = ({
|
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
});
|
|
244
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
244
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
245
245
|
}, []);
|
|
246
246
|
return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({
|
|
247
247
|
className: classNames,
|
|
@@ -385,26 +385,26 @@ const PageHeaderTabBar = /*#__PURE__*/React.forwardRef(({
|
|
|
385
385
|
sm: 4
|
|
386
386
|
}, children)));
|
|
387
387
|
}
|
|
388
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/
|
|
388
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
389
389
|
const [openPopover, setOpenPopover] = React.useState(false);
|
|
390
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/
|
|
391
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
392
392
|
const instanceId = useId.useId('PageHeaderTabBar');
|
|
393
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/
|
|
393
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
394
394
|
const tagsWithIds = React.useMemo(() => {
|
|
395
395
|
return tags.map((tag, index) => ({
|
|
396
396
|
...tag,
|
|
397
397
|
id: tag.id || `tag-${index}-${instanceId}`
|
|
398
398
|
}));
|
|
399
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
399
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
400
400
|
}, [tags]);
|
|
401
401
|
|
|
402
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/
|
|
402
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
403
403
|
const tagsContainerRef = React.useRef(null);
|
|
404
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/
|
|
404
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
405
405
|
const offsetRef = React.useRef(null);
|
|
406
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/
|
|
407
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
408
408
|
React.useEffect(() => {
|
|
409
409
|
const handleResize = () => {
|
|
410
410
|
// Close the popover when window resizes to prevent unwanted opens
|
|
@@ -421,14 +421,14 @@ const PageHeaderTabBar = /*#__PURE__*/React.forwardRef(({
|
|
|
421
421
|
visibleItems = [],
|
|
422
422
|
hiddenItems = [],
|
|
423
423
|
itemRefHandler = () => {}
|
|
424
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/
|
|
424
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
425
425
|
} = useOverflowItems.default(tagsWithIds, tagsContainerRef, offsetRef) || {
|
|
426
426
|
visibleItems: [],
|
|
427
427
|
hiddenItems: [],
|
|
428
428
|
itemRefHandler: () => {}
|
|
429
429
|
};
|
|
430
430
|
|
|
431
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/
|
|
431
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
432
432
|
const handleOverflowClick = React.useCallback(event => {
|
|
433
433
|
event.stopPropagation();
|
|
434
434
|
setOpenPopover(prev => !prev);
|
|
@@ -54,7 +54,7 @@ function getPageSize(pageSizes, pageSize) {
|
|
|
54
54
|
return pageSizes[0].value;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
57
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
58
58
|
const Pagination = /*#__PURE__*/React.forwardRef(({
|
|
59
59
|
backwardText = 'Previous page',
|
|
60
60
|
className: customClassName = '',
|
|
@@ -66,7 +66,7 @@ const Pagination = /*#__PURE__*/React.forwardRef(({
|
|
|
66
66
|
itemRangeText = (min, max, total) => `${min}–${max} of ${total} items`,
|
|
67
67
|
itemsPerPageText = 'Items per page:',
|
|
68
68
|
onChange,
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
70
70
|
pageNumberText: _pageNumberText = 'Page Number',
|
|
71
71
|
pageRangeText = (_current, total) => `of ${total} ${total === 1 ? 'page' : 'pages'}`,
|
|
72
72
|
page: controlledPage = 1,
|
|
@@ -129,7 +129,7 @@ const Pagination = /*#__PURE__*/React.forwardRef(({
|
|
|
129
129
|
handleFocus(focusTarget);
|
|
130
130
|
setFocusTarget(null);
|
|
131
131
|
}
|
|
132
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
132
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
133
133
|
}, [focusTarget]);
|
|
134
134
|
|
|
135
135
|
// Sync state with props
|
|
@@ -5,19 +5,16 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import { TranslateWithId } from '../../types/common';
|
|
8
|
+
import type { TranslateWithId } from '../../types/common';
|
|
9
9
|
type TooltipAlignment = 'start' | 'center' | 'end';
|
|
10
10
|
type TooltipPosition = 'top' | 'right' | 'bottom' | 'left';
|
|
11
11
|
declare const translationIds: {
|
|
12
|
-
readonly 'carbon.pagination-nav.next': "
|
|
13
|
-
readonly 'carbon.pagination-nav.previous': "
|
|
14
|
-
readonly 'carbon.pagination-nav.item': "
|
|
15
|
-
readonly 'carbon.pagination-nav.active': "
|
|
16
|
-
readonly 'carbon.pagination-nav.of': "of";
|
|
12
|
+
readonly 'carbon.pagination-nav.next': "carbon.pagination-nav.next";
|
|
13
|
+
readonly 'carbon.pagination-nav.previous': "carbon.pagination-nav.previous";
|
|
14
|
+
readonly 'carbon.pagination-nav.item': "carbon.pagination-nav.item";
|
|
15
|
+
readonly 'carbon.pagination-nav.active': "carbon.pagination-nav.active";
|
|
16
|
+
readonly 'carbon.pagination-nav.of': "carbon.pagination-nav.of";
|
|
17
17
|
};
|
|
18
|
-
/**
|
|
19
|
-
* Message ids that will be passed to translateWithId().
|
|
20
|
-
*/
|
|
21
18
|
type TranslationKey = keyof typeof translationIds;
|
|
22
19
|
export interface DirectionButtonProps {
|
|
23
20
|
/**
|