'use strict';

var icons = require('@transferwise/icons');
var clsx = require('clsx');
var reactIntl = require('react-intl');
var Link_messages = require('./Link.messages.js');
var jsxRuntime = require('react/jsx-runtime');

const Link = ({
  className,
  children,
  href,
  target,
  type,
  'aria-label': ariaLabel,
  onClick,
  ...props
}) => {
  const isBlank = target === '_blank';
  const {
    formatMessage
  } = reactIntl.useIntl();
  return /*#__PURE__*/jsxRuntime.jsxs("a", {
    href: href,
    target: target,
    className: clsx.clsx('np-link', type ? `np-text-${type}` : undefined, 'd-inline-flex', className),
    "aria-label": ariaLabel,
    rel: isBlank ? 'noreferrer' : undefined,
    onClick: onClick,
    ...props,
    children: [children, " ", isBlank && /*#__PURE__*/jsxRuntime.jsx(icons.NavigateAway, {
      title: formatMessage(Link_messages.opensInNewTab)
    })]
  });
};

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