'use strict';

var clsx = require('clsx');
var React = require('react');
var Body = require('../body/Body.js');
var classMap = require('../button/classMap.js');
require('../common/theme.js');
require('../common/direction.js');
var control = require('../common/propsValues/control.js');
var breakpoint = require('../common/propsValues/breakpoint.js');
require('../common/propsValues/size.js');
var typography = 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');
require('@transferwise/icons');
require('react-intl');
require('../common/closeButton/CloseButton.messages.js');
var jsxRuntime = require('react/jsx-runtime');
var Circle = require('../common/circle/Circle.js');
var useMedia = require('../common/hooks/useMedia.js');

const CircularButton = ({
  className,
  children,
  disabled,
  icon,
  priority = control.Priority.PRIMARY,
  type = control.ControlType.ACCENT,
  ...rest
}) => {
  const classes = clsx.clsx('btn np-btn', 'm-b-1', classMap.typeClassMap[type], classMap.priorityClassMap[priority]);
  const iconElement = Number(icon.props.size) !== 24 ? /*#__PURE__*/React.cloneElement(icon, {
    size: 24
  }) : icon;
  const isTinyViewport = useMedia.useMedia(`(max-width: ${breakpoint.Breakpoint.ZOOM_400}px)`);
  return /*#__PURE__*/jsxRuntime.jsxs("label", {
    className: clsx.clsx('np-circular-btn', priority, type, disabled && 'disabled', className),
    children: [/*#__PURE__*/jsxRuntime.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__*/jsxRuntime.jsx(Body, {
      as: "span",
      className: "np-circular-btn__label",
      type: typography.Typography.BODY_DEFAULT_BOLD,
      children: children
    })]
  });
};

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