@carbon/react 1.79.0 → 1.80.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 +835 -779
- package/es/components/CodeSnippet/CodeSnippet.js +1 -1
- package/es/components/ComposedModal/ComposedModal.d.ts +6 -0
- package/es/components/ComposedModal/ModalFooter.d.ts +6 -0
- package/es/components/ContainedList/index.js +1 -1
- package/es/components/DataTable/DataTable.d.ts +3 -1
- package/es/components/DatePicker/DatePicker.d.ts +1 -1
- package/es/components/DatePicker/DatePicker.js +1 -1
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +6 -0
- package/es/components/InlineLoading/InlineLoading.js +10 -2
- package/es/components/Layer/LayerLevel.d.ts +6 -0
- package/es/components/Menu/Menu.d.ts +1 -1
- package/es/components/Menu/MenuItem.d.ts +4 -4
- package/es/components/Menu/MenuItem.js +1 -1
- package/es/components/Modal/Modal.js +1 -1
- package/es/components/ModalWrapper/ModalWrapper.d.ts +1 -1
- package/es/components/ModalWrapper/ModalWrapper.js +2 -1
- package/es/components/Notification/Notification.js +1 -1
- package/es/components/NumberInput/NumberInput.d.ts +1 -1
- package/es/components/OverflowMenu/OverflowMenu.js +3 -3
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +1 -3
- package/es/components/OverflowMenuV2/index.js +1 -1
- package/es/components/PageHeader/PageHeader.d.ts +101 -0
- package/es/components/PageHeader/PageHeader.js +241 -0
- package/es/components/PageHeader/index.d.ts +8 -0
- package/es/components/PageHeader/index.js +8 -0
- package/es/components/PasswordInput/index.d.ts +6 -0
- package/es/components/Popover/index.js +1 -1
- package/es/components/Slider/SliderHandles.d.ts +6 -0
- package/es/components/Tag/DismissibleTag.d.ts +1 -55
- package/es/components/Tag/DismissibleTag.js +6 -4
- package/es/components/Tag/OperationalTag.d.ts +1 -1
- package/es/components/Tag/SelectableTag.d.ts +1 -43
- package/es/components/Tag/SelectableTag.js +7 -5
- package/es/components/Tag/Tag.js +2 -2
- package/es/components/Text/createTextComponent.js +1 -1
- package/es/components/TextArea/TextArea.d.ts +3 -3
- package/es/components/TextArea/TextArea.js +5 -2
- package/es/components/TextInput/ControlledPasswordInput.d.ts +6 -0
- package/es/components/TextInput/ControlledPasswordInput.js +1 -1
- package/es/components/TextInput/PasswordInput.d.ts +6 -0
- package/es/components/TextInput/index.js +1 -1
- package/es/components/Tile/Tile.d.ts +1 -1
- package/es/components/Tile/Tile.js +1 -4
- package/es/components/TreeView/TreeNode.d.ts +1 -1
- package/es/components/TreeView/TreeNode.js +11 -4
- package/es/components/TreeView/TreeView.d.ts +1 -1
- package/es/components/TreeView/TreeView.js +6 -6
- package/es/components/UIShell/Switcher.d.ts +1 -7
- package/es/components/UIShell/SwitcherDivider.d.ts +6 -0
- package/es/components/UIShell/SwitcherItem.d.ts +6 -0
- package/es/index.d.ts +5 -1
- package/es/index.js +3 -1
- package/es/internal/ClickListener.d.ts +13 -0
- package/es/internal/ClickListener.js +33 -60
- package/es/internal/FloatingMenu.js +2 -2
- package/es/internal/PolymorphicProps.d.ts +6 -0
- package/es/internal/deprecateFieldOnObject.d.ts +12 -0
- package/es/internal/deprecateFieldOnObject.js +4 -4
- package/es/internal/useControllableState.d.ts +34 -0
- package/es/internal/useControllableState.js +17 -32
- package/es/internal/useEvent.js +1 -1
- package/es/internal/useMergedRefs.d.ts +9 -6
- package/es/internal/useMergedRefs.js +8 -9
- package/es/internal/useNoInteractiveChildren.js +2 -2
- package/es/internal/useOutsideClick.d.ts +8 -0
- package/es/internal/useOutsideClick.js +9 -6
- package/es/internal/useSavedCallback.d.ts +15 -0
- package/es/internal/useSavedCallback.js +9 -12
- package/es/internal/warning.d.ts +17 -0
- package/es/internal/warning.js +16 -12
- package/es/internal/wrapFocus.js +1 -1
- package/es/prop-types/isRequiredOneOf.js +1 -1
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +1 -1
- package/es/tools/events.js +1 -6
- package/es/tools/toggleClass.js +6 -0
- package/es/types/common.d.ts +6 -0
- package/lib/components/CodeSnippet/CodeSnippet.js +1 -1
- package/lib/components/ComposedModal/ComposedModal.d.ts +6 -0
- package/lib/components/ComposedModal/ModalFooter.d.ts +6 -0
- package/lib/components/ContainedList/index.js +1 -1
- package/lib/components/DataTable/DataTable.d.ts +3 -1
- package/lib/components/DatePicker/DatePicker.d.ts +1 -1
- package/lib/components/DatePicker/DatePicker.js +1 -1
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +6 -0
- package/lib/components/InlineLoading/InlineLoading.js +10 -2
- package/lib/components/Layer/LayerLevel.d.ts +6 -0
- package/lib/components/Menu/Menu.d.ts +1 -1
- package/lib/components/Menu/MenuItem.d.ts +4 -4
- package/lib/components/Menu/MenuItem.js +1 -1
- package/lib/components/Modal/Modal.js +1 -1
- package/lib/components/ModalWrapper/ModalWrapper.d.ts +1 -1
- package/lib/components/ModalWrapper/ModalWrapper.js +2 -1
- package/lib/components/Notification/Notification.js +1 -1
- package/lib/components/NumberInput/NumberInput.d.ts +1 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +3 -3
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +1 -3
- package/lib/components/OverflowMenuV2/index.js +1 -1
- package/lib/components/PageHeader/PageHeader.d.ts +101 -0
- package/lib/components/PageHeader/PageHeader.js +260 -0
- package/lib/components/PageHeader/index.d.ts +8 -0
- package/lib/components/PageHeader/index.js +25 -0
- package/lib/components/PasswordInput/index.d.ts +6 -0
- package/lib/components/Popover/index.js +1 -1
- package/lib/components/Slider/SliderHandles.d.ts +6 -0
- package/lib/components/Tag/DismissibleTag.d.ts +1 -55
- package/lib/components/Tag/DismissibleTag.js +5 -3
- package/lib/components/Tag/OperationalTag.d.ts +1 -1
- package/lib/components/Tag/SelectableTag.d.ts +1 -43
- package/lib/components/Tag/SelectableTag.js +6 -4
- package/lib/components/Tag/Tag.js +2 -2
- package/lib/components/Text/createTextComponent.js +1 -1
- package/lib/components/TextArea/TextArea.d.ts +3 -3
- package/lib/components/TextArea/TextArea.js +4 -1
- package/lib/components/TextInput/ControlledPasswordInput.d.ts +6 -0
- package/lib/components/TextInput/ControlledPasswordInput.js +1 -1
- package/lib/components/TextInput/PasswordInput.d.ts +6 -0
- package/lib/components/TextInput/index.js +1 -1
- package/lib/components/Tile/Tile.d.ts +1 -1
- package/lib/components/Tile/Tile.js +1 -4
- package/lib/components/TreeView/TreeNode.d.ts +1 -1
- package/lib/components/TreeView/TreeNode.js +11 -4
- package/lib/components/TreeView/TreeView.d.ts +1 -1
- package/lib/components/TreeView/TreeView.js +6 -6
- package/lib/components/UIShell/Switcher.d.ts +1 -7
- package/lib/components/UIShell/SwitcherDivider.d.ts +6 -0
- package/lib/components/UIShell/SwitcherItem.d.ts +6 -0
- package/lib/index.d.ts +5 -1
- package/lib/index.js +62 -57
- package/lib/internal/ClickListener.d.ts +13 -0
- package/lib/internal/ClickListener.js +32 -64
- package/lib/internal/FloatingMenu.js +2 -2
- package/lib/internal/PolymorphicProps.d.ts +6 -0
- package/lib/internal/deprecateFieldOnObject.d.ts +12 -0
- package/lib/internal/deprecateFieldOnObject.js +4 -4
- package/lib/internal/useControllableState.d.ts +34 -0
- package/lib/internal/useControllableState.js +17 -32
- package/lib/internal/useEvent.js +1 -1
- package/lib/internal/useMergedRefs.d.ts +9 -6
- package/lib/internal/useMergedRefs.js +8 -9
- package/lib/internal/useNoInteractiveChildren.js +2 -2
- package/lib/internal/useOutsideClick.d.ts +8 -0
- package/lib/internal/useOutsideClick.js +9 -6
- package/lib/internal/useSavedCallback.d.ts +15 -0
- package/lib/internal/useSavedCallback.js +9 -12
- package/lib/internal/warning.d.ts +17 -0
- package/lib/internal/warning.js +16 -12
- package/lib/internal/wrapFocus.js +1 -1
- package/lib/prop-types/isRequiredOneOf.js +1 -1
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +1 -1
- package/lib/tools/events.js +1 -6
- package/lib/tools/toggleClass.js +6 -0
- package/lib/types/common.d.ts +6 -0
- package/package.json +9 -8
- package/scss/components/page-header/_index.scss +9 -0
- package/scss/components/page-header/_page-header.scss +9 -0
- package/telemetry.yml +62 -23
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2023, 2024
|
|
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
|
+
*/
|
|
1
7
|
export declare const LowerHandle: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
2
8
|
export declare const LowerHandleFocus: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
3
9
|
export declare const UpperHandle: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
7
|
import React, { ReactNode } from 'react';
|
|
9
8
|
import { PolymorphicProps } from '../../types/common';
|
|
10
9
|
import { SIZES, TYPES } from './Tag';
|
|
@@ -61,59 +60,6 @@ export interface DismissibleTagBaseProps {
|
|
|
61
60
|
type?: keyof typeof TYPES;
|
|
62
61
|
}
|
|
63
62
|
export type DismissibleTagProps<T extends React.ElementType> = PolymorphicProps<T, DismissibleTagBaseProps>;
|
|
64
|
-
declare const DismissibleTag:
|
|
65
|
-
<T extends React.ElementType>({ className, decorator, disabled, id, renderIcon, title, onClose, slug, size, text, tagTitle, type, ...other }: DismissibleTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
66
|
-
propTypes: {
|
|
67
|
-
/**
|
|
68
|
-
* Provide a custom className that is applied to the containing <span>
|
|
69
|
-
*/
|
|
70
|
-
className: PropTypes.Requireable<string>;
|
|
71
|
-
/**
|
|
72
|
-
* **Experimental:** Provide a `decorator` component to be rendered inside the `DismissibleTag` component
|
|
73
|
-
*/
|
|
74
|
-
decorator: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
75
|
-
/**
|
|
76
|
-
* Specify if the `DismissibleTag` is disabled
|
|
77
|
-
*/
|
|
78
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
79
|
-
/**
|
|
80
|
-
* Specify the id for the tag.
|
|
81
|
-
*/
|
|
82
|
-
id: PropTypes.Requireable<string>;
|
|
83
|
-
/**
|
|
84
|
-
* Click handler for filter tag close button.
|
|
85
|
-
*/
|
|
86
|
-
onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
87
|
-
/**
|
|
88
|
-
* A component used to render an icon.
|
|
89
|
-
*/
|
|
90
|
-
renderIcon: PropTypes.Requireable<object>;
|
|
91
|
-
/**
|
|
92
|
-
* Specify the size of the Tag. Currently supports either `sm`,
|
|
93
|
-
* `md` (default) or `lg` sizes.
|
|
94
|
-
*/
|
|
95
|
-
size: PropTypes.Requireable<string>;
|
|
96
|
-
/**
|
|
97
|
-
* **Experimental:** Provide a `Slug` component to be rendered inside the `DismissibleTag` component
|
|
98
|
-
*/
|
|
99
|
-
slug: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
100
|
-
/**
|
|
101
|
-
* Provide text to be rendered inside of a the tag.
|
|
102
|
-
*/
|
|
103
|
-
text: PropTypes.Requireable<string>;
|
|
104
|
-
/**
|
|
105
|
-
* Provide a custom `title` to be inserted in the tag.
|
|
106
|
-
*/
|
|
107
|
-
tagTitle: PropTypes.Requireable<string>;
|
|
108
|
-
/**
|
|
109
|
-
* Text to show on clear filters
|
|
110
|
-
*/
|
|
111
|
-
title: PropTypes.Requireable<string>;
|
|
112
|
-
/**
|
|
113
|
-
* Specify the type of the `Tag`
|
|
114
|
-
*/
|
|
115
|
-
type: PropTypes.Requireable<string>;
|
|
116
|
-
};
|
|
117
|
-
};
|
|
63
|
+
declare const DismissibleTag: React.ForwardRefExoticComponent<Omit<DismissibleTagProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
118
64
|
export declare const types: string[];
|
|
119
65
|
export default DismissibleTag;
|
|
@@ -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__default, { useRef, useState, useLayoutEffect } from 'react';
|
|
10
|
+
import React__default, { forwardRef, useRef, useState, useLayoutEffect } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { useId } from '../../internal/useId.js';
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
@@ -18,10 +18,11 @@ import '../Tooltip/DefinitionTooltip.js';
|
|
|
18
18
|
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
19
19
|
import '../Text/index.js';
|
|
20
20
|
import { isEllipsisActive } from './isEllipsisActive.js';
|
|
21
|
+
import mergeRefs from '../../tools/mergeRefs.js';
|
|
21
22
|
import { Text } from '../Text/Text.js';
|
|
22
23
|
|
|
23
24
|
var _Close;
|
|
24
|
-
const DismissibleTag = _ref => {
|
|
25
|
+
const DismissibleTag = /*#__PURE__*/forwardRef((_ref, forwardRef) => {
|
|
25
26
|
let {
|
|
26
27
|
className,
|
|
27
28
|
decorator,
|
|
@@ -46,6 +47,7 @@ const DismissibleTag = _ref => {
|
|
|
46
47
|
const newElement = tagLabelRef.current?.getElementsByClassName(`${prefix}--tag__label`)[0];
|
|
47
48
|
setIsEllipsisApplied(isEllipsisActive(newElement));
|
|
48
49
|
}, [prefix, tagLabelRef]);
|
|
50
|
+
const combinedRef = mergeRefs(tagLabelRef, forwardRef);
|
|
49
51
|
const handleClose = event => {
|
|
50
52
|
if (onClose) {
|
|
51
53
|
event.stopPropagation();
|
|
@@ -69,7 +71,7 @@ const DismissibleTag = _ref => {
|
|
|
69
71
|
} = other;
|
|
70
72
|
const dismissLabel = `Dismiss "${text}"`;
|
|
71
73
|
return /*#__PURE__*/React__default.createElement(Tag, _extends({
|
|
72
|
-
ref:
|
|
74
|
+
ref: combinedRef,
|
|
73
75
|
type: type,
|
|
74
76
|
size: size,
|
|
75
77
|
renderIcon: renderIcon,
|
|
@@ -96,7 +98,7 @@ const DismissibleTag = _ref => {
|
|
|
96
98
|
disabled: disabled,
|
|
97
99
|
"aria-label": title
|
|
98
100
|
}, _Close || (_Close = /*#__PURE__*/React__default.createElement(Close, null))))));
|
|
99
|
-
};
|
|
101
|
+
});
|
|
100
102
|
DismissibleTag.propTypes = {
|
|
101
103
|
/**
|
|
102
104
|
* Provide a custom className that is applied to the containing <span>
|
|
@@ -52,6 +52,6 @@ export interface OperationalTagBaseProps {
|
|
|
52
52
|
type?: keyof typeof TYPES;
|
|
53
53
|
}
|
|
54
54
|
export type OperationalTagProps<T extends React.ElementType> = PolymorphicProps<T, OperationalTagBaseProps>;
|
|
55
|
-
declare const OperationalTag: React.ForwardRefExoticComponent<Omit<OperationalTagProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<
|
|
55
|
+
declare const OperationalTag: React.ForwardRefExoticComponent<Omit<OperationalTagProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
56
56
|
export declare const types: string[];
|
|
57
57
|
export default OperationalTag;
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
7
|
import React, { MouseEvent } from 'react';
|
|
9
8
|
import { PolymorphicProps } from '../../types/common';
|
|
10
9
|
import { SIZES } from './Tag';
|
|
@@ -48,46 +47,5 @@ export interface SelectableTagBaseProps {
|
|
|
48
47
|
text?: string;
|
|
49
48
|
}
|
|
50
49
|
export type SelectableTagProps<T extends React.ElementType> = PolymorphicProps<T, SelectableTagBaseProps>;
|
|
51
|
-
declare const SelectableTag:
|
|
52
|
-
<T extends React.ElementType>({ className, disabled, id, renderIcon, onChange, onClick, selected, size, text, ...other }: SelectableTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
53
|
-
propTypes: {
|
|
54
|
-
/**
|
|
55
|
-
* Provide a custom className that is applied to the containing <span>
|
|
56
|
-
*/
|
|
57
|
-
className: PropTypes.Requireable<string>;
|
|
58
|
-
/**
|
|
59
|
-
* Specify if the `SelectableTag` is disabled
|
|
60
|
-
*/
|
|
61
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
62
|
-
/**
|
|
63
|
-
* Specify the id for the tag.
|
|
64
|
-
*/
|
|
65
|
-
id: PropTypes.Requireable<string>;
|
|
66
|
-
/**
|
|
67
|
-
* A component used to render an icon.
|
|
68
|
-
*/
|
|
69
|
-
renderIcon: PropTypes.Requireable<object>;
|
|
70
|
-
/**
|
|
71
|
-
* Provide an optional hook that is called when selected is changed
|
|
72
|
-
*/
|
|
73
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
74
|
-
/**
|
|
75
|
-
* Provide an optional function to be called when the tag is clicked.
|
|
76
|
-
*/
|
|
77
|
-
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
78
|
-
/**
|
|
79
|
-
* Specify the state of the selectable tag.
|
|
80
|
-
*/
|
|
81
|
-
selected: PropTypes.Requireable<boolean>;
|
|
82
|
-
/**
|
|
83
|
-
* Specify the size of the Tag. Currently supports either `sm`,
|
|
84
|
-
* `md` (default) or `lg` sizes.
|
|
85
|
-
*/
|
|
86
|
-
size: PropTypes.Requireable<string>;
|
|
87
|
-
/**
|
|
88
|
-
* Provide text to be rendered inside of a the tag.
|
|
89
|
-
*/
|
|
90
|
-
text: PropTypes.Requireable<string>;
|
|
91
|
-
};
|
|
92
|
-
};
|
|
50
|
+
declare const SelectableTag: React.ForwardRefExoticComponent<Omit<SelectableTagProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
93
51
|
export default SelectableTag;
|
|
@@ -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__default, { useRef, useState, useLayoutEffect } from 'react';
|
|
10
|
+
import React__default, { forwardRef, useRef, useState, useLayoutEffect } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { useId } from '../../internal/useId.js';
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
@@ -16,9 +16,10 @@ import '../Tooltip/DefinitionTooltip.js';
|
|
|
16
16
|
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
17
17
|
import '../Text/index.js';
|
|
18
18
|
import { isEllipsisActive } from './isEllipsisActive.js';
|
|
19
|
+
import mergeRefs from '../../tools/mergeRefs.js';
|
|
19
20
|
import { Text } from '../Text/Text.js';
|
|
20
21
|
|
|
21
|
-
const SelectableTag = _ref => {
|
|
22
|
+
const SelectableTag = /*#__PURE__*/forwardRef((_ref, forwardRef) => {
|
|
22
23
|
let {
|
|
23
24
|
className,
|
|
24
25
|
disabled,
|
|
@@ -44,6 +45,7 @@ const SelectableTag = _ref => {
|
|
|
44
45
|
setIsEllipsisApplied(isEllipsisActive(newElement));
|
|
45
46
|
}, [prefix, tagRef]);
|
|
46
47
|
const tooltipClasses = cx(`${prefix}--icon-tooltip`, `${prefix}--tag-label-tooltip`);
|
|
48
|
+
const combinedRef = mergeRefs(tagRef, forwardRef);
|
|
47
49
|
const handleClick = e => {
|
|
48
50
|
setSelectedTag(!selectedTag);
|
|
49
51
|
onChange?.(!selectedTag);
|
|
@@ -58,7 +60,7 @@ const SelectableTag = _ref => {
|
|
|
58
60
|
onMouseEnter: () => false
|
|
59
61
|
}, /*#__PURE__*/React__default.createElement(Tag, _extends({
|
|
60
62
|
"aria-pressed": selectedTag !== false,
|
|
61
|
-
ref:
|
|
63
|
+
ref: combinedRef,
|
|
62
64
|
size: size,
|
|
63
65
|
renderIcon: renderIcon,
|
|
64
66
|
disabled: disabled,
|
|
@@ -72,7 +74,7 @@ const SelectableTag = _ref => {
|
|
|
72
74
|
}
|
|
73
75
|
return /*#__PURE__*/React__default.createElement(Tag, _extends({
|
|
74
76
|
"aria-pressed": selectedTag !== false,
|
|
75
|
-
ref:
|
|
77
|
+
ref: combinedRef,
|
|
76
78
|
size: size,
|
|
77
79
|
renderIcon: renderIcon,
|
|
78
80
|
disabled: disabled,
|
|
@@ -83,7 +85,7 @@ const SelectableTag = _ref => {
|
|
|
83
85
|
title: text,
|
|
84
86
|
className: `${prefix}--tag__label`
|
|
85
87
|
}, text));
|
|
86
|
-
};
|
|
88
|
+
});
|
|
87
89
|
SelectableTag.propTypes = {
|
|
88
90
|
/**
|
|
89
91
|
* Provide a custom className that is applied to the containing <span>
|
package/es/components/Tag/Tag.js
CHANGED
|
@@ -17,7 +17,7 @@ import deprecate from '../../prop-types/deprecate.js';
|
|
|
17
17
|
import { DefinitionTooltip } from '../Tooltip/DefinitionTooltip.js';
|
|
18
18
|
import '../Tooltip/Tooltip.js';
|
|
19
19
|
import { isEllipsisActive } from './isEllipsisActive.js';
|
|
20
|
-
import {
|
|
20
|
+
import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
21
21
|
import { Text } from '../Text/Text.js';
|
|
22
22
|
|
|
23
23
|
var _Close;
|
|
@@ -62,7 +62,7 @@ const Tag = /*#__PURE__*/React__default.forwardRef((_ref, forwardRef) => {
|
|
|
62
62
|
} = _ref;
|
|
63
63
|
const prefix = usePrefix();
|
|
64
64
|
const tagRef = useRef();
|
|
65
|
-
const ref =
|
|
65
|
+
const ref = useMergedRefs([forwardRef, tagRef]);
|
|
66
66
|
const tagId = id || `tag-${useId()}`;
|
|
67
67
|
const [isEllipsisApplied, setIsEllipsisApplied] = useState(false);
|
|
68
68
|
useLayoutEffect(() => {
|
|
@@ -1,10 +1,10 @@
|
|
|
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 React, { ReactNode } from 'react';
|
|
7
|
+
import React, { type ReactNode } from 'react';
|
|
8
8
|
export interface TextAreaProps extends React.InputHTMLAttributes<HTMLTextAreaElement> {
|
|
9
9
|
/**
|
|
10
10
|
* Provide a custom className that is applied directly to the underlying
|
|
@@ -115,5 +115,5 @@ export interface TextAreaProps extends React.InputHTMLAttributes<HTMLTextAreaEle
|
|
|
115
115
|
*/
|
|
116
116
|
counterMode?: 'character' | 'word';
|
|
117
117
|
}
|
|
118
|
-
declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<
|
|
118
|
+
declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
119
119
|
export default TextArea;
|
|
@@ -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__default, { useContext, useRef, useState, useEffect } from 'react';
|
|
10
|
+
import React__default, { forwardRef, useContext, useRef, useState, useEffect } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import deprecate from '../../prop-types/deprecate.js';
|
|
13
13
|
import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
|
|
@@ -22,7 +22,10 @@ import { noopFn } from '../../internal/noopFn.js';
|
|
|
22
22
|
import '../Text/index.js';
|
|
23
23
|
import { Text } from '../Text/Text.js';
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
// TODO: This type was added to prevent the formatter from changing the
|
|
26
|
+
// indentation of this entire function. Delete it in a future pull request.
|
|
27
|
+
|
|
28
|
+
const TextArea = /*#__PURE__*/forwardRef((props, forwardRef) => {
|
|
26
29
|
const {
|
|
27
30
|
className,
|
|
28
31
|
decorator,
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2023, 2024
|
|
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
|
+
*/
|
|
1
7
|
import React from 'react';
|
|
2
8
|
import { ReactAttr } from '../../types/common';
|
|
3
9
|
export interface ControlledPasswordInputProps extends ReactAttr<HTMLInputElement> {
|
|
@@ -45,7 +45,7 @@ const ControlledPasswordInput = /*#__PURE__*/React__default.forwardRef(function
|
|
|
45
45
|
} = _ref;
|
|
46
46
|
const prefix = usePrefix();
|
|
47
47
|
const controlledPasswordInstanceId = useId();
|
|
48
|
-
if (process.env.NODE_ENV !==
|
|
48
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
49
49
|
process.env.NODE_ENV !== "production" ? warning(didWarnAboutDeprecation, '`<TextInput.ControlledPasswordInput>` has been deprecated in favor of `<TextInput.PasswordInput />` and will be removed in the next major release of `carbon-components-react`') : void 0;
|
|
50
50
|
didWarnAboutDeprecation = true;
|
|
51
51
|
}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2023, 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
|
+
*/
|
|
1
7
|
import React, { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
8
|
type ExcludedAttributes = 'size';
|
|
3
9
|
export interface PasswordInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
|
|
@@ -12,7 +12,7 @@ import TextInput from './TextInput.js';
|
|
|
12
12
|
export { default as TextInput, default } from './TextInput.js';
|
|
13
13
|
export { default as TextInputSkeleton } from './TextInput.Skeleton.js';
|
|
14
14
|
|
|
15
|
-
if (process.env.NODE_ENV !==
|
|
15
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
16
16
|
deprecateFieldOnObject(TextInput, 'ControlledPasswordInput', ControlledPasswordInput);
|
|
17
17
|
deprecateFieldOnObject(TextInput, 'PasswordInput', PasswordInput);
|
|
18
18
|
}
|
|
@@ -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 ChangeEvent, type HTMLAttributes, type KeyboardEvent, type MouseEvent, type ReactNode } from 'react';
|
|
8
8
|
export interface TileProps extends HTMLAttributes<HTMLDivElement> {
|
|
9
9
|
children?: ReactNode;
|
|
10
10
|
className?: string;
|
|
@@ -517,7 +517,6 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
|
|
|
517
517
|
});
|
|
518
518
|
}
|
|
519
519
|
return interactive ? /*#__PURE__*/React__default.createElement("div", _extends({
|
|
520
|
-
// @ts-expect-error: Needlesly strict & deep typing for the element type
|
|
521
520
|
ref: ref,
|
|
522
521
|
className: interactiveClassNames
|
|
523
522
|
}, rest), /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -541,9 +540,7 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
|
|
|
541
540
|
className: `${prefix}--tile-content`,
|
|
542
541
|
id: belowTheFoldId
|
|
543
542
|
}, childrenAsArray[1]))) : /*#__PURE__*/React__default.createElement("button", _extends({
|
|
544
|
-
type: "button"
|
|
545
|
-
// @ts-expect-error: Needlesly strict & deep typing for the element type
|
|
546
|
-
,
|
|
543
|
+
type: "button",
|
|
547
544
|
ref: ref,
|
|
548
545
|
className: classNames,
|
|
549
546
|
"aria-expanded": isExpanded,
|
|
@@ -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, { ComponentType, FunctionComponent } from 'react';
|
|
7
|
+
import React, { type ComponentType, type FunctionComponent } from 'react';
|
|
8
8
|
export type TreeNodeProps = {
|
|
9
9
|
/**
|
|
10
10
|
* **Note:** this is controlled by the parent TreeView component, do not set manually.
|
|
@@ -47,10 +47,17 @@ const TreeNode = /*#__PURE__*/React__default.forwardRef((_ref, forwardedRef) =>
|
|
|
47
47
|
} = useRef(nodeId || uniqueId());
|
|
48
48
|
const controllableExpandedState = useControllableState({
|
|
49
49
|
value: isExpanded,
|
|
50
|
-
onChange:
|
|
51
|
-
|
|
50
|
+
onChange: newValue => {
|
|
51
|
+
onToggle?.(undefined, {
|
|
52
|
+
id,
|
|
53
|
+
isExpanded: newValue,
|
|
54
|
+
label,
|
|
55
|
+
value
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
defaultValue: defaultIsExpanded ?? false
|
|
52
59
|
});
|
|
53
|
-
const uncontrollableExpandedState = useState(isExpanded);
|
|
60
|
+
const uncontrollableExpandedState = useState(isExpanded ?? false);
|
|
54
61
|
const [expanded, setExpanded] = enableTreeviewControllable ? controllableExpandedState : uncontrollableExpandedState;
|
|
55
62
|
const currentNode = useRef(null);
|
|
56
63
|
const currentNodeLabel = useRef(null);
|
|
@@ -244,7 +251,7 @@ const TreeNode = /*#__PURE__*/React__default.forwardRef((_ref, forwardedRef) =>
|
|
|
244
251
|
}
|
|
245
252
|
if (!enableTreeviewControllable) {
|
|
246
253
|
// sync props and state
|
|
247
|
-
setExpanded(isExpanded);
|
|
254
|
+
setExpanded(isExpanded ?? false);
|
|
248
255
|
}
|
|
249
256
|
}, [children, depth, Icon, isExpanded, enableTreeviewControllable, setExpanded]);
|
|
250
257
|
const treeNodeProps = {
|
|
@@ -44,7 +44,11 @@ const TreeView = _ref => {
|
|
|
44
44
|
const treeWalker = useRef(treeRootRef?.current);
|
|
45
45
|
const controllableSelectionState = useControllableState({
|
|
46
46
|
value: preselected,
|
|
47
|
-
onChange:
|
|
47
|
+
onChange: newSelected => {
|
|
48
|
+
onSelect?.(undefined, {
|
|
49
|
+
activeNodeId: newSelected[0]
|
|
50
|
+
});
|
|
51
|
+
},
|
|
48
52
|
defaultValue: []
|
|
49
53
|
});
|
|
50
54
|
const uncontrollableSelectionState = useState(preselected ?? []);
|
|
@@ -127,11 +131,7 @@ const TreeView = _ref => {
|
|
|
127
131
|
});
|
|
128
132
|
function handleKeyDown(event) {
|
|
129
133
|
event.stopPropagation();
|
|
130
|
-
if (matches(event, [ArrowUp, ArrowDown, Home, End
|
|
131
|
-
// @ts-ignore - `matches` doesn't like the object syntax without missing properties
|
|
132
|
-
{
|
|
133
|
-
code: 'KeyA'
|
|
134
|
-
}])) {
|
|
134
|
+
if (matches(event, [ArrowUp, ArrowDown, Home, End])) {
|
|
135
135
|
event.preventDefault();
|
|
136
136
|
}
|
|
137
137
|
if (!treeWalker.current) {
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
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
|
-
/**
|
|
8
|
-
* Copyright IBM Corp. 2016, 2023
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
9
3
|
*
|
|
10
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
11
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2023, 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
|
+
*/
|
|
1
7
|
import React, { HTMLAttributeAnchorTarget, KeyboardEvent } from 'react';
|
|
2
8
|
export interface BaseSwitcherItemProps {
|
|
3
9
|
/**
|
package/es/index.d.ts
CHANGED
|
@@ -31,6 +31,9 @@ export * from './components/DatePickerInput';
|
|
|
31
31
|
export * from './components/Dropdown';
|
|
32
32
|
export * from './components/ErrorBoundary';
|
|
33
33
|
export * from './components/ExpandableSearch';
|
|
34
|
+
export { FeatureFlags, useFeatureFlag, useFeatureFlags, FeatureFlags as unstable_FeatureFlags, // this export can be removed in v12
|
|
35
|
+
useFeatureFlag as unstable_useFeatureFlag, // this export can be removed in v12
|
|
36
|
+
useFeatureFlags as unstable_useFeatureFlags, } from './components/FeatureFlags';
|
|
34
37
|
export * from './components/FileUploader';
|
|
35
38
|
export * from './components/FilterableMultiSelect';
|
|
36
39
|
export * from './components/FluidForm';
|
|
@@ -55,6 +58,7 @@ export * from './components/NumberInput';
|
|
|
55
58
|
export * from './components/OrderedList';
|
|
56
59
|
export * from './components/OverflowMenu';
|
|
57
60
|
export * from './components/OverflowMenuItem';
|
|
61
|
+
export * as unstable__PageHeader from './components/PageHeader';
|
|
58
62
|
export * from './components/Pagination';
|
|
59
63
|
export * from './components/Pagination/Pagination.Skeleton';
|
|
60
64
|
export * from './components/PaginationNav';
|
|
@@ -95,7 +99,6 @@ export * from './components/Toggletip';
|
|
|
95
99
|
export * from './components/TreeView';
|
|
96
100
|
export * from './components/UIShell';
|
|
97
101
|
export * from './components/UnorderedList';
|
|
98
|
-
export { FeatureFlags as unstable_FeatureFlags, useFeatureFlag as unstable_useFeatureFlag, useFeatureFlags as unstable_useFeatureFlags, } from './components/FeatureFlags';
|
|
99
102
|
export { FluidComboBox as unstable__FluidComboBox, FluidComboBoxSkeleton as unstable__FluidComboBoxSkeleton, } from './components/FluidComboBox';
|
|
100
103
|
export { FluidDatePicker as unstable__FluidDatePicker, FluidDatePickerSkeleton as unstable__FluidDatePickerSkeleton, } from './components/FluidDatePicker';
|
|
101
104
|
export { FluidDatePickerInput as unstable__FluidDatePickerInput } from './components/FluidDatePickerInput';
|
|
@@ -263,6 +266,7 @@ export type { NumberInputSkeletonProps } from './components/NumberInput/NumberIn
|
|
|
263
266
|
export type { OrderedListProps } from './components/OrderedList/OrderedList';
|
|
264
267
|
export type { OverflowMenuProps } from './components/OverflowMenu/OverflowMenu';
|
|
265
268
|
export type { OverflowMenuItemProps } from './components/OverflowMenuItem/OverflowMenuItem';
|
|
269
|
+
export type { PageHeaderProps, PageHeaderBreadcrumbBarProps, PageHeaderContentProps, PageHeaderHeroImageProps, PageHeaderTabBarProps, } from './components/PageHeader';
|
|
266
270
|
export type { PaginationProps } from './components/Pagination/Pagination';
|
|
267
271
|
export type { PaginationSkeletonProps } from './components/Pagination/Pagination.Skeleton';
|
|
268
272
|
export type { DirectionButtonProps } from './components/PaginationNav/PaginationNav';
|
package/es/index.js
CHANGED
|
@@ -43,6 +43,7 @@ export { default as DropdownSkeleton } from './components/Dropdown/Dropdown.Skel
|
|
|
43
43
|
export { default as ErrorBoundary } from './components/ErrorBoundary/ErrorBoundary.js';
|
|
44
44
|
export { ErrorBoundaryContext } from './components/ErrorBoundary/ErrorBoundaryContext.js';
|
|
45
45
|
export { default as ExpandableSearch } from './components/ExpandableSearch/ExpandableSearch.js';
|
|
46
|
+
export { FeatureFlags, FeatureFlags as unstable_FeatureFlags, useFeatureFlag as unstable_useFeatureFlag, useFeatureFlags as unstable_useFeatureFlags, useFeatureFlag, useFeatureFlags } from './components/FeatureFlags/index.js';
|
|
46
47
|
export { default as FileUploader } from './components/FileUploader/FileUploader.js';
|
|
47
48
|
export { default as Filename } from './components/FileUploader/Filename.js';
|
|
48
49
|
export { default as FileUploaderSkeleton } from './components/FileUploader/FileUploader.Skeleton.js';
|
|
@@ -79,6 +80,8 @@ export { NumberInput } from './components/NumberInput/NumberInput.js';
|
|
|
79
80
|
export { default as OrderedList } from './components/OrderedList/OrderedList.js';
|
|
80
81
|
export { default as OverflowMenu } from './components/OverflowMenu/index.js';
|
|
81
82
|
export { default as OverflowMenuItem } from './components/OverflowMenuItem/OverflowMenuItem.js';
|
|
83
|
+
import * as index from './components/PageHeader/index.js';
|
|
84
|
+
export { index as unstable__PageHeader };
|
|
82
85
|
export { default as Pagination } from './components/Pagination/Pagination.js';
|
|
83
86
|
export { default as PaginationSkeleton } from './components/Pagination/Pagination.Skeleton.js';
|
|
84
87
|
export { default as PaginationNav } from './components/PaginationNav/PaginationNav.js';
|
|
@@ -160,7 +163,6 @@ export { default as SideNavMenu } from './components/UIShell/SideNavMenu.js';
|
|
|
160
163
|
export { default as SideNavMenuItem } from './components/UIShell/SideNavMenuItem.js';
|
|
161
164
|
export { default as SideNavSwitcher } from './components/UIShell/SideNavSwitcher.js';
|
|
162
165
|
export { default as UnorderedList } from './components/UnorderedList/UnorderedList.js';
|
|
163
|
-
export { FeatureFlags as unstable_FeatureFlags, useFeatureFlag as unstable_useFeatureFlag, useFeatureFlags as unstable_useFeatureFlags } from './components/FeatureFlags/index.js';
|
|
164
166
|
export { default as unstable__FluidComboBox } from './components/FluidComboBox/FluidComboBox.js';
|
|
165
167
|
export { default as unstable__FluidComboBoxSkeleton } from './components/FluidComboBox/FluidComboBox.Skeleton.js';
|
|
166
168
|
export { default as unstable__FluidDatePicker } from './components/FluidDatePicker/FluidDatePicker.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
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 React, { type ReactElement } from 'react';
|
|
8
|
+
interface ClickListenerProps {
|
|
9
|
+
children: ReactElement;
|
|
10
|
+
onClickOutside: (event: MouseEvent) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const ClickListener: ({ children, onClickOutside, }: ClickListenerProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
13
|
+
export {};
|