@carbon/react 1.80.1 → 1.81.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 +781 -781
- package/es/components/Accordion/AccordionItem.d.ts +2 -2
- package/es/components/AspectRatio/AspectRatio.d.ts +2 -2
- package/es/components/Button/Button.js +3 -0
- package/es/components/Button/ButtonBase.d.ts +2 -2
- package/es/components/ChatButton/ChatButton.js +5 -3
- package/es/components/CodeSnippet/CodeSnippet.js +2 -0
- package/es/components/ComboBox/ComboBox.d.ts +1 -1
- package/es/components/ComposedModal/ComposedModal.d.ts +1 -1
- package/es/components/ComposedModal/ComposedModal.js +1 -2
- package/es/components/ComposedModal/ModalFooter.js +0 -1
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +0 -1
- package/es/components/ContentSwitcher/ContentSwitcher.d.ts +1 -1
- package/es/components/ContextMenu/useContextMenu.d.ts +1 -1
- package/es/components/DataTable/DataTable.d.ts +5 -5
- package/es/components/DataTable/DataTable.js +1 -1
- package/es/components/DataTable/TableActionList.d.ts +1 -1
- package/es/components/DataTable/TableExpandHeader.d.ts +1 -1
- package/es/components/DataTable/TableHead.d.ts +1 -1
- package/es/components/DataTable/TableToolbarContent.d.ts +1 -1
- package/es/components/DataTable/TableToolbarSearch.d.ts +1 -1
- package/es/components/DatePickerInput/DatePickerInput.d.ts +2 -2
- package/es/components/Dropdown/Dropdown.d.ts +1 -1
- package/es/components/FeatureFlags/index.d.ts +1 -1
- package/es/components/FileUploader/FileUploader.d.ts +6 -1
- package/es/components/FileUploader/FileUploader.js +3 -1
- package/es/components/FileUploader/FileUploaderButton.d.ts +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
- package/es/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +3 -3
- package/es/components/FluidMultiSelect/FluidMultiSelect.d.ts +2 -2
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +6 -4
- package/es/components/FluidNumberInput/FluidNumberInput.Skeleton.js +40 -0
- package/es/components/FluidNumberInput/FluidNumberInput.js +123 -0
- package/es/components/FluidTextInput/FluidTextInput.js +2 -2
- package/es/components/Grid/Column.js +1 -1
- package/es/components/Grid/GridTypes.d.ts +6 -1
- package/es/components/Layer/LayerLevel.d.ts +3 -3
- package/es/components/Layer/LayerLevel.js +4 -3
- package/es/components/Layer/index.d.ts +4 -2
- package/es/components/Layer/index.js +3 -2
- package/es/components/Link/Link.js +3 -1
- package/es/components/Menu/Menu.d.ts +1 -1
- package/es/components/Menu/MenuContext.d.ts +1 -1
- package/es/components/Modal/Modal.js +5 -2
- package/es/components/ModalWrapper/ModalWrapper.d.ts +2 -2
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +3 -3
- package/es/components/MultiSelect/FilterableMultiSelect.js +4 -3
- package/es/components/MultiSelect/MultiSelect.d.ts +2 -6
- package/es/components/MultiSelect/MultiSelect.js +18 -3
- package/es/components/MultiSelect/index.d.ts +2 -4
- package/es/components/NumberInput/NumberInput.js +2 -1
- package/es/components/OverflowMenu/OverflowMenu.d.ts +7 -1
- package/es/components/OverflowMenu/OverflowMenu.js +69 -17
- package/es/components/OverflowMenu/index.d.ts +3 -5
- package/es/components/OverflowMenu/index.js +9 -4
- package/es/components/OverflowMenu/next/index.js +0 -1
- package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +4 -0
- package/es/components/PageHeader/PageHeader.js +1 -1
- package/es/components/PaginationNav/PaginationNav.d.ts +1 -1
- package/es/components/PaginationNav/PaginationNav.js +2 -1
- package/es/components/Popover/index.d.ts +3 -2
- package/es/components/Popover/index.js +10 -5
- package/es/components/Portal/index.d.ts +1 -1
- package/es/components/Search/Search.js +0 -1
- package/es/components/SkeletonText/SkeletonText.js +3 -1
- package/es/components/Slider/Slider.d.ts +3 -13
- package/es/components/Slider/Slider.js +2 -14
- package/es/components/Tabs/Tabs.d.ts +2 -2
- package/es/components/Tabs/Tabs.js +8 -6
- package/es/components/Tabs/usePressable.js +1 -1
- package/es/components/Tag/Tag.js +9 -2
- package/es/components/Text/Text.js +3 -2
- package/es/components/TextInput/ControlledPasswordInput.d.ts +1 -1
- package/es/components/TextInput/ControlledPasswordInput.js +0 -6
- package/es/components/TextInput/TextInput.d.ts +1 -1
- package/es/components/TextInput/TextInput.js +0 -4
- package/es/components/TextInput/index.d.ts +6 -0
- package/es/components/TextInput/index.js +0 -8
- package/es/components/Tile/Tile.js +0 -1
- package/es/components/Toggle/Toggle.d.ts +1 -1
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.d.ts +9 -14
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +37 -41
- package/es/components/Toggletip/index.js +11 -8
- package/es/components/Tooltip/Tooltip.d.ts +1 -1
- package/es/components/TreeView/TreeView.d.ts +1 -1
- package/es/components/UIShell/Content.d.ts +14 -1
- package/es/components/UIShell/HeaderGlobalBar.d.ts +1 -1
- package/es/components/UIShell/HeaderMenu.d.ts +2 -99
- package/es/components/UIShell/HeaderMenu.js +10 -3
- package/es/components/UIShell/HeaderMenuButton.d.ts +1 -98
- package/es/components/UIShell/HeaderMenuItem.d.ts +3 -4
- package/es/components/UIShell/HeaderMenuItem.js +3 -3
- package/es/components/UIShell/HeaderName.js +1 -1
- package/es/components/UIShell/HeaderNavigation.d.ts +0 -97
- package/es/components/UIShell/Link.d.ts +8 -8
- package/es/components/UIShell/Link.js +8 -5
- package/es/components/UIShell/SideNav.d.ts +3 -3
- package/es/components/UIShell/SideNav.js +1 -1
- package/es/components/UIShell/SideNavHeader.js +0 -1
- package/es/components/UIShell/SideNavLink.d.ts +3 -4
- package/es/components/UIShell/SideNavLink.js +8 -3
- package/es/components/UIShell/SideNavMenu.js +0 -1
- package/es/components/UIShell/SideNavMenuItem.d.ts +1 -49
- package/es/components/UIShell/SideNavMenuItem.js +1 -1
- package/es/components/UIShell/SideNavSwitcher.js +0 -1
- package/es/components/UIShell/SwitcherItem.d.ts +2 -2
- package/es/components/UIShell/SwitcherItem.js +1 -1
- package/es/index.d.ts +2 -2
- package/es/index.js +7 -7
- package/es/internal/FloatingMenu.js +2 -1
- package/es/internal/clamp.d.ts +10 -0
- package/es/internal/clamp.js +13 -0
- package/es/internal/useEvent.d.ts +9 -0
- package/es/internal/useEvent.js +8 -49
- package/es/internal/useId.js +1 -1
- package/es/internal/useMatchMedia.d.ts +7 -2
- package/es/internal/useMatchMedia.js +9 -10
- package/es/internal/useNoInteractiveChildren.js +4 -2
- package/es/internal/useOutsideClick.d.ts +1 -1
- package/es/prop-types/AriaPropTypes.js +1 -1
- package/es/prop-types/isRequiredOneOf.d.ts +16 -0
- package/es/prop-types/isRequiredOneOf.js +11 -9
- package/es/tools/setupGetInstanceId.d.ts +12 -0
- package/es/tools/setupGetInstanceId.js +7 -8
- package/es/tools/toggleClass.d.ts +14 -0
- package/es/tools/toggleClass.js +9 -10
- package/es/tools/wrapComponent.d.ts +1 -1
- package/es/types/common.d.ts +1 -6
- package/lib/components/Accordion/AccordionItem.d.ts +2 -2
- package/lib/components/AspectRatio/AspectRatio.d.ts +2 -2
- package/lib/components/Button/Button.js +3 -0
- package/lib/components/Button/ButtonBase.d.ts +2 -2
- package/lib/components/ChatButton/ChatButton.js +5 -3
- package/lib/components/CodeSnippet/CodeSnippet.js +2 -0
- package/lib/components/ComboBox/ComboBox.d.ts +1 -1
- package/lib/components/ComposedModal/ComposedModal.d.ts +1 -1
- package/lib/components/ComposedModal/ComposedModal.js +2 -3
- package/lib/components/ComposedModal/ModalFooter.js +0 -1
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +0 -1
- package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +1 -1
- package/lib/components/ContextMenu/useContextMenu.d.ts +1 -1
- package/lib/components/DataTable/DataTable.d.ts +5 -5
- package/lib/components/DataTable/DataTable.js +1 -1
- package/lib/components/DataTable/TableActionList.d.ts +1 -1
- package/lib/components/DataTable/TableExpandHeader.d.ts +1 -1
- package/lib/components/DataTable/TableHead.d.ts +1 -1
- package/lib/components/DataTable/TableToolbarContent.d.ts +1 -1
- package/lib/components/DataTable/TableToolbarSearch.d.ts +1 -1
- package/lib/components/DatePickerInput/DatePickerInput.d.ts +2 -2
- package/lib/components/Dropdown/Dropdown.d.ts +1 -1
- package/lib/components/FeatureFlags/index.d.ts +1 -1
- package/lib/components/FileUploader/FileUploader.d.ts +6 -1
- package/lib/components/FileUploader/FileUploader.js +3 -1
- package/lib/components/FileUploader/FileUploaderButton.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
- package/lib/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +3 -3
- package/lib/components/FluidMultiSelect/FluidMultiSelect.d.ts +2 -2
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +7 -5
- package/lib/components/FluidNumberInput/FluidNumberInput.Skeleton.js +50 -0
- package/lib/components/FluidNumberInput/FluidNumberInput.js +133 -0
- package/lib/components/FluidTextInput/FluidTextInput.js +2 -2
- package/lib/components/Grid/Column.js +1 -1
- package/lib/components/Grid/GridTypes.d.ts +6 -1
- package/lib/components/Layer/LayerLevel.d.ts +3 -3
- package/lib/components/Layer/LayerLevel.js +4 -2
- package/lib/components/Layer/index.d.ts +4 -2
- package/lib/components/Layer/index.js +2 -1
- package/lib/components/Link/Link.js +3 -1
- package/lib/components/Menu/Menu.d.ts +1 -1
- package/lib/components/Menu/MenuContext.d.ts +1 -1
- package/lib/components/Modal/Modal.js +6 -3
- package/lib/components/ModalWrapper/ModalWrapper.d.ts +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +3 -3
- package/lib/components/MultiSelect/FilterableMultiSelect.js +3 -2
- package/lib/components/MultiSelect/MultiSelect.d.ts +2 -6
- package/lib/components/MultiSelect/MultiSelect.js +17 -2
- package/lib/components/MultiSelect/index.d.ts +2 -4
- package/lib/components/NumberInput/NumberInput.js +2 -1
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +7 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +69 -17
- package/lib/components/OverflowMenu/index.d.ts +3 -5
- package/lib/components/OverflowMenu/index.js +8 -3
- package/lib/components/OverflowMenu/next/index.js +0 -1
- package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +4 -0
- package/lib/components/PageHeader/PageHeader.js +1 -1
- package/lib/components/PaginationNav/PaginationNav.d.ts +1 -1
- package/lib/components/PaginationNav/PaginationNav.js +2 -1
- package/lib/components/Popover/index.d.ts +3 -2
- package/lib/components/Popover/index.js +10 -5
- package/lib/components/Portal/index.d.ts +1 -1
- package/lib/components/Search/Search.js +0 -1
- package/lib/components/SkeletonText/SkeletonText.js +3 -1
- package/lib/components/Slider/Slider.d.ts +3 -13
- package/lib/components/Slider/Slider.js +2 -14
- package/lib/components/Tabs/Tabs.d.ts +2 -2
- package/lib/components/Tabs/Tabs.js +7 -5
- package/lib/components/Tabs/usePressable.js +1 -1
- package/lib/components/Tag/Tag.js +9 -2
- package/lib/components/Text/Text.js +2 -1
- package/lib/components/TextInput/ControlledPasswordInput.d.ts +1 -1
- package/lib/components/TextInput/ControlledPasswordInput.js +0 -6
- package/lib/components/TextInput/TextInput.d.ts +1 -1
- package/lib/components/TextInput/TextInput.js +0 -4
- package/lib/components/TextInput/index.d.ts +6 -0
- package/lib/components/TextInput/index.js +1 -7
- package/lib/components/Tile/Tile.js +0 -1
- package/lib/components/Toggle/Toggle.d.ts +1 -1
- package/lib/components/ToggleSmall/ToggleSmall.Skeleton.d.ts +9 -14
- package/lib/components/ToggleSmall/ToggleSmall.Skeleton.js +34 -39
- package/lib/components/Toggletip/index.js +11 -8
- package/lib/components/Tooltip/Tooltip.d.ts +1 -1
- package/lib/components/TreeView/TreeView.d.ts +1 -1
- package/lib/components/UIShell/Content.d.ts +14 -1
- package/lib/components/UIShell/HeaderGlobalBar.d.ts +1 -1
- package/lib/components/UIShell/HeaderMenu.d.ts +2 -99
- package/lib/components/UIShell/HeaderMenu.js +10 -3
- package/lib/components/UIShell/HeaderMenuButton.d.ts +1 -98
- package/lib/components/UIShell/HeaderMenuItem.d.ts +3 -4
- package/lib/components/UIShell/HeaderMenuItem.js +3 -3
- package/lib/components/UIShell/HeaderName.js +1 -1
- package/lib/components/UIShell/HeaderNavigation.d.ts +0 -97
- package/lib/components/UIShell/Link.d.ts +8 -8
- package/lib/components/UIShell/Link.js +7 -5
- package/lib/components/UIShell/SideNav.d.ts +3 -3
- package/lib/components/UIShell/SideNav.js +1 -1
- package/lib/components/UIShell/SideNavHeader.js +0 -1
- package/lib/components/UIShell/SideNavLink.d.ts +3 -4
- package/lib/components/UIShell/SideNavLink.js +8 -3
- package/lib/components/UIShell/SideNavMenu.js +0 -1
- package/lib/components/UIShell/SideNavMenuItem.d.ts +1 -49
- package/lib/components/UIShell/SideNavMenuItem.js +1 -1
- package/lib/components/UIShell/SideNavSwitcher.js +0 -1
- package/lib/components/UIShell/SwitcherItem.d.ts +2 -2
- package/lib/components/UIShell/SwitcherItem.js +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +13 -11
- package/lib/internal/FloatingMenu.js +2 -1
- package/lib/internal/clamp.d.ts +10 -0
- package/lib/internal/clamp.js +17 -0
- package/lib/internal/useEvent.d.ts +9 -0
- package/lib/internal/useEvent.js +8 -49
- package/lib/internal/useId.js +1 -1
- package/lib/internal/useMatchMedia.d.ts +7 -2
- package/lib/internal/useMatchMedia.js +9 -10
- package/lib/internal/useNoInteractiveChildren.js +4 -2
- package/lib/internal/useOutsideClick.d.ts +1 -1
- package/lib/prop-types/AriaPropTypes.js +1 -1
- package/lib/prop-types/isRequiredOneOf.d.ts +16 -0
- package/lib/prop-types/isRequiredOneOf.js +11 -9
- package/lib/tools/setupGetInstanceId.d.ts +12 -0
- package/lib/tools/setupGetInstanceId.js +7 -8
- package/lib/tools/toggleClass.d.ts +14 -0
- package/lib/tools/toggleClass.js +9 -10
- package/lib/tools/wrapComponent.d.ts +1 -1
- package/lib/types/common.d.ts +1 -6
- package/package.json +14 -14
- package/telemetry.yml +11 -12
- package/es/components/MultiSelect/index.js +0 -13
- package/es/internal/ClickListener.d.ts +0 -13
- package/es/internal/ClickListener.js +0 -47
- package/lib/components/MultiSelect/index.js +0 -19
- package/lib/internal/ClickListener.d.ts +0 -13
- package/lib/internal/ClickListener.js +0 -51
|
@@ -1,5 +1,5 @@
|
|
|
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.
|
|
@@ -31,5 +31,7 @@ export interface LayerBaseProps {
|
|
|
31
31
|
level?: LayerLevel;
|
|
32
32
|
}
|
|
33
33
|
export type LayerProps<T extends React.ElementType> = PolymorphicComponentPropWithRef<T, LayerBaseProps>;
|
|
34
|
-
declare const Layer: React.ForwardRefExoticComponent<
|
|
34
|
+
declare const Layer: React.ForwardRefExoticComponent<LayerBaseProps & {
|
|
35
|
+
as?: React.ElementType;
|
|
36
|
+
} & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<any>>;
|
|
35
37
|
export { Layer };
|
|
@@ -11,7 +11,8 @@ import PropTypes from 'prop-types';
|
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
import { LayerContext } from './LayerContext.js';
|
|
14
|
-
import { levels,
|
|
14
|
+
import { levels, MAX_LEVEL, MIN_LEVEL } from './LayerLevel.js';
|
|
15
|
+
import { clamp } from '../../internal/clamp.js';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* A custom hook that will return information about the current layer. A common
|
|
@@ -37,7 +38,7 @@ const Layer = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
37
38
|
const prefix = usePrefix();
|
|
38
39
|
const className = cx(`${prefix}--layer-${levels[level]}`, customClassName);
|
|
39
40
|
// The level should be between MIN_LEVEL and MAX_LEVEL
|
|
40
|
-
const value =
|
|
41
|
+
const value = clamp(level + 1, MIN_LEVEL, MAX_LEVEL);
|
|
41
42
|
const BaseComponent = as || 'div';
|
|
42
43
|
return /*#__PURE__*/React__default.createElement(LayerContext.Provider, {
|
|
43
44
|
value: value
|
|
@@ -11,7 +11,8 @@ import PropTypes from 'prop-types';
|
|
|
11
11
|
import React__default from 'react';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
// First create the component with basic types
|
|
15
|
+
const LinkBase = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
15
16
|
let {
|
|
16
17
|
as: BaseComponent,
|
|
17
18
|
children,
|
|
@@ -54,6 +55,7 @@ const Link = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
54
55
|
className: `${prefix}--link__icon`
|
|
55
56
|
}, /*#__PURE__*/React__default.createElement(Icon, null)));
|
|
56
57
|
});
|
|
58
|
+
const Link = LinkBase;
|
|
57
59
|
Link.displayName = 'Link';
|
|
58
60
|
Link.propTypes = {
|
|
59
61
|
/**
|
|
@@ -9,7 +9,7 @@ export interface MenuProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
|
9
9
|
/**
|
|
10
10
|
* The ref of the containing element, used for positioning and alignment of the menu
|
|
11
11
|
*/
|
|
12
|
-
containerRef?: RefObject<HTMLDivElement>;
|
|
12
|
+
containerRef?: RefObject<HTMLDivElement | null>;
|
|
13
13
|
/**
|
|
14
14
|
* A collection of MenuItems to be rendered within this Menu.
|
|
15
15
|
*/
|
|
@@ -10,7 +10,7 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
import React__default, { useRef, useState, useEffect } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { Close } from '@carbon/icons-react';
|
|
13
|
-
import toggleClass from '../../tools/toggleClass.js';
|
|
13
|
+
import { toggleClass } from '../../tools/toggleClass.js';
|
|
14
14
|
import Button from '../Button/Button.js';
|
|
15
15
|
import '../Button/Button.Skeleton.js';
|
|
16
16
|
import ButtonSet from '../ButtonSet/ButtonSet.js';
|
|
@@ -95,12 +95,15 @@ const Modal = /*#__PURE__*/React__default.forwardRef(function Modal(_ref, ref) {
|
|
|
95
95
|
return !onSecondarySubmit && element === secondaryButton.current || element.classList.contains(modalCloseButtonClass);
|
|
96
96
|
}
|
|
97
97
|
function handleKeyDown(evt) {
|
|
98
|
+
const {
|
|
99
|
+
target
|
|
100
|
+
} = evt;
|
|
98
101
|
evt.stopPropagation();
|
|
99
102
|
if (open) {
|
|
100
103
|
if (match(evt, Escape)) {
|
|
101
104
|
onRequestClose(evt);
|
|
102
105
|
}
|
|
103
|
-
if (match(evt, Enter) && shouldSubmitOnEnter && !isCloseButton(
|
|
106
|
+
if (match(evt, Enter) && shouldSubmitOnEnter && target instanceof Element && !isCloseButton(target) && document.activeElement !== button.current) {
|
|
104
107
|
onRequestSubmit(evt);
|
|
105
108
|
}
|
|
106
109
|
if (focusTrapWithoutSentinels && !enableDialogElement && match(evt, Tab) && innerModal.current) {
|
|
@@ -62,8 +62,8 @@ export default class ModalWrapper extends React.Component<ModalWrapperProps, Mod
|
|
|
62
62
|
triggerButtonKind: PropTypes.Requireable<"primary" | "secondary" | "danger" | "ghost" | "danger--primary" | "danger--ghost" | "danger--tertiary" | "tertiary">;
|
|
63
63
|
withHeader: PropTypes.Requireable<boolean>;
|
|
64
64
|
};
|
|
65
|
-
triggerButton: React.RefObject<HTMLButtonElement>;
|
|
66
|
-
modal: React.RefObject<HTMLDivElement>;
|
|
65
|
+
triggerButton: React.RefObject<HTMLButtonElement | null>;
|
|
66
|
+
modal: React.RefObject<HTMLDivElement | null>;
|
|
67
67
|
state: {
|
|
68
68
|
isOpen: boolean;
|
|
69
69
|
};
|
|
@@ -191,11 +191,11 @@ export interface FilterableMultiSelectProps<ItemType> extends MultiSelectSorting
|
|
|
191
191
|
*/
|
|
192
192
|
warnText?: ReactNode;
|
|
193
193
|
}
|
|
194
|
-
declare const FilterableMultiSelect: {
|
|
195
|
-
<ItemType>(props: FilterableMultiSelectProps<ItemType>): ReactElement
|
|
194
|
+
export declare const FilterableMultiSelect: {
|
|
195
|
+
<ItemType>(props: FilterableMultiSelectProps<ItemType>): ReactElement<any>;
|
|
196
196
|
propTypes?: any;
|
|
197
197
|
contextTypes?: any;
|
|
198
198
|
defaultProps?: any;
|
|
199
199
|
displayName?: any;
|
|
200
200
|
};
|
|
201
|
-
export
|
|
201
|
+
export {};
|
|
@@ -11,7 +11,7 @@ import cx from 'classnames';
|
|
|
11
11
|
import Downshift, { useCombobox, useMultipleSelection } from 'downshift';
|
|
12
12
|
import isEqual from 'react-fast-compare';
|
|
13
13
|
import PropTypes from 'prop-types';
|
|
14
|
-
import React__default, { useContext, useRef, useState, useLayoutEffect, useMemo, useEffect } from 'react';
|
|
14
|
+
import React__default, { forwardRef, useContext, useRef, useState, useLayoutEffect, useMemo, useEffect } from 'react';
|
|
15
15
|
import { defaultFilterItems } from '../ComboBox/tools/filter.js';
|
|
16
16
|
import { sortingPropTypes } from './MultiSelectPropTypes.js';
|
|
17
17
|
import ListBox from '../ListBox/index.js';
|
|
@@ -61,7 +61,7 @@ const {
|
|
|
61
61
|
* ends up just being defined as "string".)
|
|
62
62
|
*/
|
|
63
63
|
|
|
64
|
-
const FilterableMultiSelect = /*#__PURE__*/
|
|
64
|
+
const FilterableMultiSelect = /*#__PURE__*/forwardRef(function FilterableMultiSelect(_ref, ref) {
|
|
65
65
|
let {
|
|
66
66
|
autoAlign = false,
|
|
67
67
|
className: containerClassName,
|
|
@@ -647,6 +647,7 @@ const FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Fi
|
|
|
647
647
|
}, item)) : itemText)));
|
|
648
648
|
}) : null)), !inline && !invalid && !warn ? helper : null);
|
|
649
649
|
});
|
|
650
|
+
FilterableMultiSelect.displayName = 'FilterableMultiSelect';
|
|
650
651
|
FilterableMultiSelect.propTypes = {
|
|
651
652
|
/**
|
|
652
653
|
* Deprecated, aria-label is no longer needed
|
|
@@ -800,4 +801,4 @@ FilterableMultiSelect.propTypes = {
|
|
|
800
801
|
warnText: PropTypes.node
|
|
801
802
|
};
|
|
802
803
|
|
|
803
|
-
export { FilterableMultiSelect
|
|
804
|
+
export { FilterableMultiSelect };
|
|
@@ -173,9 +173,5 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
|
|
|
173
173
|
*/
|
|
174
174
|
warnText?: ReactNode;
|
|
175
175
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
<ItemType>(props: MultiSelectComponentProps<ItemType>): React.ReactElement | null;
|
|
179
|
-
}
|
|
180
|
-
declare const _default: MultiSelectComponent;
|
|
181
|
-
export default _default;
|
|
176
|
+
export declare const MultiSelect: React.ForwardRefExoticComponent<MultiSelectProps<unknown> & React.RefAttributes<HTMLButtonElement>>;
|
|
177
|
+
export {};
|
|
@@ -11,7 +11,7 @@ import cx from 'classnames';
|
|
|
11
11
|
import { useSelect } from 'downshift';
|
|
12
12
|
import isEqual from 'react-fast-compare';
|
|
13
13
|
import PropTypes from 'prop-types';
|
|
14
|
-
import React__default, { useMemo, useContext, useState, useLayoutEffect, isValidElement } from 'react';
|
|
14
|
+
import React__default, { useMemo, useContext, useState, useLayoutEffect, isValidElement, useCallback } from 'react';
|
|
15
15
|
import ListBox from '../ListBox/index.js';
|
|
16
16
|
import { sortingPropTypes } from './MultiSelectPropTypes.js';
|
|
17
17
|
import { defaultSortItems, defaultCompareItems } from './tools/sorting.js';
|
|
@@ -425,6 +425,16 @@ const MultiSelect = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
425
425
|
ref: enableFloatingStyles ? refs.setFloating : null
|
|
426
426
|
}), [enableFloatingStyles, getMenuProps, refs.setFloating]);
|
|
427
427
|
const labelProps = ! /*#__PURE__*/isValidElement(titleText) ? getLabelProps() : null;
|
|
428
|
+
const getSelectionStats = useCallback((selectedItems, filteredItems) => {
|
|
429
|
+
const hasIndividualSelections = selectedItems.some(selected => !selected.isSelectAll);
|
|
430
|
+
const nonSelectAllSelectedCount = selectedItems.filter(selected => !selected.isSelectAll).length;
|
|
431
|
+
const totalSelectableCount = filteredItems.filter(item => !item.isSelectAll && !item.disabled).length;
|
|
432
|
+
return {
|
|
433
|
+
hasIndividualSelections,
|
|
434
|
+
nonSelectAllSelectedCount,
|
|
435
|
+
totalSelectableCount
|
|
436
|
+
};
|
|
437
|
+
}, [selectedItems, filteredItems]);
|
|
428
438
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
429
439
|
className: wrapperClasses
|
|
430
440
|
}, /*#__PURE__*/React__default.createElement("label", _extends({
|
|
@@ -478,7 +488,12 @@ const MultiSelect = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
478
488
|
className: `${prefix}--list-box__inner-wrapper--decorator`
|
|
479
489
|
}, normalizedDecorator) : ''), /*#__PURE__*/React__default.createElement(ListBox.Menu, menuProps, isOpen && sortItems(filteredItems, sortOptions).map((item, index) => {
|
|
480
490
|
const isChecked = selectedItems.filter(selected => isEqual(selected, item)).length > 0;
|
|
481
|
-
const
|
|
491
|
+
const {
|
|
492
|
+
hasIndividualSelections,
|
|
493
|
+
nonSelectAllSelectedCount,
|
|
494
|
+
totalSelectableCount
|
|
495
|
+
} = getSelectionStats(selectedItems, filteredItems);
|
|
496
|
+
const isIndeterminate = item['isSelectAll'] && hasIndividualSelections && nonSelectAllSelectedCount < totalSelectableCount;
|
|
482
497
|
const itemProps = getItemProps({
|
|
483
498
|
item,
|
|
484
499
|
// we don't want Downshift to set aria-selected for us
|
|
@@ -701,4 +716,4 @@ MultiSelect.propTypes = {
|
|
|
701
716
|
warnText: PropTypes.node
|
|
702
717
|
};
|
|
703
718
|
|
|
704
|
-
export { MultiSelect
|
|
719
|
+
export { MultiSelect };
|
|
@@ -4,7 +4,5 @@
|
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
export { FilterableMultiSelect, MultiSelect };
|
|
10
|
-
export default MultiSelect;
|
|
7
|
+
export * from './FilterableMultiSelect';
|
|
8
|
+
export * from './MultiSelect';
|
|
@@ -17,6 +17,7 @@ import deprecate from '../../prop-types/deprecate.js';
|
|
|
17
17
|
import '../FluidForm/FluidForm.js';
|
|
18
18
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
19
19
|
import '../Text/index.js';
|
|
20
|
+
import { clamp } from '../../internal/clamp.js';
|
|
20
21
|
import { Text } from '../Text/Text.js';
|
|
21
22
|
|
|
22
23
|
var _Subtract, _Add;
|
|
@@ -173,7 +174,7 @@ const NumberInput = /*#__PURE__*/React__default.forwardRef(function NumberInput(
|
|
|
173
174
|
const rawValue = direction === 'up' ? currentValue + step : currentValue - step;
|
|
174
175
|
const precision = Math.max(getDecimalPlaces(currentValue), getDecimalPlaces(step));
|
|
175
176
|
const floatValue = parseFloat(rawValue.toFixed(precision));
|
|
176
|
-
const newValue =
|
|
177
|
+
const newValue = clamp(floatValue, min ?? -Infinity, max ?? Infinity);
|
|
177
178
|
const state = {
|
|
178
179
|
value: allowEmpty && inputRef.current.value === '' && step === 0 ? '' : newValue,
|
|
179
180
|
direction
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React, { type ElementType, type ReactNode, type Ref } from 'react';
|
|
8
8
|
import { type MenuDirection, type MenuOffset } from '../../internal/FloatingMenu';
|
|
9
|
+
import { PopoverAlignment } from '../Popover';
|
|
9
10
|
/**
|
|
10
11
|
* Calculates the offset for the floating menu.
|
|
11
12
|
*
|
|
@@ -16,6 +17,10 @@ import { type MenuDirection, type MenuOffset } from '../../internal/FloatingMenu
|
|
|
16
17
|
*/
|
|
17
18
|
export declare const getMenuOffset: MenuOffset;
|
|
18
19
|
export interface OverflowMenuProps {
|
|
20
|
+
/**
|
|
21
|
+
* Specify how the trigger tooltip should be aligned.
|
|
22
|
+
*/
|
|
23
|
+
align?: PopoverAlignment;
|
|
19
24
|
/**
|
|
20
25
|
* Specify a label to be read by screen readers on the container node
|
|
21
26
|
*/
|
|
@@ -105,7 +110,8 @@ export interface OverflowMenuProps {
|
|
|
105
110
|
*/
|
|
106
111
|
size?: 'sm' | 'md' | 'lg';
|
|
107
112
|
/**
|
|
108
|
-
* The ref to the
|
|
113
|
+
* The ref to the overflow menu's trigger button element.
|
|
114
|
+
* @deprecated Use the standard React `ref` prop instead.
|
|
109
115
|
*/
|
|
110
116
|
innerRef?: Ref<any>;
|
|
111
117
|
}
|
|
@@ -11,7 +11,6 @@ import { OverflowMenuVertical } from '@carbon/icons-react';
|
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import invariant from 'invariant';
|
|
13
13
|
import PropTypes from 'prop-types';
|
|
14
|
-
import { ClickListener } from '../../internal/ClickListener.js';
|
|
15
14
|
import { DIRECTION_TOP, DIRECTION_BOTTOM, FloatingMenu } from '../../internal/FloatingMenu.js';
|
|
16
15
|
import { ArrowUp, ArrowRight, ArrowDown, ArrowLeft, Escape } from '../../internal/keyboard/keys.js';
|
|
17
16
|
import { matches } from '../../internal/keyboard/match.js';
|
|
@@ -19,8 +18,10 @@ import { noopFn } from '../../internal/noopFn.js';
|
|
|
19
18
|
import { PrefixContext } from '../../internal/usePrefix.js';
|
|
20
19
|
import deprecate from '../../prop-types/deprecate.js';
|
|
21
20
|
import mergeRefs from '../../tools/mergeRefs.js';
|
|
22
|
-
import setupGetInstanceId from '../../tools/setupGetInstanceId.js';
|
|
21
|
+
import { setupGetInstanceId } from '../../tools/setupGetInstanceId.js';
|
|
23
22
|
import { IconButton } from '../IconButton/index.js';
|
|
23
|
+
import { useOutsideClick } from '../../internal/useOutsideClick.js';
|
|
24
|
+
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
24
25
|
|
|
25
26
|
const getInstanceId = setupGetInstanceId();
|
|
26
27
|
const on = function (target) {
|
|
@@ -89,8 +90,25 @@ const getMenuOffset = (menuBody, direction, trigger, flip) => {
|
|
|
89
90
|
};
|
|
90
91
|
}
|
|
91
92
|
};
|
|
93
|
+
|
|
94
|
+
// TODO: Replace this code when align mapping is consolidated.
|
|
95
|
+
// https://github.com/carbon-design-system/carbon/pull/19081
|
|
96
|
+
const propMappingFunction = deprecatedValue => {
|
|
97
|
+
const mapping = {
|
|
98
|
+
'top-left': 'top-start',
|
|
99
|
+
'top-right': 'top-end',
|
|
100
|
+
'bottom-left': 'bottom-start',
|
|
101
|
+
'bottom-right': 'bottom-end',
|
|
102
|
+
'left-bottom': 'left-end',
|
|
103
|
+
'left-top': 'left-start',
|
|
104
|
+
'right-bottom': 'right-end',
|
|
105
|
+
'right-top': 'right-start'
|
|
106
|
+
};
|
|
107
|
+
return mapping[deprecatedValue];
|
|
108
|
+
};
|
|
92
109
|
const OverflowMenu = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
93
110
|
let {
|
|
111
|
+
align,
|
|
94
112
|
['aria-label']: ariaLabel = null,
|
|
95
113
|
ariaLabel: deprecatedAriaLabel,
|
|
96
114
|
children,
|
|
@@ -112,6 +130,7 @@ const OverflowMenu = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
112
130
|
renderIcon: IconElement = OverflowMenuVertical,
|
|
113
131
|
selectorPrimaryFocus = '[data-floating-menu-primary-focus]',
|
|
114
132
|
size = 'md',
|
|
133
|
+
innerRef,
|
|
115
134
|
...other
|
|
116
135
|
} = _ref;
|
|
117
136
|
const prefix = useContext(PrefixContext);
|
|
@@ -127,6 +146,7 @@ const OverflowMenu = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
127
146
|
const prevOpenState = useRef(open);
|
|
128
147
|
/** The element ref of the tooltip's trigger button. */
|
|
129
148
|
const triggerRef = useRef(null);
|
|
149
|
+
const wrapperRef = useRef(null);
|
|
130
150
|
|
|
131
151
|
// Sync open prop changes.
|
|
132
152
|
useEffect(() => {
|
|
@@ -150,6 +170,14 @@ const OverflowMenu = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
150
170
|
}
|
|
151
171
|
prevOpenState.current = open;
|
|
152
172
|
}, [open, onClose]);
|
|
173
|
+
useOutsideClick(wrapperRef, _ref2 => {
|
|
174
|
+
let {
|
|
175
|
+
target
|
|
176
|
+
} = _ref2;
|
|
177
|
+
if (open && (!menuBodyRef.current || target instanceof Node && !menuBodyRef.current.contains(target))) {
|
|
178
|
+
closeMenu();
|
|
179
|
+
}
|
|
180
|
+
});
|
|
153
181
|
const focusMenuEl = useCallback(() => {
|
|
154
182
|
if (triggerRef.current) {
|
|
155
183
|
triggerRef.current.focus();
|
|
@@ -200,23 +228,18 @@ const OverflowMenu = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
200
228
|
evt.stopPropagation();
|
|
201
229
|
}
|
|
202
230
|
};
|
|
203
|
-
const handleClickOutside = evt => {
|
|
204
|
-
if (open && (!menuBodyRef.current || evt.target instanceof Node && !menuBodyRef.current.contains(evt.target))) {
|
|
205
|
-
closeMenu();
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
231
|
|
|
209
232
|
/**
|
|
210
233
|
* Focuses the next enabled overflow menu item given the currently focused
|
|
211
234
|
* item index and direction to move.
|
|
212
235
|
*/
|
|
213
|
-
const handleOverflowMenuItemFocus =
|
|
236
|
+
const handleOverflowMenuItemFocus = _ref3 => {
|
|
214
237
|
let {
|
|
215
|
-
currentIndex,
|
|
238
|
+
currentIndex = 0,
|
|
216
239
|
direction
|
|
217
|
-
} =
|
|
240
|
+
} = _ref3;
|
|
218
241
|
const enabledIndices = Children.toArray(children).reduce((acc, curr, i) => {
|
|
219
|
-
if (/*#__PURE__*/isValidElement(curr) && !curr.props.disabled) {
|
|
242
|
+
if (/*#__PURE__*/React__default.isValidElement(curr) && !curr.props.disabled) {
|
|
220
243
|
acc.push(i);
|
|
221
244
|
}
|
|
222
245
|
return acc;
|
|
@@ -314,12 +337,13 @@ const OverflowMenu = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
314
337
|
}, /*#__PURE__*/cloneElement(menuBody, {
|
|
315
338
|
'data-floating-menu-direction': direction
|
|
316
339
|
}));
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}, /*#__PURE__*/React__default.createElement("span", {
|
|
340
|
+
const combinedRef = innerRef ? mergeRefs(triggerRef, innerRef, ref) : mergeRefs(triggerRef, ref);
|
|
341
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
|
|
320
342
|
className: `${prefix}--overflow-menu__wrapper`,
|
|
321
|
-
"aria-owns": open ? menuBodyId : undefined
|
|
343
|
+
"aria-owns": open ? menuBodyId : undefined,
|
|
344
|
+
ref: wrapperRef
|
|
322
345
|
}, /*#__PURE__*/React__default.createElement(IconButton, _extends({}, other, {
|
|
346
|
+
align: align,
|
|
323
347
|
type: "button",
|
|
324
348
|
"aria-haspopup": true,
|
|
325
349
|
"aria-expanded": open,
|
|
@@ -327,7 +351,7 @@ const OverflowMenu = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
327
351
|
className: overflowMenuClasses,
|
|
328
352
|
onClick: handleClick,
|
|
329
353
|
id: id,
|
|
330
|
-
ref:
|
|
354
|
+
ref: combinedRef,
|
|
331
355
|
size: size,
|
|
332
356
|
label: iconDescription,
|
|
333
357
|
kind: "ghost"
|
|
@@ -337,6 +361,35 @@ const OverflowMenu = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
337
361
|
})), open && hasMountedTrigger && wrappedMenuBody));
|
|
338
362
|
});
|
|
339
363
|
OverflowMenu.propTypes = {
|
|
364
|
+
/**
|
|
365
|
+
* Specify how the trigger should align with the tooltip
|
|
366
|
+
*/
|
|
367
|
+
align: deprecateValuesWithin(PropTypes.oneOf(['top', 'top-left',
|
|
368
|
+
// deprecated use top-start instead
|
|
369
|
+
'top-right',
|
|
370
|
+
// deprecated use top-end instead
|
|
371
|
+
|
|
372
|
+
'bottom', 'bottom-left',
|
|
373
|
+
// deprecated use bottom-start instead
|
|
374
|
+
'bottom-right',
|
|
375
|
+
// deprecated use bottom-end instead
|
|
376
|
+
|
|
377
|
+
'left', 'left-bottom',
|
|
378
|
+
// deprecated use left-end instead
|
|
379
|
+
'left-top',
|
|
380
|
+
// deprecated use left-start instead
|
|
381
|
+
|
|
382
|
+
'right', 'right-bottom',
|
|
383
|
+
// deprecated use right-end instead
|
|
384
|
+
'right-top',
|
|
385
|
+
// deprecated use right-start instead
|
|
386
|
+
|
|
387
|
+
// new values to match floating-ui
|
|
388
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
389
|
+
//allowed prop values
|
|
390
|
+
['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
|
|
391
|
+
//optional mapper function
|
|
392
|
+
propMappingFunction),
|
|
340
393
|
/**
|
|
341
394
|
* Specify a label to be read by screen readers on the container node
|
|
342
395
|
*/
|
|
@@ -428,7 +481,6 @@ OverflowMenu.propTypes = {
|
|
|
428
481
|
/**
|
|
429
482
|
* A component used to render an icon.
|
|
430
483
|
*/
|
|
431
|
-
// @ts-expect-error: PropTypes are not expressive enough to cover this case
|
|
432
484
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
433
485
|
/**
|
|
434
486
|
* Specify a CSS selector that matches the DOM element that should
|
|
@@ -4,10 +4,8 @@
|
|
|
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
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
displayName: string;
|
|
11
|
-
};
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import type { OverflowMenuProps } from './OverflowMenu';
|
|
9
|
+
declare const OverflowMenu: React.ForwardRefExoticComponent<OverflowMenuProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
10
|
export default OverflowMenu;
|
|
13
11
|
export { OverflowMenu, type OverflowMenuProps };
|
|
@@ -5,17 +5,22 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
+
import React__default, { forwardRef } from 'react';
|
|
9
10
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
10
11
|
import { OverflowMenu as OverflowMenu$2 } from './next/index.js';
|
|
11
12
|
import { OverflowMenu as OverflowMenu$1 } from './OverflowMenu.js';
|
|
12
13
|
import { createClassWrapper } from '../../internal/createClassWrapper.js';
|
|
13
14
|
|
|
14
15
|
const OverflowMenuV11 = createClassWrapper(OverflowMenu$1);
|
|
15
|
-
const OverflowMenu = props => {
|
|
16
|
+
const OverflowMenu = /*#__PURE__*/forwardRef((props, ref) => {
|
|
16
17
|
const enableV12OverflowMenu = useFeatureFlag('enable-v12-overflowmenu');
|
|
17
|
-
return enableV12OverflowMenu ? /*#__PURE__*/React__default.createElement(OverflowMenu$2,
|
|
18
|
-
|
|
18
|
+
return enableV12OverflowMenu ? /*#__PURE__*/React__default.createElement(OverflowMenu$2, _extends({}, props, {
|
|
19
|
+
ref: ref
|
|
20
|
+
})) : /*#__PURE__*/React__default.createElement(OverflowMenuV11, _extends({}, props, {
|
|
21
|
+
ref: ref
|
|
22
|
+
}));
|
|
23
|
+
});
|
|
19
24
|
OverflowMenu.displayName = 'OverflowMenu';
|
|
20
25
|
|
|
21
26
|
export { OverflowMenu, OverflowMenu as default };
|
|
@@ -167,7 +167,6 @@ OverflowMenu.propTypes = {
|
|
|
167
167
|
/**
|
|
168
168
|
* A component used to render an icon.
|
|
169
169
|
*/
|
|
170
|
-
// @ts-expect-error: PropTypes are not expressive enough to cover this case
|
|
171
170
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
172
171
|
/**
|
|
173
172
|
* Specify the size of the menu, from a list of available sizes.
|
|
@@ -40,6 +40,10 @@ export interface OverflowMenuItemProps extends React.HTMLAttributes<HTMLElement>
|
|
|
40
40
|
* `true` to make this menu item a danger button.
|
|
41
41
|
*/
|
|
42
42
|
isDelete?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* accepts a ref to the button element
|
|
45
|
+
*/
|
|
46
|
+
ref?: (element: HTMLElement) => void;
|
|
43
47
|
/**
|
|
44
48
|
* `true` to require the title attribute.
|
|
45
49
|
*/
|
|
@@ -143,7 +143,7 @@ PageHeaderContent.propTypes = {
|
|
|
143
143
|
/**
|
|
144
144
|
* Provide an optional icon to render in front of the PageHeaderContent's title.
|
|
145
145
|
*/
|
|
146
|
-
|
|
146
|
+
|
|
147
147
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
148
148
|
/**
|
|
149
149
|
* The PageHeaderContent's title
|
|
@@ -14,6 +14,7 @@ import { IconButton } from '../IconButton/index.js';
|
|
|
14
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
15
|
import { breakpoints } from '@carbon/layout';
|
|
16
16
|
import { useMatchMedia } from '../../internal/useMatchMedia.js';
|
|
17
|
+
import { clamp } from '../../internal/clamp.js';
|
|
17
18
|
|
|
18
19
|
var _CaretRight, _CaretLeft, _option;
|
|
19
20
|
const translationIds = {
|
|
@@ -189,7 +190,7 @@ const PaginationNav = /*#__PURE__*/React__default.forwardRef(function Pagination
|
|
|
189
190
|
numberOfPages = itemsShown === 4 ? itemsShown : 5;
|
|
190
191
|
break;
|
|
191
192
|
case 'sm':
|
|
192
|
-
numberOfPages =
|
|
193
|
+
numberOfPages = clamp(itemsShown, 4, 7);
|
|
193
194
|
break;
|
|
194
195
|
default:
|
|
195
196
|
numberOfPages = 4;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
7
|
+
import { WeakValidationMap } from 'prop-types';
|
|
8
|
+
import React from 'react';
|
|
8
9
|
import { type Boundary } from '@floating-ui/react';
|
|
9
10
|
import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
|
|
10
11
|
export interface PopoverContext {
|
|
@@ -46,7 +46,9 @@ const propMappingFunction = deprecatedValue => {
|
|
|
46
46
|
};
|
|
47
47
|
return mapping[deprecatedValue];
|
|
48
48
|
};
|
|
49
|
-
const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFunction(_ref,
|
|
49
|
+
const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFunction(_ref,
|
|
50
|
+
//this is a workaround, have to come back and fix this.
|
|
51
|
+
forwardRef) {
|
|
50
52
|
let {
|
|
51
53
|
isTabTip,
|
|
52
54
|
align: initialAlign = isTabTip ? 'bottom-start' : 'bottom',
|
|
@@ -76,8 +78,11 @@ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFun
|
|
|
76
78
|
onRequestClose?.();
|
|
77
79
|
}
|
|
78
80
|
});
|
|
79
|
-
useWindowEvent('click',
|
|
80
|
-
|
|
81
|
+
useWindowEvent('click', _ref2 => {
|
|
82
|
+
let {
|
|
83
|
+
target
|
|
84
|
+
} = _ref2;
|
|
85
|
+
if (open && target instanceof Node && !popover.current?.contains(target)) {
|
|
81
86
|
onRequestClose?.();
|
|
82
87
|
}
|
|
83
88
|
});
|
|
@@ -351,12 +356,12 @@ Popover.propTypes = {
|
|
|
351
356
|
open: PropTypes.bool.isRequired
|
|
352
357
|
};
|
|
353
358
|
function PopoverContentRenderFunction(// eslint-disable-next-line react/prop-types
|
|
354
|
-
|
|
359
|
+
_ref3, forwardRef) {
|
|
355
360
|
let {
|
|
356
361
|
className,
|
|
357
362
|
children,
|
|
358
363
|
...rest
|
|
359
|
-
} =
|
|
364
|
+
} = _ref3;
|
|
360
365
|
const prefix = usePrefix();
|
|
361
366
|
const {
|
|
362
367
|
setFloating,
|
|
@@ -13,7 +13,7 @@ export interface PortalProps {
|
|
|
13
13
|
/**
|
|
14
14
|
* Provide a ref for a container node to render the portal
|
|
15
15
|
*/
|
|
16
|
-
container?: React.RefObject<HTMLElement>;
|
|
16
|
+
container?: React.RefObject<HTMLElement | null>;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Helper component for rendering content within a portal. By default, the
|
|
@@ -222,7 +222,6 @@ Search.propTypes = {
|
|
|
222
222
|
/**
|
|
223
223
|
* A component used to render an icon.
|
|
224
224
|
*/
|
|
225
|
-
// @ts-expect-error: PropTypes are not expressive enough to cover this case
|
|
226
225
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
227
226
|
/**
|
|
228
227
|
* Specify the role for the underlying `<input>`, defaults to `searchbox`
|
|
@@ -59,7 +59,9 @@ const SkeletonText = _ref => {
|
|
|
59
59
|
lines.push(/*#__PURE__*/React__default.createElement("p", _extends({
|
|
60
60
|
className: skeletonTextClasses,
|
|
61
61
|
key: i,
|
|
62
|
-
ref: el =>
|
|
62
|
+
ref: el => {
|
|
63
|
+
refs.current = [...refs.current, el];
|
|
64
|
+
}
|
|
63
65
|
}, rest)));
|
|
64
66
|
}
|
|
65
67
|
if (lineCountNumber !== 1) {
|