@carbon/react 1.92.1 → 1.93.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 +874 -838
- package/es/components/AILabel/index.js +4 -4
- package/es/components/Breadcrumb/BreadcrumbItem.js +1 -1
- package/es/components/Button/Button.js +2 -2
- package/es/components/ChatButton/ChatButton.js +1 -1
- package/es/components/Checkbox/Checkbox.js +1 -1
- package/es/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/es/components/CodeSnippet/CodeSnippet.js +9 -50
- package/es/components/ComboBox/ComboBox.d.ts +3 -11
- package/es/components/ComboBox/ComboBox.js +15 -25
- package/es/components/ComboButton/index.d.ts +5 -8
- package/es/components/ComboButton/index.js +9 -12
- package/es/components/ComposedModal/ComposedModal.js +19 -25
- package/es/components/DataTable/DataTable.d.ts +27 -16
- package/es/components/DataTable/DataTable.js +40 -39
- package/es/components/DataTable/Table.js +2 -2
- package/es/components/DataTable/TableBatchActions.d.ts +49 -10
- package/es/components/DataTable/TableBatchActions.js +26 -21
- package/es/components/DataTable/TableExpandHeader.js +2 -2
- package/es/components/DataTable/TableExpandRow.d.ts +4 -0
- package/es/components/DataTable/TableExpandRow.js +1 -1
- package/es/components/DataTable/TableHeader.d.ts +8 -10
- package/es/components/DataTable/TableHeader.js +11 -13
- package/es/components/DataTable/TableRow.js +7 -5
- package/es/components/DataTable/TableSlugRow.js +1 -1
- package/es/components/DataTable/TableToolbarMenu.js +1 -1
- package/es/components/DataTable/TableToolbarSearch.d.ts +8 -7
- package/es/components/DataTable/TableToolbarSearch.js +11 -11
- package/es/components/DataTable/index.d.ts +2 -2
- package/es/components/DataTable/state/sorting.d.ts +2 -2
- package/es/components/DataTable/state/sorting.js +1 -1
- package/es/components/DataTable/tools/sorting.js +1 -1
- package/es/components/DatePicker/DatePicker.js +9 -9
- package/es/components/DatePickerInput/DatePickerInput.js +5 -5
- package/es/components/Dialog/Dialog.js +6 -6
- package/es/components/Dropdown/Dropdown.d.ts +1 -1
- package/es/components/Dropdown/Dropdown.js +8 -8
- package/es/components/ErrorBoundary/ErrorBoundaryContext.js +1 -1
- package/es/components/FileUploader/FileUploader.js +4 -4
- package/es/components/FileUploader/FileUploaderButton.js +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/es/components/FileUploader/FileUploaderItem.js +2 -2
- package/es/components/FluidComboBox/FluidComboBox.d.ts +4 -7
- package/es/components/FluidComboBox/FluidComboBox.js +1 -1
- package/es/components/FluidDropdown/FluidDropdown.d.ts +4 -8
- package/es/components/FluidDropdown/FluidDropdown.js +1 -1
- package/es/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +3 -7
- package/es/components/FluidMultiSelect/FluidMultiSelect.d.ts +3 -7
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +3 -3
- package/es/components/FluidNumberInput/FluidNumberInput.d.ts +4 -7
- package/es/components/FluidNumberInput/FluidNumberInput.js +2 -2
- package/es/components/FluidSearch/FluidSearch.js +1 -1
- package/es/components/FluidSelect/FluidSelect.js +1 -1
- package/es/components/FluidTextInput/FluidTextInput.js +1 -1
- package/es/components/FluidTimePicker/FluidTimePicker.js +3 -3
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +1 -1
- package/es/components/Grid/CSSGrid.js +3 -3
- package/es/components/Grid/Column.js +2 -2
- package/es/components/Grid/ColumnHang.js +1 -1
- package/es/components/Grid/FlexGrid.js +1 -1
- package/es/components/Grid/Row.js +1 -1
- package/es/components/Heading/index.js +2 -2
- package/es/components/IconButton/index.js +2 -2
- package/es/components/IconIndicator/index.js +2 -2
- package/es/components/InlineCheckbox/InlineCheckbox.js +1 -1
- package/es/components/Layout/index.js +2 -2
- package/es/components/LayoutDirection/LayoutDirection.js +1 -1
- package/es/components/Link/Link.js +2 -2
- package/es/components/ListBox/ListBoxField.d.ts +0 -1
- package/es/components/ListBox/ListBoxMenuIcon.d.ts +8 -4
- package/es/components/ListBox/ListBoxMenuIcon.js +10 -6
- package/es/components/ListBox/ListBoxMenuItem.js +2 -2
- package/es/components/ListBox/ListBoxSelection.d.ts +3 -6
- package/es/components/ListBox/ListBoxSelection.js +5 -10
- package/es/components/ListBox/index.d.ts +5 -3
- package/es/components/ListBox/next/ListBoxSelection.d.ts +6 -13
- package/es/components/ListBox/next/ListBoxSelection.js +16 -8
- package/es/components/ListBox/next/ListBoxTrigger.d.ts +5 -10
- package/es/components/ListBox/next/ListBoxTrigger.js +6 -6
- package/es/components/Menu/MenuContext.js +1 -1
- package/es/components/Menu/MenuItem.js +1 -1
- package/es/components/MenuButton/index.js +5 -5
- package/es/components/Modal/Modal.js +17 -23
- package/es/components/ModalWrapper/ModalWrapper.js +2 -2
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +3 -12
- package/es/components/MultiSelect/FilterableMultiSelect.js +18 -27
- package/es/components/MultiSelect/MultiSelect.d.ts +2 -2
- package/es/components/MultiSelect/MultiSelect.js +12 -12
- package/es/components/Notification/Notification.js +1 -1
- package/es/components/NumberInput/NumberInput.d.ts +2 -5
- package/es/components/NumberInput/NumberInput.js +13 -18
- package/es/components/OverflowMenu/OverflowMenu.d.ts +2 -2
- package/es/components/OverflowMenu/OverflowMenu.js +4 -4
- package/es/components/OverflowMenu/next/index.d.ts +1 -1
- package/es/components/OverflowMenu/next/index.js +2 -2
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
- package/es/components/PageHeader/PageHeader.js +12 -12
- package/es/components/Pagination/Pagination.js +3 -3
- package/es/components/PaginationNav/PaginationNav.d.ts +6 -9
- package/es/components/PaginationNav/PaginationNav.js +21 -22
- package/es/components/Popover/index.js +10 -9
- package/es/components/ProgressBar/ProgressBar.js +2 -2
- package/es/components/ProgressIndicator/ProgressIndicator.d.ts +11 -15
- package/es/components/ProgressIndicator/ProgressIndicator.js +15 -15
- package/es/components/RadioButton/RadioButton.js +1 -1
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/es/components/RadioTile/RadioTile.js +1 -1
- package/es/components/Select/Select.js +7 -5
- package/es/components/ShapeIndicator/index.js +2 -2
- package/es/components/Slider/Slider.d.ts +7 -9
- package/es/components/Slider/Slider.js +16 -20
- package/es/components/Stack/HStack.js +1 -1
- package/es/components/Stack/Stack.js +1 -1
- package/es/components/Stack/VStack.js +1 -1
- package/es/components/StructuredList/StructuredList.js +3 -3
- package/es/components/Tabs/Tabs.js +12 -12
- package/es/components/Tag/DismissibleTag.js +3 -3
- package/es/components/Tag/OperationalTag.js +2 -2
- package/es/components/Tag/SelectableTag.js +2 -2
- package/es/components/Tag/Tag.js +4 -4
- package/es/components/Tag/isEllipsisActive.js +1 -1
- package/es/components/Text/Text.js +1 -1
- package/es/components/TextArea/TextArea.js +1 -1
- package/es/components/TextInput/PasswordInput.js +4 -4
- package/es/components/TextInput/TextInput.js +3 -3
- package/es/components/Theme/index.js +3 -3
- package/es/components/Tile/Tile.js +3 -3
- package/es/components/TimePicker/TimePicker.js +1 -1
- package/es/components/Toggletip/index.js +4 -4
- package/es/components/Tooltip/DefinitionTooltip.js +1 -1
- package/es/components/Tooltip/Tooltip.js +3 -3
- package/es/components/TreeView/TreeNode.js +6 -6
- package/es/components/TreeView/TreeView.js +5 -5
- package/es/components/UIShell/HeaderContainer.js +1 -1
- package/es/components/UIShell/HeaderMenu.js +1 -1
- package/es/components/UIShell/Link.js +2 -2
- package/es/components/UIShell/SideNavItems.js +1 -1
- package/es/components/UIShell/Switcher.js +1 -1
- package/es/components/UIShell/SwitcherItem.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/internal/FloatingMenu.js +4 -4
- package/es/internal/Selection.js +6 -6
- package/es/internal/useMergedRefs.js +1 -1
- package/es/internal/useNoInteractiveChildren.js +4 -4
- package/es/internal/useOutsideClick.js +1 -1
- package/es/internal/useOverflowItems.js +6 -6
- package/es/internal/useResizeObserver.js +3 -3
- package/es/internal/useSavedCallback.js +1 -1
- package/es/internal/warning.js +1 -1
- package/es/prop-types/isRequiredOneOf.js +2 -2
- package/es/tools/events.js +1 -1
- package/es/tools/wrapComponent.js +1 -1
- package/es/types/common.d.ts +6 -2
- package/lib/components/AILabel/index.js +4 -4
- package/lib/components/Breadcrumb/BreadcrumbItem.js +1 -1
- package/lib/components/Button/Button.js +2 -2
- package/lib/components/ChatButton/ChatButton.js +1 -1
- package/lib/components/Checkbox/Checkbox.js +1 -1
- package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/lib/components/CodeSnippet/CodeSnippet.js +8 -49
- package/lib/components/ComboBox/ComboBox.d.ts +3 -11
- package/lib/components/ComboBox/ComboBox.js +15 -25
- package/lib/components/ComboButton/index.d.ts +5 -8
- package/lib/components/ComboButton/index.js +9 -12
- package/lib/components/ComposedModal/ComposedModal.js +18 -24
- package/lib/components/DataTable/DataTable.d.ts +27 -16
- package/lib/components/DataTable/DataTable.js +40 -39
- package/lib/components/DataTable/Table.js +2 -2
- package/lib/components/DataTable/TableBatchActions.d.ts +49 -10
- package/lib/components/DataTable/TableBatchActions.js +26 -21
- package/lib/components/DataTable/TableExpandHeader.js +2 -2
- package/lib/components/DataTable/TableExpandRow.d.ts +4 -0
- package/lib/components/DataTable/TableExpandRow.js +1 -1
- package/lib/components/DataTable/TableHeader.d.ts +8 -10
- package/lib/components/DataTable/TableHeader.js +11 -13
- package/lib/components/DataTable/TableRow.js +7 -5
- package/lib/components/DataTable/TableSlugRow.js +1 -1
- package/lib/components/DataTable/TableToolbarMenu.js +1 -1
- package/lib/components/DataTable/TableToolbarSearch.d.ts +8 -7
- package/lib/components/DataTable/TableToolbarSearch.js +11 -11
- package/lib/components/DataTable/index.d.ts +2 -2
- package/lib/components/DataTable/state/sorting.d.ts +2 -2
- package/lib/components/DataTable/state/sorting.js +1 -1
- package/lib/components/DataTable/tools/sorting.js +1 -1
- package/lib/components/DatePicker/DatePicker.js +9 -9
- package/lib/components/DatePickerInput/DatePickerInput.js +5 -5
- package/lib/components/Dialog/Dialog.js +6 -6
- package/lib/components/Dropdown/Dropdown.d.ts +1 -1
- package/lib/components/Dropdown/Dropdown.js +8 -8
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +1 -1
- package/lib/components/FileUploader/FileUploader.js +4 -4
- package/lib/components/FileUploader/FileUploaderButton.js +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/lib/components/FileUploader/FileUploaderItem.js +2 -2
- package/lib/components/FluidComboBox/FluidComboBox.d.ts +4 -7
- package/lib/components/FluidComboBox/FluidComboBox.js +1 -1
- package/lib/components/FluidDropdown/FluidDropdown.d.ts +4 -8
- package/lib/components/FluidDropdown/FluidDropdown.js +1 -1
- package/lib/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +3 -7
- package/lib/components/FluidMultiSelect/FluidMultiSelect.d.ts +3 -7
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +3 -3
- package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +4 -7
- package/lib/components/FluidNumberInput/FluidNumberInput.js +2 -2
- package/lib/components/FluidSearch/FluidSearch.js +1 -1
- package/lib/components/FluidSelect/FluidSelect.js +1 -1
- package/lib/components/FluidTextInput/FluidTextInput.js +1 -1
- package/lib/components/FluidTimePicker/FluidTimePicker.js +3 -3
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +1 -1
- package/lib/components/Grid/CSSGrid.js +3 -3
- package/lib/components/Grid/Column.js +2 -2
- package/lib/components/Grid/ColumnHang.js +1 -1
- package/lib/components/Grid/FlexGrid.js +1 -1
- package/lib/components/Grid/Row.js +1 -1
- package/lib/components/Heading/index.js +2 -2
- package/lib/components/IconButton/index.js +2 -2
- package/lib/components/IconIndicator/index.js +2 -2
- package/lib/components/InlineCheckbox/InlineCheckbox.js +1 -1
- package/lib/components/Layout/index.js +2 -2
- package/lib/components/LayoutDirection/LayoutDirection.js +1 -1
- package/lib/components/Link/Link.js +2 -2
- package/lib/components/ListBox/ListBoxField.d.ts +0 -1
- package/lib/components/ListBox/ListBoxMenuIcon.d.ts +8 -4
- package/lib/components/ListBox/ListBoxMenuIcon.js +10 -6
- package/lib/components/ListBox/ListBoxMenuItem.js +2 -2
- package/lib/components/ListBox/ListBoxSelection.d.ts +3 -6
- package/lib/components/ListBox/ListBoxSelection.js +4 -10
- package/lib/components/ListBox/index.d.ts +5 -3
- package/lib/components/ListBox/next/ListBoxSelection.d.ts +6 -13
- package/lib/components/ListBox/next/ListBoxSelection.js +16 -8
- package/lib/components/ListBox/next/ListBoxTrigger.d.ts +5 -10
- package/lib/components/ListBox/next/ListBoxTrigger.js +5 -6
- package/lib/components/Menu/MenuContext.js +1 -1
- package/lib/components/Menu/MenuItem.js +1 -1
- package/lib/components/MenuButton/index.js +5 -5
- package/lib/components/Modal/Modal.js +16 -22
- package/lib/components/ModalWrapper/ModalWrapper.js +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +3 -12
- package/lib/components/MultiSelect/FilterableMultiSelect.js +18 -27
- package/lib/components/MultiSelect/MultiSelect.d.ts +2 -2
- package/lib/components/MultiSelect/MultiSelect.js +12 -12
- package/lib/components/Notification/Notification.js +1 -1
- package/lib/components/NumberInput/NumberInput.d.ts +2 -5
- package/lib/components/NumberInput/NumberInput.js +12 -18
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +2 -2
- package/lib/components/OverflowMenu/OverflowMenu.js +4 -4
- package/lib/components/OverflowMenu/next/index.d.ts +1 -1
- package/lib/components/OverflowMenu/next/index.js +2 -2
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
- package/lib/components/PageHeader/PageHeader.js +12 -12
- package/lib/components/Pagination/Pagination.js +3 -3
- package/lib/components/PaginationNav/PaginationNav.d.ts +6 -9
- package/lib/components/PaginationNav/PaginationNav.js +21 -22
- package/lib/components/Popover/index.js +10 -9
- package/lib/components/ProgressBar/ProgressBar.js +2 -2
- package/lib/components/ProgressIndicator/ProgressIndicator.d.ts +11 -15
- package/lib/components/ProgressIndicator/ProgressIndicator.js +15 -15
- package/lib/components/RadioButton/RadioButton.js +1 -1
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/lib/components/RadioTile/RadioTile.js +1 -1
- package/lib/components/Select/Select.js +7 -5
- package/lib/components/ShapeIndicator/index.js +2 -2
- package/lib/components/Slider/Slider.d.ts +7 -9
- package/lib/components/Slider/Slider.js +16 -20
- package/lib/components/Stack/HStack.js +1 -1
- package/lib/components/Stack/Stack.js +1 -1
- package/lib/components/Stack/VStack.js +1 -1
- package/lib/components/StructuredList/StructuredList.js +3 -3
- package/lib/components/Tabs/Tabs.js +12 -12
- package/lib/components/Tag/DismissibleTag.js +3 -3
- package/lib/components/Tag/OperationalTag.js +2 -2
- package/lib/components/Tag/SelectableTag.js +2 -2
- package/lib/components/Tag/Tag.js +4 -4
- package/lib/components/Tag/isEllipsisActive.js +1 -1
- package/lib/components/Text/Text.js +1 -1
- package/lib/components/TextArea/TextArea.js +1 -1
- package/lib/components/TextInput/PasswordInput.js +4 -4
- package/lib/components/TextInput/TextInput.js +3 -3
- package/lib/components/Theme/index.js +3 -3
- package/lib/components/Tile/Tile.js +3 -3
- package/lib/components/TimePicker/TimePicker.js +1 -1
- package/lib/components/Toggletip/index.js +4 -4
- package/lib/components/Tooltip/DefinitionTooltip.js +1 -1
- package/lib/components/Tooltip/Tooltip.js +3 -3
- package/lib/components/TreeView/TreeNode.js +6 -6
- package/lib/components/TreeView/TreeView.js +5 -5
- package/lib/components/UIShell/HeaderContainer.js +1 -1
- package/lib/components/UIShell/HeaderMenu.js +1 -1
- package/lib/components/UIShell/Link.js +2 -2
- package/lib/components/UIShell/SideNavItems.js +1 -1
- package/lib/components/UIShell/Switcher.js +1 -1
- package/lib/components/UIShell/SwitcherItem.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/internal/FloatingMenu.js +4 -4
- package/lib/internal/Selection.js +6 -6
- package/lib/internal/useMergedRefs.js +1 -1
- package/lib/internal/useNoInteractiveChildren.js +4 -4
- package/lib/internal/useOutsideClick.js +1 -1
- package/lib/internal/useOverflowItems.js +6 -6
- package/lib/internal/useResizeObserver.js +3 -3
- package/lib/internal/useSavedCallback.js +1 -1
- package/lib/internal/warning.js +1 -1
- package/lib/prop-types/isRequiredOneOf.js +2 -2
- package/lib/tools/events.js +1 -1
- package/lib/tools/wrapComponent.js +1 -1
- package/lib/types/common.d.ts +6 -2
- package/package.json +9 -9
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
7
8
|
import React, { type MouseEventHandler } from 'react';
|
|
8
9
|
import type { TranslateWithId } from '../../types/common';
|
|
9
|
-
declare const
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
declare const translationIds: {
|
|
11
|
+
readonly 'carbon.table.batch.cancel': "carbon.table.batch.cancel";
|
|
12
|
+
readonly 'carbon.table.batch.items.selected': "carbon.table.batch.items.selected";
|
|
13
|
+
readonly 'carbon.table.batch.item.selected': "carbon.table.batch.item.selected";
|
|
14
|
+
readonly 'carbon.table.batch.selectAll': "carbon.table.batch.selectAll";
|
|
15
|
+
};
|
|
16
|
+
type TranslationKey = keyof typeof translationIds;
|
|
17
|
+
export type TableBatchActionsTranslationArgs = {
|
|
12
18
|
totalSelected?: number;
|
|
13
19
|
totalCount?: number;
|
|
14
|
-
}
|
|
15
|
-
export interface TableBatchActionsProps extends React.HTMLAttributes<HTMLDivElement>, TranslateWithId<
|
|
20
|
+
};
|
|
21
|
+
export interface TableBatchActionsProps extends React.HTMLAttributes<HTMLDivElement>, TranslateWithId<TranslationKey, TableBatchActionsTranslationArgs> {
|
|
16
22
|
/**
|
|
17
23
|
* Provide elements to be rendered inside of the component.
|
|
18
24
|
*/
|
|
@@ -44,8 +50,41 @@ export interface TableBatchActionsProps extends React.HTMLAttributes<HTMLDivElem
|
|
|
44
50
|
*/
|
|
45
51
|
totalCount?: number;
|
|
46
52
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
declare const TableBatchActions: {
|
|
54
|
+
({ className, children, shouldShowBatchActions, totalSelected, totalCount, onCancel, onSelectAll, translateWithId: t, ...rest }: TableBatchActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
55
|
+
propTypes: {
|
|
56
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
57
|
+
className: PropTypes.Requireable<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Hook required to listen for when the user initiates a cancel request
|
|
60
|
+
* through this component
|
|
61
|
+
*/
|
|
62
|
+
onCancel: PropTypes.Validator<(...args: any[]) => any>;
|
|
63
|
+
/**
|
|
64
|
+
* Hook to listen for when the user initiates a select all
|
|
65
|
+
* request through this component. This _only_ controls the rendering
|
|
66
|
+
* of the `Select All` button and does not include built in functionality
|
|
67
|
+
*/
|
|
68
|
+
onSelectAll: PropTypes.Requireable<(...args: any[]) => any>;
|
|
69
|
+
/**
|
|
70
|
+
* Boolean specifier for whether or not the batch action bar should be
|
|
71
|
+
* displayed
|
|
72
|
+
*/
|
|
73
|
+
shouldShowBatchActions: PropTypes.Requireable<boolean>;
|
|
74
|
+
/**
|
|
75
|
+
* Numeric representation of the total number of items in a table.
|
|
76
|
+
* This number is used in the select all button text
|
|
77
|
+
*/
|
|
78
|
+
totalCount: PropTypes.Requireable<number>;
|
|
79
|
+
/**
|
|
80
|
+
* Numeric representation of the total number of items selected in a table.
|
|
81
|
+
* This number is used to derive the selection message
|
|
82
|
+
*/
|
|
83
|
+
totalSelected: PropTypes.Validator<number>;
|
|
84
|
+
/**
|
|
85
|
+
* Translates component strings using your i18n tool.
|
|
86
|
+
*/
|
|
87
|
+
translateWithId: PropTypes.Requireable<(...args: any[]) => any>;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
51
90
|
export default TableBatchActions;
|
|
@@ -20,27 +20,35 @@ var Text = require('../Text/Text.js');
|
|
|
20
20
|
require('../Text/TextDirection.js');
|
|
21
21
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
22
22
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
'carbon.table.batch.
|
|
26
|
-
'carbon.table.batch.
|
|
27
|
-
'carbon.table.batch.
|
|
28
|
-
'carbon.table.batch.selectAll': 'Select all'
|
|
23
|
+
const translationIds = {
|
|
24
|
+
'carbon.table.batch.cancel': 'carbon.table.batch.cancel',
|
|
25
|
+
'carbon.table.batch.items.selected': 'carbon.table.batch.items.selected',
|
|
26
|
+
'carbon.table.batch.item.selected': 'carbon.table.batch.item.selected',
|
|
27
|
+
'carbon.table.batch.selectAll': 'carbon.table.batch.selectAll'
|
|
29
28
|
};
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
const defaultTranslations = {
|
|
30
|
+
[translationIds['carbon.table.batch.cancel']]: 'Cancel',
|
|
31
|
+
[translationIds['carbon.table.batch.items.selected']]: 'items selected',
|
|
32
|
+
[translationIds['carbon.table.batch.item.selected']]: 'item selected',
|
|
33
|
+
[translationIds['carbon.table.batch.selectAll']]: 'Select all'
|
|
34
|
+
};
|
|
35
|
+
const defaultTranslateWithId = (messageId, args = {
|
|
34
36
|
totalSelected: 0,
|
|
35
37
|
totalCount: 0
|
|
36
38
|
}) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const {
|
|
40
|
+
totalSelected,
|
|
41
|
+
totalCount
|
|
42
|
+
} = args;
|
|
43
|
+
switch (messageId) {
|
|
44
|
+
case translationIds['carbon.table.batch.cancel']:
|
|
45
|
+
return defaultTranslations[messageId];
|
|
46
|
+
case translationIds['carbon.table.batch.selectAll']:
|
|
47
|
+
return `${defaultTranslations[messageId]} (${totalCount})`;
|
|
48
|
+
case translationIds['carbon.table.batch.items.selected']:
|
|
49
|
+
case translationIds['carbon.table.batch.item.selected']:
|
|
50
|
+
return `${totalSelected} ${defaultTranslations[messageId]}`;
|
|
42
51
|
}
|
|
43
|
-
return `${totalSelected} ${translationKeys[id]}`;
|
|
44
52
|
};
|
|
45
53
|
const TableBatchActions = ({
|
|
46
54
|
className,
|
|
@@ -50,7 +58,7 @@ const TableBatchActions = ({
|
|
|
50
58
|
totalCount,
|
|
51
59
|
onCancel,
|
|
52
60
|
onSelectAll,
|
|
53
|
-
translateWithId: t =
|
|
61
|
+
translateWithId: t = defaultTranslateWithId,
|
|
54
62
|
...rest
|
|
55
63
|
}) => {
|
|
56
64
|
const [isScrolling, setIsScrolling] = React.useState(false);
|
|
@@ -89,7 +97,6 @@ const TableBatchActions = ({
|
|
|
89
97
|
onClick: onCancel
|
|
90
98
|
}, t('carbon.table.batch.cancel'))));
|
|
91
99
|
};
|
|
92
|
-
TableBatchActions.translationKeys = TableBatchActionsTranslationKeys;
|
|
93
100
|
TableBatchActions.propTypes = {
|
|
94
101
|
children: PropTypes.node,
|
|
95
102
|
className: PropTypes.string,
|
|
@@ -120,9 +127,7 @@ TableBatchActions.propTypes = {
|
|
|
120
127
|
*/
|
|
121
128
|
totalSelected: PropTypes.number.isRequired,
|
|
122
129
|
/**
|
|
123
|
-
*
|
|
124
|
-
* choice. Translation keys are available on the `translationKeys` field for
|
|
125
|
-
* this component.
|
|
130
|
+
* Translates component strings using your i18n tool.
|
|
126
131
|
*/
|
|
127
132
|
translateWithId: PropTypes.func
|
|
128
133
|
};
|
|
@@ -96,9 +96,9 @@ TableExpandHeader.propTypes = {
|
|
|
96
96
|
* Hook for when a listener initiates a request to expand the given row
|
|
97
97
|
*/
|
|
98
98
|
onExpand: PropTypes.oneOfType([requiredIfGivenPropIsTruthy.requiredIfGivenPropIsTruthy('enableExpando', PropTypes.func
|
|
99
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
100
100
|
), requiredIfGivenPropIsTruthy.requiredIfGivenPropIsTruthy('enableToggle', PropTypes.func
|
|
101
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
102
102
|
)])
|
|
103
103
|
};
|
|
104
104
|
|
|
@@ -33,6 +33,10 @@ export interface TableRowExpandInteropProps {
|
|
|
33
33
|
* Specify if the row is selected.
|
|
34
34
|
*/
|
|
35
35
|
isSelected?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The id of the matching th node in the table head. Addresses a11y concerns outlined here: https://www.ibm.com/able/guidelines/ci162/info_and_relationships.html and https://www.w3.org/TR/WCAG20-TECHS/H43
|
|
38
|
+
*/
|
|
39
|
+
expandHeader?: string;
|
|
36
40
|
}
|
|
37
41
|
export interface TableExpandRowProps extends PropsWithChildren<Omit<HTMLAttributes<HTMLTableRowElement>, 'onClick'>>, Omit<TableRowExpandInteropProps, 'aria-label' | 'onExpand'> {
|
|
38
42
|
/**
|
|
@@ -96,7 +96,7 @@ TableExpandRow.propTypes = {
|
|
|
96
96
|
* Specify the string read by a voice reader when the expand trigger is
|
|
97
97
|
* focused
|
|
98
98
|
*/
|
|
99
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
100
100
|
/**@ts-ignore*/
|
|
101
101
|
'aria-label': PropTypes.string,
|
|
102
102
|
/**
|
|
@@ -5,21 +5,19 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React, { type HTMLAttributes, type MouseEventHandler, type ReactNode } from 'react';
|
|
8
|
-
import { TranslateWithId } from '../../types/common';
|
|
8
|
+
import type { TranslateWithId } from '../../types/common';
|
|
9
9
|
import { sortStates, type DataTableSortState } from './state/sortStates';
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
declare const translationIds: {
|
|
11
|
+
readonly 'carbon.table.header.icon.description': "carbon.table.header.icon.description";
|
|
12
|
+
};
|
|
13
|
+
type TranslationKey = keyof typeof translationIds;
|
|
14
|
+
interface TableHeaderTranslationArgs {
|
|
12
15
|
header: ReactNode;
|
|
13
16
|
isSortHeader?: boolean;
|
|
14
17
|
sortDirection?: DataTableSortState;
|
|
15
18
|
sortStates: typeof sortStates;
|
|
16
19
|
}
|
|
17
|
-
export interface TableHeaderProps extends HTMLAttributes<HTMLTableCellElement & HTMLButtonElement>, TranslateWithId<
|
|
18
|
-
header: any;
|
|
19
|
-
sortDirection: any;
|
|
20
|
-
isSortHeader: any;
|
|
21
|
-
sortStates: any;
|
|
22
|
-
}> {
|
|
20
|
+
export interface TableHeaderProps extends HTMLAttributes<HTMLTableCellElement & HTMLButtonElement>, TranslateWithId<TranslationKey, TableHeaderTranslationArgs> {
|
|
23
21
|
/**
|
|
24
22
|
* Pass in children that will be embedded in the table header label
|
|
25
23
|
*/
|
|
@@ -69,7 +67,7 @@ export interface TableHeaderProps extends HTMLAttributes<HTMLTableCellElement &
|
|
|
69
67
|
* Specify which direction we are currently sorting by, should be one of DESC,
|
|
70
68
|
* NONE, or ASC.
|
|
71
69
|
*/
|
|
72
|
-
sortDirection?:
|
|
70
|
+
sortDirection?: DataTableSortState;
|
|
73
71
|
}
|
|
74
72
|
declare const TableHeader: React.ForwardRefExoticComponent<TableHeaderProps & React.RefAttributes<HTMLTableCellElement>>;
|
|
75
73
|
export default TableHeader;
|
|
@@ -21,11 +21,14 @@ var index = require('../AILabel/index.js');
|
|
|
21
21
|
var utils = require('../../internal/utils.js');
|
|
22
22
|
|
|
23
23
|
const defaultScope = 'col';
|
|
24
|
-
const
|
|
25
|
-
|
|
24
|
+
const translationIds = {
|
|
25
|
+
'carbon.table.header.icon.description': 'carbon.table.header.icon.description'
|
|
26
26
|
};
|
|
27
|
-
const
|
|
28
|
-
|
|
27
|
+
const defaultTranslations = {
|
|
28
|
+
[translationIds['carbon.table.header.icon.description']]: 'Click to sort rows by header in ascending order'
|
|
29
|
+
};
|
|
30
|
+
const defaultTranslateWithId = (messageId, args) => {
|
|
31
|
+
if (args && messageId === translationIds['carbon.table.header.icon.description']) {
|
|
29
32
|
if (args.isSortHeader && sortStates.sortStates) {
|
|
30
33
|
// When transitioning, we know that the sequence of states is as follows:
|
|
31
34
|
// NONE -> ASC -> DESC -> NONE
|
|
@@ -39,7 +42,7 @@ const translateWithId = (key, args) => {
|
|
|
39
42
|
}
|
|
40
43
|
return `Click to sort rows by ${args.header} header in ascending order`;
|
|
41
44
|
}
|
|
42
|
-
return
|
|
45
|
+
return defaultTranslations[messageId];
|
|
43
46
|
};
|
|
44
47
|
const sortDirections = {
|
|
45
48
|
[sortStates.sortStates.NONE]: 'none',
|
|
@@ -56,7 +59,7 @@ const TableHeader = /*#__PURE__*/React.forwardRef(function TableHeader({
|
|
|
56
59
|
onClick,
|
|
57
60
|
scope = defaultScope,
|
|
58
61
|
sortDirection,
|
|
59
|
-
translateWithId: t =
|
|
62
|
+
translateWithId: t = defaultTranslateWithId,
|
|
60
63
|
slug,
|
|
61
64
|
id,
|
|
62
65
|
...rest
|
|
@@ -72,7 +75,7 @@ const TableHeader = /*#__PURE__*/React.forwardRef(function TableHeader({
|
|
|
72
75
|
const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/React.cloneElement(candidate, {
|
|
73
76
|
size: 'mini',
|
|
74
77
|
ref: AILableRef
|
|
75
|
-
}) :
|
|
78
|
+
}) : candidate;
|
|
76
79
|
const headerLabelClassNames = cx({
|
|
77
80
|
[`${prefix}--table-header-label`]: true,
|
|
78
81
|
[`${prefix}--table-header-label--slug ${prefix}--table-header-label--ai-label`]: colHasAILabel,
|
|
@@ -186,15 +189,10 @@ TableHeader.propTypes = {
|
|
|
186
189
|
*/
|
|
187
190
|
sortDirection: PropTypes.oneOf(Object.values(sortStates.sortStates)),
|
|
188
191
|
/**
|
|
189
|
-
*
|
|
190
|
-
* choice. Translation keys are available on the `translationKeys` field for
|
|
191
|
-
* this component.
|
|
192
|
+
* Translates component strings using your i18n tool.
|
|
192
193
|
*/
|
|
193
194
|
translateWithId: PropTypes.func
|
|
194
195
|
};
|
|
195
|
-
|
|
196
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
197
|
-
TableHeader.translationKeys = Object.values(translationKeys);
|
|
198
196
|
TableHeader.displayName = 'TableHeader';
|
|
199
197
|
|
|
200
198
|
exports.default = TableHeader;
|
|
@@ -25,16 +25,18 @@ const TableRow = frFn((props, ref) => {
|
|
|
25
25
|
// only useful in `TableExpandRow`
|
|
26
26
|
const {
|
|
27
27
|
ariaLabel,
|
|
28
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
28
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
29
29
|
'aria-label': ariaLabelAlt,
|
|
30
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
30
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
31
31
|
'aria-controls': ariaControls,
|
|
32
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
32
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
33
33
|
onExpand,
|
|
34
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
34
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
35
35
|
isExpanded,
|
|
36
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
36
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
37
37
|
isSelected,
|
|
38
|
+
expandHeader,
|
|
39
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
38
40
|
...cleanProps
|
|
39
41
|
} = props;
|
|
40
42
|
const prefix = usePrefix.usePrefix();
|
|
@@ -34,7 +34,7 @@ const TableSlugRow = ({
|
|
|
34
34
|
// Slug is always size `mini`
|
|
35
35
|
let normalizedSlug;
|
|
36
36
|
if (slug) {
|
|
37
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
38
38
|
normalizedSlug = /*#__PURE__*/React.cloneElement(slug, {
|
|
39
39
|
size: 'mini'
|
|
40
40
|
});
|
|
@@ -19,7 +19,7 @@ var index = require('../OverflowMenu/index.js');
|
|
|
19
19
|
|
|
20
20
|
const defaultIconDescription = 'Settings';
|
|
21
21
|
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- https://github.com/carbon-design-system/carbon/issues/
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
23
23
|
|
|
24
24
|
const TableToolbarMenu = ({
|
|
25
25
|
className,
|
|
@@ -7,14 +7,15 @@
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { ChangeEvent, FocusEvent, ReactNode } from 'react';
|
|
9
9
|
import { SearchProps } from '../Search';
|
|
10
|
-
import { TranslateWithId } from '../../types/common';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
import type { TranslateWithId } from '../../types/common';
|
|
11
|
+
declare const translationIds: {
|
|
12
|
+
readonly 'carbon.table.toolbar.search.label': "carbon.table.toolbar.search.label";
|
|
13
|
+
readonly 'carbon.table.toolbar.search.placeholder': "carbon.table.toolbar.search.placeholder";
|
|
14
|
+
};
|
|
15
|
+
type TranslationKey = keyof typeof translationIds;
|
|
15
16
|
type ExcludedInheritedProps = 'defaultValue' | 'labelText' | 'onBlur' | 'onChange' | 'onExpand' | 'onFocus' | 'tabIndex';
|
|
16
17
|
export type TableToolbarSearchHandleExpand = (event: FocusEvent<HTMLInputElement>, newValue?: boolean) => void;
|
|
17
|
-
export interface TableToolbarSearchProps extends Omit<SearchProps, ExcludedInheritedProps>, TranslateWithId<
|
|
18
|
+
export interface TableToolbarSearchProps extends Omit<SearchProps, ExcludedInheritedProps>, TranslateWithId<TranslationKey> {
|
|
18
19
|
/**
|
|
19
20
|
* Specifies if the search should initially render in an expanded state
|
|
20
21
|
*/
|
|
@@ -138,7 +139,7 @@ declare const TableToolbarSearch: {
|
|
|
138
139
|
*/
|
|
139
140
|
tabIndex: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
140
141
|
/**
|
|
141
|
-
*
|
|
142
|
+
* Translates component strings using your i18n tool.
|
|
142
143
|
*/
|
|
143
144
|
translateWithId: PropTypes.Requireable<(...args: any[]) => any>;
|
|
144
145
|
};
|
|
@@ -19,23 +19,23 @@ var useId = require('../../internal/useId.js');
|
|
|
19
19
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
20
20
|
var noopFn = require('../../internal/noopFn.js');
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
'carbon.table.toolbar.search.label': 'Filter table',
|
|
28
|
-
'carbon.table.toolbar.search.placeholder': 'Filter table'
|
|
22
|
+
const translationIds = {
|
|
23
|
+
'carbon.table.toolbar.search.label': 'carbon.table.toolbar.search.label',
|
|
24
|
+
'carbon.table.toolbar.search.placeholder': 'carbon.table.toolbar.search.placeholder'
|
|
25
|
+
};
|
|
26
|
+
const defaultTranslations = {
|
|
27
|
+
[translationIds['carbon.table.toolbar.search.label']]: 'Filter table',
|
|
28
|
+
[translationIds['carbon.table.toolbar.search.placeholder']]: 'Filter table'
|
|
29
29
|
};
|
|
30
|
-
const
|
|
31
|
-
return
|
|
30
|
+
const defaultTranslateWithId = messageId => {
|
|
31
|
+
return defaultTranslations[messageId];
|
|
32
32
|
};
|
|
33
33
|
const TableToolbarSearch = ({
|
|
34
34
|
className,
|
|
35
35
|
searchContainerClass,
|
|
36
36
|
onChange: onChangeProp,
|
|
37
37
|
onClear = noopFn.noopFn,
|
|
38
|
-
translateWithId: t =
|
|
38
|
+
translateWithId: t = defaultTranslateWithId,
|
|
39
39
|
placeholder,
|
|
40
40
|
labelText,
|
|
41
41
|
expanded: expandedProp,
|
|
@@ -192,7 +192,7 @@ TableToolbarSearch.propTypes = {
|
|
|
192
192
|
*/
|
|
193
193
|
tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
194
194
|
/**
|
|
195
|
-
*
|
|
195
|
+
* Translates component strings using your i18n tool.
|
|
196
196
|
*/
|
|
197
197
|
translateWithId: PropTypes.func
|
|
198
198
|
};
|
|
@@ -17,7 +17,7 @@ import TableDecoratorRow from './TableDecoratorRow';
|
|
|
17
17
|
import TableExpandRow from './TableExpandRow';
|
|
18
18
|
import TableExpandedRow from './TableExpandedRow';
|
|
19
19
|
import TableHead from './TableHead';
|
|
20
|
-
import TableHeader
|
|
20
|
+
import TableHeader from './TableHeader';
|
|
21
21
|
import TableRow from './TableRow';
|
|
22
22
|
import TableSelectAll from './TableSelectAll';
|
|
23
23
|
import TableSelectRow from './TableSelectRow';
|
|
@@ -28,5 +28,5 @@ import TableToolbarContent from './TableToolbarContent';
|
|
|
28
28
|
import TableToolbarSearch from './TableToolbarSearch';
|
|
29
29
|
import TableToolbarMenu from './TableToolbarMenu';
|
|
30
30
|
import type { DataTableSortState } from './state/sortStates';
|
|
31
|
-
export { DataTable, type DataTableCell, type DataTableHeader, type DataTableProps, type DataTableRenderProps, type DataTableSortState, type DataTableRow, type DataTableSize, Table, TableActionList, TableBatchAction, TableBatchActions, TableBody, TableCell, TableContainer, TableDecoratorRow, TableExpandHeader, TableExpandRow, TableExpandedRow, TableHead, TableHeader,
|
|
31
|
+
export { DataTable, type DataTableCell, type DataTableHeader, type DataTableProps, type DataTableRenderProps, type DataTableSortState, type DataTableRow, type DataTableSize, Table, TableActionList, TableBatchAction, TableBatchActions, TableBody, TableCell, TableContainer, TableDecoratorRow, TableExpandHeader, TableExpandRow, TableExpandedRow, TableHead, TableHeader, TableRow, TableSelectAll, TableSelectRow, TableSlugRow, TableToolbar, TableToolbarAction, TableToolbarContent, TableToolbarSearch, TableToolbarMenu, };
|
|
32
32
|
export default DataTable;
|
|
@@ -13,8 +13,8 @@ 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, // eslint-disable-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
17
|
-
cellB: any, // eslint-disable-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
16
|
+
export type SortRowFn = (cellA: any, // eslint-disable-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
17
|
+
cellB: any, // eslint-disable-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
18
18
|
options: SortRowParams) => number;
|
|
19
19
|
interface Props {
|
|
20
20
|
locale?: string;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
var sortStates = require('./sortStates.js');
|
|
11
11
|
var sorting = require('../tools/sorting.js');
|
|
12
12
|
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
14
14
|
|
|
15
15
|
const initialSortState = sortStates.sortStates.NONE;
|
|
16
16
|
|
|
@@ -15,7 +15,7 @@ var sortStates = require('../state/sortStates.js');
|
|
|
15
15
|
* type, the default sort algorithm will be used for those types. Otherwise, the
|
|
16
16
|
* values will be converted to strings for comparison.
|
|
17
17
|
*/
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
19
19
|
const compare = (a, b, locale = 'en') => {
|
|
20
20
|
// prevent multiple null values in one column (sorting breaks)
|
|
21
21
|
if (a === null) a = '';
|
|
@@ -173,7 +173,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
173
173
|
isFluid
|
|
174
174
|
} = React.useContext(FormContext.FormContext);
|
|
175
175
|
const [hasInput, setHasInput] = React.useState(false);
|
|
176
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
176
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
177
177
|
const startInputField = React.useCallback(node => {
|
|
178
178
|
if (node !== null) {
|
|
179
179
|
startInputField.current = node;
|
|
@@ -194,9 +194,9 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
194
194
|
onClose(selectedDates, dateStr, instance);
|
|
195
195
|
}
|
|
196
196
|
},
|
|
197
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
197
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
198
198
|
[onClose]);
|
|
199
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
199
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
200
200
|
const onCalendarClose = (selectedDates, dateStr, instance, e) => {
|
|
201
201
|
if (e && e.type === 'clickOutside') {
|
|
202
202
|
return;
|
|
@@ -235,9 +235,9 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
235
235
|
[String(className)]: className
|
|
236
236
|
});
|
|
237
237
|
|
|
238
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
238
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
239
239
|
const childrenWithProps = React.Children.toArray(children).map(
|
|
240
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
240
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
241
241
|
(child, index) => {
|
|
242
242
|
if (index === 0 && child.type === /*#__PURE__*/React.createElement(DatePickerInput.default, child.props).type) {
|
|
243
243
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
@@ -352,7 +352,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
352
352
|
const {
|
|
353
353
|
current: end
|
|
354
354
|
} = endInputField;
|
|
355
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
355
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
356
356
|
const flatpickerConfig = {
|
|
357
357
|
inline: inline ?? false,
|
|
358
358
|
onClose: onCalendarClose,
|
|
@@ -528,7 +528,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
528
528
|
// this hook allows consumers to access the flatpickr calendar
|
|
529
529
|
// instance for cases where functions like open() or close()
|
|
530
530
|
// need to be imperatively called on the calendar
|
|
531
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
531
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
532
532
|
React.useImperativeHandle(ref, () => ({
|
|
533
533
|
get calendar() {
|
|
534
534
|
return calendarRef.current;
|
|
@@ -585,7 +585,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
585
585
|
endInputField.current.value = '';
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
588
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
589
589
|
}, [value]);
|
|
590
590
|
React.useEffect(() => {
|
|
591
591
|
const handleMouseDown = event => {
|
|
@@ -594,7 +594,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
594
594
|
closeCalendar();
|
|
595
595
|
}
|
|
596
596
|
};
|
|
597
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
597
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
598
598
|
const closeCalendar = event => {
|
|
599
599
|
calendarRef.current?.close();
|
|
600
600
|
// Remove focus from endDate calendar input
|
|
@@ -24,7 +24,7 @@ var deprecate = require('../../prop-types/deprecate.js');
|
|
|
24
24
|
var index = require('../AILabel/index.js');
|
|
25
25
|
var utils = require('../../internal/utils.js');
|
|
26
26
|
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
28
28
|
|
|
29
29
|
let didWarnAboutDatePickerInputValue = false;
|
|
30
30
|
const DatePickerInput = /*#__PURE__*/React.forwardRef(function DatePickerInput(props, ref) {
|
|
@@ -100,7 +100,7 @@ const DatePickerInput = /*#__PURE__*/React.forwardRef(function DatePickerInput(p
|
|
|
100
100
|
});
|
|
101
101
|
const datePickerInputHelperId = !helperText ? undefined : `datepicker-input-helper-text-${datePickerInputInstanceId}`;
|
|
102
102
|
|
|
103
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
103
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
104
104
|
const inputProps = {
|
|
105
105
|
...rest,
|
|
106
106
|
...datePickerInputProps,
|
|
@@ -119,7 +119,7 @@ const DatePickerInput = /*#__PURE__*/React.forwardRef(function DatePickerInput(p
|
|
|
119
119
|
const candidateIsAILabel = utils.isComponentElement(candidate, index.AILabel);
|
|
120
120
|
const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/React.cloneElement(candidate, {
|
|
121
121
|
size: 'mini'
|
|
122
|
-
}) :
|
|
122
|
+
}) : candidate;
|
|
123
123
|
return /*#__PURE__*/React.createElement("div", {
|
|
124
124
|
className: containerClasses
|
|
125
125
|
}, labelText && /*#__PURE__*/React.createElement(Text.Text, {
|
|
@@ -206,14 +206,14 @@ DatePickerInput.propTypes = {
|
|
|
206
206
|
/**
|
|
207
207
|
* Provide a regular expression that the input value must match
|
|
208
208
|
*/
|
|
209
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
209
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
210
210
|
pattern: (props, propName, componentName) => {
|
|
211
211
|
if (props[propName] === undefined) {
|
|
212
212
|
return;
|
|
213
213
|
}
|
|
214
214
|
try {
|
|
215
215
|
new RegExp(props[propName]);
|
|
216
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
216
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
217
217
|
} catch (e) {
|
|
218
218
|
return new Error(`Invalid value of prop '${propName}' supplied to '${componentName}', it should be a valid regular expression`);
|
|
219
219
|
}
|
|
@@ -95,7 +95,7 @@ const Dialog = /*#__PURE__*/React.forwardRef(({
|
|
|
95
95
|
ref.current.close();
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
98
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
99
99
|
}, [modal, open]);
|
|
100
100
|
React.useEffect(() => {
|
|
101
101
|
if (!open && focusAfterCloseRef) {
|
|
@@ -126,7 +126,7 @@ const Dialog = /*#__PURE__*/React.forwardRef(({
|
|
|
126
126
|
ref.current.setAttribute('aria-labelledby', title.id);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
129
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
130
130
|
}, [open, ariaLabel, ariaLabelledBy, prefix]);
|
|
131
131
|
return /*#__PURE__*/React.createElement(DialogContext.Provider, {
|
|
132
132
|
value: contextValue
|
|
@@ -231,7 +231,7 @@ const DialogControls = /*#__PURE__*/React.forwardRef(({
|
|
|
231
231
|
const prefix = usePrefix.usePrefix();
|
|
232
232
|
return (
|
|
233
233
|
/*#__PURE__*/
|
|
234
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/
|
|
234
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
235
235
|
// @ts-ignore
|
|
236
236
|
React.createElement("div", _rollupPluginBabelHelpers.extends({
|
|
237
237
|
className: `${prefix}--dialog__header-controls`,
|
|
@@ -260,7 +260,7 @@ const DialogCloseButton = /*#__PURE__*/React.forwardRef(({
|
|
|
260
260
|
const prefix = usePrefix.usePrefix();
|
|
261
261
|
return (
|
|
262
262
|
/*#__PURE__*/
|
|
263
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/
|
|
263
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
264
264
|
// @ts-ignore
|
|
265
265
|
React.createElement(index.IconButton, _rollupPluginBabelHelpers.extends({
|
|
266
266
|
kind: "ghost",
|
|
@@ -497,7 +497,7 @@ const DialogFooter = /*#__PURE__*/React.forwardRef(({
|
|
|
497
497
|
onClick: onButtonClick
|
|
498
498
|
}, i) => /*#__PURE__*/React.createElement(Button.default, {
|
|
499
499
|
key: `${buttonText}-${i}`
|
|
500
|
-
// eslint-disable-next-line jsx-a11y/no-autofocus -- https://github.com/carbon-design-system/carbon/issues/
|
|
500
|
+
// eslint-disable-next-line jsx-a11y/no-autofocus -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
501
501
|
,
|
|
502
502
|
autoFocus: danger,
|
|
503
503
|
kind: "secondary",
|
|
@@ -507,7 +507,7 @@ const DialogFooter = /*#__PURE__*/React.forwardRef(({
|
|
|
507
507
|
ref: danger ? setSecondaryButtonRef : undefined,
|
|
508
508
|
disabled: loadingActive,
|
|
509
509
|
kind: "secondary"
|
|
510
|
-
// eslint-disable-next-line jsx-a11y/no-autofocus -- https://github.com/carbon-design-system/carbon/issues/
|
|
510
|
+
// eslint-disable-next-line jsx-a11y/no-autofocus -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
511
511
|
,
|
|
512
512
|
autoFocus: danger,
|
|
513
513
|
onClick: onSecondaryButtonClick
|