@carbon/react 1.90.0-rc.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 +743 -784
- 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 +4 -1
- 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.js +1 -0
- package/es/components/DataTable/TableHeader.js +2 -0
- package/es/components/DataTable/TableRow.js +5 -0
- package/es/components/DataTable/TableSlugRow.js +1 -0
- package/es/components/DataTable/TableToolbarMenu.js +3 -0
- package/es/components/DataTable/state/sorting.d.ts +3 -1
- package/es/components/DataTable/state/sorting.js +2 -0
- package/es/components/DataTable/tools/sorting.js +1 -0
- package/es/components/DatePicker/DatePicker.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 +3 -0
- 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 +7 -1
- 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 +14 -4
- 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.js +2 -0
- package/es/components/Tag/OperationalTag.js +2 -0
- package/es/components/Tag/SelectableTag.js +2 -0
- package/es/components/Tag/Tag.js +4 -0
- package/es/components/Tag/isEllipsisActive.js +1 -0
- package/es/components/Text/Text.js +1 -0
- package/es/components/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 +4 -0
- package/es/components/Tooltip/DefinitionTooltip.js +1 -0
- package/es/components/Tooltip/Tooltip.js +30 -23
- package/es/components/TreeView/TreeNode.js +13 -5
- package/es/components/TreeView/TreeView.js +7 -0
- package/es/components/UIShell/HeaderContainer.js +3 -1
- package/es/components/UIShell/HeaderGlobalAction.js +2 -2
- package/es/components/UIShell/HeaderMenu.js +3 -3
- package/es/components/UIShell/HeaderPanel.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 +4 -1
- 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.js +1 -0
- package/lib/components/DataTable/TableHeader.js +2 -0
- package/lib/components/DataTable/TableRow.js +5 -0
- package/lib/components/DataTable/TableSlugRow.js +1 -0
- package/lib/components/DataTable/TableToolbarMenu.js +3 -0
- package/lib/components/DataTable/state/sorting.d.ts +3 -1
- package/lib/components/DataTable/state/sorting.js +2 -0
- package/lib/components/DataTable/tools/sorting.js +1 -0
- package/lib/components/DatePicker/DatePicker.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 +3 -0
- 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 +7 -1
- 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 +14 -4
- 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.js +2 -0
- package/lib/components/Tag/OperationalTag.js +2 -0
- package/lib/components/Tag/SelectableTag.js +2 -0
- package/lib/components/Tag/Tag.js +4 -0
- package/lib/components/Tag/isEllipsisActive.js +1 -0
- package/lib/components/Text/Text.js +1 -0
- package/lib/components/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 +4 -0
- package/lib/components/Tooltip/DefinitionTooltip.js +1 -0
- package/lib/components/Tooltip/Tooltip.js +30 -23
- package/lib/components/TreeView/TreeNode.js +13 -5
- package/lib/components/TreeView/TreeView.js +7 -0
- package/lib/components/UIShell/HeaderContainer.js +3 -1
- package/lib/components/UIShell/HeaderGlobalAction.js +2 -2
- package/lib/components/UIShell/HeaderMenu.js +3 -3
- package/lib/components/UIShell/HeaderPanel.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 +9 -9
|
@@ -15,7 +15,7 @@ import { ArrowDown, ArrowUp } from '../../internal/keyboard/keys.js';
|
|
|
15
15
|
import { match } from '../../internal/keyboard/match.js';
|
|
16
16
|
import { AriaLabelPropType } from '../../prop-types/AriaPropTypes.js';
|
|
17
17
|
|
|
18
|
-
const SwitcherItem = /*#__PURE__*/forwardRef(
|
|
18
|
+
const SwitcherItem = /*#__PURE__*/forwardRef((props, forwardRef) => {
|
|
19
19
|
const {
|
|
20
20
|
'aria-label': ariaLabel,
|
|
21
21
|
'aria-labelledby': ariaLabelledBy,
|
|
@@ -68,7 +68,9 @@ const SwitcherItem = /*#__PURE__*/forwardRef(function SwitcherItem(props, forwar
|
|
|
68
68
|
},
|
|
69
69
|
href: href,
|
|
70
70
|
target: target,
|
|
71
|
-
rel: rel
|
|
71
|
+
rel: rel
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
73
|
+
,
|
|
72
74
|
ref: forwardRef
|
|
73
75
|
}, rest, {
|
|
74
76
|
className: linkClassName,
|
|
@@ -198,6 +198,7 @@ const FloatingMenu = ({
|
|
|
198
198
|
}
|
|
199
199
|
placeInProgressRef.current = false;
|
|
200
200
|
}
|
|
201
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
201
202
|
}, [floatingPosition, onPlace]);
|
|
202
203
|
|
|
203
204
|
// Attach a resize listener.
|
|
@@ -208,11 +209,13 @@ const FloatingMenu = ({
|
|
|
208
209
|
return () => {
|
|
209
210
|
resizeHandler.remove();
|
|
210
211
|
};
|
|
212
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
211
213
|
}, [triggerRef, menuOffset, menuDirection, flipped, target, updateOrientation]);
|
|
212
214
|
|
|
213
215
|
// Update menu position when key props change.
|
|
214
216
|
useEffect(() => {
|
|
215
217
|
updateMenuPosition();
|
|
218
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
216
219
|
}, [menuOffset, menuDirection, flipped, triggerRef, target, updateOrientation]);
|
|
217
220
|
|
|
218
221
|
/**
|
|
@@ -274,7 +277,10 @@ const FloatingMenu = ({
|
|
|
274
277
|
const focusTrapWithoutSentinels = FeatureFlags.enabled('enable-experimental-focus-wrap-without-sentinels');
|
|
275
278
|
if (typeof document !== 'undefined') {
|
|
276
279
|
const portalTarget = target ? target() : document.body;
|
|
277
|
-
return /*#__PURE__*/ReactDOM.createPortal(
|
|
280
|
+
return /*#__PURE__*/ReactDOM.createPortal(
|
|
281
|
+
/*#__PURE__*/
|
|
282
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
283
|
+
React.createElement("div", {
|
|
278
284
|
onBlur: focusTrap && !focusTrapWithoutSentinels ? handleBlur : undefined,
|
|
279
285
|
onKeyDown: focusTrapWithoutSentinels ? handleKeyDown : undefined
|
|
280
286
|
}, !focusTrapWithoutSentinels && /*#__PURE__*/React.createElement("span", {
|
package/es/internal/Selection.js
CHANGED
|
@@ -42,21 +42,28 @@ const useSelection = ({
|
|
|
42
42
|
const savedOnChange = useRef(onChange);
|
|
43
43
|
const [uncontrolledItems, setUncontrolledItems] = useState(initialSelectedItems);
|
|
44
44
|
const isControlled = !!controlledItems;
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
45
46
|
const selectedItems = isControlled ? controlledItems : uncontrolledItems;
|
|
46
47
|
const onItemChange = useCallback(item => {
|
|
47
48
|
if (disabled) return;
|
|
48
49
|
|
|
49
50
|
// Assert special properties (e.g., `disabled`, `isSelectAll`, etc.) are
|
|
50
51
|
// `any` since those properties aren’t part of the generic type.
|
|
51
|
-
const allSelectableItems = filteredItems.filter(
|
|
52
|
-
|
|
52
|
+
const allSelectableItems = filteredItems.filter(
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
54
|
+
item => !item?.disabled && !item?.isSelectAll);
|
|
55
|
+
const disabledItemCount = filteredItems.filter(
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
57
|
+
item => item?.disabled).length;
|
|
53
58
|
let newSelectedItems;
|
|
54
59
|
|
|
55
60
|
// deselect all on click to All/indeterminate option
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
56
62
|
if (item?.isSelectAll && selectedItems.length > 0) {
|
|
57
63
|
newSelectedItems = [];
|
|
58
64
|
}
|
|
59
65
|
// select all options
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
60
67
|
else if (item?.isSelectAll && selectedItems.length === 0) {
|
|
61
68
|
newSelectedItems = allSelectableItems;
|
|
62
69
|
} else {
|
|
@@ -69,7 +76,9 @@ const useSelection = ({
|
|
|
69
76
|
}
|
|
70
77
|
} else {
|
|
71
78
|
newSelectedItems = removeAtIndex(selectedItems, selectedIndex);
|
|
72
|
-
newSelectedItems = newSelectedItems.filter(
|
|
79
|
+
newSelectedItems = newSelectedItems.filter(
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
81
|
+
item => !item?.isSelectAll);
|
|
73
82
|
}
|
|
74
83
|
}
|
|
75
84
|
callOnChangeHandler({
|
|
@@ -16,6 +16,7 @@ import { useMemo, useCallback } from 'react';
|
|
|
16
16
|
* node, assigns that node to every ref in the array.
|
|
17
17
|
*/
|
|
18
18
|
const useMergedRefs = refs => {
|
|
19
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
19
20
|
const memoizedRefs = useMemo(() => refs, refs);
|
|
20
21
|
return useCallback(node => {
|
|
21
22
|
memoizedRefs.forEach(ref => {
|
|
@@ -14,13 +14,16 @@ const useNoInteractiveChildren = (ref, message = 'component should have no inter
|
|
|
14
14
|
/*
|
|
15
15
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
16
16
|
*/
|
|
17
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
17
18
|
useEffect(() => {
|
|
18
19
|
const node = ref.current ? getInteractiveContent(ref.current) : false;
|
|
19
20
|
if (node) {
|
|
20
21
|
const errorMessage = `Error: ${message}.\n\nInstead found: ${node.outerHTML}`;
|
|
22
|
+
// eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
21
23
|
console.error(errorMessage);
|
|
22
24
|
throw new Error(errorMessage);
|
|
23
25
|
}
|
|
26
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
24
27
|
}, []);
|
|
25
28
|
}
|
|
26
29
|
};
|
|
@@ -31,6 +34,7 @@ const useInteractiveChildrenNeedDescription = (ref, message = `interactive child
|
|
|
31
34
|
/*
|
|
32
35
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
33
36
|
*/
|
|
37
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
34
38
|
useEffect(() => {
|
|
35
39
|
const node = ref.current ? getInteractiveContent(ref.current) : false;
|
|
36
40
|
if (node && !node.hasAttribute('aria-describedby')) {
|
|
@@ -23,6 +23,7 @@ const useOutsideClick = (ref, callback) => {
|
|
|
23
23
|
/*
|
|
24
24
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
25
25
|
*/
|
|
26
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
26
27
|
useWindowEvent('click', event => {
|
|
27
28
|
const {
|
|
28
29
|
target
|
|
@@ -36,6 +36,7 @@ const useOverflowItems = (items, containerRef, offsetRef, maxItems, onChange) =>
|
|
|
36
36
|
setMaxWidth(newMax);
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
39
40
|
useResizeObserver({
|
|
40
41
|
ref: containerRef,
|
|
41
42
|
onResize: handleResize
|
|
@@ -85,14 +86,17 @@ const useOverflowItems = (items, containerRef, offsetRef, maxItems, onChange) =>
|
|
|
85
86
|
};
|
|
86
87
|
|
|
87
88
|
// Memoize visible items calculation to avoid recalculating on every render
|
|
89
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
88
90
|
const visibleItems = useMemo(() => {
|
|
89
91
|
if (!Array.isArray(items)) {
|
|
90
92
|
return [];
|
|
91
93
|
}
|
|
92
94
|
return getVisibleItems();
|
|
95
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
93
96
|
}, [items, maxWidth, maxItems]);
|
|
94
97
|
|
|
95
98
|
// Memoize hidden items calculation
|
|
99
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
96
100
|
const hiddenItems = useMemo(() => {
|
|
97
101
|
if (!Array.isArray(items)) {
|
|
98
102
|
return [];
|
|
@@ -101,9 +105,11 @@ const useOverflowItems = (items, containerRef, offsetRef, maxItems, onChange) =>
|
|
|
101
105
|
}, [items, visibleItems]);
|
|
102
106
|
|
|
103
107
|
// Use previous value to compare and only call onChange when needed
|
|
108
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
104
109
|
const previousHiddenItems = usePreviousValue(hiddenItems);
|
|
105
110
|
|
|
106
111
|
// Only call onChange if hidden items actually changed
|
|
112
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
107
113
|
useEffect(() => {
|
|
108
114
|
}, [hiddenItems, previousHiddenItems, onChange]);
|
|
109
115
|
return {
|
|
@@ -35,6 +35,7 @@ const useResizeObserver = ({
|
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
getInitialSize();
|
|
38
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
38
39
|
}, [width, height]);
|
|
39
40
|
useLayoutEffect(() => {
|
|
40
41
|
if (!ref?.current) {
|
|
@@ -47,6 +48,8 @@ const useResizeObserver = ({
|
|
|
47
48
|
const entry = entriesToHandle.current[0];
|
|
48
49
|
setWidth(entry.contentRect.width);
|
|
49
50
|
setHeight(entry.contentRect.height);
|
|
51
|
+
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
50
53
|
cb.current && cb.current(entry.contentRect);
|
|
51
54
|
};
|
|
52
55
|
const observer = new ResizeObserver(entries => {
|
|
@@ -63,6 +66,7 @@ const useResizeObserver = ({
|
|
|
63
66
|
return () => {
|
|
64
67
|
observer.disconnect();
|
|
65
68
|
};
|
|
69
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
66
70
|
}, []);
|
|
67
71
|
return {
|
|
68
72
|
width,
|
|
@@ -15,6 +15,7 @@ import { useRef, useEffect, useCallback } from 'react';
|
|
|
15
15
|
*
|
|
16
16
|
* @param callback - The callback to track.
|
|
17
17
|
*/
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
18
19
|
const useSavedCallback = callback => {
|
|
19
20
|
const savedCallback = useRef(callback);
|
|
20
21
|
useEffect(() => {
|
package/es/internal/warning.js
CHANGED
|
@@ -22,6 +22,7 @@ const warning = process.env.NODE_ENV !== 'production' ? (condition, message) =>
|
|
|
22
22
|
throw new Error('`warning(condition, message)` requires a warning ' + 'format argument');
|
|
23
23
|
}
|
|
24
24
|
if (!condition) {
|
|
25
|
+
// eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
25
26
|
console.warn('Warning: ' + message);
|
|
26
27
|
}
|
|
27
28
|
} : noopFn;
|
|
@@ -13,9 +13,12 @@
|
|
|
13
13
|
* are the names of the props, and the values are the prop-type validators.
|
|
14
14
|
* @returns A new object of wrapped prop-type validators.
|
|
15
15
|
*/
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
16
17
|
const isRequiredOneOf = propTypes => {
|
|
17
18
|
const names = Object.keys(propTypes);
|
|
18
|
-
const checker = propType =>
|
|
19
|
+
const checker = propType =>
|
|
20
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
21
|
+
(props, propName, componentName, ...rest) => {
|
|
19
22
|
if (process.env.NODE_ENV !== 'production' && names.every(name => typeof props[name] === 'undefined')) {
|
|
20
23
|
return new Error(`${componentName} requires one of the following props: ${names.join(', ')}`);
|
|
21
24
|
}
|
package/es/tools/events.js
CHANGED
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
* @param handlers - An array of event handler functions.
|
|
15
15
|
* @returns A composite event handler.
|
|
16
16
|
*/
|
|
17
|
-
const composeEventHandlers = handlers =>
|
|
17
|
+
const composeEventHandlers = handlers =>
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
19
|
+
(event, ...args) => {
|
|
18
20
|
for (const handler of handlers) {
|
|
19
21
|
if (event.defaultPrevented) {
|
|
20
22
|
break;
|
|
@@ -21,17 +21,19 @@ var deprecate = require('../../prop-types/deprecate.js');
|
|
|
21
21
|
var _Undo;
|
|
22
22
|
const AILabelContent = /*#__PURE__*/React.forwardRef(function AILabelContent({
|
|
23
23
|
className,
|
|
24
|
-
children
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
children
|
|
25
|
+
}, ref // eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
26
|
+
) {
|
|
27
27
|
const prefix = usePrefix.usePrefix();
|
|
28
28
|
const hasAILabelActions = React.Children.toArray(children).some(child => {
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
29
30
|
const item = child;
|
|
30
31
|
// TODO: Is there supposed to be a `return` here? If so, this issue would
|
|
31
32
|
// have been caught by ESLint. It's concerning that this code is 7 months
|
|
32
33
|
// old and no one has noticed any issues with it. It also makes me question
|
|
33
34
|
// whether the code is necessary.
|
|
34
35
|
// https://github.com/carbon-design-system/carbon/issues/18991
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
35
37
|
item.type === AILabelActions;
|
|
36
38
|
});
|
|
37
39
|
const aiLabelContentClasses = cx(className, {
|
|
@@ -55,9 +57,9 @@ AILabelContent.propTypes = {
|
|
|
55
57
|
};
|
|
56
58
|
const AILabelActions = /*#__PURE__*/React.forwardRef(function AILabelActions({
|
|
57
59
|
className,
|
|
58
|
-
children
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
children
|
|
61
|
+
}, ref // eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
62
|
+
) {
|
|
61
63
|
const prefix = usePrefix.usePrefix();
|
|
62
64
|
const aiLabelActionsClasses = cx(className, {
|
|
63
65
|
[`${prefix}--ai-label-actions`]: true
|
|
@@ -37,6 +37,8 @@ const BreadcrumbItem = frFn((props, ref) => {
|
|
|
37
37
|
[`${prefix}--breadcrumb-item--current`]: isCurrentPage && ariaCurrent !== 'page',
|
|
38
38
|
[customClassName]: !!customClassName
|
|
39
39
|
});
|
|
40
|
+
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
40
42
|
const child = children;
|
|
41
43
|
if (child.type && child.type.displayName !== undefined && child.type.displayName.includes('OverflowMenu')) {
|
|
42
44
|
const horizontalOverflowIcon = /*#__PURE__*/React.createElement(iconsReact.OverflowMenuHorizontal, {
|
|
@@ -25,6 +25,8 @@ function isIconOnlyButton(hasIconOnly, _kind) {
|
|
|
25
25
|
}
|
|
26
26
|
return false;
|
|
27
27
|
}
|
|
28
|
+
|
|
29
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
28
30
|
const Button = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
29
31
|
const {
|
|
30
32
|
as,
|
|
@@ -47,6 +49,7 @@ const Button = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
47
49
|
...rest
|
|
48
50
|
} = props;
|
|
49
51
|
if (ButtonImageElement && !children && !iconDescription) {
|
|
52
|
+
// eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
50
53
|
console.error('Button: renderIcon property specified without also providing an iconDescription property. ' + 'This may impact accessibility for screen reader users.');
|
|
51
54
|
}
|
|
52
55
|
const iconOnlyImage = !ButtonImageElement ? null : /*#__PURE__*/React.createElement(ButtonImageElement, null);
|
|
@@ -42,6 +42,7 @@ const ChatButton = /*#__PURE__*/React.forwardRef(function ChatButton({
|
|
|
42
42
|
} else {
|
|
43
43
|
// Check if size is valid and warn if not
|
|
44
44
|
if (size && !allowedSizes.includes(size)) {
|
|
45
|
+
// eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
45
46
|
console.error(`Invalid size "${size}" provided to ChatButton. Size must be one of: ${allowedSizes.join(', ')}. Defaulting to "lg".`);
|
|
46
47
|
size = 'lg';
|
|
47
48
|
}
|
|
@@ -19,6 +19,8 @@ var iconsReact = require('@carbon/icons-react');
|
|
|
19
19
|
var useId = require('../../internal/useId.js');
|
|
20
20
|
var index = require('../AILabel/index.js');
|
|
21
21
|
var utils = require('../../internal/utils.js');
|
|
22
|
+
var Checkbox = require('../Checkbox/Checkbox.js');
|
|
23
|
+
require('../Checkbox/Checkbox.Skeleton.js');
|
|
22
24
|
|
|
23
25
|
const CheckboxGroup = ({
|
|
24
26
|
children,
|
|
@@ -61,6 +63,23 @@ const CheckboxGroup = ({
|
|
|
61
63
|
size: 'mini',
|
|
62
64
|
kind: 'default'
|
|
63
65
|
}) : null;
|
|
66
|
+
const clonedChildren = React.Children.map(children, child => {
|
|
67
|
+
if (/*#__PURE__*/React.isValidElement(child) && child.type === Checkbox.default) {
|
|
68
|
+
const childProps = {
|
|
69
|
+
...(typeof invalid !== 'undefined' && typeof child.props.invalid === 'undefined' ? {
|
|
70
|
+
invalid
|
|
71
|
+
} : {}),
|
|
72
|
+
...(typeof readOnly !== 'undefined' && typeof child.props.readOnly === 'undefined' ? {
|
|
73
|
+
readOnly
|
|
74
|
+
} : {}),
|
|
75
|
+
...(typeof warn !== 'undefined' && typeof child.props.warn === 'undefined' ? {
|
|
76
|
+
warn
|
|
77
|
+
} : {})
|
|
78
|
+
};
|
|
79
|
+
return Object.keys(childProps).length ? /*#__PURE__*/React.cloneElement(child, childProps) : child;
|
|
80
|
+
}
|
|
81
|
+
return child;
|
|
82
|
+
});
|
|
64
83
|
return /*#__PURE__*/React.createElement("fieldset", _rollupPluginBabelHelpers.extends({
|
|
65
84
|
className: fieldsetClasses,
|
|
66
85
|
"data-invalid": invalid ? true : undefined,
|
|
@@ -72,7 +91,7 @@ const CheckboxGroup = ({
|
|
|
72
91
|
id: legendId || rest['aria-labelledby']
|
|
73
92
|
}, legendText, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React.createElement("div", {
|
|
74
93
|
className: `${prefix}--checkbox-group-inner--decorator`
|
|
75
|
-
}, normalizedDecorator) : ''),
|
|
94
|
+
}, normalizedDecorator) : ''), clonedChildren, /*#__PURE__*/React.createElement("div", {
|
|
76
95
|
className: `${prefix}--checkbox-group__validation-msg`
|
|
77
96
|
}, !readOnly && invalid && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(iconsReact.WarningFilled, {
|
|
78
97
|
className: `${prefix}--checkbox__invalid-icon`
|
|
@@ -184,6 +184,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
184
184
|
refs.floating.current.style.width = parentWidth + 'px';
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
187
188
|
}, [enableFloatingStyles, floatingStyles, refs.floating, parentWidth]);
|
|
188
189
|
const [inputValue, setInputValue] = React.useState(getInputValue({
|
|
189
190
|
initialSelectedItem,
|
|
@@ -213,6 +214,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
213
214
|
}
|
|
214
215
|
prevInputLengthRef.current = inputValue.length;
|
|
215
216
|
}
|
|
217
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
216
218
|
}, [typeahead, inputValue, items, itemToString, autocompleteCustomFilter]);
|
|
217
219
|
const isManualClearingRef = React.useRef(false);
|
|
218
220
|
const [isClearing, setIsClearing] = React.useState(false);
|
|
@@ -253,6 +255,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
253
255
|
}
|
|
254
256
|
prevSelectedItemProp.current = selectedItemProp;
|
|
255
257
|
}
|
|
258
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
256
259
|
}, [selectedItemProp]);
|
|
257
260
|
const filterItems = (items, itemToString, inputValue) => items.filter(item => typeahead ? autocompleteCustomFilter({
|
|
258
261
|
item: itemToString(item),
|
|
@@ -267,8 +270,10 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
267
270
|
React.useEffect(() => {
|
|
268
271
|
if (prevInputValue.current !== inputValue) {
|
|
269
272
|
prevInputValue.current = inputValue;
|
|
273
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
270
274
|
onInputChange && onInputChange(inputValue);
|
|
271
275
|
}
|
|
276
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
272
277
|
}, [inputValue]);
|
|
273
278
|
const handleSelectionClear = () => {
|
|
274
279
|
if (textInput?.current) {
|
|
@@ -321,6 +326,8 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
321
326
|
if (state.highlightedIndex !== -1) {
|
|
322
327
|
const filteredList = filterItems(items, itemToString, inputValue);
|
|
323
328
|
const highlightedItem = filteredList[state.highlightedIndex];
|
|
329
|
+
|
|
330
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
324
331
|
if (highlightedItem && !highlightedItem.disabled) {
|
|
325
332
|
return {
|
|
326
333
|
...changes,
|
|
@@ -332,6 +339,8 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
332
339
|
const autoIndex = indexToHighlight(inputValue);
|
|
333
340
|
if (autoIndex !== -1) {
|
|
334
341
|
const matchingItem = items[autoIndex];
|
|
342
|
+
|
|
343
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
335
344
|
if (matchingItem && !matchingItem.disabled) {
|
|
336
345
|
return {
|
|
337
346
|
...changes,
|
|
@@ -484,8 +493,10 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
484
493
|
onHighlightedIndexChange: ({
|
|
485
494
|
highlightedIndex
|
|
486
495
|
}) => {
|
|
496
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion , valid-typeof , no-constant-binary-expression -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
487
497
|
if (highlightedIndex > -1 && typeof window !== undefined) {
|
|
488
498
|
const itemArray = document.querySelectorAll(`li.${prefix}--list-box__menu-item[role="option"]`);
|
|
499
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
489
500
|
const highlightedItem = itemArray[highlightedIndex];
|
|
490
501
|
if (highlightedItem) {
|
|
491
502
|
highlightedItem.scrollIntoView({
|
|
@@ -498,7 +509,9 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
498
509
|
initialSelectedItem: initialSelectedItem,
|
|
499
510
|
inputId: id,
|
|
500
511
|
stateReducer,
|
|
512
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
501
513
|
isItemDisabled(item, _index) {
|
|
514
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
502
515
|
return item?.disabled;
|
|
503
516
|
},
|
|
504
517
|
...downshiftProps,
|
|
@@ -535,6 +548,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
535
548
|
toggleMenu
|
|
536
549
|
};
|
|
537
550
|
}
|
|
551
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
538
552
|
}, [closeMenu, openMenu, reset, selectItem, setHighlightedIndex, downshiftSetInputValue, toggleMenu]);
|
|
539
553
|
const buttonProps = getToggleButtonProps({
|
|
540
554
|
disabled: disabled || readOnly,
|
|
@@ -583,7 +597,9 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
583
597
|
// Memoize the value of getMenuProps to avoid an infinite loop
|
|
584
598
|
const menuProps = React.useMemo(() => getMenuProps({
|
|
585
599
|
ref: enableFloatingStyles ? refs.setFloating : null
|
|
586
|
-
}),
|
|
600
|
+
}),
|
|
601
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
602
|
+
[enableFloatingStyles, deprecatedAriaLabel, ariaLabel, getMenuProps, refs.setFloating]);
|
|
587
603
|
React.useEffect(() => {
|
|
588
604
|
if (textInput.current) {
|
|
589
605
|
if (inputRef.current && typeaheadText) {
|
|
@@ -56,6 +56,7 @@ const ComboButton = /*#__PURE__*/React.forwardRef(function ComboButton({
|
|
|
56
56
|
const id = useId.useId('combobutton');
|
|
57
57
|
const prefix = usePrefix.usePrefix();
|
|
58
58
|
const containerRef = React.useRef(null);
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
59
60
|
let middlewares = [];
|
|
60
61
|
if (!enableOnlyFloatingStyles) {
|
|
61
62
|
middlewares = [react.flip({
|
|
@@ -138,6 +138,7 @@ const ComposedModal = /*#__PURE__*/React.forwardRef(function ComposedModal({
|
|
|
138
138
|
setWasOpen(!!open);
|
|
139
139
|
toggleClass.toggleClass(document.body, `${prefix}--body--with-modal-open`, !!open);
|
|
140
140
|
}
|
|
141
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
141
142
|
}, [open, wasOpen, prefix]);
|
|
142
143
|
// Remove the document.body className on unmount
|
|
143
144
|
React.useEffect(() => {
|
|
@@ -213,7 +214,7 @@ const ComposedModal = /*#__PURE__*/React.forwardRef(function ComposedModal({
|
|
|
213
214
|
}
|
|
214
215
|
const lastContent = modalContent.children[modalContent.children.length - 1];
|
|
215
216
|
const gradientSpacing = modalContent.scrollHeight - lastContent.offsetTop - lastContent.clientHeight;
|
|
216
|
-
for (
|
|
217
|
+
for (const elem of modalContent.children) {
|
|
217
218
|
if (elem.contains(currentActiveNode)) {
|
|
218
219
|
const spaceBelow = modalContent.clientHeight - elem.offsetTop + modalContent.scrollTop - elem.clientHeight;
|
|
219
220
|
if (spaceBelow < gradientSpacing) {
|
|
@@ -280,6 +281,7 @@ const ComposedModal = /*#__PURE__*/React.forwardRef(function ComposedModal({
|
|
|
280
281
|
return () => {
|
|
281
282
|
document.removeEventListener('keydown', handleEscapeKey, true);
|
|
282
283
|
};
|
|
284
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
283
285
|
}, [open]);
|
|
284
286
|
React.useEffect(() => {
|
|
285
287
|
if (!enableDialogElement && !open && launcherButtonRef) {
|
|
@@ -311,6 +313,7 @@ const ComposedModal = /*#__PURE__*/React.forwardRef(function ComposedModal({
|
|
|
311
313
|
focusButton(innerModal.current);
|
|
312
314
|
}
|
|
313
315
|
}
|
|
316
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
314
317
|
}, [open, selectorPrimaryFocus, isOpen]);
|
|
315
318
|
|
|
316
319
|
// AILabel is always size `sm`
|
|
@@ -70,6 +70,17 @@ const defaultTranslations = {
|
|
|
70
70
|
[translationKeys.unselectRow]: 'Unselect row'
|
|
71
71
|
};
|
|
72
72
|
const translateWithId = id => defaultTranslations[id];
|
|
73
|
+
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
75
|
+
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
77
|
+
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
79
|
+
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
81
|
+
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
83
|
+
|
|
73
84
|
/**
|
|
74
85
|
* Data Tables are used to represent a collection of resources, displaying a
|
|
75
86
|
* subset of their fields in columns, or headers. We prioritize direct updates
|
|
@@ -80,6 +91,7 @@ const translateWithId = id => defaultTranslations[id];
|
|
|
80
91
|
* and updating the state of the single entity will cascade updates to the
|
|
81
92
|
* consumer.
|
|
82
93
|
*/
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
83
95
|
const DataTable = props => {
|
|
84
96
|
const {
|
|
85
97
|
children,
|
|
@@ -128,6 +140,7 @@ const DataTable = props => {
|
|
|
128
140
|
if (hasRowIdsChanged || hasHeadersChanged || hasRowsChanged) {
|
|
129
141
|
setState(prev => getDerivedStateFromProps.default(props, prev));
|
|
130
142
|
}
|
|
143
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
131
144
|
}, [headers, rows]);
|
|
132
145
|
|
|
133
146
|
/**
|
|
@@ -160,6 +173,7 @@ const DataTable = props => {
|
|
|
160
173
|
...prev,
|
|
161
174
|
...nextSortState
|
|
162
175
|
}));
|
|
176
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
163
177
|
onClick && handleOnHeaderClick(onClick, {
|
|
164
178
|
sortHeaderKey: header.key,
|
|
165
179
|
sortDirection: nextSortState.sortDirection
|
|
@@ -76,9 +76,11 @@ const Table = ({
|
|
|
76
76
|
[`${prefix}--data-table--visible-overflow-menu`]: !overflowMenuOnHover
|
|
77
77
|
});
|
|
78
78
|
const toggleTableBodyAlignmentClass = React.useCallback((alignTop = false) => {
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
79
80
|
alignTop ? tableRef.current?.classList.add(`${prefix}--data-table--top-aligned-body`) : tableRef.current?.classList.remove(`${prefix}--data-table--top-aligned-body`);
|
|
80
81
|
}, [prefix]);
|
|
81
82
|
const toggleTableHeaderAlignmentClass = React.useCallback((alignTop = false) => {
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
82
84
|
alignTop ? tableRef.current?.classList.add(`${prefix}--data-table--top-aligned-header`) : tableRef.current?.classList.remove(`${prefix}--data-table--top-aligned-header`);
|
|
83
85
|
}, [prefix]);
|
|
84
86
|
const setTableAlignment = React.useCallback(() => {
|
|
@@ -128,9 +130,7 @@ const Table = ({
|
|
|
128
130
|
setTableAlignment();
|
|
129
131
|
}, [setTableAlignment, size]);
|
|
130
132
|
const table = /*#__PURE__*/React.createElement("div", {
|
|
131
|
-
className: `${prefix}--data-table-content
|
|
132
|
-
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
133
|
-
,
|
|
133
|
+
className: `${prefix}--data-table-content`,
|
|
134
134
|
tabIndex: tabIndex ?? (isScrollable ? 0 : undefined)
|
|
135
135
|
}, /*#__PURE__*/React.createElement("table", _rollupPluginBabelHelpers.extends({
|
|
136
136
|
"aria-labelledby": titleId,
|
|
@@ -95,7 +95,11 @@ TableExpandHeader.propTypes = {
|
|
|
95
95
|
/**
|
|
96
96
|
* Hook for when a listener initiates a request to expand the given row
|
|
97
97
|
*/
|
|
98
|
-
onExpand: PropTypes.oneOfType([requiredIfGivenPropIsTruthy.default('enableExpando', PropTypes.func
|
|
98
|
+
onExpand: PropTypes.oneOfType([requiredIfGivenPropIsTruthy.default('enableExpando', PropTypes.func
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
100
|
+
), requiredIfGivenPropIsTruthy.default('enableToggle', PropTypes.func
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
102
|
+
)])
|
|
99
103
|
};
|
|
100
104
|
|
|
101
105
|
exports.default = TableExpandHeader;
|
|
@@ -96,6 +96,7 @@ TableExpandRow.propTypes = {
|
|
|
96
96
|
* Specify the string read by a voice reader when the expand trigger is
|
|
97
97
|
* focused
|
|
98
98
|
*/
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
99
100
|
/**@ts-ignore*/
|
|
100
101
|
'aria-label': PropTypes.string,
|
|
101
102
|
/**
|
|
@@ -192,6 +192,8 @@ TableHeader.propTypes = {
|
|
|
192
192
|
*/
|
|
193
193
|
translateWithId: PropTypes.func
|
|
194
194
|
};
|
|
195
|
+
|
|
196
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
195
197
|
TableHeader.translationKeys = Object.values(translationKeys);
|
|
196
198
|
TableHeader.displayName = 'TableHeader';
|
|
197
199
|
|
|
@@ -25,10 +25,15 @@ const TableRow = frFn((props, ref) => {
|
|
|
25
25
|
// only useful in `TableExpandRow`
|
|
26
26
|
const {
|
|
27
27
|
ariaLabel,
|
|
28
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
28
29
|
'aria-label': ariaLabelAlt,
|
|
30
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
29
31
|
'aria-controls': ariaControls,
|
|
32
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
30
33
|
onExpand,
|
|
34
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
31
35
|
isExpanded,
|
|
36
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
32
37
|
isSelected,
|
|
33
38
|
...cleanProps
|
|
34
39
|
} = props;
|
|
@@ -34,6 +34,7 @@ const TableSlugRow = ({
|
|
|
34
34
|
// Slug is always size `mini`
|
|
35
35
|
let normalizedSlug;
|
|
36
36
|
if (slug) {
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
37
38
|
normalizedSlug = /*#__PURE__*/React.cloneElement(slug, {
|
|
38
39
|
size: 'mini'
|
|
39
40
|
});
|