@transferwise/components 0.0.0-experimental-e477c03 → 0.0.0-experimental-7709e0e

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 CHANGED
@@ -746,7 +746,7 @@ const StatusIcon = ({
746
746
  const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';
747
747
  return /*#__PURE__*/jsxRuntime.jsx("span", {
748
748
  "data-testid": "status-icon",
749
- className: classNames__default.default('status-circle', 'status-circle-' + size, sentiment),
749
+ className: classNames__default.default('status-circle', `status-circle-${size}`, sentiment),
750
750
  children: /*#__PURE__*/jsxRuntime.jsx(Icon, {
751
751
  className: classNames__default.default('status-icon', iconColor)
752
752
  })
@@ -4866,44 +4866,20 @@ function InlineAlert({
4866
4866
  className,
4867
4867
  children
4868
4868
  }) {
4869
- const getStatusIcon = sentiment => {
4870
- switch (sentiment) {
4871
- case exports.Sentiment.POSITIVE:
4872
- case exports.Sentiment.SUCCESS:
4873
- return /*#__PURE__*/jsxRuntime.jsx(icons.CheckCircleFill, {});
4874
- case exports.Sentiment.WARNING:
4875
- return /*#__PURE__*/jsxRuntime.jsx(icons.AlertCircleFill, {});
4876
- case exports.Sentiment.NEGATIVE:
4877
- case exports.Sentiment.ERROR:
4878
- return /*#__PURE__*/jsxRuntime.jsx(icons.CrossCircleFill, {});
4879
- default:
4880
- return null;
4881
- }
4882
- };
4883
- const hasTextChildren = content => {
4884
- let label = '';
4885
- const fillLabel = childrenNodes => {
4886
- React__namespace.default.Children.map(childrenNodes, child => {
4887
- if (typeof child === 'string') {
4888
- label += child;
4889
- }
4890
- if (typeof child === 'object' && /*#__PURE__*/React__namespace.default.isValidElement(child)) {
4891
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
4892
- fillLabel(child?.props?.children);
4893
- }
4894
- });
4895
- };
4896
- fillLabel(content);
4897
- return !!label.length;
4898
- };
4899
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
4869
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
4900
4870
  role: "alert",
4901
4871
  id: id,
4902
4872
  className: classNames__default.default('alert alert-detach', `alert-${[exports.Sentiment.NEGATIVE, exports.Sentiment.ERROR].includes(type) ? 'danger' : type}`, className),
4903
- children: [hasTextChildren(children) && getStatusIcon(type), /*#__PURE__*/jsxRuntime.jsx("div", {
4904
- className: "np-text-body-default",
4905
- children: children
4906
- })]
4873
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
4874
+ className: "d-inline-flex",
4875
+ children: [type !== exports.Sentiment.NEUTRAL && type !== exports.Sentiment.PENDING && /*#__PURE__*/jsxRuntime.jsx(StatusIcon, {
4876
+ sentiment: type,
4877
+ size: exports.Size.SMALL
4878
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
4879
+ className: "np-text-body-default",
4880
+ children: children
4881
+ })]
4882
+ })
4907
4883
  });
4908
4884
  }
4909
4885
 
@@ -4916,7 +4892,7 @@ const Label = ({
4916
4892
  return /*#__PURE__*/jsxRuntime.jsx("label", {
4917
4893
  id: id,
4918
4894
  htmlFor: htmlFor,
4919
- className: classNames__default.default('control-label d-flex flex-column gap-y-xs m-b-0', className),
4895
+ className: classNames__default.default('control-label d-flex flex-column gap-y-1 m-b-0', className),
4920
4896
  children: children
4921
4897
  });
4922
4898
  };