carbon-react 111.13.2 → 111.14.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/esm/components/button-toggle-group/button-toggle-group.component.d.ts +3 -1
- package/esm/components/button-toggle-group/button-toggle-group.component.js +4 -1
- package/esm/components/button-toggle-group/button-toggle-group.style.d.ts +1 -1
- package/esm/components/button-toggle-group/button-toggle-group.style.js +12 -1
- package/lib/components/button-toggle-group/button-toggle-group.component.d.ts +3 -1
- package/lib/components/button-toggle-group/button-toggle-group.component.js +4 -1
- package/lib/components/button-toggle-group/button-toggle-group.style.d.ts +1 -1
- package/lib/components/button-toggle-group/button-toggle-group.style.js +11 -0
- package/package.json +1 -1
|
@@ -27,6 +27,8 @@ export interface ButtonToggleGroupProps extends ValidationProps, MarginProps, Ta
|
|
|
27
27
|
labelInline?: boolean;
|
|
28
28
|
/** The percentage width of the label. */
|
|
29
29
|
labelWidth?: number;
|
|
30
|
+
/** If true all ButtonToggle children will flex to the full width of the ButtonToggleGroup parent */
|
|
31
|
+
fullWidth?: boolean;
|
|
30
32
|
/** The alignment for the text in the label. */
|
|
31
33
|
labelAlign?: "left" | "right";
|
|
32
34
|
/** Callback triggered by blur event on the input. */
|
|
@@ -39,7 +41,7 @@ export interface ButtonToggleGroupProps extends ValidationProps, MarginProps, Ta
|
|
|
39
41
|
helpAriaLabel?: string;
|
|
40
42
|
}
|
|
41
43
|
declare const ButtonToggleGroup: {
|
|
42
|
-
({ children, name, error, warning, info, validationOnLabel, label, labelHelp, labelSpacing, inputWidth, fieldHelp, fieldHelpInline, labelInline, labelWidth, labelAlign, onChange, onBlur, value, "data-component": dataComponent, "data-element": dataElement, "data-role": dataRole, helpAriaLabel, id, ...props }: ButtonToggleGroupProps): JSX.Element;
|
|
44
|
+
({ children, name, error, warning, info, validationOnLabel, label, labelHelp, labelSpacing, inputWidth, fullWidth, fieldHelp, fieldHelpInline, labelInline, labelWidth, labelAlign, onChange, onBlur, value, "data-component": dataComponent, "data-element": dataElement, "data-role": dataRole, helpAriaLabel, id, ...props }: ButtonToggleGroupProps): JSX.Element;
|
|
43
45
|
displayName: string;
|
|
44
46
|
};
|
|
45
47
|
export default ButtonToggleGroup;
|
|
@@ -23,6 +23,7 @@ const ButtonToggleGroup = ({
|
|
|
23
23
|
labelHelp,
|
|
24
24
|
labelSpacing,
|
|
25
25
|
inputWidth,
|
|
26
|
+
fullWidth,
|
|
26
27
|
fieldHelp,
|
|
27
28
|
fieldHelpInline,
|
|
28
29
|
labelInline,
|
|
@@ -69,7 +70,8 @@ const ButtonToggleGroup = ({
|
|
|
69
70
|
}, validationProps, filterStyledSystemMarginProps(props)), /*#__PURE__*/React.createElement(StyledButtonToggleGroup, _extends({
|
|
70
71
|
"aria-label": label,
|
|
71
72
|
role: "radiogroup",
|
|
72
|
-
inputWidth: inputWidth
|
|
73
|
+
inputWidth: inputWidth,
|
|
74
|
+
fullWidth: fullWidth
|
|
73
75
|
}, validationProps), /*#__PURE__*/React.createElement(RadioButtonMapper, {
|
|
74
76
|
name: name,
|
|
75
77
|
onBlur: onBlur,
|
|
@@ -88,6 +90,7 @@ ButtonToggleGroup.propTypes = {
|
|
|
88
90
|
"error": PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
89
91
|
"fieldHelp": PropTypes.string,
|
|
90
92
|
"fieldHelpInline": PropTypes.bool,
|
|
93
|
+
"fullWidth": PropTypes.bool,
|
|
91
94
|
"helpAriaLabel": PropTypes.string,
|
|
92
95
|
"id": PropTypes.string.isRequired,
|
|
93
96
|
"info": PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ButtonToggleGroupProps } from ".";
|
|
2
2
|
import { ValidationProps } from "../../__internal__/validations";
|
|
3
|
-
declare const StyledButtonToggleGroup: import("styled-components").StyledComponent<"div", any, ValidationProps & Pick<ButtonToggleGroupProps, "inputWidth">, never>;
|
|
3
|
+
declare const StyledButtonToggleGroup: import("styled-components").StyledComponent<"div", any, ValidationProps & Pick<ButtonToggleGroupProps, "inputWidth" | "fullWidth">, never>;
|
|
4
4
|
export default StyledButtonToggleGroup;
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
|
-
import { StyledButtonToggleLabel } from "../button-toggle/button-toggle.style";
|
|
2
|
+
import { StyledButtonToggleLabel, StyledButtonToggle } from "../button-toggle/button-toggle.style";
|
|
3
3
|
import ValidationIconStyle from "../../__internal__/validations/validation-icon.style";
|
|
4
4
|
const StyledButtonToggleGroup = styled.div`
|
|
5
5
|
display: flex;
|
|
6
6
|
|
|
7
|
+
${({
|
|
8
|
+
fullWidth
|
|
9
|
+
}) => fullWidth && css`
|
|
10
|
+
${StyledButtonToggleLabel} {
|
|
11
|
+
width: 100%;
|
|
12
|
+
}
|
|
13
|
+
${StyledButtonToggle} {
|
|
14
|
+
flex: auto;
|
|
15
|
+
}
|
|
16
|
+
`};
|
|
17
|
+
|
|
7
18
|
${({
|
|
8
19
|
inputWidth
|
|
9
20
|
}) => inputWidth && css`
|
|
@@ -27,6 +27,8 @@ export interface ButtonToggleGroupProps extends ValidationProps, MarginProps, Ta
|
|
|
27
27
|
labelInline?: boolean;
|
|
28
28
|
/** The percentage width of the label. */
|
|
29
29
|
labelWidth?: number;
|
|
30
|
+
/** If true all ButtonToggle children will flex to the full width of the ButtonToggleGroup parent */
|
|
31
|
+
fullWidth?: boolean;
|
|
30
32
|
/** The alignment for the text in the label. */
|
|
31
33
|
labelAlign?: "left" | "right";
|
|
32
34
|
/** Callback triggered by blur event on the input. */
|
|
@@ -39,7 +41,7 @@ export interface ButtonToggleGroupProps extends ValidationProps, MarginProps, Ta
|
|
|
39
41
|
helpAriaLabel?: string;
|
|
40
42
|
}
|
|
41
43
|
declare const ButtonToggleGroup: {
|
|
42
|
-
({ children, name, error, warning, info, validationOnLabel, label, labelHelp, labelSpacing, inputWidth, fieldHelp, fieldHelpInline, labelInline, labelWidth, labelAlign, onChange, onBlur, value, "data-component": dataComponent, "data-element": dataElement, "data-role": dataRole, helpAriaLabel, id, ...props }: ButtonToggleGroupProps): JSX.Element;
|
|
44
|
+
({ children, name, error, warning, info, validationOnLabel, label, labelHelp, labelSpacing, inputWidth, fullWidth, fieldHelp, fieldHelpInline, labelInline, labelWidth, labelAlign, onChange, onBlur, value, "data-component": dataComponent, "data-element": dataElement, "data-role": dataRole, helpAriaLabel, id, ...props }: ButtonToggleGroupProps): JSX.Element;
|
|
43
45
|
displayName: string;
|
|
44
46
|
};
|
|
45
47
|
export default ButtonToggleGroup;
|
|
@@ -46,6 +46,7 @@ const ButtonToggleGroup = ({
|
|
|
46
46
|
labelHelp,
|
|
47
47
|
labelSpacing,
|
|
48
48
|
inputWidth,
|
|
49
|
+
fullWidth,
|
|
49
50
|
fieldHelp,
|
|
50
51
|
fieldHelpInline,
|
|
51
52
|
labelInline,
|
|
@@ -93,7 +94,8 @@ const ButtonToggleGroup = ({
|
|
|
93
94
|
}, validationProps, (0, _utils.filterStyledSystemMarginProps)(props)), /*#__PURE__*/_react.default.createElement(_buttonToggleGroup.default, _extends({
|
|
94
95
|
"aria-label": label,
|
|
95
96
|
role: "radiogroup",
|
|
96
|
-
inputWidth: inputWidth
|
|
97
|
+
inputWidth: inputWidth,
|
|
98
|
+
fullWidth: fullWidth
|
|
97
99
|
}, validationProps), /*#__PURE__*/_react.default.createElement(_radioButtonMapper.default, {
|
|
98
100
|
name: name,
|
|
99
101
|
onBlur: onBlur,
|
|
@@ -112,6 +114,7 @@ ButtonToggleGroup.propTypes = {
|
|
|
112
114
|
"error": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
113
115
|
"fieldHelp": _propTypes.default.string,
|
|
114
116
|
"fieldHelpInline": _propTypes.default.bool,
|
|
117
|
+
"fullWidth": _propTypes.default.bool,
|
|
115
118
|
"helpAriaLabel": _propTypes.default.string,
|
|
116
119
|
"id": _propTypes.default.string.isRequired,
|
|
117
120
|
"info": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ButtonToggleGroupProps } from ".";
|
|
2
2
|
import { ValidationProps } from "../../__internal__/validations";
|
|
3
|
-
declare const StyledButtonToggleGroup: import("styled-components").StyledComponent<"div", any, ValidationProps & Pick<ButtonToggleGroupProps, "inputWidth">, never>;
|
|
3
|
+
declare const StyledButtonToggleGroup: import("styled-components").StyledComponent<"div", any, ValidationProps & Pick<ButtonToggleGroupProps, "inputWidth" | "fullWidth">, never>;
|
|
4
4
|
export default StyledButtonToggleGroup;
|
|
@@ -20,6 +20,17 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
20
20
|
const StyledButtonToggleGroup = _styledComponents.default.div`
|
|
21
21
|
display: flex;
|
|
22
22
|
|
|
23
|
+
${({
|
|
24
|
+
fullWidth
|
|
25
|
+
}) => fullWidth && (0, _styledComponents.css)`
|
|
26
|
+
${_buttonToggle.StyledButtonToggleLabel} {
|
|
27
|
+
width: 100%;
|
|
28
|
+
}
|
|
29
|
+
${_buttonToggle.StyledButtonToggle} {
|
|
30
|
+
flex: auto;
|
|
31
|
+
}
|
|
32
|
+
`};
|
|
33
|
+
|
|
23
34
|
${({
|
|
24
35
|
inputWidth
|
|
25
36
|
}) => inputWidth && (0, _styledComponents.css)`
|