import { clsx } from 'clsx';
import { cloneElement } from 'react';
import Body from '../body/Body.mjs';
import { typeClassMap, priorityClassMap } from '../button/classMap.mjs';
import '../common/theme.mjs';
import '../common/direction.mjs';
import { Priority, ControlType } from '../common/propsValues/control.mjs';
import { Breakpoint } from '../common/propsValues/breakpoint.mjs';
import '../common/propsValues/size.mjs';
import { Typography } from '../common/propsValues/typography.mjs';
import '../common/propsValues/width.mjs';
import '../common/propsValues/type.mjs';
import '../common/propsValues/dateMode.mjs';
import '../common/propsValues/monthFormat.mjs';
import '../common/propsValues/position.mjs';
import '../common/propsValues/layouts.mjs';
import '../common/propsValues/status.mjs';
import '../common/propsValues/sentiment.mjs';
import '../common/propsValues/profileType.mjs';
import '../common/propsValues/variant.mjs';
import '../common/propsValues/scroll.mjs';
import '../common/propsValues/markdownNodeType.mjs';
import '../common/fileType.mjs';
import '@transferwise/icons';
import 'react-intl';
import '../common/closeButton/CloseButton.messages.mjs';
import { jsxs, jsx } from 'react/jsx-runtime';
import Circle from '../common/circle/Circle.mjs';
import { useMedia } from '../common/hooks/useMedia.mjs';

const CircularButton = ({
  className,
  children,
  disabled,
  icon,
  priority = Priority.PRIMARY,
  type = ControlType.ACCENT,
  ...rest
}) => {
  const classes = clsx('btn np-btn', 'm-b-1', typeClassMap[type], priorityClassMap[priority]);
  const iconElement = Number(icon.props.size) !== 24 ? /*#__PURE__*/cloneElement(icon, {
    size: 24
  }) : icon;
  const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);
  return /*#__PURE__*/jsxs("label", {
    className: clsx('np-circular-btn', priority, type, disabled && 'disabled', className),
    children: [/*#__PURE__*/jsx(Circle, {
      as: "input"
      // @ts-expect-error it's input[type=button] element
      ,
      type: "button",
      size: isTinyViewport ? 72 : 56,
      "aria-label": children,
      className: classes,
      disabled: disabled,
      ...rest
    }), iconElement, /*#__PURE__*/jsx(Body, {
      as: "span",
      className: "np-circular-btn__label",
      type: Typography.BODY_DEFAULT_BOLD,
      children: children
    })]
  });
};

export { CircularButton as default };
//# sourceMappingURL=CircularButton.mjs.map
