@carbon/react 1.52.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 +1751 -1451
- 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
package/es/components/Tag/Tag.js
CHANGED
|
@@ -13,6 +13,7 @@ import { Close } from '@carbon/icons-react';
|
|
|
13
13
|
import setupGetInstanceId from '../../tools/setupGetInstanceId.js';
|
|
14
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
15
|
import '../Text/index.js';
|
|
16
|
+
import deprecate from '../../prop-types/deprecate.js';
|
|
16
17
|
import { Text } from '../Text/Text.js';
|
|
17
18
|
|
|
18
19
|
var _Close;
|
|
@@ -31,6 +32,11 @@ const TYPES = {
|
|
|
31
32
|
'high-contrast': 'High-Contrast',
|
|
32
33
|
outline: 'Outline'
|
|
33
34
|
};
|
|
35
|
+
const SIZES = {
|
|
36
|
+
sm: 'sm',
|
|
37
|
+
md: 'md',
|
|
38
|
+
lg: 'lg'
|
|
39
|
+
};
|
|
34
40
|
const Tag = _ref => {
|
|
35
41
|
let {
|
|
36
42
|
children,
|
|
@@ -38,10 +44,13 @@ const Tag = _ref => {
|
|
|
38
44
|
id,
|
|
39
45
|
type,
|
|
40
46
|
filter,
|
|
47
|
+
// remove filter in next major release - V12
|
|
41
48
|
renderIcon: CustomIconElement,
|
|
42
49
|
title = 'Clear filter',
|
|
50
|
+
// remove title in next major release - V12
|
|
43
51
|
disabled,
|
|
44
52
|
onClose,
|
|
53
|
+
// remove onClose in next major release - V12
|
|
45
54
|
size,
|
|
46
55
|
as: BaseComponent,
|
|
47
56
|
slug,
|
|
@@ -49,6 +58,8 @@ const Tag = _ref => {
|
|
|
49
58
|
} = _ref;
|
|
50
59
|
const prefix = usePrefix();
|
|
51
60
|
const tagId = id || `tag-${getInstanceId()}`;
|
|
61
|
+
const conditions = [`${prefix}--tag--selectable`, `${prefix}--tag--filter`, `${prefix}--tag--operational`];
|
|
62
|
+
const isInteractiveTag = conditions.some(el => className?.includes(el));
|
|
52
63
|
const tagClasses = cx(`${prefix}--tag`, className, {
|
|
53
64
|
[`${prefix}--tag--disabled`]: disabled,
|
|
54
65
|
[`${prefix}--tag--filter`]: filter,
|
|
@@ -56,7 +67,7 @@ const Tag = _ref => {
|
|
|
56
67
|
// TODO: V12 - Remove this class
|
|
57
68
|
[`${prefix}--layout--size-${size}`]: size,
|
|
58
69
|
[`${prefix}--tag--${type}`]: type,
|
|
59
|
-
[`${prefix}--tag--interactive`]: other.onClick && !
|
|
70
|
+
[`${prefix}--tag--interactive`]: other.onClick && !isInteractiveTag
|
|
60
71
|
});
|
|
61
72
|
const typeText = type !== undefined && type in Object.keys(TYPES) ? TYPES[type] : '';
|
|
62
73
|
const handleClose = event => {
|
|
@@ -68,7 +79,7 @@ const Tag = _ref => {
|
|
|
68
79
|
|
|
69
80
|
// Slug is always size `md` and `inline`
|
|
70
81
|
let normalizedSlug;
|
|
71
|
-
if (slug && slug['type']?.displayName === 'Slug') {
|
|
82
|
+
if (slug && slug['type']?.displayName === 'Slug' && !isInteractiveTag) {
|
|
72
83
|
normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
|
|
73
84
|
size: 'sm',
|
|
74
85
|
kind: 'inline'
|
|
@@ -79,7 +90,7 @@ const Tag = _ref => {
|
|
|
79
90
|
return /*#__PURE__*/React__default.createElement(ComponentTag, _extends({
|
|
80
91
|
className: tagClasses,
|
|
81
92
|
id: tagId
|
|
82
|
-
}, other), CustomIconElement ? /*#__PURE__*/React__default.createElement("div", {
|
|
93
|
+
}, other), CustomIconElement && size !== 'sm' ? /*#__PURE__*/React__default.createElement("div", {
|
|
83
94
|
className: `${prefix}--tag__custom-icon`
|
|
84
95
|
}, /*#__PURE__*/React__default.createElement(CustomIconElement, null)) : '', /*#__PURE__*/React__default.createElement(Text, {
|
|
85
96
|
className: `${prefix}--tag__label`,
|
|
@@ -93,16 +104,14 @@ const Tag = _ref => {
|
|
|
93
104
|
title: title
|
|
94
105
|
}, _Close || (_Close = /*#__PURE__*/React__default.createElement(Close, null))));
|
|
95
106
|
}
|
|
96
|
-
const ComponentTag = BaseComponent ?? (other.onClick ? 'button' : 'div');
|
|
107
|
+
const ComponentTag = BaseComponent ?? (other.onClick || className?.includes(`${prefix}--tag--operational`) ? 'button' : 'div');
|
|
97
108
|
return /*#__PURE__*/React__default.createElement(ComponentTag, _extends({
|
|
98
|
-
disabled:
|
|
109
|
+
disabled: disabled,
|
|
99
110
|
className: tagClasses,
|
|
100
111
|
id: tagId
|
|
101
|
-
}, other), CustomIconElement ? /*#__PURE__*/React__default.createElement("div", {
|
|
112
|
+
}, other), CustomIconElement && size !== 'sm' ? /*#__PURE__*/React__default.createElement("div", {
|
|
102
113
|
className: `${prefix}--tag__custom-icon`
|
|
103
|
-
}, /*#__PURE__*/React__default.createElement(CustomIconElement, null)) : '', /*#__PURE__*/React__default.createElement(Text,
|
|
104
|
-
title: typeof children === 'string' ? children : undefined
|
|
105
|
-
}, children !== null && children !== undefined ? children : typeText), normalizedSlug);
|
|
114
|
+
}, /*#__PURE__*/React__default.createElement(CustomIconElement, null)) : '', /*#__PURE__*/React__default.createElement(Text, null, children !== null && children !== undefined ? children : typeText), normalizedSlug);
|
|
106
115
|
};
|
|
107
116
|
Tag.propTypes = {
|
|
108
117
|
/**
|
|
@@ -125,7 +134,7 @@ Tag.propTypes = {
|
|
|
125
134
|
/**
|
|
126
135
|
* Determine if `Tag` is a filter/chip
|
|
127
136
|
*/
|
|
128
|
-
filter: PropTypes.bool,
|
|
137
|
+
filter: deprecate(PropTypes.bool, 'This property is deprecated and will be removed in the next major version. Use DismissibleTag instead.'),
|
|
129
138
|
/**
|
|
130
139
|
* Specify the id for the tag.
|
|
131
140
|
*/
|
|
@@ -133,17 +142,17 @@ Tag.propTypes = {
|
|
|
133
142
|
/**
|
|
134
143
|
* Click handler for filter tag close button.
|
|
135
144
|
*/
|
|
136
|
-
onClose: PropTypes.func,
|
|
145
|
+
onClose: deprecate(PropTypes.func, 'This property is deprecated and will be removed in the next major version. Use DismissibleTag instead.'),
|
|
137
146
|
/**
|
|
138
147
|
* Optional prop to render a custom icon.
|
|
139
148
|
* Can be a React component class
|
|
140
149
|
*/
|
|
141
150
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
142
151
|
/**
|
|
143
|
-
* Specify the size of the Tag. Currently supports either `sm
|
|
144
|
-
*
|
|
152
|
+
* Specify the size of the Tag. Currently supports either `sm`,
|
|
153
|
+
* `md` (default) or `lg` sizes.
|
|
145
154
|
*/
|
|
146
|
-
size: PropTypes.oneOf(
|
|
155
|
+
size: PropTypes.oneOf(Object.keys(SIZES)),
|
|
147
156
|
/**
|
|
148
157
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `Tag` component
|
|
149
158
|
*/
|
|
@@ -151,12 +160,11 @@ Tag.propTypes = {
|
|
|
151
160
|
/**
|
|
152
161
|
* Text to show on clear filters
|
|
153
162
|
*/
|
|
154
|
-
title: PropTypes.string,
|
|
163
|
+
title: deprecate(PropTypes.string, 'This property is deprecated and will be removed in the next major version. Use DismissibleTag instead.'),
|
|
155
164
|
/**
|
|
156
165
|
* Specify the type of the `Tag`
|
|
157
166
|
*/
|
|
158
167
|
type: PropTypes.oneOf(Object.keys(TYPES))
|
|
159
168
|
};
|
|
160
|
-
const types = Object.keys(TYPES);
|
|
161
169
|
|
|
162
|
-
export { Tag as default
|
|
170
|
+
export { SIZES, TYPES, Tag as default };
|
|
@@ -65,6 +65,7 @@ function Toggle(_ref) {
|
|
|
65
65
|
const switchClasses = cx(`${prefix}--toggle__switch`, {
|
|
66
66
|
[`${prefix}--toggle__switch--checked`]: checked
|
|
67
67
|
});
|
|
68
|
+
const labelId = `${id}_label`;
|
|
68
69
|
return (
|
|
69
70
|
/*#__PURE__*/
|
|
70
71
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
@@ -88,10 +89,11 @@ function Toggle(_ref) {
|
|
|
88
89
|
role: "switch",
|
|
89
90
|
type: "button",
|
|
90
91
|
"aria-checked": checked,
|
|
91
|
-
"aria-labelledby":
|
|
92
|
+
"aria-labelledby": ariaLabelledby ?? labelId,
|
|
92
93
|
disabled: disabled,
|
|
93
94
|
onClick: handleClick
|
|
94
95
|
})), /*#__PURE__*/React__default.createElement(LabelComponent, {
|
|
96
|
+
id: labelId,
|
|
95
97
|
htmlFor: ariaLabelledby ? undefined : id,
|
|
96
98
|
className: `${prefix}--toggle__label`
|
|
97
99
|
}, labelText && /*#__PURE__*/React__default.createElement(Text, {
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import { type ElementType, type ReactNode } from 'react';
|
|
8
|
+
import React, { type ElementType, type ReactNode } from 'react';
|
|
9
9
|
import { type PopoverAlignment } from '../Popover';
|
|
10
|
+
import { PolymorphicProps } from '../../types/common';
|
|
10
11
|
type ToggletipLabelProps<E extends ElementType> = {
|
|
11
12
|
as?: E | undefined;
|
|
12
13
|
children?: ReactNode;
|
|
@@ -78,16 +79,17 @@ export declare namespace Toggletip {
|
|
|
78
79
|
defaultOpen: PropTypes.Requireable<boolean>;
|
|
79
80
|
};
|
|
80
81
|
}
|
|
81
|
-
interface
|
|
82
|
+
interface ToggletipButtonBaseProps {
|
|
82
83
|
children?: ReactNode;
|
|
83
84
|
className?: string | undefined;
|
|
84
85
|
label?: string | undefined;
|
|
85
86
|
}
|
|
87
|
+
export type ToggleTipButtonProps<T extends React.ElementType> = PolymorphicProps<T, ToggletipButtonBaseProps>;
|
|
86
88
|
/**
|
|
87
89
|
* `ToggletipButton` controls the visibility of the Toggletip through mouse
|
|
88
90
|
* clicks and keyboard interactions.
|
|
89
91
|
*/
|
|
90
|
-
export declare function ToggletipButton({ children, className: customClassName, label, }:
|
|
92
|
+
export declare function ToggletipButton<T extends React.ElementType>({ children, className: customClassName, label, as: BaseComponent, ...rest }: ToggleTipButtonProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
91
93
|
export declare namespace ToggletipButton {
|
|
92
94
|
var propTypes: {
|
|
93
95
|
/**
|
|
@@ -92,6 +92,9 @@ function Toggletip(_ref2) {
|
|
|
92
92
|
},
|
|
93
93
|
contentProps: {
|
|
94
94
|
id
|
|
95
|
+
},
|
|
96
|
+
onClick: {
|
|
97
|
+
onClick: actions.toggle
|
|
95
98
|
}
|
|
96
99
|
};
|
|
97
100
|
const onKeyDown = event => {
|
|
@@ -179,16 +182,24 @@ function ToggletipButton(_ref3) {
|
|
|
179
182
|
let {
|
|
180
183
|
children,
|
|
181
184
|
className: customClassName,
|
|
182
|
-
label = 'Show information'
|
|
185
|
+
label = 'Show information',
|
|
186
|
+
as: BaseComponent,
|
|
187
|
+
...rest
|
|
183
188
|
} = _ref3;
|
|
184
189
|
const toggletip = useToggletip();
|
|
185
190
|
const prefix = usePrefix();
|
|
186
191
|
const className = cx(`${prefix}--toggletip-button`, customClassName);
|
|
192
|
+
const ComponentToggle = BaseComponent ?? 'button';
|
|
193
|
+
if (ComponentToggle !== 'button') {
|
|
194
|
+
return /*#__PURE__*/React__default.createElement(ComponentToggle, _extends({}, toggletip?.onClick, {
|
|
195
|
+
className: className
|
|
196
|
+
}, rest), children);
|
|
197
|
+
}
|
|
187
198
|
return /*#__PURE__*/React__default.createElement("button", _extends({}, toggletip?.buttonProps, {
|
|
188
199
|
"aria-label": label,
|
|
189
200
|
type: "button",
|
|
190
201
|
className: className
|
|
191
|
-
}), children);
|
|
202
|
+
}, rest), children);
|
|
192
203
|
}
|
|
193
204
|
ToggletipButton.propTypes = {
|
|
194
205
|
/**
|
|
@@ -49,6 +49,9 @@ const DefinitionTooltip = _ref => {
|
|
|
49
49
|
onMouseEnter: () => {
|
|
50
50
|
openOnHover ? setOpen(true) : null;
|
|
51
51
|
},
|
|
52
|
+
onFocus: () => {
|
|
53
|
+
setOpen(true);
|
|
54
|
+
},
|
|
52
55
|
open: isOpen
|
|
53
56
|
}, /*#__PURE__*/React__default.createElement("button", _extends({}, rest, {
|
|
54
57
|
className: cx(`${prefix}--definition-term`, triggerClassName),
|
package/es/feature-flags.js
CHANGED
package/es/index.js
CHANGED
|
@@ -97,7 +97,7 @@ export { default as IconSwitch } from './components/Switch/IconSwitch.js';
|
|
|
97
97
|
export { IconTab, Tab, TabList, TabPanel, TabPanels, Tabs } from './components/Tabs/Tabs.js';
|
|
98
98
|
export { default as TabContent } from './components/TabContent/TabContent.js';
|
|
99
99
|
export { default as TabsSkeleton } from './components/Tabs/Tabs.Skeleton.js';
|
|
100
|
-
export { default as Tag
|
|
100
|
+
export { default as Tag } from './components/Tag/Tag.js';
|
|
101
101
|
export { default as TagSkeleton } from './components/Tag/Tag.Skeleton.js';
|
|
102
102
|
export { default as TextArea } from './components/TextArea/TextArea.js';
|
|
103
103
|
export { default as TextAreaSkeleton } from './components/TextArea/TextArea.Skeleton.js';
|
package/es/internal/Selection.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { defineProperty as _defineProperty } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import React__default, { useRef, useState,
|
|
9
|
+
import React__default, { useRef, useState, useEffect, useCallback } from 'react';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import isEqual from 'lodash.isequal';
|
|
12
12
|
|
|
@@ -39,7 +39,16 @@ function useSelection(_ref2) {
|
|
|
39
39
|
const savedOnChange = useRef(onChange);
|
|
40
40
|
const [uncontrolledItems, setUncontrolledItems] = useState(initialSelectedItems);
|
|
41
41
|
const isControlled = !!controlledItems;
|
|
42
|
-
const selectedItems = isControlled ? controlledItems : uncontrolledItems;
|
|
42
|
+
const [selectedItems, setSelectedItems] = useState(isControlled ? controlledItems : uncontrolledItems);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
callOnChangeHandler({
|
|
45
|
+
isControlled,
|
|
46
|
+
isMounted: isMounted.current,
|
|
47
|
+
onChangeHandlerControlled: savedOnChange.current,
|
|
48
|
+
onChangeHandlerUncontrolled: setUncontrolledItems,
|
|
49
|
+
selectedItems: selectedItems
|
|
50
|
+
});
|
|
51
|
+
}, [isControlled, isMounted, selectedItems]);
|
|
43
52
|
const onItemChange = useCallback(item => {
|
|
44
53
|
if (disabled) {
|
|
45
54
|
return;
|
|
@@ -50,27 +59,12 @@ function useSelection(_ref2) {
|
|
|
50
59
|
selectedIndex = index;
|
|
51
60
|
}
|
|
52
61
|
});
|
|
53
|
-
let newSelectedItems;
|
|
54
62
|
if (selectedIndex === undefined) {
|
|
55
|
-
|
|
56
|
-
callOnChangeHandler({
|
|
57
|
-
isControlled,
|
|
58
|
-
isMounted: isMounted.current,
|
|
59
|
-
onChangeHandlerControlled: savedOnChange.current,
|
|
60
|
-
onChangeHandlerUncontrolled: setUncontrolledItems,
|
|
61
|
-
selectedItems: newSelectedItems
|
|
62
|
-
});
|
|
63
|
+
setSelectedItems(selectedItems => selectedItems.concat(item));
|
|
63
64
|
return;
|
|
64
65
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
isControlled,
|
|
68
|
-
isMounted: isMounted.current,
|
|
69
|
-
onChangeHandlerControlled: savedOnChange.current,
|
|
70
|
-
onChangeHandlerUncontrolled: setUncontrolledItems,
|
|
71
|
-
selectedItems: newSelectedItems
|
|
72
|
-
});
|
|
73
|
-
}, [disabled, isControlled, selectedItems]);
|
|
66
|
+
setSelectedItems(selectedItems => removeAtIndex(selectedItems, selectedIndex));
|
|
67
|
+
}, [disabled, selectedItems]);
|
|
74
68
|
const clearSelection = useCallback(() => {
|
|
75
69
|
if (disabled) {
|
|
76
70
|
return;
|
|
@@ -80,7 +74,7 @@ function useSelection(_ref2) {
|
|
|
80
74
|
isMounted: isMounted.current,
|
|
81
75
|
onChangeHandlerControlled: savedOnChange.current,
|
|
82
76
|
onChangeHandlerUncontrolled: setUncontrolledItems,
|
|
83
|
-
selectedItems: []
|
|
77
|
+
selectedItems: setSelectedItems([])
|
|
84
78
|
});
|
|
85
79
|
}, [disabled, isControlled]);
|
|
86
80
|
useEffect(() => {
|
|
@@ -55,7 +55,7 @@ function AccordionItem(_ref) {
|
|
|
55
55
|
const prefix = usePrefix.usePrefix();
|
|
56
56
|
const className = cx__default["default"]({
|
|
57
57
|
[`${prefix}--accordion__item`]: true,
|
|
58
|
-
[`${prefix}--accordion__item--active`]: isOpen,
|
|
58
|
+
[`${prefix}--accordion__item--active`]: isOpen && !disabled,
|
|
59
59
|
[`${prefix}--accordion__item--disabled`]: disabled,
|
|
60
60
|
[customClassName]: !!customClassName
|
|
61
61
|
});
|
|
@@ -36,7 +36,7 @@ const rowHeightInPixels = 16;
|
|
|
36
36
|
const defaultMaxCollapsedNumberOfRows = 15;
|
|
37
37
|
const defaultMaxExpandedNumberOfRows = 0;
|
|
38
38
|
const defaultMinCollapsedNumberOfRows = 3;
|
|
39
|
-
const defaultMinExpandedNumberOfRows =
|
|
39
|
+
const defaultMinExpandedNumberOfRows = 0;
|
|
40
40
|
function CodeSnippet(_ref) {
|
|
41
41
|
let {
|
|
42
42
|
align = 'bottom',
|
|
@@ -113,7 +113,7 @@ function CodeSnippet(_ref) {
|
|
|
113
113
|
if (codeContentRef?.current && type === 'multi') {
|
|
114
114
|
const {
|
|
115
115
|
height
|
|
116
|
-
} =
|
|
116
|
+
} = innerCodeRef.current.getBoundingClientRect();
|
|
117
117
|
if (maxCollapsedNumberOfRows > 0 && (maxExpandedNumberOfRows <= 0 || maxExpandedNumberOfRows > maxCollapsedNumberOfRows) && height > maxCollapsedNumberOfRows * rowHeightInPixels) {
|
|
118
118
|
setShouldShowMoreLessBtn(true);
|
|
119
119
|
} 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>;
|
|
@@ -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
|
*/
|
|
@@ -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;
|