@carbon/react 1.99.0 → 1.100.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 +953 -953
- package/es/components/BadgeIndicator/index.d.ts +1 -1
- package/es/components/BadgeIndicator/index.js +8 -6
- package/es/components/Breadcrumb/BreadcrumbItem.d.ts +1 -1
- package/es/components/Breadcrumb/BreadcrumbItem.js +6 -7
- package/es/components/Button/Button.Skeleton.d.ts +28 -2
- package/es/components/Button/Button.js +3 -2
- package/es/components/ChatButton/ChatButton.d.ts +3 -2
- package/es/components/CheckboxGroup/CheckboxGroup.d.ts +60 -2
- package/es/components/ComboBox/ComboBox.d.ts +4 -4
- package/es/components/ComboBox/ComboBox.js +21 -3
- package/es/components/ComposedModal/ComposedModal.d.ts +2 -2
- package/es/components/ContainedList/ContainedList.d.ts +35 -6
- package/es/components/ContainedList/ContainedList.js +3 -1
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +32 -3
- package/es/components/ContainedList/index.d.ts +1 -1
- package/es/components/ContainedList/index.js +4 -1
- package/es/components/DangerButton/DangerButton.d.ts +1 -1
- package/es/components/DataTable/DataTable.d.ts +22 -5
- package/es/components/DataTable/DataTable.js +1 -1
- package/es/components/DataTable/TableExpandRow.d.ts +1 -1
- package/es/components/DataTable/TableExpandRow.js +2 -2
- package/es/components/DataTable/TableHeader.d.ts +1 -1
- package/es/components/DataTable/TableHeader.js +18 -16
- package/es/components/DataTable/TableToolbar.d.ts +25 -1
- package/es/components/DataTable/TableToolbarMenu.d.ts +25 -5
- package/es/components/DataTable/TableToolbarMenu.js +0 -3
- package/es/components/DataTableSkeleton/DataTableSkeleton.d.ts +51 -2
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +6 -0
- package/es/components/DatePicker/DatePicker.d.ts +2 -2
- package/es/components/DatePicker/DatePicker.js +38 -53
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +28 -2
- package/es/components/DatePickerInput/DatePickerInput.d.ts +1 -1
- package/es/components/DatePickerInput/DatePickerInput.js +3 -2
- package/es/components/Dialog/Dialog.d.ts +1 -1
- package/es/components/Dropdown/Dropdown.Skeleton.d.ts +19 -2
- package/es/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
- package/es/components/ExpandableSearch/ExpandableSearch.js +14 -12
- package/es/components/FileUploader/FileUploader.d.ts +1 -1
- package/es/components/FileUploader/FileUploader.js +2 -2
- package/es/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +28 -10
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.d.ts +11 -3
- package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.d.ts +15 -3
- package/es/components/FluidDatePicker/FluidDatePicker.d.ts +2 -2
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.d.ts +11 -3
- package/es/components/FluidForm/FluidForm.d.ts +15 -2
- package/es/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +2 -2
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.d.ts +11 -3
- package/es/components/FluidNumberInput/FluidNumberInput.Skeleton.d.ts +11 -3
- package/es/components/FluidNumberInput/FluidNumberInput.d.ts +1 -1
- package/es/components/FluidSearch/FluidSearch.Skeleton.d.ts +11 -3
- package/es/components/FluidSearch/FluidSearch.d.ts +1 -1
- package/es/components/FluidSearch/FluidSearch.js +3 -3
- package/es/components/FluidSelect/FluidSelect.Skeleton.d.ts +11 -3
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +11 -3
- package/es/components/FluidTextArea/FluidTextArea.d.ts +95 -1
- package/es/components/FluidTextInput/FluidPasswordInput.d.ts +83 -2
- package/es/components/FluidTextInput/FluidTextInput.Skeleton.d.ts +11 -3
- package/es/components/Grid/GridContext.d.ts +19 -1
- package/es/components/IconButton/index.d.ts +1 -1
- package/es/components/IconButton/index.js +2 -2
- package/es/components/Link/Link.js +3 -0
- package/es/components/ListBox/ListBoxField.d.ts +35 -2
- package/es/components/ListBox/ListBoxMenuIcon.d.ts +16 -3
- package/es/components/ListBox/ListBoxMenuItem.d.ts +1 -1
- package/es/components/ListBox/ListBoxSelection.d.ts +34 -3
- package/es/components/Menu/MenuItem.d.ts +2 -2
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +2 -2
- package/es/components/MultiSelect/FilterableMultiSelect.js +22 -13
- package/es/components/MultiSelect/MultiSelect.js +22 -13
- package/es/components/Notification/Notification.d.ts +8 -7
- package/es/components/Notification/Notification.js +0 -1
- package/es/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/es/components/OverflowMenu/OverflowMenu.js +0 -1
- package/es/components/OverflowMenu/index.d.ts +1 -1
- package/es/components/PageHeader/PageHeader.d.ts +3 -3
- package/es/components/Popover/index.js +21 -12
- package/es/components/Search/Search.d.ts +2 -2
- package/es/components/Select/Select.d.ts +1 -1
- package/es/components/Select/Select.js +2 -2
- package/es/components/SkeletonIcon/SkeletonIcon.d.ts +16 -2
- package/es/components/SkeletonText/SkeletonText.d.ts +1 -1
- package/es/components/Tag/Tag.d.ts +1 -1
- package/es/components/Tag/Tag.js +2 -0
- package/es/components/Text/Text.d.ts +1 -1
- package/es/components/Text/Text.js +4 -3
- package/es/components/Text/TextDirection.d.ts +1 -1
- package/es/components/Text/TextDirection.js +1 -3
- package/es/components/Text/TextDirectionContext.d.ts +3 -3
- package/es/components/TextInput/ControlledPasswordInput.d.ts +1 -1
- package/es/components/TextInput/ControlledPasswordInput.js +2 -2
- package/es/components/TextInput/PasswordInput.d.ts +1 -1
- package/es/components/TextInput/PasswordInput.js +2 -2
- package/es/components/TextInput/TextInput.d.ts +1 -1
- package/es/components/TextInput/TextInput.js +2 -2
- package/es/components/Toggle/Toggle.Skeleton.d.ts +9 -3
- package/es/components/Toggletip/index.d.ts +1 -1
- package/es/components/Toggletip/index.js +9 -7
- package/es/components/Tooltip/DefinitionTooltip.d.ts +52 -1
- package/es/components/Tooltip/Tooltip.js +2 -0
- package/es/components/TreeView/TreeNode.d.ts +4 -4
- package/es/components/UIShell/Header.d.ts +20 -3
- package/es/components/UIShell/HeaderGlobalAction.d.ts +2 -2
- package/es/components/UIShell/HeaderName.js +1 -1
- package/es/components/UIShell/Link.d.ts +1 -1
- package/es/components/UIShell/Link.js +14 -14
- package/es/components/UIShell/SideNav.d.ts +3 -3
- package/es/components/UIShell/SideNav.js +26 -25
- package/es/components/UIShell/SideNavDivider.d.ts +11 -3
- package/es/components/UIShell/SideNavHeader.d.ts +24 -1
- package/es/components/UIShell/SideNavIcon.d.ts +20 -2
- package/es/components/UIShell/SideNavItem.d.ts +20 -2
- package/es/components/UIShell/SideNavItems.d.ts +22 -2
- package/es/components/UIShell/SideNavLink.d.ts +1 -1
- package/es/components/UIShell/SideNavLink.js +14 -14
- package/es/components/UIShell/SideNavMenu.d.ts +1 -1
- package/es/components/UIShell/SideNavMenu.js +2 -2
- package/es/components/UIShell/SideNavMenuItem.d.ts +2 -2
- package/es/components/UIShell/SideNavMenuItem.js +2 -2
- package/es/components/UIShell/SwitcherDivider.d.ts +10 -2
- package/es/internal/FloatingMenu.d.ts +1 -1
- package/es/internal/FloatingMenu.js +0 -2
- package/es/internal/PolymorphicProps.d.ts +3 -3
- package/es/internal/useNoInteractiveChildren.d.ts +1 -1
- package/es/internal/useNoInteractiveChildren.js +8 -10
- package/es/internal/useOutsideClick.d.ts +1 -1
- package/es/internal/useOutsideClick.js +0 -4
- package/lib/components/BadgeIndicator/index.d.ts +1 -1
- package/lib/components/BadgeIndicator/index.js +7 -5
- package/lib/components/Breadcrumb/BreadcrumbItem.d.ts +1 -1
- package/lib/components/Breadcrumb/BreadcrumbItem.js +5 -6
- package/lib/components/Button/Button.Skeleton.d.ts +28 -2
- package/lib/components/Button/Button.js +3 -2
- package/lib/components/ChatButton/ChatButton.d.ts +3 -2
- package/lib/components/CheckboxGroup/CheckboxGroup.d.ts +60 -2
- package/lib/components/ComboBox/ComboBox.d.ts +4 -4
- package/lib/components/ComboBox/ComboBox.js +21 -3
- package/lib/components/ComposedModal/ComposedModal.d.ts +2 -2
- package/lib/components/ContainedList/ContainedList.d.ts +35 -6
- package/lib/components/ContainedList/ContainedList.js +3 -1
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +32 -3
- package/lib/components/ContainedList/index.d.ts +1 -1
- package/lib/components/ContainedList/index.js +4 -1
- package/lib/components/DangerButton/DangerButton.d.ts +1 -1
- package/lib/components/DataTable/DataTable.d.ts +22 -5
- package/lib/components/DataTable/DataTable.js +1 -1
- package/lib/components/DataTable/TableExpandRow.d.ts +1 -1
- package/lib/components/DataTable/TableHeader.d.ts +1 -1
- package/lib/components/DataTable/TableHeader.js +17 -15
- package/lib/components/DataTable/TableToolbar.d.ts +25 -1
- package/lib/components/DataTable/TableToolbarMenu.d.ts +25 -5
- package/lib/components/DataTable/TableToolbarMenu.js +0 -3
- package/lib/components/DataTableSkeleton/DataTableSkeleton.d.ts +51 -2
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +6 -0
- package/lib/components/DatePicker/DatePicker.d.ts +2 -2
- package/lib/components/DatePicker/DatePicker.js +37 -52
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +28 -2
- package/lib/components/DatePickerInput/DatePickerInput.d.ts +1 -1
- package/lib/components/DatePickerInput/DatePickerInput.js +2 -1
- package/lib/components/Dialog/Dialog.d.ts +1 -1
- package/lib/components/Dropdown/Dropdown.Skeleton.d.ts +19 -2
- package/lib/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
- package/lib/components/ExpandableSearch/ExpandableSearch.js +13 -11
- package/lib/components/FileUploader/FileUploader.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +28 -10
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.d.ts +11 -3
- package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.d.ts +15 -3
- package/lib/components/FluidDatePicker/FluidDatePicker.d.ts +2 -2
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.d.ts +11 -3
- package/lib/components/FluidForm/FluidForm.d.ts +15 -2
- package/lib/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +2 -2
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.d.ts +11 -3
- package/lib/components/FluidNumberInput/FluidNumberInput.Skeleton.d.ts +11 -3
- package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +1 -1
- package/lib/components/FluidSearch/FluidSearch.Skeleton.d.ts +11 -3
- package/lib/components/FluidSearch/FluidSearch.d.ts +1 -1
- package/lib/components/FluidSearch/FluidSearch.js +2 -2
- package/lib/components/FluidSelect/FluidSelect.Skeleton.d.ts +11 -3
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +11 -3
- package/lib/components/FluidTextArea/FluidTextArea.d.ts +95 -1
- package/lib/components/FluidTextInput/FluidPasswordInput.d.ts +83 -2
- package/lib/components/FluidTextInput/FluidTextInput.Skeleton.d.ts +11 -3
- package/lib/components/Grid/GridContext.d.ts +19 -1
- package/lib/components/IconButton/index.d.ts +1 -1
- package/lib/components/Link/Link.js +3 -0
- package/lib/components/ListBox/ListBoxField.d.ts +35 -2
- package/lib/components/ListBox/ListBoxMenuIcon.d.ts +16 -3
- package/lib/components/ListBox/ListBoxMenuItem.d.ts +1 -1
- package/lib/components/ListBox/ListBoxSelection.d.ts +34 -3
- package/lib/components/Menu/MenuItem.d.ts +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.js +22 -13
- package/lib/components/MultiSelect/MultiSelect.js +22 -13
- package/lib/components/Notification/Notification.d.ts +8 -7
- package/lib/components/Notification/Notification.js +0 -1
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +0 -1
- package/lib/components/OverflowMenu/index.d.ts +1 -1
- package/lib/components/PageHeader/PageHeader.d.ts +3 -3
- package/lib/components/Popover/index.js +19 -10
- package/lib/components/Search/Search.d.ts +2 -2
- package/lib/components/Select/Select.d.ts +1 -1
- package/lib/components/SkeletonIcon/SkeletonIcon.d.ts +16 -2
- package/lib/components/SkeletonText/SkeletonText.d.ts +1 -1
- package/lib/components/Tag/Tag.d.ts +1 -1
- package/lib/components/Tag/Tag.js +2 -0
- package/lib/components/Text/Text.d.ts +1 -1
- package/lib/components/Text/Text.js +3 -2
- package/lib/components/Text/TextDirection.d.ts +1 -1
- package/lib/components/Text/TextDirection.js +1 -3
- package/lib/components/Text/TextDirectionContext.d.ts +3 -3
- package/lib/components/TextInput/ControlledPasswordInput.d.ts +1 -1
- package/lib/components/TextInput/PasswordInput.d.ts +1 -1
- package/lib/components/TextInput/TextInput.d.ts +1 -1
- package/lib/components/Toggle/Toggle.Skeleton.d.ts +9 -3
- package/lib/components/Toggletip/index.d.ts +1 -1
- package/lib/components/Toggletip/index.js +7 -5
- package/lib/components/Tooltip/DefinitionTooltip.d.ts +52 -1
- package/lib/components/Tooltip/Tooltip.js +2 -0
- package/lib/components/TreeView/TreeNode.d.ts +4 -4
- package/lib/components/UIShell/Header.d.ts +20 -3
- package/lib/components/UIShell/HeaderGlobalAction.d.ts +2 -2
- package/lib/components/UIShell/HeaderName.js +1 -1
- package/lib/components/UIShell/Link.d.ts +1 -1
- package/lib/components/UIShell/Link.js +13 -13
- package/lib/components/UIShell/SideNav.d.ts +3 -3
- package/lib/components/UIShell/SideNav.js +25 -24
- package/lib/components/UIShell/SideNavDivider.d.ts +11 -3
- package/lib/components/UIShell/SideNavHeader.d.ts +24 -1
- package/lib/components/UIShell/SideNavIcon.d.ts +20 -2
- package/lib/components/UIShell/SideNavItem.d.ts +20 -2
- package/lib/components/UIShell/SideNavItems.d.ts +22 -2
- package/lib/components/UIShell/SideNavLink.d.ts +1 -1
- package/lib/components/UIShell/SideNavLink.js +14 -14
- package/lib/components/UIShell/SideNavMenu.d.ts +1 -1
- package/lib/components/UIShell/SideNavMenuItem.d.ts +2 -2
- package/lib/components/UIShell/SwitcherDivider.d.ts +10 -2
- package/lib/internal/FloatingMenu.d.ts +1 -1
- package/lib/internal/FloatingMenu.js +0 -2
- package/lib/internal/PolymorphicProps.d.ts +3 -3
- package/lib/internal/useNoInteractiveChildren.d.ts +1 -1
- package/lib/internal/useNoInteractiveChildren.js +8 -10
- package/lib/internal/useOutsideClick.d.ts +1 -1
- package/lib/internal/useOutsideClick.js +0 -4
- package/package.json +7 -7
- package/scss/_carbon-utilities.scss +9 -0
- package/telemetry.yml +0 -1
- package/es/internal/createClassWrapper.d.ts +0 -12
- package/lib/internal/createClassWrapper.d.ts +0 -12
|
@@ -4,13 +4,46 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
7
|
+
import { type HTMLAttributes } from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
8
9
|
export interface ListBoxFieldProps extends HTMLAttributes<HTMLDivElement> {
|
|
9
10
|
/**
|
|
10
11
|
* Specify if the parent <ListBox> is disabled
|
|
11
12
|
*/
|
|
12
13
|
disabled?: boolean;
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
+
/**
|
|
16
|
+
* `ListBoxField` is responsible for creating the containing node for valid
|
|
17
|
+
* elements inside of a field. It also provides a11y-related attributes like
|
|
18
|
+
* `role` to make sure a user can focus the given field.
|
|
19
|
+
*/
|
|
20
|
+
declare function ListBoxField({ children, disabled, tabIndex, ...rest }: ListBoxFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
declare namespace ListBoxField {
|
|
22
|
+
var propTypes: {
|
|
23
|
+
/**
|
|
24
|
+
* Typically set by `getToggleButtonProps`, this should specify whether the
|
|
25
|
+
* field has a popup.
|
|
26
|
+
*/
|
|
27
|
+
'aria-haspopup': PropTypes.Requireable<NonNullable<string | boolean | null | undefined>>;
|
|
28
|
+
/**
|
|
29
|
+
* Provide the contents of your ListBoxField
|
|
30
|
+
*/
|
|
31
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
32
|
+
/**
|
|
33
|
+
* Specify if the parent <ListBox> is disabled
|
|
34
|
+
*/
|
|
35
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
36
|
+
/**
|
|
37
|
+
* The role for the component, should be set by `getToggleButtonProps` coming
|
|
38
|
+
* from Downshift
|
|
39
|
+
*/
|
|
40
|
+
role: PropTypes.Requireable<string>;
|
|
41
|
+
/**
|
|
42
|
+
* Optional prop to specify the tabIndex of the <ListBox> trigger button
|
|
43
|
+
*/
|
|
44
|
+
tabIndex: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export type ListBoxFieldComponent = typeof ListBoxField;
|
|
15
48
|
declare const _default: ListBoxFieldComponent;
|
|
16
49
|
export default _default;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
8
|
import type { TranslateWithId } from '../../types/common';
|
|
9
9
|
declare const translationIds: {
|
|
10
10
|
readonly 'close.menu': "close.menu";
|
|
@@ -18,10 +18,23 @@ export interface ListBoxMenuIconProps extends TranslateWithId<TranslationKey> {
|
|
|
18
18
|
*/
|
|
19
19
|
isOpen: boolean;
|
|
20
20
|
}
|
|
21
|
-
export type ListBoxMenuIconComponent =
|
|
21
|
+
export type ListBoxMenuIconComponent = typeof ListBoxMenuIcon;
|
|
22
22
|
/**
|
|
23
23
|
* `ListBoxMenuIcon` is used to orient the icon up or down depending on the
|
|
24
24
|
* state of the menu for a given `ListBox`
|
|
25
25
|
*/
|
|
26
|
-
declare const ListBoxMenuIcon:
|
|
26
|
+
declare const ListBoxMenuIcon: {
|
|
27
|
+
({ isOpen, translateWithId: t, }: ListBoxMenuIconProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
propTypes: {
|
|
29
|
+
/**
|
|
30
|
+
* Specify whether the menu is currently open, which will influence the
|
|
31
|
+
* direction of the menu icon
|
|
32
|
+
*/
|
|
33
|
+
isOpen: PropTypes.Validator<boolean>;
|
|
34
|
+
/**
|
|
35
|
+
* Translates component strings using your i18n tool.
|
|
36
|
+
*/
|
|
37
|
+
translateWithId: PropTypes.Requireable<(...args: any[]) => any>;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
27
40
|
export default ListBoxMenuIcon;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
8
|
import { KeyboardEvent, MouseEvent } from 'react';
|
|
9
9
|
import type { TranslateWithId } from '../../types/common';
|
|
10
10
|
export interface ListBoxSelectionProps extends TranslateWithId<TranslationKey> {
|
|
@@ -32,7 +32,7 @@ export interface ListBoxSelectionProps extends TranslateWithId<TranslationKey> {
|
|
|
32
32
|
*/
|
|
33
33
|
selectionCount?: number;
|
|
34
34
|
}
|
|
35
|
-
export type ListBoxSelectionComponent =
|
|
35
|
+
export type ListBoxSelectionComponent = typeof ListBoxSelection;
|
|
36
36
|
declare const translationIds: {
|
|
37
37
|
readonly 'clear.all': "clear.all";
|
|
38
38
|
readonly 'clear.selection': "clear.selection";
|
|
@@ -43,5 +43,36 @@ type TranslationKey = keyof typeof translationIds;
|
|
|
43
43
|
* addition to conditionally rendering a badge if the control has more than one
|
|
44
44
|
* selection.
|
|
45
45
|
*/
|
|
46
|
-
declare const ListBoxSelection:
|
|
46
|
+
declare const ListBoxSelection: {
|
|
47
|
+
({ clearSelection, selectionCount, translateWithId: t, disabled, onClearSelection, readOnly, }: ListBoxSelectionProps): import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
propTypes: {
|
|
49
|
+
/**
|
|
50
|
+
* Specify a function to be invoked when a user interacts with the clear
|
|
51
|
+
* selection element.
|
|
52
|
+
*/
|
|
53
|
+
clearSelection: PropTypes.Validator<(...args: any[]) => any>;
|
|
54
|
+
/**
|
|
55
|
+
* Specify whether or not the clear selection element should be disabled
|
|
56
|
+
*/
|
|
57
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
58
|
+
/**
|
|
59
|
+
* Specify an optional `onClearSelection` handler that is called when the underlying
|
|
60
|
+
* element is cleared
|
|
61
|
+
*/
|
|
62
|
+
onClearSelection: PropTypes.Requireable<(...args: any[]) => any>;
|
|
63
|
+
/**
|
|
64
|
+
* Whether or not the Dropdown is readonly
|
|
65
|
+
*/
|
|
66
|
+
readOnly: PropTypes.Requireable<boolean>;
|
|
67
|
+
/**
|
|
68
|
+
* Specify an optional `selectionCount` value that will be used to determine
|
|
69
|
+
* whether the selection should display a badge or a single clear icon.
|
|
70
|
+
*/
|
|
71
|
+
selectionCount: PropTypes.Requireable<number>;
|
|
72
|
+
/**
|
|
73
|
+
* Translates component strings using your i18n tool.
|
|
74
|
+
*/
|
|
75
|
+
translateWithId: PropTypes.Requireable<(...args: any[]) => any>;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
47
78
|
export default ListBoxSelection;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import React, { ComponentProps,
|
|
7
|
+
import React, { type ComponentProps, type ElementType, type KeyboardEvent, type LiHTMLAttributes, type MouseEvent, type ReactNode } from 'react';
|
|
8
8
|
export interface MenuItemProps extends LiHTMLAttributes<HTMLLIElement> {
|
|
9
9
|
/**
|
|
10
10
|
* Optionally provide another Menu to create a submenu. props.children can't be used to specify the content of the MenuItem itself. Use props.label instead.
|
|
@@ -33,7 +33,7 @@ export interface MenuItemProps extends LiHTMLAttributes<HTMLLIElement> {
|
|
|
33
33
|
/**
|
|
34
34
|
* A component used to render an icon.
|
|
35
35
|
*/
|
|
36
|
-
renderIcon?:
|
|
36
|
+
renderIcon?: ElementType;
|
|
37
37
|
/**
|
|
38
38
|
* Provide a shortcut for the action of this MenuItem. Note that the component will only render it as a hint but not actually register the shortcut.
|
|
39
39
|
*/
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { type UseComboboxProps, type UseMultipleSelectionProps } from 'downshift';
|
|
8
|
-
import React, { type
|
|
8
|
+
import React, { type ReactElement, type ReactNode } from 'react';
|
|
9
9
|
import { type MultiSelectSortingProps } from './MultiSelectPropTypes';
|
|
10
10
|
import { type ListBoxMenuIconTranslationKey, type ListBoxSelectionTranslationKey, type ListBoxSize, type ListBoxType } from '../ListBox';
|
|
11
11
|
import type { TranslateWithId } from '../../types/common';
|
|
@@ -93,7 +93,7 @@ export interface FilterableMultiSelectProps<ItemType> extends MultiSelectSorting
|
|
|
93
93
|
* Function to render items as custom components instead of strings.
|
|
94
94
|
* Defaults to null and is overridden by a getter
|
|
95
95
|
*/
|
|
96
|
-
itemToElement?:
|
|
96
|
+
itemToElement?: (item: ItemType) => ReactNode;
|
|
97
97
|
/**
|
|
98
98
|
* Helper function passed to downshift that allows the library to render
|
|
99
99
|
* a given item to a string label.
|
|
@@ -33,6 +33,7 @@ import { useFloating, autoUpdate, flip, size, hide } from '@floating-ui/react';
|
|
|
33
33
|
import { AILabel } from '../AILabel/index.js';
|
|
34
34
|
import { defaultItemToString } from '../../internal/defaultItemToString.js';
|
|
35
35
|
import { isComponentElement } from '../../internal/utils.js';
|
|
36
|
+
import { useNormalizedInputProps } from '../../internal/useNormalizedInputProps.js';
|
|
36
37
|
import { ListBoxTypePropType, ListBoxSizePropType } from '../ListBox/ListBoxPropTypes.js';
|
|
37
38
|
|
|
38
39
|
const {
|
|
@@ -71,7 +72,7 @@ const FilterableMultiSelect = /*#__PURE__*/forwardRef(function FilterableMultiSe
|
|
|
71
72
|
hideLabel,
|
|
72
73
|
id,
|
|
73
74
|
initialSelectedItems = [],
|
|
74
|
-
invalid,
|
|
75
|
+
invalid = false,
|
|
75
76
|
invalidText,
|
|
76
77
|
items,
|
|
77
78
|
itemToElement: ItemToElement,
|
|
@@ -93,7 +94,7 @@ const FilterableMultiSelect = /*#__PURE__*/forwardRef(function FilterableMultiSe
|
|
|
93
94
|
sortItems = defaultSortItems,
|
|
94
95
|
translateWithId,
|
|
95
96
|
useTitleInItem,
|
|
96
|
-
warn,
|
|
97
|
+
warn = false,
|
|
97
98
|
warnText,
|
|
98
99
|
slug,
|
|
99
100
|
inputProps
|
|
@@ -237,15 +238,23 @@ const FilterableMultiSelect = /*#__PURE__*/forwardRef(function FilterableMultiSe
|
|
|
237
238
|
return sortedReal;
|
|
238
239
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
239
240
|
}, [items, inputValue, controlledSelectedItems, topItems, selectionFeedback, itemToString, compareItems, locale, sortItems, nonSelectAllItems]);
|
|
241
|
+
const normalizedProps = useNormalizedInputProps({
|
|
242
|
+
id,
|
|
243
|
+
disabled,
|
|
244
|
+
readOnly,
|
|
245
|
+
invalid,
|
|
246
|
+
warn
|
|
247
|
+
});
|
|
240
248
|
const inline = type === 'inline';
|
|
241
|
-
const showWarning =
|
|
249
|
+
const showWarning = normalizedProps.warn;
|
|
250
|
+
const showHelperText = !normalizedProps.warn && !normalizedProps.invalid;
|
|
242
251
|
const wrapperClasses = cx(`${prefix}--multi-select__wrapper`, `${prefix}--multi-select--filterable__wrapper`, `${prefix}--list-box__wrapper`, containerClassName, {
|
|
243
252
|
[`${prefix}--multi-select__wrapper--inline`]: inline,
|
|
244
253
|
[`${prefix}--list-box__wrapper--inline`]: inline,
|
|
245
|
-
[`${prefix}--multi-select__wrapper--inline--invalid`]: inline && invalid,
|
|
246
|
-
[`${prefix}--list-box__wrapper--inline--invalid`]: inline && invalid,
|
|
254
|
+
[`${prefix}--multi-select__wrapper--inline--invalid`]: inline && normalizedProps.invalid,
|
|
255
|
+
[`${prefix}--list-box__wrapper--inline--invalid`]: inline && normalizedProps.invalid,
|
|
247
256
|
[`${prefix}--list-box--up`]: direction === 'top',
|
|
248
|
-
[`${prefix}--list-box__wrapper--fluid--invalid`]: isFluid && invalid,
|
|
257
|
+
[`${prefix}--list-box__wrapper--fluid--invalid`]: isFluid && normalizedProps.invalid,
|
|
249
258
|
[`${prefix}--list-box__wrapper--slug`]: slug,
|
|
250
259
|
[`${prefix}--list-box__wrapper--decorator`]: decorator,
|
|
251
260
|
[`${prefix}--autoalign`]: autoAlign
|
|
@@ -519,8 +528,8 @@ const FilterableMultiSelect = /*#__PURE__*/forwardRef(function FilterableMultiSe
|
|
|
519
528
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
520
529
|
item => !item.isSelectAll).length;
|
|
521
530
|
const className = cx(`${prefix}--multi-select`, `${prefix}--combo-box`, `${prefix}--multi-select--filterable`, {
|
|
522
|
-
[`${prefix}--multi-select--invalid`]: invalid,
|
|
523
|
-
[`${prefix}--multi-select--invalid--focused`]:
|
|
531
|
+
[`${prefix}--multi-select--invalid`]: normalizedProps.invalid,
|
|
532
|
+
[`${prefix}--multi-select--invalid--focused`]: inputFocused && normalizedProps.invalid,
|
|
524
533
|
[`${prefix}--multi-select--open`]: isOpen,
|
|
525
534
|
[`${prefix}--multi-select--inline`]: inline,
|
|
526
535
|
[`${prefix}--multi-select--selected`]: controlledSelectedItems?.length > 0,
|
|
@@ -552,7 +561,7 @@ const FilterableMultiSelect = /*#__PURE__*/forwardRef(function FilterableMultiSe
|
|
|
552
561
|
});
|
|
553
562
|
const inputProp = getInputProps(getDropdownProps({
|
|
554
563
|
'aria-controls': isOpen ? menuId : undefined,
|
|
555
|
-
'aria-describedby': helperText &&
|
|
564
|
+
'aria-describedby': helperText && showHelperText ? helperId : undefined,
|
|
556
565
|
'aria-haspopup': 'listbox',
|
|
557
566
|
// Remove excess aria `aria-labelledby`. HTML <label for>
|
|
558
567
|
// provides this aria information.
|
|
@@ -647,9 +656,9 @@ const FilterableMultiSelect = /*#__PURE__*/forwardRef(function FilterableMultiSe
|
|
|
647
656
|
light: light,
|
|
648
657
|
ref: ref,
|
|
649
658
|
id: id,
|
|
650
|
-
invalid: invalid,
|
|
659
|
+
invalid: normalizedProps.invalid,
|
|
651
660
|
invalidText: invalidText,
|
|
652
|
-
warn: warn,
|
|
661
|
+
warn: normalizedProps.warn,
|
|
653
662
|
warnText: warnText,
|
|
654
663
|
isOpen: !readOnly && isOpen,
|
|
655
664
|
size: size$1
|
|
@@ -673,7 +682,7 @@ const FilterableMultiSelect = /*#__PURE__*/forwardRef(function FilterableMultiSe
|
|
|
673
682
|
ref: mergedRef
|
|
674
683
|
}, readOnlyEventHandlers, {
|
|
675
684
|
readOnly: readOnly
|
|
676
|
-
})), invalid && /*#__PURE__*/React.createElement(WarningFilled, {
|
|
685
|
+
})), normalizedProps.invalid && /*#__PURE__*/React.createElement(WarningFilled, {
|
|
677
686
|
className: `${prefix}--list-box__invalid-icon`
|
|
678
687
|
}), showWarning && /*#__PURE__*/React.createElement(WarningAltFilled, {
|
|
679
688
|
className: `${prefix}--list-box__invalid-icon ${prefix}--list-box__invalid-icon--warning`
|
|
@@ -742,7 +751,7 @@ const FilterableMultiSelect = /*#__PURE__*/forwardRef(function FilterableMultiSe
|
|
|
742
751
|
disabled: disabled,
|
|
743
752
|
tabIndex: -1
|
|
744
753
|
})));
|
|
745
|
-
}) : null)), !inline &&
|
|
754
|
+
}) : null)), !inline && showHelperText ? helper : null);
|
|
746
755
|
});
|
|
747
756
|
FilterableMultiSelect.displayName = 'FilterableMultiSelect';
|
|
748
757
|
FilterableMultiSelect.propTypes = {
|
|
@@ -32,6 +32,7 @@ import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
|
32
32
|
import { AILabel } from '../AILabel/index.js';
|
|
33
33
|
import { defaultItemToString } from '../../internal/defaultItemToString.js';
|
|
34
34
|
import { isComponentElement } from '../../internal/utils.js';
|
|
35
|
+
import { useNormalizedInputProps } from '../../internal/useNormalizedInputProps.js';
|
|
35
36
|
import { ListBoxTypePropType, ListBoxSizePropType } from '../ListBox/ListBoxPropTypes.js';
|
|
36
37
|
|
|
37
38
|
const {
|
|
@@ -71,9 +72,9 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
71
72
|
clearAnnouncement = 'all items have been cleared',
|
|
72
73
|
clearSelectionDescription = 'Total items selected: ',
|
|
73
74
|
light,
|
|
74
|
-
invalid,
|
|
75
|
+
invalid = false,
|
|
75
76
|
invalidText,
|
|
76
|
-
warn,
|
|
77
|
+
warn = false,
|
|
77
78
|
warnText,
|
|
78
79
|
useTitleInItem,
|
|
79
80
|
translateWithId,
|
|
@@ -254,14 +255,22 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
254
255
|
setIsOpenWrapper(open);
|
|
255
256
|
setPrevOpenProp(open);
|
|
256
257
|
}
|
|
258
|
+
const normalizedProps = useNormalizedInputProps({
|
|
259
|
+
id,
|
|
260
|
+
disabled,
|
|
261
|
+
readOnly,
|
|
262
|
+
invalid,
|
|
263
|
+
warn
|
|
264
|
+
});
|
|
257
265
|
const inline = type === 'inline';
|
|
258
|
-
const showWarning =
|
|
266
|
+
const showWarning = normalizedProps.warn;
|
|
267
|
+
const showHelperText = !normalizedProps.warn && !normalizedProps.invalid && helperText;
|
|
259
268
|
const wrapperClasses = cx(`${prefix}--multi-select__wrapper`, `${prefix}--list-box__wrapper`, containerClassName, {
|
|
260
269
|
[`${prefix}--multi-select__wrapper--inline`]: inline,
|
|
261
270
|
[`${prefix}--list-box__wrapper--inline`]: inline,
|
|
262
|
-
[`${prefix}--multi-select__wrapper--inline--invalid`]: inline && invalid,
|
|
263
|
-
[`${prefix}--list-box__wrapper--inline--invalid`]: inline && invalid,
|
|
264
|
-
[`${prefix}--list-box__wrapper--fluid--invalid`]: isFluid && invalid,
|
|
271
|
+
[`${prefix}--multi-select__wrapper--inline--invalid`]: inline && normalizedProps.invalid,
|
|
272
|
+
[`${prefix}--list-box__wrapper--inline--invalid`]: inline && normalizedProps.invalid,
|
|
273
|
+
[`${prefix}--list-box__wrapper--fluid--invalid`]: isFluid && normalizedProps.invalid,
|
|
265
274
|
[`${prefix}--list-box__wrapper--slug`]: slug,
|
|
266
275
|
[`${prefix}--list-box__wrapper--decorator`]: decorator
|
|
267
276
|
});
|
|
@@ -275,8 +284,8 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
275
284
|
[`${prefix}--form__helper-text--disabled`]: disabled
|
|
276
285
|
});
|
|
277
286
|
const className = cx(`${prefix}--multi-select`, {
|
|
278
|
-
[`${prefix}--multi-select--invalid`]: invalid,
|
|
279
|
-
[`${prefix}--multi-select--invalid--focused`]:
|
|
287
|
+
[`${prefix}--multi-select--invalid`]: normalizedProps.invalid,
|
|
288
|
+
[`${prefix}--multi-select--invalid--focused`]: inputFocused && normalizedProps.invalid,
|
|
280
289
|
[`${prefix}--multi-select--warning`]: showWarning,
|
|
281
290
|
[`${prefix}--multi-select--inline`]: inline,
|
|
282
291
|
[`${prefix}--multi-select--selected`]: selectedItems && selectedItems.length > 0,
|
|
@@ -447,13 +456,13 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
447
456
|
className: className,
|
|
448
457
|
disabled: disabled,
|
|
449
458
|
light: light,
|
|
450
|
-
invalid: invalid,
|
|
459
|
+
invalid: normalizedProps.invalid,
|
|
451
460
|
invalidText: invalidText,
|
|
452
|
-
warn: warn,
|
|
461
|
+
warn: normalizedProps.warn,
|
|
453
462
|
warnText: warnText,
|
|
454
463
|
isOpen: isOpen,
|
|
455
464
|
id: id
|
|
456
|
-
}, invalid && /*#__PURE__*/React.createElement(WarningFilled, {
|
|
465
|
+
}, normalizedProps.invalid && /*#__PURE__*/React.createElement(WarningFilled, {
|
|
457
466
|
className: `${prefix}--list-box__invalid-icon`
|
|
458
467
|
}), showWarning && /*#__PURE__*/React.createElement(WarningAltFilled, {
|
|
459
468
|
className: `${prefix}--list-box__invalid-icon ${prefix}--list-box__invalid-icon--warning`
|
|
@@ -473,7 +482,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
473
482
|
className: `${prefix}--list-box__field`,
|
|
474
483
|
disabled: disabled,
|
|
475
484
|
"aria-disabled": disabled || readOnly,
|
|
476
|
-
"aria-describedby": !inline &&
|
|
485
|
+
"aria-describedby": !inline && showHelperText ? helperId : undefined
|
|
477
486
|
}, toggleButtonProps, {
|
|
478
487
|
ref: mergedRef
|
|
479
488
|
}, readOnlyEventHandlers), /*#__PURE__*/React.createElement("span", {
|
|
@@ -528,7 +537,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
528
537
|
})), itemsCleared && /*#__PURE__*/React.createElement("span", {
|
|
529
538
|
"aria-live": "assertive",
|
|
530
539
|
"aria-label": clearAnnouncement
|
|
531
|
-
})), !inline &&
|
|
540
|
+
})), !inline && showHelperText && /*#__PURE__*/React.createElement("div", {
|
|
532
541
|
id: helperId,
|
|
533
542
|
className: helperClasses
|
|
534
543
|
}, helperText));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2026
|
|
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.
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import React, { type ReactNode, type MouseEvent, type ButtonHTMLAttributes, type HTMLAttributes, type ComponentProps } from 'react';
|
|
9
9
|
import Button, { type ButtonProps } from '../Button';
|
|
10
|
+
type NotificationCloseHandler = ((event: MouseEvent) => boolean) | ((event: MouseEvent) => void);
|
|
10
11
|
export interface NotificationActionButtonProps extends ButtonProps<'button'> {
|
|
11
12
|
/**
|
|
12
13
|
* Specify the content of the notification action button.
|
|
@@ -151,7 +152,7 @@ export interface ToastNotificationProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
151
152
|
/**
|
|
152
153
|
* Provide a function that is called when menu is closed
|
|
153
154
|
*/
|
|
154
|
-
onClose
|
|
155
|
+
onClose?: NotificationCloseHandler;
|
|
155
156
|
/**
|
|
156
157
|
* Provide a function that is called when the close button is clicked
|
|
157
158
|
*/
|
|
@@ -277,7 +278,7 @@ export interface InlineNotificationProps extends HTMLAttributes<HTMLDivElement>
|
|
|
277
278
|
/**
|
|
278
279
|
* Provide a function that is called when menu is closed
|
|
279
280
|
*/
|
|
280
|
-
onClose
|
|
281
|
+
onClose?: NotificationCloseHandler;
|
|
281
282
|
/**
|
|
282
283
|
* Provide a function that is called when the close button is clicked
|
|
283
284
|
*/
|
|
@@ -409,7 +410,7 @@ export interface ActionableNotificationProps extends HTMLAttributes<HTMLDivEleme
|
|
|
409
410
|
* Provide a function that is called when menu is closed.
|
|
410
411
|
* Default behavior of hiding the notification is prevented if this function returns false.
|
|
411
412
|
*/
|
|
412
|
-
onClose
|
|
413
|
+
onClose?: NotificationCloseHandler;
|
|
413
414
|
/**
|
|
414
415
|
* Provide a function that is called when the close button is clicked
|
|
415
416
|
*/
|
|
@@ -617,6 +618,6 @@ export declare namespace Callout {
|
|
|
617
618
|
/**
|
|
618
619
|
* @deprecated Use `CalloutProps` instead.
|
|
619
620
|
*/
|
|
620
|
-
export
|
|
621
|
-
|
|
622
|
-
export
|
|
621
|
+
export type StaticNotificationProps = CalloutProps;
|
|
622
|
+
export declare const StaticNotification: (props: StaticNotificationProps) => import("react/jsx-runtime").JSX.Element;
|
|
623
|
+
export {};
|
|
@@ -810,7 +810,6 @@ Callout.propTypes = {
|
|
|
810
810
|
/**
|
|
811
811
|
* @deprecated Use `CalloutProps` instead.
|
|
812
812
|
*/
|
|
813
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
814
813
|
|
|
815
814
|
let didWarnAboutDeprecation = false;
|
|
816
815
|
const StaticNotification = props => {
|
|
@@ -75,7 +75,6 @@ const getMenuOffset = (menuBody, direction, trigger, flip) => {
|
|
|
75
75
|
case 'top':
|
|
76
76
|
case 'bottom':
|
|
77
77
|
{
|
|
78
|
-
// TODO: Ensure `trigger` is there for `<OverflowMenu open>`
|
|
79
78
|
const triggerWidth = !trigger ? 0 : trigger.offsetWidth;
|
|
80
79
|
return {
|
|
81
80
|
left: (!flip ? 1 : -1) * (menuWidth / 2 - triggerWidth / 2),
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import React, { type
|
|
7
|
+
import React, { type ElementType } from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { TYPES } from '../Tag/Tag';
|
|
10
10
|
/**
|
|
@@ -32,7 +32,7 @@ interface PageHeaderBreadcrumbBarProps {
|
|
|
32
32
|
/**
|
|
33
33
|
* Provide an optional icon to render in front of the PageHeaderContent's title.
|
|
34
34
|
*/
|
|
35
|
-
renderIcon?:
|
|
35
|
+
renderIcon?: ElementType;
|
|
36
36
|
/**
|
|
37
37
|
* The PageHeaderBreadcrumbBar's content actions
|
|
38
38
|
*/
|
|
@@ -68,7 +68,7 @@ interface PageHeaderContentProps {
|
|
|
68
68
|
/**
|
|
69
69
|
* Provide an optional icon to render in front of the PageHeaderContent's title.
|
|
70
70
|
*/
|
|
71
|
-
renderIcon?:
|
|
71
|
+
renderIcon?: ElementType;
|
|
72
72
|
/**
|
|
73
73
|
* The PageHeaderContent's title
|
|
74
74
|
*/
|
|
@@ -9,13 +9,13 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import { deprecateValuesWithin } from '../../prop-types/deprecateValuesWithin.js';
|
|
12
|
-
import React, {
|
|
12
|
+
import React, { forwardRef, useRef, useEffect, useMemo } from 'react';
|
|
13
13
|
import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
|
|
14
14
|
import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
15
15
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
16
16
|
import { useEvent, useWindowEvent } from '../../internal/useEvent.js';
|
|
17
17
|
import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
|
|
18
|
-
import { useFloating,
|
|
18
|
+
import { useFloating, offset, flip, arrow, hide, autoUpdate } from '@floating-ui/react';
|
|
19
19
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
20
20
|
|
|
21
21
|
const PopoverContext = /*#__PURE__*/React.createContext({
|
|
@@ -147,7 +147,9 @@ forwardRef) {
|
|
|
147
147
|
refs,
|
|
148
148
|
floatingStyles,
|
|
149
149
|
placement,
|
|
150
|
-
middlewareData
|
|
150
|
+
middlewareData,
|
|
151
|
+
elements,
|
|
152
|
+
update
|
|
151
153
|
} = useFloating(enableFloatingStyles ? {
|
|
152
154
|
placement: align,
|
|
153
155
|
// The floating element is positioned relative to its nearest
|
|
@@ -167,12 +169,18 @@ forwardRef) {
|
|
|
167
169
|
}), arrow({
|
|
168
170
|
element: caretRef,
|
|
169
171
|
padding: 16
|
|
170
|
-
}), autoAlign && hide()]
|
|
171
|
-
whileElementsMounted: autoUpdate
|
|
172
|
+
}), autoAlign && hide()]
|
|
172
173
|
} : {}
|
|
173
174
|
// When autoAlign is turned off & the `enable-v12-dynamic-floating-styles` feature flag is not
|
|
174
175
|
// enabled, floating-ui will not be used
|
|
175
176
|
);
|
|
177
|
+
useEffect(() => {
|
|
178
|
+
if (!enableFloatingStyles) return;
|
|
179
|
+
if (open && elements.reference && elements.floating) {
|
|
180
|
+
const cleanup = autoUpdate(elements.reference, elements.floating, update);
|
|
181
|
+
return cleanup;
|
|
182
|
+
}
|
|
183
|
+
}, [enableFloatingStyles, open, elements, update]);
|
|
176
184
|
const value = useMemo(() => {
|
|
177
185
|
return {
|
|
178
186
|
floating,
|
|
@@ -397,11 +405,13 @@ Popover.propTypes = {
|
|
|
397
405
|
*/
|
|
398
406
|
open: PropTypes.bool.isRequired
|
|
399
407
|
};
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
408
|
+
const frFn = forwardRef;
|
|
409
|
+
const PopoverContent = frFn((props, forwardRef) => {
|
|
410
|
+
const {
|
|
411
|
+
className,
|
|
412
|
+
children,
|
|
413
|
+
...rest
|
|
414
|
+
} = props;
|
|
405
415
|
const prefix = usePrefix();
|
|
406
416
|
const {
|
|
407
417
|
setFloating,
|
|
@@ -427,8 +437,7 @@ function PopoverContentRenderFunction({
|
|
|
427
437
|
}),
|
|
428
438
|
ref: caretRef
|
|
429
439
|
}));
|
|
430
|
-
}
|
|
431
|
-
const PopoverContent = /*#__PURE__*/React.forwardRef(PopoverContentRenderFunction);
|
|
440
|
+
});
|
|
432
441
|
PopoverContent.displayName = 'PopoverContent';
|
|
433
442
|
PopoverContent.propTypes = {
|
|
434
443
|
/**
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import React, { type ChangeEvent, type
|
|
7
|
+
import React, { type ChangeEvent, type ElementType, type HTMLAttributes, type KeyboardEvent, type MouseEvent, type ReactNode } from 'react';
|
|
8
8
|
type InputPropsBase = Omit<HTMLAttributes<HTMLInputElement>, 'onChange'>;
|
|
9
9
|
export interface SearchProps extends InputPropsBase {
|
|
10
10
|
/**
|
|
@@ -61,7 +61,7 @@ export interface SearchProps extends InputPropsBase {
|
|
|
61
61
|
/**
|
|
62
62
|
* A component used to render an icon.
|
|
63
63
|
*/
|
|
64
|
-
renderIcon?:
|
|
64
|
+
renderIcon?: ElementType;
|
|
65
65
|
/**
|
|
66
66
|
* @deprecated Specify the role for the underlying `<input>`.
|
|
67
67
|
* No longer needed since `<input type="search">` already provides the correct semantics.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import React, { useContext, useState, cloneElement } from 'react';
|
|
10
|
+
import React, { forwardRef, useContext, useState, cloneElement } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { ChevronDown, WarningFilled, WarningAltFilled } from '@carbon/icons-react';
|
|
13
13
|
import { deprecate } from '../../prop-types/deprecate.js';
|
|
@@ -21,7 +21,7 @@ import { AILabel } from '../AILabel/index.js';
|
|
|
21
21
|
import { isComponentElement } from '../../internal/utils.js';
|
|
22
22
|
import { useNormalizedInputProps } from '../../internal/useNormalizedInputProps.js';
|
|
23
23
|
|
|
24
|
-
const Select = /*#__PURE__*/
|
|
24
|
+
const Select = /*#__PURE__*/forwardRef(({
|
|
25
25
|
className,
|
|
26
26
|
decorator,
|
|
27
27
|
id,
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
2
8
|
export interface SkeletonIconProps {
|
|
3
9
|
/**
|
|
4
10
|
* Specify an optional className to add.
|
|
5
11
|
*/
|
|
6
12
|
className?: string;
|
|
7
13
|
}
|
|
8
|
-
declare const SkeletonIcon:
|
|
14
|
+
declare const SkeletonIcon: {
|
|
15
|
+
({ className, ...other }: SkeletonIconProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
propTypes: {
|
|
17
|
+
/**
|
|
18
|
+
* Specify an optional className to add.
|
|
19
|
+
*/
|
|
20
|
+
className: PropTypes.Requireable<string>;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
9
23
|
export default SkeletonIcon;
|