'use strict';

var icons = require('@transferwise/icons');
var clsx = require('clsx');
var Circle = require('../common/circle/Circle.js');
var useMedia = require('../common/hooks/useMedia.js');
var jsxRuntime = require('react/jsx-runtime');
var breakpoint = require('../common/propsValues/breakpoint.js');
var size = require('../common/propsValues/size.js');

const iconTypeMap = {
  positive: icons.Check,
  neutral: icons.Info,
  warning: icons.Alert,
  negative: icons.Cross,
  pending: icons.ClockBorderless,
  info: icons.Info,
  error: icons.Cross,
  success: icons.Check
};
const mapLegacySize = {
  [String(size.Size.SMALL)]: 16,
  [String(size.Size.MEDIUM)]: 40,
  [String(size.Size.LARGE)]: 48
};
const StatusIcon = ({
  sentiment = 'neutral',
  size: sizeProp = 'md'
}) => {
  const Icon = iconTypeMap[sentiment];
  const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';
  const isTinyViewport = useMedia.useMedia(`(max-width: ${breakpoint.Breakpoint.ZOOM_400}px)`);
  const size$1 = sizeProp === size.Size.SMALL && isTinyViewport ? 32 : mapLegacySize[sizeProp];
  return /*#__PURE__*/jsxRuntime.jsx(Circle, {
    as: "span",
    size: size$1,
    "data-testid": "status-icon",
    className: clsx.clsx('status-circle', `status-circle-${sizeProp}`, sentiment),
    children: /*#__PURE__*/jsxRuntime.jsx(Icon, {
      className: clsx.clsx('status-icon', iconColor)
    })
  });
};

module.exports = StatusIcon;
//# sourceMappingURL=StatusIcon.js.map
