import _extends from "@babel/runtime/helpers/extends";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["children", "className", "fontVariant", "color", "shade", "to", "target", "onClick", "disabled"];
import React from "react";
import PropTypes from "prop-types";
import classnames from "classnames";
import { getColorsLabels, getShades } from "../styles/colors";
import getClasses from "./styles";
var colorsList = getColorsLabels(true);
var shadesList = getShades();
var CleverLink = /*#__PURE__*/React.forwardRef(function (props, ref) {
  var children = props.children,
      classNameProp = props.className,
      fontVariant = props.fontVariant,
      color = props.color,
      shade = props.shade,
      to = props.to,
      target = props.target,
      onClick = props.onClick,
      disabled = props.disabled,
      htmlProps = _objectWithoutProperties(props, _excluded);

  var classes = getClasses({
    color: color,
    shade: shade,
    fontVariant: fontVariant
  });
  var className = classnames(classes.root, classNameProp, _defineProperty({}, classes.disabled, disabled));

  if (to) {
    return /*#__PURE__*/React.createElement("a", _extends({
      ref: ref,
      href: to,
      className: className,
      target: target,
      "aria-disabled": disabled
    }, htmlProps), children);
  }

  return /*#__PURE__*/React.createElement("button", _extends({
    ref: ref,
    type: "button",
    className: className,
    onClick: onClick,
    disabled: disabled
  }, htmlProps), children);
});
CleverLink.propTypes = {
  className: PropTypes.string,
  to: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
  target: PropTypes.string,
  // TODO: Change for dynamic list
  fontVariant: PropTypes.oneOf(["title", "subtitle", "title2", "paragraph", "inputText", "label", "small", "smallItalic", "caption"]),
  onClick: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
  disabled: PropTypes.bool,
  color: PropTypes.oneOf(colorsList),
  shade: PropTypes.oneOf(shadesList)
};
CleverLink.defaultProps = {
  disabled: false,
  color: "blue",
  shade: 500
};
export default CleverLink;