@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
|
@@ -19,17 +19,19 @@ import { deprecate } from '../../prop-types/deprecate.js';
|
|
|
19
19
|
var _Undo;
|
|
20
20
|
const AILabelContent = /*#__PURE__*/React.forwardRef(function AILabelContent({
|
|
21
21
|
className,
|
|
22
|
-
children
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
children
|
|
23
|
+
}, ref // eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
24
|
+
) {
|
|
25
25
|
const prefix = usePrefix();
|
|
26
26
|
const hasAILabelActions = React.Children.toArray(children).some(child => {
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
27
28
|
const item = child;
|
|
28
29
|
// TODO: Is there supposed to be a `return` here? If so, this issue would
|
|
29
30
|
// have been caught by ESLint. It's concerning that this code is 7 months
|
|
30
31
|
// old and no one has noticed any issues with it. It also makes me question
|
|
31
32
|
// whether the code is necessary.
|
|
32
33
|
// https://github.com/carbon-design-system/carbon/issues/18991
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
33
35
|
item.type === AILabelActions;
|
|
34
36
|
});
|
|
35
37
|
const aiLabelContentClasses = cx(className, {
|
|
@@ -53,9 +55,9 @@ AILabelContent.propTypes = {
|
|
|
53
55
|
};
|
|
54
56
|
const AILabelActions = /*#__PURE__*/React.forwardRef(function AILabelActions({
|
|
55
57
|
className,
|
|
56
|
-
children
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
children
|
|
59
|
+
}, ref // eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
60
|
+
) {
|
|
59
61
|
const prefix = usePrefix();
|
|
60
62
|
const aiLabelActionsClasses = cx(className, {
|
|
61
63
|
[`${prefix}--ai-label-actions`]: true
|
|
@@ -33,6 +33,8 @@ const BreadcrumbItem = frFn((props, ref) => {
|
|
|
33
33
|
[`${prefix}--breadcrumb-item--current`]: isCurrentPage && ariaCurrent !== 'page',
|
|
34
34
|
[customClassName]: !!customClassName
|
|
35
35
|
});
|
|
36
|
+
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
36
38
|
const child = children;
|
|
37
39
|
if (child.type && child.type.displayName !== undefined && child.type.displayName.includes('OverflowMenu')) {
|
|
38
40
|
const horizontalOverflowIcon = /*#__PURE__*/React.createElement(OverflowMenuHorizontal, {
|
|
@@ -21,6 +21,8 @@ function isIconOnlyButton(hasIconOnly, _kind) {
|
|
|
21
21
|
}
|
|
22
22
|
return false;
|
|
23
23
|
}
|
|
24
|
+
|
|
25
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
24
26
|
const Button = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
25
27
|
const {
|
|
26
28
|
as,
|
|
@@ -43,6 +45,7 @@ const Button = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
43
45
|
...rest
|
|
44
46
|
} = props;
|
|
45
47
|
if (ButtonImageElement && !children && !iconDescription) {
|
|
48
|
+
// eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
46
49
|
console.error('Button: renderIcon property specified without also providing an iconDescription property. ' + 'This may impact accessibility for screen reader users.');
|
|
47
50
|
}
|
|
48
51
|
const iconOnlyImage = !ButtonImageElement ? null : /*#__PURE__*/React.createElement(ButtonImageElement, null);
|
|
@@ -38,6 +38,7 @@ const ChatButton = /*#__PURE__*/React.forwardRef(function ChatButton({
|
|
|
38
38
|
} else {
|
|
39
39
|
// Check if size is valid and warn if not
|
|
40
40
|
if (size && !allowedSizes.includes(size)) {
|
|
41
|
+
// eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
41
42
|
console.error(`Invalid size "${size}" provided to ChatButton. Size must be one of: ${allowedSizes.join(', ')}. Defaulting to "lg".`);
|
|
42
43
|
size = 'lg';
|
|
43
44
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import React, { cloneElement } from 'react';
|
|
10
|
+
import React, { Children, isValidElement, cloneElement } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { deprecate } from '../../prop-types/deprecate.js';
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
@@ -15,6 +15,8 @@ import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
|
|
|
15
15
|
import { useId } from '../../internal/useId.js';
|
|
16
16
|
import { AILabel } from '../AILabel/index.js';
|
|
17
17
|
import { isComponentElement } from '../../internal/utils.js';
|
|
18
|
+
import Checkbox from '../Checkbox/Checkbox.js';
|
|
19
|
+
import '../Checkbox/Checkbox.Skeleton.js';
|
|
18
20
|
|
|
19
21
|
const CheckboxGroup = ({
|
|
20
22
|
children,
|
|
@@ -57,6 +59,23 @@ const CheckboxGroup = ({
|
|
|
57
59
|
size: 'mini',
|
|
58
60
|
kind: 'default'
|
|
59
61
|
}) : null;
|
|
62
|
+
const clonedChildren = Children.map(children, child => {
|
|
63
|
+
if (/*#__PURE__*/isValidElement(child) && child.type === Checkbox) {
|
|
64
|
+
const childProps = {
|
|
65
|
+
...(typeof invalid !== 'undefined' && typeof child.props.invalid === 'undefined' ? {
|
|
66
|
+
invalid
|
|
67
|
+
} : {}),
|
|
68
|
+
...(typeof readOnly !== 'undefined' && typeof child.props.readOnly === 'undefined' ? {
|
|
69
|
+
readOnly
|
|
70
|
+
} : {}),
|
|
71
|
+
...(typeof warn !== 'undefined' && typeof child.props.warn === 'undefined' ? {
|
|
72
|
+
warn
|
|
73
|
+
} : {})
|
|
74
|
+
};
|
|
75
|
+
return Object.keys(childProps).length ? /*#__PURE__*/cloneElement(child, childProps) : child;
|
|
76
|
+
}
|
|
77
|
+
return child;
|
|
78
|
+
});
|
|
60
79
|
return /*#__PURE__*/React.createElement("fieldset", _extends({
|
|
61
80
|
className: fieldsetClasses,
|
|
62
81
|
"data-invalid": invalid ? true : undefined,
|
|
@@ -68,7 +87,7 @@ const CheckboxGroup = ({
|
|
|
68
87
|
id: legendId || rest['aria-labelledby']
|
|
69
88
|
}, legendText, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React.createElement("div", {
|
|
70
89
|
className: `${prefix}--checkbox-group-inner--decorator`
|
|
71
|
-
}, normalizedDecorator) : ''),
|
|
90
|
+
}, normalizedDecorator) : ''), clonedChildren, /*#__PURE__*/React.createElement("div", {
|
|
72
91
|
className: `${prefix}--checkbox-group__validation-msg`
|
|
73
92
|
}, !readOnly && invalid && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(WarningFilled, {
|
|
74
93
|
className: `${prefix}--checkbox__invalid-icon`
|
|
@@ -180,6 +180,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
180
180
|
refs.floating.current.style.width = parentWidth + 'px';
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
183
184
|
}, [enableFloatingStyles, floatingStyles, refs.floating, parentWidth]);
|
|
184
185
|
const [inputValue, setInputValue] = useState(getInputValue({
|
|
185
186
|
initialSelectedItem,
|
|
@@ -209,6 +210,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
209
210
|
}
|
|
210
211
|
prevInputLengthRef.current = inputValue.length;
|
|
211
212
|
}
|
|
213
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
212
214
|
}, [typeahead, inputValue, items, itemToString, autocompleteCustomFilter]);
|
|
213
215
|
const isManualClearingRef = useRef(false);
|
|
214
216
|
const [isClearing, setIsClearing] = useState(false);
|
|
@@ -249,6 +251,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
249
251
|
}
|
|
250
252
|
prevSelectedItemProp.current = selectedItemProp;
|
|
251
253
|
}
|
|
254
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
252
255
|
}, [selectedItemProp]);
|
|
253
256
|
const filterItems = (items, itemToString, inputValue) => items.filter(item => typeahead ? autocompleteCustomFilter({
|
|
254
257
|
item: itemToString(item),
|
|
@@ -263,8 +266,10 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
263
266
|
useEffect(() => {
|
|
264
267
|
if (prevInputValue.current !== inputValue) {
|
|
265
268
|
prevInputValue.current = inputValue;
|
|
269
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
266
270
|
onInputChange && onInputChange(inputValue);
|
|
267
271
|
}
|
|
272
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
268
273
|
}, [inputValue]);
|
|
269
274
|
const handleSelectionClear = () => {
|
|
270
275
|
if (textInput?.current) {
|
|
@@ -317,6 +322,8 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
317
322
|
if (state.highlightedIndex !== -1) {
|
|
318
323
|
const filteredList = filterItems(items, itemToString, inputValue);
|
|
319
324
|
const highlightedItem = filteredList[state.highlightedIndex];
|
|
325
|
+
|
|
326
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
320
327
|
if (highlightedItem && !highlightedItem.disabled) {
|
|
321
328
|
return {
|
|
322
329
|
...changes,
|
|
@@ -328,6 +335,8 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
328
335
|
const autoIndex = indexToHighlight(inputValue);
|
|
329
336
|
if (autoIndex !== -1) {
|
|
330
337
|
const matchingItem = items[autoIndex];
|
|
338
|
+
|
|
339
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
331
340
|
if (matchingItem && !matchingItem.disabled) {
|
|
332
341
|
return {
|
|
333
342
|
...changes,
|
|
@@ -480,8 +489,10 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
480
489
|
onHighlightedIndexChange: ({
|
|
481
490
|
highlightedIndex
|
|
482
491
|
}) => {
|
|
492
|
+
// 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
|
|
483
493
|
if (highlightedIndex > -1 && typeof window !== undefined) {
|
|
484
494
|
const itemArray = document.querySelectorAll(`li.${prefix}--list-box__menu-item[role="option"]`);
|
|
495
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
485
496
|
const highlightedItem = itemArray[highlightedIndex];
|
|
486
497
|
if (highlightedItem) {
|
|
487
498
|
highlightedItem.scrollIntoView({
|
|
@@ -494,7 +505,9 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
494
505
|
initialSelectedItem: initialSelectedItem,
|
|
495
506
|
inputId: id,
|
|
496
507
|
stateReducer,
|
|
508
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
497
509
|
isItemDisabled(item, _index) {
|
|
510
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
498
511
|
return item?.disabled;
|
|
499
512
|
},
|
|
500
513
|
...downshiftProps,
|
|
@@ -531,6 +544,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
531
544
|
toggleMenu
|
|
532
545
|
};
|
|
533
546
|
}
|
|
547
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
534
548
|
}, [closeMenu, openMenu, reset, selectItem, setHighlightedIndex, downshiftSetInputValue, toggleMenu]);
|
|
535
549
|
const buttonProps = getToggleButtonProps({
|
|
536
550
|
disabled: disabled || readOnly,
|
|
@@ -579,7 +593,9 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
579
593
|
// Memoize the value of getMenuProps to avoid an infinite loop
|
|
580
594
|
const menuProps = useMemo(() => getMenuProps({
|
|
581
595
|
ref: enableFloatingStyles ? refs.setFloating : null
|
|
582
|
-
}),
|
|
596
|
+
}),
|
|
597
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
598
|
+
[enableFloatingStyles, deprecatedAriaLabel, ariaLabel, getMenuProps, refs.setFloating]);
|
|
583
599
|
useEffect(() => {
|
|
584
600
|
if (textInput.current) {
|
|
585
601
|
if (inputRef.current && typeaheadText) {
|
|
@@ -54,6 +54,7 @@ const ComboButton = /*#__PURE__*/React.forwardRef(function ComboButton({
|
|
|
54
54
|
const id = useId('combobutton');
|
|
55
55
|
const prefix = usePrefix();
|
|
56
56
|
const containerRef = useRef(null);
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
57
58
|
let middlewares = [];
|
|
58
59
|
if (!enableOnlyFloatingStyles) {
|
|
59
60
|
middlewares = [flip({
|
|
@@ -134,6 +134,7 @@ const ComposedModal = /*#__PURE__*/React.forwardRef(function ComposedModal({
|
|
|
134
134
|
setWasOpen(!!open);
|
|
135
135
|
toggleClass(document.body, `${prefix}--body--with-modal-open`, !!open);
|
|
136
136
|
}
|
|
137
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
137
138
|
}, [open, wasOpen, prefix]);
|
|
138
139
|
// Remove the document.body className on unmount
|
|
139
140
|
useEffect(() => {
|
|
@@ -209,7 +210,7 @@ const ComposedModal = /*#__PURE__*/React.forwardRef(function ComposedModal({
|
|
|
209
210
|
}
|
|
210
211
|
const lastContent = modalContent.children[modalContent.children.length - 1];
|
|
211
212
|
const gradientSpacing = modalContent.scrollHeight - lastContent.offsetTop - lastContent.clientHeight;
|
|
212
|
-
for (
|
|
213
|
+
for (const elem of modalContent.children) {
|
|
213
214
|
if (elem.contains(currentActiveNode)) {
|
|
214
215
|
const spaceBelow = modalContent.clientHeight - elem.offsetTop + modalContent.scrollTop - elem.clientHeight;
|
|
215
216
|
if (spaceBelow < gradientSpacing) {
|
|
@@ -276,6 +277,7 @@ const ComposedModal = /*#__PURE__*/React.forwardRef(function ComposedModal({
|
|
|
276
277
|
return () => {
|
|
277
278
|
document.removeEventListener('keydown', handleEscapeKey, true);
|
|
278
279
|
};
|
|
280
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
279
281
|
}, [open]);
|
|
280
282
|
useEffect(() => {
|
|
281
283
|
if (!enableDialogElement && !open && launcherButtonRef) {
|
|
@@ -307,6 +309,7 @@ const ComposedModal = /*#__PURE__*/React.forwardRef(function ComposedModal({
|
|
|
307
309
|
focusButton(innerModal.current);
|
|
308
310
|
}
|
|
309
311
|
}
|
|
312
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
310
313
|
}, [open, selectorPrimaryFocus, isOpen]);
|
|
311
314
|
|
|
312
315
|
// AILabel is always size `sm`
|
|
@@ -68,6 +68,17 @@ const defaultTranslations = {
|
|
|
68
68
|
[translationKeys.unselectRow]: 'Unselect row'
|
|
69
69
|
};
|
|
70
70
|
const translateWithId = id => defaultTranslations[id];
|
|
71
|
+
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
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
|
+
|
|
71
82
|
/**
|
|
72
83
|
* Data Tables are used to represent a collection of resources, displaying a
|
|
73
84
|
* subset of their fields in columns, or headers. We prioritize direct updates
|
|
@@ -78,6 +89,7 @@ const translateWithId = id => defaultTranslations[id];
|
|
|
78
89
|
* and updating the state of the single entity will cascade updates to the
|
|
79
90
|
* consumer.
|
|
80
91
|
*/
|
|
92
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
81
93
|
const DataTable = props => {
|
|
82
94
|
const {
|
|
83
95
|
children,
|
|
@@ -126,6 +138,7 @@ const DataTable = props => {
|
|
|
126
138
|
if (hasRowIdsChanged || hasHeadersChanged || hasRowsChanged) {
|
|
127
139
|
setState(prev => getDerivedStateFromProps(props, prev));
|
|
128
140
|
}
|
|
141
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
129
142
|
}, [headers, rows]);
|
|
130
143
|
|
|
131
144
|
/**
|
|
@@ -158,6 +171,7 @@ const DataTable = props => {
|
|
|
158
171
|
...prev,
|
|
159
172
|
...nextSortState
|
|
160
173
|
}));
|
|
174
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
161
175
|
onClick && handleOnHeaderClick(onClick, {
|
|
162
176
|
sortHeaderKey: header.key,
|
|
163
177
|
sortDirection: nextSortState.sortDirection
|
|
@@ -72,9 +72,11 @@ const Table = ({
|
|
|
72
72
|
[`${prefix}--data-table--visible-overflow-menu`]: !overflowMenuOnHover
|
|
73
73
|
});
|
|
74
74
|
const toggleTableBodyAlignmentClass = useCallback((alignTop = false) => {
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
75
76
|
alignTop ? tableRef.current?.classList.add(`${prefix}--data-table--top-aligned-body`) : tableRef.current?.classList.remove(`${prefix}--data-table--top-aligned-body`);
|
|
76
77
|
}, [prefix]);
|
|
77
78
|
const toggleTableHeaderAlignmentClass = useCallback((alignTop = false) => {
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
78
80
|
alignTop ? tableRef.current?.classList.add(`${prefix}--data-table--top-aligned-header`) : tableRef.current?.classList.remove(`${prefix}--data-table--top-aligned-header`);
|
|
79
81
|
}, [prefix]);
|
|
80
82
|
const setTableAlignment = useCallback(() => {
|
|
@@ -124,9 +126,7 @@ const Table = ({
|
|
|
124
126
|
setTableAlignment();
|
|
125
127
|
}, [setTableAlignment, size]);
|
|
126
128
|
const table = /*#__PURE__*/React.createElement("div", {
|
|
127
|
-
className: `${prefix}--data-table-content
|
|
128
|
-
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
129
|
-
,
|
|
129
|
+
className: `${prefix}--data-table-content`,
|
|
130
130
|
tabIndex: tabIndex ?? (isScrollable ? 0 : undefined)
|
|
131
131
|
}, /*#__PURE__*/React.createElement("table", _extends({
|
|
132
132
|
"aria-labelledby": titleId,
|
|
@@ -91,7 +91,11 @@ TableExpandHeader.propTypes = {
|
|
|
91
91
|
/**
|
|
92
92
|
* Hook for when a listener initiates a request to expand the given row
|
|
93
93
|
*/
|
|
94
|
-
onExpand: PropTypes.oneOfType([requiredIfGivenPropIsTruthy('enableExpando', PropTypes.func
|
|
94
|
+
onExpand: PropTypes.oneOfType([requiredIfGivenPropIsTruthy('enableExpando', PropTypes.func
|
|
95
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
96
|
+
), requiredIfGivenPropIsTruthy('enableToggle', PropTypes.func
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
98
|
+
)])
|
|
95
99
|
};
|
|
96
100
|
|
|
97
101
|
export { TableExpandHeader as default };
|
|
@@ -92,6 +92,7 @@ TableExpandRow.propTypes = {
|
|
|
92
92
|
* Specify the string read by a voice reader when the expand trigger is
|
|
93
93
|
* focused
|
|
94
94
|
*/
|
|
95
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
95
96
|
/**@ts-ignore*/
|
|
96
97
|
'aria-label': PropTypes.string,
|
|
97
98
|
/**
|
|
@@ -188,6 +188,8 @@ TableHeader.propTypes = {
|
|
|
188
188
|
*/
|
|
189
189
|
translateWithId: PropTypes.func
|
|
190
190
|
};
|
|
191
|
+
|
|
192
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
191
193
|
TableHeader.translationKeys = Object.values(translationKeys);
|
|
192
194
|
TableHeader.displayName = 'TableHeader';
|
|
193
195
|
|
|
@@ -21,10 +21,15 @@ const TableRow = frFn((props, ref) => {
|
|
|
21
21
|
// only useful in `TableExpandRow`
|
|
22
22
|
const {
|
|
23
23
|
ariaLabel,
|
|
24
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
24
25
|
'aria-label': ariaLabelAlt,
|
|
26
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
25
27
|
'aria-controls': ariaControls,
|
|
28
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
26
29
|
onExpand,
|
|
30
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
27
31
|
isExpanded,
|
|
32
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
28
33
|
isSelected,
|
|
29
34
|
...cleanProps
|
|
30
35
|
} = props;
|
|
@@ -30,6 +30,7 @@ const TableSlugRow = ({
|
|
|
30
30
|
// Slug is always size `mini`
|
|
31
31
|
let normalizedSlug;
|
|
32
32
|
if (slug) {
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
33
34
|
normalizedSlug = /*#__PURE__*/React.cloneElement(slug, {
|
|
34
35
|
size: 'mini'
|
|
35
36
|
});
|
|
@@ -14,6 +14,9 @@ import { usePrefix } from '../../internal/usePrefix.js';
|
|
|
14
14
|
import OverflowMenu from '../OverflowMenu/index.js';
|
|
15
15
|
|
|
16
16
|
const defaultIconDescription = 'Settings';
|
|
17
|
+
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
19
|
+
|
|
17
20
|
const TableToolbarMenu = ({
|
|
18
21
|
className,
|
|
19
22
|
renderIcon = Settings,
|
|
@@ -13,7 +13,9 @@ export interface SortRowParams {
|
|
|
13
13
|
locale: string;
|
|
14
14
|
compare: (a: string | number, b: string | number, locale?: string) => number;
|
|
15
15
|
}
|
|
16
|
-
export type SortRowFn = (cellA: any,
|
|
16
|
+
export type SortRowFn = (cellA: any, // eslint-disable-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
17
|
+
cellB: any, // eslint-disable-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
18
|
+
options: SortRowParams) => number;
|
|
17
19
|
interface Props {
|
|
18
20
|
locale?: string;
|
|
19
21
|
sortRow?: SortRowFn;
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
import { sortStates } from './sortStates.js';
|
|
9
9
|
import { sortRows } from '../tools/sorting.js';
|
|
10
10
|
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
12
|
+
|
|
11
13
|
const initialSortState = sortStates.NONE;
|
|
12
14
|
|
|
13
15
|
/**
|
|
@@ -13,6 +13,7 @@ import { sortStates } from '../state/sortStates.js';
|
|
|
13
13
|
* type, the default sort algorithm will be used for those types. Otherwise, the
|
|
14
14
|
* values will be converted to strings for comparison.
|
|
15
15
|
*/
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
16
17
|
const compare = (a, b, locale = 'en') => {
|
|
17
18
|
// prevent multiple null values in one column (sorting breaks)
|
|
18
19
|
if (a === null) a = '';
|
|
@@ -69,7 +69,6 @@ const carbonFlatpickrMonthSelectPlugin = config => fp => {
|
|
|
69
69
|
elem.parentNode.removeChild(elem);
|
|
70
70
|
});
|
|
71
71
|
fp.monthElements.splice(0, fp.monthElements.length, ...fp.monthElements.map(() => {
|
|
72
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
73
72
|
const monthElement = fp._createElement('span', config.classFlatpickrCurrentMonth);
|
|
74
73
|
monthElement.textContent = monthToStr(fp.currentMonth, config.shorthand === true, fp.l10n);
|
|
75
74
|
fp.yearElements[0].closest(config.selectorFlatpickrMonthYearContainer).insertBefore(monthElement, fp.yearElements[0].closest(config.selectorFlatpickrYearContainer));
|
|
@@ -170,6 +169,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
170
169
|
isFluid
|
|
171
170
|
} = useContext(FormContext);
|
|
172
171
|
const [hasInput, setHasInput] = useState(false);
|
|
172
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
173
173
|
const startInputField = useCallback(node => {
|
|
174
174
|
if (node !== null) {
|
|
175
175
|
startInputField.current = node;
|
|
@@ -189,7 +189,10 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
189
189
|
if (onClose) {
|
|
190
190
|
onClose(selectedDates, dateStr, instance);
|
|
191
191
|
}
|
|
192
|
-
},
|
|
192
|
+
},
|
|
193
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
194
|
+
[onClose]);
|
|
195
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
193
196
|
const onCalendarClose = (selectedDates, dateStr, instance, e) => {
|
|
194
197
|
if (e && e.type === 'clickOutside') {
|
|
195
198
|
return;
|
|
@@ -226,7 +229,11 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
226
229
|
const wrapperClasses = cx(`${prefix}--form-item`, {
|
|
227
230
|
[String(className)]: className
|
|
228
231
|
});
|
|
229
|
-
|
|
232
|
+
|
|
233
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
234
|
+
const childrenWithProps = React.Children.toArray(children).map(
|
|
235
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
236
|
+
(child, index) => {
|
|
230
237
|
if (index === 0 && child.type === /*#__PURE__*/React.createElement(DatePickerInput, child.props).type) {
|
|
231
238
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
232
239
|
datePickerType,
|
|
@@ -332,6 +339,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
332
339
|
const {
|
|
333
340
|
current: end
|
|
334
341
|
} = endInputField;
|
|
342
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
335
343
|
const flatpickerConfig = {
|
|
336
344
|
inline: inline ?? false,
|
|
337
345
|
onClose: onCalendarClose,
|
|
@@ -507,6 +515,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
507
515
|
// this hook allows consumers to access the flatpickr calendar
|
|
508
516
|
// instance for cases where functions like open() or close()
|
|
509
517
|
// need to be imperatively called on the calendar
|
|
518
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
510
519
|
useImperativeHandle(ref, () => ({
|
|
511
520
|
get calendar() {
|
|
512
521
|
return calendarRef.current;
|
|
@@ -563,6 +572,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
563
572
|
endInputField.current.value = '';
|
|
564
573
|
}
|
|
565
574
|
}
|
|
575
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
566
576
|
}, [value]);
|
|
567
577
|
useEffect(() => {
|
|
568
578
|
const handleMouseDown = event => {
|
|
@@ -571,6 +581,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
571
581
|
closeCalendar();
|
|
572
582
|
}
|
|
573
583
|
};
|
|
584
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
574
585
|
const closeCalendar = event => {
|
|
575
586
|
calendarRef.current?.close();
|
|
576
587
|
// Remove focus from endDate calendar input
|
|
@@ -20,6 +20,8 @@ import { AILabel } from '../AILabel/index.js';
|
|
|
20
20
|
import { isComponentElement } from '../../internal/utils.js';
|
|
21
21
|
import { Text } from '../Text/Text.js';
|
|
22
22
|
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
24
|
+
|
|
23
25
|
let didWarnAboutDatePickerInputValue = false;
|
|
24
26
|
const DatePickerInput = /*#__PURE__*/React.forwardRef(function DatePickerInput(props, ref) {
|
|
25
27
|
const {
|
|
@@ -93,6 +95,8 @@ const DatePickerInput = /*#__PURE__*/React.forwardRef(function DatePickerInput(p
|
|
|
93
95
|
[`${prefix}--date-picker--fluid--warn`]: isFluid && warn
|
|
94
96
|
});
|
|
95
97
|
const datePickerInputHelperId = !helperText ? undefined : `datepicker-input-helper-text-${datePickerInputInstanceId}`;
|
|
98
|
+
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
96
100
|
const inputProps = {
|
|
97
101
|
...rest,
|
|
98
102
|
...datePickerInputProps,
|
|
@@ -198,12 +202,14 @@ DatePickerInput.propTypes = {
|
|
|
198
202
|
/**
|
|
199
203
|
* Provide a regular expression that the input value must match
|
|
200
204
|
*/
|
|
205
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
201
206
|
pattern: (props, propName, componentName) => {
|
|
202
207
|
if (props[propName] === undefined) {
|
|
203
208
|
return;
|
|
204
209
|
}
|
|
205
210
|
try {
|
|
206
211
|
new RegExp(props[propName]);
|
|
212
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
207
213
|
} catch (e) {
|
|
208
214
|
return new Error(`Invalid value of prop '${propName}' supplied to '${componentName}', it should be a valid regular expression`);
|
|
209
215
|
}
|
|
@@ -93,6 +93,7 @@ const Dialog = /*#__PURE__*/React.forwardRef(({
|
|
|
93
93
|
ref.current.close();
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
96
97
|
}, [modal, open]);
|
|
97
98
|
useEffect(() => {
|
|
98
99
|
if (!open && focusAfterCloseRef) {
|
|
@@ -123,6 +124,7 @@ const Dialog = /*#__PURE__*/React.forwardRef(({
|
|
|
123
124
|
ref.current.setAttribute('aria-labelledby', title.id);
|
|
124
125
|
}
|
|
125
126
|
}
|
|
127
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
126
128
|
}, [open, ariaLabel, ariaLabelledBy, prefix]);
|
|
127
129
|
return /*#__PURE__*/React.createElement(DialogContext.Provider, {
|
|
128
130
|
value: contextValue
|
|
@@ -227,6 +229,7 @@ const DialogControls = /*#__PURE__*/React.forwardRef(({
|
|
|
227
229
|
const prefix = usePrefix();
|
|
228
230
|
return (
|
|
229
231
|
/*#__PURE__*/
|
|
232
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
230
233
|
// @ts-ignore
|
|
231
234
|
React.createElement("div", _extends({
|
|
232
235
|
className: `${prefix}--dialog__header-controls`,
|
|
@@ -255,6 +258,7 @@ const DialogCloseButton = /*#__PURE__*/React.forwardRef(({
|
|
|
255
258
|
const prefix = usePrefix();
|
|
256
259
|
return (
|
|
257
260
|
/*#__PURE__*/
|
|
261
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
258
262
|
// @ts-ignore
|
|
259
263
|
React.createElement(IconButton, _extends({
|
|
260
264
|
kind: "ghost",
|
|
@@ -490,7 +494,9 @@ const DialogFooter = /*#__PURE__*/React.forwardRef(({
|
|
|
490
494
|
buttonText,
|
|
491
495
|
onClick: onButtonClick
|
|
492
496
|
}, i) => /*#__PURE__*/React.createElement(Button, {
|
|
493
|
-
key: `${buttonText}-${i}
|
|
497
|
+
key: `${buttonText}-${i}`
|
|
498
|
+
// eslint-disable-next-line jsx-a11y/no-autofocus -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
499
|
+
,
|
|
494
500
|
autoFocus: danger,
|
|
495
501
|
kind: "secondary",
|
|
496
502
|
ref: i === 0 && danger ? setSecondaryButtonRef : undefined,
|
|
@@ -498,7 +504,9 @@ const DialogFooter = /*#__PURE__*/React.forwardRef(({
|
|
|
498
504
|
}, buttonText)) : secondaryButtonText && /*#__PURE__*/React.createElement(Button, {
|
|
499
505
|
ref: danger ? setSecondaryButtonRef : undefined,
|
|
500
506
|
disabled: loadingActive,
|
|
501
|
-
kind: "secondary"
|
|
507
|
+
kind: "secondary"
|
|
508
|
+
// eslint-disable-next-line jsx-a11y/no-autofocus -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
509
|
+
,
|
|
502
510
|
autoFocus: danger,
|
|
503
511
|
onClick: onSecondaryButtonClick
|
|
504
512
|
}, secondaryButtonText), /*#__PURE__*/React.createElement(Button, {
|