@carbon/react 1.89.0 → 1.90.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +877 -877
- package/README.md +2 -2
- package/es/components/AILabel/index.js +8 -6
- package/es/components/Breadcrumb/BreadcrumbItem.js +2 -0
- package/es/components/Button/Button.js +3 -0
- package/es/components/ChatButton/ChatButton.js +1 -0
- package/es/components/CheckboxGroup/CheckboxGroup.js +21 -2
- package/es/components/ComboBox/ComboBox.js +17 -1
- package/es/components/ComboButton/index.js +1 -0
- package/es/components/ComposedModal/ComposedModal.js +18 -4
- package/es/components/DataTable/DataTable.d.ts +3 -8
- package/es/components/DataTable/DataTable.js +14 -0
- package/es/components/DataTable/Table.js +3 -3
- package/es/components/DataTable/TableExpandHeader.js +5 -1
- package/es/components/DataTable/TableExpandRow.d.ts +33 -5
- package/es/components/DataTable/TableExpandRow.js +5 -2
- package/es/components/DataTable/TableHeader.d.ts +1 -2
- package/es/components/DataTable/TableHeader.js +3 -2
- package/es/components/DataTable/TableRow.d.ts +3 -6
- package/es/components/DataTable/TableRow.js +40 -22
- package/es/components/DataTable/TableSlugRow.js +1 -0
- package/es/components/DataTable/TableToolbarMenu.js +3 -0
- package/es/components/DataTable/state/sorting.d.ts +57 -14
- package/es/components/DataTable/state/sorting.js +42 -50
- package/es/components/DataTable/tools/sorting.js +5 -0
- package/es/components/DatePicker/DatePicker.js +14 -3
- package/es/components/DatePickerInput/DatePickerInput.js +6 -0
- package/es/components/Dialog/Dialog.js +10 -2
- package/es/components/Dropdown/Dropdown.js +16 -4
- package/es/components/ErrorBoundary/ErrorBoundaryContext.js +1 -0
- package/es/components/FileUploader/FileUploader.js +9 -2
- package/es/components/FileUploader/FileUploaderButton.js +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/es/components/FileUploader/FileUploaderItem.js +3 -0
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +2 -0
- package/es/components/FluidNumberInput/FluidNumberInput.js +3 -2
- package/es/components/FluidSearch/FluidSearch.js +3 -2
- package/es/components/FluidSelect/FluidSelect.js +3 -2
- package/es/components/FluidTextInput/FluidTextInput.js +3 -2
- package/es/components/FluidTimePicker/FluidTimePicker.js +11 -4
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +3 -2
- package/es/components/Grid/CSSGrid.js +5 -0
- package/es/components/Grid/Column.js +3 -0
- package/es/components/Grid/ColumnHang.js +1 -0
- package/es/components/Grid/FlexGrid.js +1 -0
- package/es/components/Grid/Row.js +1 -0
- package/es/components/Heading/index.js +3 -1
- package/es/components/IconButton/index.js +4 -2
- package/es/components/IconIndicator/index.js +4 -2
- package/es/components/InlineCheckbox/InlineCheckbox.js +3 -2
- package/es/components/Layout/index.js +6 -4
- package/es/components/LayoutDirection/LayoutDirection.js +2 -0
- package/es/components/Link/Link.js +3 -0
- package/es/components/ListBox/ListBoxMenuItem.js +4 -1
- package/es/components/ListBox/next/ListBoxTrigger.js +3 -2
- package/es/components/Menu/Menu.js +6 -9
- package/es/components/Menu/MenuContext.js +1 -0
- package/es/components/Menu/MenuItem.js +5 -13
- package/es/components/MenuButton/index.js +7 -2
- package/es/components/Modal/Modal.js +15 -6
- package/es/components/ModalWrapper/ModalWrapper.js +2 -0
- package/es/components/MultiSelect/FilterableMultiSelect.js +24 -5
- package/es/components/MultiSelect/MultiSelect.js +21 -5
- package/es/components/Notification/Notification.js +1 -1
- package/es/components/NumberInput/NumberInput.js +18 -7
- package/es/components/OverflowMenu/OverflowMenu.js +2 -0
- package/es/components/OverflowMenu/next/index.js +3 -2
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +2 -0
- package/es/components/PageHeader/PageHeader.d.ts +3 -3
- package/es/components/PageHeader/PageHeader.js +22 -8
- package/es/components/Pagination/Pagination.js +6 -2
- package/es/components/PaginationNav/PaginationNav.js +2 -5
- package/es/components/Popover/index.js +20 -6
- package/es/components/ProgressBar/ProgressBar.js +4 -2
- package/es/components/RadioTile/RadioTile.js +2 -2
- package/es/components/Search/Search.js +2 -2
- package/es/components/Select/Select.js +2 -3
- package/es/components/ShapeIndicator/index.js +4 -2
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.d.ts +4 -4
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +1 -2
- package/es/components/SkeletonText/SkeletonText.js +0 -2
- package/es/components/Slider/Slider.js +11 -16
- package/es/components/Stack/HStack.js +1 -0
- package/es/components/Stack/Stack.js +6 -9
- package/es/components/Stack/VStack.js +1 -0
- package/es/components/StructuredList/StructuredList.js +3 -0
- package/es/components/Switch/Switch.js +1 -1
- package/es/components/Tabs/Tabs.js +28 -17
- package/es/components/Tag/DismissibleTag.d.ts +5 -0
- package/es/components/Tag/DismissibleTag.js +8 -1
- package/es/components/Tag/OperationalTag.js +2 -0
- package/es/components/Tag/SelectableTag.js +2 -0
- package/es/components/Tag/Tag.js +4 -0
- package/es/components/Tag/isEllipsisActive.js +1 -0
- package/es/components/Text/Text.js +1 -0
- package/es/components/TextInput/ControlledPasswordInput.js +2 -4
- package/es/components/TextInput/PasswordInput.js +7 -2
- package/es/components/TextInput/TextInput.js +4 -2
- package/es/components/Theme/index.js +8 -3
- package/es/components/Tile/Tile.js +14 -17
- package/es/components/TimePicker/TimePicker.js +1 -0
- package/es/components/Toggle/Toggle.js +1 -1
- package/es/components/Toggletip/index.js +23 -8
- package/es/components/Tooltip/DefinitionTooltip.js +1 -0
- package/es/components/Tooltip/Tooltip.js +30 -23
- package/es/components/TreeView/TreeNode.d.ts +28 -0
- package/es/components/TreeView/TreeNode.js +19 -10
- package/es/components/TreeView/TreeView.js +7 -0
- package/es/components/UIShell/HeaderContainer.js +3 -1
- package/es/components/UIShell/HeaderGlobalAction.js +2 -2
- package/es/components/UIShell/HeaderMenu.js +3 -3
- package/es/components/UIShell/HeaderPanel.js +2 -2
- package/es/components/UIShell/Link.js +2 -0
- package/es/components/UIShell/SideNavItems.js +1 -0
- package/es/components/UIShell/SideNavMenu.js +2 -2
- package/es/components/UIShell/SideNavMenuItem.js +1 -1
- package/es/components/UIShell/SideNavSwitcher.js +1 -1
- package/es/components/UIShell/Switcher.js +2 -1
- package/es/components/UIShell/SwitcherItem.js +4 -2
- package/es/internal/FloatingMenu.js +7 -1
- package/es/internal/Selection.js +12 -3
- package/es/internal/useMergedRefs.js +1 -0
- package/es/internal/useNoInteractiveChildren.js +4 -0
- package/es/internal/useOutsideClick.js +1 -0
- package/es/internal/useOverflowItems.js +6 -0
- package/es/internal/useResizeObserver.js +4 -0
- package/es/internal/useSavedCallback.js +1 -0
- package/es/internal/warning.js +1 -0
- package/es/prop-types/isRequiredOneOf.js +4 -1
- package/es/tools/events.js +3 -1
- package/es/tools/wrapComponent.js +1 -0
- package/lib/components/AILabel/index.js +8 -6
- package/lib/components/Breadcrumb/BreadcrumbItem.js +2 -0
- package/lib/components/Button/Button.js +3 -0
- package/lib/components/ChatButton/ChatButton.js +1 -0
- package/lib/components/CheckboxGroup/CheckboxGroup.js +20 -1
- package/lib/components/ComboBox/ComboBox.js +17 -1
- package/lib/components/ComboButton/index.js +1 -0
- package/lib/components/ComposedModal/ComposedModal.js +18 -4
- package/lib/components/DataTable/DataTable.d.ts +3 -8
- package/lib/components/DataTable/DataTable.js +14 -0
- package/lib/components/DataTable/Table.js +3 -3
- package/lib/components/DataTable/TableExpandHeader.js +5 -1
- package/lib/components/DataTable/TableExpandRow.d.ts +33 -5
- package/lib/components/DataTable/TableExpandRow.js +5 -2
- package/lib/components/DataTable/TableHeader.d.ts +1 -2
- package/lib/components/DataTable/TableHeader.js +3 -2
- package/lib/components/DataTable/TableRow.d.ts +3 -6
- package/lib/components/DataTable/TableRow.js +39 -21
- package/lib/components/DataTable/TableSlugRow.js +1 -0
- package/lib/components/DataTable/TableToolbarMenu.js +3 -0
- package/lib/components/DataTable/state/sorting.d.ts +57 -14
- package/lib/components/DataTable/state/sorting.js +41 -50
- package/lib/components/DataTable/tools/sorting.js +5 -0
- package/lib/components/DatePicker/DatePicker.js +14 -3
- package/lib/components/DatePickerInput/DatePickerInput.js +6 -0
- package/lib/components/Dialog/Dialog.js +10 -2
- package/lib/components/Dropdown/Dropdown.js +16 -4
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +1 -0
- package/lib/components/FileUploader/FileUploader.js +9 -2
- package/lib/components/FileUploader/FileUploaderButton.js +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/lib/components/FileUploader/FileUploaderItem.js +3 -0
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +2 -0
- package/lib/components/FluidNumberInput/FluidNumberInput.js +3 -2
- package/lib/components/FluidSearch/FluidSearch.js +3 -2
- package/lib/components/FluidSelect/FluidSelect.js +3 -2
- package/lib/components/FluidTextInput/FluidTextInput.js +3 -2
- package/lib/components/FluidTimePicker/FluidTimePicker.js +11 -4
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +3 -2
- package/lib/components/Grid/CSSGrid.js +5 -0
- package/lib/components/Grid/Column.js +3 -0
- package/lib/components/Grid/ColumnHang.js +1 -0
- package/lib/components/Grid/FlexGrid.js +1 -0
- package/lib/components/Grid/Row.js +1 -0
- package/lib/components/Heading/index.js +3 -1
- package/lib/components/IconButton/index.js +4 -2
- package/lib/components/IconIndicator/index.js +4 -2
- package/lib/components/InlineCheckbox/InlineCheckbox.js +3 -2
- package/lib/components/Layout/index.js +6 -4
- package/lib/components/LayoutDirection/LayoutDirection.js +2 -0
- package/lib/components/Link/Link.js +3 -0
- package/lib/components/ListBox/ListBoxMenuItem.js +4 -1
- package/lib/components/ListBox/next/ListBoxTrigger.js +3 -2
- package/lib/components/Menu/Menu.js +6 -9
- package/lib/components/Menu/MenuContext.js +1 -0
- package/lib/components/Menu/MenuItem.js +5 -13
- package/lib/components/MenuButton/index.js +7 -2
- package/lib/components/Modal/Modal.js +15 -6
- package/lib/components/ModalWrapper/ModalWrapper.js +2 -0
- package/lib/components/MultiSelect/FilterableMultiSelect.js +24 -5
- package/lib/components/MultiSelect/MultiSelect.js +21 -5
- package/lib/components/Notification/Notification.js +1 -1
- package/lib/components/NumberInput/NumberInput.js +17 -6
- package/lib/components/OverflowMenu/OverflowMenu.js +2 -0
- package/lib/components/OverflowMenu/next/index.js +3 -2
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +2 -0
- package/lib/components/PageHeader/PageHeader.d.ts +3 -3
- package/lib/components/PageHeader/PageHeader.js +22 -8
- package/lib/components/Pagination/Pagination.js +6 -2
- package/lib/components/PaginationNav/PaginationNav.js +2 -5
- package/lib/components/Popover/index.js +20 -6
- package/lib/components/ProgressBar/ProgressBar.js +4 -2
- package/lib/components/RadioTile/RadioTile.js +2 -2
- package/lib/components/Search/Search.js +2 -2
- package/lib/components/Select/Select.js +2 -3
- package/lib/components/ShapeIndicator/index.js +4 -2
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.d.ts +4 -4
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +1 -2
- package/lib/components/SkeletonText/SkeletonText.js +0 -2
- package/lib/components/Slider/Slider.js +11 -16
- package/lib/components/Stack/HStack.js +1 -0
- package/lib/components/Stack/Stack.js +6 -9
- package/lib/components/Stack/VStack.js +1 -0
- package/lib/components/StructuredList/StructuredList.js +3 -0
- package/lib/components/Switch/Switch.js +1 -1
- package/lib/components/Tabs/Tabs.js +28 -17
- package/lib/components/Tag/DismissibleTag.d.ts +5 -0
- package/lib/components/Tag/DismissibleTag.js +8 -1
- package/lib/components/Tag/OperationalTag.js +2 -0
- package/lib/components/Tag/SelectableTag.js +2 -0
- package/lib/components/Tag/Tag.js +4 -0
- package/lib/components/Tag/isEllipsisActive.js +1 -0
- package/lib/components/Text/Text.js +1 -0
- package/lib/components/TextInput/ControlledPasswordInput.js +2 -4
- package/lib/components/TextInput/PasswordInput.js +7 -2
- package/lib/components/TextInput/TextInput.js +4 -2
- package/lib/components/Theme/index.js +8 -3
- package/lib/components/Tile/Tile.js +14 -17
- package/lib/components/TimePicker/TimePicker.js +1 -0
- package/lib/components/Toggle/Toggle.js +1 -1
- package/lib/components/Toggletip/index.js +22 -7
- package/lib/components/Tooltip/DefinitionTooltip.js +1 -0
- package/lib/components/Tooltip/Tooltip.js +30 -23
- package/lib/components/TreeView/TreeNode.d.ts +28 -0
- package/lib/components/TreeView/TreeNode.js +19 -10
- package/lib/components/TreeView/TreeView.js +7 -0
- package/lib/components/UIShell/HeaderContainer.js +3 -1
- package/lib/components/UIShell/HeaderGlobalAction.js +2 -2
- package/lib/components/UIShell/HeaderMenu.js +3 -3
- package/lib/components/UIShell/HeaderPanel.js +2 -2
- package/lib/components/UIShell/Link.js +2 -0
- package/lib/components/UIShell/SideNavItems.js +1 -0
- package/lib/components/UIShell/SideNavMenu.js +2 -2
- package/lib/components/UIShell/SideNavMenuItem.js +1 -1
- package/lib/components/UIShell/SideNavSwitcher.js +1 -1
- package/lib/components/UIShell/Switcher.js +2 -1
- package/lib/components/UIShell/SwitcherItem.js +4 -2
- package/lib/internal/FloatingMenu.js +7 -1
- package/lib/internal/Selection.js +12 -3
- package/lib/internal/useMergedRefs.js +1 -0
- package/lib/internal/useNoInteractiveChildren.js +4 -0
- package/lib/internal/useOutsideClick.js +1 -0
- package/lib/internal/useOverflowItems.js +6 -0
- package/lib/internal/useResizeObserver.js +4 -0
- package/lib/internal/useSavedCallback.js +1 -0
- package/lib/internal/warning.js +1 -0
- package/lib/prop-types/isRequiredOneOf.js +4 -1
- package/lib/tools/events.js +3 -1
- package/lib/tools/wrapComponent.js +1 -0
- package/package.json +11 -11
- package/telemetry.yml +14 -0
|
@@ -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,
|
|
@@ -1,15 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 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 DataTableSortState } from './sortStates';
|
|
8
|
+
import type { DataTableCell } from '../DataTable';
|
|
9
|
+
export interface SortRowParams {
|
|
10
|
+
key: string;
|
|
11
|
+
sortDirection: DataTableSortState;
|
|
12
|
+
sortStates: Record<DataTableSortState, DataTableSortState>;
|
|
8
13
|
locale: string;
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
compare: (a: string | number, b: string | number, locale?: string) => number;
|
|
15
|
+
}
|
|
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;
|
|
19
|
+
interface Props {
|
|
20
|
+
locale?: string;
|
|
21
|
+
sortRow?: SortRowFn;
|
|
22
|
+
}
|
|
23
|
+
interface State<ColTypes extends any[]> {
|
|
24
|
+
rowIds: string[];
|
|
25
|
+
cellsById: Record<string, DataTableCell<ColTypes[number]>>;
|
|
26
|
+
initialRowOrder: string[];
|
|
27
|
+
sortHeaderKey: string | null;
|
|
28
|
+
sortDirection: DataTableSortState;
|
|
29
|
+
}
|
|
30
|
+
export declare const initialSortState: DataTableSortState;
|
|
31
|
+
/**
|
|
32
|
+
* Gets the next sort direction for a header.
|
|
33
|
+
*
|
|
34
|
+
* @param prevHeader - Key of the previously sorted header.
|
|
35
|
+
* @param currentHeader - Key of the currently selected header.
|
|
36
|
+
* @param prevState - Previous sort direction.
|
|
37
|
+
*/
|
|
38
|
+
export declare const getNextSortDirection: (prevHeader: string, currentHeader: string, prevState: DataTableSortState) => DataTableSortState;
|
|
39
|
+
/**
|
|
40
|
+
* Gets the next sort state.
|
|
41
|
+
*
|
|
42
|
+
* @param props - Component props.
|
|
43
|
+
* @param state - Current table state.
|
|
44
|
+
* @param key - Header key to sort by.
|
|
45
|
+
*/
|
|
46
|
+
export declare const getNextSortState: <ColTypes extends any[]>(props: Props, state: State<ColTypes>, { key }: {
|
|
47
|
+
key: string;
|
|
48
|
+
}) => Pick<State<ColTypes>, "sortHeaderKey" | "sortDirection" | "rowIds">;
|
|
49
|
+
/**
|
|
50
|
+
* Gets a sort state update.
|
|
51
|
+
*
|
|
52
|
+
* @param props - Component props.
|
|
53
|
+
* @param state - Current state of the table.
|
|
54
|
+
* @param key - Header key to sort by.
|
|
55
|
+
* @param sortDirection - Sort direction to apply.
|
|
56
|
+
*/
|
|
57
|
+
export declare const getSortedState: <ColTypes extends any[]>({ locale, sortRow }: Props, { rowIds, cellsById, initialRowOrder }: State<ColTypes>, key: string, sortDirection: DataTableSortState) => Pick<State<ColTypes>, "rowIds" | "sortDirection" | "sortHeaderKey">;
|
|
58
|
+
export {};
|
|
@@ -8,37 +8,41 @@
|
|
|
8
8
|
import { sortStates } from './sortStates.js';
|
|
9
9
|
import { sortRows } from '../tools/sorting.js';
|
|
10
10
|
|
|
11
|
-
//
|
|
12
|
-
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
12
|
+
|
|
13
13
|
const initialSortState = sortStates.NONE;
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
* information:
|
|
16
|
+
* Gets the next sort direction for a header.
|
|
18
17
|
*
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
22
|
-
* @returns {string}
|
|
18
|
+
* @param prevHeader - Key of the previously sorted header.
|
|
19
|
+
* @param currentHeader - Key of the currently selected header.
|
|
20
|
+
* @param prevState - Previous sort direction.
|
|
23
21
|
*/
|
|
24
|
-
const getNextSortDirection = (prevHeader,
|
|
25
|
-
//
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return sortStates.DESC;
|
|
22
|
+
const getNextSortDirection = (prevHeader, currentHeader, prevState) => {
|
|
23
|
+
// Cycle for sorting the same header: NONE -> ASC -> DESC -> NONE.
|
|
24
|
+
if (prevHeader === currentHeader) {
|
|
25
|
+
switch (prevState) {
|
|
26
|
+
case sortStates.NONE:
|
|
27
|
+
return sortStates.ASC;
|
|
28
|
+
case sortStates.ASC:
|
|
29
|
+
return sortStates.DESC;
|
|
30
|
+
case sortStates.DESC:
|
|
31
|
+
return sortStates.NONE;
|
|
35
32
|
}
|
|
36
|
-
return sortStates.NONE;
|
|
37
33
|
}
|
|
38
|
-
|
|
39
|
-
//
|
|
34
|
+
|
|
35
|
+
// Sorting a new header starts at ascending order.
|
|
40
36
|
return sortStates.ASC;
|
|
41
37
|
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Gets the next sort state.
|
|
41
|
+
*
|
|
42
|
+
* @param props - Component props.
|
|
43
|
+
* @param state - Current table state.
|
|
44
|
+
* @param key - Header key to sort by.
|
|
45
|
+
*/
|
|
42
46
|
const getNextSortState = (props, state, {
|
|
43
47
|
key
|
|
44
48
|
}) => {
|
|
@@ -46,38 +50,26 @@ const getNextSortState = (props, state, {
|
|
|
46
50
|
sortDirection,
|
|
47
51
|
sortHeaderKey
|
|
48
52
|
} = state;
|
|
49
|
-
const nextSortDirection = getNextSortDirection(key, sortHeaderKey, sortDirection);
|
|
53
|
+
const nextSortDirection = getNextSortDirection(key, sortHeaderKey ?? '', sortDirection);
|
|
50
54
|
return getSortedState(props, state, key, nextSortDirection);
|
|
51
55
|
};
|
|
52
56
|
|
|
53
57
|
/**
|
|
54
|
-
*
|
|
55
|
-
* header key and sortDirection
|
|
58
|
+
* Gets a sort state update.
|
|
56
59
|
*
|
|
57
|
-
* @param
|
|
58
|
-
* @param
|
|
59
|
-
* @param
|
|
60
|
-
*
|
|
61
|
-
* @param {object} state
|
|
62
|
-
* @param {Array<string>} state.rowIds Array of row ids
|
|
63
|
-
* @param {object} state.cellsById Lookup object for cells by id
|
|
64
|
-
* @param {Array<string>} state.initialRowOrder Initial row order for the
|
|
65
|
-
* current set of rows
|
|
66
|
-
* @param {string} key The key for the given header we are serving the
|
|
67
|
-
* sorted state for
|
|
68
|
-
* @param {string} sortDirection The sortState that we want to order by
|
|
69
|
-
* @returns {object}
|
|
60
|
+
* @param props - Component props.
|
|
61
|
+
* @param state - Current state of the table.
|
|
62
|
+
* @param key - Header key to sort by.
|
|
63
|
+
* @param sortDirection - Sort direction to apply.
|
|
70
64
|
*/
|
|
71
|
-
const getSortedState = (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
sortRow
|
|
80
|
-
} = props;
|
|
65
|
+
const getSortedState = ({
|
|
66
|
+
locale,
|
|
67
|
+
sortRow
|
|
68
|
+
}, {
|
|
69
|
+
rowIds,
|
|
70
|
+
cellsById,
|
|
71
|
+
initialRowOrder
|
|
72
|
+
}, key, sortDirection) => {
|
|
81
73
|
const nextRowIds = sortDirection !== sortStates.NONE ? sortRows({
|
|
82
74
|
rowIds,
|
|
83
75
|
cellsById,
|
|
@@ -88,9 +80,9 @@ const getSortedState = (props, state, key, sortDirection) => {
|
|
|
88
80
|
}) : initialRowOrder;
|
|
89
81
|
return {
|
|
90
82
|
sortHeaderKey: key,
|
|
91
|
-
sortDirection
|
|
83
|
+
sortDirection,
|
|
92
84
|
rowIds: nextRowIds
|
|
93
85
|
};
|
|
94
86
|
};
|
|
95
87
|
|
|
96
|
-
export { getNextSortDirection, getNextSortState, getSortedState, initialSortState
|
|
88
|
+
export { getNextSortDirection, getNextSortState, getSortedState, initialSortState };
|
|
@@ -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 = '';
|
|
@@ -42,6 +43,10 @@ const compareStrings = (a, b, locale = 'en') => {
|
|
|
42
43
|
numeric: isNumeric
|
|
43
44
|
});
|
|
44
45
|
};
|
|
46
|
+
|
|
47
|
+
// TODO: Should `SortRowParams` in
|
|
48
|
+
// packages/react/src/components/DataTable/state/sorting.ts be used here?
|
|
49
|
+
|
|
45
50
|
/**
|
|
46
51
|
* Sorts table rows based on the provided column key and direction.
|
|
47
52
|
*/
|
|
@@ -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, {
|
|
@@ -149,6 +149,7 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
|
|
|
149
149
|
}
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
152
153
|
}, [floatingStyles, autoAlign, refs.floating]);
|
|
153
154
|
const prefix = usePrefix();
|
|
154
155
|
const {
|
|
@@ -163,6 +164,8 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
|
|
|
163
164
|
});
|
|
164
165
|
}
|
|
165
166
|
}, [onChange]);
|
|
167
|
+
|
|
168
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
166
169
|
const isItemDisabled = useCallback((item, _index) => {
|
|
167
170
|
const isObject = item !== null && typeof item === 'object';
|
|
168
171
|
return isObject && 'disabled' in item && item.disabled === true;
|
|
@@ -171,7 +174,9 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
|
|
|
171
174
|
const {
|
|
172
175
|
highlightedIndex
|
|
173
176
|
} = changes;
|
|
174
|
-
if (highlightedIndex !== undefined && highlightedIndex > -1 &&
|
|
177
|
+
if (highlightedIndex !== undefined && highlightedIndex > -1 &&
|
|
178
|
+
// eslint-disable-next-line valid-typeof , no-constant-binary-expression -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
179
|
+
typeof window !== undefined) {
|
|
175
180
|
const itemArray = document.querySelectorAll(`li.${prefix}--list-box__menu-item[role="option"]`);
|
|
176
181
|
const highlightedItem = itemArray[highlightedIndex];
|
|
177
182
|
if (highlightedItem) {
|
|
@@ -192,7 +197,9 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
|
|
|
192
197
|
isItemDisabled,
|
|
193
198
|
onHighlightedIndexChange,
|
|
194
199
|
...downshiftProps
|
|
195
|
-
}),
|
|
200
|
+
}),
|
|
201
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
202
|
+
[items, itemToString, initialSelectedItem, onSelectedItemChange, stateReducer, isItemDisabled, onHighlightedIndexChange, downshiftProps]);
|
|
196
203
|
const dropdownInstanceId = useId();
|
|
197
204
|
|
|
198
205
|
// only set selectedItem if the prop is defined. Setting if it is undefined
|
|
@@ -281,7 +288,9 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
|
|
|
281
288
|
if (toggleButtonProps.onKeyDown && (evt.key !== 'ArrowUp' || isOpen && evt.key === 'ArrowUp')) {
|
|
282
289
|
toggleButtonProps.onKeyDown(evt);
|
|
283
290
|
}
|
|
284
|
-
},
|
|
291
|
+
},
|
|
292
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
293
|
+
[isTyping, currTimer, toggleButtonProps]);
|
|
285
294
|
const readOnlyEventHandlers = useMemo(() => {
|
|
286
295
|
if (readOnly) {
|
|
287
296
|
return {
|
|
@@ -304,6 +313,7 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
|
|
|
304
313
|
onKeyDown: onKeyDownHandler
|
|
305
314
|
};
|
|
306
315
|
}
|
|
316
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
307
317
|
}, [readOnly, onKeyDownHandler]);
|
|
308
318
|
const menuProps = useMemo(() => getMenuProps({
|
|
309
319
|
ref: enableFloatingStyles || autoAlign ? refs.setFloating : null
|
|
@@ -354,7 +364,9 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
|
|
|
354
364
|
ref: mergedRef
|
|
355
365
|
}), /*#__PURE__*/React.createElement("span", {
|
|
356
366
|
className: `${prefix}--list-box__label`
|
|
357
|
-
}, selectedItem ? renderSelectedItem ? renderSelectedItem(selectedItem) : itemToString(selectedItem) :
|
|
367
|
+
}, selectedItem ? renderSelectedItem ? renderSelectedItem(selectedItem) : itemToString(selectedItem) :
|
|
368
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
369
|
+
label), /*#__PURE__*/React.createElement(ListBox.MenuIcon, {
|
|
358
370
|
isOpen: isOpen,
|
|
359
371
|
translateWithId: translateWithId
|
|
360
372
|
})), 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
|
});
|
|
@@ -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
|