@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.mjs CHANGED
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import React__default, { forwardRef, useId, cloneElement, useState, useEffect, useRef, useMemo, Component, createContext, useContext, useSyncExternalStore, useCallback, useImperativeHandle, createElement, PureComponent, createRef, isValidElement, Children, Fragment as Fragment$1 } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
- import { ChevronUp, CrossCircleFill, Cross, Check, Info as Info$1, Alert as Alert$1, ClockBorderless, NavigateAway, Briefcase, Person, ArrowRight, Download, ChevronLeft, ChevronRight, AlertCircleFill, CheckCircleFill, ArrowLeft, QuestionMarkCircle, Search, CrossCircle, ChevronDown, ClockFill, Upload as Upload$2, Document, Plus, PlusCircle, Bin } from '@transferwise/icons';
5
+ import { ChevronUp, CrossCircleFill, Cross, Check, Info as Info$1, Alert as Alert$1, ClockBorderless, NavigateAway, Briefcase, Person, ArrowRight, Download, ChevronLeft, ChevronRight, AlertCircleFill, ArrowLeft, QuestionMarkCircle, Search, CrossCircle, ChevronDown, CheckCircleFill, ClockFill, Upload as Upload$2, Document, Plus, PlusCircle, Bin } from '@transferwise/icons';
6
6
  import { defineMessages, useIntl, injectIntl, IntlProvider } from 'react-intl';
7
7
  import commonmark from 'commonmark';
8
8
  import { useTheme, ThemeProvider } from '@wise/components-theming';
@@ -717,7 +717,7 @@ const StatusIcon = ({
717
717
  const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';
718
718
  return /*#__PURE__*/jsx("span", {
719
719
  "data-testid": "status-icon",
720
- className: classNames('status-circle', 'status-circle-' + size, sentiment),
720
+ className: classNames('status-circle', `status-circle-${size}`, sentiment),
721
721
  children: /*#__PURE__*/jsx(Icon, {
722
722
  className: classNames('status-icon', iconColor)
723
723
  })
@@ -4837,44 +4837,20 @@ function InlineAlert({
4837
4837
  className,
4838
4838
  children
4839
4839
  }) {
4840
- const getStatusIcon = sentiment => {
4841
- switch (sentiment) {
4842
- case Sentiment.POSITIVE:
4843
- case Sentiment.SUCCESS:
4844
- return /*#__PURE__*/jsx(CheckCircleFill, {});
4845
- case Sentiment.WARNING:
4846
- return /*#__PURE__*/jsx(AlertCircleFill, {});
4847
- case Sentiment.NEGATIVE:
4848
- case Sentiment.ERROR:
4849
- return /*#__PURE__*/jsx(CrossCircleFill, {});
4850
- default:
4851
- return null;
4852
- }
4853
- };
4854
- const hasTextChildren = content => {
4855
- let label = '';
4856
- const fillLabel = childrenNodes => {
4857
- React__default.Children.map(childrenNodes, child => {
4858
- if (typeof child === 'string') {
4859
- label += child;
4860
- }
4861
- if (typeof child === 'object' && /*#__PURE__*/React__default.isValidElement(child)) {
4862
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
4863
- fillLabel(child?.props?.children);
4864
- }
4865
- });
4866
- };
4867
- fillLabel(content);
4868
- return !!label.length;
4869
- };
4870
- return /*#__PURE__*/jsxs("div", {
4840
+ return /*#__PURE__*/jsx("div", {
4871
4841
  role: "alert",
4872
4842
  id: id,
4873
4843
  className: classNames('alert alert-detach', `alert-${[Sentiment.NEGATIVE, Sentiment.ERROR].includes(type) ? 'danger' : type}`, className),
4874
- children: [hasTextChildren(children) && getStatusIcon(type), /*#__PURE__*/jsx("div", {
4875
- className: "np-text-body-default",
4876
- children: children
4877
- })]
4844
+ children: /*#__PURE__*/jsxs("div", {
4845
+ className: "d-inline-flex",
4846
+ children: [type !== Sentiment.NEUTRAL && type !== Sentiment.PENDING && /*#__PURE__*/jsx(StatusIcon, {
4847
+ sentiment: type,
4848
+ size: Size.SMALL
4849
+ }), /*#__PURE__*/jsx("div", {
4850
+ className: "np-text-body-default",
4851
+ children: children
4852
+ })]
4853
+ })
4878
4854
  });
4879
4855
  }
4880
4856
 
@@ -4887,7 +4863,7 @@ const Label = ({
4887
4863
  return /*#__PURE__*/jsx("label", {
4888
4864
  id: id,
4889
4865
  htmlFor: htmlFor,
4890
- className: classNames('control-label d-flex flex-column gap-y-xs m-b-0', className),
4866
+ className: classNames('control-label d-flex flex-column gap-y-1 m-b-0', className),
4891
4867
  children: children
4892
4868
  });
4893
4869
  };