@carbon/react 1.66.0-rc.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 +822 -898
- 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/CodeSnippet/CodeSnippet.d.ts +9 -1
- package/es/components/CodeSnippet/CodeSnippet.js +7 -0
- package/es/components/ComboBox/ComboBox.js +26 -12
- 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/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/IconButton/index.d.ts +4 -0
- package/es/components/IconButton/index.js +6 -0
- package/es/components/Menu/Menu.js +2 -1
- package/es/components/MultiSelect/FilterableMultiSelect.js +2 -1
- package/es/components/MultiSelect/MultiSelect.js +1 -0
- package/es/components/OverflowMenu/next/index.js +3 -1
- package/es/components/Popover/index.js +1 -1
- 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/index.js +2 -2
- 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/CodeSnippet/CodeSnippet.d.ts +9 -1
- package/lib/components/CodeSnippet/CodeSnippet.js +7 -0
- package/lib/components/ComboBox/ComboBox.js +26 -12
- 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/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/IconButton/index.d.ts +4 -0
- package/lib/components/IconButton/index.js +6 -0
- package/lib/components/Menu/Menu.js +2 -1
- package/lib/components/MultiSelect/FilterableMultiSelect.js +2 -1
- package/lib/components/MultiSelect/MultiSelect.js +1 -0
- package/lib/components/OverflowMenu/next/index.js +3 -1
- package/lib/components/Popover/index.js +1 -1
- 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/index.js +4 -4
- package/package.json +9 -9
|
@@ -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
|
|
@@ -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
|
*/
|
|
@@ -213,17 +213,30 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
213
213
|
} = changes;
|
|
214
214
|
switch (type) {
|
|
215
215
|
case InputBlur:
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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
|
+
}
|
|
227
240
|
return changes;
|
|
228
241
|
}
|
|
229
242
|
case InputKeyDownEnter:
|
|
@@ -292,7 +305,8 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
292
305
|
[`${prefix}--combo-box--invalid--focused`]: invalid && isFocused,
|
|
293
306
|
[`${prefix}--list-box--up`]: direction === 'top',
|
|
294
307
|
[`${prefix}--combo-box--warning`]: showWarning,
|
|
295
|
-
[`${prefix}--combo-box--readonly`]: readOnly
|
|
308
|
+
[`${prefix}--combo-box--readonly`]: readOnly,
|
|
309
|
+
[`${prefix}--autoalign`]: autoAlign
|
|
296
310
|
});
|
|
297
311
|
const titleClasses = cx(`${prefix}--label`, {
|
|
298
312
|
[`${prefix}--label--disabled`]: disabled
|
|
@@ -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
|
*/
|
|
@@ -12,6 +12,10 @@ export interface CopyButtonProps extends ButtonProps<'button'> {
|
|
|
12
12
|
* Specify how the trigger should align with the tooltip
|
|
13
13
|
*/
|
|
14
14
|
align?: 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'right';
|
|
15
|
+
/**
|
|
16
|
+
* **Experimental**: Will attempt to automatically align the tooltip
|
|
17
|
+
*/
|
|
18
|
+
autoAlign?: boolean;
|
|
15
19
|
/**
|
|
16
20
|
* Specify an optional className to be applied to the underlying `<button>`
|
|
17
21
|
*/
|
|
@@ -36,13 +40,17 @@ export interface CopyButtonProps extends ButtonProps<'button'> {
|
|
|
36
40
|
*/
|
|
37
41
|
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
38
42
|
}
|
|
39
|
-
declare function CopyButton({ align, feedback, feedbackTimeout, iconDescription, className, onClick, ...other }: CopyButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
declare function CopyButton({ align, autoAlign, feedback, feedbackTimeout, iconDescription, className, onClick, ...other }: CopyButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
40
44
|
declare namespace CopyButton {
|
|
41
45
|
var propTypes: {
|
|
42
46
|
/**
|
|
43
47
|
* Specify how the trigger should align with the tooltip
|
|
44
48
|
*/
|
|
45
49
|
align: PropTypes.Requireable<string>;
|
|
50
|
+
/**
|
|
51
|
+
* **Experimental**: Will attempt to automatically align the tooltip
|
|
52
|
+
*/
|
|
53
|
+
autoAlign: PropTypes.Requireable<boolean>;
|
|
46
54
|
/**
|
|
47
55
|
* Specify an optional className to be applied to the underlying `<button>`
|
|
48
56
|
*/
|
|
@@ -18,6 +18,7 @@ import { noopFn } from '../../internal/noopFn.js';
|
|
|
18
18
|
function CopyButton(_ref) {
|
|
19
19
|
let {
|
|
20
20
|
align = 'bottom',
|
|
21
|
+
autoAlign = false,
|
|
21
22
|
feedback = 'Copied!',
|
|
22
23
|
feedbackTimeout = 2000,
|
|
23
24
|
iconDescription = 'Copy to clipboard',
|
|
@@ -36,6 +37,7 @@ function CopyButton(_ref) {
|
|
|
36
37
|
feedbackTimeout: feedbackTimeout,
|
|
37
38
|
onClick: onClick,
|
|
38
39
|
align: align,
|
|
40
|
+
autoAlign: autoAlign,
|
|
39
41
|
className: cx(className, `${prefix}--copy-btn`),
|
|
40
42
|
"aria-label": iconDescription
|
|
41
43
|
}, other), /*#__PURE__*/React__default.createElement(Copy$1, {
|
|
@@ -47,6 +49,10 @@ CopyButton.propTypes = {
|
|
|
47
49
|
* Specify how the trigger should align with the tooltip
|
|
48
50
|
*/
|
|
49
51
|
align: PropTypes.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
|
|
52
|
+
/**
|
|
53
|
+
* **Experimental**: Will attempt to automatically align the tooltip
|
|
54
|
+
*/
|
|
55
|
+
autoAlign: PropTypes.bool,
|
|
50
56
|
/**
|
|
51
57
|
* Specify an optional className to be applied to the underlying `<button>`
|
|
52
58
|
*/
|
|
@@ -185,7 +185,7 @@ const Dropdown = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
185
185
|
[`${prefix}--dropdown--readonly`]: readOnly,
|
|
186
186
|
[`${prefix}--dropdown--${size$1}`]: size$1,
|
|
187
187
|
[`${prefix}--list-box--up`]: direction === 'top',
|
|
188
|
-
[`${prefix}--
|
|
188
|
+
[`${prefix}--autoalign`]: autoAlign
|
|
189
189
|
});
|
|
190
190
|
const titleClasses = cx(`${prefix}--label`, {
|
|
191
191
|
[`${prefix}--label--disabled`]: disabled,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
export interface FluidTextAreaSkeletonProps {
|
|
3
|
+
/**
|
|
4
|
+
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
5
|
+
*/
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
declare function FluidTextAreaSkeleton({ className, ...other }: {
|
|
9
|
+
[x: string]: any;
|
|
10
|
+
className: any;
|
|
11
|
+
}): void;
|
|
12
|
+
declare namespace FluidTextAreaSkeleton {
|
|
13
|
+
var propTypes: {
|
|
14
|
+
/**
|
|
15
|
+
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
16
|
+
*/
|
|
17
|
+
className: PropTypes.Requireable<string>;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export default FluidTextAreaSkeleton;
|
|
@@ -5,30 +5,13 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
8
|
import PropTypes from 'prop-types';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
9
|
+
import 'react';
|
|
10
|
+
import 'classnames';
|
|
12
11
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
|
-
import { FormContext } from '../FluidForm/FormContext.js';
|
|
14
12
|
|
|
15
13
|
function FluidTextAreaSkeleton(_ref) {
|
|
16
|
-
|
|
17
|
-
className,
|
|
18
|
-
...other
|
|
19
|
-
} = _ref;
|
|
20
|
-
const prefix = usePrefix();
|
|
21
|
-
return /*#__PURE__*/React__default.createElement(FormContext.Provider, {
|
|
22
|
-
value: {
|
|
23
|
-
isFluid: true
|
|
24
|
-
}
|
|
25
|
-
}, /*#__PURE__*/React__default.createElement("div", _extends({
|
|
26
|
-
className: cx(`${prefix}--form-item ${prefix}--text-area--fluid__skeleton`, className)
|
|
27
|
-
}, other), /*#__PURE__*/React__default.createElement("span", {
|
|
28
|
-
className: `${prefix}--label ${prefix}--skeleton`
|
|
29
|
-
}), /*#__PURE__*/React__default.createElement("div", {
|
|
30
|
-
className: `${prefix}--skeleton ${prefix}--text-area`
|
|
31
|
-
})));
|
|
14
|
+
usePrefix();
|
|
32
15
|
}
|
|
33
16
|
FluidTextAreaSkeleton.propTypes = {
|
|
34
17
|
/**
|
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
import React from 'react';
|
|
8
|
+
export interface FluidTextAreaProps {
|
|
9
|
+
/**
|
|
10
|
+
* Provide a custom className that is applied directly to the underlying
|
|
11
|
+
* `<textarea>` node
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Specify the `cols` attribute for the underlying `<textarea>` node
|
|
16
|
+
*/
|
|
17
|
+
cols?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Optionally provide the default value of the `<textarea>`
|
|
20
|
+
*/
|
|
21
|
+
defaultValue?: string | number;
|
|
22
|
+
/**
|
|
23
|
+
* Specify whether the control is disabled
|
|
24
|
+
*/
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Specify whether to display the character counter
|
|
28
|
+
*/
|
|
29
|
+
enableCounter?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Provide text that is used alongside the control label for additional help
|
|
32
|
+
*/
|
|
33
|
+
helperText?: React.ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* Specify whether you want the underlying label to be visually hidden
|
|
36
|
+
*/
|
|
37
|
+
hideLabel?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Provide a unique identifier for the control
|
|
40
|
+
*/
|
|
41
|
+
id?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Specify whether the control is currently invalid
|
|
44
|
+
*/
|
|
45
|
+
invalid?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Provide the text that is displayed when the control is in an invalid state
|
|
48
|
+
*/
|
|
49
|
+
invalidText?: React.ReactNode;
|
|
50
|
+
/**
|
|
51
|
+
* Provide the text that will be read by a screen reader when visiting this
|
|
52
|
+
* control
|
|
53
|
+
*/
|
|
54
|
+
labelText: React.ReactNode;
|
|
55
|
+
/**
|
|
56
|
+
* `true` to use the light version. For use on $ui-01 backgrounds only.
|
|
57
|
+
* Don't use this to make tile background color same as container background color.
|
|
58
|
+
*/
|
|
59
|
+
light?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Max character count allowed for the textarea. This is needed in order for enableCounter to display
|
|
62
|
+
*/
|
|
63
|
+
maxCount?: number;
|
|
64
|
+
/**
|
|
65
|
+
* Optionally provide an `onChange` handler that is called whenever `<textarea>`
|
|
66
|
+
* is updated
|
|
67
|
+
*/
|
|
68
|
+
onChange?: React.ChangeEventHandler<HTMLTextAreaElement>;
|
|
69
|
+
/**
|
|
70
|
+
* Optionally provide an `onClick` handler that is called whenever the
|
|
71
|
+
* `<textarea>` is clicked
|
|
72
|
+
*/
|
|
73
|
+
onClick?: React.MouseEventHandler<HTMLTextAreaElement>;
|
|
74
|
+
/**
|
|
75
|
+
* Specify the placeholder attribute for the `<textarea>`
|
|
76
|
+
*/
|
|
77
|
+
placeholder?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Specify the rows attribute for the `<textarea>`
|
|
80
|
+
*/
|
|
81
|
+
rows?: number;
|
|
82
|
+
/**
|
|
83
|
+
* Provide the current value of the `<textarea>`
|
|
84
|
+
*/
|
|
85
|
+
value?: string | number;
|
|
86
|
+
/**
|
|
87
|
+
* Specify whether the control is currently in warning state
|
|
88
|
+
*/
|
|
89
|
+
warn?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Provide the text that is displayed when the control is in warning state
|
|
92
|
+
*/
|
|
93
|
+
warnText?: React.ReactNode;
|
|
94
|
+
}
|
|
95
|
+
declare const FluidTextArea: React.FC<FluidTextAreaProps>;
|
|
96
|
+
export default FluidTextArea;
|
|
@@ -15,7 +15,7 @@ import deprecate from '../../prop-types/deprecate.js';
|
|
|
15
15
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
16
16
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
const FluidTextArea = _ref => {
|
|
19
19
|
let {
|
|
20
20
|
className,
|
|
21
21
|
...other
|
|
@@ -29,7 +29,7 @@ function FluidTextArea(_ref) {
|
|
|
29
29
|
}, /*#__PURE__*/React__default.createElement(TextArea, _extends({
|
|
30
30
|
className: classNames
|
|
31
31
|
}, other)));
|
|
32
|
-
}
|
|
32
|
+
};
|
|
33
33
|
FluidTextArea.propTypes = {
|
|
34
34
|
/**
|
|
35
35
|
* Provide a custom className that is applied directly to the underlying
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
import FluidTextArea from './FluidTextArea';
|
|
8
|
+
import { type FluidTextAreaProps } from './FluidTextArea';
|
|
9
|
+
import { type FluidTextAreaSkeletonProps } from './FluidTextArea.Skeleton';
|
|
10
|
+
export default FluidTextArea;
|
|
11
|
+
export { FluidTextArea, type FluidTextAreaProps, type FluidTextAreaSkeletonProps, };
|
|
12
|
+
export { default as FluidTextAreaSkeleton } from './FluidTextArea.Skeleton';
|
|
@@ -13,6 +13,10 @@ interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>
|
|
|
13
13
|
* Specify how the trigger should align with the tooltip
|
|
14
14
|
*/
|
|
15
15
|
align?: 'top' | 'top-left' | 'top-start' | 'top-right' | 'top-end' | 'bottom' | 'bottom-left' | 'bottom-start' | 'bottom-right' | 'bottom-end' | 'left' | 'right';
|
|
16
|
+
/**
|
|
17
|
+
* **Experimental**: Will attempt to automatically align the tooltip
|
|
18
|
+
*/
|
|
19
|
+
autoAlign?: boolean;
|
|
16
20
|
/**
|
|
17
21
|
* Provide an icon or asset to be rendered inside of the IconButton
|
|
18
22
|
*/
|