@transferwise/components 0.0.0-experimental-1d9df7f → 0.0.0-experimental-a44fd6f
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/build/index.js +17 -1
- package/build/index.js.map +1 -1
- package/build/index.mjs +17 -1
- package/build/index.mjs.map +1 -1
- package/build/types/inlineAlert/InlineAlert.d.ts +2 -2
- package/build/types/inlineAlert/InlineAlert.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/inlineAlert/InlineAlert.tsx +23 -2
package/build/index.js
CHANGED
|
@@ -4896,11 +4896,27 @@ function InlineAlert({
|
|
|
4896
4896
|
return null;
|
|
4897
4897
|
}
|
|
4898
4898
|
};
|
|
4899
|
+
const hasTextChildren = content => {
|
|
4900
|
+
let label = '';
|
|
4901
|
+
const fillLabel = childrenNodes => {
|
|
4902
|
+
React__namespace.default.Children.map(childrenNodes, child => {
|
|
4903
|
+
if (typeof child === 'string') {
|
|
4904
|
+
label += child;
|
|
4905
|
+
}
|
|
4906
|
+
if (typeof child === 'object' && /*#__PURE__*/React__namespace.default.isValidElement(child)) {
|
|
4907
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
4908
|
+
fillLabel(child?.props?.children);
|
|
4909
|
+
}
|
|
4910
|
+
});
|
|
4911
|
+
};
|
|
4912
|
+
fillLabel(content);
|
|
4913
|
+
return !!label.length;
|
|
4914
|
+
};
|
|
4899
4915
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4900
4916
|
role: "alert",
|
|
4901
4917
|
id: id,
|
|
4902
4918
|
className: classNames__default.default('alert alert-detach', `alert-${[exports.Sentiment.NEGATIVE, exports.Sentiment.ERROR].includes(type) ? 'danger' : type}`, className),
|
|
4903
|
-
children: [getStatusIcon(type), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4919
|
+
children: [hasTextChildren(children) && getStatusIcon(type), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4904
4920
|
children: children
|
|
4905
4921
|
})]
|
|
4906
4922
|
});
|