@carbon/react 1.33.1 → 1.33.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/es/components/TextArea/TextArea.js +1 -1
- package/es/components/UIShell/HeaderPanel.js +1 -1
- package/es/components/UIShell/Switcher.js +17 -6
- package/lib/components/TextArea/TextArea.js +1 -1
- package/lib/components/UIShell/HeaderPanel.js +1 -1
- package/lib/components/UIShell/Switcher.js +17 -6
- package/package.json +2 -2
|
@@ -61,7 +61,7 @@ const TextArea = /*#__PURE__*/React__default.forwardRef((props, forwardRef) => {
|
|
|
61
61
|
if (!other.disabled && onChange) {
|
|
62
62
|
// delay textCount assignation to give the textarea element value time to catch up if is a controlled input
|
|
63
63
|
setTimeout(() => {
|
|
64
|
-
setTextCount(evt.target
|
|
64
|
+
setTextCount(evt.target?.value?.length);
|
|
65
65
|
}, 0);
|
|
66
66
|
onChange(evt);
|
|
67
67
|
}
|
|
@@ -39,7 +39,7 @@ const HeaderPanel = /*#__PURE__*/React__default.forwardRef(function HeaderPanel(
|
|
|
39
39
|
const eventHandlers = {};
|
|
40
40
|
if (addFocusListeners) {
|
|
41
41
|
eventHandlers.onBlur = event => {
|
|
42
|
-
if (!event.currentTarget.contains(event.relatedTarget) && !lastClickedElement
|
|
42
|
+
if (!event.currentTarget.contains(event.relatedTarget) && !lastClickedElement?.classList?.contains('cds--switcher__item-link')) {
|
|
43
43
|
setExpandedState(false);
|
|
44
44
|
setLastClickedElement(null);
|
|
45
45
|
if (expanded) {
|
|
@@ -57,12 +57,23 @@ const Switcher = /*#__PURE__*/React__default.forwardRef(function Switcher(props,
|
|
|
57
57
|
const switcherItem = switcherRef.current.children[nextValidIndex].children[0];
|
|
58
58
|
switcherItem?.focus();
|
|
59
59
|
};
|
|
60
|
-
const childrenWithProps = React__default.Children.toArray(children).map((child, index) =>
|
|
61
|
-
handleSwitcherItemFocus
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
const childrenWithProps = React__default.Children.toArray(children).map((child, index) => {
|
|
61
|
+
// handleSwitcherItemFocus should only be passed down if the child is a SwitcherItem
|
|
62
|
+
// SwitcherDivider, for example, does not accept a handleSwitcherItemFocus prop
|
|
63
|
+
if (child.type?.displayName === 'SwitcherItem') {
|
|
64
|
+
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
65
|
+
handleSwitcherItemFocus,
|
|
66
|
+
index,
|
|
67
|
+
key: index,
|
|
68
|
+
expanded
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
72
|
+
index,
|
|
73
|
+
key: index,
|
|
74
|
+
expanded
|
|
75
|
+
});
|
|
76
|
+
});
|
|
66
77
|
return /*#__PURE__*/React__default.createElement("ul", _extends({
|
|
67
78
|
ref: ref,
|
|
68
79
|
className: className
|
|
@@ -71,7 +71,7 @@ const TextArea = /*#__PURE__*/React__default["default"].forwardRef((props, forwa
|
|
|
71
71
|
if (!other.disabled && onChange) {
|
|
72
72
|
// delay textCount assignation to give the textarea element value time to catch up if is a controlled input
|
|
73
73
|
setTimeout(() => {
|
|
74
|
-
setTextCount(evt.target
|
|
74
|
+
setTextCount(evt.target?.value?.length);
|
|
75
75
|
}, 0);
|
|
76
76
|
onChange(evt);
|
|
77
77
|
}
|
|
@@ -49,7 +49,7 @@ const HeaderPanel = /*#__PURE__*/React__default["default"].forwardRef(function H
|
|
|
49
49
|
const eventHandlers = {};
|
|
50
50
|
if (addFocusListeners) {
|
|
51
51
|
eventHandlers.onBlur = event => {
|
|
52
|
-
if (!event.currentTarget.contains(event.relatedTarget) && !lastClickedElement
|
|
52
|
+
if (!event.currentTarget.contains(event.relatedTarget) && !lastClickedElement?.classList?.contains('cds--switcher__item-link')) {
|
|
53
53
|
setExpandedState(false);
|
|
54
54
|
setLastClickedElement(null);
|
|
55
55
|
if (expanded) {
|
|
@@ -67,12 +67,23 @@ const Switcher = /*#__PURE__*/React__default["default"].forwardRef(function Swit
|
|
|
67
67
|
const switcherItem = switcherRef.current.children[nextValidIndex].children[0];
|
|
68
68
|
switcherItem?.focus();
|
|
69
69
|
};
|
|
70
|
-
const childrenWithProps = React__default["default"].Children.toArray(children).map((child, index) =>
|
|
71
|
-
handleSwitcherItemFocus
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
const childrenWithProps = React__default["default"].Children.toArray(children).map((child, index) => {
|
|
71
|
+
// handleSwitcherItemFocus should only be passed down if the child is a SwitcherItem
|
|
72
|
+
// SwitcherDivider, for example, does not accept a handleSwitcherItemFocus prop
|
|
73
|
+
if (child.type?.displayName === 'SwitcherItem') {
|
|
74
|
+
return /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
75
|
+
handleSwitcherItemFocus,
|
|
76
|
+
index,
|
|
77
|
+
key: index,
|
|
78
|
+
expanded
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
82
|
+
index,
|
|
83
|
+
key: index,
|
|
84
|
+
expanded
|
|
85
|
+
});
|
|
86
|
+
});
|
|
76
87
|
return /*#__PURE__*/React__default["default"].createElement("ul", _rollupPluginBabelHelpers["extends"]({
|
|
77
88
|
ref: ref,
|
|
78
89
|
className: className
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/react",
|
|
3
3
|
"description": "React components for the Carbon Design System",
|
|
4
|
-
"version": "1.33.
|
|
4
|
+
"version": "1.33.2",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -137,5 +137,5 @@
|
|
|
137
137
|
"**/*.scss",
|
|
138
138
|
"**/*.css"
|
|
139
139
|
],
|
|
140
|
-
"gitHead": "
|
|
140
|
+
"gitHead": "292537f58efeb08051e3e32afd6c1a923c92060f"
|
|
141
141
|
}
|