@carbon/react 1.90.0-rc.0 → 1.91.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +923 -964
- package/es/components/AILabel/index.js +8 -6
- package/es/components/Breadcrumb/BreadcrumbItem.js +2 -0
- package/es/components/Button/Button.js +3 -0
- package/es/components/ChatButton/ChatButton.js +1 -0
- package/es/components/CheckboxGroup/CheckboxGroup.js +21 -2
- package/es/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/es/components/CodeSnippet/CodeSnippet.js +1 -1
- package/es/components/ComboBox/ComboBox.js +18 -13
- package/es/components/ComboButton/index.js +2 -1
- package/es/components/ComposedModal/ComposedModal.js +5 -2
- package/es/components/Copy/Copy.d.ts +1 -1
- package/es/components/Copy/Copy.js +1 -1
- package/es/components/CopyButton/CopyButton.d.ts +1 -1
- package/es/components/CopyButton/CopyButton.js +1 -1
- package/es/components/DataTable/DataTable.d.ts +60 -15
- package/es/components/DataTable/DataTable.js +119 -178
- package/es/components/DataTable/Table.d.ts +2 -2
- package/es/components/DataTable/Table.js +4 -4
- package/es/components/DataTable/TableExpandHeader.d.ts +1 -1
- package/es/components/DataTable/TableExpandHeader.js +6 -2
- package/es/components/DataTable/TableExpandRow.js +1 -0
- package/es/components/DataTable/TableHeader.js +2 -0
- package/es/components/DataTable/TableRow.js +5 -0
- package/es/components/DataTable/TableSlugRow.js +1 -0
- package/es/components/DataTable/TableToolbarMenu.js +3 -0
- package/es/components/DataTable/state/sorting.d.ts +3 -1
- package/es/components/DataTable/state/sorting.js +2 -0
- package/es/components/DataTable/tools/sorting.js +1 -0
- package/es/components/DatePicker/DatePicker.d.ts +0 -12
- package/es/components/DatePicker/DatePicker.js +17 -6
- package/es/components/DatePicker/plugins/rangePlugin.d.ts +19 -2
- package/es/components/DatePicker/plugins/rangePlugin.js +18 -14
- package/es/components/DatePickerInput/DatePickerInput.js +6 -0
- package/es/components/Dialog/Dialog.js +10 -2
- package/es/components/Dropdown/Dropdown.js +17 -16
- package/es/components/ErrorBoundary/ErrorBoundaryContext.js +1 -0
- package/es/components/FeatureFlags/index.js +1 -0
- package/es/components/FileUploader/FileUploader.js +9 -2
- package/es/components/FileUploader/FileUploaderButton.js +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/es/components/FileUploader/FileUploaderItem.js +3 -0
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +2 -0
- package/es/components/FluidNumberInput/FluidNumberInput.js +3 -2
- package/es/components/FluidSearch/FluidSearch.js +3 -2
- package/es/components/FluidSelect/FluidSelect.js +3 -2
- package/es/components/FluidTextInput/FluidTextInput.js +3 -2
- package/es/components/FluidTimePicker/FluidTimePicker.js +11 -4
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +3 -2
- package/es/components/Grid/CSSGrid.js +5 -0
- package/es/components/Grid/Column.js +3 -0
- package/es/components/Grid/ColumnHang.js +1 -0
- package/es/components/Grid/FlexGrid.js +1 -0
- package/es/components/Grid/Row.js +1 -0
- package/es/components/Heading/index.js +3 -1
- package/es/components/IconButton/index.js +5 -3
- package/es/components/IconIndicator/index.js +4 -2
- package/es/components/InlineCheckbox/InlineCheckbox.js +3 -2
- package/es/components/Layout/index.js +6 -4
- package/es/components/LayoutDirection/LayoutDirection.js +2 -0
- package/es/components/Link/Link.js +3 -0
- package/es/components/ListBox/ListBoxMenuItem.js +4 -1
- package/es/components/ListBox/next/ListBoxTrigger.js +3 -2
- package/es/components/Menu/Menu.js +6 -9
- package/es/components/Menu/MenuContext.js +1 -0
- package/es/components/Menu/MenuItem.d.ts +1 -1
- package/es/components/Menu/MenuItem.js +10 -18
- package/es/components/MenuButton/index.js +7 -2
- package/es/components/Modal/Modal.js +4 -1
- package/es/components/ModalWrapper/ModalWrapper.js +2 -0
- package/es/components/MultiSelect/FilterableMultiSelect.js +25 -6
- package/es/components/MultiSelect/MultiSelect.js +22 -17
- package/es/components/Notification/Notification.d.ts +6 -6
- package/es/components/Notification/Notification.js +7 -7
- package/es/components/NumberInput/NumberInput.js +7 -1
- package/es/components/OverflowMenu/OverflowMenu.js +3 -1
- package/es/components/OverflowMenu/next/index.js +4 -3
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +2 -0
- package/es/components/PageHeader/PageHeader.d.ts +3 -3
- package/es/components/PageHeader/PageHeader.js +22 -8
- package/es/components/Pagination/Pagination.js +6 -2
- package/es/components/PaginationNav/PaginationNav.js +2 -5
- package/es/components/Popover/index.js +15 -5
- package/es/components/ProgressBar/ProgressBar.js +4 -2
- package/es/components/RadioTile/RadioTile.js +2 -2
- package/es/components/Search/Search.d.ts +4 -2
- package/es/components/Search/Search.js +7 -6
- package/es/components/Select/Select.js +2 -3
- package/es/components/ShapeIndicator/index.js +4 -2
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.d.ts +4 -4
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +1 -2
- package/es/components/SkeletonText/SkeletonText.js +0 -2
- package/es/components/Slider/Slider.d.ts +144 -188
- package/es/components/Slider/Slider.js +798 -726
- package/es/components/Slider/index.d.ts +2 -2
- package/es/components/Stack/HStack.js +1 -0
- package/es/components/Stack/Stack.js +6 -9
- package/es/components/Stack/VStack.js +1 -0
- package/es/components/StructuredList/StructuredList.js +3 -0
- package/es/components/Switch/Switch.js +1 -1
- package/es/components/Tabs/Tabs.d.ts +4 -0
- package/es/components/Tabs/Tabs.js +28 -17
- package/es/components/Tag/DismissibleTag.js +2 -0
- package/es/components/Tag/OperationalTag.js +2 -0
- package/es/components/Tag/SelectableTag.js +2 -0
- package/es/components/Tag/Tag.js +4 -0
- package/es/components/Tag/isEllipsisActive.js +1 -0
- package/es/components/Text/Text.js +1 -0
- package/es/components/TextArea/TextArea.js +13 -6
- package/es/components/TextInput/ControlledPasswordInput.js +4 -6
- package/es/components/TextInput/PasswordInput.js +9 -4
- package/es/components/TextInput/TextInput.js +6 -4
- package/es/components/TextInput/util.d.ts +17 -5
- package/es/components/TextInput/util.js +2 -7
- package/es/components/Theme/index.js +8 -3
- package/es/components/Tile/Tile.js +14 -17
- package/es/components/TimePicker/TimePicker.js +1 -0
- package/es/components/Toggle/Toggle.js +1 -1
- package/es/components/Toggletip/index.js +4 -0
- package/es/components/Tooltip/DefinitionTooltip.js +1 -0
- package/es/components/Tooltip/Tooltip.js +30 -23
- package/es/components/TreeView/TreeNode.js +13 -5
- package/es/components/TreeView/TreeView.js +7 -0
- package/es/components/UIShell/HeaderContainer.js +3 -1
- package/es/components/UIShell/HeaderGlobalAction.js +2 -2
- package/es/components/UIShell/HeaderMenu.js +3 -3
- package/es/components/UIShell/HeaderPanel.d.ts +1 -1
- package/es/components/UIShell/HeaderPanel.js +2 -2
- package/es/components/UIShell/Link.js +2 -0
- package/es/components/UIShell/SideNavItems.js +1 -0
- package/es/components/UIShell/SideNavMenu.js +2 -2
- package/es/components/UIShell/SideNavMenuItem.js +1 -1
- package/es/components/UIShell/SideNavSwitcher.js +1 -1
- package/es/components/UIShell/Switcher.js +2 -1
- package/es/components/UIShell/SwitcherItem.js +4 -2
- package/es/index.d.ts +12 -13
- package/es/index.js +25 -24
- package/es/internal/FloatingMenu.js +7 -1
- package/es/internal/Selection.js +12 -3
- package/es/internal/defaultItemToString.d.ts +7 -0
- package/es/internal/defaultItemToString.js +17 -0
- package/es/internal/index.d.ts +1 -0
- package/es/internal/useMergedRefs.js +1 -0
- package/es/internal/useNoInteractiveChildren.js +4 -0
- package/es/internal/useOutsideClick.js +1 -0
- package/es/internal/useOverflowItems.js +6 -0
- package/es/internal/useResizeObserver.js +4 -0
- package/es/internal/useSavedCallback.js +1 -0
- package/es/internal/warning.js +1 -0
- package/es/prop-types/deprecateValuesWithin.d.ts +8 -1
- package/es/prop-types/deprecateValuesWithin.js +6 -6
- package/es/prop-types/isRequiredOneOf.js +4 -1
- package/es/prop-types/requiredIfGivenPropIsTruthy.d.ts +8 -7
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +10 -10
- package/es/tools/events.js +3 -1
- package/es/tools/wrapComponent.js +1 -0
- package/lib/components/AILabel/index.js +8 -6
- package/lib/components/Breadcrumb/BreadcrumbItem.js +2 -0
- package/lib/components/Button/Button.js +3 -0
- package/lib/components/ChatButton/ChatButton.js +1 -0
- package/lib/components/CheckboxGroup/CheckboxGroup.js +20 -1
- package/lib/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/lib/components/CodeSnippet/CodeSnippet.js +1 -1
- package/lib/components/ComboBox/ComboBox.js +20 -15
- package/lib/components/ComboButton/index.js +2 -1
- package/lib/components/ComposedModal/ComposedModal.js +5 -2
- package/lib/components/Copy/Copy.d.ts +1 -1
- package/lib/components/Copy/Copy.js +1 -1
- package/lib/components/CopyButton/CopyButton.d.ts +1 -1
- package/lib/components/CopyButton/CopyButton.js +1 -1
- package/lib/components/DataTable/DataTable.d.ts +60 -15
- package/lib/components/DataTable/DataTable.js +119 -178
- package/lib/components/DataTable/Table.d.ts +2 -2
- package/lib/components/DataTable/Table.js +4 -4
- package/lib/components/DataTable/TableExpandHeader.d.ts +1 -1
- package/lib/components/DataTable/TableExpandHeader.js +6 -2
- package/lib/components/DataTable/TableExpandRow.js +1 -0
- package/lib/components/DataTable/TableHeader.js +2 -0
- package/lib/components/DataTable/TableRow.js +5 -0
- package/lib/components/DataTable/TableSlugRow.js +1 -0
- package/lib/components/DataTable/TableToolbarMenu.js +3 -0
- package/lib/components/DataTable/state/sorting.d.ts +3 -1
- package/lib/components/DataTable/state/sorting.js +2 -0
- package/lib/components/DataTable/tools/sorting.js +1 -0
- package/lib/components/DatePicker/DatePicker.d.ts +0 -12
- package/lib/components/DatePicker/DatePicker.js +16 -5
- package/lib/components/DatePicker/plugins/rangePlugin.d.ts +19 -2
- package/lib/components/DatePicker/plugins/rangePlugin.js +18 -16
- package/lib/components/DatePickerInput/DatePickerInput.js +6 -0
- package/lib/components/Dialog/Dialog.js +10 -2
- package/lib/components/Dropdown/Dropdown.js +19 -18
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +1 -0
- package/lib/components/FeatureFlags/index.js +1 -0
- package/lib/components/FileUploader/FileUploader.js +9 -2
- package/lib/components/FileUploader/FileUploaderButton.js +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/lib/components/FileUploader/FileUploaderItem.js +3 -0
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +2 -0
- package/lib/components/FluidNumberInput/FluidNumberInput.js +3 -2
- package/lib/components/FluidSearch/FluidSearch.js +3 -2
- package/lib/components/FluidSelect/FluidSelect.js +3 -2
- package/lib/components/FluidTextInput/FluidTextInput.js +3 -2
- package/lib/components/FluidTimePicker/FluidTimePicker.js +11 -4
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +3 -2
- package/lib/components/Grid/CSSGrid.js +5 -0
- package/lib/components/Grid/Column.js +3 -0
- package/lib/components/Grid/ColumnHang.js +1 -0
- package/lib/components/Grid/FlexGrid.js +1 -0
- package/lib/components/Grid/Row.js +1 -0
- package/lib/components/Heading/index.js +3 -1
- package/lib/components/IconButton/index.js +5 -3
- package/lib/components/IconIndicator/index.js +4 -2
- package/lib/components/InlineCheckbox/InlineCheckbox.js +3 -2
- package/lib/components/Layout/index.js +6 -4
- package/lib/components/LayoutDirection/LayoutDirection.js +2 -0
- package/lib/components/Link/Link.js +3 -0
- package/lib/components/ListBox/ListBoxMenuItem.js +4 -1
- package/lib/components/ListBox/next/ListBoxTrigger.js +3 -2
- package/lib/components/Menu/Menu.js +6 -9
- package/lib/components/Menu/MenuContext.js +1 -0
- package/lib/components/Menu/MenuItem.d.ts +1 -1
- package/lib/components/Menu/MenuItem.js +11 -19
- package/lib/components/MenuButton/index.js +7 -2
- package/lib/components/Modal/Modal.js +4 -1
- package/lib/components/ModalWrapper/ModalWrapper.js +2 -0
- package/lib/components/MultiSelect/FilterableMultiSelect.js +32 -13
- package/lib/components/MultiSelect/MultiSelect.js +23 -18
- package/lib/components/Notification/Notification.d.ts +6 -6
- package/lib/components/Notification/Notification.js +7 -7
- package/lib/components/NumberInput/NumberInput.js +7 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +3 -1
- package/lib/components/OverflowMenu/next/index.js +4 -3
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +2 -0
- package/lib/components/PageHeader/PageHeader.d.ts +3 -3
- package/lib/components/PageHeader/PageHeader.js +22 -8
- package/lib/components/Pagination/Pagination.js +6 -2
- package/lib/components/PaginationNav/PaginationNav.js +2 -5
- package/lib/components/Popover/index.js +15 -5
- package/lib/components/ProgressBar/ProgressBar.js +4 -2
- package/lib/components/RadioTile/RadioTile.js +2 -2
- package/lib/components/Search/Search.d.ts +4 -2
- package/lib/components/Search/Search.js +7 -6
- package/lib/components/Select/Select.js +2 -3
- package/lib/components/ShapeIndicator/index.js +4 -2
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.d.ts +4 -4
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +1 -2
- package/lib/components/SkeletonText/SkeletonText.js +0 -2
- package/lib/components/Slider/Slider.d.ts +144 -188
- package/lib/components/Slider/Slider.js +795 -725
- package/lib/components/Slider/index.d.ts +2 -2
- package/lib/components/Stack/HStack.js +1 -0
- package/lib/components/Stack/Stack.js +6 -9
- package/lib/components/Stack/VStack.js +1 -0
- package/lib/components/StructuredList/StructuredList.js +3 -0
- package/lib/components/Switch/Switch.js +1 -1
- package/lib/components/Tabs/Tabs.d.ts +4 -0
- package/lib/components/Tabs/Tabs.js +28 -17
- package/lib/components/Tag/DismissibleTag.js +2 -0
- package/lib/components/Tag/OperationalTag.js +2 -0
- package/lib/components/Tag/SelectableTag.js +2 -0
- package/lib/components/Tag/Tag.js +4 -0
- package/lib/components/Tag/isEllipsisActive.js +1 -0
- package/lib/components/Text/Text.js +1 -0
- package/lib/components/TextArea/TextArea.js +13 -6
- package/lib/components/TextInput/ControlledPasswordInput.js +3 -5
- package/lib/components/TextInput/PasswordInput.js +8 -3
- package/lib/components/TextInput/TextInput.js +5 -3
- package/lib/components/TextInput/util.d.ts +17 -5
- package/lib/components/TextInput/util.js +2 -7
- package/lib/components/Theme/index.js +8 -3
- package/lib/components/Tile/Tile.js +14 -17
- package/lib/components/TimePicker/TimePicker.js +1 -0
- package/lib/components/Toggle/Toggle.js +1 -1
- package/lib/components/Toggletip/index.js +4 -0
- package/lib/components/Tooltip/DefinitionTooltip.js +1 -0
- package/lib/components/Tooltip/Tooltip.js +30 -23
- package/lib/components/TreeView/TreeNode.js +13 -5
- package/lib/components/TreeView/TreeView.js +7 -0
- package/lib/components/UIShell/HeaderContainer.js +3 -1
- package/lib/components/UIShell/HeaderGlobalAction.js +2 -2
- package/lib/components/UIShell/HeaderMenu.js +3 -3
- package/lib/components/UIShell/HeaderPanel.d.ts +1 -1
- package/lib/components/UIShell/HeaderPanel.js +2 -2
- package/lib/components/UIShell/Link.js +2 -0
- package/lib/components/UIShell/SideNavItems.js +1 -0
- package/lib/components/UIShell/SideNavMenu.js +2 -2
- package/lib/components/UIShell/SideNavMenuItem.js +1 -1
- package/lib/components/UIShell/SideNavSwitcher.js +1 -1
- package/lib/components/UIShell/Switcher.js +2 -1
- package/lib/components/UIShell/SwitcherItem.js +4 -2
- package/lib/index.d.ts +12 -13
- package/lib/index.js +51 -28
- package/lib/internal/FloatingMenu.js +7 -1
- package/lib/internal/Selection.js +12 -3
- package/lib/internal/defaultItemToString.d.ts +7 -0
- package/lib/internal/defaultItemToString.js +19 -0
- package/lib/internal/index.d.ts +1 -0
- package/lib/internal/useMergedRefs.js +1 -0
- package/lib/internal/useNoInteractiveChildren.js +4 -0
- package/lib/internal/useOutsideClick.js +1 -0
- package/lib/internal/useOverflowItems.js +6 -0
- package/lib/internal/useResizeObserver.js +4 -0
- package/lib/internal/useSavedCallback.js +1 -0
- package/lib/internal/warning.js +1 -0
- package/lib/prop-types/deprecateValuesWithin.d.ts +8 -1
- package/lib/prop-types/deprecateValuesWithin.js +6 -8
- package/lib/prop-types/isRequiredOneOf.js +4 -1
- package/lib/prop-types/requiredIfGivenPropIsTruthy.d.ts +8 -7
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +10 -12
- package/lib/tools/events.js +3 -1
- package/lib/tools/wrapComponent.js +1 -0
- package/package.json +10 -9
- package/es/components/MultiSelect/tools/itemToString.d.ts +0 -1
- package/es/components/MultiSelect/tools/itemToString.js +0 -21
- package/es/components/Slider/index.js +0 -14
- package/es/internal/createClassWrapper.js +0 -23
- package/lib/components/MultiSelect/tools/itemToString.d.ts +0 -1
- package/lib/components/MultiSelect/tools/itemToString.js +0 -23
- package/lib/components/Slider/index.js +0 -20
- package/lib/internal/createClassWrapper.js +0 -25
|
@@ -21,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 = '';
|
|
@@ -8,18 +8,6 @@ import React, { ReactNode } from 'react';
|
|
|
8
8
|
import flatpickr from 'flatpickr';
|
|
9
9
|
import { DateLimit, DateOption } from 'flatpickr/dist/types/options';
|
|
10
10
|
export type DatePickerTypes = 'simple' | 'single' | 'range';
|
|
11
|
-
export type CalRef = {
|
|
12
|
-
inline: boolean;
|
|
13
|
-
disableMobile: boolean;
|
|
14
|
-
defaultDate: Date;
|
|
15
|
-
closeOnSelect: (evt: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
16
|
-
mode: 'simple' | 'single' | 'range';
|
|
17
|
-
allowInput: boolean;
|
|
18
|
-
dateFormat: string;
|
|
19
|
-
locale: string;
|
|
20
|
-
plugins: [];
|
|
21
|
-
clickOpens: any;
|
|
22
|
-
};
|
|
23
11
|
export interface DatePickerProps {
|
|
24
12
|
/**
|
|
25
13
|
* Flatpickr prop passthrough enables direct date input, and when set to false,
|
|
@@ -14,7 +14,7 @@ import l10n from 'flatpickr/dist/l10n/index';
|
|
|
14
14
|
import DatePickerInput from '../DatePickerInput/DatePickerInput.js';
|
|
15
15
|
import { appendToPlugin } from './plugins/appendToPlugin.js';
|
|
16
16
|
import carbonFlatpickrFixEventsPlugin from './plugins/fixEventsPlugin.js';
|
|
17
|
-
import
|
|
17
|
+
import { rangePlugin } from './plugins/rangePlugin.js';
|
|
18
18
|
import { deprecate } from '../../prop-types/deprecate.js';
|
|
19
19
|
import { Escape, Tab, Enter } from '../../internal/keyboard/keys.js';
|
|
20
20
|
import { match } from '../../internal/keyboard/match.js';
|
|
@@ -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,
|
|
@@ -346,8 +354,8 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
346
354
|
minDate: minDate,
|
|
347
355
|
maxDate: maxDate,
|
|
348
356
|
parseDate: parseDate,
|
|
349
|
-
plugins: [datePickerType === 'range' ?
|
|
350
|
-
input: endInputField.current
|
|
357
|
+
plugins: [datePickerType === 'range' ? rangePlugin({
|
|
358
|
+
input: endInputField.current ?? undefined
|
|
351
359
|
}) : () => {}, appendTo ? appendToPlugin({
|
|
352
360
|
appendTo
|
|
353
361
|
}) : () => {}, carbonFlatpickrMonthSelectPlugin({
|
|
@@ -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
|
|
@@ -1,2 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2019, 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { type Config } from 'flatpickr/dist/plugins/rangePlugin';
|
|
8
|
+
import { Instance } from 'flatpickr/dist/types/instance';
|
|
9
|
+
/**
|
|
10
|
+
* @param config Plugin configuration.
|
|
11
|
+
* @returns An extension of Flatpickr `rangePlugin` that does the following:
|
|
12
|
+
* * Better ensures the calendar dropdown is always aligned to the `<input>` for the starting date.
|
|
13
|
+
* Workaround for: https://github.com/flatpickr/flatpickr/issues/1944
|
|
14
|
+
* * A logic to ensure `fp.setDate()` call won't end up with "startDate to endDate" set to the first `<input>`
|
|
15
|
+
*/
|
|
16
|
+
export declare const rangePlugin: (config?: Config) => (fp: Instance) => Partial<import("flatpickr/dist/types/options").BaseOptions> & {
|
|
17
|
+
onReady: (import("flatpickr/dist/types/options").Hook | import("flatpickr/dist/types/options").Hook[] | undefined)[];
|
|
18
|
+
onPreCalendarPosition: () => void;
|
|
19
|
+
};
|
|
@@ -5,36 +5,40 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import baseRangePlugin from 'flatpickr/dist/plugins/rangePlugin';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* @param
|
|
12
|
-
* @returns
|
|
11
|
+
* @param config Plugin configuration.
|
|
12
|
+
* @returns An extension of Flatpickr `rangePlugin` that does the following:
|
|
13
13
|
* * Better ensures the calendar dropdown is always aligned to the `<input>` for the starting date.
|
|
14
14
|
* Workaround for: https://github.com/flatpickr/flatpickr/issues/1944
|
|
15
15
|
* * A logic to ensure `fp.setDate()` call won't end up with "startDate to endDate" set to the first `<input>`
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
|
-
const factory =
|
|
17
|
+
const rangePlugin = (config = {}) => {
|
|
18
|
+
const factory = baseRangePlugin(Object.assign({
|
|
19
19
|
position: 'left'
|
|
20
20
|
}, config));
|
|
21
21
|
return fp => {
|
|
22
|
-
const
|
|
22
|
+
const {
|
|
23
|
+
setDate: origSetDate
|
|
24
|
+
} = fp;
|
|
23
25
|
const init = () => {
|
|
24
|
-
fp.setDate =
|
|
25
|
-
origSetDate
|
|
26
|
+
fp.setDate = (dates, triggerChange, format) => {
|
|
27
|
+
origSetDate(dates, triggerChange, format);
|
|
26
28
|
// If `triggerChange` is `true`, `onValueUpdate` Flatpickr event is fired
|
|
27
29
|
// where Flatpickr's range plugin takes care of fixing the first `<input>`
|
|
28
|
-
if (!triggerChange && dates.length === 2) {
|
|
30
|
+
if (!triggerChange && Array.isArray(dates) && dates.length === 2) {
|
|
29
31
|
const {
|
|
32
|
+
formatDate,
|
|
30
33
|
_input: inputFrom
|
|
31
34
|
} = fp;
|
|
32
35
|
const {
|
|
33
36
|
input: inputTo
|
|
34
37
|
} = config;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
const inputToElement = typeof inputTo === 'string' ? document.querySelector(inputTo) : inputTo;
|
|
39
|
+
[inputFrom, inputToElement].forEach((input, i) => {
|
|
40
|
+
if (input && input instanceof HTMLInputElement) {
|
|
41
|
+
input.value = !dates[i] ? '' : formatDate(new Date(dates[i]), fp.config.dateFormat);
|
|
38
42
|
}
|
|
39
43
|
});
|
|
40
44
|
}
|
|
@@ -46,9 +50,9 @@ var carbonFlatpickrRangePlugin = config => {
|
|
|
46
50
|
} = origRangePlugin;
|
|
47
51
|
return Object.assign(origRangePlugin, {
|
|
48
52
|
onReady: [init, origOnReady],
|
|
49
|
-
onPreCalendarPosition() {}
|
|
53
|
+
onPreCalendarPosition: () => {}
|
|
50
54
|
});
|
|
51
55
|
};
|
|
52
56
|
};
|
|
53
57
|
|
|
54
|
-
export {
|
|
58
|
+
export { rangePlugin };
|
|
@@ -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, {
|
|
@@ -21,6 +21,7 @@ import { useId } from '../../internal/useId.js';
|
|
|
21
21
|
import { useFloating, autoUpdate, size, flip, hide } from '@floating-ui/react';
|
|
22
22
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
23
23
|
import { AILabel } from '../AILabel/index.js';
|
|
24
|
+
import { defaultItemToString } from '../../internal/defaultItemToString.js';
|
|
24
25
|
import { isComponentElement } from '../../internal/utils.js';
|
|
25
26
|
import { ListBoxTypePropType, ListBoxSizePropType } from '../ListBox/ListBoxPropTypes.js';
|
|
26
27
|
|
|
@@ -28,18 +29,6 @@ const {
|
|
|
28
29
|
ItemMouseMove,
|
|
29
30
|
MenuMouseLeave
|
|
30
31
|
} = useSelect.stateChangeTypes;
|
|
31
|
-
const defaultItemToString = item => {
|
|
32
|
-
if (typeof item === 'string') {
|
|
33
|
-
return item;
|
|
34
|
-
}
|
|
35
|
-
if (typeof item === 'number') {
|
|
36
|
-
return `${item}`;
|
|
37
|
-
}
|
|
38
|
-
if (item !== null && typeof item === 'object' && 'label' in item && typeof item['label'] === 'string') {
|
|
39
|
-
return item['label'];
|
|
40
|
-
}
|
|
41
|
-
return '';
|
|
42
|
-
};
|
|
43
32
|
/**
|
|
44
33
|
* Custom state reducer for `useSelect` in Downshift, providing control over
|
|
45
34
|
* state changes.
|
|
@@ -149,6 +138,7 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
|
|
|
149
138
|
}
|
|
150
139
|
});
|
|
151
140
|
}
|
|
141
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
152
142
|
}, [floatingStyles, autoAlign, refs.floating]);
|
|
153
143
|
const prefix = usePrefix();
|
|
154
144
|
const {
|
|
@@ -163,6 +153,8 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
|
|
|
163
153
|
});
|
|
164
154
|
}
|
|
165
155
|
}, [onChange]);
|
|
156
|
+
|
|
157
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
166
158
|
const isItemDisabled = useCallback((item, _index) => {
|
|
167
159
|
const isObject = item !== null && typeof item === 'object';
|
|
168
160
|
return isObject && 'disabled' in item && item.disabled === true;
|
|
@@ -171,7 +163,9 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
|
|
|
171
163
|
const {
|
|
172
164
|
highlightedIndex
|
|
173
165
|
} = changes;
|
|
174
|
-
if (highlightedIndex !== undefined && highlightedIndex > -1 &&
|
|
166
|
+
if (highlightedIndex !== undefined && highlightedIndex > -1 &&
|
|
167
|
+
// eslint-disable-next-line valid-typeof , no-constant-binary-expression -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
168
|
+
typeof window !== undefined) {
|
|
175
169
|
const itemArray = document.querySelectorAll(`li.${prefix}--list-box__menu-item[role="option"]`);
|
|
176
170
|
const highlightedItem = itemArray[highlightedIndex];
|
|
177
171
|
if (highlightedItem) {
|
|
@@ -192,7 +186,9 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
|
|
|
192
186
|
isItemDisabled,
|
|
193
187
|
onHighlightedIndexChange,
|
|
194
188
|
...downshiftProps
|
|
195
|
-
}),
|
|
189
|
+
}),
|
|
190
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
191
|
+
[items, itemToString, initialSelectedItem, onSelectedItemChange, stateReducer, isItemDisabled, onHighlightedIndexChange, downshiftProps]);
|
|
196
192
|
const dropdownInstanceId = useId();
|
|
197
193
|
|
|
198
194
|
// only set selectedItem if the prop is defined. Setting if it is undefined
|
|
@@ -281,7 +277,9 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
|
|
|
281
277
|
if (toggleButtonProps.onKeyDown && (evt.key !== 'ArrowUp' || isOpen && evt.key === 'ArrowUp')) {
|
|
282
278
|
toggleButtonProps.onKeyDown(evt);
|
|
283
279
|
}
|
|
284
|
-
},
|
|
280
|
+
},
|
|
281
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
282
|
+
[isTyping, currTimer, toggleButtonProps]);
|
|
285
283
|
const readOnlyEventHandlers = useMemo(() => {
|
|
286
284
|
if (readOnly) {
|
|
287
285
|
return {
|
|
@@ -304,6 +302,7 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
|
|
|
304
302
|
onKeyDown: onKeyDownHandler
|
|
305
303
|
};
|
|
306
304
|
}
|
|
305
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
307
306
|
}, [readOnly, onKeyDownHandler]);
|
|
308
307
|
const menuProps = useMemo(() => getMenuProps({
|
|
309
308
|
ref: enableFloatingStyles || autoAlign ? refs.setFloating : null
|
|
@@ -354,7 +353,9 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
|
|
|
354
353
|
ref: mergedRef
|
|
355
354
|
}), /*#__PURE__*/React.createElement("span", {
|
|
356
355
|
className: `${prefix}--list-box__label`
|
|
357
|
-
}, selectedItem ? renderSelectedItem ? renderSelectedItem(selectedItem) : itemToString(selectedItem) :
|
|
356
|
+
}, selectedItem ? renderSelectedItem ? renderSelectedItem(selectedItem) : itemToString(selectedItem) :
|
|
357
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
358
|
+
label), /*#__PURE__*/React.createElement(ListBox.MenuIcon, {
|
|
358
359
|
isOpen: isOpen,
|
|
359
360
|
translateWithId: translateWithId
|
|
360
361
|
})), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -9,6 +9,7 @@ import { createContext } from 'react';
|
|
|
9
9
|
|
|
10
10
|
const ErrorBoundaryContext = /*#__PURE__*/createContext({
|
|
11
11
|
log(error, info) {
|
|
12
|
+
// eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
12
13
|
console.log(info.componentStack);
|
|
13
14
|
}
|
|
14
15
|
});
|
|
@@ -10,6 +10,7 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
import React, { useContext, createContext, useState, useRef, useEffect } from 'react';
|
|
11
11
|
import { deprecate } from '../../prop-types/deprecate.js';
|
|
12
12
|
|
|
13
|
+
// TODO: Can this variable be deleted now? It isn't used anywhere.
|
|
13
14
|
/**
|
|
14
15
|
* Our FeatureFlagContext is used alongside the FeatureFlags component to enable
|
|
15
16
|
* or disable feature flags in a given React tree
|
|
@@ -20,6 +20,7 @@ import { useId } from '../../internal/useId.js';
|
|
|
20
20
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
21
21
|
import { Text } from '../Text/Text.js';
|
|
22
22
|
|
|
23
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
23
24
|
const FileUploader = /*#__PURE__*/React.forwardRef(({
|
|
24
25
|
accept,
|
|
25
26
|
buttonKind,
|
|
@@ -43,6 +44,8 @@ const FileUploader = /*#__PURE__*/React.forwardRef(({
|
|
|
43
44
|
const enhancedFileUploaderEnabled = useFeatureFlag('enable-enhanced-file-uploader');
|
|
44
45
|
const [fileItems, setFileItems] = useState([]);
|
|
45
46
|
const [legacyFileNames, setLegacyFileNames] = useState([]);
|
|
47
|
+
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
46
49
|
const [fileObjects, setFileObjects] = useState(new Map());
|
|
47
50
|
const nodes = [];
|
|
48
51
|
const createFileItem = file => ({
|
|
@@ -95,7 +98,9 @@ const FileUploader = /*#__PURE__*/React.forwardRef(({
|
|
|
95
98
|
onChange(evt);
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
|
-
},
|
|
101
|
+
},
|
|
102
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
103
|
+
[enhancedFileUploaderEnabled, fileItems, legacyFileNames, multiple, onChange]);
|
|
99
104
|
const handleClick = useCallback((evt, {
|
|
100
105
|
index,
|
|
101
106
|
filenameStatus
|
|
@@ -150,7 +155,9 @@ const FileUploader = /*#__PURE__*/React.forwardRef(({
|
|
|
150
155
|
}
|
|
151
156
|
uploaderButton.current?.focus?.();
|
|
152
157
|
}
|
|
153
|
-
},
|
|
158
|
+
},
|
|
159
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
160
|
+
[enhancedFileUploaderEnabled, fileItems, legacyFileNames, onDelete, onChange, onClick]);
|
|
154
161
|
useImperativeHandle(ref, () => ({
|
|
155
162
|
clearFiles() {
|
|
156
163
|
if (enhancedFileUploaderEnabled) {
|
|
@@ -30,13 +30,13 @@ function FileUploaderButton({
|
|
|
30
30
|
onChange = noopFn,
|
|
31
31
|
name,
|
|
32
32
|
size = 'md',
|
|
33
|
-
// eslint-disable-next-line react/prop-types
|
|
34
33
|
innerRef,
|
|
35
34
|
...other
|
|
36
35
|
}) {
|
|
37
36
|
const prefix = usePrefix();
|
|
38
37
|
const [labelText, setLabelText] = useState(ownerLabelText);
|
|
39
38
|
const [prevOwnerLabelText, setPrevOwnerLabelText] = useState(ownerLabelText);
|
|
39
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
40
40
|
const {
|
|
41
41
|
current: inputId
|
|
42
42
|
} = useRef(id || useId());
|
|
@@ -28,12 +28,12 @@ function FileUploaderDropContainer({
|
|
|
28
28
|
onAddFiles = noopFn,
|
|
29
29
|
onClick,
|
|
30
30
|
pattern = '.[0-9a-z]+$',
|
|
31
|
-
// eslint-disable-next-line react/prop-types
|
|
32
31
|
innerRef,
|
|
33
32
|
...rest
|
|
34
33
|
}) {
|
|
35
34
|
const prefix = usePrefix();
|
|
36
35
|
const inputRef = useRef(null);
|
|
36
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
37
37
|
const {
|
|
38
38
|
current: uid
|
|
39
39
|
} = useRef(id || useId());
|
|
@@ -36,6 +36,7 @@ function FileUploaderItem({
|
|
|
36
36
|
const textRef = useRef(null);
|
|
37
37
|
const [isEllipsisApplied, setIsEllipsisApplied] = useState(false);
|
|
38
38
|
const prefix = usePrefix();
|
|
39
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
39
40
|
const {
|
|
40
41
|
current: id
|
|
41
42
|
} = useRef(uuid || useId());
|
|
@@ -48,6 +49,8 @@ function FileUploaderItem({
|
|
|
48
49
|
const filterSpaceName = name => {
|
|
49
50
|
return name?.replace(/\s+/g, '');
|
|
50
51
|
};
|
|
52
|
+
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
51
54
|
const isEllipsisActive = element => {
|
|
52
55
|
setIsEllipsisApplied(element.offsetWidth < element.scrollWidth);
|
|
53
56
|
return element.offsetWidth < element.scrollWidth;
|
|
@@ -30,12 +30,14 @@ const FluidMultiSelect = /*#__PURE__*/React.forwardRef(function FluidMultiSelect
|
|
|
30
30
|
}
|
|
31
31
|
}, isFilterable ?
|
|
32
32
|
/*#__PURE__*/
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
33
34
|
// @ts-ignore
|
|
34
35
|
React.createElement(FilterableMultiSelect, _extends({
|
|
35
36
|
ref: ref,
|
|
36
37
|
className: classNames
|
|
37
38
|
}, other)) :
|
|
38
39
|
/*#__PURE__*/
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
39
41
|
// @ts-ignore
|
|
40
42
|
React.createElement(MultiSelect, _extends({
|
|
41
43
|
ref: ref,
|
|
@@ -15,10 +15,11 @@ import { usePrefix } from '../../internal/usePrefix.js';
|
|
|
15
15
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
16
16
|
import { NumberFormatOptionsPropType } from '../NumberInput/NumberFormatPropTypes.js';
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
19
|
+
const FluidNumberInput = /*#__PURE__*/React.forwardRef(({
|
|
19
20
|
className,
|
|
20
21
|
...other
|
|
21
|
-
}, ref) {
|
|
22
|
+
}, ref) => {
|
|
22
23
|
const prefix = usePrefix();
|
|
23
24
|
const classNames = cx(`${prefix}--number-input--fluid`, className);
|
|
24
25
|
return /*#__PURE__*/React.createElement(FormContext.Provider, {
|
|
@@ -14,10 +14,11 @@ import '../Search/Search.Skeleton.js';
|
|
|
14
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
15
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
18
|
+
const FluidSearch = /*#__PURE__*/React.forwardRef(({
|
|
18
19
|
className,
|
|
19
20
|
...other
|
|
20
|
-
}, ref) {
|
|
21
|
+
}, ref) => {
|
|
21
22
|
const prefix = usePrefix();
|
|
22
23
|
const classNames = cx(`${prefix}--search--fluid`, className);
|
|
23
24
|
return /*#__PURE__*/React.createElement(FormContext.Provider, {
|
|
@@ -14,11 +14,12 @@ import '../Select/Select.Skeleton.js';
|
|
|
14
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
15
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
18
|
+
const FluidSelect = /*#__PURE__*/React.forwardRef(({
|
|
18
19
|
className,
|
|
19
20
|
children,
|
|
20
21
|
...other
|
|
21
|
-
}, ref) {
|
|
22
|
+
}, ref) => {
|
|
22
23
|
const prefix = usePrefix();
|
|
23
24
|
const classNames = cx(`${prefix}--select--fluid`, className);
|
|
24
25
|
return /*#__PURE__*/React.createElement(FormContext.Provider, {
|
|
@@ -16,11 +16,12 @@ import PasswordInput from '../TextInput/PasswordInput.js';
|
|
|
16
16
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
17
17
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
20
|
+
const FluidTextInput = /*#__PURE__*/React.forwardRef(({
|
|
20
21
|
className,
|
|
21
22
|
isPassword,
|
|
22
23
|
...other
|
|
23
|
-
}, ref) {
|
|
24
|
+
}, ref) => {
|
|
24
25
|
const prefix = usePrefix();
|
|
25
26
|
const classNames = cx(className, {
|
|
26
27
|
[`${prefix}--text-input--fluid`]: !isPassword
|