@carbon/react 1.44.0-rc.0 → 1.44.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 +969 -1010
- package/es/components/Accordion/AccordionItem.d.ts +1 -1
- package/es/components/Accordion/AccordionItem.js +19 -15
- package/es/components/Checkbox/Checkbox.d.ts +4 -0
- package/es/components/Checkbox/Checkbox.js +15 -2
- package/es/components/CheckboxGroup/CheckboxGroup.js +17 -2
- package/es/components/DataTable/tools/sorting.js +1 -1
- package/es/components/FileUploader/FileUploader.js +5 -3
- package/es/components/Grid/Column.js +11 -1
- package/es/components/MenuButton/index.js +7 -1
- package/es/components/RadioButton/RadioButton.d.ts +4 -0
- package/es/components/RadioButton/RadioButton.js +15 -2
- package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -0
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +17 -2
- package/es/components/Select/Select.d.ts +1 -1
- package/es/components/Slug/index.js +1 -1
- package/es/components/Tile/Tile.d.ts +37 -0
- package/es/components/Tile/Tile.js +110 -13
- package/es/components/UIShell/Content.d.ts +296 -0
- package/es/components/UIShell/Content.js +1 -2
- package/es/components/UIShell/SideNav.d.ts +1 -1
- package/lib/components/Accordion/AccordionItem.d.ts +1 -1
- package/lib/components/Accordion/AccordionItem.js +18 -14
- package/lib/components/Checkbox/Checkbox.d.ts +4 -0
- package/lib/components/Checkbox/Checkbox.js +15 -2
- package/lib/components/CheckboxGroup/CheckboxGroup.js +17 -2
- package/lib/components/DataTable/tools/sorting.js +1 -1
- package/lib/components/FileUploader/FileUploader.js +5 -3
- package/lib/components/Grid/Column.js +11 -1
- package/lib/components/MenuButton/index.js +7 -1
- package/lib/components/RadioButton/RadioButton.d.ts +4 -0
- package/lib/components/RadioButton/RadioButton.js +15 -2
- package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -0
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +17 -2
- package/lib/components/Select/Select.d.ts +1 -1
- package/lib/components/Slug/index.js +1 -1
- package/lib/components/Tile/Tile.d.ts +37 -0
- package/lib/components/Tile/Tile.js +110 -13
- package/lib/components/UIShell/Content.d.ts +296 -0
- package/lib/components/UIShell/Content.js +1 -2
- package/lib/components/UIShell/SideNav.d.ts +1 -1
- package/package.json +5 -5
|
@@ -47,8 +47,6 @@ function AccordionItem(_ref) {
|
|
|
47
47
|
...rest
|
|
48
48
|
} = _ref;
|
|
49
49
|
const [isOpen, setIsOpen] = React.useState(open);
|
|
50
|
-
const [prevIsOpen, setPrevIsOpen] = React.useState(open);
|
|
51
|
-
const [animation, setAnimation] = React.useState('');
|
|
52
50
|
const accordionState = React.useContext(AccordionProvider.AccordionContext);
|
|
53
51
|
const disabledIsControlled = typeof controlledDisabled === 'boolean';
|
|
54
52
|
const disabled = disabledIsControlled ? controlledDisabled : accordionState.disabled;
|
|
@@ -57,23 +55,28 @@ function AccordionItem(_ref) {
|
|
|
57
55
|
const className = cx__default["default"]({
|
|
58
56
|
[`${prefix}--accordion__item`]: true,
|
|
59
57
|
[`${prefix}--accordion__item--active`]: isOpen,
|
|
60
|
-
[`${prefix}--accordion__item--${animation}`]: animation,
|
|
61
58
|
[`${prefix}--accordion__item--disabled`]: disabled,
|
|
62
59
|
[customClassName]: !!customClassName
|
|
63
60
|
});
|
|
64
61
|
const Toggle = renderToggle || renderExpando; // remove renderExpando in next major release
|
|
65
62
|
|
|
66
|
-
|
|
67
|
-
setAnimation(isOpen ? 'collapsing' : 'expanding');
|
|
68
|
-
setIsOpen(open);
|
|
69
|
-
setPrevIsOpen(open);
|
|
70
|
-
}
|
|
63
|
+
const content = React.useRef(null);
|
|
71
64
|
|
|
72
65
|
// When the AccordionItem heading is clicked, toggle the open state of the
|
|
73
66
|
// panel
|
|
74
67
|
function onClick(event) {
|
|
68
|
+
// type guard for ref
|
|
69
|
+
if (!content.current) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (isOpen) {
|
|
73
|
+
// accordion closes
|
|
74
|
+
content.current.style.maxBlockSize = '';
|
|
75
|
+
} else {
|
|
76
|
+
// accordion opens
|
|
77
|
+
content.current.style.maxBlockSize = content.current.scrollHeight + 15 + 'px';
|
|
78
|
+
}
|
|
75
79
|
const nextValue = !isOpen;
|
|
76
|
-
setAnimation(isOpen ? 'collapsing' : 'expanding');
|
|
77
80
|
setIsOpen(nextValue);
|
|
78
81
|
if (onHeadingClick) {
|
|
79
82
|
// TODO: normalize signature, potentially:
|
|
@@ -95,13 +98,10 @@ function AccordionItem(_ref) {
|
|
|
95
98
|
if (handleAnimationEnd) {
|
|
96
99
|
handleAnimationEnd(event);
|
|
97
100
|
}
|
|
98
|
-
setAnimation('');
|
|
99
101
|
}
|
|
100
102
|
return /*#__PURE__*/React__default["default"].createElement("li", _rollupPluginBabelHelpers["extends"]({
|
|
101
103
|
className: className
|
|
102
|
-
}, rest, {
|
|
103
|
-
onAnimationEnd: onAnimationEnd
|
|
104
|
-
}), /*#__PURE__*/React__default["default"].createElement(Toggle, {
|
|
104
|
+
}, rest), /*#__PURE__*/React__default["default"].createElement(Toggle, {
|
|
105
105
|
disabled: disabled,
|
|
106
106
|
"aria-controls": id,
|
|
107
107
|
"aria-expanded": isOpen,
|
|
@@ -115,9 +115,13 @@ function AccordionItem(_ref) {
|
|
|
115
115
|
as: "div",
|
|
116
116
|
className: `${prefix}--accordion__title`
|
|
117
117
|
}, title)), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
118
|
+
ref: content,
|
|
119
|
+
className: `${prefix}--accordion__wrapper`,
|
|
120
|
+
onTransitionEnd: onAnimationEnd
|
|
121
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
118
122
|
id: id,
|
|
119
123
|
className: `${prefix}--accordion__content`
|
|
120
|
-
}, children));
|
|
124
|
+
}, children)));
|
|
121
125
|
}
|
|
122
126
|
AccordionItem.propTypes = {
|
|
123
127
|
/**
|
|
@@ -45,6 +45,10 @@ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
|
|
|
45
45
|
* Provide the text that is displayed when the Checkbox is in an invalid state
|
|
46
46
|
*/
|
|
47
47
|
invalidText?: React.ReactNode;
|
|
48
|
+
/**
|
|
49
|
+
* Provide a `Slug` component to be rendered inside the `Checkbox` component
|
|
50
|
+
*/
|
|
51
|
+
slug?: ReactNodeLike;
|
|
48
52
|
/**
|
|
49
53
|
* Specify whether the Checkbox is currently invalid
|
|
50
54
|
*/
|
|
@@ -43,6 +43,7 @@ const Checkbox = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
43
43
|
title = '',
|
|
44
44
|
warn,
|
|
45
45
|
warnText,
|
|
46
|
+
slug,
|
|
46
47
|
...other
|
|
47
48
|
} = _ref;
|
|
48
49
|
const prefix = usePrefix.usePrefix();
|
|
@@ -57,11 +58,19 @@ const Checkbox = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
57
58
|
const wrapperClasses = cx__default["default"](`${prefix}--form-item`, `${prefix}--checkbox-wrapper`, className, {
|
|
58
59
|
[`${prefix}--checkbox-wrapper--readonly`]: readOnly,
|
|
59
60
|
[`${prefix}--checkbox-wrapper--invalid`]: !readOnly && invalid,
|
|
60
|
-
[`${prefix}--checkbox-wrapper--warning`]: showWarning
|
|
61
|
+
[`${prefix}--checkbox-wrapper--warning`]: showWarning,
|
|
62
|
+
[`${prefix}--checkbox-wrapper--slug`]: slug
|
|
61
63
|
});
|
|
62
64
|
const innerLabelClasses = cx__default["default"](`${prefix}--checkbox-label-text`, {
|
|
63
65
|
[`${prefix}--visually-hidden`]: hideLabel
|
|
64
66
|
});
|
|
67
|
+
let normalizedSlug;
|
|
68
|
+
if (slug && /*#__PURE__*/React__default["default"].isValidElement(slug)) {
|
|
69
|
+
const size = slug.props?.['kind'] === 'inline' ? 'md' : 'mini';
|
|
70
|
+
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
71
|
+
size
|
|
72
|
+
});
|
|
73
|
+
}
|
|
65
74
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
66
75
|
className: wrapperClasses
|
|
67
76
|
}, /*#__PURE__*/React__default["default"].createElement("input", _rollupPluginBabelHelpers["extends"]({}, other, {
|
|
@@ -107,7 +116,7 @@ const Checkbox = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
107
116
|
title: title
|
|
108
117
|
}, /*#__PURE__*/React__default["default"].createElement(Text.Text, {
|
|
109
118
|
className: innerLabelClasses
|
|
110
|
-
}, labelText)), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
119
|
+
}, labelText, normalizedSlug)), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
111
120
|
className: `${prefix}--checkbox__validation-msg`
|
|
112
121
|
}, !readOnly && invalid && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningFilled, {
|
|
113
122
|
className: `${prefix}--checkbox__invalid-icon`
|
|
@@ -175,6 +184,10 @@ Checkbox.propTypes = {
|
|
|
175
184
|
* Specify whether the Checkbox is read-only
|
|
176
185
|
*/
|
|
177
186
|
readOnly: PropTypes__default["default"].bool,
|
|
187
|
+
/**
|
|
188
|
+
* Provide a `Slug` component to be rendered inside the `Checkbox` component
|
|
189
|
+
*/
|
|
190
|
+
slug: PropTypes__default["default"].node,
|
|
178
191
|
/**
|
|
179
192
|
* Specify a title for the <label> node for the Checkbox
|
|
180
193
|
*/
|
|
@@ -36,6 +36,7 @@ function CheckboxGroup(_ref) {
|
|
|
36
36
|
readOnly,
|
|
37
37
|
warn,
|
|
38
38
|
warnText,
|
|
39
|
+
slug,
|
|
39
40
|
...rest
|
|
40
41
|
} = _ref;
|
|
41
42
|
const prefix = usePrefix.usePrefix();
|
|
@@ -50,8 +51,18 @@ function CheckboxGroup(_ref) {
|
|
|
50
51
|
const fieldsetClasses = cx__default["default"](`${prefix}--checkbox-group`, className, {
|
|
51
52
|
[`${prefix}--checkbox-group--readonly`]: readOnly,
|
|
52
53
|
[`${prefix}--checkbox-group--invalid`]: !readOnly && invalid,
|
|
53
|
-
[`${prefix}--checkbox-group--warning`]: showWarning
|
|
54
|
+
[`${prefix}--checkbox-group--warning`]: showWarning,
|
|
55
|
+
[`${prefix}--checkbox-group--slug`]: slug
|
|
54
56
|
});
|
|
57
|
+
|
|
58
|
+
// Slug is always size `mini`
|
|
59
|
+
let normalizedSlug;
|
|
60
|
+
if (slug) {
|
|
61
|
+
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
62
|
+
size: 'mini',
|
|
63
|
+
kind: 'default'
|
|
64
|
+
});
|
|
65
|
+
}
|
|
55
66
|
return /*#__PURE__*/React__default["default"].createElement("fieldset", _rollupPluginBabelHelpers["extends"]({
|
|
56
67
|
className: fieldsetClasses,
|
|
57
68
|
"data-invalid": invalid ? true : undefined,
|
|
@@ -61,7 +72,7 @@ function CheckboxGroup(_ref) {
|
|
|
61
72
|
}, rest), /*#__PURE__*/React__default["default"].createElement("legend", {
|
|
62
73
|
className: `${prefix}--label`,
|
|
63
74
|
id: legendId || rest['aria-labelledby']
|
|
64
|
-
}, legendText), children, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
75
|
+
}, legendText, normalizedSlug), children, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
65
76
|
className: `${prefix}--checkbox-group__validation-msg`
|
|
66
77
|
}, !readOnly && invalid && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningFilled, {
|
|
67
78
|
className: `${prefix}--checkbox__invalid-icon`
|
|
@@ -107,6 +118,10 @@ CheckboxGroup.propTypes = {
|
|
|
107
118
|
* Whether the CheckboxGroup should be read-only
|
|
108
119
|
*/
|
|
109
120
|
readOnly: PropTypes__default["default"].bool,
|
|
121
|
+
/**
|
|
122
|
+
* Provide a `Slug` component to be rendered inside the `CheckboxGroup` component
|
|
123
|
+
*/
|
|
124
|
+
slug: PropTypes__default["default"].node,
|
|
110
125
|
/**
|
|
111
126
|
* Specify whether the form group is currently in warning state
|
|
112
127
|
*/
|
|
@@ -37,7 +37,7 @@ const compare = function (a, b) {
|
|
|
37
37
|
|
|
38
38
|
// if column has React elements, this should sort by the child string if there is one
|
|
39
39
|
if (typeof a === 'object' && typeof b === 'object') {
|
|
40
|
-
if (typeof a.props
|
|
40
|
+
if (typeof a.props?.children === 'string' && typeof b.props?.children === 'string') {
|
|
41
41
|
return compareStrings(a.props.children, b.props.children, locale);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -116,11 +116,12 @@ class FileUploader extends React__default["default"].Component {
|
|
|
116
116
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
117
117
|
className: classes
|
|
118
118
|
}, other), !labelTitle ? null : /*#__PURE__*/React__default["default"].createElement(Text.Text, {
|
|
119
|
-
as: "
|
|
119
|
+
as: "h3",
|
|
120
120
|
className: getHelperLabelClasses(`${prefix}--file--label`)
|
|
121
121
|
}, labelTitle), /*#__PURE__*/React__default["default"].createElement(Text.Text, {
|
|
122
122
|
as: "p",
|
|
123
|
-
className: getHelperLabelClasses(`${prefix}--label-description`)
|
|
123
|
+
className: getHelperLabelClasses(`${prefix}--label-description`),
|
|
124
|
+
id: "description"
|
|
124
125
|
}, labelDescription), /*#__PURE__*/React__default["default"].createElement(FileUploaderButton["default"], {
|
|
125
126
|
innerRef: this.uploaderButton,
|
|
126
127
|
disabled: disabled,
|
|
@@ -131,7 +132,8 @@ class FileUploader extends React__default["default"].Component {
|
|
|
131
132
|
disableLabelChanges: true,
|
|
132
133
|
accept: accept,
|
|
133
134
|
name: name,
|
|
134
|
-
size: size
|
|
135
|
+
size: size,
|
|
136
|
+
"aria-describedby": "description"
|
|
135
137
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
136
138
|
className: `${prefix}--file-container`
|
|
137
139
|
}, this.state.filenames.length === 0 ? null : this.state.filenames.map((name, index) => /*#__PURE__*/React__default["default"].createElement("span", _rollupPluginBabelHelpers["extends"]({
|
|
@@ -131,6 +131,11 @@ Column.propTypes = {
|
|
|
131
131
|
* @see https://www.carbondesignsystem.com/guidelines/layout#breakpoints
|
|
132
132
|
*/
|
|
133
133
|
sm: spanPropType,
|
|
134
|
+
/**
|
|
135
|
+
* Specify constant column span, start, or end values that will not change
|
|
136
|
+
* based on breakpoint
|
|
137
|
+
*/
|
|
138
|
+
span: PropTypes__default["default"].oneOfType([PropTypes__default["default"].number, percentSpanType]),
|
|
134
139
|
/**
|
|
135
140
|
* Specify column span for the `xlg` breakpoint (Default breakpoint up to
|
|
136
141
|
* 1584px) This breakpoint supports 16 columns by default.
|
|
@@ -340,8 +345,13 @@ function getClassNameForFlexGridBreakpoints(breakpoints, prefix) {
|
|
|
340
345
|
*/
|
|
341
346
|
function getClassNameForSpan(value, prefix) {
|
|
342
347
|
const classNames = [];
|
|
343
|
-
if (typeof value === 'number'
|
|
348
|
+
if (typeof value === 'number') {
|
|
344
349
|
classNames.push(`${prefix}--col-span-${value}`);
|
|
350
|
+
}
|
|
351
|
+
// If value is a string, the user has specified a percent
|
|
352
|
+
// they'd like this column to span.
|
|
353
|
+
else if (typeof value === 'string') {
|
|
354
|
+
classNames.push(`${prefix}--col-span-${value.slice(0, -1)}`);
|
|
345
355
|
} else if (typeof value === 'object') {
|
|
346
356
|
const {
|
|
347
357
|
span,
|
|
@@ -39,6 +39,7 @@ const MenuButton = /*#__PURE__*/React__default["default"].forwardRef(function Me
|
|
|
39
39
|
kind = defaultButtonKind,
|
|
40
40
|
label,
|
|
41
41
|
size = 'lg',
|
|
42
|
+
tabIndex = 0,
|
|
42
43
|
...rest
|
|
43
44
|
} = _ref;
|
|
44
45
|
const id = useId.useId('MenuButton');
|
|
@@ -79,6 +80,7 @@ const MenuButton = /*#__PURE__*/React__default["default"].forwardRef(function Me
|
|
|
79
80
|
}), /*#__PURE__*/React__default["default"].createElement(Button["default"], {
|
|
80
81
|
className: triggerClasses,
|
|
81
82
|
size: size,
|
|
83
|
+
tabIndex: tabIndex,
|
|
82
84
|
kind: buttonKind,
|
|
83
85
|
renderIcon: iconsReact.ChevronDown,
|
|
84
86
|
disabled: disabled,
|
|
@@ -124,7 +126,11 @@ MenuButton.propTypes = {
|
|
|
124
126
|
/**
|
|
125
127
|
* Specify the size of the button and menu.
|
|
126
128
|
*/
|
|
127
|
-
size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg'])
|
|
129
|
+
size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg']),
|
|
130
|
+
/**
|
|
131
|
+
* Specify the tabIndex of the button.
|
|
132
|
+
*/
|
|
133
|
+
tabIndex: PropTypes__default["default"].number
|
|
128
134
|
};
|
|
129
135
|
|
|
130
136
|
exports.MenuButton = MenuButton;
|
|
@@ -55,6 +55,10 @@ export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
55
55
|
* Provide a handler that is invoked when a user clicks on the control
|
|
56
56
|
*/
|
|
57
57
|
onClick?: (evt: React.MouseEvent<HTMLInputElement>) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Provide a `Slug` component to be rendered inside the `RadioButton` component
|
|
60
|
+
*/
|
|
61
|
+
slug?: ReactNodeLike;
|
|
58
62
|
/**
|
|
59
63
|
* Specify the value of the `<RadioButton>`
|
|
60
64
|
*/
|
|
@@ -36,6 +36,7 @@ const RadioButton = /*#__PURE__*/React__default["default"].forwardRef((props, re
|
|
|
36
36
|
name,
|
|
37
37
|
onChange = () => {},
|
|
38
38
|
value = '',
|
|
39
|
+
slug,
|
|
39
40
|
...rest
|
|
40
41
|
} = props;
|
|
41
42
|
const prefix = usePrefix.usePrefix();
|
|
@@ -48,9 +49,17 @@ const RadioButton = /*#__PURE__*/React__default["default"].forwardRef((props, re
|
|
|
48
49
|
[`${prefix}--visually-hidden`]: hideLabel
|
|
49
50
|
});
|
|
50
51
|
const wrapperClasses = cx__default["default"](className, `${prefix}--radio-button-wrapper`, {
|
|
51
|
-
[`${prefix}--radio-button-wrapper--label-${labelPosition}`]: labelPosition !== 'right'
|
|
52
|
+
[`${prefix}--radio-button-wrapper--label-${labelPosition}`]: labelPosition !== 'right',
|
|
53
|
+
[`${prefix}--radio-button-wrapper--slug`]: slug
|
|
52
54
|
});
|
|
53
55
|
const inputRef = React.useRef(null);
|
|
56
|
+
let normalizedSlug;
|
|
57
|
+
if (slug && /*#__PURE__*/React__default["default"].isValidElement(slug)) {
|
|
58
|
+
const size = slug.props?.['kind'] === 'inline' ? 'md' : 'mini';
|
|
59
|
+
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
60
|
+
size
|
|
61
|
+
});
|
|
62
|
+
}
|
|
54
63
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
55
64
|
className: wrapperClasses
|
|
56
65
|
}, /*#__PURE__*/React__default["default"].createElement("input", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
@@ -69,7 +78,7 @@ const RadioButton = /*#__PURE__*/React__default["default"].forwardRef((props, re
|
|
|
69
78
|
className: `${prefix}--radio-button__appearance`
|
|
70
79
|
}), labelText && /*#__PURE__*/React__default["default"].createElement(Text.Text, {
|
|
71
80
|
className: innerLabelClasses
|
|
72
|
-
}, labelText)));
|
|
81
|
+
}, labelText, normalizedSlug)));
|
|
73
82
|
});
|
|
74
83
|
RadioButton.displayName = 'RadioButton';
|
|
75
84
|
RadioButton.propTypes = {
|
|
@@ -120,6 +129,10 @@ RadioButton.propTypes = {
|
|
|
120
129
|
* Provide a handler that is invoked when a user clicks on the control
|
|
121
130
|
*/
|
|
122
131
|
onClick: PropTypes__default["default"].func,
|
|
132
|
+
/**
|
|
133
|
+
* Provide a `Slug` component to be rendered inside the `RadioButton` component
|
|
134
|
+
*/
|
|
135
|
+
slug: PropTypes__default["default"].node,
|
|
123
136
|
/**
|
|
124
137
|
* Specify the value of the `<RadioButton>`
|
|
125
138
|
*/
|
|
@@ -63,6 +63,10 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
|
|
|
63
63
|
* Whether the RadioButtonGroup should be read-only
|
|
64
64
|
*/
|
|
65
65
|
readOnly?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Provide a `Slug` component to be rendered inside the `RadioButtonGroup` component
|
|
68
|
+
*/
|
|
69
|
+
slug?: ReactNodeLike;
|
|
66
70
|
/**
|
|
67
71
|
* Specify whether the control is currently in warning state
|
|
68
72
|
*/
|
|
@@ -44,6 +44,7 @@ const RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef((prop
|
|
|
44
44
|
valueSelected,
|
|
45
45
|
warn = false,
|
|
46
46
|
warnText,
|
|
47
|
+
slug,
|
|
47
48
|
...rest
|
|
48
49
|
} = props;
|
|
49
50
|
const prefix = usePrefix.usePrefix();
|
|
@@ -98,7 +99,8 @@ const RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef((prop
|
|
|
98
99
|
[`${prefix}--radio-button-group--label-${labelPosition}`]: labelPosition,
|
|
99
100
|
[`${prefix}--radio-button-group--readonly`]: readOnly,
|
|
100
101
|
[`${prefix}--radio-button-group--invalid`]: !readOnly && invalid,
|
|
101
|
-
[`${prefix}--radio-button-group--warning`]: showWarning
|
|
102
|
+
[`${prefix}--radio-button-group--warning`]: showWarning,
|
|
103
|
+
[`${prefix}--radio-button-group--slug`]: slug
|
|
102
104
|
});
|
|
103
105
|
const helperClasses = cx__default["default"](`${prefix}--form__helper-text`, {
|
|
104
106
|
[`${prefix}--form__helper-text--disabled`]: disabled
|
|
@@ -109,6 +111,15 @@ const RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef((prop
|
|
|
109
111
|
className: helperClasses
|
|
110
112
|
}, helperText) : null;
|
|
111
113
|
const divRef = React.useRef(null);
|
|
114
|
+
|
|
115
|
+
// Slug is always size `mini`
|
|
116
|
+
let normalizedSlug;
|
|
117
|
+
if (slug) {
|
|
118
|
+
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
119
|
+
size: 'mini',
|
|
120
|
+
kind: 'default'
|
|
121
|
+
});
|
|
122
|
+
}
|
|
112
123
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
113
124
|
className: wrapperClasses,
|
|
114
125
|
ref: mergeRefs["default"](divRef, ref)
|
|
@@ -119,7 +130,7 @@ const RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef((prop
|
|
|
119
130
|
"aria-describedby": showHelper && helperText ? helperId : undefined
|
|
120
131
|
}, rest), legendText && /*#__PURE__*/React__default["default"].createElement(index.Legend, {
|
|
121
132
|
className: `${prefix}--label`
|
|
122
|
-
}, legendText), getRadioButtons()), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
133
|
+
}, legendText, normalizedSlug), getRadioButtons()), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
123
134
|
className: `${prefix}--radio-button__validation-msg`
|
|
124
135
|
}, !readOnly && invalid && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningFilled, {
|
|
125
136
|
className: `${prefix}--radio-button__invalid-icon`
|
|
@@ -186,6 +197,10 @@ RadioButtonGroup.propTypes = {
|
|
|
186
197
|
* Whether the RadioButtonGroup should be read-only
|
|
187
198
|
*/
|
|
188
199
|
readOnly: PropTypes__default["default"].bool,
|
|
200
|
+
/**
|
|
201
|
+
* Provide a `Slug` component to be rendered inside the `RadioButtonGroup` component
|
|
202
|
+
*/
|
|
203
|
+
slug: PropTypes__default["default"].node,
|
|
189
204
|
/**
|
|
190
205
|
* Specify the value that is currently selected in the group
|
|
191
206
|
*/
|
|
@@ -90,5 +90,5 @@ interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttr
|
|
|
90
90
|
*/
|
|
91
91
|
warnText?: ReactNode;
|
|
92
92
|
}
|
|
93
|
-
declare const Select: React.ForwardRefExoticComponent<Pick<SelectProps, "value" | "children" | "disabled" | "form" | "slot" | "style" | "title" | "className" | "size" | "dir" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "autoComplete" | "multiple" | "key" | "id" | "aria-controls" | "aria-expanded" | "onClick" | "
|
|
93
|
+
declare const Select: React.ForwardRefExoticComponent<Pick<SelectProps, "value" | "children" | "disabled" | "form" | "slot" | "style" | "title" | "className" | "size" | "dir" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "autoComplete" | "multiple" | "key" | "id" | "aria-controls" | "aria-expanded" | "onClick" | "onKeyDown" | "onTransitionEnd" | "tabIndex" | "color" | "lang" | "name" | "role" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEndCapture" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "inline" | "readOnly" | "required" | "light" | "invalid" | "labelText" | "helperText" | "invalidText" | "hideLabel" | "warn" | "warnText" | "slug" | "noLabel"> & React.RefAttributes<HTMLSelectElement>>;
|
|
94
94
|
export default Select;
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import React, { type ReactNode, type MouseEvent, type KeyboardEvent, type HTMLAttributes, type ChangeEvent, type ComponentType } from 'react';
|
|
2
|
+
import { ReactNodeLike } from 'prop-types';
|
|
2
3
|
export interface TileProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
4
|
children?: ReactNode;
|
|
4
5
|
className?: string;
|
|
5
6
|
/** @deprecated */
|
|
6
7
|
light?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Specify if the `Tile` component should be rendered with rounded corners. Only valid
|
|
10
|
+
* when `slug` prop is present
|
|
11
|
+
*/
|
|
12
|
+
hasRoundedCorners?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Provide a `Slug` component to be rendered inside the `SelectableTile` component
|
|
15
|
+
*/
|
|
16
|
+
slug?: ReactNodeLike;
|
|
7
17
|
}
|
|
8
18
|
export declare const Tile: React.ForwardRefExoticComponent<TileProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
19
|
export interface ClickableTileProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
@@ -19,6 +29,11 @@ export interface ClickableTileProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
|
19
29
|
* Specify whether the ClickableTile should be disabled
|
|
20
30
|
*/
|
|
21
31
|
disabled?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Specify if the `ClickableTile` component should be rendered with rounded corners.
|
|
34
|
+
* Only valid when `slug` prop is present
|
|
35
|
+
*/
|
|
36
|
+
hasRoundedCorners?: boolean;
|
|
22
37
|
/**
|
|
23
38
|
* The href for the link.
|
|
24
39
|
*/
|
|
@@ -41,6 +56,10 @@ export interface ClickableTileProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
|
41
56
|
* The rel property for the link.
|
|
42
57
|
*/
|
|
43
58
|
rel?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Specify if a `Slug` icon should be rendered inside the `ClickableTile`
|
|
61
|
+
*/
|
|
62
|
+
slug?: boolean;
|
|
44
63
|
}
|
|
45
64
|
export declare const ClickableTile: React.ForwardRefExoticComponent<ClickableTileProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
46
65
|
export interface SelectableTileProps extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -52,6 +71,11 @@ export interface SelectableTileProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
52
71
|
* Specify whether the SelectableTile should be disabled
|
|
53
72
|
*/
|
|
54
73
|
disabled?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Specify if the `SelectableTile` component should be rendered with rounded corners.
|
|
76
|
+
* Only valid when `slug` prop is present
|
|
77
|
+
*/
|
|
78
|
+
hasRoundedCorners?: boolean;
|
|
55
79
|
/**
|
|
56
80
|
* The ID of the `<input>`.
|
|
57
81
|
*/
|
|
@@ -77,6 +101,10 @@ export interface SelectableTileProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
77
101
|
* `true` to select this tile.
|
|
78
102
|
*/
|
|
79
103
|
selected?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Provide a `Slug` component to be rendered inside the `SelectableTile` component
|
|
106
|
+
*/
|
|
107
|
+
slug?: ReactNodeLike;
|
|
80
108
|
/**
|
|
81
109
|
* Specify the tab index of the wrapper element
|
|
82
110
|
*/
|
|
@@ -101,6 +129,11 @@ export interface ExpandableTileProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
101
129
|
* `true` if the tile is expanded.
|
|
102
130
|
*/
|
|
103
131
|
expanded?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Specify if the `ExpandableTile` component should be rendered with rounded corners.
|
|
134
|
+
* Only valid when `slug` prop is present
|
|
135
|
+
*/
|
|
136
|
+
hasRoundedCorners?: boolean;
|
|
104
137
|
/**
|
|
105
138
|
* An ID that can be provided to aria-labelledby
|
|
106
139
|
*/
|
|
@@ -113,6 +146,10 @@ export interface ExpandableTileProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
113
146
|
* optional handler to trigger a function when a key is pressed
|
|
114
147
|
*/
|
|
115
148
|
onKeyUp?(event: KeyboardEvent): void;
|
|
149
|
+
/**
|
|
150
|
+
* Provide a `Slug` component to be rendered inside the `ExpandableTile` component
|
|
151
|
+
*/
|
|
152
|
+
slug?: ReactNodeLike;
|
|
116
153
|
/**
|
|
117
154
|
* The `tabindex` attribute.
|
|
118
155
|
*/
|