import { NavigateAway } from '@transferwise/icons';
import { clsx } from 'clsx';
import { useIntl } from 'react-intl';
import messages from './Link.messages.mjs';
import { jsxs, jsx } from 'react/jsx-runtime';

const Link = ({
  className,
  children,
  href,
  target,
  type,
  'aria-label': ariaLabel,
  onClick,
  ...props
}) => {
  const isBlank = target === '_blank';
  const {
    formatMessage
  } = useIntl();
  return /*#__PURE__*/jsxs("a", {
    href: href,
    target: target,
    className: 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__*/jsx(NavigateAway, {
      title: formatMessage(messages.opensInNewTab)
    })]
  });
};

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