@carbon/react 1.52.0 → 1.53.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 +1617 -1393
- package/es/components/Accordion/AccordionItem.js +1 -1
- package/es/components/CodeSnippet/CodeSnippet.js +2 -2
- package/es/components/Copy/Copy.d.ts +74 -0
- package/es/components/Copy/Copy.js +1 -1
- package/es/components/Copy/index.d.ts +9 -0
- package/es/components/CopyButton/CopyButton.d.ts +71 -0
- package/es/components/CopyButton/index.d.ts +9 -0
- 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/OverflowMenu/OverflowMenu.js +13 -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 +3 -3
- 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/Copy/Copy.d.ts +74 -0
- package/lib/components/Copy/Copy.js +1 -1
- package/lib/components/Copy/index.d.ts +9 -0
- package/lib/components/CopyButton/CopyButton.d.ts +71 -0
- package/lib/components/CopyButton/index.d.ts +9 -0
- 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/OverflowMenu/OverflowMenu.js +13 -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 +4 -5
- package/lib/internal/Selection.js +14 -20
- package/package.json +8 -8
|
@@ -0,0 +1,71 @@
|
|
|
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 from 'prop-types';
|
|
8
|
+
import { MouseEventHandler } from 'react';
|
|
9
|
+
import { ButtonProps } from '../Button';
|
|
10
|
+
export interface CopyButtonProps extends ButtonProps<'button'> {
|
|
11
|
+
/**
|
|
12
|
+
* Specify how the trigger should align with the tooltip
|
|
13
|
+
*/
|
|
14
|
+
align?: 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'right';
|
|
15
|
+
/**
|
|
16
|
+
* Specify an optional className to be applied to the underlying `<button>`
|
|
17
|
+
*/
|
|
18
|
+
className?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Specify the string that is displayed when the button is clicked and the
|
|
21
|
+
* content is copied
|
|
22
|
+
*/
|
|
23
|
+
feedback?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Specify the time it takes for the feedback message to timeout
|
|
26
|
+
*/
|
|
27
|
+
feedbackTimeout?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Provide a description for the icon representing the copy action that can
|
|
30
|
+
* be read by screen readers
|
|
31
|
+
*/
|
|
32
|
+
iconDescription?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Specify an optional `onClick` handler that is called when the underlying
|
|
35
|
+
* `<button>` is clicked
|
|
36
|
+
*/
|
|
37
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
38
|
+
}
|
|
39
|
+
declare function CopyButton({ align, feedback, feedbackTimeout, iconDescription, className, onClick, ...other }: CopyButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
declare namespace CopyButton {
|
|
41
|
+
var propTypes: {
|
|
42
|
+
/**
|
|
43
|
+
* Specify how the trigger should align with the tooltip
|
|
44
|
+
*/
|
|
45
|
+
align: PropTypes.Requireable<string>;
|
|
46
|
+
/**
|
|
47
|
+
* Specify an optional className to be applied to the underlying `<button>`
|
|
48
|
+
*/
|
|
49
|
+
className: PropTypes.Requireable<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Specify the string that is displayed when the button is clicked and the
|
|
52
|
+
* content is copied
|
|
53
|
+
*/
|
|
54
|
+
feedback: PropTypes.Requireable<string>;
|
|
55
|
+
/**
|
|
56
|
+
* Specify the time it takes for the feedback message to timeout
|
|
57
|
+
*/
|
|
58
|
+
feedbackTimeout: PropTypes.Requireable<number>;
|
|
59
|
+
/**
|
|
60
|
+
* Provide a description for the icon representing the copy action that can
|
|
61
|
+
* be read by screen readers
|
|
62
|
+
*/
|
|
63
|
+
iconDescription: PropTypes.Requireable<string>;
|
|
64
|
+
/**
|
|
65
|
+
* Specify an optional `onClick` handler that is called when the underlying
|
|
66
|
+
* `<button>` is clicked
|
|
67
|
+
*/
|
|
68
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export default CopyButton;
|
|
@@ -0,0 +1,9 @@
|
|
|
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 CopyButton from './CopyButton';
|
|
8
|
+
export default CopyButton;
|
|
9
|
+
export { CopyButton };
|
|
@@ -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>;
|
|
@@ -27,25 +27,30 @@ const DropdownSkeleton = _ref => {
|
|
|
27
27
|
let {
|
|
28
28
|
className,
|
|
29
29
|
size,
|
|
30
|
+
hideLabel,
|
|
30
31
|
...rest
|
|
31
32
|
} = _ref;
|
|
32
33
|
const prefix = usePrefix.usePrefix();
|
|
33
|
-
const wrapperClasses = cx__default["default"](className, `${prefix}--skeleton`, `${prefix}--
|
|
34
|
+
const wrapperClasses = cx__default["default"](className, `${prefix}--skeleton`, `${prefix}--form-item`, {
|
|
34
35
|
[`${prefix}--list-box--${size}`]: size
|
|
35
36
|
});
|
|
36
37
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
37
38
|
className: wrapperClasses
|
|
38
|
-
}, rest), /*#__PURE__*/React__default["default"].createElement("
|
|
39
|
-
className: `${prefix}--
|
|
40
|
-
}, /*#__PURE__*/React__default["default"].createElement("
|
|
41
|
-
className: `${prefix}--
|
|
42
|
-
}))
|
|
39
|
+
}, rest), !hideLabel && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
40
|
+
className: `${prefix}--label ${prefix}--skeleton`
|
|
41
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
42
|
+
className: `${prefix}--skeleton ${prefix}--dropdown`
|
|
43
|
+
}));
|
|
43
44
|
};
|
|
44
45
|
DropdownSkeleton.propTypes = {
|
|
45
46
|
/**
|
|
46
47
|
* Specify an optional className to add.
|
|
47
48
|
*/
|
|
48
49
|
className: PropTypes__default["default"].string,
|
|
50
|
+
/**
|
|
51
|
+
* Specify whether the label should be hidden, or not
|
|
52
|
+
*/
|
|
53
|
+
hideLabel: PropTypes__default["default"].bool,
|
|
49
54
|
/**
|
|
50
55
|
* Specify the size of the ListBox.
|
|
51
56
|
*/
|
|
@@ -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
|
/**
|
|
@@ -41,6 +41,7 @@ function FileUploaderItem(_ref) {
|
|
|
41
41
|
errorSubject,
|
|
42
42
|
errorBody,
|
|
43
43
|
size,
|
|
44
|
+
className,
|
|
44
45
|
...other
|
|
45
46
|
} = _ref;
|
|
46
47
|
const [isEllipsisApplied, setIsEllipsisApplied] = React.useState(false);
|
|
@@ -48,7 +49,7 @@ function FileUploaderItem(_ref) {
|
|
|
48
49
|
const {
|
|
49
50
|
current: id
|
|
50
51
|
} = React.useRef(uuid || uniqueId["default"]());
|
|
51
|
-
const classes = cx__default["default"](`${prefix}--file__selected-file`, {
|
|
52
|
+
const classes = cx__default["default"](`${prefix}--file__selected-file`, className, {
|
|
52
53
|
[`${prefix}--file__selected-file--invalid`]: invalid,
|
|
53
54
|
[`${prefix}--file__selected-file--md`]: size === 'md',
|
|
54
55
|
[`${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
|
*/
|
|
@@ -739,6 +739,7 @@ function StaticNotification(_ref8) {
|
|
|
739
739
|
className: `${prefix}--actionable-notification__button-wrapper`
|
|
740
740
|
}, actionButtonLabel && /*#__PURE__*/React__default["default"].createElement(NotificationActionButton, {
|
|
741
741
|
onClick: onActionButtonClick,
|
|
742
|
+
"aria-describedby": titleId,
|
|
742
743
|
inline: true
|
|
743
744
|
}, actionButtonLabel)));
|
|
744
745
|
}
|
|
@@ -774,7 +775,7 @@ StaticNotification.propTypes = {
|
|
|
774
775
|
/**
|
|
775
776
|
* Specify the subtitle
|
|
776
777
|
*/
|
|
777
|
-
subtitle: PropTypes__default["default"].
|
|
778
|
+
subtitle: PropTypes__default["default"].node,
|
|
778
779
|
/**
|
|
779
780
|
* Specify the title
|
|
780
781
|
*/
|
|
@@ -129,6 +129,9 @@ class OverflowMenu extends React.Component {
|
|
|
129
129
|
const {
|
|
130
130
|
onClick = noopFn.noopFn
|
|
131
131
|
} = this.props;
|
|
132
|
+
this.setState({
|
|
133
|
+
click: true
|
|
134
|
+
});
|
|
132
135
|
evt.stopPropagation();
|
|
133
136
|
if (!this._menuBody || !this._menuBody.contains(evt.target)) {
|
|
134
137
|
this.setState({
|
|
@@ -138,6 +141,15 @@ class OverflowMenu extends React.Component {
|
|
|
138
141
|
}
|
|
139
142
|
});
|
|
140
143
|
_rollupPluginBabelHelpers.defineProperty(this, "closeMenuAndFocus", () => {
|
|
144
|
+
let wasClicked = this.state.click;
|
|
145
|
+
let wasOpen = this.state.open;
|
|
146
|
+
this.closeMenu(() => {
|
|
147
|
+
if (wasOpen && !wasClicked) {
|
|
148
|
+
this.focusMenuEl();
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
_rollupPluginBabelHelpers.defineProperty(this, "closeMenuOnEscape", () => {
|
|
141
153
|
let wasOpen = this.state.open;
|
|
142
154
|
this.closeMenu(() => {
|
|
143
155
|
if (wasOpen) {
|
|
@@ -152,7 +164,7 @@ class OverflowMenu extends React.Component {
|
|
|
152
164
|
|
|
153
165
|
// Close the overflow menu on escape
|
|
154
166
|
if (match.matches(evt, [keys.Escape])) {
|
|
155
|
-
this.
|
|
167
|
+
this.closeMenuOnEscape();
|
|
156
168
|
|
|
157
169
|
// Stop the esc keypress from bubbling out and closing something it shouldn't
|
|
158
170
|
evt.stopPropagation();
|
|
@@ -19,6 +19,7 @@ var usePrefix = require('../../internal/usePrefix.js');
|
|
|
19
19
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
20
20
|
var noopFn = require('../../internal/noopFn.js');
|
|
21
21
|
require('../Text/index.js');
|
|
22
|
+
var index = require('../FeatureFlags/index.js');
|
|
22
23
|
var Text = require('../Text/Text.js');
|
|
23
24
|
var match = require('../../internal/keyboard/match.js');
|
|
24
25
|
var keys = require('../../internal/keyboard/keys.js');
|
|
@@ -29,7 +30,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
29
30
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
30
31
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
31
32
|
|
|
32
|
-
var _CheckmarkFilled;
|
|
33
|
+
var _RadioButtonChecked, _RadioButton, _CheckmarkFilled;
|
|
33
34
|
const RadioTile = /*#__PURE__*/React__default["default"].forwardRef(function RadioTile(_ref, ref) {
|
|
34
35
|
let {
|
|
35
36
|
children,
|
|
@@ -52,6 +53,18 @@ const RadioTile = /*#__PURE__*/React__default["default"].forwardRef(function Rad
|
|
|
52
53
|
[`${prefix}--tile--light`]: light,
|
|
53
54
|
[`${prefix}--tile--disabled`]: disabled
|
|
54
55
|
});
|
|
56
|
+
const v12TileRadioIcons = index.useFeatureFlag('enable-v12-tile-radio-icons');
|
|
57
|
+
function icon() {
|
|
58
|
+
if (v12TileRadioIcons) {
|
|
59
|
+
if (checked) {
|
|
60
|
+
return _RadioButtonChecked || (_RadioButtonChecked = /*#__PURE__*/React__default["default"].createElement(iconsReact.RadioButtonChecked, null));
|
|
61
|
+
} else {
|
|
62
|
+
return _RadioButton || (_RadioButton = /*#__PURE__*/React__default["default"].createElement(iconsReact.RadioButton, null));
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
return _CheckmarkFilled || (_CheckmarkFilled = /*#__PURE__*/React__default["default"].createElement(iconsReact.CheckmarkFilled, null));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
55
68
|
function handleOnChange(evt) {
|
|
56
69
|
onChange(value, name, evt);
|
|
57
70
|
}
|
|
@@ -78,7 +91,7 @@ const RadioTile = /*#__PURE__*/React__default["default"].forwardRef(function Rad
|
|
|
78
91
|
className: className
|
|
79
92
|
}), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
80
93
|
className: `${prefix}--tile__checkmark`
|
|
81
|
-
},
|
|
94
|
+
}, icon()), /*#__PURE__*/React__default["default"].createElement(Text.Text, {
|
|
82
95
|
className: `${prefix}--tile-content`
|
|
83
96
|
}, children)));
|
|
84
97
|
});
|
|
@@ -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
|
*/
|