@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,7 +47,7 @@ interface AccordionItemProps {
|
|
|
47
47
|
* The callback function to run on the `onAnimationEnd`
|
|
48
48
|
* event for the list item.
|
|
49
49
|
*/
|
|
50
|
-
handleAnimationEnd?: AnimationEventHandler<
|
|
50
|
+
handleAnimationEnd?: AnimationEventHandler<HTMLElement>;
|
|
51
51
|
}
|
|
52
52
|
interface AccordionToggleProps {
|
|
53
53
|
'aria-controls'?: AriaAttributes['aria-controls'];
|
|
@@ -9,7 +9,7 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import { ChevronRight } from '@carbon/icons-react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
|
-
import React__default, { useState, useContext } from 'react';
|
|
12
|
+
import React__default, { useState, useContext, useRef } from 'react';
|
|
13
13
|
import '../Text/index.js';
|
|
14
14
|
import { useId } from '../../internal/useId.js';
|
|
15
15
|
import deprecate from '../../prop-types/deprecate.js';
|
|
@@ -37,8 +37,6 @@ function AccordionItem(_ref) {
|
|
|
37
37
|
...rest
|
|
38
38
|
} = _ref;
|
|
39
39
|
const [isOpen, setIsOpen] = useState(open);
|
|
40
|
-
const [prevIsOpen, setPrevIsOpen] = useState(open);
|
|
41
|
-
const [animation, setAnimation] = useState('');
|
|
42
40
|
const accordionState = useContext(AccordionContext);
|
|
43
41
|
const disabledIsControlled = typeof controlledDisabled === 'boolean';
|
|
44
42
|
const disabled = disabledIsControlled ? controlledDisabled : accordionState.disabled;
|
|
@@ -47,23 +45,28 @@ function AccordionItem(_ref) {
|
|
|
47
45
|
const className = cx({
|
|
48
46
|
[`${prefix}--accordion__item`]: true,
|
|
49
47
|
[`${prefix}--accordion__item--active`]: isOpen,
|
|
50
|
-
[`${prefix}--accordion__item--${animation}`]: animation,
|
|
51
48
|
[`${prefix}--accordion__item--disabled`]: disabled,
|
|
52
49
|
[customClassName]: !!customClassName
|
|
53
50
|
});
|
|
54
51
|
const Toggle = renderToggle || renderExpando; // remove renderExpando in next major release
|
|
55
52
|
|
|
56
|
-
|
|
57
|
-
setAnimation(isOpen ? 'collapsing' : 'expanding');
|
|
58
|
-
setIsOpen(open);
|
|
59
|
-
setPrevIsOpen(open);
|
|
60
|
-
}
|
|
53
|
+
const content = useRef(null);
|
|
61
54
|
|
|
62
55
|
// When the AccordionItem heading is clicked, toggle the open state of the
|
|
63
56
|
// panel
|
|
64
57
|
function onClick(event) {
|
|
58
|
+
// type guard for ref
|
|
59
|
+
if (!content.current) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (isOpen) {
|
|
63
|
+
// accordion closes
|
|
64
|
+
content.current.style.maxBlockSize = '';
|
|
65
|
+
} else {
|
|
66
|
+
// accordion opens
|
|
67
|
+
content.current.style.maxBlockSize = content.current.scrollHeight + 15 + 'px';
|
|
68
|
+
}
|
|
65
69
|
const nextValue = !isOpen;
|
|
66
|
-
setAnimation(isOpen ? 'collapsing' : 'expanding');
|
|
67
70
|
setIsOpen(nextValue);
|
|
68
71
|
if (onHeadingClick) {
|
|
69
72
|
// TODO: normalize signature, potentially:
|
|
@@ -85,13 +88,10 @@ function AccordionItem(_ref) {
|
|
|
85
88
|
if (handleAnimationEnd) {
|
|
86
89
|
handleAnimationEnd(event);
|
|
87
90
|
}
|
|
88
|
-
setAnimation('');
|
|
89
91
|
}
|
|
90
92
|
return /*#__PURE__*/React__default.createElement("li", _extends({
|
|
91
93
|
className: className
|
|
92
|
-
}, rest, {
|
|
93
|
-
onAnimationEnd: onAnimationEnd
|
|
94
|
-
}), /*#__PURE__*/React__default.createElement(Toggle, {
|
|
94
|
+
}, rest), /*#__PURE__*/React__default.createElement(Toggle, {
|
|
95
95
|
disabled: disabled,
|
|
96
96
|
"aria-controls": id,
|
|
97
97
|
"aria-expanded": isOpen,
|
|
@@ -105,9 +105,13 @@ function AccordionItem(_ref) {
|
|
|
105
105
|
as: "div",
|
|
106
106
|
className: `${prefix}--accordion__title`
|
|
107
107
|
}, title)), /*#__PURE__*/React__default.createElement("div", {
|
|
108
|
+
ref: content,
|
|
109
|
+
className: `${prefix}--accordion__wrapper`,
|
|
110
|
+
onTransitionEnd: onAnimationEnd
|
|
111
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
108
112
|
id: id,
|
|
109
113
|
className: `${prefix}--accordion__content`
|
|
110
|
-
}, children));
|
|
114
|
+
}, children)));
|
|
111
115
|
}
|
|
112
116
|
AccordionItem.propTypes = {
|
|
113
117
|
/**
|
|
@@ -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
|
*/
|
|
@@ -33,6 +33,7 @@ const Checkbox = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
33
33
|
title = '',
|
|
34
34
|
warn,
|
|
35
35
|
warnText,
|
|
36
|
+
slug,
|
|
36
37
|
...other
|
|
37
38
|
} = _ref;
|
|
38
39
|
const prefix = usePrefix();
|
|
@@ -47,11 +48,19 @@ const Checkbox = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
47
48
|
const wrapperClasses = cx(`${prefix}--form-item`, `${prefix}--checkbox-wrapper`, className, {
|
|
48
49
|
[`${prefix}--checkbox-wrapper--readonly`]: readOnly,
|
|
49
50
|
[`${prefix}--checkbox-wrapper--invalid`]: !readOnly && invalid,
|
|
50
|
-
[`${prefix}--checkbox-wrapper--warning`]: showWarning
|
|
51
|
+
[`${prefix}--checkbox-wrapper--warning`]: showWarning,
|
|
52
|
+
[`${prefix}--checkbox-wrapper--slug`]: slug
|
|
51
53
|
});
|
|
52
54
|
const innerLabelClasses = cx(`${prefix}--checkbox-label-text`, {
|
|
53
55
|
[`${prefix}--visually-hidden`]: hideLabel
|
|
54
56
|
});
|
|
57
|
+
let normalizedSlug;
|
|
58
|
+
if (slug && /*#__PURE__*/React__default.isValidElement(slug)) {
|
|
59
|
+
const size = slug.props?.['kind'] === 'inline' ? 'md' : 'mini';
|
|
60
|
+
normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
|
|
61
|
+
size
|
|
62
|
+
});
|
|
63
|
+
}
|
|
55
64
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
56
65
|
className: wrapperClasses
|
|
57
66
|
}, /*#__PURE__*/React__default.createElement("input", _extends({}, other, {
|
|
@@ -97,7 +106,7 @@ const Checkbox = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
97
106
|
title: title
|
|
98
107
|
}, /*#__PURE__*/React__default.createElement(Text, {
|
|
99
108
|
className: innerLabelClasses
|
|
100
|
-
}, labelText)), /*#__PURE__*/React__default.createElement("div", {
|
|
109
|
+
}, labelText, normalizedSlug)), /*#__PURE__*/React__default.createElement("div", {
|
|
101
110
|
className: `${prefix}--checkbox__validation-msg`
|
|
102
111
|
}, !readOnly && invalid && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(WarningFilled, {
|
|
103
112
|
className: `${prefix}--checkbox__invalid-icon`
|
|
@@ -165,6 +174,10 @@ Checkbox.propTypes = {
|
|
|
165
174
|
* Specify whether the Checkbox is read-only
|
|
166
175
|
*/
|
|
167
176
|
readOnly: PropTypes.bool,
|
|
177
|
+
/**
|
|
178
|
+
* Provide a `Slug` component to be rendered inside the `Checkbox` component
|
|
179
|
+
*/
|
|
180
|
+
slug: PropTypes.node,
|
|
168
181
|
/**
|
|
169
182
|
* Specify a title for the <label> node for the Checkbox
|
|
170
183
|
*/
|
|
@@ -26,6 +26,7 @@ function CheckboxGroup(_ref) {
|
|
|
26
26
|
readOnly,
|
|
27
27
|
warn,
|
|
28
28
|
warnText,
|
|
29
|
+
slug,
|
|
29
30
|
...rest
|
|
30
31
|
} = _ref;
|
|
31
32
|
const prefix = usePrefix();
|
|
@@ -40,8 +41,18 @@ function CheckboxGroup(_ref) {
|
|
|
40
41
|
const fieldsetClasses = cx(`${prefix}--checkbox-group`, className, {
|
|
41
42
|
[`${prefix}--checkbox-group--readonly`]: readOnly,
|
|
42
43
|
[`${prefix}--checkbox-group--invalid`]: !readOnly && invalid,
|
|
43
|
-
[`${prefix}--checkbox-group--warning`]: showWarning
|
|
44
|
+
[`${prefix}--checkbox-group--warning`]: showWarning,
|
|
45
|
+
[`${prefix}--checkbox-group--slug`]: slug
|
|
44
46
|
});
|
|
47
|
+
|
|
48
|
+
// Slug is always size `mini`
|
|
49
|
+
let normalizedSlug;
|
|
50
|
+
if (slug) {
|
|
51
|
+
normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
|
|
52
|
+
size: 'mini',
|
|
53
|
+
kind: 'default'
|
|
54
|
+
});
|
|
55
|
+
}
|
|
45
56
|
return /*#__PURE__*/React__default.createElement("fieldset", _extends({
|
|
46
57
|
className: fieldsetClasses,
|
|
47
58
|
"data-invalid": invalid ? true : undefined,
|
|
@@ -51,7 +62,7 @@ function CheckboxGroup(_ref) {
|
|
|
51
62
|
}, rest), /*#__PURE__*/React__default.createElement("legend", {
|
|
52
63
|
className: `${prefix}--label`,
|
|
53
64
|
id: legendId || rest['aria-labelledby']
|
|
54
|
-
}, legendText), children, /*#__PURE__*/React__default.createElement("div", {
|
|
65
|
+
}, legendText, normalizedSlug), children, /*#__PURE__*/React__default.createElement("div", {
|
|
55
66
|
className: `${prefix}--checkbox-group__validation-msg`
|
|
56
67
|
}, !readOnly && invalid && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(WarningFilled, {
|
|
57
68
|
className: `${prefix}--checkbox__invalid-icon`
|
|
@@ -97,6 +108,10 @@ CheckboxGroup.propTypes = {
|
|
|
97
108
|
* Whether the CheckboxGroup should be read-only
|
|
98
109
|
*/
|
|
99
110
|
readOnly: PropTypes.bool,
|
|
111
|
+
/**
|
|
112
|
+
* Provide a `Slug` component to be rendered inside the `CheckboxGroup` component
|
|
113
|
+
*/
|
|
114
|
+
slug: PropTypes.node,
|
|
100
115
|
/**
|
|
101
116
|
* Specify whether the form group is currently in warning state
|
|
102
117
|
*/
|
|
@@ -33,7 +33,7 @@ const compare = function (a, b) {
|
|
|
33
33
|
|
|
34
34
|
// if column has React elements, this should sort by the child string if there is one
|
|
35
35
|
if (typeof a === 'object' && typeof b === 'object') {
|
|
36
|
-
if (typeof a.props
|
|
36
|
+
if (typeof a.props?.children === 'string' && typeof b.props?.children === 'string') {
|
|
37
37
|
return compareStrings(a.props.children, b.props.children, locale);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -106,11 +106,12 @@ class FileUploader extends React__default.Component {
|
|
|
106
106
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
107
107
|
className: classes
|
|
108
108
|
}, other), !labelTitle ? null : /*#__PURE__*/React__default.createElement(Text, {
|
|
109
|
-
as: "
|
|
109
|
+
as: "h3",
|
|
110
110
|
className: getHelperLabelClasses(`${prefix}--file--label`)
|
|
111
111
|
}, labelTitle), /*#__PURE__*/React__default.createElement(Text, {
|
|
112
112
|
as: "p",
|
|
113
|
-
className: getHelperLabelClasses(`${prefix}--label-description`)
|
|
113
|
+
className: getHelperLabelClasses(`${prefix}--label-description`),
|
|
114
|
+
id: "description"
|
|
114
115
|
}, labelDescription), /*#__PURE__*/React__default.createElement(FileUploaderButton, {
|
|
115
116
|
innerRef: this.uploaderButton,
|
|
116
117
|
disabled: disabled,
|
|
@@ -121,7 +122,8 @@ class FileUploader extends React__default.Component {
|
|
|
121
122
|
disableLabelChanges: true,
|
|
122
123
|
accept: accept,
|
|
123
124
|
name: name,
|
|
124
|
-
size: size
|
|
125
|
+
size: size,
|
|
126
|
+
"aria-describedby": "description"
|
|
125
127
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
126
128
|
className: `${prefix}--file-container`
|
|
127
129
|
}, this.state.filenames.length === 0 ? null : this.state.filenames.map((name, index) => /*#__PURE__*/React__default.createElement("span", _extends({
|
|
@@ -102,6 +102,11 @@ Column.propTypes = {
|
|
|
102
102
|
* @see https://www.carbondesignsystem.com/guidelines/layout#breakpoints
|
|
103
103
|
*/
|
|
104
104
|
sm: spanPropType,
|
|
105
|
+
/**
|
|
106
|
+
* Specify constant column span, start, or end values that will not change
|
|
107
|
+
* based on breakpoint
|
|
108
|
+
*/
|
|
109
|
+
span: PropTypes.oneOfType([PropTypes.number, percentSpanType]),
|
|
105
110
|
/**
|
|
106
111
|
* Specify column span for the `xlg` breakpoint (Default breakpoint up to
|
|
107
112
|
* 1584px) This breakpoint supports 16 columns by default.
|
|
@@ -311,8 +316,13 @@ function getClassNameForFlexGridBreakpoints(breakpoints, prefix) {
|
|
|
311
316
|
*/
|
|
312
317
|
function getClassNameForSpan(value, prefix) {
|
|
313
318
|
const classNames = [];
|
|
314
|
-
if (typeof value === 'number'
|
|
319
|
+
if (typeof value === 'number') {
|
|
315
320
|
classNames.push(`${prefix}--col-span-${value}`);
|
|
321
|
+
}
|
|
322
|
+
// If value is a string, the user has specified a percent
|
|
323
|
+
// they'd like this column to span.
|
|
324
|
+
else if (typeof value === 'string') {
|
|
325
|
+
classNames.push(`${prefix}--col-span-${value.slice(0, -1)}`);
|
|
316
326
|
} else if (typeof value === 'object') {
|
|
317
327
|
const {
|
|
318
328
|
span,
|
|
@@ -29,6 +29,7 @@ const MenuButton = /*#__PURE__*/React__default.forwardRef(function MenuButton(_r
|
|
|
29
29
|
kind = defaultButtonKind,
|
|
30
30
|
label,
|
|
31
31
|
size = 'lg',
|
|
32
|
+
tabIndex = 0,
|
|
32
33
|
...rest
|
|
33
34
|
} = _ref;
|
|
34
35
|
const id = useId('MenuButton');
|
|
@@ -69,6 +70,7 @@ const MenuButton = /*#__PURE__*/React__default.forwardRef(function MenuButton(_r
|
|
|
69
70
|
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
70
71
|
className: triggerClasses,
|
|
71
72
|
size: size,
|
|
73
|
+
tabIndex: tabIndex,
|
|
72
74
|
kind: buttonKind,
|
|
73
75
|
renderIcon: ChevronDown,
|
|
74
76
|
disabled: disabled,
|
|
@@ -114,7 +116,11 @@ MenuButton.propTypes = {
|
|
|
114
116
|
/**
|
|
115
117
|
* Specify the size of the button and menu.
|
|
116
118
|
*/
|
|
117
|
-
size: PropTypes.oneOf(['sm', 'md', 'lg'])
|
|
119
|
+
size: PropTypes.oneOf(['sm', 'md', 'lg']),
|
|
120
|
+
/**
|
|
121
|
+
* Specify the tabIndex of the button.
|
|
122
|
+
*/
|
|
123
|
+
tabIndex: PropTypes.number
|
|
118
124
|
};
|
|
119
125
|
|
|
120
126
|
export { 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
|
*/
|
|
@@ -26,6 +26,7 @@ const RadioButton = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
26
26
|
name,
|
|
27
27
|
onChange = () => {},
|
|
28
28
|
value = '',
|
|
29
|
+
slug,
|
|
29
30
|
...rest
|
|
30
31
|
} = props;
|
|
31
32
|
const prefix = usePrefix();
|
|
@@ -38,9 +39,17 @@ const RadioButton = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
38
39
|
[`${prefix}--visually-hidden`]: hideLabel
|
|
39
40
|
});
|
|
40
41
|
const wrapperClasses = cx(className, `${prefix}--radio-button-wrapper`, {
|
|
41
|
-
[`${prefix}--radio-button-wrapper--label-${labelPosition}`]: labelPosition !== 'right'
|
|
42
|
+
[`${prefix}--radio-button-wrapper--label-${labelPosition}`]: labelPosition !== 'right',
|
|
43
|
+
[`${prefix}--radio-button-wrapper--slug`]: slug
|
|
42
44
|
});
|
|
43
45
|
const inputRef = useRef(null);
|
|
46
|
+
let normalizedSlug;
|
|
47
|
+
if (slug && /*#__PURE__*/React__default.isValidElement(slug)) {
|
|
48
|
+
const size = slug.props?.['kind'] === 'inline' ? 'md' : 'mini';
|
|
49
|
+
normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
|
|
50
|
+
size
|
|
51
|
+
});
|
|
52
|
+
}
|
|
44
53
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
45
54
|
className: wrapperClasses
|
|
46
55
|
}, /*#__PURE__*/React__default.createElement("input", _extends({}, rest, {
|
|
@@ -59,7 +68,7 @@ const RadioButton = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
59
68
|
className: `${prefix}--radio-button__appearance`
|
|
60
69
|
}), labelText && /*#__PURE__*/React__default.createElement(Text, {
|
|
61
70
|
className: innerLabelClasses
|
|
62
|
-
}, labelText)));
|
|
71
|
+
}, labelText, normalizedSlug)));
|
|
63
72
|
});
|
|
64
73
|
RadioButton.displayName = 'RadioButton';
|
|
65
74
|
RadioButton.propTypes = {
|
|
@@ -110,6 +119,10 @@ RadioButton.propTypes = {
|
|
|
110
119
|
* Provide a handler that is invoked when a user clicks on the control
|
|
111
120
|
*/
|
|
112
121
|
onClick: PropTypes.func,
|
|
122
|
+
/**
|
|
123
|
+
* Provide a `Slug` component to be rendered inside the `RadioButton` component
|
|
124
|
+
*/
|
|
125
|
+
slug: PropTypes.node,
|
|
113
126
|
/**
|
|
114
127
|
* Specify the value of the `<RadioButton>`
|
|
115
128
|
*/
|
|
@@ -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
|
*/
|
|
@@ -34,6 +34,7 @@ const RadioButtonGroup = /*#__PURE__*/React__default.forwardRef((props, ref) =>
|
|
|
34
34
|
valueSelected,
|
|
35
35
|
warn = false,
|
|
36
36
|
warnText,
|
|
37
|
+
slug,
|
|
37
38
|
...rest
|
|
38
39
|
} = props;
|
|
39
40
|
const prefix = usePrefix();
|
|
@@ -88,7 +89,8 @@ const RadioButtonGroup = /*#__PURE__*/React__default.forwardRef((props, ref) =>
|
|
|
88
89
|
[`${prefix}--radio-button-group--label-${labelPosition}`]: labelPosition,
|
|
89
90
|
[`${prefix}--radio-button-group--readonly`]: readOnly,
|
|
90
91
|
[`${prefix}--radio-button-group--invalid`]: !readOnly && invalid,
|
|
91
|
-
[`${prefix}--radio-button-group--warning`]: showWarning
|
|
92
|
+
[`${prefix}--radio-button-group--warning`]: showWarning,
|
|
93
|
+
[`${prefix}--radio-button-group--slug`]: slug
|
|
92
94
|
});
|
|
93
95
|
const helperClasses = cx(`${prefix}--form__helper-text`, {
|
|
94
96
|
[`${prefix}--form__helper-text--disabled`]: disabled
|
|
@@ -99,6 +101,15 @@ const RadioButtonGroup = /*#__PURE__*/React__default.forwardRef((props, ref) =>
|
|
|
99
101
|
className: helperClasses
|
|
100
102
|
}, helperText) : null;
|
|
101
103
|
const divRef = useRef(null);
|
|
104
|
+
|
|
105
|
+
// Slug is always size `mini`
|
|
106
|
+
let normalizedSlug;
|
|
107
|
+
if (slug) {
|
|
108
|
+
normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
|
|
109
|
+
size: 'mini',
|
|
110
|
+
kind: 'default'
|
|
111
|
+
});
|
|
112
|
+
}
|
|
102
113
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
103
114
|
className: wrapperClasses,
|
|
104
115
|
ref: mergeRefs(divRef, ref)
|
|
@@ -109,7 +120,7 @@ const RadioButtonGroup = /*#__PURE__*/React__default.forwardRef((props, ref) =>
|
|
|
109
120
|
"aria-describedby": showHelper && helperText ? helperId : undefined
|
|
110
121
|
}, rest), legendText && /*#__PURE__*/React__default.createElement(Legend, {
|
|
111
122
|
className: `${prefix}--label`
|
|
112
|
-
}, legendText), getRadioButtons()), /*#__PURE__*/React__default.createElement("div", {
|
|
123
|
+
}, legendText, normalizedSlug), getRadioButtons()), /*#__PURE__*/React__default.createElement("div", {
|
|
113
124
|
className: `${prefix}--radio-button__validation-msg`
|
|
114
125
|
}, !readOnly && invalid && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(WarningFilled, {
|
|
115
126
|
className: `${prefix}--radio-button__invalid-icon`
|
|
@@ -176,6 +187,10 @@ RadioButtonGroup.propTypes = {
|
|
|
176
187
|
* Whether the RadioButtonGroup should be read-only
|
|
177
188
|
*/
|
|
178
189
|
readOnly: PropTypes.bool,
|
|
190
|
+
/**
|
|
191
|
+
* Provide a `Slug` component to be rendered inside the `RadioButtonGroup` component
|
|
192
|
+
*/
|
|
193
|
+
slug: PropTypes.node,
|
|
179
194
|
/**
|
|
180
195
|
* Specify the value that is currently selected in the group
|
|
181
196
|
*/
|
|
@@ -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
|
*/
|