carbon-react 101.4.2 → 101.4.3
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__/label/label.component.js +4 -8
- package/lib/__internal__/validations/validation-icon.component.js +2 -1
- package/lib/__internal__/validations/validation-icon.style.js +12 -2
- package/lib/components/help/help.component.js +1 -1
- package/lib/components/help/help.d.ts +1 -1
- package/package.json +1 -1
|
@@ -65,8 +65,9 @@ const Label = ({
|
|
|
65
65
|
pl,
|
|
66
66
|
isRequired
|
|
67
67
|
}) => {
|
|
68
|
-
const [isFocused, setFocus] = (0, _react.useState)(false);
|
|
69
68
|
const {
|
|
69
|
+
hasFocus,
|
|
70
|
+
hasMouseOver,
|
|
70
71
|
onMouseEnter,
|
|
71
72
|
onMouseLeave
|
|
72
73
|
} = (0, _react.useContext)(_inputBehaviour.InputContext);
|
|
@@ -86,11 +87,6 @@ const Label = ({
|
|
|
86
87
|
};
|
|
87
88
|
|
|
88
89
|
const icon = () => {
|
|
89
|
-
const wrapperProps = {
|
|
90
|
-
onFocus: () => setFocus(true),
|
|
91
|
-
onBlur: () => setFocus(false)
|
|
92
|
-
};
|
|
93
|
-
|
|
94
90
|
if (useValidationIcon && shouldDisplayValidationIcon({
|
|
95
91
|
error,
|
|
96
92
|
warning,
|
|
@@ -113,11 +109,11 @@ const Label = ({
|
|
|
113
109
|
}));
|
|
114
110
|
}
|
|
115
111
|
|
|
116
|
-
return help && /*#__PURE__*/_react.default.createElement(_iconWrapper.default,
|
|
112
|
+
return help && /*#__PURE__*/_react.default.createElement(_iconWrapper.default, null, /*#__PURE__*/_react.default.createElement(_help.default, {
|
|
117
113
|
tooltipId: tooltipId,
|
|
118
114
|
tabIndex: helpTabIndex,
|
|
119
115
|
type: helpIcon,
|
|
120
|
-
isFocused:
|
|
116
|
+
isFocused: hasFocus || hasMouseOver
|
|
121
117
|
}, help));
|
|
122
118
|
};
|
|
123
119
|
|
|
@@ -91,7 +91,8 @@ const ValidationIcon = ({
|
|
|
91
91
|
onBlur: e => {
|
|
92
92
|
setTriggeredByIcon(false);
|
|
93
93
|
if (onBlur) onBlur(e);
|
|
94
|
-
}
|
|
94
|
+
},
|
|
95
|
+
isPartOfInput: isPartOfInput
|
|
95
96
|
}, (0, _utils.filterStyledSystemMarginProps)(rest)), /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
96
97
|
key: `${validationType}-icon`,
|
|
97
98
|
type: validationType,
|
|
@@ -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 _styledSystem = require("styled-system");
|
|
11
11
|
|
|
@@ -15,9 +15,13 @@ var _icon = _interopRequireDefault(require("../../components/icon/icon.style"));
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
18
22
|
const ValidationIconStyle = _styledComponents.default.span`
|
|
19
23
|
background: none;
|
|
20
|
-
cursor:
|
|
24
|
+
cursor: default;
|
|
21
25
|
display: flex;
|
|
22
26
|
align-items: center;
|
|
23
27
|
margin-top: 0;
|
|
@@ -25,6 +29,12 @@ const ValidationIconStyle = _styledComponents.default.span`
|
|
|
25
29
|
border: 0;
|
|
26
30
|
outline: none;
|
|
27
31
|
|
|
32
|
+
${({
|
|
33
|
+
isPartOfInput
|
|
34
|
+
}) => isPartOfInput && (0, _styledComponents.css)`
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
`}
|
|
37
|
+
|
|
28
38
|
${_icon.default}:before {
|
|
29
39
|
color: ${({
|
|
30
40
|
validationType,
|
|
@@ -139,7 +139,7 @@ Help.propTypes = { ...marginPropTypes,
|
|
|
139
139
|
/** A path for the anchor */
|
|
140
140
|
href: _propTypes.default.string,
|
|
141
141
|
|
|
142
|
-
/**
|
|
142
|
+
/** Overrides the visibility of the Tooltip if true */
|
|
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
|
+
/** Overrides the visibility of the Tooltip if true */
|
|
17
17
|
isFocused?: boolean;
|
|
18
18
|
/** Overrides the default tabindex of the component */
|
|
19
19
|
tabIndex?: number | string;
|