'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var clsx = require('clsx');
var React = require('react');
var theme = require('../common/theme.js');
require('../common/direction.js');
require('../common/propsValues/control.js');
require('../common/propsValues/breakpoint.js');
require('../common/propsValues/size.js');
require('../common/propsValues/typography.js');
require('../common/propsValues/width.js');
require('../common/propsValues/type.js');
require('../common/propsValues/dateMode.js');
require('../common/propsValues/monthFormat.js');
require('../common/propsValues/position.js');
require('../common/propsValues/layouts.js');
require('../common/propsValues/status.js');
require('../common/propsValues/sentiment.js');
require('../common/propsValues/profileType.js');
require('../common/propsValues/variant.js');
require('../common/propsValues/scroll.js');
require('../common/propsValues/markdownNodeType.js');
require('../common/fileType.js');
var colors = require('../common/colors.js');
require('@transferwise/icons');
require('react-intl');
require('../common/closeButton/CloseButton.messages.js');
var jsxRuntime = require('react/jsx-runtime');

const backwardsCompatibleSize = size => {
  switch (size) {
    case 'sm':
      return 24;
    case 'md':
      return 48;
    case 'lg':
      return 72;
    default:
      return size;
  }
};
/**
 * @deprecated Use `AvatarView` component instead
 */
const Avatar = ({
  backgroundColor = null,
  backgroundColorSeed = null,
  children = null,
  className,
  outlined = false,
  size: sizeFromProps = 48,
  theme: theme$1 = theme.Theme.LIGHT,
  type = 'thumbnail',
  'aria-label': ariaLabel
}) => {
  const backgroundColorFromSeed = React.useMemo(() => !backgroundColor && backgroundColorSeed ? colors.getBrandColorFromSeed(backgroundColorSeed) : undefined, [backgroundColor, backgroundColorSeed]);
  const size = backwardsCompatibleSize(sizeFromProps);
  return /*#__PURE__*/jsxRuntime.jsx("div", {
    className: clsx.clsx('tw-avatar', className, `tw-avatar--${size}`, `tw-avatar--${type}`, {
      'tw-avatar--outlined': outlined,
      'tw-avatar--branded': Boolean(backgroundColorFromSeed),
      'np-text-title-body': type === 'initials'
    }),
    "aria-label": ariaLabel,
    children: /*#__PURE__*/jsxRuntime.jsx("div", {
      className: "tw-avatar__content",
      style: {
        backgroundColor: backgroundColor || backgroundColorFromSeed
      },
      children: children
    })
  });
};

exports.default = Avatar;
//# sourceMappingURL=Avatar.js.map
