carbon-react 104.7.1 → 104.7.2
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/lib/__internal__/checkable-input/checkable-input.component.js +2 -3
- package/lib/__internal__/form-field/form-field.component.d.ts +4 -1
- package/lib/__internal__/form-field/form-field.component.js +7 -2
- package/lib/__internal__/form-field/form-field.d.ts +2 -0
- package/lib/__internal__/input-icon-toggle/input-icon-toggle.component.d.ts +3 -3
- package/lib/__internal__/input-icon-toggle/input-icon-toggle.component.js +6 -5
- package/lib/__internal__/input-icon-toggle/input-icon-toggle.d.ts +2 -0
- package/lib/__internal__/label/label.component.d.ts +4 -1
- package/lib/__internal__/label/label.component.js +15 -6
- package/lib/__internal__/label/label.d.ts +2 -0
- package/lib/__internal__/tooltip-provider/index.js +22 -12
- package/lib/components/help/help.component.js +1 -1
- package/lib/components/help/help.d.ts +1 -1
- package/lib/components/textarea/textarea.component.js +2 -3
- package/lib/components/textbox/textbox.component.js +4 -4
- package/lib/hooks/__internal__/useInputAccessibility/useInputAccessibility.d.ts +2 -3
- package/lib/hooks/__internal__/useInputAccessibility/useInputAccessibility.js +3 -4
- package/package.json +1 -1
|
@@ -63,8 +63,8 @@ const CheckableInput = ({
|
|
|
63
63
|
} = (0, _react.useRef)(inputId || (0, _guid.default)());
|
|
64
64
|
const {
|
|
65
65
|
labelId,
|
|
66
|
-
tooltipId,
|
|
67
66
|
fieldHelpId,
|
|
67
|
+
validationIconId,
|
|
68
68
|
ariaDescribedBy,
|
|
69
69
|
ariaLabelledBy
|
|
70
70
|
} = (0, _useInputAccessibility.default)({
|
|
@@ -73,7 +73,6 @@ const CheckableInput = ({
|
|
|
73
73
|
warning,
|
|
74
74
|
info,
|
|
75
75
|
label,
|
|
76
|
-
labelHelp,
|
|
77
76
|
fieldHelp
|
|
78
77
|
});
|
|
79
78
|
const isRadio = type === "radio";
|
|
@@ -82,7 +81,6 @@ const CheckableInput = ({
|
|
|
82
81
|
error,
|
|
83
82
|
fieldHelp,
|
|
84
83
|
fieldHelpInline,
|
|
85
|
-
tooltipId,
|
|
86
84
|
fieldHelpId,
|
|
87
85
|
id,
|
|
88
86
|
info,
|
|
@@ -96,6 +94,7 @@ const CheckableInput = ({
|
|
|
96
94
|
name: id,
|
|
97
95
|
reverse,
|
|
98
96
|
warning,
|
|
97
|
+
validationIconId,
|
|
99
98
|
// We don't want an asterisk on each radio control, only the legend
|
|
100
99
|
// However, we still want the input element to receive the required prop
|
|
101
100
|
isRequired: isRadio ? undefined : required,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default FormField;
|
|
2
|
-
declare function FormField({ children, disabled, fieldHelp: fieldHelpContent, fieldHelpInline, error, warning, info, tooltipId, fieldHelpId, helpTabIndex, label, labelId, labelAlign, labelHelp, labelHelpIcon, labelInline, labelSpacing, labelWidth, id, reverse, isOptional, useValidationIcon, adaptiveLabelBreakpoint, isRequired, ...rest }: {
|
|
2
|
+
declare function FormField({ children, disabled, fieldHelp: fieldHelpContent, fieldHelpInline, error, warning, info, tooltipId, fieldHelpId, helpTabIndex, label, labelId, labelAlign, labelHelp, labelHelpIcon, labelInline, labelSpacing, labelWidth, id, reverse, isOptional, useValidationIcon, adaptiveLabelBreakpoint, isRequired, validationIconId, ...rest }: {
|
|
3
3
|
[x: string]: any;
|
|
4
4
|
children: any;
|
|
5
5
|
disabled: any;
|
|
@@ -25,6 +25,7 @@ declare function FormField({ children, disabled, fieldHelp: fieldHelpContent, fi
|
|
|
25
25
|
useValidationIcon: any;
|
|
26
26
|
adaptiveLabelBreakpoint: any;
|
|
27
27
|
isRequired: any;
|
|
28
|
+
validationIconId: any;
|
|
28
29
|
}): JSX.Element;
|
|
29
30
|
declare namespace FormField {
|
|
30
31
|
const propTypes: {
|
|
@@ -58,6 +59,8 @@ declare namespace FormField {
|
|
|
58
59
|
adaptiveLabelBreakpoint: PropTypes.Requireable<number>;
|
|
59
60
|
/** Flag to configure component as mandatory */
|
|
60
61
|
isRequired: PropTypes.Requireable<boolean>;
|
|
62
|
+
/** Id of the validation icon */
|
|
63
|
+
validationIconId: PropTypes.Requireable<string>;
|
|
61
64
|
};
|
|
62
65
|
}
|
|
63
66
|
import PropTypes from "prop-types";
|
|
@@ -60,6 +60,7 @@ const FormField = ({
|
|
|
60
60
|
useValidationIcon,
|
|
61
61
|
adaptiveLabelBreakpoint,
|
|
62
62
|
isRequired,
|
|
63
|
+
validationIconId,
|
|
63
64
|
...rest
|
|
64
65
|
}) => {
|
|
65
66
|
const context = (0, _react.useContext)(_tab.TabContext);
|
|
@@ -103,7 +104,8 @@ const FormField = ({
|
|
|
103
104
|
useValidationIcon: useValidationIcon,
|
|
104
105
|
pr: !reverse ? labelSpacing : undefined,
|
|
105
106
|
pl: reverse ? labelSpacing : undefined,
|
|
106
|
-
isRequired: isRequired
|
|
107
|
+
isRequired: isRequired,
|
|
108
|
+
validationIconId: validationIconId
|
|
107
109
|
}, label), fieldHelpInline && fieldHelp, !reverse && children), !fieldHelpInline && fieldHelp);
|
|
108
110
|
};
|
|
109
111
|
|
|
@@ -150,7 +152,10 @@ FormField.propTypes = {
|
|
|
150
152
|
adaptiveLabelBreakpoint: _propTypes.default.number,
|
|
151
153
|
|
|
152
154
|
/** Flag to configure component as mandatory */
|
|
153
|
-
isRequired: _propTypes.default.bool
|
|
155
|
+
isRequired: _propTypes.default.bool,
|
|
156
|
+
|
|
157
|
+
/** Id of the validation icon */
|
|
158
|
+
validationIconId: _propTypes.default.string
|
|
154
159
|
};
|
|
155
160
|
var _default = FormField;
|
|
156
161
|
exports.default = _default;
|
|
@@ -33,6 +33,8 @@ export interface CommonFormFieldPropTypes
|
|
|
33
33
|
labelWidth?: number;
|
|
34
34
|
/** If true the label switches position with the input */
|
|
35
35
|
reverse?: boolean;
|
|
36
|
+
/** Id of the validation icon */
|
|
37
|
+
validationIconId?: string;
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
export interface FormFieldPropTypes extends CommonFormFieldPropTypes {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default InputIconToggle;
|
|
2
|
-
declare function InputIconToggle({ disabled, readOnly, size, inputIcon: type, onClick, onFocus, onBlur, onMouseDown, error, warning, info, useValidationIcon, align, iconTabIndex,
|
|
2
|
+
declare function InputIconToggle({ disabled, readOnly, size, inputIcon: type, onClick, onFocus, onBlur, onMouseDown, error, warning, info, useValidationIcon, align, iconTabIndex, validationIconId, }: {
|
|
3
3
|
disabled: any;
|
|
4
4
|
readOnly: any;
|
|
5
5
|
size: any;
|
|
@@ -14,7 +14,7 @@ declare function InputIconToggle({ disabled, readOnly, size, inputIcon: type, on
|
|
|
14
14
|
useValidationIcon: any;
|
|
15
15
|
align: any;
|
|
16
16
|
iconTabIndex: any;
|
|
17
|
-
|
|
17
|
+
validationIconId: any;
|
|
18
18
|
}): JSX.Element | null;
|
|
19
19
|
declare namespace InputIconToggle {
|
|
20
20
|
namespace propTypes {
|
|
@@ -32,7 +32,7 @@ declare namespace InputIconToggle {
|
|
|
32
32
|
const align: PropTypes.Requireable<string>;
|
|
33
33
|
const useValidationIcon: PropTypes.Requireable<boolean>;
|
|
34
34
|
const iconTabIndex: PropTypes.Requireable<number>;
|
|
35
|
-
const
|
|
35
|
+
const validationIconId: PropTypes.Requireable<string>;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
import PropTypes from "prop-types";
|
|
@@ -41,7 +41,7 @@ const InputIconToggle = ({
|
|
|
41
41
|
useValidationIcon,
|
|
42
42
|
align,
|
|
43
43
|
iconTabIndex,
|
|
44
|
-
|
|
44
|
+
validationIconId
|
|
45
45
|
}) => {
|
|
46
46
|
if (useValidationIcon && !disabled && shouldDisplayValidationIcon({
|
|
47
47
|
error,
|
|
@@ -60,7 +60,7 @@ const InputIconToggle = ({
|
|
|
60
60
|
onBlur: onBlur,
|
|
61
61
|
isPartOfInput: true,
|
|
62
62
|
tabIndex: iconTabIndex,
|
|
63
|
-
|
|
63
|
+
iconId: validationIconId,
|
|
64
64
|
tooltipPosition: align === "right" ? "left" : "right"
|
|
65
65
|
}));
|
|
66
66
|
}
|
|
@@ -74,8 +74,7 @@ const InputIconToggle = ({
|
|
|
74
74
|
onMouseDown: onMouseDown,
|
|
75
75
|
tabIndex: iconTabIndex
|
|
76
76
|
}, /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
77
|
-
type: type
|
|
78
|
-
tooltipId: tooltipId
|
|
77
|
+
type: type
|
|
79
78
|
}));
|
|
80
79
|
}
|
|
81
80
|
|
|
@@ -97,7 +96,9 @@ InputIconToggle.propTypes = {
|
|
|
97
96
|
align: _propTypes.default.oneOf(["left", "right"]),
|
|
98
97
|
useValidationIcon: _propTypes.default.bool,
|
|
99
98
|
iconTabIndex: _propTypes.default.number,
|
|
100
|
-
|
|
99
|
+
|
|
100
|
+
/** Id of the validation icon */
|
|
101
|
+
validationIconId: _propTypes.default.string
|
|
101
102
|
};
|
|
102
103
|
var _default = InputIconToggle;
|
|
103
104
|
exports.default = _default;
|
|
@@ -16,6 +16,8 @@ export interface InputIconToggleProps {
|
|
|
16
16
|
useValidationIcon?: boolean;
|
|
17
17
|
iconTabIndex?: number;
|
|
18
18
|
tooltipId?: string;
|
|
19
|
+
/** Id of the validation icon */
|
|
20
|
+
validationIconId?: string;
|
|
19
21
|
}
|
|
20
22
|
declare function InputIconToggle(props: InputIconToggleProps): JSX.Element;
|
|
21
23
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare var _default: React.MemoExoticComponent<{
|
|
2
|
-
({ disabled, inline, align, width, optional, labelId, tooltipId, children, error, warning, info, help, helpIcon, helpTabIndex, useValidationIcon, htmlFor, pr, pl, isRequired, }: {
|
|
2
|
+
({ disabled, inline, align, width, optional, labelId, tooltipId, children, error, warning, info, help, helpIcon, helpTabIndex, useValidationIcon, htmlFor, pr, pl, isRequired, validationIconId, }: {
|
|
3
3
|
disabled: any;
|
|
4
4
|
inline: any;
|
|
5
5
|
align?: string | undefined;
|
|
@@ -19,6 +19,7 @@ declare var _default: React.MemoExoticComponent<{
|
|
|
19
19
|
pr: any;
|
|
20
20
|
pl: any;
|
|
21
21
|
isRequired: any;
|
|
22
|
+
validationIconId: any;
|
|
22
23
|
}): JSX.Element;
|
|
23
24
|
propTypes: {
|
|
24
25
|
/** Label width */
|
|
@@ -59,6 +60,8 @@ declare var _default: React.MemoExoticComponent<{
|
|
|
59
60
|
pl: PropTypes.Requireable<number>;
|
|
60
61
|
/** Flag to configure component as mandatory */
|
|
61
62
|
isRequired: PropTypes.Requireable<boolean>;
|
|
63
|
+
/** Id of the validation icon */
|
|
64
|
+
validationIconId: PropTypes.Requireable<string>;
|
|
62
65
|
};
|
|
63
66
|
}>;
|
|
64
67
|
export default _default;
|
|
@@ -63,11 +63,11 @@ const Label = ({
|
|
|
63
63
|
htmlFor,
|
|
64
64
|
pr,
|
|
65
65
|
pl,
|
|
66
|
-
isRequired
|
|
66
|
+
isRequired,
|
|
67
|
+
validationIconId
|
|
67
68
|
}) => {
|
|
69
|
+
const [isFocused, setFocus] = (0, _react.useState)(false);
|
|
68
70
|
const {
|
|
69
|
-
hasFocus,
|
|
70
|
-
hasMouseOver,
|
|
71
71
|
onMouseEnter,
|
|
72
72
|
onMouseLeave
|
|
73
73
|
} = (0, _react.useContext)(_inputBehaviour.InputContext);
|
|
@@ -87,6 +87,11 @@ const Label = ({
|
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
const icon = () => {
|
|
90
|
+
const wrapperProps = {
|
|
91
|
+
onFocus: () => setFocus(true),
|
|
92
|
+
onBlur: () => setFocus(false)
|
|
93
|
+
};
|
|
94
|
+
|
|
90
95
|
if (useValidationIcon && shouldDisplayValidationIcon({
|
|
91
96
|
error,
|
|
92
97
|
warning,
|
|
@@ -100,6 +105,7 @@ const Label = ({
|
|
|
100
105
|
inline
|
|
101
106
|
});
|
|
102
107
|
return /*#__PURE__*/_react.default.createElement(_iconWrapper.default, null, /*#__PURE__*/_react.default.createElement(_validationIcon.default, {
|
|
108
|
+
iconId: validationIconId,
|
|
103
109
|
tooltipId: tooltipId,
|
|
104
110
|
error: error,
|
|
105
111
|
warning: warning,
|
|
@@ -109,11 +115,11 @@ const Label = ({
|
|
|
109
115
|
}));
|
|
110
116
|
}
|
|
111
117
|
|
|
112
|
-
return help && /*#__PURE__*/_react.default.createElement(_iconWrapper.default,
|
|
118
|
+
return help && /*#__PURE__*/_react.default.createElement(_iconWrapper.default, wrapperProps, /*#__PURE__*/_react.default.createElement(_help.default, {
|
|
113
119
|
tooltipId: tooltipId,
|
|
114
120
|
tabIndex: helpTabIndex,
|
|
115
121
|
type: helpIcon,
|
|
116
|
-
isFocused:
|
|
122
|
+
isFocused: isFocused
|
|
117
123
|
}, help));
|
|
118
124
|
};
|
|
119
125
|
|
|
@@ -191,7 +197,10 @@ Label.propTypes = {
|
|
|
191
197
|
pl: _propTypes.default.oneOf([1, 2]),
|
|
192
198
|
|
|
193
199
|
/** Flag to configure component as mandatory */
|
|
194
|
-
isRequired: _propTypes.default.bool
|
|
200
|
+
isRequired: _propTypes.default.bool,
|
|
201
|
+
|
|
202
|
+
/** Id of the validation icon */
|
|
203
|
+
validationIconId: _propTypes.default.string
|
|
195
204
|
};
|
|
196
205
|
|
|
197
206
|
var _default = /*#__PURE__*/_react.default.memo(Label);
|
|
@@ -34,6 +34,8 @@ export interface LabelPropTypes extends ValidationPropTypes {
|
|
|
34
34
|
pr?: 1 | 2;
|
|
35
35
|
/** Padding left, integer multiplied by base spacing constant (8) */
|
|
36
36
|
pl?: 1 | 2;
|
|
37
|
+
/** Id of the validation icon */
|
|
38
|
+
validationIconId?: string;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
declare function Label(props: LabelPropTypes): JSX.Element;
|
|
@@ -5,12 +5,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.TooltipProvider = exports.TooltipContext = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
+
var _guid = _interopRequireDefault(require("../utils/helpers/guid/guid"));
|
|
13
|
+
|
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
15
|
|
|
16
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
17
|
+
|
|
18
|
+
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; }
|
|
19
|
+
|
|
14
20
|
const TooltipContext = /*#__PURE__*/_react.default.createContext({});
|
|
15
21
|
|
|
16
22
|
exports.TooltipContext = TooltipContext;
|
|
@@ -21,18 +27,22 @@ const TooltipProvider = ({
|
|
|
21
27
|
helpAriaLabel,
|
|
22
28
|
focusable = true,
|
|
23
29
|
tooltipVisible,
|
|
24
|
-
disabled
|
|
30
|
+
disabled,
|
|
25
31
|
target
|
|
26
|
-
}) =>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
}) => {
|
|
33
|
+
const tooltipId = (0, _react.useRef)((0, _guid.default)());
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement(TooltipContext.Provider, {
|
|
35
|
+
value: {
|
|
36
|
+
tooltipPosition,
|
|
37
|
+
helpAriaLabel,
|
|
38
|
+
focusable,
|
|
39
|
+
tooltipVisible,
|
|
40
|
+
disabled,
|
|
41
|
+
tooltipId,
|
|
42
|
+
target
|
|
43
|
+
}
|
|
44
|
+
}, children);
|
|
45
|
+
};
|
|
36
46
|
|
|
37
47
|
exports.TooltipProvider = TooltipProvider;
|
|
38
48
|
TooltipProvider.propTypes = {
|
|
@@ -139,7 +139,7 @@ Help.propTypes = { ...marginPropTypes,
|
|
|
139
139
|
/** A path for the anchor */
|
|
140
140
|
href: _propTypes.default.string,
|
|
141
141
|
|
|
142
|
-
/**
|
|
142
|
+
/** A boolean received from IconWrapper */
|
|
143
143
|
isFocused: _propTypes.default.bool,
|
|
144
144
|
|
|
145
145
|
/** <a href="https://brand.sage.com/d/NdbrveWvNheA/foundations#/icons/icons" target="_blank">List of supported icons</a>
|
|
@@ -13,7 +13,7 @@ export interface HelpProps extends MarginProps {
|
|
|
13
13
|
helpId?: string;
|
|
14
14
|
/** A path for the anchor */
|
|
15
15
|
href?: string;
|
|
16
|
-
/**
|
|
16
|
+
/** A boolean received from IconWrapper */
|
|
17
17
|
isFocused?: boolean;
|
|
18
18
|
/** Overrides the default tabindex of the component */
|
|
19
19
|
tabIndex?: number | string;
|
|
@@ -105,7 +105,7 @@ const Textarea = ({
|
|
|
105
105
|
|
|
106
106
|
const {
|
|
107
107
|
labelId,
|
|
108
|
-
|
|
108
|
+
validationIconId,
|
|
109
109
|
fieldHelpId,
|
|
110
110
|
ariaDescribedBy,
|
|
111
111
|
ariaLabelledBy
|
|
@@ -115,7 +115,6 @@ const Textarea = ({
|
|
|
115
115
|
warning,
|
|
116
116
|
info,
|
|
117
117
|
label,
|
|
118
|
-
labelHelp,
|
|
119
118
|
fieldHelp
|
|
120
119
|
});
|
|
121
120
|
(0, _react.useEffect)(() => {
|
|
@@ -176,7 +175,6 @@ const Textarea = ({
|
|
|
176
175
|
labelWidth: labelWidth,
|
|
177
176
|
labelHelp: labelHelp,
|
|
178
177
|
labelSpacing: labelSpacing,
|
|
179
|
-
tooltipId: tooltipId,
|
|
180
178
|
isRequired: props.required,
|
|
181
179
|
useValidationIcon: validationOnLabel,
|
|
182
180
|
adaptiveLabelBreakpoint: adaptiveLabelBreakpoint
|
|
@@ -214,6 +212,7 @@ const Textarea = ({
|
|
|
214
212
|
error: error,
|
|
215
213
|
warning: warning,
|
|
216
214
|
info: info,
|
|
215
|
+
validationIconId: validationIconId,
|
|
217
216
|
useValidationIcon: !validationOnLabel
|
|
218
217
|
}))), characterCount())));
|
|
219
218
|
};
|
|
@@ -94,7 +94,7 @@ const Textbox = ({
|
|
|
94
94
|
const [maxLength, characterCount] = (0, _useCharacterCount.default)(value, characterLimit, warnOverLimit, enforceCharacterLimit);
|
|
95
95
|
const {
|
|
96
96
|
labelId: internalLabelId,
|
|
97
|
-
|
|
97
|
+
validationIconId,
|
|
98
98
|
fieldHelpId,
|
|
99
99
|
ariaDescribedBy
|
|
100
100
|
} = (0, _useInputAccessibility.default)({
|
|
@@ -111,7 +111,6 @@ const Textbox = ({
|
|
|
111
111
|
helpAriaLabel: helpAriaLabel,
|
|
112
112
|
tooltipPosition: tooltipPosition
|
|
113
113
|
}, /*#__PURE__*/_react.default.createElement(_inputBehaviour.InputBehaviour, null, /*#__PURE__*/_react.default.createElement(_formField.default, _extends({
|
|
114
|
-
tooltipId: tooltipId,
|
|
115
114
|
disabled: disabled,
|
|
116
115
|
fieldHelp: fieldHelp,
|
|
117
116
|
fieldHelpId: fieldHelpId,
|
|
@@ -133,7 +132,8 @@ const Textbox = ({
|
|
|
133
132
|
isRequired: required,
|
|
134
133
|
"data-component": dataComponent,
|
|
135
134
|
"data-role": dataRole,
|
|
136
|
-
"data-element": dataElement
|
|
135
|
+
"data-element": dataElement,
|
|
136
|
+
validationIconId: validationIconId
|
|
137
137
|
}, (0, _utils.filterStyledSystemMarginProps)(props)), /*#__PURE__*/_react.default.createElement(_input.InputPresentation, {
|
|
138
138
|
align: align,
|
|
139
139
|
disabled: disabled,
|
|
@@ -182,7 +182,7 @@ const Textbox = ({
|
|
|
182
182
|
size: size,
|
|
183
183
|
useValidationIcon: !validationOnLabel,
|
|
184
184
|
warning: warning,
|
|
185
|
-
|
|
185
|
+
validationIconId: validationIconId
|
|
186
186
|
}))), characterCount));
|
|
187
187
|
};
|
|
188
188
|
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
export default function useInputAccessibility({ id, error, warning, info, label,
|
|
1
|
+
export default function useInputAccessibility({ id, error, warning, info, label, fieldHelp, }: {
|
|
2
2
|
id: any;
|
|
3
3
|
error: any;
|
|
4
4
|
warning: any;
|
|
5
5
|
info: any;
|
|
6
6
|
label: any;
|
|
7
|
-
labelHelp: any;
|
|
8
7
|
fieldHelp: any;
|
|
9
8
|
}): {
|
|
10
9
|
labelId: string | undefined;
|
|
11
|
-
|
|
10
|
+
validationIconId: string | undefined;
|
|
12
11
|
fieldHelpId: string | undefined;
|
|
13
12
|
ariaDescribedBy: string;
|
|
14
13
|
ariaLabelledBy: string | undefined;
|
|
@@ -11,17 +11,16 @@ function useInputAccessibility({
|
|
|
11
11
|
warning,
|
|
12
12
|
info,
|
|
13
13
|
label,
|
|
14
|
-
labelHelp,
|
|
15
14
|
fieldHelp
|
|
16
15
|
}) {
|
|
17
16
|
const labelId = label ? `${id}-label` : undefined;
|
|
18
|
-
const
|
|
17
|
+
const validationIconId = [error, warning, info].filter(validation => typeof validation === "string").length ? `${id}-validation-icon` : undefined;
|
|
19
18
|
const fieldHelpId = fieldHelp ? `${id}-field-help` : undefined;
|
|
20
|
-
const ariaDescribedBy = [fieldHelpId,
|
|
19
|
+
const ariaDescribedBy = [fieldHelpId, validationIconId].filter(Boolean).join(" ");
|
|
21
20
|
const ariaLabelledBy = labelId;
|
|
22
21
|
return {
|
|
23
22
|
labelId,
|
|
24
|
-
|
|
23
|
+
validationIconId,
|
|
25
24
|
fieldHelpId,
|
|
26
25
|
ariaDescribedBy,
|
|
27
26
|
ariaLabelledBy
|