@carbon/react 1.92.0 → 1.93.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1011 -970
- 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/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 +22 -36
- package/es/components/DataTable/DataTable.d.ts +25 -16
- package/es/components/DataTable/DataTable.js +33 -34
- 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.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 +5 -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 +20 -36
- 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 +8 -8
- 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/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 +21 -35
- package/lib/components/DataTable/DataTable.d.ts +25 -16
- package/lib/components/DataTable/DataTable.js +33 -34
- 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.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 +5 -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 +19 -35
- 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 +8 -8
- 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
|
@@ -40,15 +40,15 @@ import TableToolbarMenu from './TableToolbarMenu.js';
|
|
|
40
40
|
import { deprecate } from '../../prop-types/deprecate.js';
|
|
41
41
|
|
|
42
42
|
const getInstanceId = setupGetInstanceId();
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
const translationIds = {
|
|
44
|
+
'carbon.table.row.expand': 'carbon.table.row.expand',
|
|
45
|
+
'carbon.table.row.collapse': 'carbon.table.row.collapse',
|
|
46
|
+
'carbon.table.all.expand': 'carbon.table.all.expand',
|
|
47
|
+
'carbon.table.all.collapse': 'carbon.table.all.collapse',
|
|
48
|
+
'carbon.table.all.select': 'carbon.table.all.select',
|
|
49
|
+
'carbon.table.all.unselect': 'carbon.table.all.unselect',
|
|
50
|
+
'carbon.table.row.select': 'carbon.table.row.select',
|
|
51
|
+
'carbon.table.row.unselect': 'carbon.table.row.unselect'
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
/**
|
|
@@ -56,26 +56,28 @@ const translationKeys = {
|
|
|
56
56
|
*/
|
|
57
57
|
|
|
58
58
|
const defaultTranslations = {
|
|
59
|
-
[
|
|
60
|
-
[
|
|
61
|
-
[
|
|
62
|
-
[
|
|
63
|
-
[
|
|
64
|
-
[
|
|
65
|
-
[
|
|
66
|
-
[
|
|
59
|
+
[translationIds['carbon.table.all.expand']]: 'Expand all rows',
|
|
60
|
+
[translationIds['carbon.table.all.collapse']]: 'Collapse all rows',
|
|
61
|
+
[translationIds['carbon.table.row.expand']]: 'Expand current row',
|
|
62
|
+
[translationIds['carbon.table.row.collapse']]: 'Collapse current row',
|
|
63
|
+
[translationIds['carbon.table.all.select']]: 'Select all rows',
|
|
64
|
+
[translationIds['carbon.table.all.unselect']]: 'Unselect all rows',
|
|
65
|
+
[translationIds['carbon.table.row.select']]: 'Select row',
|
|
66
|
+
[translationIds['carbon.table.row.unselect']]: 'Unselect row'
|
|
67
|
+
};
|
|
68
|
+
const defaultTranslateWithId = messageId => {
|
|
69
|
+
return defaultTranslations[messageId];
|
|
67
70
|
};
|
|
68
|
-
const translateWithId = id => defaultTranslations[id];
|
|
69
71
|
|
|
70
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
71
73
|
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
73
75
|
|
|
74
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
75
77
|
|
|
76
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
77
79
|
|
|
78
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
79
81
|
|
|
80
82
|
/**
|
|
81
83
|
* DataTable components are used to represent a collection of resources,
|
|
@@ -85,14 +87,14 @@ const translateWithId = id => defaultTranslations[id];
|
|
|
85
87
|
* the DataTable is accessible through look-up by ID, and updating the state of
|
|
86
88
|
* a single entity cascades updates to the consumer.
|
|
87
89
|
*/
|
|
88
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
89
91
|
const DataTable = props => {
|
|
90
92
|
const {
|
|
91
93
|
children,
|
|
92
94
|
filterRows = defaultFilterRows,
|
|
93
95
|
headers,
|
|
94
96
|
render,
|
|
95
|
-
translateWithId: t =
|
|
97
|
+
translateWithId: t = defaultTranslateWithId,
|
|
96
98
|
size,
|
|
97
99
|
isSortable: isSortableProp,
|
|
98
100
|
useZebraStyles,
|
|
@@ -128,7 +130,7 @@ const DataTable = props => {
|
|
|
128
130
|
if (hasRowIdsChanged || hasHeadersChanged || hasRowsChanged) {
|
|
129
131
|
setState(prev => getDerivedStateFromProps(props, prev));
|
|
130
132
|
}
|
|
131
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
133
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
132
134
|
}, [headers, rows]);
|
|
133
135
|
const getHeaderProps = ({
|
|
134
136
|
header,
|
|
@@ -181,7 +183,7 @@ const DataTable = props => {
|
|
|
181
183
|
rowsById
|
|
182
184
|
} = state;
|
|
183
185
|
const isExpanded = isExpandedAll || rowIds.every(id => rowsById[id].isExpanded);
|
|
184
|
-
const translationKey = isExpanded ?
|
|
186
|
+
const translationKey = isExpanded ? translationIds['carbon.table.all.collapse'] : translationIds['carbon.table.all.expand'];
|
|
185
187
|
const handlers = [handleOnExpandAll, onExpand];
|
|
186
188
|
if (onClick) {
|
|
187
189
|
handlers.push(handleOnExpandHeaderClick(onClick, {
|
|
@@ -216,7 +218,7 @@ const DataTable = props => {
|
|
|
216
218
|
onClick,
|
|
217
219
|
...rest
|
|
218
220
|
}) => {
|
|
219
|
-
const translationKey = row.isExpanded ?
|
|
221
|
+
const translationKey = row.isExpanded ? translationIds['carbon.table.row.collapse'] : translationIds['carbon.table.row.expand'];
|
|
220
222
|
return {
|
|
221
223
|
...rest,
|
|
222
224
|
key: row.id,
|
|
@@ -251,7 +253,7 @@ const DataTable = props => {
|
|
|
251
253
|
} = {}) => {
|
|
252
254
|
// If we're given a row, return the selection state values for that row
|
|
253
255
|
if (row) {
|
|
254
|
-
const translationKey = row.isSelected ?
|
|
256
|
+
const translationKey = row.isSelected ? translationIds['carbon.table.row.unselect'] : translationIds['carbon.table.row.select'];
|
|
255
257
|
return {
|
|
256
258
|
...rest,
|
|
257
259
|
checked: row.isSelected,
|
|
@@ -270,7 +272,7 @@ const DataTable = props => {
|
|
|
270
272
|
const selectedRowCount = selectedRows.length;
|
|
271
273
|
const checked = rowCount > 0 && selectedRowCount === rowCount;
|
|
272
274
|
const indeterminate = rowCount > 0 && selectedRowCount > 0 && selectedRowCount !== rowCount;
|
|
273
|
-
const translationKey = checked || indeterminate ?
|
|
275
|
+
const translationKey = checked || indeterminate ? translationIds['carbon.table.all.unselect'] : translationIds['carbon.table.all.select'];
|
|
274
276
|
return {
|
|
275
277
|
...rest,
|
|
276
278
|
'aria-label': t(translationKey),
|
|
@@ -552,7 +554,6 @@ const DataTable = props => {
|
|
|
552
554
|
}
|
|
553
555
|
return null;
|
|
554
556
|
};
|
|
555
|
-
DataTable.translationKeys = Object.values(translationKeys);
|
|
556
557
|
DataTable.Table = Table;
|
|
557
558
|
DataTable.TableActionList = TableActionList;
|
|
558
559
|
DataTable.TableBatchAction = TableBatchAction;
|
|
@@ -648,9 +649,7 @@ DataTable.propTypes = {
|
|
|
648
649
|
*/
|
|
649
650
|
stickyHeader: PropTypes.bool,
|
|
650
651
|
/**
|
|
651
|
-
*
|
|
652
|
-
* internationalized string. See `DataTable.translationKeys` for all
|
|
653
|
-
* available message IDs.
|
|
652
|
+
* Translates component strings using your i18n tool.
|
|
654
653
|
*/
|
|
655
654
|
translateWithId: PropTypes.func,
|
|
656
655
|
/**
|
|
@@ -72,11 +72,11 @@ const Table = ({
|
|
|
72
72
|
[`${prefix}--data-table--visible-overflow-menu`]: !overflowMenuOnHover
|
|
73
73
|
});
|
|
74
74
|
const toggleTableBodyAlignmentClass = useCallback((alignTop = false) => {
|
|
75
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
76
76
|
alignTop ? tableRef.current?.classList.add(`${prefix}--data-table--top-aligned-body`) : tableRef.current?.classList.remove(`${prefix}--data-table--top-aligned-body`);
|
|
77
77
|
}, [prefix]);
|
|
78
78
|
const toggleTableHeaderAlignmentClass = useCallback((alignTop = false) => {
|
|
79
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
80
80
|
alignTop ? tableRef.current?.classList.add(`${prefix}--data-table--top-aligned-header`) : tableRef.current?.classList.remove(`${prefix}--data-table--top-aligned-header`);
|
|
81
81
|
}, [prefix]);
|
|
82
82
|
const setTableAlignment = useCallback(() => {
|
|
@@ -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;
|
|
@@ -16,27 +16,35 @@ import { Text } from '../Text/Text.js';
|
|
|
16
16
|
import '../Text/TextDirection.js';
|
|
17
17
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
'carbon.table.batch.
|
|
22
|
-
'carbon.table.batch.
|
|
23
|
-
'carbon.table.batch.
|
|
24
|
-
'carbon.table.batch.selectAll': 'Select all'
|
|
19
|
+
const translationIds = {
|
|
20
|
+
'carbon.table.batch.cancel': 'carbon.table.batch.cancel',
|
|
21
|
+
'carbon.table.batch.items.selected': 'carbon.table.batch.items.selected',
|
|
22
|
+
'carbon.table.batch.item.selected': 'carbon.table.batch.item.selected',
|
|
23
|
+
'carbon.table.batch.selectAll': 'carbon.table.batch.selectAll'
|
|
25
24
|
};
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
const defaultTranslations = {
|
|
26
|
+
[translationIds['carbon.table.batch.cancel']]: 'Cancel',
|
|
27
|
+
[translationIds['carbon.table.batch.items.selected']]: 'items selected',
|
|
28
|
+
[translationIds['carbon.table.batch.item.selected']]: 'item selected',
|
|
29
|
+
[translationIds['carbon.table.batch.selectAll']]: 'Select all'
|
|
30
|
+
};
|
|
31
|
+
const defaultTranslateWithId = (messageId, args = {
|
|
30
32
|
totalSelected: 0,
|
|
31
33
|
totalCount: 0
|
|
32
34
|
}) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
const {
|
|
36
|
+
totalSelected,
|
|
37
|
+
totalCount
|
|
38
|
+
} = args;
|
|
39
|
+
switch (messageId) {
|
|
40
|
+
case translationIds['carbon.table.batch.cancel']:
|
|
41
|
+
return defaultTranslations[messageId];
|
|
42
|
+
case translationIds['carbon.table.batch.selectAll']:
|
|
43
|
+
return `${defaultTranslations[messageId]} (${totalCount})`;
|
|
44
|
+
case translationIds['carbon.table.batch.items.selected']:
|
|
45
|
+
case translationIds['carbon.table.batch.item.selected']:
|
|
46
|
+
return `${totalSelected} ${defaultTranslations[messageId]}`;
|
|
38
47
|
}
|
|
39
|
-
return `${totalSelected} ${translationKeys[id]}`;
|
|
40
48
|
};
|
|
41
49
|
const TableBatchActions = ({
|
|
42
50
|
className,
|
|
@@ -46,7 +54,7 @@ const TableBatchActions = ({
|
|
|
46
54
|
totalCount,
|
|
47
55
|
onCancel,
|
|
48
56
|
onSelectAll,
|
|
49
|
-
translateWithId: t =
|
|
57
|
+
translateWithId: t = defaultTranslateWithId,
|
|
50
58
|
...rest
|
|
51
59
|
}) => {
|
|
52
60
|
const [isScrolling, setIsScrolling] = React.useState(false);
|
|
@@ -85,7 +93,6 @@ const TableBatchActions = ({
|
|
|
85
93
|
onClick: onCancel
|
|
86
94
|
}, t('carbon.table.batch.cancel'))));
|
|
87
95
|
};
|
|
88
|
-
TableBatchActions.translationKeys = TableBatchActionsTranslationKeys;
|
|
89
96
|
TableBatchActions.propTypes = {
|
|
90
97
|
children: PropTypes.node,
|
|
91
98
|
className: PropTypes.string,
|
|
@@ -116,9 +123,7 @@ TableBatchActions.propTypes = {
|
|
|
116
123
|
*/
|
|
117
124
|
totalSelected: PropTypes.number.isRequired,
|
|
118
125
|
/**
|
|
119
|
-
*
|
|
120
|
-
* choice. Translation keys are available on the `translationKeys` field for
|
|
121
|
-
* this component.
|
|
126
|
+
* Translates component strings using your i18n tool.
|
|
122
127
|
*/
|
|
123
128
|
translateWithId: PropTypes.func
|
|
124
129
|
};
|
|
@@ -92,9 +92,9 @@ TableExpandHeader.propTypes = {
|
|
|
92
92
|
* Hook for when a listener initiates a request to expand the given row
|
|
93
93
|
*/
|
|
94
94
|
onExpand: PropTypes.oneOfType([requiredIfGivenPropIsTruthy('enableExpando', PropTypes.func
|
|
95
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
95
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
96
96
|
), requiredIfGivenPropIsTruthy('enableToggle', PropTypes.func
|
|
97
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
98
98
|
)])
|
|
99
99
|
};
|
|
100
100
|
|
|
@@ -92,7 +92,7 @@ TableExpandRow.propTypes = {
|
|
|
92
92
|
* Specify the string read by a voice reader when the expand trigger is
|
|
93
93
|
* focused
|
|
94
94
|
*/
|
|
95
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/
|
|
95
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
96
96
|
/**@ts-ignore*/
|
|
97
97
|
'aria-label': PropTypes.string,
|
|
98
98
|
/**
|
|
@@ -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;
|
|
@@ -17,11 +17,14 @@ import { AILabel } from '../AILabel/index.js';
|
|
|
17
17
|
import { isComponentElement } from '../../internal/utils.js';
|
|
18
18
|
|
|
19
19
|
const defaultScope = 'col';
|
|
20
|
-
const
|
|
21
|
-
|
|
20
|
+
const translationIds = {
|
|
21
|
+
'carbon.table.header.icon.description': 'carbon.table.header.icon.description'
|
|
22
22
|
};
|
|
23
|
-
const
|
|
24
|
-
|
|
23
|
+
const defaultTranslations = {
|
|
24
|
+
[translationIds['carbon.table.header.icon.description']]: 'Click to sort rows by header in ascending order'
|
|
25
|
+
};
|
|
26
|
+
const defaultTranslateWithId = (messageId, args) => {
|
|
27
|
+
if (args && messageId === translationIds['carbon.table.header.icon.description']) {
|
|
25
28
|
if (args.isSortHeader && sortStates) {
|
|
26
29
|
// When transitioning, we know that the sequence of states is as follows:
|
|
27
30
|
// NONE -> ASC -> DESC -> NONE
|
|
@@ -35,7 +38,7 @@ const translateWithId = (key, args) => {
|
|
|
35
38
|
}
|
|
36
39
|
return `Click to sort rows by ${args.header} header in ascending order`;
|
|
37
40
|
}
|
|
38
|
-
return
|
|
41
|
+
return defaultTranslations[messageId];
|
|
39
42
|
};
|
|
40
43
|
const sortDirections = {
|
|
41
44
|
[sortStates.NONE]: 'none',
|
|
@@ -52,7 +55,7 @@ const TableHeader = /*#__PURE__*/React.forwardRef(function TableHeader({
|
|
|
52
55
|
onClick,
|
|
53
56
|
scope = defaultScope,
|
|
54
57
|
sortDirection,
|
|
55
|
-
translateWithId: t =
|
|
58
|
+
translateWithId: t = defaultTranslateWithId,
|
|
56
59
|
slug,
|
|
57
60
|
id,
|
|
58
61
|
...rest
|
|
@@ -68,7 +71,7 @@ const TableHeader = /*#__PURE__*/React.forwardRef(function TableHeader({
|
|
|
68
71
|
const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/cloneElement(candidate, {
|
|
69
72
|
size: 'mini',
|
|
70
73
|
ref: AILableRef
|
|
71
|
-
}) :
|
|
74
|
+
}) : candidate;
|
|
72
75
|
const headerLabelClassNames = cx({
|
|
73
76
|
[`${prefix}--table-header-label`]: true,
|
|
74
77
|
[`${prefix}--table-header-label--slug ${prefix}--table-header-label--ai-label`]: colHasAILabel,
|
|
@@ -182,15 +185,10 @@ TableHeader.propTypes = {
|
|
|
182
185
|
*/
|
|
183
186
|
sortDirection: PropTypes.oneOf(Object.values(sortStates)),
|
|
184
187
|
/**
|
|
185
|
-
*
|
|
186
|
-
* choice. Translation keys are available on the `translationKeys` field for
|
|
187
|
-
* this component.
|
|
188
|
+
* Translates component strings using your i18n tool.
|
|
188
189
|
*/
|
|
189
190
|
translateWithId: PropTypes.func
|
|
190
191
|
};
|
|
191
|
-
|
|
192
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20071
|
|
193
|
-
TableHeader.translationKeys = Object.values(translationKeys);
|
|
194
192
|
TableHeader.displayName = 'TableHeader';
|
|
195
193
|
|
|
196
194
|
export { TableHeader as default };
|
|
@@ -21,15 +21,15 @@ const TableRow = frFn((props, ref) => {
|
|
|
21
21
|
// only useful in `TableExpandRow`
|
|
22
22
|
const {
|
|
23
23
|
ariaLabel,
|
|
24
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
24
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
25
25
|
'aria-label': ariaLabelAlt,
|
|
26
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
26
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
27
27
|
'aria-controls': ariaControls,
|
|
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
|
onExpand,
|
|
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
|
isExpanded,
|
|
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
|
isSelected,
|
|
34
34
|
...cleanProps
|
|
35
35
|
} = props;
|
|
@@ -30,7 +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/
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
34
34
|
normalizedSlug = /*#__PURE__*/React.cloneElement(slug, {
|
|
35
35
|
size: 'mini'
|
|
36
36
|
});
|
|
@@ -15,7 +15,7 @@ import OverflowMenu from '../OverflowMenu/index.js';
|
|
|
15
15
|
|
|
16
16
|
const defaultIconDescription = 'Settings';
|
|
17
17
|
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- https://github.com/carbon-design-system/carbon/issues/
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
19
19
|
|
|
20
20
|
const TableToolbarMenu = ({
|
|
21
21
|
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
|
};
|
|
@@ -15,23 +15,23 @@ import { useId } from '../../internal/useId.js';
|
|
|
15
15
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
16
16
|
import { noopFn } from '../../internal/noopFn.js';
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
'carbon.table.toolbar.search.label': 'Filter table',
|
|
24
|
-
'carbon.table.toolbar.search.placeholder': 'Filter table'
|
|
18
|
+
const translationIds = {
|
|
19
|
+
'carbon.table.toolbar.search.label': 'carbon.table.toolbar.search.label',
|
|
20
|
+
'carbon.table.toolbar.search.placeholder': 'carbon.table.toolbar.search.placeholder'
|
|
21
|
+
};
|
|
22
|
+
const defaultTranslations = {
|
|
23
|
+
[translationIds['carbon.table.toolbar.search.label']]: 'Filter table',
|
|
24
|
+
[translationIds['carbon.table.toolbar.search.placeholder']]: 'Filter table'
|
|
25
25
|
};
|
|
26
|
-
const
|
|
27
|
-
return
|
|
26
|
+
const defaultTranslateWithId = messageId => {
|
|
27
|
+
return defaultTranslations[messageId];
|
|
28
28
|
};
|
|
29
29
|
const TableToolbarSearch = ({
|
|
30
30
|
className,
|
|
31
31
|
searchContainerClass,
|
|
32
32
|
onChange: onChangeProp,
|
|
33
33
|
onClear = noopFn,
|
|
34
|
-
translateWithId: t =
|
|
34
|
+
translateWithId: t = defaultTranslateWithId,
|
|
35
35
|
placeholder,
|
|
36
36
|
labelText,
|
|
37
37
|
expanded: expandedProp,
|
|
@@ -188,7 +188,7 @@ TableToolbarSearch.propTypes = {
|
|
|
188
188
|
*/
|
|
189
189
|
tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
190
190
|
/**
|
|
191
|
-
*
|
|
191
|
+
* Translates component strings using your i18n tool.
|
|
192
192
|
*/
|
|
193
193
|
translateWithId: PropTypes.func
|
|
194
194
|
};
|
|
@@ -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;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { sortStates } from './sortStates.js';
|
|
9
9
|
import { sortRows } from '../tools/sorting.js';
|
|
10
10
|
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
12
12
|
|
|
13
13
|
const initialSortState = sortStates.NONE;
|
|
14
14
|
|
|
@@ -13,7 +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/
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
17
17
|
const compare = (a, b, locale = 'en') => {
|
|
18
18
|
// prevent multiple null values in one column (sorting breaks)
|
|
19
19
|
if (a === null) a = '';
|