carbon-react 111.12.4 → 111.12.6
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/__internal__/input/input.component.d.ts +6 -0
- package/esm/__internal__/input/input.component.js +3 -0
- package/esm/__internal__/radio-button-mapper/index.d.ts +2 -2
- package/esm/__internal__/radio-button-mapper/radio-button-mapper.component.d.ts +29 -0
- package/esm/__internal__/radio-button-mapper/radio-button-mapper.component.js +20 -26
- package/esm/components/checkbox/checkbox.style.d.ts +1 -1
- package/esm/components/date/date.component.js +3 -1
- package/esm/components/date/date.style.js +18 -1
- package/esm/components/decimal/decimal.component.js +1 -0
- package/esm/components/grouped-character/grouped-character.component.js +1 -0
- package/esm/components/radio-button/index.d.ts +4 -6
- package/esm/components/radio-button/index.js +2 -2
- package/esm/components/radio-button/radio-button-group.component.d.ts +42 -0
- package/esm/components/radio-button/radio-button-group.component.js +181 -67
- package/esm/components/radio-button/radio-button-group.style.d.ts +5 -0
- package/esm/components/radio-button/radio-button-svg.component.d.ts +3 -0
- package/esm/components/radio-button/radio-button-svg.component.js +1 -0
- package/esm/components/radio-button/radio-button.component.d.ts +28 -0
- package/esm/components/radio-button/radio-button.component.js +529 -107
- package/esm/components/radio-button/radio-button.style.d.ts +5 -0
- package/esm/components/textarea/index.d.ts +2 -1
- package/esm/components/textarea/textarea.component.d.ts +94 -0
- package/esm/components/textarea/textarea.component.js +570 -162
- package/esm/components/textarea/textarea.style.d.ts +8 -2
- package/esm/components/textbox/textbox.component.js +41 -36
- package/esm/components/textbox/textbox.style.js +1 -1
- package/lib/__internal__/input/input.component.d.ts +6 -0
- package/lib/__internal__/input/input.component.js +3 -0
- package/lib/__internal__/radio-button-mapper/index.d.ts +2 -2
- package/lib/__internal__/radio-button-mapper/radio-button-mapper.component.d.ts +29 -0
- package/lib/__internal__/radio-button-mapper/radio-button-mapper.component.js +20 -26
- package/lib/components/checkbox/checkbox.style.d.ts +1 -1
- package/lib/components/date/date.component.js +3 -1
- package/lib/components/date/date.style.js +25 -1
- package/lib/components/decimal/decimal.component.js +1 -0
- package/lib/components/grouped-character/grouped-character.component.js +1 -0
- package/lib/components/radio-button/index.d.ts +4 -6
- package/lib/components/radio-button/index.js +1 -11
- package/lib/components/radio-button/radio-button-group.component.d.ts +42 -0
- package/lib/components/radio-button/radio-button-group.component.js +182 -70
- package/lib/components/radio-button/radio-button-group.style.d.ts +5 -0
- package/lib/components/radio-button/radio-button-svg.component.d.ts +3 -0
- package/lib/components/radio-button/radio-button-svg.component.js +2 -0
- package/lib/components/radio-button/radio-button.component.d.ts +28 -0
- package/lib/components/radio-button/radio-button.component.js +530 -109
- package/lib/components/radio-button/radio-button.style.d.ts +5 -0
- package/lib/components/textarea/index.d.ts +2 -1
- package/lib/components/textarea/textarea.component.d.ts +94 -0
- package/lib/components/textarea/textarea.component.js +574 -166
- package/lib/components/textarea/textarea.style.d.ts +8 -2
- package/lib/components/textbox/textbox.component.js +44 -36
- package/lib/components/textbox/textbox.style.js +1 -1
- package/package.json +1 -1
- package/esm/__internal__/radio-button-mapper/radio-button-mapper.d.ts +0 -20
- package/esm/components/radio-button/radio-button-group.d.ts +0 -42
- package/esm/components/radio-button/radio-button.d.ts +0 -30
- package/esm/components/textarea/textarea.d.ts +0 -81
- package/lib/__internal__/radio-button-mapper/radio-button-mapper.d.ts +0 -20
- package/lib/components/radio-button/radio-button-group.d.ts +0 -42
- package/lib/components/radio-button/radio-button.d.ts +0 -30
- package/lib/components/textarea/textarea.d.ts +0 -81
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
export const MIN_HEIGHT
|
|
1
|
+
export declare const MIN_HEIGHT = 64;
|
|
2
|
+
export interface StyledTextAreaProps {
|
|
3
|
+
/** When true, label is placed in line an input */
|
|
4
|
+
labelInline?: boolean;
|
|
5
|
+
/** When true, adjusts padding for icon */
|
|
6
|
+
hasIcon?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const StyledTextarea: import("styled-components").StyledComponent<"div", any, StyledTextAreaProps, never>;
|
|
2
9
|
export default StyledTextarea;
|
|
3
|
-
declare const StyledTextarea: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -16,6 +16,7 @@ import { ErrorBorder, StyledHintText } from "./textbox.style";
|
|
|
16
16
|
import ValidationMessage from "../../__internal__/validation-message";
|
|
17
17
|
import { NewValidationContext } from "../carbon-provider/carbon-provider.component";
|
|
18
18
|
import NumeralDateContext from "../numeral-date/numeral-date-context";
|
|
19
|
+
import Box from "../box";
|
|
19
20
|
|
|
20
21
|
const Textbox = ({
|
|
21
22
|
align = "left",
|
|
@@ -99,38 +100,7 @@ const Textbox = ({
|
|
|
99
100
|
});
|
|
100
101
|
const labelId = label ? externalLabelId || internalLabelId : "";
|
|
101
102
|
const hasIconInside = !!(inputIcon || validationIconId && !validationOnLabel);
|
|
102
|
-
|
|
103
|
-
helpAriaLabel: helpAriaLabel,
|
|
104
|
-
tooltipPosition: tooltipPosition
|
|
105
|
-
}, /*#__PURE__*/React.createElement(InputBehaviour, null, /*#__PURE__*/React.createElement(FormField, _extends({
|
|
106
|
-
disabled: disabled,
|
|
107
|
-
fieldHelpId: fieldHelpId,
|
|
108
|
-
fieldHelp: computeLabelPropValues(fieldHelp),
|
|
109
|
-
error: error,
|
|
110
|
-
warning: warning,
|
|
111
|
-
info: info,
|
|
112
|
-
label: label,
|
|
113
|
-
labelId: labelId,
|
|
114
|
-
labelAlign: computeLabelPropValues(labelAlign),
|
|
115
|
-
labelHelp: computeLabelPropValues(labelHelp),
|
|
116
|
-
labelInline: computeLabelPropValues(labelInline),
|
|
117
|
-
labelSpacing: labelSpacing,
|
|
118
|
-
labelWidth: computeLabelPropValues(labelWidth),
|
|
119
|
-
id: uniqueId,
|
|
120
|
-
reverse: computeLabelPropValues(reverse),
|
|
121
|
-
isOptional: isOptional,
|
|
122
|
-
useValidationIcon: computeLabelPropValues(validationOnLabel),
|
|
123
|
-
adaptiveLabelBreakpoint: adaptiveLabelBreakpoint,
|
|
124
|
-
isRequired: required,
|
|
125
|
-
"data-component": dataComponent,
|
|
126
|
-
"data-role": dataRole,
|
|
127
|
-
"data-element": dataElement,
|
|
128
|
-
validationIconId: validationRedesignOptIn ? undefined : validationIconId,
|
|
129
|
-
validationRedesignOptIn: validationRedesignOptIn
|
|
130
|
-
}, filterStyledSystemMarginProps(props)), validationRedesignOptIn && labelHelp && /*#__PURE__*/React.createElement(StyledHintText, null, labelHelp), validationRedesignOptIn && /*#__PURE__*/React.createElement(ValidationMessage, {
|
|
131
|
-
error: error,
|
|
132
|
-
warning: warning
|
|
133
|
-
}), /*#__PURE__*/React.createElement(InputPresentation, {
|
|
103
|
+
const input = /*#__PURE__*/React.createElement(InputPresentation, {
|
|
134
104
|
align: align,
|
|
135
105
|
disabled: disabled,
|
|
136
106
|
readOnly: readOnly,
|
|
@@ -143,9 +113,7 @@ const Textbox = ({
|
|
|
143
113
|
hasIcon: hasIconInside
|
|
144
114
|
}, leftChildren, prefix && /*#__PURE__*/React.createElement(StyledPrefix, {
|
|
145
115
|
"data-element": "textbox-prefix"
|
|
146
|
-
}, prefix),
|
|
147
|
-
warning: !!(!error && warning)
|
|
148
|
-
}), /*#__PURE__*/React.createElement(Input, _extends({}, required && {
|
|
116
|
+
}, prefix), /*#__PURE__*/React.createElement(Input, _extends({}, required && {
|
|
149
117
|
required
|
|
150
118
|
}, {
|
|
151
119
|
align: align,
|
|
@@ -182,7 +150,43 @@ const Textbox = ({
|
|
|
182
150
|
useValidationIcon: !(validationRedesignOptIn || validationOnLabel),
|
|
183
151
|
warning: warning,
|
|
184
152
|
validationIconId: validationRedesignOptIn ? undefined : validationIconId
|
|
185
|
-
}))
|
|
153
|
+
}));
|
|
154
|
+
return /*#__PURE__*/React.createElement(TooltipProvider, {
|
|
155
|
+
helpAriaLabel: helpAriaLabel,
|
|
156
|
+
tooltipPosition: tooltipPosition
|
|
157
|
+
}, /*#__PURE__*/React.createElement(InputBehaviour, null, /*#__PURE__*/React.createElement(FormField, _extends({
|
|
158
|
+
disabled: disabled,
|
|
159
|
+
fieldHelpId: fieldHelpId,
|
|
160
|
+
fieldHelp: computeLabelPropValues(fieldHelp),
|
|
161
|
+
error: error,
|
|
162
|
+
warning: warning,
|
|
163
|
+
info: info,
|
|
164
|
+
label: label,
|
|
165
|
+
labelId: labelId,
|
|
166
|
+
labelAlign: computeLabelPropValues(labelAlign),
|
|
167
|
+
labelHelp: computeLabelPropValues(labelHelp),
|
|
168
|
+
labelInline: computeLabelPropValues(labelInline),
|
|
169
|
+
labelSpacing: labelSpacing,
|
|
170
|
+
labelWidth: computeLabelPropValues(labelWidth),
|
|
171
|
+
id: uniqueId,
|
|
172
|
+
reverse: computeLabelPropValues(reverse),
|
|
173
|
+
isOptional: isOptional,
|
|
174
|
+
useValidationIcon: computeLabelPropValues(validationOnLabel),
|
|
175
|
+
adaptiveLabelBreakpoint: adaptiveLabelBreakpoint,
|
|
176
|
+
isRequired: required,
|
|
177
|
+
"data-component": dataComponent,
|
|
178
|
+
"data-role": dataRole,
|
|
179
|
+
"data-element": dataElement,
|
|
180
|
+
validationIconId: validationRedesignOptIn ? undefined : validationIconId,
|
|
181
|
+
validationRedesignOptIn: validationRedesignOptIn
|
|
182
|
+
}, filterStyledSystemMarginProps(props)), validationRedesignOptIn && labelHelp && /*#__PURE__*/React.createElement(StyledHintText, null, labelHelp), validationRedesignOptIn ? /*#__PURE__*/React.createElement(Box, {
|
|
183
|
+
position: "relative"
|
|
184
|
+
}, /*#__PURE__*/React.createElement(ValidationMessage, {
|
|
185
|
+
error: error,
|
|
186
|
+
warning: warning
|
|
187
|
+
}), !disableErrorBorder && (error || warning) && /*#__PURE__*/React.createElement(ErrorBorder, {
|
|
188
|
+
warning: !!(!error && warning)
|
|
189
|
+
}), input) : input), characterCount));
|
|
186
190
|
};
|
|
187
191
|
|
|
188
192
|
Textbox.propTypes = {
|
|
@@ -240,6 +244,7 @@ Textbox.propTypes = {
|
|
|
240
244
|
"aria-valuemin": PropTypes.number,
|
|
241
245
|
"aria-valuenow": PropTypes.number,
|
|
242
246
|
"aria-valuetext": PropTypes.string,
|
|
247
|
+
"as": PropTypes.elementType,
|
|
243
248
|
"autoCapitalize": PropTypes.string,
|
|
244
249
|
"autoComplete": PropTypes.string,
|
|
245
250
|
"autoCorrect": PropTypes.string,
|
|
@@ -6,10 +6,10 @@ const ErrorBorder = styled.span`
|
|
|
6
6
|
position: absolute;
|
|
7
7
|
z-index: 6;
|
|
8
8
|
width: 2px;
|
|
9
|
-
height: calc(100% + var(--spacing300));
|
|
10
9
|
background-color: ${warning ? "var(--colorsSemanticCaution500)" : "var(--colorsSemanticNegative500)"};
|
|
11
10
|
left: -12px;
|
|
12
11
|
bottom: 0px;
|
|
12
|
+
top: 0px;
|
|
13
13
|
`}
|
|
14
14
|
`;
|
|
15
15
|
const StyledHintText = styled.p`
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export interface CommonInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "type"> {
|
|
3
3
|
align?: "right" | "left";
|
|
4
|
+
/** Override the variant component */
|
|
5
|
+
as?: React.ElementType;
|
|
4
6
|
/** If true the Component will be focused when rendered */
|
|
5
7
|
autoFocus?: boolean;
|
|
6
8
|
/** If true, the component will be disabled */
|
|
@@ -29,10 +31,14 @@ export interface CommonInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
29
31
|
required?: boolean;
|
|
30
32
|
}
|
|
31
33
|
export interface InputProps extends CommonInputProps {
|
|
34
|
+
/** The visible width of the text control, in average character widths */
|
|
35
|
+
cols?: number;
|
|
32
36
|
/** Integer to determine a timeout for the defered callback */
|
|
33
37
|
deferTimeout?: number;
|
|
34
38
|
/** Defered callback to be called after the onChange event */
|
|
35
39
|
onChangeDeferred?: (ev: React.ChangeEvent<HTMLInputElement>) => void;
|
|
40
|
+
/** The number of visible text lines for the control */
|
|
41
|
+
rows?: number;
|
|
36
42
|
/** HTML type attribute of the input */
|
|
37
43
|
type?: string;
|
|
38
44
|
}
|
|
@@ -225,6 +225,7 @@ Input.propTypes = {
|
|
|
225
225
|
"aria-valuemin": _propTypes.default.number,
|
|
226
226
|
"aria-valuenow": _propTypes.default.number,
|
|
227
227
|
"aria-valuetext": _propTypes.default.string,
|
|
228
|
+
"as": _propTypes.default.elementType,
|
|
228
229
|
"autoCapitalize": _propTypes.default.string,
|
|
229
230
|
"autoComplete": _propTypes.default.string,
|
|
230
231
|
"autoCorrect": _propTypes.default.string,
|
|
@@ -235,6 +236,7 @@ Input.propTypes = {
|
|
|
235
236
|
"children": _propTypes.default.node,
|
|
236
237
|
"className": _propTypes.default.string,
|
|
237
238
|
"color": _propTypes.default.string,
|
|
239
|
+
"cols": _propTypes.default.number,
|
|
238
240
|
"contentEditable": _propTypes.default.oneOfType([_propTypes.default.oneOf(["false", "inherit", "true"]), _propTypes.default.bool]),
|
|
239
241
|
"contextMenu": _propTypes.default.string,
|
|
240
242
|
"crossOrigin": _propTypes.default.string,
|
|
@@ -499,6 +501,7 @@ Input.propTypes = {
|
|
|
499
501
|
"trimStart": _propTypes.default.func.isRequired,
|
|
500
502
|
"valueOf": _propTypes.default.func.isRequired
|
|
501
503
|
})]),
|
|
504
|
+
"rows": _propTypes.default.number,
|
|
502
505
|
"security": _propTypes.default.string,
|
|
503
506
|
"size": _propTypes.default.number,
|
|
504
507
|
"slot": _propTypes.default.string,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from "./radio-button-mapper";
|
|
2
|
-
export
|
|
1
|
+
export { default } from "./radio-button-mapper.component";
|
|
2
|
+
export type { RadioButtonMapperProps, MappedChildProps, } from "./radio-button-mapper.component";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface InputEvents {
|
|
3
|
+
/** Callback fired when each RadioButton is blurred */
|
|
4
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
5
|
+
/** Callback fired when the user selects a RadioButton */
|
|
6
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
7
|
+
/** Callback fired on mouse down */
|
|
8
|
+
onMouseDown?: (event: React.MouseEvent<HTMLInputElement>) => void;
|
|
9
|
+
/** Callback fired on key down */
|
|
10
|
+
onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
11
|
+
}
|
|
12
|
+
export interface RadioButtonMapperProps extends InputEvents {
|
|
13
|
+
/** The RadioButton objects to be rendered in the group */
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
/** Specifies the name prop to be applied to each button in the group */
|
|
16
|
+
name: string;
|
|
17
|
+
/** Value of the selected RadioButton */
|
|
18
|
+
value?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface MappedChildProps {
|
|
21
|
+
defaultChecked?: boolean;
|
|
22
|
+
checked: boolean;
|
|
23
|
+
name: string;
|
|
24
|
+
}
|
|
25
|
+
declare const RadioButtonMapper: {
|
|
26
|
+
({ children, name, onBlur, onChange, onMouseDown, onKeyDown, value, }: RadioButtonMapperProps): JSX.Element;
|
|
27
|
+
displayName: string;
|
|
28
|
+
};
|
|
29
|
+
export default RadioButtonMapper;
|
|
@@ -28,7 +28,7 @@ const RadioButtonMapper = ({
|
|
|
28
28
|
const anyChecked = (0, _react.useMemo)(() => {
|
|
29
29
|
let result = false;
|
|
30
30
|
filteredChildren.forEach(child => {
|
|
31
|
-
if (Object.prototype.hasOwnProperty.call(child.props, "defaultChecked")) {
|
|
31
|
+
if ( /*#__PURE__*/_react.default.isValidElement(child) && Object.prototype.hasOwnProperty.call(child.props, "defaultChecked")) {
|
|
32
32
|
result = true;
|
|
33
33
|
}
|
|
34
34
|
});
|
|
@@ -36,18 +36,21 @@ const RadioButtonMapper = ({
|
|
|
36
36
|
}, [filteredChildren]);
|
|
37
37
|
const isControlled = value !== undefined;
|
|
38
38
|
const [checkedValue, setCheckedValue] = (0, _react.useState)(false);
|
|
39
|
-
const onChangeProp = (0, _react.useCallback)(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
39
|
+
const onChangeProp = (0, _react.useCallback)(event => {
|
|
40
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
41
|
+
/* istanbul ignore else */
|
|
43
42
|
|
|
44
43
|
if (!isControlled) {
|
|
45
|
-
setCheckedValue(
|
|
44
|
+
setCheckedValue(event.target.value);
|
|
46
45
|
}
|
|
47
46
|
}, [onChange, setCheckedValue, isControlled]);
|
|
48
47
|
const buttons = filteredChildren.map(child => {
|
|
49
48
|
let checked;
|
|
50
49
|
|
|
50
|
+
if (! /*#__PURE__*/_react.default.isValidElement(child)) {
|
|
51
|
+
return child;
|
|
52
|
+
}
|
|
53
|
+
|
|
51
54
|
if (isControlled) {
|
|
52
55
|
// The user is controlling the input via the value prop
|
|
53
56
|
checked = value === child.props.value;
|
|
@@ -59,7 +62,7 @@ const RadioButtonMapper = ({
|
|
|
59
62
|
checked = checkedValue === child.props.value;
|
|
60
63
|
}
|
|
61
64
|
|
|
62
|
-
|
|
65
|
+
const childProps = {
|
|
63
66
|
defaultChecked: undefined,
|
|
64
67
|
checked,
|
|
65
68
|
name,
|
|
@@ -67,29 +70,20 @@ const RadioButtonMapper = ({
|
|
|
67
70
|
onMouseDown,
|
|
68
71
|
onChange: onChangeProp,
|
|
69
72
|
onKeyDown
|
|
70
|
-
}
|
|
73
|
+
};
|
|
74
|
+
return /*#__PURE__*/_react.default.cloneElement(child, childProps);
|
|
71
75
|
});
|
|
72
|
-
return buttons;
|
|
76
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, buttons);
|
|
73
77
|
};
|
|
74
78
|
|
|
75
79
|
RadioButtonMapper.propTypes = {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
onBlur: _propTypes.default.func,
|
|
84
|
-
|
|
85
|
-
/** Callback fired when the user selects a RadioButton */
|
|
86
|
-
onChange: _propTypes.default.func,
|
|
87
|
-
|
|
88
|
-
/** Callback fired on key down */
|
|
89
|
-
onKeyDown: _propTypes.default.func,
|
|
90
|
-
|
|
91
|
-
/** Value of the selected RadioButton */
|
|
92
|
-
value: _propTypes.default.string
|
|
80
|
+
"children": _propTypes.default.node,
|
|
81
|
+
"name": _propTypes.default.string.isRequired,
|
|
82
|
+
"onBlur": _propTypes.default.func,
|
|
83
|
+
"onChange": _propTypes.default.func,
|
|
84
|
+
"onKeyDown": _propTypes.default.func,
|
|
85
|
+
"onMouseDown": _propTypes.default.func,
|
|
86
|
+
"value": _propTypes.default.string
|
|
93
87
|
};
|
|
94
88
|
RadioButtonMapper.displayName = "RadioButtonMapper";
|
|
95
89
|
var _default = RadioButtonMapper;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MarginProps } from "styled-system";
|
|
2
2
|
import { ValidationProps } from "../../__internal__/validations";
|
|
3
|
-
interface StyledCheckboxProps extends ValidationProps, MarginProps {
|
|
3
|
+
export interface StyledCheckboxProps extends ValidationProps, MarginProps {
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
fieldHelpInline?: boolean;
|
|
6
6
|
inputWidth?: number | string;
|
|
@@ -315,7 +315,9 @@ const DateInput = ({
|
|
|
315
315
|
"data-component": dataComponent || "date",
|
|
316
316
|
"data-element": dataElement,
|
|
317
317
|
"data-role": dataRole
|
|
318
|
-
}, (0, _utils2.filterStyledSystemMarginProps)(rest)
|
|
318
|
+
}, (0, _utils2.filterStyledSystemMarginProps)(rest), {
|
|
319
|
+
applyDateRangeStyling: !!inputRefMap
|
|
320
|
+
}), /*#__PURE__*/_react.default.createElement(_textbox.default, _extends({}, (0, _utils2.filterOutStyledSystemSpacingProps)(rest), {
|
|
319
321
|
value: computedValue(),
|
|
320
322
|
onBlur: handleBlur,
|
|
321
323
|
onChange: handleChange,
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _styledComponents =
|
|
8
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
@@ -17,8 +17,18 @@ var _input = _interopRequireDefault(require("../../__internal__/input/input.styl
|
|
|
17
17
|
|
|
18
18
|
var _inputPresentation = _interopRequireDefault(require("../../__internal__/input/input-presentation.style"));
|
|
19
19
|
|
|
20
|
+
var _formField = require("../../__internal__/form-field/form-field.style");
|
|
21
|
+
|
|
22
|
+
var _validationMessage = _interopRequireDefault(require("../../__internal__/validation-message/validation-message.style"));
|
|
23
|
+
|
|
24
|
+
var _label = _interopRequireDefault(require("../../__internal__/label/label.style"));
|
|
25
|
+
|
|
20
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
27
|
|
|
28
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
29
|
+
|
|
30
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
+
|
|
22
32
|
const datePickerWidth = {
|
|
23
33
|
large: "140px",
|
|
24
34
|
medium: "135px",
|
|
@@ -37,6 +47,20 @@ const StyledDateInput = _styledComponents.default.div`
|
|
|
37
47
|
margin-right: -8px;
|
|
38
48
|
}
|
|
39
49
|
}
|
|
50
|
+
|
|
51
|
+
${({
|
|
52
|
+
applyDateRangeStyling,
|
|
53
|
+
size,
|
|
54
|
+
labelInline
|
|
55
|
+
}) => applyDateRangeStyling && !labelInline && (0, _styledComponents.css)`
|
|
56
|
+
${_formField.FieldLineStyle} {
|
|
57
|
+
max-width: ${datePickerWidth[size]};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
${_validationMessage.default}, ${_label.default} {
|
|
61
|
+
overflow-wrap: anywhere;
|
|
62
|
+
}
|
|
63
|
+
`}
|
|
40
64
|
`;
|
|
41
65
|
StyledDateInput.propTypes = {
|
|
42
66
|
size: _propTypes.default.oneOf(["small", "medium", "large"])
|
|
@@ -278,6 +278,7 @@ Decimal.propTypes = {
|
|
|
278
278
|
"aria-valuemin": _propTypes.default.number,
|
|
279
279
|
"aria-valuenow": _propTypes.default.number,
|
|
280
280
|
"aria-valuetext": _propTypes.default.string,
|
|
281
|
+
"as": _propTypes.default.elementType,
|
|
281
282
|
"autoCapitalize": _propTypes.default.string,
|
|
282
283
|
"autoComplete": _propTypes.default.string,
|
|
283
284
|
"autoCorrect": _propTypes.default.string,
|
|
@@ -191,6 +191,7 @@ GroupedCharacter.propTypes = {
|
|
|
191
191
|
"aria-valuemin": _propTypes.default.number,
|
|
192
192
|
"aria-valuenow": _propTypes.default.number,
|
|
193
193
|
"aria-valuetext": _propTypes.default.string,
|
|
194
|
+
"as": _propTypes.default.elementType,
|
|
194
195
|
"autoCapitalize": _propTypes.default.string,
|
|
195
196
|
"autoComplete": _propTypes.default.string,
|
|
196
197
|
"autoCorrect": _propTypes.default.string,
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "./radio-button";
|
|
6
|
-
export { default as RadioButtonGroup } from "./radio-button-group";
|
|
1
|
+
import RadioButton from "./radio-button.component";
|
|
2
|
+
import RadioButtonGroup from "./radio-button-group.component";
|
|
3
|
+
export { RadioButton, RadioButtonGroup };
|
|
4
|
+
export default RadioButton;
|
|
@@ -9,12 +9,6 @@ Object.defineProperty(exports, "RadioButton", {
|
|
|
9
9
|
return _radioButton.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "PrivateRadioButton", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _radioButton.PrivateRadioButton;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
12
|
Object.defineProperty(exports, "RadioButtonGroup", {
|
|
19
13
|
enumerable: true,
|
|
20
14
|
get: function () {
|
|
@@ -23,15 +17,11 @@ Object.defineProperty(exports, "RadioButtonGroup", {
|
|
|
23
17
|
});
|
|
24
18
|
exports.default = void 0;
|
|
25
19
|
|
|
26
|
-
var _radioButton =
|
|
20
|
+
var _radioButton = _interopRequireDefault(require("./radio-button.component"));
|
|
27
21
|
|
|
28
22
|
var _radioButtonGroup = _interopRequireDefault(require("./radio-button-group.component"));
|
|
29
23
|
|
|
30
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
25
|
|
|
32
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
33
|
-
|
|
34
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
|
-
|
|
36
26
|
var _default = _radioButton.default;
|
|
37
27
|
exports.default = _default;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MarginProps } from "styled-system";
|
|
3
|
+
import { ValidationProps } from "../../__internal__/validations";
|
|
4
|
+
export interface RadioButtonGroupProps extends ValidationProps, MarginProps {
|
|
5
|
+
/** Breakpoint for adaptive legend (inline labels change to top aligned). Enables the adaptive behaviour when set */
|
|
6
|
+
adaptiveLegendBreakpoint?: number;
|
|
7
|
+
/** Breakpoint for adaptive spacing (left margin changes to 0). Enables the adaptive behaviour when set */
|
|
8
|
+
adaptiveSpacingBreakpoint?: number;
|
|
9
|
+
/** The RadioButton objects to be rendered in the group */
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
/** When true, RadioButtons are in line */
|
|
12
|
+
inline?: boolean;
|
|
13
|
+
/** Spacing between labels and radio buttons, given number will be multiplied by base spacing unit (8) */
|
|
14
|
+
labelSpacing?: 1 | 2;
|
|
15
|
+
/** The content for the RadioGroup Legend */
|
|
16
|
+
legend?: string;
|
|
17
|
+
/** Text alignment of legend when inline */
|
|
18
|
+
legendAlign?: "left" | "right";
|
|
19
|
+
/** When true, legend is placed in line with the radiobuttons */
|
|
20
|
+
legendInline?: boolean;
|
|
21
|
+
/** Spacing between legend and field for inline legend, number multiplied by base spacing unit (8) */
|
|
22
|
+
legendSpacing?: 1 | 2;
|
|
23
|
+
/** Percentage width of legend (only when legend is inline) */
|
|
24
|
+
legendWidth?: number;
|
|
25
|
+
/** Specifies the name prop to be applied to each button in the group */
|
|
26
|
+
name: string;
|
|
27
|
+
/** Callback fired when each RadioButton is blurred */
|
|
28
|
+
onBlur?: (ev: React.FocusEvent<HTMLInputElement>) => void;
|
|
29
|
+
/** Callback fired when the user selects a RadioButton */
|
|
30
|
+
onChange?: (ev: React.ChangeEvent<HTMLInputElement>) => void;
|
|
31
|
+
/** Flag to configure component as mandatory */
|
|
32
|
+
required?: boolean;
|
|
33
|
+
/** value of the selected RadioButton */
|
|
34
|
+
value?: string;
|
|
35
|
+
/** Overrides the default tooltip position */
|
|
36
|
+
tooltipPosition?: "top" | "bottom" | "left" | "right";
|
|
37
|
+
}
|
|
38
|
+
export declare const RadioButtonGroup: {
|
|
39
|
+
(props: RadioButtonGroupProps): JSX.Element;
|
|
40
|
+
displayName: string;
|
|
41
|
+
};
|
|
42
|
+
export default RadioButtonGroup;
|