@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
|
@@ -20,18 +20,18 @@ var _Undo;
|
|
|
20
20
|
const AILabelContent = /*#__PURE__*/React.forwardRef(function AILabelContent({
|
|
21
21
|
className,
|
|
22
22
|
children
|
|
23
|
-
}, ref // eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
23
|
+
}, ref // eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
24
24
|
) {
|
|
25
25
|
const prefix = usePrefix();
|
|
26
26
|
const hasAILabelActions = React.Children.toArray(children).some(child => {
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
28
28
|
const item = child;
|
|
29
29
|
// TODO: Is there supposed to be a `return` here? If so, this issue would
|
|
30
30
|
// have been caught by ESLint. It's concerning that this code is 7 months
|
|
31
31
|
// old and no one has noticed any issues with it. It also makes me question
|
|
32
32
|
// whether the code is necessary.
|
|
33
33
|
// https://github.com/carbon-design-system/carbon/issues/18991
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
35
35
|
item.type === AILabelActions;
|
|
36
36
|
});
|
|
37
37
|
const aiLabelContentClasses = cx(className, {
|
|
@@ -56,7 +56,7 @@ AILabelContent.propTypes = {
|
|
|
56
56
|
const AILabelActions = /*#__PURE__*/React.forwardRef(function AILabelActions({
|
|
57
57
|
className,
|
|
58
58
|
children
|
|
59
|
-
}, ref // eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
59
|
+
}, ref // eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
60
60
|
) {
|
|
61
61
|
const prefix = usePrefix();
|
|
62
62
|
const aiLabelActionsClasses = cx(className, {
|
|
@@ -34,7 +34,7 @@ const BreadcrumbItem = frFn((props, ref) => {
|
|
|
34
34
|
[customClassName]: !!customClassName
|
|
35
35
|
});
|
|
36
36
|
|
|
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
|
const child = children;
|
|
39
39
|
if (child.type && child.type.displayName !== undefined && child.type.displayName.includes('OverflowMenu')) {
|
|
40
40
|
const horizontalOverflowIcon = /*#__PURE__*/React.createElement(OverflowMenuHorizontal, {
|
|
@@ -22,7 +22,7 @@ function isIconOnlyButton(hasIconOnly, _kind) {
|
|
|
22
22
|
return false;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
25
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
26
26
|
const Button = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
27
27
|
const {
|
|
28
28
|
as,
|
|
@@ -45,7 +45,7 @@ const Button = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
45
45
|
...rest
|
|
46
46
|
} = props;
|
|
47
47
|
if (ButtonImageElement && !children && !iconDescription) {
|
|
48
|
-
// eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/
|
|
48
|
+
// eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
49
49
|
console.error('Button: renderIcon property specified without also providing an iconDescription property. ' + 'This may impact accessibility for screen reader users.');
|
|
50
50
|
}
|
|
51
51
|
const iconOnlyImage = !ButtonImageElement ? null : /*#__PURE__*/React.createElement(ButtonImageElement, null);
|
|
@@ -38,7 +38,7 @@ const ChatButton = /*#__PURE__*/React.forwardRef(function ChatButton({
|
|
|
38
38
|
} else {
|
|
39
39
|
// Check if size is valid and warn if not
|
|
40
40
|
if (size && !allowedSizes.includes(size)) {
|
|
41
|
-
// eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/
|
|
41
|
+
// eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
42
42
|
console.error(`Invalid size "${size}" provided to ChatButton. Size must be one of: ${allowedSizes.join(', ')}. Defaulting to "lg".`);
|
|
43
43
|
size = 'lg';
|
|
44
44
|
}
|
|
@@ -61,7 +61,7 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
|
|
|
61
61
|
const candidateIsAILabel = isComponentElement(candidate, AILabel);
|
|
62
62
|
const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/cloneElement(candidate, {
|
|
63
63
|
size: candidate.props.kind === 'inline' ? 'md' : 'mini'
|
|
64
|
-
}) :
|
|
64
|
+
}) : candidate;
|
|
65
65
|
return /*#__PURE__*/React.createElement("div", {
|
|
66
66
|
className: wrapperClasses
|
|
67
67
|
}, /*#__PURE__*/React.createElement("input", _extends({}, other, {
|
|
@@ -58,7 +58,7 @@ const CheckboxGroup = ({
|
|
|
58
58
|
const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/cloneElement(candidate, {
|
|
59
59
|
size: 'mini',
|
|
60
60
|
kind: 'default'
|
|
61
|
-
}) :
|
|
61
|
+
}) : candidate;
|
|
62
62
|
const clonedChildren = Children.map(children, child => {
|
|
63
63
|
if (/*#__PURE__*/isValidElement(child) && child.type === Checkbox) {
|
|
64
64
|
const childProps = {
|
|
@@ -6,23 +6,15 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { UseComboboxProps, UseComboboxActions } from 'downshift';
|
|
8
8
|
import React, { type ComponentType, type InputHTMLAttributes, type MouseEvent, type PropsWithChildren, type PropsWithRef, type ReactElement, type ReactNode, type RefAttributes } from 'react';
|
|
9
|
-
import { type ListBoxSize } from '../ListBox';
|
|
10
|
-
import { TranslateWithId } from '../../types/common';
|
|
9
|
+
import { type ListBoxMenuIconTranslationKey, type ListBoxSelectionTranslationKey, type ListBoxSize } from '../ListBox';
|
|
10
|
+
import type { TranslateWithId } from '../../types/common';
|
|
11
11
|
type ExcludedAttributes = 'id' | 'onChange' | 'onClick' | 'type' | 'size';
|
|
12
12
|
export interface OnChangeData<ItemType> {
|
|
13
13
|
selectedItem: ItemType | null | undefined;
|
|
14
14
|
inputValue?: string | null;
|
|
15
15
|
}
|
|
16
|
-
/**
|
|
17
|
-
* Message ids that will be passed to translateWithId().
|
|
18
|
-
* Combination of message ids from ListBox/next/ListBoxSelection.js and
|
|
19
|
-
* ListBox/next/ListBoxTrigger.js, but we can't access those values directly
|
|
20
|
-
* because those components aren't Typescript. (If you try, TranslationKey
|
|
21
|
-
* ends up just being defined as "string".)
|
|
22
|
-
*/
|
|
23
|
-
export type TranslationKey = 'close.menu' | 'open.menu' | 'clear.all' | 'clear.selection';
|
|
24
16
|
export type ItemToStringHandler<ItemType> = (item: ItemType | null) => string;
|
|
25
|
-
export interface ComboBoxProps<ItemType> extends Omit<InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes>, TranslateWithId<
|
|
17
|
+
export interface ComboBoxProps<ItemType> extends Omit<InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes>, TranslateWithId<ListBoxMenuIconTranslationKey | ListBoxSelectionTranslationKey> {
|
|
26
18
|
/**
|
|
27
19
|
* Specify whether or not the ComboBox should allow a value that is
|
|
28
20
|
* not in the list to be entered in the input
|
|
@@ -93,15 +93,6 @@ const findHighlightedIndex = ({
|
|
|
93
93
|
}
|
|
94
94
|
return -1;
|
|
95
95
|
};
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Message ids that will be passed to translateWithId().
|
|
99
|
-
* Combination of message ids from ListBox/next/ListBoxSelection.js and
|
|
100
|
-
* ListBox/next/ListBoxTrigger.js, but we can't access those values directly
|
|
101
|
-
* because those components aren't Typescript. (If you try, TranslationKey
|
|
102
|
-
* ends up just being defined as "string".)
|
|
103
|
-
*/
|
|
104
|
-
|
|
105
96
|
const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
106
97
|
const prevInputLengthRef = useRef(0);
|
|
107
98
|
const inputRef = useRef(null);
|
|
@@ -169,7 +160,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
169
160
|
refs.floating.current.style.width = parentWidth + 'px';
|
|
170
161
|
}
|
|
171
162
|
}
|
|
172
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
163
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
173
164
|
}, [enableFloatingStyles, floatingStyles, refs.floating, parentWidth]);
|
|
174
165
|
const [inputValue, setInputValue] = useState(getInputValue({
|
|
175
166
|
initialSelectedItem,
|
|
@@ -199,7 +190,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
199
190
|
}
|
|
200
191
|
prevInputLengthRef.current = inputValue.length;
|
|
201
192
|
}
|
|
202
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
193
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
203
194
|
}, [typeahead, inputValue, items, itemToString, autocompleteCustomFilter]);
|
|
204
195
|
const isManualClearingRef = useRef(false);
|
|
205
196
|
const [isClearing, setIsClearing] = useState(false);
|
|
@@ -240,7 +231,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
240
231
|
}
|
|
241
232
|
prevSelectedItemProp.current = selectedItemProp;
|
|
242
233
|
}
|
|
243
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
234
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
244
235
|
}, [selectedItemProp]);
|
|
245
236
|
const filterItems = (items, itemToString, inputValue) => items.filter(item => typeahead ? autocompleteCustomFilter({
|
|
246
237
|
item: itemToString(item),
|
|
@@ -255,10 +246,10 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
255
246
|
useEffect(() => {
|
|
256
247
|
if (prevInputValue.current !== inputValue) {
|
|
257
248
|
prevInputValue.current = inputValue;
|
|
258
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/
|
|
249
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
259
250
|
onInputChange && onInputChange(inputValue);
|
|
260
251
|
}
|
|
261
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
252
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
262
253
|
}, [inputValue]);
|
|
263
254
|
const handleSelectionClear = () => {
|
|
264
255
|
if (textInput?.current) {
|
|
@@ -327,7 +318,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
327
318
|
const filteredList = filterItems(items, itemToString, inputValue);
|
|
328
319
|
const highlightedItem = filteredList[state.highlightedIndex];
|
|
329
320
|
|
|
330
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
321
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
331
322
|
if (highlightedItem && !highlightedItem.disabled) {
|
|
332
323
|
return {
|
|
333
324
|
...changes,
|
|
@@ -340,7 +331,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
340
331
|
if (autoIndex !== -1) {
|
|
341
332
|
const matchingItem = items[autoIndex];
|
|
342
333
|
|
|
343
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
334
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
344
335
|
if (matchingItem && !matchingItem.disabled) {
|
|
345
336
|
return {
|
|
346
337
|
...changes,
|
|
@@ -458,7 +449,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
458
449
|
const candidateIsAILabel = isComponentElement(candidate, AILabel);
|
|
459
450
|
const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/cloneElement(candidate, {
|
|
460
451
|
size: 'mini'
|
|
461
|
-
}) :
|
|
452
|
+
}) : candidate;
|
|
462
453
|
const {
|
|
463
454
|
// Prop getters
|
|
464
455
|
getInputProps,
|
|
@@ -494,10 +485,10 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
494
485
|
onHighlightedIndexChange: ({
|
|
495
486
|
highlightedIndex
|
|
496
487
|
}) => {
|
|
497
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion , valid-typeof , no-constant-binary-expression -- https://github.com/carbon-design-system/carbon/issues/
|
|
488
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion , valid-typeof , no-constant-binary-expression -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
498
489
|
if (highlightedIndex > -1 && typeof window !== undefined) {
|
|
499
490
|
const itemArray = document.querySelectorAll(`li.${prefix}--list-box__menu-item[role="option"]`);
|
|
500
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/
|
|
491
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
501
492
|
const highlightedItem = itemArray[highlightedIndex];
|
|
502
493
|
if (highlightedItem) {
|
|
503
494
|
highlightedItem.scrollIntoView({
|
|
@@ -510,9 +501,9 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
510
501
|
initialSelectedItem: initialSelectedItem,
|
|
511
502
|
inputId: id,
|
|
512
503
|
stateReducer,
|
|
513
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
504
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
514
505
|
isItemDisabled(item, _index) {
|
|
515
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
506
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
516
507
|
return item?.disabled;
|
|
517
508
|
},
|
|
518
509
|
...downshiftProps,
|
|
@@ -549,7 +540,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
549
540
|
toggleMenu
|
|
550
541
|
};
|
|
551
542
|
}
|
|
552
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
543
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
553
544
|
}, [closeMenu, openMenu, reset, selectItem, setHighlightedIndex, downshiftSetInputValue, toggleMenu]);
|
|
554
545
|
const buttonProps = getToggleButtonProps({
|
|
555
546
|
disabled: disabled || readOnly,
|
|
@@ -599,7 +590,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
599
590
|
const menuProps = useMemo(() => getMenuProps({
|
|
600
591
|
ref: enableFloatingStyles ? refs.setFloating : null
|
|
601
592
|
}),
|
|
602
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
593
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
603
594
|
[enableFloatingStyles, deprecatedAriaLabel, ariaLabel, getMenuProps, refs.setFloating]);
|
|
604
595
|
useEffect(() => {
|
|
605
596
|
if (textInput.current) {
|
|
@@ -933,8 +924,7 @@ ComboBox.propTypes = {
|
|
|
933
924
|
*/
|
|
934
925
|
titleText: PropTypes.node,
|
|
935
926
|
/**
|
|
936
|
-
*
|
|
937
|
-
* and returns the localized string for the message
|
|
927
|
+
* Translates component strings using your i18n tool.
|
|
938
928
|
*/
|
|
939
929
|
translateWithId: PropTypes.func,
|
|
940
930
|
/**
|
|
@@ -9,14 +9,11 @@ import { IconButton } from '../IconButton';
|
|
|
9
9
|
import Button from '../Button';
|
|
10
10
|
import { Menu } from '../Menu';
|
|
11
11
|
import { MenuAlignment } from '../MenuButton';
|
|
12
|
-
import { TranslateWithId } from '../../types/common';
|
|
13
|
-
declare const
|
|
14
|
-
'carbon.combo-button.additional-actions':
|
|
12
|
+
import type { TranslateWithId } from '../../types/common';
|
|
13
|
+
declare const translationIds: {
|
|
14
|
+
readonly 'carbon.combo-button.additional-actions': "carbon.combo-button.additional-actions";
|
|
15
15
|
};
|
|
16
|
-
|
|
17
|
-
* Message ids that will be passed to translateWithId().
|
|
18
|
-
*/
|
|
19
|
-
export type TranslationKey = keyof typeof defaultTranslations;
|
|
16
|
+
type TranslationKey = keyof typeof translationIds;
|
|
20
17
|
interface ComboButtonProps extends TranslateWithId<TranslationKey> {
|
|
21
18
|
/**
|
|
22
19
|
* A collection of `MenuItems` to be rendered as additional actions for this `ComboButton`.
|
|
@@ -45,7 +42,7 @@ interface ComboButtonProps extends TranslateWithId<TranslationKey> {
|
|
|
45
42
|
/**
|
|
46
43
|
* Specify the size of the buttons and menu.
|
|
47
44
|
*/
|
|
48
|
-
size?: 'sm' | 'md' | 'lg';
|
|
45
|
+
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
49
46
|
/**
|
|
50
47
|
* Specify how the trigger tooltip should be aligned.
|
|
51
48
|
*/
|
|
@@ -25,17 +25,15 @@ import { deprecateValuesWithin } from '../../prop-types/deprecateValuesWithin.js
|
|
|
25
25
|
import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
|
|
26
26
|
|
|
27
27
|
var _ChevronDown;
|
|
28
|
+
const translationIds = {
|
|
29
|
+
'carbon.combo-button.additional-actions': 'carbon.combo-button.additional-actions'
|
|
30
|
+
};
|
|
28
31
|
const defaultTranslations = {
|
|
29
|
-
'carbon.combo-button.additional-actions': 'Additional actions'
|
|
32
|
+
[translationIds['carbon.combo-button.additional-actions']]: 'Additional actions'
|
|
30
33
|
};
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Message ids that will be passed to translateWithId().
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
function defaultTranslateWithId(messageId) {
|
|
34
|
+
const defaultTranslateWithId = messageId => {
|
|
37
35
|
return defaultTranslations[messageId];
|
|
38
|
-
}
|
|
36
|
+
};
|
|
39
37
|
const ComboButton = /*#__PURE__*/React.forwardRef(function ComboButton({
|
|
40
38
|
children,
|
|
41
39
|
className,
|
|
@@ -54,7 +52,7 @@ const ComboButton = /*#__PURE__*/React.forwardRef(function ComboButton({
|
|
|
54
52
|
const id = useId('combobutton');
|
|
55
53
|
const prefix = usePrefix();
|
|
56
54
|
const containerRef = useRef(null);
|
|
57
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
58
56
|
let middlewares = [];
|
|
59
57
|
if (!enableOnlyFloatingStyles) {
|
|
60
58
|
middlewares = [flip({
|
|
@@ -186,7 +184,7 @@ ComboButton.propTypes = {
|
|
|
186
184
|
/**
|
|
187
185
|
* Specify the size of the buttons and menu.
|
|
188
186
|
*/
|
|
189
|
-
size: PropTypes.oneOf(['sm', 'md', 'lg']),
|
|
187
|
+
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg']),
|
|
190
188
|
/**
|
|
191
189
|
* Specify how the trigger tooltip should be aligned.
|
|
192
190
|
*/
|
|
@@ -213,8 +211,7 @@ ComboButton.propTypes = {
|
|
|
213
211
|
// new values to match floating-ui
|
|
214
212
|
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']), ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'], mapPopoverAlign),
|
|
215
213
|
/**
|
|
216
|
-
*
|
|
217
|
-
* internationalized string.
|
|
214
|
+
* Translates component strings using your i18n tool.
|
|
218
215
|
*/
|
|
219
216
|
translateWithId: PropTypes.func
|
|
220
217
|
};
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import React, { useRef,
|
|
9
|
+
import React, { useRef, useContext, useEffect, Children, cloneElement } from 'react';
|
|
10
|
+
import { useResizeObserver } from '../../internal/useResizeObserver.js';
|
|
10
11
|
import { isElement } from 'react-is';
|
|
11
12
|
import PropTypes from 'prop-types';
|
|
12
13
|
import { Layer } from '../Layer/index.js';
|
|
13
14
|
import { ModalHeader } from './ModalHeader.js';
|
|
14
15
|
import { ModalFooter } from './ModalFooter.js';
|
|
15
|
-
import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
|
|
16
16
|
import { mergeRefs } from '../../tools/mergeRefs.js';
|
|
17
17
|
import cx from 'classnames';
|
|
18
18
|
import { toggleClass } from '../../tools/toggleClass.js';
|
|
@@ -32,7 +32,6 @@ import { useMergeRefs } from '@floating-ui/react';
|
|
|
32
32
|
import { ComposedModalPresenceContext, useExclusiveComposedModalPresenceContext, ComposedModalPresence } from './ComposedModalPresence.js';
|
|
33
33
|
import { useId } from '../../internal/useId.js';
|
|
34
34
|
import { useComposedModalState } from './useComposedModalState.js';
|
|
35
|
-
import { debounce } from '../../node_modules/es-toolkit/dist/compat/function/debounce.js';
|
|
36
35
|
|
|
37
36
|
const ModalBody = /*#__PURE__*/React.forwardRef(function ModalBody({
|
|
38
37
|
className: customClassName,
|
|
@@ -43,28 +42,23 @@ const ModalBody = /*#__PURE__*/React.forwardRef(function ModalBody({
|
|
|
43
42
|
}, ref) {
|
|
44
43
|
const prefix = usePrefix();
|
|
45
44
|
const contentRef = useRef(null);
|
|
46
|
-
const
|
|
45
|
+
const {
|
|
46
|
+
height
|
|
47
|
+
} = useResizeObserver({
|
|
48
|
+
ref: contentRef
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* isScrollable is implicitly dependent on height, when height gets updated
|
|
53
|
+
* via `useResizeObserver`, clientHeight and scrollHeight get updated too
|
|
54
|
+
*/
|
|
55
|
+
const isScrollable = !!contentRef.current && contentRef?.current?.scrollHeight > contentRef?.current?.clientHeight;
|
|
47
56
|
const contentClass = cx({
|
|
48
57
|
[`${prefix}--modal-content`]: true,
|
|
49
58
|
[`${prefix}--modal-content--with-form`]: hasForm,
|
|
50
|
-
[`${prefix}--modal-scroll-content`]: hasScrollingContent || isScrollable
|
|
59
|
+
[`${prefix}--modal-scroll-content`]: hasScrollingContent || isScrollable,
|
|
60
|
+
[`${prefix}--modal-scroll-content--no-fade`]: height <= 300
|
|
51
61
|
}, customClassName);
|
|
52
|
-
useIsomorphicEffect(() => {
|
|
53
|
-
if (contentRef.current) {
|
|
54
|
-
setIsScrollable(contentRef.current.scrollHeight > contentRef.current.clientHeight);
|
|
55
|
-
}
|
|
56
|
-
function handler() {
|
|
57
|
-
if (contentRef.current) {
|
|
58
|
-
setIsScrollable(contentRef.current.scrollHeight > contentRef.current.clientHeight);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
const debouncedHandler = debounce(handler, 200);
|
|
62
|
-
window.addEventListener('resize', debouncedHandler);
|
|
63
|
-
return () => {
|
|
64
|
-
debouncedHandler.cancel();
|
|
65
|
-
window.removeEventListener('resize', debouncedHandler);
|
|
66
|
-
};
|
|
67
|
-
}, []);
|
|
68
62
|
const hasScrollingContentProps = hasScrollingContent || isScrollable ? {
|
|
69
63
|
tabIndex: 0,
|
|
70
64
|
role: 'region'
|
|
@@ -169,7 +163,7 @@ const ComposedModalDialog = /*#__PURE__*/React.forwardRef(function ComposedModal
|
|
|
169
163
|
if (!enableDialogElement) {
|
|
170
164
|
toggleClass(document.body, `${prefix}--body--with-modal-open`, !!open);
|
|
171
165
|
}
|
|
172
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
166
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
173
167
|
}, [open, prefix]);
|
|
174
168
|
// Remove the document.body className on unmount
|
|
175
169
|
useEffect(() => {
|
|
@@ -243,17 +237,9 @@ const ComposedModalDialog = /*#__PURE__*/React.forwardRef(function ComposedModal
|
|
|
243
237
|
if (!modalContent || !modalContent.classList.contains(`${prefix}--modal-scroll-content`) || !currentActiveNode || !modalContent.contains(currentActiveNode)) {
|
|
244
238
|
return;
|
|
245
239
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
if (elem.contains(currentActiveNode)) {
|
|
250
|
-
const spaceBelow = modalContent.clientHeight - elem.offsetTop + modalContent.scrollTop - elem.clientHeight;
|
|
251
|
-
if (spaceBelow < gradientSpacing) {
|
|
252
|
-
modalContent.scrollTop = modalContent.scrollTop + (gradientSpacing - spaceBelow);
|
|
253
|
-
}
|
|
254
|
-
break;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
240
|
+
currentActiveNode.scrollIntoView({
|
|
241
|
+
block: 'center'
|
|
242
|
+
});
|
|
257
243
|
}
|
|
258
244
|
function closeModal(evt) {
|
|
259
245
|
if (!onClose || onClose(evt) !== false) {
|
|
@@ -313,7 +299,7 @@ const ComposedModalDialog = /*#__PURE__*/React.forwardRef(function ComposedModal
|
|
|
313
299
|
return () => {
|
|
314
300
|
document.removeEventListener('keydown', handleEscapeKey, true);
|
|
315
301
|
};
|
|
316
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
302
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
317
303
|
}, [open]);
|
|
318
304
|
useEffect(() => {
|
|
319
305
|
if (!enableDialogElement && !enablePresence && !open && launcherButtonRef) {
|
|
@@ -356,7 +342,7 @@ const ComposedModalDialog = /*#__PURE__*/React.forwardRef(function ComposedModal
|
|
|
356
342
|
focusButton(innerModal.current);
|
|
357
343
|
}
|
|
358
344
|
}
|
|
359
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
345
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
360
346
|
}, [open, selectorPrimaryFocus, isOpen]);
|
|
361
347
|
|
|
362
348
|
// AILabel is always size `sm`
|
|
@@ -364,7 +350,7 @@ const ComposedModalDialog = /*#__PURE__*/React.forwardRef(function ComposedModal
|
|
|
364
350
|
const candidateIsAILabel = isComponentElement(candidate, AILabel);
|
|
365
351
|
const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/cloneElement(candidate, {
|
|
366
352
|
size: 'sm'
|
|
367
|
-
}) :
|
|
353
|
+
}) : candidate;
|
|
368
354
|
const modalBody = enableDialogElement ? /*#__PURE__*/React.createElement(Dialog, {
|
|
369
355
|
open: open,
|
|
370
356
|
focusAfterCloseRef: launcherButtonRef,
|
|
@@ -8,21 +8,21 @@ import PropTypes from 'prop-types';
|
|
|
8
8
|
import React, { type ChangeEvent, type MouseEvent, type ReactElement, type ReactNode } from 'react';
|
|
9
9
|
import { type SortRowFn } from './state/sorting';
|
|
10
10
|
import type { DataTableSortState } from './state/sortStates';
|
|
11
|
-
import { TranslateWithId } from '../../types/common';
|
|
12
|
-
declare const
|
|
13
|
-
readonly
|
|
14
|
-
readonly
|
|
15
|
-
readonly
|
|
16
|
-
readonly
|
|
17
|
-
readonly
|
|
18
|
-
readonly
|
|
19
|
-
readonly
|
|
20
|
-
readonly
|
|
11
|
+
import type { TranslateWithId } from '../../types/common';
|
|
12
|
+
declare const translationIds: {
|
|
13
|
+
readonly 'carbon.table.row.expand': "carbon.table.row.expand";
|
|
14
|
+
readonly 'carbon.table.row.collapse': "carbon.table.row.collapse";
|
|
15
|
+
readonly 'carbon.table.all.expand': "carbon.table.all.expand";
|
|
16
|
+
readonly 'carbon.table.all.collapse': "carbon.table.all.collapse";
|
|
17
|
+
readonly 'carbon.table.all.select': "carbon.table.all.select";
|
|
18
|
+
readonly 'carbon.table.all.unselect': "carbon.table.all.unselect";
|
|
19
|
+
readonly 'carbon.table.row.select': "carbon.table.row.select";
|
|
20
|
+
readonly 'carbon.table.row.unselect': "carbon.table.row.unselect";
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
23
23
|
* Message IDs that will be passed to translateWithId().
|
|
24
24
|
*/
|
|
25
|
-
type TranslationKey =
|
|
25
|
+
type TranslationKey = keyof typeof translationIds;
|
|
26
26
|
export type DataTableSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
27
27
|
export interface DataTableCell<T> {
|
|
28
28
|
id: string;
|
|
@@ -233,7 +233,6 @@ export interface DataTableProps<RowType, ColTypes extends any[]> extends Transla
|
|
|
233
233
|
*/
|
|
234
234
|
export declare const DataTable: {
|
|
235
235
|
<RowType, ColTypes extends any[]>(props: DataTableProps<RowType, ColTypes>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
|
|
236
|
-
translationKeys: ("carbon.table.row.expand" | "carbon.table.row.collapse" | "carbon.table.all.expand" | "carbon.table.all.collapse" | "carbon.table.all.select" | "carbon.table.all.unselect" | "carbon.table.row.select" | "carbon.table.row.unselect")[];
|
|
237
236
|
Table: {
|
|
238
237
|
({ className, children, useZebraStyles, size, isSortable, useStaticWidth, stickyHeader, overflowMenuOnHover, experimentalAutoAlign, tabIndex, ...other }: React.PropsWithChildren<import("./Table").TableProps>): import("react/jsx-runtime").JSX.Element;
|
|
239
238
|
propTypes: {
|
|
@@ -258,7 +257,19 @@ export declare const DataTable: {
|
|
|
258
257
|
renderIcon: PropTypes.Requireable<object>;
|
|
259
258
|
};
|
|
260
259
|
};
|
|
261
|
-
TableBatchActions:
|
|
260
|
+
TableBatchActions: {
|
|
261
|
+
({ className, children, shouldShowBatchActions, totalSelected, totalCount, onCancel, onSelectAll, translateWithId: t, ...rest }: import("./TableBatchActions").TableBatchActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
262
|
+
propTypes: {
|
|
263
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
264
|
+
className: PropTypes.Requireable<string>;
|
|
265
|
+
onCancel: PropTypes.Validator<(...args: any[]) => any>;
|
|
266
|
+
onSelectAll: PropTypes.Requireable<(...args: any[]) => any>;
|
|
267
|
+
shouldShowBatchActions: PropTypes.Requireable<boolean>;
|
|
268
|
+
totalCount: PropTypes.Requireable<number>;
|
|
269
|
+
totalSelected: PropTypes.Validator<number>;
|
|
270
|
+
translateWithId: PropTypes.Requireable<(...args: any[]) => any>;
|
|
271
|
+
};
|
|
272
|
+
};
|
|
262
273
|
TableBody: {
|
|
263
274
|
({ children, className, ...rest }: import("./TableBody").TableBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
264
275
|
propTypes: {
|
|
@@ -454,9 +465,7 @@ export declare const DataTable: {
|
|
|
454
465
|
*/
|
|
455
466
|
stickyHeader: PropTypes.Requireable<boolean>;
|
|
456
467
|
/**
|
|
457
|
-
*
|
|
458
|
-
* internationalized string. See `DataTable.translationKeys` for all
|
|
459
|
-
* available message IDs.
|
|
468
|
+
* Translates component strings using your i18n tool.
|
|
460
469
|
*/
|
|
461
470
|
translateWithId: PropTypes.Requireable<(...args: any[]) => any>;
|
|
462
471
|
/**
|