@carbon/react 1.89.0 → 1.90.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 +877 -877
- package/README.md +2 -2
- 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/ComboBox/ComboBox.js +17 -1
- package/es/components/ComboButton/index.js +1 -0
- package/es/components/ComposedModal/ComposedModal.js +18 -4
- package/es/components/DataTable/DataTable.d.ts +3 -8
- package/es/components/DataTable/DataTable.js +14 -0
- package/es/components/DataTable/Table.js +3 -3
- package/es/components/DataTable/TableExpandHeader.js +5 -1
- package/es/components/DataTable/TableExpandRow.d.ts +33 -5
- package/es/components/DataTable/TableExpandRow.js +5 -2
- package/es/components/DataTable/TableHeader.d.ts +1 -2
- package/es/components/DataTable/TableHeader.js +3 -2
- package/es/components/DataTable/TableRow.d.ts +3 -6
- package/es/components/DataTable/TableRow.js +40 -22
- package/es/components/DataTable/TableSlugRow.js +1 -0
- package/es/components/DataTable/TableToolbarMenu.js +3 -0
- package/es/components/DataTable/state/sorting.d.ts +57 -14
- package/es/components/DataTable/state/sorting.js +42 -50
- package/es/components/DataTable/tools/sorting.js +5 -0
- package/es/components/DatePicker/DatePicker.js +14 -3
- package/es/components/DatePickerInput/DatePickerInput.js +6 -0
- package/es/components/Dialog/Dialog.js +10 -2
- package/es/components/Dropdown/Dropdown.js +16 -4
- package/es/components/ErrorBoundary/ErrorBoundaryContext.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 +4 -2
- 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.js +5 -13
- package/es/components/MenuButton/index.js +7 -2
- package/es/components/Modal/Modal.js +15 -6
- package/es/components/ModalWrapper/ModalWrapper.js +2 -0
- package/es/components/MultiSelect/FilterableMultiSelect.js +24 -5
- package/es/components/MultiSelect/MultiSelect.js +21 -5
- package/es/components/Notification/Notification.js +1 -1
- package/es/components/NumberInput/NumberInput.js +18 -7
- package/es/components/OverflowMenu/OverflowMenu.js +2 -0
- package/es/components/OverflowMenu/next/index.js +3 -2
- 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 +20 -6
- package/es/components/ProgressBar/ProgressBar.js +4 -2
- package/es/components/RadioTile/RadioTile.js +2 -2
- package/es/components/Search/Search.js +2 -2
- 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.js +11 -16
- 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.js +28 -17
- package/es/components/Tag/DismissibleTag.d.ts +5 -0
- package/es/components/Tag/DismissibleTag.js +8 -1
- 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/TextInput/ControlledPasswordInput.js +2 -4
- package/es/components/TextInput/PasswordInput.js +7 -2
- package/es/components/TextInput/TextInput.js +4 -2
- 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 +23 -8
- package/es/components/Tooltip/DefinitionTooltip.js +1 -0
- package/es/components/Tooltip/Tooltip.js +30 -23
- package/es/components/TreeView/TreeNode.d.ts +28 -0
- package/es/components/TreeView/TreeNode.js +19 -10
- 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.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/internal/FloatingMenu.js +7 -1
- package/es/internal/Selection.js +12 -3
- 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/isRequiredOneOf.js +4 -1
- 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/ComboBox/ComboBox.js +17 -1
- package/lib/components/ComboButton/index.js +1 -0
- package/lib/components/ComposedModal/ComposedModal.js +18 -4
- package/lib/components/DataTable/DataTable.d.ts +3 -8
- package/lib/components/DataTable/DataTable.js +14 -0
- package/lib/components/DataTable/Table.js +3 -3
- package/lib/components/DataTable/TableExpandHeader.js +5 -1
- package/lib/components/DataTable/TableExpandRow.d.ts +33 -5
- package/lib/components/DataTable/TableExpandRow.js +5 -2
- package/lib/components/DataTable/TableHeader.d.ts +1 -2
- package/lib/components/DataTable/TableHeader.js +3 -2
- package/lib/components/DataTable/TableRow.d.ts +3 -6
- package/lib/components/DataTable/TableRow.js +39 -21
- package/lib/components/DataTable/TableSlugRow.js +1 -0
- package/lib/components/DataTable/TableToolbarMenu.js +3 -0
- package/lib/components/DataTable/state/sorting.d.ts +57 -14
- package/lib/components/DataTable/state/sorting.js +41 -50
- package/lib/components/DataTable/tools/sorting.js +5 -0
- package/lib/components/DatePicker/DatePicker.js +14 -3
- package/lib/components/DatePickerInput/DatePickerInput.js +6 -0
- package/lib/components/Dialog/Dialog.js +10 -2
- package/lib/components/Dropdown/Dropdown.js +16 -4
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.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 +4 -2
- 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.js +5 -13
- package/lib/components/MenuButton/index.js +7 -2
- package/lib/components/Modal/Modal.js +15 -6
- package/lib/components/ModalWrapper/ModalWrapper.js +2 -0
- package/lib/components/MultiSelect/FilterableMultiSelect.js +24 -5
- package/lib/components/MultiSelect/MultiSelect.js +21 -5
- package/lib/components/Notification/Notification.js +1 -1
- package/lib/components/NumberInput/NumberInput.js +17 -6
- package/lib/components/OverflowMenu/OverflowMenu.js +2 -0
- package/lib/components/OverflowMenu/next/index.js +3 -2
- 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 +20 -6
- package/lib/components/ProgressBar/ProgressBar.js +4 -2
- package/lib/components/RadioTile/RadioTile.js +2 -2
- package/lib/components/Search/Search.js +2 -2
- 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.js +11 -16
- 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.js +28 -17
- package/lib/components/Tag/DismissibleTag.d.ts +5 -0
- package/lib/components/Tag/DismissibleTag.js +8 -1
- 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/TextInput/ControlledPasswordInput.js +2 -4
- package/lib/components/TextInput/PasswordInput.js +7 -2
- package/lib/components/TextInput/TextInput.js +4 -2
- 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 +22 -7
- package/lib/components/Tooltip/DefinitionTooltip.js +1 -0
- package/lib/components/Tooltip/Tooltip.js +30 -23
- package/lib/components/TreeView/TreeNode.d.ts +28 -0
- package/lib/components/TreeView/TreeNode.js +19 -10
- 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.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/internal/FloatingMenu.js +7 -1
- package/lib/internal/Selection.js +12 -3
- 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/isRequiredOneOf.js +4 -1
- package/lib/tools/events.js +3 -1
- package/lib/tools/wrapComponent.js +1 -0
- package/package.json +11 -11
- package/telemetry.yml +14 -0
|
@@ -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
|
/**
|
|
@@ -111,12 +111,15 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
111
111
|
return true; // Return true if item is not an object with undefined values
|
|
112
112
|
});
|
|
113
113
|
}, [items]);
|
|
114
|
+
|
|
115
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
114
116
|
const selectAll = filteredItems.some(item => item.isSelectAll);
|
|
115
117
|
const prefix = usePrefix();
|
|
116
118
|
const {
|
|
117
119
|
isFluid
|
|
118
120
|
} = useContext(FormContext);
|
|
119
121
|
const multiSelectInstanceId = useId();
|
|
122
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
120
123
|
const [isFocused, setIsFocused] = useState(false);
|
|
121
124
|
const [inputFocused, setInputFocused] = useState(false);
|
|
122
125
|
const [isOpen, setIsOpen] = useState(open || false);
|
|
@@ -185,13 +188,15 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
185
188
|
stateReducer,
|
|
186
189
|
isOpen,
|
|
187
190
|
itemToString: filteredItems => {
|
|
188
|
-
return Array.isArray(filteredItems) && filteredItems.map(
|
|
191
|
+
return Array.isArray(filteredItems) && filteredItems.map(item => {
|
|
189
192
|
return itemToString(item);
|
|
190
193
|
}).join(', ') || '';
|
|
191
194
|
},
|
|
192
195
|
selectedItem: controlledSelectedItems,
|
|
193
196
|
items: filteredItems,
|
|
197
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
194
198
|
isItemDisabled(item, _index) {
|
|
199
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
195
200
|
return item?.disabled;
|
|
196
201
|
},
|
|
197
202
|
...downshiftProps
|
|
@@ -386,6 +391,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
386
391
|
[`${prefix}--list-box__field--wrapper--input-focused`]: inputFocused
|
|
387
392
|
});
|
|
388
393
|
const handleFocus = evt => {
|
|
394
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
389
395
|
evt.target.classList.contains(`${prefix}--tag__close-icon`) ? setIsFocused(false) : setIsFocused(evt.type === 'focus' ? true : false);
|
|
390
396
|
};
|
|
391
397
|
const readOnlyEventHandlers = readOnly ? {
|
|
@@ -413,7 +419,9 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
413
419
|
size: 'mini'
|
|
414
420
|
}) : null;
|
|
415
421
|
const itemsSelectedText = selectedItems.length > 0 && selectedItems.map(item => item?.text);
|
|
416
|
-
const selectedItemsLength = selectAll ?
|
|
422
|
+
const selectedItemsLength = selectAll ?
|
|
423
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
424
|
+
selectedItems.filter(item => !item.isSelectAll).length : selectedItems.length;
|
|
417
425
|
|
|
418
426
|
// Memoize the value of getMenuProps to avoid an infinite loop
|
|
419
427
|
const menuProps = useMemo(() => getMenuProps({
|
|
@@ -432,7 +440,9 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
432
440
|
nonSelectAllSelectedCount,
|
|
433
441
|
totalSelectableCount
|
|
434
442
|
};
|
|
435
|
-
},
|
|
443
|
+
},
|
|
444
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
445
|
+
[selectedItems, filteredItems]);
|
|
436
446
|
return /*#__PURE__*/React.createElement("div", {
|
|
437
447
|
className: wrapperClasses
|
|
438
448
|
}, /*#__PURE__*/React.createElement("label", _extends({
|
|
@@ -484,14 +494,20 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
484
494
|
translateWithId: translateWithId
|
|
485
495
|
})), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React.createElement("div", {
|
|
486
496
|
className: `${prefix}--list-box__inner-wrapper--decorator`
|
|
487
|
-
}, normalizedDecorator) : ''), /*#__PURE__*/React.createElement(ListBox.Menu, menuProps, isOpen &&
|
|
497
|
+
}, normalizedDecorator) : ''), /*#__PURE__*/React.createElement(ListBox.Menu, menuProps, isOpen &&
|
|
498
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
499
|
+
sortItems(filteredItems, sortOptions).map((item, index) => {
|
|
488
500
|
const {
|
|
489
501
|
hasIndividualSelections,
|
|
490
502
|
nonSelectAllSelectedCount,
|
|
491
503
|
totalSelectableCount
|
|
492
504
|
} = getSelectionStats(selectedItems, filteredItems);
|
|
505
|
+
|
|
506
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
493
507
|
const isChecked = item.isSelectAll ? nonSelectAllSelectedCount === totalSelectableCount && totalSelectableCount > 0 : selectedItems.some(selected => isEqual(selected, item));
|
|
494
|
-
const isIndeterminate =
|
|
508
|
+
const isIndeterminate =
|
|
509
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
510
|
+
item.isSelectAll && hasIndividualSelections && nonSelectAllSelectedCount < totalSelectableCount;
|
|
495
511
|
const itemProps = getItemProps({
|
|
496
512
|
item,
|
|
497
513
|
// we don't want Downshift to set aria-selected for us
|
|
@@ -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,
|
|
@@ -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 => {
|
|
@@ -9,7 +9,7 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import { Subtract, Add } from '@carbon/icons-react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
|
-
import React, { useContext, useState, useMemo, useCallback, useRef,
|
|
12
|
+
import React, { useContext, useState, useMemo, useCallback, useRef, useEffect, cloneElement } from 'react';
|
|
13
13
|
import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
14
14
|
import { useNormalizedInputProps } from '../../internal/useNormalizedInputProps.js';
|
|
15
15
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
@@ -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
|
/**
|
|
@@ -173,11 +175,16 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
|
|
|
173
175
|
[`${prefix}--number__invalid`]: normalizedProps.invalid || normalizedProps.warn,
|
|
174
176
|
[`${prefix}--number__invalid--warning`]: normalizedProps.warn
|
|
175
177
|
});
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
useEffect(() => {
|
|
179
|
+
if (type === 'number' && controlledValue !== undefined) {
|
|
180
|
+
if (allowEmpty && controlledValue === '') {
|
|
181
|
+
setValue('');
|
|
182
|
+
} else {
|
|
183
|
+
setValue(controlledValue);
|
|
184
|
+
}
|
|
185
|
+
setPrevControlledValue(controlledValue);
|
|
186
|
+
}
|
|
187
|
+
}, [controlledValue, type, allowEmpty]);
|
|
181
188
|
let ariaDescribedBy = undefined;
|
|
182
189
|
if (normalizedProps.invalid) {
|
|
183
190
|
ariaDescribedBy = normalizedProps.invalidId;
|
|
@@ -228,6 +235,8 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
|
|
|
228
235
|
[`${prefix}--number-input--fluid--focus`]: isFluid && isFocused,
|
|
229
236
|
[`${prefix}--number-input--fluid--disabled`]: isFluid && disabled
|
|
230
237
|
});
|
|
238
|
+
|
|
239
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
231
240
|
const Icon = normalizedProps.icon;
|
|
232
241
|
const getDecimalPlaces = num => {
|
|
233
242
|
const parts = num.toString().split('.');
|
|
@@ -337,7 +346,9 @@ const NumberInput = /*#__PURE__*/React.forwardRef(function NumberInput(props, fo
|
|
|
337
346
|
onKeyUp: onKeyUp,
|
|
338
347
|
onKeyDown: e => {
|
|
339
348
|
if (type === 'text') {
|
|
349
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
340
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
|
|
341
352
|
match(e, ArrowDown) && handleStep(e, 'down');
|
|
342
353
|
}
|
|
343
354
|
if (rest?.onKeyDown) {
|
|
@@ -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,
|
|
@@ -23,7 +23,8 @@ 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
|
|
@@ -107,7 +107,6 @@ function PaginationOverflow({
|
|
|
107
107
|
fromIndex = NaN,
|
|
108
108
|
count = NaN,
|
|
109
109
|
onSelect,
|
|
110
|
-
// eslint-disable-next-line react/prop-types
|
|
111
110
|
disableOverflow,
|
|
112
111
|
translateWithId: t = translateWithId
|
|
113
112
|
}) {
|
|
@@ -165,7 +164,7 @@ function PaginationOverflow({
|
|
|
165
164
|
}
|
|
166
165
|
return null;
|
|
167
166
|
}
|
|
168
|
-
const PaginationNav = /*#__PURE__*/React.forwardRef(
|
|
167
|
+
const PaginationNav = /*#__PURE__*/React.forwardRef(({
|
|
169
168
|
className,
|
|
170
169
|
onChange = () => {},
|
|
171
170
|
totalItems = NaN,
|
|
@@ -176,7 +175,7 @@ const PaginationNav = /*#__PURE__*/React.forwardRef(function PaginationNav({
|
|
|
176
175
|
size = 'lg',
|
|
177
176
|
translateWithId: t = translateWithId,
|
|
178
177
|
...rest
|
|
179
|
-
}, ref) {
|
|
178
|
+
}, ref) => {
|
|
180
179
|
const smMediaQuery = `(max-width: ${breakpoints.sm.width})`;
|
|
181
180
|
const isSm = useMatchMedia(smMediaQuery);
|
|
182
181
|
let numberOfPages;
|
|
@@ -396,8 +395,6 @@ PaginationNav.propTypes = {
|
|
|
396
395
|
* Set this to true if you are having performance problems with large data sets.
|
|
397
396
|
*/
|
|
398
397
|
disableOverflow: PropTypes.bool,
|
|
399
|
-
// eslint-disable-line react/prop-types
|
|
400
|
-
|
|
401
398
|
/**
|
|
402
399
|
* The number of items to be shown (minimum of 4 unless props.items < 4).
|
|
403
400
|
*/
|
|
@@ -48,8 +48,10 @@ const Popover = /*#__PURE__*/React.forwardRef(function PopoverRenderFunction({
|
|
|
48
48
|
open,
|
|
49
49
|
alignmentAxisOffset,
|
|
50
50
|
...rest
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
51
52
|
},
|
|
52
53
|
//this is a workaround, have to come back and fix this.
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
53
55
|
forwardRef) {
|
|
54
56
|
const prefix = usePrefix();
|
|
55
57
|
const floating = useRef(null);
|
|
@@ -61,8 +63,12 @@ forwardRef) {
|
|
|
61
63
|
// The `Popover` should close whenever it and its children loses focus
|
|
62
64
|
useEvent(popover, 'focusout', event => {
|
|
63
65
|
const relatedTarget = event.relatedTarget;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
if (isTabTip) {
|
|
67
|
+
if (relatedTarget && !popover.current?.contains(relatedTarget)) {
|
|
68
|
+
onRequestClose?.();
|
|
69
|
+
}
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
66
72
|
if (!relatedTarget) {
|
|
67
73
|
onRequestClose?.();
|
|
68
74
|
return;
|
|
@@ -87,7 +93,12 @@ forwardRef) {
|
|
|
87
93
|
// needs to be placed 1px further outside the popover content. To do so,
|
|
88
94
|
// we look to see if any of the children has a className containing "slug"
|
|
89
95
|
const initialCaretHeight = React.Children.toArray(children).some(x => {
|
|
90
|
-
return
|
|
96
|
+
return (
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
98
|
+
x?.props?.className?.includes('slug') ||
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
100
|
+
x?.props?.className?.includes('ai-label')
|
|
101
|
+
);
|
|
91
102
|
}) ? 7 : 6;
|
|
92
103
|
// These defaults match the defaults defined in packages/styles/scss/components/popover/_popover.scss
|
|
93
104
|
const popoverDimensions = useRef({
|
|
@@ -206,6 +217,7 @@ forwardRef) {
|
|
|
206
217
|
[`${prefix}--popover--tab-tip`]: isTabTip
|
|
207
218
|
}, customClassName);
|
|
208
219
|
const mappedChildren = React.Children.map(children, child => {
|
|
220
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
209
221
|
const item = child;
|
|
210
222
|
const displayName = item?.type?.displayName;
|
|
211
223
|
|
|
@@ -220,9 +232,13 @@ forwardRef) {
|
|
|
220
232
|
const isTriggerComponent = enableFloatingStyles && displayName && ['ToggletipButton'].includes(displayName);
|
|
221
233
|
const isAllowedTriggerComponent = enableFloatingStyles && !['ToggletipContent', 'PopoverContent'].includes(displayName);
|
|
222
234
|
if (/*#__PURE__*/React.isValidElement(item) && (isTriggerElement || isTriggerComponent || isAllowedTriggerComponent)) {
|
|
235
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
223
236
|
const className = item?.props?.className;
|
|
237
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
224
238
|
const ref = (item?.props).ref;
|
|
225
239
|
const tabTipClasses = cx(`${prefix}--popover--tab-tip__button`, className);
|
|
240
|
+
|
|
241
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
226
242
|
return /*#__PURE__*/React.cloneElement(item, {
|
|
227
243
|
className: isTabTip && item?.type === 'button' ? tabTipClasses : className || '',
|
|
228
244
|
// With cloneElement, if you pass a `ref`, it overrides the original ref.
|
|
@@ -354,9 +370,7 @@ Popover.propTypes = {
|
|
|
354
370
|
*/
|
|
355
371
|
open: PropTypes.bool.isRequired
|
|
356
372
|
};
|
|
357
|
-
function PopoverContentRenderFunction(
|
|
358
|
-
// eslint-disable-next-line react/prop-types
|
|
359
|
-
{
|
|
373
|
+
function PopoverContentRenderFunction({
|
|
360
374
|
className,
|
|
361
375
|
children,
|
|
362
376
|
...rest
|
|
@@ -55,14 +55,16 @@ function ProgressBar({
|
|
|
55
55
|
});
|
|
56
56
|
let StatusIcon = null;
|
|
57
57
|
if (isError) {
|
|
58
|
-
|
|
58
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
59
|
+
StatusIcon = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
59
60
|
return /*#__PURE__*/React.createElement(ErrorFilled, _extends({
|
|
60
61
|
ref: ref,
|
|
61
62
|
size: 16
|
|
62
63
|
}, props));
|
|
63
64
|
});
|
|
64
65
|
} else if (isFinished) {
|
|
65
|
-
|
|
66
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
67
|
+
StatusIcon = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
66
68
|
return /*#__PURE__*/React.createElement(CheckmarkFilled, _extends({
|
|
67
69
|
ref: ref,
|
|
68
70
|
size: 16
|