@carbon/react 1.52.0-rc.0 → 1.53.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1791 -1450
- package/es/components/Accordion/AccordionItem.js +1 -1
- package/es/components/CodeSnippet/CodeSnippet.js +2 -2
- package/es/components/Dropdown/Dropdown.Skeleton.d.ts +11 -0
- package/es/components/Dropdown/Dropdown.Skeleton.js +11 -6
- package/es/components/FileUploader/FileUploaderItem.d.ts +1 -1
- package/es/components/FileUploader/FileUploaderItem.js +2 -1
- package/es/components/Notification/Notification.d.ts +2 -2
- package/es/components/Notification/Notification.js +2 -1
- package/es/components/RadioTile/RadioTile.js +16 -3
- package/es/components/Tag/DismissibleTag.d.ts +104 -0
- package/es/components/Tag/OperationalTag.d.ts +101 -0
- package/es/components/Tag/SelectableTag.d.ts +87 -0
- package/es/components/Tag/Tag.d.ts +17 -12
- package/es/components/Tag/Tag.js +25 -17
- package/es/components/Tag/index.d.ts +0 -1
- package/es/components/Toggle/Toggle.js +3 -1
- package/es/components/Toggletip/index.d.ts +5 -3
- package/es/components/Toggletip/index.js +13 -2
- package/es/components/Tooltip/DefinitionTooltip.js +3 -0
- package/es/feature-flags.js +2 -1
- package/es/index.js +1 -1
- package/es/internal/Selection.js +15 -21
- package/lib/components/Accordion/AccordionItem.js +1 -1
- package/lib/components/CodeSnippet/CodeSnippet.js +2 -2
- package/lib/components/Dropdown/Dropdown.Skeleton.d.ts +11 -0
- package/lib/components/Dropdown/Dropdown.Skeleton.js +11 -6
- package/lib/components/FileUploader/FileUploaderItem.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderItem.js +2 -1
- package/lib/components/Notification/Notification.d.ts +2 -2
- package/lib/components/Notification/Notification.js +2 -1
- package/lib/components/RadioTile/RadioTile.js +15 -2
- package/lib/components/Tag/DismissibleTag.d.ts +104 -0
- package/lib/components/Tag/OperationalTag.d.ts +101 -0
- package/lib/components/Tag/SelectableTag.d.ts +87 -0
- package/lib/components/Tag/Tag.d.ts +17 -12
- package/lib/components/Tag/Tag.js +26 -17
- package/lib/components/Tag/index.d.ts +0 -1
- package/lib/components/Toggle/Toggle.js +3 -1
- package/lib/components/Toggletip/index.d.ts +5 -3
- package/lib/components/Toggletip/index.js +13 -2
- package/lib/components/Tooltip/DefinitionTooltip.js +3 -0
- package/lib/feature-flags.js +2 -1
- package/lib/index.js +0 -1
- package/lib/internal/Selection.js +14 -20
- package/package.json +8 -8
|
@@ -45,7 +45,7 @@ function AccordionItem(_ref) {
|
|
|
45
45
|
const prefix = usePrefix();
|
|
46
46
|
const className = cx({
|
|
47
47
|
[`${prefix}--accordion__item`]: true,
|
|
48
|
-
[`${prefix}--accordion__item--active`]: isOpen,
|
|
48
|
+
[`${prefix}--accordion__item--active`]: isOpen && !disabled,
|
|
49
49
|
[`${prefix}--accordion__item--disabled`]: disabled,
|
|
50
50
|
[customClassName]: !!customClassName
|
|
51
51
|
});
|
|
@@ -24,7 +24,7 @@ const rowHeightInPixels = 16;
|
|
|
24
24
|
const defaultMaxCollapsedNumberOfRows = 15;
|
|
25
25
|
const defaultMaxExpandedNumberOfRows = 0;
|
|
26
26
|
const defaultMinCollapsedNumberOfRows = 3;
|
|
27
|
-
const defaultMinExpandedNumberOfRows =
|
|
27
|
+
const defaultMinExpandedNumberOfRows = 0;
|
|
28
28
|
function CodeSnippet(_ref) {
|
|
29
29
|
let {
|
|
30
30
|
align = 'bottom',
|
|
@@ -101,7 +101,7 @@ function CodeSnippet(_ref) {
|
|
|
101
101
|
if (codeContentRef?.current && type === 'multi') {
|
|
102
102
|
const {
|
|
103
103
|
height
|
|
104
|
-
} =
|
|
104
|
+
} = innerCodeRef.current.getBoundingClientRect();
|
|
105
105
|
if (maxCollapsedNumberOfRows > 0 && (maxExpandedNumberOfRows <= 0 || maxExpandedNumberOfRows > maxCollapsedNumberOfRows) && height > maxCollapsedNumberOfRows * rowHeightInPixels) {
|
|
106
106
|
setShouldShowMoreLessBtn(true);
|
|
107
107
|
} else {
|
|
@@ -8,6 +8,17 @@ import React from 'react';
|
|
|
8
8
|
import { ListBoxSize } from '../ListBox';
|
|
9
9
|
import { ReactAttr } from '../../types/common';
|
|
10
10
|
export interface DropdownSkeletonProps extends ReactAttr<HTMLDivElement> {
|
|
11
|
+
/**
|
|
12
|
+
* Specify an optional className to add.
|
|
13
|
+
*/
|
|
14
|
+
className?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Specify whether the label should be hidden, or not
|
|
17
|
+
*/
|
|
18
|
+
hideLabel?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Specify the size of the ListBox.
|
|
21
|
+
*/
|
|
11
22
|
size?: ListBoxSize;
|
|
12
23
|
}
|
|
13
24
|
declare const DropdownSkeleton: React.FC<DropdownSkeletonProps>;
|
|
@@ -17,25 +17,30 @@ const DropdownSkeleton = _ref => {
|
|
|
17
17
|
let {
|
|
18
18
|
className,
|
|
19
19
|
size,
|
|
20
|
+
hideLabel,
|
|
20
21
|
...rest
|
|
21
22
|
} = _ref;
|
|
22
23
|
const prefix = usePrefix();
|
|
23
|
-
const wrapperClasses = cx(className, `${prefix}--skeleton`, `${prefix}--
|
|
24
|
+
const wrapperClasses = cx(className, `${prefix}--skeleton`, `${prefix}--form-item`, {
|
|
24
25
|
[`${prefix}--list-box--${size}`]: size
|
|
25
26
|
});
|
|
26
27
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
27
28
|
className: wrapperClasses
|
|
28
|
-
}, rest), /*#__PURE__*/React__default.createElement("
|
|
29
|
-
className: `${prefix}--
|
|
30
|
-
}, /*#__PURE__*/React__default.createElement("
|
|
31
|
-
className: `${prefix}--
|
|
32
|
-
}))
|
|
29
|
+
}, rest), !hideLabel && /*#__PURE__*/React__default.createElement("span", {
|
|
30
|
+
className: `${prefix}--label ${prefix}--skeleton`
|
|
31
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
32
|
+
className: `${prefix}--skeleton ${prefix}--dropdown`
|
|
33
|
+
}));
|
|
33
34
|
};
|
|
34
35
|
DropdownSkeleton.propTypes = {
|
|
35
36
|
/**
|
|
36
37
|
* Specify an optional className to add.
|
|
37
38
|
*/
|
|
38
39
|
className: PropTypes.string,
|
|
40
|
+
/**
|
|
41
|
+
* Specify whether the label should be hidden, or not
|
|
42
|
+
*/
|
|
43
|
+
hideLabel: PropTypes.bool,
|
|
39
44
|
/**
|
|
40
45
|
* Specify the size of the ListBox.
|
|
41
46
|
*/
|
|
@@ -53,7 +53,7 @@ export interface FileUploaderItemProps extends ReactAttr<HTMLSpanElement> {
|
|
|
53
53
|
*/
|
|
54
54
|
uuid?: string;
|
|
55
55
|
}
|
|
56
|
-
declare function FileUploaderItem({ uuid, name, status, iconDescription, onDelete, invalid, errorSubject, errorBody, size, ...other }: FileUploaderItemProps): import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
declare function FileUploaderItem({ uuid, name, status, iconDescription, onDelete, invalid, errorSubject, errorBody, size, className, ...other }: FileUploaderItemProps): import("react/jsx-runtime").JSX.Element;
|
|
57
57
|
declare namespace FileUploaderItem {
|
|
58
58
|
var propTypes: {
|
|
59
59
|
/**
|
|
@@ -31,6 +31,7 @@ function FileUploaderItem(_ref) {
|
|
|
31
31
|
errorSubject,
|
|
32
32
|
errorBody,
|
|
33
33
|
size,
|
|
34
|
+
className,
|
|
34
35
|
...other
|
|
35
36
|
} = _ref;
|
|
36
37
|
const [isEllipsisApplied, setIsEllipsisApplied] = useState(false);
|
|
@@ -38,7 +39,7 @@ function FileUploaderItem(_ref) {
|
|
|
38
39
|
const {
|
|
39
40
|
current: id
|
|
40
41
|
} = useRef(uuid || uniqueId());
|
|
41
|
-
const classes = cx(`${prefix}--file__selected-file`, {
|
|
42
|
+
const classes = cx(`${prefix}--file__selected-file`, className, {
|
|
42
43
|
[`${prefix}--file__selected-file--invalid`]: invalid,
|
|
43
44
|
[`${prefix}--file__selected-file--md`]: size === 'md',
|
|
44
45
|
[`${prefix}--file__selected-file--sm`]: size === 'sm'
|
|
@@ -549,7 +549,7 @@ export interface StaticNotificationProps extends HTMLAttributes<HTMLDivElement>
|
|
|
549
549
|
/**
|
|
550
550
|
* Specify the subtitle
|
|
551
551
|
*/
|
|
552
|
-
subtitle?:
|
|
552
|
+
subtitle?: ReactNode;
|
|
553
553
|
/**
|
|
554
554
|
* Specify the title
|
|
555
555
|
*/
|
|
@@ -593,7 +593,7 @@ export declare namespace StaticNotification {
|
|
|
593
593
|
/**
|
|
594
594
|
* Specify the subtitle
|
|
595
595
|
*/
|
|
596
|
-
subtitle: PropTypes.Requireable<
|
|
596
|
+
subtitle: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
597
597
|
/**
|
|
598
598
|
* Specify the title
|
|
599
599
|
*/
|
|
@@ -729,6 +729,7 @@ function StaticNotification(_ref8) {
|
|
|
729
729
|
className: `${prefix}--actionable-notification__button-wrapper`
|
|
730
730
|
}, actionButtonLabel && /*#__PURE__*/React__default.createElement(NotificationActionButton, {
|
|
731
731
|
onClick: onActionButtonClick,
|
|
732
|
+
"aria-describedby": titleId,
|
|
732
733
|
inline: true
|
|
733
734
|
}, actionButtonLabel)));
|
|
734
735
|
}
|
|
@@ -764,7 +765,7 @@ StaticNotification.propTypes = {
|
|
|
764
765
|
/**
|
|
765
766
|
* Specify the subtitle
|
|
766
767
|
*/
|
|
767
|
-
subtitle: PropTypes.
|
|
768
|
+
subtitle: PropTypes.node,
|
|
768
769
|
/**
|
|
769
770
|
* Specify the title
|
|
770
771
|
*/
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import { CheckmarkFilled } from '@carbon/icons-react';
|
|
9
|
+
import { RadioButtonChecked, RadioButton, CheckmarkFilled } from '@carbon/icons-react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
12
|
import React__default from 'react';
|
|
@@ -15,11 +15,12 @@ import { usePrefix } from '../../internal/usePrefix.js';
|
|
|
15
15
|
import deprecate from '../../prop-types/deprecate.js';
|
|
16
16
|
import { noopFn } from '../../internal/noopFn.js';
|
|
17
17
|
import '../Text/index.js';
|
|
18
|
+
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
18
19
|
import { Text } from '../Text/Text.js';
|
|
19
20
|
import { matches } from '../../internal/keyboard/match.js';
|
|
20
21
|
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
21
22
|
|
|
22
|
-
var _CheckmarkFilled;
|
|
23
|
+
var _RadioButtonChecked, _RadioButton, _CheckmarkFilled;
|
|
23
24
|
const RadioTile = /*#__PURE__*/React__default.forwardRef(function RadioTile(_ref, ref) {
|
|
24
25
|
let {
|
|
25
26
|
children,
|
|
@@ -42,6 +43,18 @@ const RadioTile = /*#__PURE__*/React__default.forwardRef(function RadioTile(_ref
|
|
|
42
43
|
[`${prefix}--tile--light`]: light,
|
|
43
44
|
[`${prefix}--tile--disabled`]: disabled
|
|
44
45
|
});
|
|
46
|
+
const v12TileRadioIcons = useFeatureFlag('enable-v12-tile-radio-icons');
|
|
47
|
+
function icon() {
|
|
48
|
+
if (v12TileRadioIcons) {
|
|
49
|
+
if (checked) {
|
|
50
|
+
return _RadioButtonChecked || (_RadioButtonChecked = /*#__PURE__*/React__default.createElement(RadioButtonChecked, null));
|
|
51
|
+
} else {
|
|
52
|
+
return _RadioButton || (_RadioButton = /*#__PURE__*/React__default.createElement(RadioButton, null));
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
return _CheckmarkFilled || (_CheckmarkFilled = /*#__PURE__*/React__default.createElement(CheckmarkFilled, null));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
45
58
|
function handleOnChange(evt) {
|
|
46
59
|
onChange(value, name, evt);
|
|
47
60
|
}
|
|
@@ -68,7 +81,7 @@ const RadioTile = /*#__PURE__*/React__default.forwardRef(function RadioTile(_ref
|
|
|
68
81
|
className: className
|
|
69
82
|
}), /*#__PURE__*/React__default.createElement("span", {
|
|
70
83
|
className: `${prefix}--tile__checkmark`
|
|
71
|
-
},
|
|
84
|
+
}, icon()), /*#__PURE__*/React__default.createElement(Text, {
|
|
72
85
|
className: `${prefix}--tile-content`
|
|
73
86
|
}, children)));
|
|
74
87
|
});
|
|
@@ -0,0 +1,104 @@
|
|
|
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 PropTypes, { ReactNodeLike } from 'prop-types';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { PolymorphicProps } from '../../types/common';
|
|
10
|
+
import { SIZES, TYPES } from './Tag';
|
|
11
|
+
export interface DismissibleTagBaseProps {
|
|
12
|
+
/**
|
|
13
|
+
* Provide content to be rendered inside of a `DismissibleTag`
|
|
14
|
+
*/
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Provide a custom className that is applied to the containing <span>
|
|
18
|
+
*/
|
|
19
|
+
className?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Specify if the `DismissibleTag` is disabled
|
|
22
|
+
*/
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Specify the id for the selectabletag.
|
|
26
|
+
*/
|
|
27
|
+
id?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Click handler for filter tag close button.
|
|
30
|
+
*/
|
|
31
|
+
onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Optional prop to render a custom icon.
|
|
34
|
+
* Can be a React component class
|
|
35
|
+
*/
|
|
36
|
+
renderIcon?: React.ElementType;
|
|
37
|
+
/**
|
|
38
|
+
* Specify the size of the Tag. Currently supports either `sm`,
|
|
39
|
+
* `md` (default) or `lg` sizes.
|
|
40
|
+
*/
|
|
41
|
+
size?: keyof typeof SIZES;
|
|
42
|
+
/**
|
|
43
|
+
* **Experimental:** Provide a `Slug` component to be rendered inside the `DismissibleTag` component
|
|
44
|
+
*/
|
|
45
|
+
slug?: ReactNodeLike;
|
|
46
|
+
/**
|
|
47
|
+
* Text to show on clear filters
|
|
48
|
+
*/
|
|
49
|
+
title?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Specify the type of the `Tag`
|
|
52
|
+
*/
|
|
53
|
+
type?: keyof typeof TYPES;
|
|
54
|
+
}
|
|
55
|
+
export type DismissibleTagProps<T extends React.ElementType> = PolymorphicProps<T, DismissibleTagBaseProps>;
|
|
56
|
+
declare const DismissibleTag: {
|
|
57
|
+
<T extends React.ElementType<any>>({ children, className, disabled, id, renderIcon, title, onClose, slug, size, type, ...other }: DismissibleTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
58
|
+
propTypes: {
|
|
59
|
+
/**
|
|
60
|
+
* Provide content to be rendered inside of a `DismissibleTag`
|
|
61
|
+
*/
|
|
62
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
63
|
+
/**
|
|
64
|
+
* Provide a custom className that is applied to the containing <span>
|
|
65
|
+
*/
|
|
66
|
+
className: PropTypes.Requireable<string>;
|
|
67
|
+
/**
|
|
68
|
+
* Specify if the `DismissibleTag` is disabled
|
|
69
|
+
*/
|
|
70
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
71
|
+
/**
|
|
72
|
+
* Specify the id for the tag.
|
|
73
|
+
*/
|
|
74
|
+
id: PropTypes.Requireable<string>;
|
|
75
|
+
/**
|
|
76
|
+
* Click handler for filter tag close button.
|
|
77
|
+
*/
|
|
78
|
+
onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
79
|
+
/**
|
|
80
|
+
* Optional prop to render a custom icon.
|
|
81
|
+
* Can be a React component class
|
|
82
|
+
*/
|
|
83
|
+
renderIcon: PropTypes.Requireable<object>;
|
|
84
|
+
/**
|
|
85
|
+
* Specify the size of the Tag. Currently supports either `sm`,
|
|
86
|
+
* `md` (default) or `lg` sizes.
|
|
87
|
+
*/
|
|
88
|
+
size: PropTypes.Requireable<string>;
|
|
89
|
+
/**
|
|
90
|
+
* **Experimental:** Provide a `Slug` component to be rendered inside the `DismissibleTag` component
|
|
91
|
+
*/
|
|
92
|
+
slug: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
93
|
+
/**
|
|
94
|
+
* Text to show on clear filters
|
|
95
|
+
*/
|
|
96
|
+
title: PropTypes.Requireable<string>;
|
|
97
|
+
/**
|
|
98
|
+
* Specify the type of the `Tag`
|
|
99
|
+
*/
|
|
100
|
+
type: PropTypes.Requireable<string>;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
export declare const types: string[];
|
|
104
|
+
export default DismissibleTag;
|
|
@@ -0,0 +1,101 @@
|
|
|
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 PropTypes, { ReactNodeLike } from 'prop-types';
|
|
8
|
+
import React, { MouseEventHandler } from 'react';
|
|
9
|
+
import { PolymorphicProps } from '../../types/common';
|
|
10
|
+
import { SIZES } from './Tag';
|
|
11
|
+
declare const TYPES: {
|
|
12
|
+
red: string;
|
|
13
|
+
magenta: string;
|
|
14
|
+
purple: string;
|
|
15
|
+
blue: string;
|
|
16
|
+
cyan: string;
|
|
17
|
+
teal: string;
|
|
18
|
+
green: string;
|
|
19
|
+
gray: string;
|
|
20
|
+
'cool-gray': string;
|
|
21
|
+
'warm-gray': string;
|
|
22
|
+
};
|
|
23
|
+
export interface OperationalTagBaseProps {
|
|
24
|
+
/**
|
|
25
|
+
* Provide content to be rendered inside of a `OperationalTag`
|
|
26
|
+
*/
|
|
27
|
+
children?: React.ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Provide a custom className that is applied to the containing <span>
|
|
30
|
+
*/
|
|
31
|
+
className?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Specify if the `OperationalTag` is disabled
|
|
34
|
+
*/
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Specify the id for the OperationalTag.
|
|
38
|
+
*/
|
|
39
|
+
id?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Optional prop to render a custom icon.
|
|
42
|
+
* Can be a React component class
|
|
43
|
+
*/
|
|
44
|
+
renderIcon?: React.ElementType;
|
|
45
|
+
onClick?: MouseEventHandler;
|
|
46
|
+
/**
|
|
47
|
+
* Specify the size of the Tag. Currently supports either `sm`,
|
|
48
|
+
* `md` (default) or `lg` sizes.
|
|
49
|
+
*/
|
|
50
|
+
size?: keyof typeof SIZES;
|
|
51
|
+
/**
|
|
52
|
+
* **Experimental:** Provide a `Slug` component to be rendered inside the `OperationalTag` component
|
|
53
|
+
*/
|
|
54
|
+
slug?: ReactNodeLike;
|
|
55
|
+
/**
|
|
56
|
+
* Specify the type of the `Tag`
|
|
57
|
+
*/
|
|
58
|
+
type?: keyof typeof TYPES;
|
|
59
|
+
}
|
|
60
|
+
export type OperationalTagProps<T extends React.ElementType> = PolymorphicProps<T, OperationalTagBaseProps>;
|
|
61
|
+
declare const OperationalTag: {
|
|
62
|
+
<T extends React.ElementType<any>>({ children, className, disabled, id, renderIcon, slug, size, type, ...other }: OperationalTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
63
|
+
propTypes: {
|
|
64
|
+
/**
|
|
65
|
+
* Provide content to be rendered inside of a `OperationalTag`
|
|
66
|
+
*/
|
|
67
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
68
|
+
/**
|
|
69
|
+
* Provide a custom className that is applied to the containing <span>
|
|
70
|
+
*/
|
|
71
|
+
className: PropTypes.Requireable<string>;
|
|
72
|
+
/**
|
|
73
|
+
* Specify if the `OperationalTag` is disabled
|
|
74
|
+
*/
|
|
75
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
76
|
+
/**
|
|
77
|
+
* Specify the id for the tag.
|
|
78
|
+
*/
|
|
79
|
+
id: PropTypes.Requireable<string>;
|
|
80
|
+
/**
|
|
81
|
+
* Optional prop to render a custom icon.
|
|
82
|
+
* Can be a React component class
|
|
83
|
+
*/
|
|
84
|
+
renderIcon: PropTypes.Requireable<object>;
|
|
85
|
+
/**
|
|
86
|
+
* Specify the size of the Tag. Currently supports either `sm`,
|
|
87
|
+
* `md` (default) or `lg` sizes.
|
|
88
|
+
*/
|
|
89
|
+
size: PropTypes.Requireable<string>;
|
|
90
|
+
/**
|
|
91
|
+
* **Experimental:** Provide a `Slug` component to be rendered inside the `OperationalTag` component
|
|
92
|
+
*/
|
|
93
|
+
slug: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
94
|
+
/**
|
|
95
|
+
* Specify the type of the `Tag`
|
|
96
|
+
*/
|
|
97
|
+
type: PropTypes.Requireable<string>;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
export declare const types: string[];
|
|
101
|
+
export default OperationalTag;
|
|
@@ -0,0 +1,87 @@
|
|
|
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 PropTypes, { ReactNodeLike } from 'prop-types';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { PolymorphicProps } from '../../types/common';
|
|
10
|
+
import { SIZES } from './Tag';
|
|
11
|
+
export interface SelectableTagBaseProps {
|
|
12
|
+
/**
|
|
13
|
+
* Provide content to be rendered inside of a `SelectableTag`
|
|
14
|
+
*/
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Provide a custom className that is applied to the containing <span>
|
|
18
|
+
*/
|
|
19
|
+
className?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Specify if the `SelectableTag` is disabled
|
|
22
|
+
*/
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Specify the id for the selectabletag.
|
|
26
|
+
*/
|
|
27
|
+
id?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Optional prop to render a custom icon.
|
|
30
|
+
* Can be a React component class
|
|
31
|
+
*/
|
|
32
|
+
renderIcon?: React.ElementType;
|
|
33
|
+
/**
|
|
34
|
+
* Specify the state of the selectable tag.
|
|
35
|
+
*/
|
|
36
|
+
selected?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Specify the size of the Tag. Currently supports either `sm`,
|
|
39
|
+
* `md` (default) or `lg` sizes.
|
|
40
|
+
*/
|
|
41
|
+
size?: keyof typeof SIZES;
|
|
42
|
+
/**
|
|
43
|
+
* **Experimental:** Provide a `Slug` component to be rendered inside the `SelectableTag` component
|
|
44
|
+
*/
|
|
45
|
+
slug?: ReactNodeLike;
|
|
46
|
+
}
|
|
47
|
+
export type SelectableTagProps<T extends React.ElementType> = PolymorphicProps<T, SelectableTagBaseProps>;
|
|
48
|
+
declare const SelectableTag: {
|
|
49
|
+
<T extends React.ElementType<any>>({ children, className, disabled, id, renderIcon, selected, slug, size, ...other }: SelectableTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
propTypes: {
|
|
51
|
+
/**
|
|
52
|
+
* Provide content to be rendered inside of a `SelectableTag`
|
|
53
|
+
*/
|
|
54
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
55
|
+
/**
|
|
56
|
+
* Provide a custom className that is applied to the containing <span>
|
|
57
|
+
*/
|
|
58
|
+
className: PropTypes.Requireable<string>;
|
|
59
|
+
/**
|
|
60
|
+
* Specify if the `SelectableTag` is disabled
|
|
61
|
+
*/
|
|
62
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
63
|
+
/**
|
|
64
|
+
* Specify the id for the tag.
|
|
65
|
+
*/
|
|
66
|
+
id: PropTypes.Requireable<string>;
|
|
67
|
+
/**
|
|
68
|
+
* Optional prop to render a custom icon.
|
|
69
|
+
* Can be a React component class
|
|
70
|
+
*/
|
|
71
|
+
renderIcon: PropTypes.Requireable<object>;
|
|
72
|
+
/**
|
|
73
|
+
* Specify the state of the selectable tag.
|
|
74
|
+
*/
|
|
75
|
+
selected: PropTypes.Requireable<boolean>;
|
|
76
|
+
/**
|
|
77
|
+
* Specify the size of the Tag. Currently supports either `sm`,
|
|
78
|
+
* `md` (default) or `lg` sizes.
|
|
79
|
+
*/
|
|
80
|
+
size: PropTypes.Requireable<string>;
|
|
81
|
+
/**
|
|
82
|
+
* **Experimental:** Provide a `Slug` component to be rendered inside the `SelectableTag` component
|
|
83
|
+
*/
|
|
84
|
+
slug: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
export default SelectableTag;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import PropTypes, { ReactNodeLike } from 'prop-types';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import { PolymorphicProps } from '../../types/common';
|
|
10
|
-
declare const TYPES: {
|
|
10
|
+
export declare const TYPES: {
|
|
11
11
|
red: string;
|
|
12
12
|
magenta: string;
|
|
13
13
|
purple: string;
|
|
@@ -21,6 +21,11 @@ declare const TYPES: {
|
|
|
21
21
|
'high-contrast': string;
|
|
22
22
|
outline: string;
|
|
23
23
|
};
|
|
24
|
+
export declare const SIZES: {
|
|
25
|
+
sm: string;
|
|
26
|
+
md: string;
|
|
27
|
+
lg: string;
|
|
28
|
+
};
|
|
24
29
|
export interface TagBaseProps {
|
|
25
30
|
/**
|
|
26
31
|
* Provide content to be rendered inside of a `Tag`
|
|
@@ -35,7 +40,7 @@ export interface TagBaseProps {
|
|
|
35
40
|
*/
|
|
36
41
|
disabled?: boolean;
|
|
37
42
|
/**
|
|
38
|
-
*
|
|
43
|
+
* @deprecated This property is deprecated and will be removed in the next major version. Use DismissibleTag instead.
|
|
39
44
|
*/
|
|
40
45
|
filter?: boolean;
|
|
41
46
|
/**
|
|
@@ -43,7 +48,7 @@ export interface TagBaseProps {
|
|
|
43
48
|
*/
|
|
44
49
|
id?: string;
|
|
45
50
|
/**
|
|
46
|
-
*
|
|
51
|
+
* @deprecated This property is deprecated and will be removed in the next major version. Use DismissibleTag instead.
|
|
47
52
|
*/
|
|
48
53
|
onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
49
54
|
/**
|
|
@@ -52,16 +57,16 @@ export interface TagBaseProps {
|
|
|
52
57
|
*/
|
|
53
58
|
renderIcon?: React.ElementType;
|
|
54
59
|
/**
|
|
55
|
-
* Specify the size of the Tag. Currently supports either `sm
|
|
56
|
-
*
|
|
60
|
+
* Specify the size of the Tag. Currently supports either `sm`,
|
|
61
|
+
* `md` (default) or `lg` sizes.
|
|
57
62
|
*/
|
|
58
|
-
size?:
|
|
63
|
+
size?: keyof typeof SIZES;
|
|
59
64
|
/**
|
|
60
65
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `Tag` component
|
|
61
66
|
*/
|
|
62
67
|
slug?: ReactNodeLike;
|
|
63
68
|
/**
|
|
64
|
-
*
|
|
69
|
+
* @deprecated This property is deprecated and will be removed in the next major version. Use DismissibleTag instead.
|
|
65
70
|
*/
|
|
66
71
|
title?: string;
|
|
67
72
|
/**
|
|
@@ -93,7 +98,7 @@ declare const Tag: {
|
|
|
93
98
|
/**
|
|
94
99
|
* Determine if `Tag` is a filter/chip
|
|
95
100
|
*/
|
|
96
|
-
filter:
|
|
101
|
+
filter: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
97
102
|
/**
|
|
98
103
|
* Specify the id for the tag.
|
|
99
104
|
*/
|
|
@@ -101,15 +106,15 @@ declare const Tag: {
|
|
|
101
106
|
/**
|
|
102
107
|
* Click handler for filter tag close button.
|
|
103
108
|
*/
|
|
104
|
-
onClose:
|
|
109
|
+
onClose: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
105
110
|
/**
|
|
106
111
|
* Optional prop to render a custom icon.
|
|
107
112
|
* Can be a React component class
|
|
108
113
|
*/
|
|
109
114
|
renderIcon: PropTypes.Requireable<object>;
|
|
110
115
|
/**
|
|
111
|
-
* Specify the size of the Tag. Currently supports either `sm
|
|
112
|
-
*
|
|
116
|
+
* Specify the size of the Tag. Currently supports either `sm`,
|
|
117
|
+
* `md` (default) or `lg` sizes.
|
|
113
118
|
*/
|
|
114
119
|
size: PropTypes.Requireable<string>;
|
|
115
120
|
/**
|
|
@@ -119,7 +124,7 @@ declare const Tag: {
|
|
|
119
124
|
/**
|
|
120
125
|
* Text to show on clear filters
|
|
121
126
|
*/
|
|
122
|
-
title:
|
|
127
|
+
title: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
123
128
|
/**
|
|
124
129
|
* Specify the type of the `Tag`
|
|
125
130
|
*/
|