@carbon/react 1.92.1 → 1.93.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +874 -838
- package/es/components/AILabel/index.js +4 -4
- package/es/components/Breadcrumb/BreadcrumbItem.js +1 -1
- package/es/components/Button/Button.js +2 -2
- package/es/components/ChatButton/ChatButton.js +1 -1
- package/es/components/Checkbox/Checkbox.js +1 -1
- package/es/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/es/components/CodeSnippet/CodeSnippet.js +9 -50
- package/es/components/ComboBox/ComboBox.d.ts +3 -11
- package/es/components/ComboBox/ComboBox.js +15 -25
- package/es/components/ComboButton/index.d.ts +5 -8
- package/es/components/ComboButton/index.js +9 -12
- package/es/components/ComposedModal/ComposedModal.js +19 -25
- package/es/components/DataTable/DataTable.d.ts +27 -16
- package/es/components/DataTable/DataTable.js +40 -39
- package/es/components/DataTable/Table.js +2 -2
- package/es/components/DataTable/TableBatchActions.d.ts +49 -10
- package/es/components/DataTable/TableBatchActions.js +26 -21
- package/es/components/DataTable/TableExpandHeader.js +2 -2
- package/es/components/DataTable/TableExpandRow.d.ts +4 -0
- package/es/components/DataTable/TableExpandRow.js +1 -1
- package/es/components/DataTable/TableHeader.d.ts +8 -10
- package/es/components/DataTable/TableHeader.js +11 -13
- package/es/components/DataTable/TableRow.js +7 -5
- package/es/components/DataTable/TableSlugRow.js +1 -1
- package/es/components/DataTable/TableToolbarMenu.js +1 -1
- package/es/components/DataTable/TableToolbarSearch.d.ts +8 -7
- package/es/components/DataTable/TableToolbarSearch.js +11 -11
- package/es/components/DataTable/index.d.ts +2 -2
- package/es/components/DataTable/state/sorting.d.ts +2 -2
- package/es/components/DataTable/state/sorting.js +1 -1
- package/es/components/DataTable/tools/sorting.js +1 -1
- package/es/components/DatePicker/DatePicker.js +9 -9
- package/es/components/DatePickerInput/DatePickerInput.js +5 -5
- package/es/components/Dialog/Dialog.js +6 -6
- package/es/components/Dropdown/Dropdown.d.ts +1 -1
- package/es/components/Dropdown/Dropdown.js +8 -8
- package/es/components/ErrorBoundary/ErrorBoundaryContext.js +1 -1
- package/es/components/FileUploader/FileUploader.js +4 -4
- package/es/components/FileUploader/FileUploaderButton.js +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/es/components/FileUploader/FileUploaderItem.js +2 -2
- package/es/components/FluidComboBox/FluidComboBox.d.ts +4 -7
- package/es/components/FluidComboBox/FluidComboBox.js +1 -1
- package/es/components/FluidDropdown/FluidDropdown.d.ts +4 -8
- package/es/components/FluidDropdown/FluidDropdown.js +1 -1
- package/es/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +3 -7
- package/es/components/FluidMultiSelect/FluidMultiSelect.d.ts +3 -7
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +3 -3
- package/es/components/FluidNumberInput/FluidNumberInput.d.ts +4 -7
- package/es/components/FluidNumberInput/FluidNumberInput.js +2 -2
- package/es/components/FluidSearch/FluidSearch.js +1 -1
- package/es/components/FluidSelect/FluidSelect.js +1 -1
- package/es/components/FluidTextInput/FluidTextInput.js +1 -1
- package/es/components/FluidTimePicker/FluidTimePicker.js +3 -3
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +1 -1
- package/es/components/Grid/CSSGrid.js +3 -3
- package/es/components/Grid/Column.js +2 -2
- package/es/components/Grid/ColumnHang.js +1 -1
- package/es/components/Grid/FlexGrid.js +1 -1
- package/es/components/Grid/Row.js +1 -1
- package/es/components/Heading/index.js +2 -2
- package/es/components/IconButton/index.js +2 -2
- package/es/components/IconIndicator/index.js +2 -2
- package/es/components/InlineCheckbox/InlineCheckbox.js +1 -1
- package/es/components/Layout/index.js +2 -2
- package/es/components/LayoutDirection/LayoutDirection.js +1 -1
- package/es/components/Link/Link.js +2 -2
- package/es/components/ListBox/ListBoxField.d.ts +0 -1
- package/es/components/ListBox/ListBoxMenuIcon.d.ts +8 -4
- package/es/components/ListBox/ListBoxMenuIcon.js +10 -6
- package/es/components/ListBox/ListBoxMenuItem.js +2 -2
- package/es/components/ListBox/ListBoxSelection.d.ts +3 -6
- package/es/components/ListBox/ListBoxSelection.js +5 -10
- package/es/components/ListBox/index.d.ts +5 -3
- package/es/components/ListBox/next/ListBoxSelection.d.ts +6 -13
- package/es/components/ListBox/next/ListBoxSelection.js +16 -8
- package/es/components/ListBox/next/ListBoxTrigger.d.ts +5 -10
- package/es/components/ListBox/next/ListBoxTrigger.js +6 -6
- package/es/components/Menu/MenuContext.js +1 -1
- package/es/components/Menu/MenuItem.js +1 -1
- package/es/components/MenuButton/index.js +5 -5
- package/es/components/Modal/Modal.js +17 -23
- package/es/components/ModalWrapper/ModalWrapper.js +2 -2
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +3 -12
- package/es/components/MultiSelect/FilterableMultiSelect.js +18 -27
- package/es/components/MultiSelect/MultiSelect.d.ts +2 -2
- package/es/components/MultiSelect/MultiSelect.js +12 -12
- package/es/components/Notification/Notification.js +1 -1
- package/es/components/NumberInput/NumberInput.d.ts +2 -5
- package/es/components/NumberInput/NumberInput.js +13 -18
- package/es/components/OverflowMenu/OverflowMenu.d.ts +2 -2
- package/es/components/OverflowMenu/OverflowMenu.js +4 -4
- package/es/components/OverflowMenu/next/index.d.ts +1 -1
- package/es/components/OverflowMenu/next/index.js +2 -2
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
- package/es/components/PageHeader/PageHeader.js +12 -12
- package/es/components/Pagination/Pagination.js +3 -3
- package/es/components/PaginationNav/PaginationNav.d.ts +6 -9
- package/es/components/PaginationNav/PaginationNav.js +21 -22
- package/es/components/Popover/index.js +10 -9
- package/es/components/ProgressBar/ProgressBar.js +2 -2
- package/es/components/ProgressIndicator/ProgressIndicator.d.ts +11 -15
- package/es/components/ProgressIndicator/ProgressIndicator.js +15 -15
- package/es/components/RadioButton/RadioButton.js +1 -1
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/es/components/RadioTile/RadioTile.js +1 -1
- package/es/components/Select/Select.js +7 -5
- package/es/components/ShapeIndicator/index.js +2 -2
- package/es/components/Slider/Slider.d.ts +7 -9
- package/es/components/Slider/Slider.js +16 -20
- package/es/components/Stack/HStack.js +1 -1
- package/es/components/Stack/Stack.js +1 -1
- package/es/components/Stack/VStack.js +1 -1
- package/es/components/StructuredList/StructuredList.js +3 -3
- package/es/components/Tabs/Tabs.js +12 -12
- package/es/components/Tag/DismissibleTag.js +3 -3
- package/es/components/Tag/OperationalTag.js +2 -2
- package/es/components/Tag/SelectableTag.js +2 -2
- package/es/components/Tag/Tag.js +4 -4
- package/es/components/Tag/isEllipsisActive.js +1 -1
- package/es/components/Text/Text.js +1 -1
- package/es/components/TextArea/TextArea.js +1 -1
- package/es/components/TextInput/PasswordInput.js +4 -4
- package/es/components/TextInput/TextInput.js +3 -3
- package/es/components/Theme/index.js +3 -3
- package/es/components/Tile/Tile.js +3 -3
- package/es/components/TimePicker/TimePicker.js +1 -1
- package/es/components/Toggletip/index.js +4 -4
- package/es/components/Tooltip/DefinitionTooltip.js +1 -1
- package/es/components/Tooltip/Tooltip.js +3 -3
- package/es/components/TreeView/TreeNode.js +6 -6
- package/es/components/TreeView/TreeView.js +5 -5
- package/es/components/UIShell/HeaderContainer.js +1 -1
- package/es/components/UIShell/HeaderMenu.js +1 -1
- package/es/components/UIShell/Link.js +2 -2
- package/es/components/UIShell/SideNavItems.js +1 -1
- package/es/components/UIShell/Switcher.js +1 -1
- package/es/components/UIShell/SwitcherItem.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/internal/FloatingMenu.js +4 -4
- package/es/internal/Selection.js +6 -6
- package/es/internal/useMergedRefs.js +1 -1
- package/es/internal/useNoInteractiveChildren.js +4 -4
- package/es/internal/useOutsideClick.js +1 -1
- package/es/internal/useOverflowItems.js +6 -6
- package/es/internal/useResizeObserver.js +3 -3
- package/es/internal/useSavedCallback.js +1 -1
- package/es/internal/warning.js +1 -1
- package/es/prop-types/isRequiredOneOf.js +2 -2
- package/es/tools/events.js +1 -1
- package/es/tools/wrapComponent.js +1 -1
- package/es/types/common.d.ts +6 -2
- package/lib/components/AILabel/index.js +4 -4
- package/lib/components/Breadcrumb/BreadcrumbItem.js +1 -1
- package/lib/components/Button/Button.js +2 -2
- package/lib/components/ChatButton/ChatButton.js +1 -1
- package/lib/components/Checkbox/Checkbox.js +1 -1
- package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/lib/components/CodeSnippet/CodeSnippet.js +8 -49
- package/lib/components/ComboBox/ComboBox.d.ts +3 -11
- package/lib/components/ComboBox/ComboBox.js +15 -25
- package/lib/components/ComboButton/index.d.ts +5 -8
- package/lib/components/ComboButton/index.js +9 -12
- package/lib/components/ComposedModal/ComposedModal.js +18 -24
- package/lib/components/DataTable/DataTable.d.ts +27 -16
- package/lib/components/DataTable/DataTable.js +40 -39
- package/lib/components/DataTable/Table.js +2 -2
- package/lib/components/DataTable/TableBatchActions.d.ts +49 -10
- package/lib/components/DataTable/TableBatchActions.js +26 -21
- package/lib/components/DataTable/TableExpandHeader.js +2 -2
- package/lib/components/DataTable/TableExpandRow.d.ts +4 -0
- package/lib/components/DataTable/TableExpandRow.js +1 -1
- package/lib/components/DataTable/TableHeader.d.ts +8 -10
- package/lib/components/DataTable/TableHeader.js +11 -13
- package/lib/components/DataTable/TableRow.js +7 -5
- package/lib/components/DataTable/TableSlugRow.js +1 -1
- package/lib/components/DataTable/TableToolbarMenu.js +1 -1
- package/lib/components/DataTable/TableToolbarSearch.d.ts +8 -7
- package/lib/components/DataTable/TableToolbarSearch.js +11 -11
- package/lib/components/DataTable/index.d.ts +2 -2
- package/lib/components/DataTable/state/sorting.d.ts +2 -2
- package/lib/components/DataTable/state/sorting.js +1 -1
- package/lib/components/DataTable/tools/sorting.js +1 -1
- package/lib/components/DatePicker/DatePicker.js +9 -9
- package/lib/components/DatePickerInput/DatePickerInput.js +5 -5
- package/lib/components/Dialog/Dialog.js +6 -6
- package/lib/components/Dropdown/Dropdown.d.ts +1 -1
- package/lib/components/Dropdown/Dropdown.js +8 -8
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +1 -1
- package/lib/components/FileUploader/FileUploader.js +4 -4
- package/lib/components/FileUploader/FileUploaderButton.js +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/lib/components/FileUploader/FileUploaderItem.js +2 -2
- package/lib/components/FluidComboBox/FluidComboBox.d.ts +4 -7
- package/lib/components/FluidComboBox/FluidComboBox.js +1 -1
- package/lib/components/FluidDropdown/FluidDropdown.d.ts +4 -8
- package/lib/components/FluidDropdown/FluidDropdown.js +1 -1
- package/lib/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +3 -7
- package/lib/components/FluidMultiSelect/FluidMultiSelect.d.ts +3 -7
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +3 -3
- package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +4 -7
- package/lib/components/FluidNumberInput/FluidNumberInput.js +2 -2
- package/lib/components/FluidSearch/FluidSearch.js +1 -1
- package/lib/components/FluidSelect/FluidSelect.js +1 -1
- package/lib/components/FluidTextInput/FluidTextInput.js +1 -1
- package/lib/components/FluidTimePicker/FluidTimePicker.js +3 -3
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +1 -1
- package/lib/components/Grid/CSSGrid.js +3 -3
- package/lib/components/Grid/Column.js +2 -2
- package/lib/components/Grid/ColumnHang.js +1 -1
- package/lib/components/Grid/FlexGrid.js +1 -1
- package/lib/components/Grid/Row.js +1 -1
- package/lib/components/Heading/index.js +2 -2
- package/lib/components/IconButton/index.js +2 -2
- package/lib/components/IconIndicator/index.js +2 -2
- package/lib/components/InlineCheckbox/InlineCheckbox.js +1 -1
- package/lib/components/Layout/index.js +2 -2
- package/lib/components/LayoutDirection/LayoutDirection.js +1 -1
- package/lib/components/Link/Link.js +2 -2
- package/lib/components/ListBox/ListBoxField.d.ts +0 -1
- package/lib/components/ListBox/ListBoxMenuIcon.d.ts +8 -4
- package/lib/components/ListBox/ListBoxMenuIcon.js +10 -6
- package/lib/components/ListBox/ListBoxMenuItem.js +2 -2
- package/lib/components/ListBox/ListBoxSelection.d.ts +3 -6
- package/lib/components/ListBox/ListBoxSelection.js +4 -10
- package/lib/components/ListBox/index.d.ts +5 -3
- package/lib/components/ListBox/next/ListBoxSelection.d.ts +6 -13
- package/lib/components/ListBox/next/ListBoxSelection.js +16 -8
- package/lib/components/ListBox/next/ListBoxTrigger.d.ts +5 -10
- package/lib/components/ListBox/next/ListBoxTrigger.js +5 -6
- package/lib/components/Menu/MenuContext.js +1 -1
- package/lib/components/Menu/MenuItem.js +1 -1
- package/lib/components/MenuButton/index.js +5 -5
- package/lib/components/Modal/Modal.js +16 -22
- package/lib/components/ModalWrapper/ModalWrapper.js +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +3 -12
- package/lib/components/MultiSelect/FilterableMultiSelect.js +18 -27
- package/lib/components/MultiSelect/MultiSelect.d.ts +2 -2
- package/lib/components/MultiSelect/MultiSelect.js +12 -12
- package/lib/components/Notification/Notification.js +1 -1
- package/lib/components/NumberInput/NumberInput.d.ts +2 -5
- package/lib/components/NumberInput/NumberInput.js +12 -18
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +2 -2
- package/lib/components/OverflowMenu/OverflowMenu.js +4 -4
- package/lib/components/OverflowMenu/next/index.d.ts +1 -1
- package/lib/components/OverflowMenu/next/index.js +2 -2
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
- package/lib/components/PageHeader/PageHeader.js +12 -12
- package/lib/components/Pagination/Pagination.js +3 -3
- package/lib/components/PaginationNav/PaginationNav.d.ts +6 -9
- package/lib/components/PaginationNav/PaginationNav.js +21 -22
- package/lib/components/Popover/index.js +10 -9
- package/lib/components/ProgressBar/ProgressBar.js +2 -2
- package/lib/components/ProgressIndicator/ProgressIndicator.d.ts +11 -15
- package/lib/components/ProgressIndicator/ProgressIndicator.js +15 -15
- package/lib/components/RadioButton/RadioButton.js +1 -1
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/lib/components/RadioTile/RadioTile.js +1 -1
- package/lib/components/Select/Select.js +7 -5
- package/lib/components/ShapeIndicator/index.js +2 -2
- package/lib/components/Slider/Slider.d.ts +7 -9
- package/lib/components/Slider/Slider.js +16 -20
- package/lib/components/Stack/HStack.js +1 -1
- package/lib/components/Stack/Stack.js +1 -1
- package/lib/components/Stack/VStack.js +1 -1
- package/lib/components/StructuredList/StructuredList.js +3 -3
- package/lib/components/Tabs/Tabs.js +12 -12
- package/lib/components/Tag/DismissibleTag.js +3 -3
- package/lib/components/Tag/OperationalTag.js +2 -2
- package/lib/components/Tag/SelectableTag.js +2 -2
- package/lib/components/Tag/Tag.js +4 -4
- package/lib/components/Tag/isEllipsisActive.js +1 -1
- package/lib/components/Text/Text.js +1 -1
- package/lib/components/TextArea/TextArea.js +1 -1
- package/lib/components/TextInput/PasswordInput.js +4 -4
- package/lib/components/TextInput/TextInput.js +3 -3
- package/lib/components/Theme/index.js +3 -3
- package/lib/components/Tile/Tile.js +3 -3
- package/lib/components/TimePicker/TimePicker.js +1 -1
- package/lib/components/Toggletip/index.js +4 -4
- package/lib/components/Tooltip/DefinitionTooltip.js +1 -1
- package/lib/components/Tooltip/Tooltip.js +3 -3
- package/lib/components/TreeView/TreeNode.js +6 -6
- package/lib/components/TreeView/TreeView.js +5 -5
- package/lib/components/UIShell/HeaderContainer.js +1 -1
- package/lib/components/UIShell/HeaderMenu.js +1 -1
- package/lib/components/UIShell/Link.js +2 -2
- package/lib/components/UIShell/SideNavItems.js +1 -1
- package/lib/components/UIShell/Switcher.js +1 -1
- package/lib/components/UIShell/SwitcherItem.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/internal/FloatingMenu.js +4 -4
- package/lib/internal/Selection.js +6 -6
- package/lib/internal/useMergedRefs.js +1 -1
- package/lib/internal/useNoInteractiveChildren.js +4 -4
- package/lib/internal/useOutsideClick.js +1 -1
- package/lib/internal/useOverflowItems.js +6 -6
- package/lib/internal/useResizeObserver.js +3 -3
- package/lib/internal/useSavedCallback.js +1 -1
- package/lib/internal/warning.js +1 -1
- package/lib/prop-types/isRequiredOneOf.js +2 -2
- package/lib/tools/events.js +1 -1
- package/lib/tools/wrapComponent.js +1 -1
- package/lib/types/common.d.ts +6 -2
- package/package.json +9 -9
|
@@ -16,7 +16,7 @@ var React = require('react');
|
|
|
16
16
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
17
17
|
|
|
18
18
|
// First create the component with basic types
|
|
19
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
19
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
20
20
|
const LinkBase = /*#__PURE__*/React.forwardRef(({
|
|
21
21
|
as: BaseComponent,
|
|
22
22
|
children,
|
|
@@ -53,7 +53,7 @@ const LinkBase = /*#__PURE__*/React.forwardRef(({
|
|
|
53
53
|
linkProps['aria-disabled'] = true;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
57
57
|
const BaseComponentAsAny = BaseComponent ?? 'a';
|
|
58
58
|
const handleOnClick = event => {
|
|
59
59
|
if (disabled) {
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React, { type HTMLAttributes } from 'react';
|
|
8
|
-
export declare const translationIds: {};
|
|
9
8
|
export interface ListBoxFieldProps extends HTMLAttributes<HTMLDivElement> {
|
|
10
9
|
/**
|
|
11
10
|
* Specify if the parent <ListBox> is disabled
|
|
@@ -1,13 +1,17 @@
|
|
|
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
7
|
import React from 'react';
|
|
8
|
-
import { TranslateWithId } from '../../types/common';
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
import type { TranslateWithId } from '../../types/common';
|
|
9
|
+
declare const translationIds: {
|
|
10
|
+
readonly 'close.menu': "close.menu";
|
|
11
|
+
readonly 'open.menu': "open.menu";
|
|
12
|
+
};
|
|
13
|
+
type TranslationKey = keyof typeof translationIds;
|
|
14
|
+
export interface ListBoxMenuIconProps extends TranslateWithId<TranslationKey> {
|
|
11
15
|
/**
|
|
12
16
|
* Specify whether the menu is currently open, which will influence the
|
|
13
17
|
* direction of the menu icon
|
|
@@ -15,11 +15,17 @@ var PropTypes = require('prop-types');
|
|
|
15
15
|
var iconsReact = require('@carbon/icons-react');
|
|
16
16
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
17
17
|
|
|
18
|
+
const translationIds = {
|
|
19
|
+
'close.menu': 'close.menu',
|
|
20
|
+
'open.menu': 'open.menu'
|
|
21
|
+
};
|
|
18
22
|
const defaultTranslations = {
|
|
19
|
-
'close.menu': 'Close menu',
|
|
20
|
-
'open.menu': 'Open menu'
|
|
23
|
+
[translationIds['close.menu']]: 'Close menu',
|
|
24
|
+
[translationIds['open.menu']]: 'Open menu'
|
|
25
|
+
};
|
|
26
|
+
const defaultTranslateWithId = messageId => {
|
|
27
|
+
return defaultTranslations[messageId];
|
|
21
28
|
};
|
|
22
|
-
const defaultTranslateWithId = id => defaultTranslations[id];
|
|
23
29
|
/**
|
|
24
30
|
* `ListBoxMenuIcon` is used to orient the icon up or down depending on the
|
|
25
31
|
* state of the menu for a given `ListBox`
|
|
@@ -47,9 +53,7 @@ ListBoxMenuIcon.propTypes = {
|
|
|
47
53
|
*/
|
|
48
54
|
isOpen: PropTypes.bool.isRequired,
|
|
49
55
|
/**
|
|
50
|
-
*
|
|
51
|
-
* icon. This function takes a ListBoxMenuIconTranslationKey and should
|
|
52
|
-
* return a string message for that given message id.
|
|
56
|
+
* Translates component strings using your i18n tool.
|
|
53
57
|
*/
|
|
54
58
|
translateWithId: PropTypes.func
|
|
55
59
|
};
|
|
@@ -27,7 +27,7 @@ var useMergedRefs = require('../../internal/useMergedRefs.js');
|
|
|
27
27
|
* @returns An object containing the truncation state and the merged ref.
|
|
28
28
|
*/
|
|
29
29
|
const useIsTruncated = (forwardedRef,
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
31
31
|
deps = []) => {
|
|
32
32
|
const localRef = React.useRef(null);
|
|
33
33
|
const mergedRef = useMergedRefs.useMergedRefs([...(forwardedRef ? [forwardedRef] : []), localRef]);
|
|
@@ -41,7 +41,7 @@ deps = []) => {
|
|
|
41
41
|
} = element;
|
|
42
42
|
setIsTruncated(offsetWidth < scrollWidth);
|
|
43
43
|
}
|
|
44
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
44
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
45
45
|
}, [localRef, ...deps]);
|
|
46
46
|
return {
|
|
47
47
|
isTruncated,
|
|
@@ -1,12 +1,12 @@
|
|
|
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
7
|
import React from 'react';
|
|
8
8
|
import { KeyboardEvent, MouseEvent } from 'react';
|
|
9
|
-
import { TranslateWithId } from '../../types/common';
|
|
9
|
+
import type { TranslateWithId } from '../../types/common';
|
|
10
10
|
export interface ListBoxSelectionProps extends TranslateWithId<TranslationKey> {
|
|
11
11
|
/**
|
|
12
12
|
* Specify a function to be invoked when a user interacts with the clear
|
|
@@ -33,13 +33,10 @@ export interface ListBoxSelectionProps extends TranslateWithId<TranslationKey> {
|
|
|
33
33
|
selectionCount?: number;
|
|
34
34
|
}
|
|
35
35
|
export type ListBoxSelectionComponent = React.FC<ListBoxSelectionProps>;
|
|
36
|
-
|
|
36
|
+
declare const translationIds: {
|
|
37
37
|
readonly 'clear.all': "clear.all";
|
|
38
38
|
readonly 'clear.selection': "clear.selection";
|
|
39
39
|
};
|
|
40
|
-
/**
|
|
41
|
-
* Message ids that will be passed to translateWithId().
|
|
42
|
-
*/
|
|
43
40
|
type TranslationKey = keyof typeof translationIds;
|
|
44
41
|
/**
|
|
45
42
|
* `ListBoxSelection` is used to provide controls for clearing a selection, in
|
|
@@ -20,16 +20,13 @@ const translationIds = {
|
|
|
20
20
|
'clear.all': 'clear.all',
|
|
21
21
|
'clear.selection': 'clear.selection'
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Message ids that will be passed to translateWithId().
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
23
|
const defaultTranslations = {
|
|
29
24
|
[translationIds['clear.all']]: 'Clear all selected items',
|
|
30
25
|
[translationIds['clear.selection']]: 'Clear selected item'
|
|
31
26
|
};
|
|
32
|
-
const defaultTranslateWithId =
|
|
27
|
+
const defaultTranslateWithId = messageId => {
|
|
28
|
+
return defaultTranslations[messageId];
|
|
29
|
+
};
|
|
33
30
|
|
|
34
31
|
/**
|
|
35
32
|
* `ListBoxSelection` is used to provide controls for clearing a selection, in
|
|
@@ -112,12 +109,9 @@ ListBoxSelection.propTypes = {
|
|
|
112
109
|
*/
|
|
113
110
|
selectionCount: PropTypes.number,
|
|
114
111
|
/**
|
|
115
|
-
*
|
|
116
|
-
* icon. This function takes in an id defined in `translationIds` and should
|
|
117
|
-
* return a string message for that given message id.
|
|
112
|
+
* Translates component strings using your i18n tool.
|
|
118
113
|
*/
|
|
119
114
|
translateWithId: PropTypes.func
|
|
120
115
|
};
|
|
121
116
|
|
|
122
117
|
exports.default = ListBoxSelection;
|
|
123
|
-
exports.translationIds = translationIds;
|
|
@@ -5,12 +5,13 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
export * from './ListBoxPropTypes';
|
|
8
|
+
import type { ComponentProps } from 'react';
|
|
8
9
|
import ListBoxInternal from './ListBox';
|
|
9
10
|
import { ListBoxFieldComponent } from './ListBoxField';
|
|
10
11
|
import ListBoxMenu from './ListBoxMenu';
|
|
11
|
-
import { ListBoxMenuIconComponent } from './ListBoxMenuIcon';
|
|
12
|
+
import ListBoxMenuIcon, { ListBoxMenuIconComponent } from './ListBoxMenuIcon';
|
|
12
13
|
import ListBoxMenuItem from './ListBoxMenuItem';
|
|
13
|
-
import { ListBoxSelectionComponent } from './ListBoxSelection';
|
|
14
|
+
import ListBoxSelection, { ListBoxSelectionComponent } from './ListBoxSelection';
|
|
14
15
|
type ListBoxMenuComponent = typeof ListBoxMenu;
|
|
15
16
|
type ListBoxMenuItemComponent = typeof ListBoxMenuItem;
|
|
16
17
|
type ListBoxPartialComponent = typeof ListBoxInternal;
|
|
@@ -23,4 +24,5 @@ export interface ListBoxComponent extends ListBoxPartialComponent {
|
|
|
23
24
|
}
|
|
24
25
|
declare const ListBox: ListBoxComponent;
|
|
25
26
|
export default ListBox;
|
|
26
|
-
export type
|
|
27
|
+
export type ListBoxMenuIconTranslationKey = Parameters<NonNullable<ComponentProps<typeof ListBoxMenuIcon>['translateWithId']>>[0];
|
|
28
|
+
export type ListBoxSelectionTranslationKey = Parameters<NonNullable<ComponentProps<typeof ListBoxSelection>['translateWithId']>>[0];
|
|
@@ -1,22 +1,23 @@
|
|
|
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
7
|
import React from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
|
+
import type { TranslateWithId } from '../../../types/common';
|
|
9
10
|
/**
|
|
10
11
|
* `ListBoxSelection` is used to provide controls for clearing a selection, in
|
|
11
12
|
* addition to conditionally rendering a badge if the control has more than one
|
|
12
13
|
* selection.
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
|
+
declare const translationIds: {
|
|
15
16
|
readonly 'clear.all': "clear.all";
|
|
16
17
|
readonly 'clear.selection': "clear.selection";
|
|
17
18
|
};
|
|
18
|
-
|
|
19
|
-
export interface ListBoxSelectionProps {
|
|
19
|
+
type TranslationKey = keyof typeof translationIds;
|
|
20
|
+
export interface ListBoxSelectionProps extends TranslateWithId<TranslationKey> {
|
|
20
21
|
/**
|
|
21
22
|
* Specify a function to be invoked when a user interacts with the clear
|
|
22
23
|
* selection element.
|
|
@@ -27,12 +28,6 @@ export interface ListBoxSelectionProps {
|
|
|
27
28
|
* whether the selection should display a badge or a single clear icon.
|
|
28
29
|
*/
|
|
29
30
|
selectionCount?: number;
|
|
30
|
-
/**
|
|
31
|
-
* i18n hook used to provide the appropriate description for the given menu
|
|
32
|
-
* icon. This function takes in an id defined in `translationIds` and should
|
|
33
|
-
* return a string message for that given message id.
|
|
34
|
-
*/
|
|
35
|
-
translateWithId?: (id: TranslationKey) => string;
|
|
36
31
|
/**
|
|
37
32
|
* Specify whether or not the clear selection element should be disabled
|
|
38
33
|
*/
|
|
@@ -104,9 +99,7 @@ declare namespace ListBoxSelection {
|
|
|
104
99
|
*/
|
|
105
100
|
selectionCount: PropTypes.Requireable<number>;
|
|
106
101
|
/**
|
|
107
|
-
*
|
|
108
|
-
* icon. This function takes in an id defined in `translationIds` and should
|
|
109
|
-
* return a string message for that given message id.
|
|
102
|
+
* Translates component strings using your i18n tool.
|
|
110
103
|
*/
|
|
111
104
|
translateWithId: PropTypes.Requireable<(...args: any[]) => any>;
|
|
112
105
|
};
|
|
@@ -17,13 +17,23 @@ var iconsReact = require('@carbon/icons-react');
|
|
|
17
17
|
var usePrefix = require('../../../internal/usePrefix.js');
|
|
18
18
|
|
|
19
19
|
var _Close, _Close2;
|
|
20
|
+
/**
|
|
21
|
+
* `ListBoxSelection` is used to provide controls for clearing a selection, in
|
|
22
|
+
* addition to conditionally rendering a badge if the control has more than one
|
|
23
|
+
* selection.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const translationIds = {
|
|
27
|
+
'clear.all': 'clear.all',
|
|
28
|
+
'clear.selection': 'clear.selection'
|
|
29
|
+
};
|
|
20
30
|
const defaultTranslations = {
|
|
21
|
-
'clear.all': 'Clear all selected items',
|
|
22
|
-
'clear.selection': 'Clear selected item'
|
|
31
|
+
[translationIds['clear.all']]: 'Clear all selected items',
|
|
32
|
+
[translationIds['clear.selection']]: 'Clear selected item'
|
|
33
|
+
};
|
|
34
|
+
const defaultTranslateWithId = messageId => {
|
|
35
|
+
return defaultTranslations[messageId];
|
|
23
36
|
};
|
|
24
|
-
function defaultTranslateWithId(id) {
|
|
25
|
-
return defaultTranslations[id];
|
|
26
|
-
}
|
|
27
37
|
function ListBoxSelection({
|
|
28
38
|
clearSelection,
|
|
29
39
|
selectionCount,
|
|
@@ -120,9 +130,7 @@ ListBoxSelection.propTypes = {
|
|
|
120
130
|
*/
|
|
121
131
|
selectionCount: PropTypes.number,
|
|
122
132
|
/**
|
|
123
|
-
*
|
|
124
|
-
* icon. This function takes in an id defined in `translationIds` and should
|
|
125
|
-
* return a string message for that given message id.
|
|
133
|
+
* Translates component strings using your i18n tool.
|
|
126
134
|
*/
|
|
127
135
|
translateWithId: PropTypes.func
|
|
128
136
|
};
|
|
@@ -1,27 +1,22 @@
|
|
|
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
7
|
import React from 'react';
|
|
8
|
-
|
|
8
|
+
import type { TranslateWithId } from '../../../types/common';
|
|
9
|
+
declare const translationIds: {
|
|
9
10
|
readonly 'close.menu': "close.menu";
|
|
10
11
|
readonly 'open.menu': "open.menu";
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
-
export interface ListBoxTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
13
|
+
type TranslationKey = keyof typeof translationIds;
|
|
14
|
+
export interface ListBoxTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, TranslateWithId<TranslationKey> {
|
|
14
15
|
/**
|
|
15
16
|
* Specify whether the menu is currently open, which will influence the
|
|
16
17
|
* direction of the menu icon
|
|
17
18
|
*/
|
|
18
19
|
isOpen: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* i18n hook used to provide the appropriate description for the given menu
|
|
21
|
-
* icon. This function takes in an id defined in `translationIds` and should
|
|
22
|
-
* return a string message for that given message id.
|
|
23
|
-
*/
|
|
24
|
-
translateWithId?: (id: TranslationKey) => string;
|
|
25
20
|
}
|
|
26
21
|
/**
|
|
27
22
|
* `ListBoxTrigger` is used to orient the icon up or down depending on the
|
|
@@ -25,13 +25,15 @@ const defaultTranslations = {
|
|
|
25
25
|
[translationIds['close.menu']]: 'Close',
|
|
26
26
|
[translationIds['open.menu']]: 'Open'
|
|
27
27
|
};
|
|
28
|
-
const defaultTranslateWithId =
|
|
28
|
+
const defaultTranslateWithId = messageId => {
|
|
29
|
+
return defaultTranslations[messageId];
|
|
30
|
+
};
|
|
29
31
|
/**
|
|
30
32
|
* `ListBoxTrigger` is used to orient the icon up or down depending on the
|
|
31
33
|
* state of the menu for a given `ListBox`
|
|
32
34
|
*/
|
|
33
35
|
|
|
34
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
36
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
35
37
|
const ListBoxTrigger = /*#__PURE__*/React.forwardRef(({
|
|
36
38
|
isOpen,
|
|
37
39
|
translateWithId: t = defaultTranslateWithId,
|
|
@@ -59,12 +61,9 @@ ListBoxTrigger.propTypes = {
|
|
|
59
61
|
*/
|
|
60
62
|
isOpen: PropTypes.bool.isRequired,
|
|
61
63
|
/**
|
|
62
|
-
*
|
|
63
|
-
* icon. This function takes in an id defined in `translationIds` and should
|
|
64
|
-
* return a string message for that given message id.
|
|
64
|
+
* Translates component strings using your i18n tool.
|
|
65
65
|
*/
|
|
66
66
|
translateWithId: PropTypes.func
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
exports.default = ListBoxTrigger;
|
|
70
|
-
exports.translationIds = translationIds;
|
|
@@ -46,7 +46,7 @@ function menuReducer(state, action) {
|
|
|
46
46
|
const MenuContext = /*#__PURE__*/React.createContext({
|
|
47
47
|
state: menuDefaultState,
|
|
48
48
|
// 'dispatch' is populated by the root menu
|
|
49
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
50
50
|
dispatch: _ => {}
|
|
51
51
|
});
|
|
52
52
|
|
|
@@ -344,7 +344,7 @@ const MenuItemRadioGroup = /*#__PURE__*/React.forwardRef(function MenuItemRadioG
|
|
|
344
344
|
onChange,
|
|
345
345
|
defaultValue: defaultSelectedItem ?? {}
|
|
346
346
|
});
|
|
347
|
-
//eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
347
|
+
//eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
348
348
|
function handleClick(item, e) {
|
|
349
349
|
setSelection(item);
|
|
350
350
|
}
|
|
@@ -25,7 +25,7 @@ var mergeRefs = require('../../tools/mergeRefs.js');
|
|
|
25
25
|
|
|
26
26
|
const validButtonKinds = ['primary', 'tertiary', 'ghost'];
|
|
27
27
|
const defaultButtonKind = 'primary';
|
|
28
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
28
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
29
29
|
const MenuButton = /*#__PURE__*/React.forwardRef(({
|
|
30
30
|
children,
|
|
31
31
|
className,
|
|
@@ -44,7 +44,7 @@ const MenuButton = /*#__PURE__*/React.forwardRef(({
|
|
|
44
44
|
const id = useId.useId('MenuButton');
|
|
45
45
|
const prefix = usePrefix.usePrefix();
|
|
46
46
|
const triggerRef = React.useRef(null);
|
|
47
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
48
48
|
let middlewares = [];
|
|
49
49
|
if (!enableOnlyFloatingStyles) {
|
|
50
50
|
middlewares = [react.flip({
|
|
@@ -163,7 +163,7 @@ MenuButton.propTypes = {
|
|
|
163
163
|
/**
|
|
164
164
|
* Specify the type of button to be used as the base for the trigger button.
|
|
165
165
|
*/
|
|
166
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/
|
|
166
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
167
167
|
// @ts-ignore-next-line -- avoid spurious (?) TS2322 error
|
|
168
168
|
kind: PropTypes.oneOf(validButtonKinds),
|
|
169
169
|
/**
|
|
@@ -177,13 +177,13 @@ MenuButton.propTypes = {
|
|
|
177
177
|
/**
|
|
178
178
|
* Specify the size of the button and menu.
|
|
179
179
|
*/
|
|
180
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/
|
|
180
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
181
181
|
// @ts-ignore-next-line -- avoid spurious (?) TS2322 error
|
|
182
182
|
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg']),
|
|
183
183
|
/**
|
|
184
184
|
* Specify the tabIndex of the button.
|
|
185
185
|
*/
|
|
186
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/
|
|
186
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
187
187
|
// @ts-ignore-next-line -- avoid spurious (?) TS2322 error
|
|
188
188
|
tabIndex: PropTypes.number,
|
|
189
189
|
/**
|
|
@@ -22,7 +22,7 @@ var InlineLoading = require('../InlineLoading/InlineLoading.js');
|
|
|
22
22
|
var index$3 = require('../Layer/index.js');
|
|
23
23
|
var requiredIfGivenPropIsTruthy = require('../../prop-types/requiredIfGivenPropIsTruthy.js');
|
|
24
24
|
var wrapFocus = require('../../internal/wrapFocus.js');
|
|
25
|
-
var
|
|
25
|
+
var useResizeObserver = require('../../internal/useResizeObserver.js');
|
|
26
26
|
var useId = require('../../internal/useId.js');
|
|
27
27
|
var useMergedRefs = require('../../internal/useMergedRefs.js');
|
|
28
28
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
@@ -41,7 +41,6 @@ var index$1 = require('../AILabel/index.js');
|
|
|
41
41
|
var utils = require('../../internal/utils.js');
|
|
42
42
|
var warning = require('../../internal/warning.js');
|
|
43
43
|
var ModalPresence = require('./ModalPresence.js');
|
|
44
|
-
var debounce = require('../../node_modules/es-toolkit/dist/compat/function/debounce.js');
|
|
45
44
|
|
|
46
45
|
const ModalSizes = ['xs', 'sm', 'md', 'lg'];
|
|
47
46
|
const invalidOutsideClickMessage = '`<Modal>` prop `preventCloseOnClickOutside` should not be `false` when ' + '`passiveModal` is `false`. Transactional, non-passive Modals should ' + 'not be dissmissable by clicking outside. ' + 'See: https://carbondesignsystem.com/components/modal/usage/#transactional-modal';
|
|
@@ -116,7 +115,6 @@ const ModalDialog = /*#__PURE__*/React.forwardRef(function ModalDialog({
|
|
|
116
115
|
const startTrap = React.useRef(null);
|
|
117
116
|
const endTrap = React.useRef(null);
|
|
118
117
|
const wrapFocusTimeout = React.useRef(null);
|
|
119
|
-
const [isScrollable, setIsScrollable] = React.useState(false);
|
|
120
118
|
const modalInstanceId = `modal-${useId.useId()}`;
|
|
121
119
|
const modalLabelId = `${prefix}--modal-header__label--${modalInstanceId}`;
|
|
122
120
|
const modalHeadingId = `${prefix}--modal-header__heading--${modalInstanceId}`;
|
|
@@ -216,6 +214,11 @@ const ModalDialog = /*#__PURE__*/React.forwardRef(function ModalDialog({
|
|
|
216
214
|
});
|
|
217
215
|
}
|
|
218
216
|
const onSecondaryButtonClick = onSecondarySubmit ? onSecondarySubmit : onRequestClose;
|
|
217
|
+
const {
|
|
218
|
+
height
|
|
219
|
+
} = useResizeObserver.useResizeObserver({
|
|
220
|
+
ref: contentRef
|
|
221
|
+
});
|
|
219
222
|
const modalClasses = cx(`${prefix}--modal`, {
|
|
220
223
|
[`${prefix}--modal-tall`]: !passiveModal,
|
|
221
224
|
'is-visible': enablePresence || open,
|
|
@@ -228,8 +231,15 @@ const ModalDialog = /*#__PURE__*/React.forwardRef(function ModalDialog({
|
|
|
228
231
|
[`${prefix}--modal-container--${size}`]: size,
|
|
229
232
|
[`${prefix}--modal-container--full-width`]: isFullWidth
|
|
230
233
|
});
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* isScrollable is implicitly dependent on height, when height gets updated
|
|
237
|
+
* via `useResizeObserver`, clientHeight and scrollHeight get updated too
|
|
238
|
+
*/
|
|
239
|
+
const isScrollable = !!contentRef.current && contentRef?.current?.scrollHeight > contentRef?.current?.clientHeight;
|
|
231
240
|
const contentClasses = cx(`${prefix}--modal-content`, {
|
|
232
|
-
[`${prefix}--modal-scroll-content`]: hasScrollingContent || isScrollable
|
|
241
|
+
[`${prefix}--modal-scroll-content`]: hasScrollingContent || isScrollable,
|
|
242
|
+
[`${prefix}--modal-scroll-content--no-fade`]: height <= 300
|
|
233
243
|
});
|
|
234
244
|
const footerClasses = cx(`${prefix}--modal-footer`, {
|
|
235
245
|
[`${prefix}--modal-footer--three-button`]: Array.isArray(secondaryButtons) && secondaryButtons.length === 2
|
|
@@ -268,7 +278,7 @@ const ModalDialog = /*#__PURE__*/React.forwardRef(function ModalDialog({
|
|
|
268
278
|
return () => {
|
|
269
279
|
document.removeEventListener('keydown', handleEscapeKey, true);
|
|
270
280
|
};
|
|
271
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
281
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
272
282
|
}, [open]);
|
|
273
283
|
React.useEffect(() => {
|
|
274
284
|
return () => {
|
|
@@ -323,29 +333,13 @@ const ModalDialog = /*#__PURE__*/React.forwardRef(function ModalDialog({
|
|
|
323
333
|
}
|
|
324
334
|
}
|
|
325
335
|
}, [open, selectorPrimaryFocus, danger, prefix, enableDialogElement]);
|
|
326
|
-
useIsomorphicEffect.default(() => {
|
|
327
|
-
if (contentRef.current) {
|
|
328
|
-
setIsScrollable(contentRef.current.scrollHeight > contentRef.current.clientHeight);
|
|
329
|
-
}
|
|
330
|
-
function handler() {
|
|
331
|
-
if (contentRef.current) {
|
|
332
|
-
setIsScrollable(contentRef.current.scrollHeight > contentRef.current.clientHeight);
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
const debouncedHandler = debounce.debounce(handler, 200);
|
|
336
|
-
window.addEventListener('resize', debouncedHandler);
|
|
337
|
-
return () => {
|
|
338
|
-
debouncedHandler.cancel();
|
|
339
|
-
window.removeEventListener('resize', debouncedHandler);
|
|
340
|
-
};
|
|
341
|
-
}, []);
|
|
342
336
|
|
|
343
337
|
// AILabel always size `sm`
|
|
344
338
|
const candidate = slug ?? decorator;
|
|
345
339
|
const candidateIsAILabel = utils.isComponentElement(candidate, index$1.AILabel);
|
|
346
340
|
const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/React.cloneElement(candidate, {
|
|
347
341
|
size: 'sm'
|
|
348
|
-
}) :
|
|
342
|
+
}) : candidate;
|
|
349
343
|
const modalButton = /*#__PURE__*/React.createElement("div", {
|
|
350
344
|
className: `${prefix}--modal-close-button`
|
|
351
345
|
}, /*#__PURE__*/React.createElement(index$2.IconButton, {
|
|
@@ -21,7 +21,7 @@ var keys = require('../../internal/keyboard/keys.js');
|
|
|
21
21
|
var match = require('../../internal/keyboard/match.js');
|
|
22
22
|
|
|
23
23
|
let didWarnAboutDeprecation = false;
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
25
25
|
process.env.NODE_ENV !== 'production';
|
|
26
26
|
class ModalWrapper extends React.Component {
|
|
27
27
|
constructor(...args) {
|
|
@@ -58,7 +58,7 @@ class ModalWrapper extends React.Component {
|
|
|
58
58
|
handleSubmit?.(evt);
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
62
62
|
if(isDev) {
|
|
63
63
|
process.env.NODE_ENV !== "production" ? warning.warning(didWarnAboutDeprecation, '`<ModalWrapper>` has been deprecated in favor of `<ComposedModal/>` and will be removed in the next major version, `@carbon/react@v2.x`') : void 0;
|
|
64
64
|
didWarnAboutDeprecation = true;
|
|
@@ -7,17 +7,9 @@
|
|
|
7
7
|
import { type UseComboboxProps, type UseMultipleSelectionProps } from 'downshift';
|
|
8
8
|
import React, { type FunctionComponent, type ReactElement, type ReactNode } from 'react';
|
|
9
9
|
import { type MultiSelectSortingProps } from './MultiSelectPropTypes';
|
|
10
|
-
import { type ListBoxSize, type ListBoxType } from '../ListBox';
|
|
11
|
-
import { TranslateWithId } from '../../types/common';
|
|
12
|
-
|
|
13
|
-
* Message ids that will be passed to translateWithId().
|
|
14
|
-
* Combination of message ids from ListBox/next/ListBoxSelection.js and
|
|
15
|
-
* ListBox/next/ListBoxTrigger.js, but we can't access those values directly
|
|
16
|
-
* because those components aren't Typescript. (If you try, TranslationKey
|
|
17
|
-
* ends up just being defined as "string".)
|
|
18
|
-
*/
|
|
19
|
-
type TranslationKey = 'close.menu' | 'open.menu' | 'clear.all' | 'clear.selection';
|
|
20
|
-
export interface FilterableMultiSelectProps<ItemType> extends MultiSelectSortingProps<ItemType>, React.RefAttributes<HTMLDivElement>, TranslateWithId<TranslationKey> {
|
|
10
|
+
import { type ListBoxMenuIconTranslationKey, type ListBoxSelectionTranslationKey, type ListBoxSize, type ListBoxType } from '../ListBox';
|
|
11
|
+
import type { TranslateWithId } from '../../types/common';
|
|
12
|
+
export interface FilterableMultiSelectProps<ItemType> extends MultiSelectSortingProps<ItemType>, React.RefAttributes<HTMLDivElement>, TranslateWithId<ListBoxSelectionTranslationKey | ListBoxMenuIconTranslationKey> {
|
|
21
13
|
/**
|
|
22
14
|
* Specify a label to be read by screen readers on the container node
|
|
23
15
|
* @deprecated
|
|
@@ -209,4 +201,3 @@ export declare const FilterableMultiSelect: {
|
|
|
209
201
|
defaultProps?: any;
|
|
210
202
|
displayName?: any;
|
|
211
203
|
};
|
|
212
|
-
export {};
|