import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
//  strict
import PropTypes from 'prop-types';
import * as React from 'react';
import styled from 'styled-components';
import injectE2E from '../../Tools/injectE2E';
import { prop, theme } from '../../Tools/interpolation';

var getTextTransform = function getTextTransform(props) {
  if (props.capitalize === true) {
    return 'capitalize';
  }

  if (props.uppercase === true) {
    return 'uppercase';
  }

  return 'none';
};

var Wrapper =
/*#__PURE__*/
styled.a.attrs(injectE2E).withConfig({
  componentId: "sc-1r996ns-0"
})(["\n  font-family: ", ";\n  font-weight: ", ";\n  font-size: ", ";\n  text-transform: ", ";\n  font-style: ", ";\n  color: ", ";\n  opacity: ", ";\n  cursor: pointer;\n  text-decoration: none;\n\n  &:hover {\n    color: ", ";\n    text-decoration: none;\n  }\n"], theme('fontPrimary'), prop('weight'), prop('size'), getTextTransform, function (props) {
  return props.italic === true ? 'italic' : 'normal';
}, theme('linkColor'), prop('opacity'), theme('linkHoverColor'));

var Link = function Link(_ref) {
  var children = _ref.children,
      rest = _objectWithoutProperties(_ref, ["children"]);

  return React.createElement(Wrapper, rest, children);
};

Link.propTypes = process.env.NODE_ENV !== "production" ? {
  capitalize: PropTypes.bool,
  children: PropTypes.node,
  e2e: PropTypes.string,
  italic: PropTypes.bool,
  opacity: PropTypes.number,
  size: PropTypes.string,
  uppercase: PropTypes.bool,
  weight: PropTypes.oneOf([100, 200, 300, 400, 500, 600, 700])
} : {};
Link.defaultProps = {
  capitalize: false,
  e2e: 'defaultLink',
  italic: false,
  opacity: 1,
  size: '1rem',
  uppercase: false,
  weight: 400
};
export default Link;