@carbon/react 1.65.0 → 1.66.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 +927 -927
- package/es/components/AILabel/index.d.ts +37 -0
- package/es/components/AILabel/index.js +38 -14
- package/es/components/Accordion/Accordion.d.ts +5 -1
- package/es/components/Breadcrumb/BreadcrumbItem.js +1 -1
- package/es/components/Button/Button.d.ts +2 -1
- package/es/components/Button/Button.js +14 -3
- package/es/components/ChatButton/ChatButton.Skeleton.d.ts +31 -0
- package/es/components/ChatButton/ChatButton.Skeleton.js +1 -2
- package/es/components/ChatButton/ChatButton.d.ts +46 -0
- package/es/components/ChatButton/ChatButton.js +3 -3
- package/es/components/ChatButton/index.d.ts +12 -0
- package/es/components/Checkbox/index.js +10 -0
- package/es/components/CodeSnippet/CodeSnippet.d.ts +9 -1
- package/es/components/CodeSnippet/CodeSnippet.js +7 -0
- package/es/components/ComboBox/ComboBox.js +38 -19
- package/es/components/ComboButton/index.js +8 -3
- package/es/components/ComposedModal/index.d.ts +2 -0
- package/es/components/Copy/Copy.d.ts +9 -1
- package/es/components/Copy/Copy.js +6 -0
- package/es/components/CopyButton/CopyButton.d.ts +9 -1
- package/es/components/CopyButton/CopyButton.js +6 -0
- package/es/components/DataTable/TableSlugRow.d.ts +1 -0
- package/es/components/DataTable/TableSlugRow.js +1 -0
- package/es/components/Dropdown/Dropdown.js +1 -1
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +20 -0
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +3 -20
- package/es/components/FluidTextArea/FluidTextArea.d.ts +96 -0
- package/es/components/FluidTextArea/FluidTextArea.js +2 -2
- package/es/components/FluidTextArea/index.d.ts +12 -0
- package/es/components/Grid/Column.js +3 -3
- package/es/components/IconButton/index.d.ts +4 -0
- package/es/components/IconButton/index.js +6 -0
- package/es/components/ListBox/ListBoxMenuItem.d.ts +10 -1
- package/es/components/ListBox/next/ListBoxSelection.d.ts +106 -0
- package/es/components/ListBox/next/ListBoxSelection.js +12 -16
- package/es/components/ListBox/next/ListBoxTrigger.d.ts +31 -0
- package/es/components/ListBox/next/ListBoxTrigger.js +2 -4
- package/es/components/ListBox/next/index.d.ts +8 -0
- package/es/components/Menu/Menu.js +2 -1
- package/es/components/MultiSelect/FilterableMultiSelect.js +14 -15
- package/es/components/MultiSelect/MultiSelect.js +65 -49
- package/es/components/MultiSelect/tools/sorting.js +5 -8
- package/es/components/OverflowMenu/OverflowMenu.js +1 -1
- package/es/components/OverflowMenu/next/index.js +3 -1
- package/es/components/Popover/index.js +22 -5
- package/es/components/Tag/DismissibleTag.d.ts +9 -1
- package/es/components/Tag/DismissibleTag.js +7 -3
- package/es/components/Tag/Tag.js +2 -2
- package/es/components/Toggletip/index.js +2 -1
- package/es/components/TreeView/TreeNode.js +41 -33
- package/es/components/TreeView/TreeView.d.ts +5 -3
- package/es/index.js +4 -4
- package/es/internal/Selection.js +30 -18
- package/es/internal/useMergedRefs.d.ts +1 -1
- package/lib/components/AILabel/index.d.ts +37 -0
- package/lib/components/AILabel/index.js +38 -14
- package/lib/components/Accordion/Accordion.d.ts +5 -1
- package/lib/components/Breadcrumb/BreadcrumbItem.js +1 -1
- package/lib/components/Button/Button.d.ts +2 -1
- package/lib/components/Button/Button.js +13 -2
- package/lib/components/ChatButton/ChatButton.Skeleton.d.ts +31 -0
- package/lib/components/ChatButton/ChatButton.Skeleton.js +1 -2
- package/lib/components/ChatButton/ChatButton.d.ts +46 -0
- package/lib/components/ChatButton/ChatButton.js +4 -4
- package/lib/components/ChatButton/index.d.ts +12 -0
- package/lib/components/Checkbox/index.js +19 -0
- package/lib/components/CodeSnippet/CodeSnippet.d.ts +9 -1
- package/lib/components/CodeSnippet/CodeSnippet.js +7 -0
- package/lib/components/ComboBox/ComboBox.js +38 -19
- package/lib/components/ComboButton/index.js +8 -3
- package/lib/components/ComposedModal/index.d.ts +2 -0
- package/lib/components/Copy/Copy.d.ts +9 -1
- package/lib/components/Copy/Copy.js +6 -0
- package/lib/components/CopyButton/CopyButton.d.ts +9 -1
- package/lib/components/CopyButton/CopyButton.js +6 -0
- package/lib/components/DataTable/TableSlugRow.d.ts +1 -0
- package/lib/components/DataTable/TableSlugRow.js +1 -0
- package/lib/components/Dropdown/Dropdown.js +1 -1
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +20 -0
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +3 -22
- package/lib/components/FluidTextArea/FluidTextArea.d.ts +96 -0
- package/lib/components/FluidTextArea/FluidTextArea.js +2 -2
- package/lib/components/FluidTextArea/index.d.ts +12 -0
- package/lib/components/Grid/Column.js +3 -3
- package/lib/components/IconButton/index.d.ts +4 -0
- package/lib/components/IconButton/index.js +6 -0
- package/lib/components/ListBox/ListBoxMenuItem.d.ts +10 -1
- package/lib/components/ListBox/next/ListBoxSelection.d.ts +106 -0
- package/lib/components/ListBox/next/ListBoxSelection.js +11 -16
- package/lib/components/ListBox/next/ListBoxTrigger.d.ts +31 -0
- package/lib/components/ListBox/next/ListBoxTrigger.js +2 -4
- package/lib/components/ListBox/next/index.d.ts +8 -0
- package/lib/components/Menu/Menu.js +2 -1
- package/lib/components/MultiSelect/FilterableMultiSelect.js +14 -15
- package/lib/components/MultiSelect/MultiSelect.js +64 -48
- package/lib/components/MultiSelect/tools/sorting.js +5 -8
- package/lib/components/OverflowMenu/OverflowMenu.js +1 -1
- package/lib/components/OverflowMenu/next/index.js +3 -1
- package/lib/components/Popover/index.js +22 -5
- package/lib/components/Tag/DismissibleTag.d.ts +9 -1
- package/lib/components/Tag/DismissibleTag.js +7 -3
- package/lib/components/Tag/Tag.js +2 -2
- package/lib/components/Toggletip/index.js +2 -1
- package/lib/components/TreeView/TreeNode.js +41 -33
- package/lib/components/TreeView/TreeView.d.ts +5 -3
- package/lib/index.js +8 -8
- package/lib/internal/Selection.js +30 -18
- package/lib/internal/useMergedRefs.d.ts +1 -1
- package/package.json +25 -22
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 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
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
export type AILabelContentProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
9
|
+
export declare const AILabelContent: React.ForwardRefExoticComponent<AILabelContentProps & React.RefAttributes<unknown>>;
|
|
10
|
+
export type AILabelActionsProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
11
|
+
export declare const AILabelActions: React.ForwardRefExoticComponent<AILabelActionsProps & React.RefAttributes<unknown>>;
|
|
12
|
+
/**
|
|
13
|
+
* Deprecated popover alignment values.
|
|
14
|
+
* @deprecated Use NewPopoverAlignment instead.
|
|
15
|
+
*/
|
|
16
|
+
export type DeprecatedAlignment = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top';
|
|
17
|
+
export type NewAlignment = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
|
|
18
|
+
export type Alignment = DeprecatedAlignment | NewAlignment;
|
|
19
|
+
interface AILabelProps {
|
|
20
|
+
AILabelContent?: React.ReactNode;
|
|
21
|
+
aiText?: string;
|
|
22
|
+
aiTextLabel?: string;
|
|
23
|
+
textLabel?: string;
|
|
24
|
+
align?: Alignment;
|
|
25
|
+
autoAlign?: boolean;
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
className?: string;
|
|
28
|
+
kind?: 'default' | 'inline';
|
|
29
|
+
onRevertClick?: (evt: React.MouseEvent<HTMLButtonElement>) => void;
|
|
30
|
+
revertActive?: boolean;
|
|
31
|
+
revertLabel?: string;
|
|
32
|
+
size?: 'mini' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
33
|
+
'aria-label'?: string;
|
|
34
|
+
slugLabel?: string;
|
|
35
|
+
}
|
|
36
|
+
export declare const AILabel: React.ForwardRefExoticComponent<AILabelProps & React.RefAttributes<HTMLDivElement>>;
|
|
37
|
+
export {};
|
|
@@ -8,10 +8,12 @@
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
|
+
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
11
12
|
import React__default from 'react';
|
|
12
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
14
|
import { ToggletipContent, ToggletipActions, Toggletip, ToggletipButton } from '../Toggletip/index.js';
|
|
14
15
|
import { IconButton } from '../IconButton/index.js';
|
|
16
|
+
import { mapPopoverAlignProp } from '../../tools/createPropAdapter.js';
|
|
15
17
|
import { Undo } from '@carbon/icons-react';
|
|
16
18
|
import { useId } from '../../internal/useId.js';
|
|
17
19
|
import deprecate from '../../prop-types/deprecate.js';
|
|
@@ -19,11 +21,15 @@ import deprecate from '../../prop-types/deprecate.js';
|
|
|
19
21
|
var _Undo;
|
|
20
22
|
const AILabelContent = /*#__PURE__*/React__default.forwardRef(function AILabelContent(_ref, ref) {
|
|
21
23
|
let {
|
|
24
|
+
className,
|
|
22
25
|
children,
|
|
23
|
-
|
|
26
|
+
...rest
|
|
24
27
|
} = _ref;
|
|
25
28
|
const prefix = usePrefix();
|
|
26
|
-
const hasAILabelActions = React__default.Children.toArray(children).some(child =>
|
|
29
|
+
const hasAILabelActions = React__default.Children.toArray(children).some(child => {
|
|
30
|
+
const item = child;
|
|
31
|
+
item.type?.displayName === 'AILabelActions';
|
|
32
|
+
});
|
|
27
33
|
const aiLabelContentClasses = cx(className, {
|
|
28
34
|
[`${prefix}--slug-content`]: true,
|
|
29
35
|
[`${prefix}--slug-content--with-actions`]: hasAILabelActions
|
|
@@ -45,16 +51,16 @@ AILabelContent.propTypes = {
|
|
|
45
51
|
};
|
|
46
52
|
const AILabelActions = /*#__PURE__*/React__default.forwardRef(function AILabelActions(_ref2, ref) {
|
|
47
53
|
let {
|
|
54
|
+
className,
|
|
48
55
|
children,
|
|
49
|
-
|
|
56
|
+
...rest
|
|
50
57
|
} = _ref2;
|
|
51
58
|
const prefix = usePrefix();
|
|
52
59
|
const aiLabelActionsClasses = cx(className, {
|
|
53
60
|
[`${prefix}--slug-actions`]: true
|
|
54
61
|
});
|
|
55
62
|
return /*#__PURE__*/React__default.createElement(ToggletipActions, {
|
|
56
|
-
className: aiLabelActionsClasses
|
|
57
|
-
ref: ref
|
|
63
|
+
className: aiLabelActionsClasses
|
|
58
64
|
}, children);
|
|
59
65
|
});
|
|
60
66
|
AILabelActions.displayName = 'AILabelActions';
|
|
@@ -68,6 +74,15 @@ AILabelActions.propTypes = {
|
|
|
68
74
|
*/
|
|
69
75
|
className: PropTypes.string
|
|
70
76
|
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Deprecated popover alignment values.
|
|
80
|
+
* @deprecated Use NewPopoverAlignment instead.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
const propMappingFunction = deprecatedValue => {
|
|
84
|
+
return mapPopoverAlignProp(deprecatedValue);
|
|
85
|
+
};
|
|
71
86
|
const AILabel = /*#__PURE__*/React__default.forwardRef(function AILabel(_ref3, ref) {
|
|
72
87
|
let {
|
|
73
88
|
aiText = 'AI',
|
|
@@ -143,23 +158,32 @@ AILabel.propTypes = {
|
|
|
143
158
|
/**
|
|
144
159
|
* Specify how the popover should align with the button
|
|
145
160
|
*/
|
|
146
|
-
align: PropTypes.oneOf(['top', 'top-left',
|
|
161
|
+
align: deprecateValuesWithin(PropTypes.oneOf(['top', 'top-left',
|
|
147
162
|
// deprecated use top-start instead
|
|
148
|
-
'top-
|
|
163
|
+
'top-right',
|
|
149
164
|
// deprecated use top-end instead
|
|
150
|
-
|
|
165
|
+
|
|
166
|
+
'bottom', 'bottom-left',
|
|
151
167
|
// deprecated use bottom-start instead
|
|
152
|
-
'bottom-
|
|
168
|
+
'bottom-right',
|
|
153
169
|
// deprecated use bottom-end instead
|
|
154
|
-
|
|
170
|
+
|
|
171
|
+
'left', 'left-bottom',
|
|
155
172
|
// deprecated use left-end instead
|
|
156
|
-
'left-
|
|
173
|
+
'left-top',
|
|
157
174
|
// deprecated use left-start instead
|
|
158
|
-
|
|
175
|
+
|
|
176
|
+
'right', 'right-bottom',
|
|
159
177
|
// deprecated use right-end instead
|
|
160
|
-
'right-
|
|
178
|
+
'right-top',
|
|
161
179
|
// deprecated use right-start instead
|
|
162
|
-
|
|
180
|
+
|
|
181
|
+
// new values to match floating-ui
|
|
182
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
183
|
+
//allowed prop values
|
|
184
|
+
['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
|
|
185
|
+
//optional mapper function
|
|
186
|
+
propMappingFunction),
|
|
163
187
|
/**
|
|
164
188
|
* Specify the text that will be provided to the aria-label of the `AILabel` button
|
|
165
189
|
*/
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import { PropsWithChildren } from 'react';
|
|
8
|
+
import { PropsWithChildren, ReactNode } from 'react';
|
|
9
9
|
export interface AccordionProps {
|
|
10
10
|
/**
|
|
11
11
|
* Specify the alignment of the accordion heading
|
|
@@ -17,6 +17,10 @@ export interface AccordionProps {
|
|
|
17
17
|
* the container node.
|
|
18
18
|
*/
|
|
19
19
|
className?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Pass in the children that will be rendered within the Accordion
|
|
22
|
+
*/
|
|
23
|
+
children?: ReactNode;
|
|
20
24
|
/**
|
|
21
25
|
* Specify whether an individual AccordionItem
|
|
22
26
|
* should be disabled.
|
|
@@ -54,7 +54,7 @@ const BreadcrumbItem = /*#__PURE__*/React__default.forwardRef(function Breadcrum
|
|
|
54
54
|
ref: ref
|
|
55
55
|
}, rest), href ? /*#__PURE__*/React__default.createElement(Link, {
|
|
56
56
|
href: href,
|
|
57
|
-
"aria-current": ariaCurrent
|
|
57
|
+
"aria-current": ariaCurrent || isCurrentPage
|
|
58
58
|
}, children) : /*#__PURE__*/React__default.createElement(Text, {
|
|
59
59
|
className: `${prefix}--link`
|
|
60
60
|
}, children));
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
+
import { IconButtonKind } from '../IconButton';
|
|
8
9
|
import { PolymorphicProps } from '../../types/common';
|
|
9
10
|
export declare const ButtonKinds: readonly ["primary", "secondary", "danger", "ghost", "danger--primary", "danger--ghost", "danger--tertiary", "tertiary"];
|
|
10
11
|
export type ButtonKind = (typeof ButtonKinds)[number];
|
|
@@ -43,7 +44,7 @@ export interface ButtonBaseProps extends React.ButtonHTMLAttributes<HTMLButtonEl
|
|
|
43
44
|
/**
|
|
44
45
|
* Specify the kind of Button you want to create
|
|
45
46
|
*/
|
|
46
|
-
kind?: ButtonKind;
|
|
47
|
+
kind?: ButtonBaseProps['hasIconOnly'] extends true ? IconButtonKind : ButtonKind;
|
|
47
48
|
/**
|
|
48
49
|
* Optional prop to allow overriding the icon rendering.
|
|
49
50
|
* Can be a React component class
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import React__default, { useRef } from 'react';
|
|
11
|
-
import { IconButton } from '../IconButton/index.js';
|
|
11
|
+
import { IconButton, IconButtonKinds } from '../IconButton/index.js';
|
|
12
12
|
import { composeEventHandlers } from '../../tools/events.js';
|
|
13
13
|
import ButtonBase from './ButtonBase.js';
|
|
14
14
|
|
|
@@ -141,8 +141,19 @@ Button.propTypes = {
|
|
|
141
141
|
/**
|
|
142
142
|
* Specify the kind of Button you want to create
|
|
143
143
|
*/
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
kind: (props, propName, componentName) => {
|
|
145
|
+
const {
|
|
146
|
+
hasIconOnly
|
|
147
|
+
} = props;
|
|
148
|
+
const validKinds = hasIconOnly ? IconButtonKinds : ButtonKinds;
|
|
149
|
+
if (props[propName] === undefined) {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
if (!validKinds.includes(props[propName])) {
|
|
153
|
+
return new Error(`Invalid prop \`${propName}\` supplied to \`${componentName}\`. Expected one of ${validKinds.join(', ')}.`);
|
|
154
|
+
}
|
|
155
|
+
return null;
|
|
156
|
+
},
|
|
146
157
|
/**
|
|
147
158
|
* Provide an optional function to be called when the button element
|
|
148
159
|
* loses focus
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 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
|
+
*/
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
export interface ChatButtonSkeletonProps {
|
|
9
|
+
/**
|
|
10
|
+
* Specify an optional className to add.
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Specify the size of the `ChatButtonSkeleton`, from the following list of sizes:
|
|
15
|
+
*/
|
|
16
|
+
size?: 'sm' | 'md' | 'lg';
|
|
17
|
+
}
|
|
18
|
+
declare const ChatButtonSkeleton: {
|
|
19
|
+
({ className, size, ...rest }: ChatButtonSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
propTypes: {
|
|
21
|
+
/**
|
|
22
|
+
* Specify an optional className to add.
|
|
23
|
+
*/
|
|
24
|
+
className: PropTypes.Requireable<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Specify the size of the `ChatButtonSkeleton`, from the following list of sizes:
|
|
27
|
+
*/
|
|
28
|
+
size: PropTypes.Requireable<string>;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export default ChatButtonSkeleton;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 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
|
+
*/
|
|
7
|
+
import React, { type ComponentType, type FunctionComponent } from 'react';
|
|
8
|
+
export type ChatButtonKind = 'primary' | 'secondary' | 'danger' | 'ghost' | 'tertiary';
|
|
9
|
+
export type ChatButtonSize = 'sm' | 'md' | 'lg';
|
|
10
|
+
export interface ChatButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
11
|
+
/**
|
|
12
|
+
* Provide the contents of your Select
|
|
13
|
+
*/
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Specify an optional className to be applied to the node containing the label and the select box
|
|
17
|
+
*/
|
|
18
|
+
className?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Specify whether the `ChatButton` should be disabled
|
|
21
|
+
*/
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Specify whether the `ChatButton` should be rendered as a quick action button
|
|
25
|
+
*/
|
|
26
|
+
isQuickAction?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Specify whether the quick action `ChatButton` should be rendered as selected. This disables the input
|
|
29
|
+
*/
|
|
30
|
+
isSelected?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Specify the kind of `ChatButton` you want to create
|
|
33
|
+
*/
|
|
34
|
+
kind?: ChatButtonKind;
|
|
35
|
+
/**
|
|
36
|
+
* Optional prop to specify an icon to be rendered.
|
|
37
|
+
* Can be a React component class
|
|
38
|
+
*/
|
|
39
|
+
renderIcon?: ComponentType | FunctionComponent;
|
|
40
|
+
/**
|
|
41
|
+
* Specify the size of the `ChatButton`, from the following list of sizes:
|
|
42
|
+
*/
|
|
43
|
+
size?: ChatButtonSize;
|
|
44
|
+
}
|
|
45
|
+
declare const ChatButton: React.ForwardRefExoticComponent<ChatButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
46
|
+
export default ChatButton;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import PropTypes from 'prop-types';
|
|
10
9
|
import React__default from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import Button from '../Button/Button.js';
|
|
13
13
|
import '../Button/Button.Skeleton.js';
|
|
@@ -78,12 +78,12 @@ ChatButton.propTypes = {
|
|
|
78
78
|
* Optional prop to specify an icon to be rendered.
|
|
79
79
|
* Can be a React component class
|
|
80
80
|
*/
|
|
81
|
+
// @ts-expect-error: PropTypes are not expressive enough to cover this case
|
|
81
82
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
82
83
|
/**
|
|
83
84
|
* Specify the size of the `ChatButton`, from the following list of sizes:
|
|
84
85
|
*/
|
|
85
86
|
size: PropTypes.oneOf(['sm', 'md', 'lg'])
|
|
86
87
|
};
|
|
87
|
-
var ChatButton$1 = ChatButton;
|
|
88
88
|
|
|
89
|
-
export { ChatButton
|
|
89
|
+
export { ChatButton as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 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
|
+
*/
|
|
7
|
+
import ChatButton from './ChatButton';
|
|
8
|
+
import { type ChatButtonProps } from './ChatButton';
|
|
9
|
+
import { type ChatButtonSkeletonProps } from './ChatButton.Skeleton';
|
|
10
|
+
export default ChatButton;
|
|
11
|
+
export { ChatButton, type ChatButtonProps, type ChatButtonSkeletonProps };
|
|
12
|
+
export { default as ChatButtonSkeleton } from './ChatButton.Skeleton';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
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
|
+
import Checkbox from './Checkbox.js';
|
|
9
|
+
export { default as Checkbox, default } from './Checkbox.js';
|
|
10
|
+
export { default as CheckboxSkeleton } from './Checkbox.Skeleton.js';
|
|
@@ -11,6 +11,10 @@ export interface CodeSnippetProps {
|
|
|
11
11
|
* Specify how the trigger should align with the tooltip
|
|
12
12
|
*/
|
|
13
13
|
align?: 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'right';
|
|
14
|
+
/**
|
|
15
|
+
* **Experimental**: Will attempt to automatically align the tooltip
|
|
16
|
+
*/
|
|
17
|
+
autoAlign?: boolean;
|
|
14
18
|
/**
|
|
15
19
|
* Specify a label to be read by screen readers on the containing textbox
|
|
16
20
|
* node
|
|
@@ -96,7 +100,7 @@ export interface CodeSnippetProps {
|
|
|
96
100
|
*/
|
|
97
101
|
wrapText?: boolean;
|
|
98
102
|
}
|
|
99
|
-
declare function CodeSnippet({ align, className, type, children, disabled, feedback, feedbackTimeout, onClick, ['aria-label']: ariaLabel, ariaLabel: deprecatedAriaLabel, copyText, copyButtonDescription, light, showMoreText, showLessText, hideCopyButton, wrapText, maxCollapsedNumberOfRows, maxExpandedNumberOfRows, minCollapsedNumberOfRows, minExpandedNumberOfRows, ...rest }: PropsWithChildren<CodeSnippetProps>): import("react/jsx-runtime").JSX.Element;
|
|
103
|
+
declare function CodeSnippet({ align, autoAlign, className, type, children, disabled, feedback, feedbackTimeout, onClick, ['aria-label']: ariaLabel, ariaLabel: deprecatedAriaLabel, copyText, copyButtonDescription, light, showMoreText, showLessText, hideCopyButton, wrapText, maxCollapsedNumberOfRows, maxExpandedNumberOfRows, minCollapsedNumberOfRows, minExpandedNumberOfRows, ...rest }: PropsWithChildren<CodeSnippetProps>): import("react/jsx-runtime").JSX.Element;
|
|
100
104
|
declare namespace CodeSnippet {
|
|
101
105
|
var propTypes: {
|
|
102
106
|
/**
|
|
@@ -114,6 +118,10 @@ declare namespace CodeSnippet {
|
|
|
114
118
|
* node
|
|
115
119
|
*/
|
|
116
120
|
ariaLabel: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
121
|
+
/**
|
|
122
|
+
* **Experimental**: Will attempt to automatically align the tooltip
|
|
123
|
+
*/
|
|
124
|
+
autoAlign: PropTypes.Requireable<boolean>;
|
|
117
125
|
/**
|
|
118
126
|
* Provide the content of your CodeSnippet as a node or string
|
|
119
127
|
*/
|
|
@@ -28,6 +28,7 @@ const defaultMinExpandedNumberOfRows = 16;
|
|
|
28
28
|
function CodeSnippet(_ref) {
|
|
29
29
|
let {
|
|
30
30
|
align = 'bottom',
|
|
31
|
+
autoAlign = false,
|
|
31
32
|
className,
|
|
32
33
|
type = 'single',
|
|
33
34
|
children,
|
|
@@ -150,6 +151,7 @@ function CodeSnippet(_ref) {
|
|
|
150
151
|
}
|
|
151
152
|
return /*#__PURE__*/React__default.createElement(Copy, _extends({}, rest, {
|
|
152
153
|
align: align,
|
|
154
|
+
autoAlign: autoAlign,
|
|
153
155
|
onClick: handleCopyClick,
|
|
154
156
|
"aria-label": deprecatedAriaLabel || ariaLabel,
|
|
155
157
|
"aria-describedby": uid,
|
|
@@ -205,6 +207,7 @@ function CodeSnippet(_ref) {
|
|
|
205
207
|
className: `${prefix}--snippet__overflow-indicator--right`
|
|
206
208
|
}), !hideCopyButton && /*#__PURE__*/React__default.createElement(CopyButton, {
|
|
207
209
|
align: align,
|
|
210
|
+
autoAlign: autoAlign,
|
|
208
211
|
size: type === 'multi' ? 'sm' : 'md',
|
|
209
212
|
disabled: disabled,
|
|
210
213
|
onClick: handleCopyClick,
|
|
@@ -241,6 +244,10 @@ CodeSnippet.propTypes = {
|
|
|
241
244
|
* node
|
|
242
245
|
*/
|
|
243
246
|
ariaLabel: deprecate(PropTypes.string, 'This prop syntax has been deprecated. Please use the new `aria-label`.'),
|
|
247
|
+
/**
|
|
248
|
+
* **Experimental**: Will attempt to automatically align the tooltip
|
|
249
|
+
*/
|
|
250
|
+
autoAlign: PropTypes.bool,
|
|
244
251
|
/**
|
|
245
252
|
* Provide the content of your CodeSnippet as a node or string
|
|
246
253
|
*/
|
|
@@ -13,6 +13,8 @@ import React__default, { forwardRef, useEffect, useContext, useRef, useState, us
|
|
|
13
13
|
import '../Text/index.js';
|
|
14
14
|
import { WarningFilled, WarningAltFilled, Checkmark } from '@carbon/icons-react';
|
|
15
15
|
import ListBox from '../ListBox/index.js';
|
|
16
|
+
import ListBoxSelection from '../ListBox/next/ListBoxSelection.js';
|
|
17
|
+
import ListBoxTrigger from '../ListBox/next/ListBoxTrigger.js';
|
|
16
18
|
import { useId } from '../../internal/useId.js';
|
|
17
19
|
import mergeRefs from '../../tools/mergeRefs.js';
|
|
18
20
|
import deprecate from '../../prop-types/deprecate.js';
|
|
@@ -20,10 +22,9 @@ import { usePrefix } from '../../internal/usePrefix.js';
|
|
|
20
22
|
import '../FluidForm/FluidForm.js';
|
|
21
23
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
22
24
|
import { useFloating, flip, autoUpdate } from '@floating-ui/react';
|
|
25
|
+
import { hide } from '../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js';
|
|
23
26
|
import { Text } from '../Text/Text.js';
|
|
24
27
|
import { match } from '../../internal/keyboard/match.js';
|
|
25
|
-
import ListBoxSelection from '../ListBox/next/ListBoxSelection.js';
|
|
26
|
-
import ListBoxTrigger from '../ListBox/next/ListBoxTrigger.js';
|
|
27
28
|
import { ListBoxSize } from '../ListBox/ListBoxPropTypes.js';
|
|
28
29
|
import { Space, Enter, Escape, Home, End } from '../../internal/keyboard/keys.js';
|
|
29
30
|
|
|
@@ -128,19 +129,24 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
128
129
|
} = props;
|
|
129
130
|
const {
|
|
130
131
|
refs,
|
|
131
|
-
floatingStyles
|
|
132
|
+
floatingStyles,
|
|
133
|
+
middlewareData
|
|
132
134
|
} = useFloating(autoAlign ? {
|
|
133
135
|
placement: direction,
|
|
134
136
|
strategy: 'fixed',
|
|
135
|
-
middleware: [flip()],
|
|
137
|
+
middleware: [flip(), hide()],
|
|
136
138
|
whileElementsMounted: autoUpdate
|
|
137
139
|
} : {});
|
|
138
140
|
const parentWidth = refs?.reference?.current?.clientWidth;
|
|
139
141
|
useEffect(() => {
|
|
140
142
|
if (autoAlign) {
|
|
141
|
-
|
|
143
|
+
const updatedFloatingStyles = {
|
|
144
|
+
...floatingStyles,
|
|
145
|
+
visibility: middlewareData.hide?.referenceHidden ? 'hidden' : 'visible'
|
|
146
|
+
};
|
|
147
|
+
Object.keys(updatedFloatingStyles).forEach(style => {
|
|
142
148
|
if (refs.floating.current) {
|
|
143
|
-
refs.floating.current.style[style] =
|
|
149
|
+
refs.floating.current.style[style] = updatedFloatingStyles[style];
|
|
144
150
|
}
|
|
145
151
|
});
|
|
146
152
|
if (parentWidth && refs.floating.current) {
|
|
@@ -207,17 +213,30 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
207
213
|
} = changes;
|
|
208
214
|
switch (type) {
|
|
209
215
|
case InputBlur:
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
216
|
+
{
|
|
217
|
+
if (allowCustomValue && highlightedIndex == '-1') {
|
|
218
|
+
const customValue = inputValue;
|
|
219
|
+
changes.selectedItem = customValue;
|
|
220
|
+
if (onChange) {
|
|
221
|
+
onChange({
|
|
222
|
+
selectedItem: inputValue,
|
|
223
|
+
inputValue
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
return changes;
|
|
227
|
+
}
|
|
228
|
+
if (state.inputValue && highlightedIndex == '-1' && changes.selectedItem) {
|
|
229
|
+
return {
|
|
230
|
+
...changes,
|
|
231
|
+
inputValue: itemToString(changes.selectedItem)
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
if (state.inputValue && highlightedIndex == '-1' && !allowCustomValue && !changes.selectedItem) {
|
|
235
|
+
return {
|
|
236
|
+
...changes,
|
|
237
|
+
inputValue: ''
|
|
238
|
+
};
|
|
239
|
+
}
|
|
221
240
|
return changes;
|
|
222
241
|
}
|
|
223
242
|
case InputKeyDownEnter:
|
|
@@ -286,7 +305,8 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
286
305
|
[`${prefix}--combo-box--invalid--focused`]: invalid && isFocused,
|
|
287
306
|
[`${prefix}--list-box--up`]: direction === 'top',
|
|
288
307
|
[`${prefix}--combo-box--warning`]: showWarning,
|
|
289
|
-
[`${prefix}--combo-box--readonly`]: readOnly
|
|
308
|
+
[`${prefix}--combo-box--readonly`]: readOnly,
|
|
309
|
+
[`${prefix}--autoalign`]: autoAlign
|
|
290
310
|
});
|
|
291
311
|
const titleClasses = cx(`${prefix}--label`, {
|
|
292
312
|
[`${prefix}--label--disabled`]: disabled
|
|
@@ -533,7 +553,6 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
533
553
|
onClearSelection: handleSelectionClear,
|
|
534
554
|
selectionCount: 0
|
|
535
555
|
}), /*#__PURE__*/React__default.createElement(ListBoxTrigger, _extends({}, buttonProps, {
|
|
536
|
-
// @ts-expect-error
|
|
537
556
|
isOpen: isOpen,
|
|
538
557
|
translateWithId: translateWithId
|
|
539
558
|
}))), normalizedSlug, /*#__PURE__*/React__default.createElement(ListBox.Menu, menuProps, isOpen ? filterItems(items, itemToString, inputValue).map((item, index) => {
|
|
@@ -20,6 +20,7 @@ import { useId } from '../../internal/useId.js';
|
|
|
20
20
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
21
21
|
import { flip, size, useFloating, autoUpdate } from '@floating-ui/react';
|
|
22
22
|
import mergeRefs from '../../tools/mergeRefs.js';
|
|
23
|
+
import { hide } from '../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js';
|
|
23
24
|
|
|
24
25
|
var _ChevronDown;
|
|
25
26
|
const defaultTranslations = {
|
|
@@ -51,7 +52,7 @@ const ComboButton = /*#__PURE__*/React__default.forwardRef(function ComboButton(
|
|
|
51
52
|
const containerRef = useRef(null);
|
|
52
53
|
const middlewares = [flip({
|
|
53
54
|
crossAxis: false
|
|
54
|
-
})];
|
|
55
|
+
}), hide()];
|
|
55
56
|
if (menuAlignment === 'bottom' || menuAlignment === 'top') {
|
|
56
57
|
middlewares.push(size({
|
|
57
58
|
apply(_ref2) {
|
|
@@ -89,9 +90,13 @@ const ComboButton = /*#__PURE__*/React__default.forwardRef(function ComboButton(
|
|
|
89
90
|
handleClose
|
|
90
91
|
} = useAttachedMenu(containerRef);
|
|
91
92
|
useLayoutEffect(() => {
|
|
92
|
-
|
|
93
|
+
const updatedFloatingStyles = {
|
|
94
|
+
...floatingStyles,
|
|
95
|
+
visibility: middlewareData.hide?.referenceHidden ? 'hidden' : 'visible'
|
|
96
|
+
};
|
|
97
|
+
Object.keys(updatedFloatingStyles).forEach(style => {
|
|
93
98
|
if (refs.floating.current) {
|
|
94
|
-
refs.floating.current.style[style] =
|
|
99
|
+
refs.floating.current.style[style] = updatedFloatingStyles[style];
|
|
95
100
|
}
|
|
96
101
|
});
|
|
97
102
|
}, [floatingStyles, refs.floating, middlewareData, placement, open]);
|
|
@@ -4,6 +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 ComposedModal from './ComposedModal';
|
|
7
8
|
export { default as ComposedModal, type ComposedModalProps, ModalBody, type ModalBodyProps, } from './ComposedModal';
|
|
8
9
|
export { ModalHeader, type ModalHeaderProps } from './ModalHeader';
|
|
9
10
|
export { ModalFooter, type ModalFooterProps } from './ModalFooter';
|
|
11
|
+
export default ComposedModal;
|
|
@@ -11,6 +11,10 @@ interface CopyProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
11
11
|
* Specify how the trigger should align with the tooltip
|
|
12
12
|
*/
|
|
13
13
|
align?: 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'right';
|
|
14
|
+
/**
|
|
15
|
+
* **Experimental**: Will attempt to automatically align the tooltip
|
|
16
|
+
*/
|
|
17
|
+
autoAlign?: boolean;
|
|
14
18
|
/**
|
|
15
19
|
* Specify an optional className to be applied to the underlying `<button>`
|
|
16
20
|
*/
|
|
@@ -35,13 +39,17 @@ interface CopyProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
35
39
|
*/
|
|
36
40
|
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
37
41
|
}
|
|
38
|
-
declare function Copy({ align, children, className, feedback, feedbackTimeout, onAnimationEnd, onClick, ...other }: PropsWithChildren<CopyProps>): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
declare function Copy({ align, autoAlign, children, className, feedback, feedbackTimeout, onAnimationEnd, onClick, ...other }: PropsWithChildren<CopyProps>): import("react/jsx-runtime").JSX.Element;
|
|
39
43
|
declare namespace Copy {
|
|
40
44
|
var propTypes: {
|
|
41
45
|
/**
|
|
42
46
|
* Specify how the trigger should align with the tooltip
|
|
43
47
|
*/
|
|
44
48
|
align: PropTypes.Requireable<string>;
|
|
49
|
+
/**
|
|
50
|
+
* **Experimental**: Will attempt to automatically align the tooltip
|
|
51
|
+
*/
|
|
52
|
+
autoAlign: PropTypes.Requireable<boolean>;
|
|
45
53
|
/**
|
|
46
54
|
* Pass in content to be rendered in the underlying `<button>`
|
|
47
55
|
*/
|
|
@@ -18,6 +18,7 @@ import { noopFn } from '../../internal/noopFn.js';
|
|
|
18
18
|
function Copy(_ref) {
|
|
19
19
|
let {
|
|
20
20
|
align = 'bottom',
|
|
21
|
+
autoAlign = false,
|
|
21
22
|
children,
|
|
22
23
|
className,
|
|
23
24
|
feedback = 'Copied!',
|
|
@@ -52,6 +53,7 @@ function Copy(_ref) {
|
|
|
52
53
|
return /*#__PURE__*/React__default.createElement(IconButton, _extends({
|
|
53
54
|
closeOnActivation: false,
|
|
54
55
|
align: align,
|
|
56
|
+
autoAlign: autoAlign,
|
|
55
57
|
className: classNames,
|
|
56
58
|
label: animation ? feedback : initialLabel,
|
|
57
59
|
onClick: composeEventHandlers([onClick, handleClick]),
|
|
@@ -65,6 +67,10 @@ Copy.propTypes = {
|
|
|
65
67
|
* Specify how the trigger should align with the tooltip
|
|
66
68
|
*/
|
|
67
69
|
align: PropTypes.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
|
|
70
|
+
/**
|
|
71
|
+
* **Experimental**: Will attempt to automatically align the tooltip
|
|
72
|
+
*/
|
|
73
|
+
autoAlign: PropTypes.bool,
|
|
68
74
|
/**
|
|
69
75
|
* Pass in content to be rendered in the underlying `<button>`
|
|
70
76
|
*/
|