@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.mjs CHANGED
@@ -4867,11 +4867,27 @@ function InlineAlert({
4867
4867
  return null;
4868
4868
  }
4869
4869
  };
4870
+ const hasTextChildren = content => {
4871
+ let label = '';
4872
+ const fillLabel = childrenNodes => {
4873
+ React__default.Children.map(childrenNodes, child => {
4874
+ if (typeof child === 'string') {
4875
+ label += child;
4876
+ }
4877
+ if (typeof child === 'object' && /*#__PURE__*/React__default.isValidElement(child)) {
4878
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
4879
+ fillLabel(child?.props?.children);
4880
+ }
4881
+ });
4882
+ };
4883
+ fillLabel(content);
4884
+ return !!label.length;
4885
+ };
4870
4886
  return /*#__PURE__*/jsxs("div", {
4871
4887
  role: "alert",
4872
4888
  id: id,
4873
4889
  className: classNames('alert alert-detach', `alert-${[Sentiment.NEGATIVE, Sentiment.ERROR].includes(type) ? 'danger' : type}`, className),
4874
- children: [getStatusIcon(type), /*#__PURE__*/jsx("div", {
4890
+ children: [hasTextChildren(children) && getStatusIcon(type), /*#__PURE__*/jsx("div", {
4875
4891
  children: children
4876
4892
  })]
4877
4893
  });