'use strict';

var clsx = require('clsx');
var React = require('react');
var Circle = require('../common/circle/Circle.js');
var jsxRuntime = require('react/jsx-runtime');
var colors = require('../common/colors.js');
var theme = require('../common/theme.js');

const backwardsCompatibleSize = size => {
  switch (size) {
    case 'sm':
      return 24;
    case 'md':
      return 48;
    case 'lg':
      return 72;
    default:
      return size;
  }
};
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(Circle, {
    size: size,
    fixedSize: true,
    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(Circle, {
      size: size,
      fixedSize: true,
      className: "tw-avatar__content",
      style: {
        backgroundColor: backgroundColor || backgroundColorFromSeed
      },
      children: children
    })
  });
};

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