'use strict';

var icons = require('@transferwise/icons');
var clsx = require('clsx');
var React = require('react');
var reactIntl = require('react-intl');
var size = require('../propsValues/size.js');
var CloseButton_messages = require('./CloseButton.messages.js');
var jsxRuntime = require('react/jsx-runtime');

const CloseButton = /*#__PURE__*/React.forwardRef(function CloseButton({
  'aria-label': ariaLabel,
  size: size$1 = size.Size.MEDIUM,
  filled = false,
  className,
  onClick,
  isDisabled,
  testId
}, reference) {
  const intl = reactIntl.useIntl();
  ariaLabel ??= intl.formatMessage(CloseButton_messages.ariaLabel);
  const Icon = filled ? icons.CrossCircleFill : icons.Cross;
  return /*#__PURE__*/jsxRuntime.jsx("button", {
    ref: reference,
    type: "button",
    className: clsx.clsx('np-close-button', 'close btn-link', 'text-no-decoration', {
      'np-close-button--large': size$1 === size.Size.MEDIUM,
      'np-close-button--x-large': size$1 === size.Size.LARGE
    }, className),
    "aria-label": ariaLabel,
    "aria-disabled": isDisabled,
    disabled: isDisabled,
    "data-testid": testId,
    onClick: onClick,
    children: /*#__PURE__*/jsxRuntime.jsx(Icon, {
      size: size$1 === size.Size.SMALL ? 16 : 24
    })
  });
});

exports.CloseButton = CloseButton;
//# sourceMappingURL=CloseButton.js.map
