carbon-react 141.0.0 → 141.0.1
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.
|
@@ -43,7 +43,8 @@ const InputPresentation = ({
|
|
|
43
43
|
};
|
|
44
44
|
return /*#__PURE__*/React.createElement(StyledInputPresentationContainer, {
|
|
45
45
|
inputWidth: inputWidth,
|
|
46
|
-
maxWidth: maxWidth
|
|
46
|
+
maxWidth: maxWidth,
|
|
47
|
+
"data-role": "input-presentation-container"
|
|
47
48
|
}, positionedChildren, /*#__PURE__*/React.createElement(InputPresentationStyle, {
|
|
48
49
|
hasFocus: hasFocus,
|
|
49
50
|
role: "presentation",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
import React, { useContext, useMemo, useState } from "react";
|
|
2
|
+
import React, { useContext, useEffect, useMemo, useState } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import Icon from "../icon";
|
|
5
5
|
import MenuContext from "../menu/__internal__/menu.context";
|
|
@@ -83,6 +83,11 @@ const Link = /*#__PURE__*/React.forwardRef(({
|
|
|
83
83
|
"data-role": "link-anchor"
|
|
84
84
|
}, /*#__PURE__*/React.createElement(React.Fragment, null, renderLinkIcon(), /*#__PURE__*/React.createElement(StyledContent, null, isSkipLink ? l.link.skipLinkLabel() : children), renderLinkIcon("right")));
|
|
85
85
|
};
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (disabled || !(href || onClick)) {
|
|
88
|
+
setHasFocus(false);
|
|
89
|
+
}
|
|
90
|
+
}, [disabled, href, onClick]);
|
|
86
91
|
return /*#__PURE__*/React.createElement(StyledLink, _extends({
|
|
87
92
|
isSkipLink: isSkipLink,
|
|
88
93
|
disabled: disabled,
|
|
@@ -52,7 +52,8 @@ const InputPresentation = ({
|
|
|
52
52
|
};
|
|
53
53
|
return /*#__PURE__*/_react.default.createElement(_inputPresentation.StyledInputPresentationContainer, {
|
|
54
54
|
inputWidth: inputWidth,
|
|
55
|
-
maxWidth: maxWidth
|
|
55
|
+
maxWidth: maxWidth,
|
|
56
|
+
"data-role": "input-presentation-container"
|
|
56
57
|
}, positionedChildren, /*#__PURE__*/_react.default.createElement(_inputPresentation.default, {
|
|
57
58
|
hasFocus: hasFocus,
|
|
58
59
|
role: "presentation",
|
|
@@ -92,6 +92,11 @@ const Link = exports.Link = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
92
92
|
"data-role": "link-anchor"
|
|
93
93
|
}, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, renderLinkIcon(), /*#__PURE__*/_react.default.createElement(_link.StyledContent, null, isSkipLink ? l.link.skipLinkLabel() : children), renderLinkIcon("right")));
|
|
94
94
|
};
|
|
95
|
+
(0, _react.useEffect)(() => {
|
|
96
|
+
if (disabled || !(href || onClick)) {
|
|
97
|
+
setHasFocus(false);
|
|
98
|
+
}
|
|
99
|
+
}, [disabled, href, onClick]);
|
|
95
100
|
return /*#__PURE__*/_react.default.createElement(_link.StyledLink, _extends({
|
|
96
101
|
isSkipLink: isSkipLink,
|
|
97
102
|
disabled: disabled,
|