import _extends from "@babel/runtime/helpers/extends";

/* eslint-disable max-len */
import React from "react";
import PropTypes from "prop-types";
import classnames from "classnames";
import makeStyles from "../styles/makeStyles";
import { getShades } from "../styles/colors";

var deprecationWarning = function deprecationWarning(message) {
  if (process.env.NODE_ENV === "development") {
    // eslint-disable-next-line no-console
    console.warn("[Clever-react]: ".concat(message));
  }
};

var getClasses = makeStyles(function (_ref) {
  var colors = _ref.cleverUI.colors;
  return {
    root: function root(_ref2) {
      var rotation = _ref2.rotation,
          padding = _ref2.padding,
          size = _ref2.size,
          color = _ref2.color,
          shade = _ref2.shade;
      var res = {
        color: colors[color] ? colors[color][shade] : color
      };

      if (rotation > 0) {
        res.transform = "rotate(".concat(rotation, "deg)");
      }

      if (padding > 0) {
        res.padding = "".concat(size * padding / 200, "px");
      }

      return res;
    }
  };
});
var shadesList = getShades();

function Discount(props) {
  var classes = getClasses(props);
  var size = props.size,
      padding = props.padding,
      className = props.className,
      onMouseEnter = props.onMouseEnter,
      onMouseLeave = props.onMouseLeave;
  var sizeIcon = size;
  var otherProps = {
    className: classnames(className, classes.root),
    onMouseEnter: onMouseEnter,
    onMouseLeave: onMouseLeave
  };

  if (padding) {
    deprecationWarning("The padding prop is deprecated, use a className for customization");
    sizeIcon = sizeIcon * (100 - padding) / 100;
  }

  return /*#__PURE__*/React.createElement("svg", _extends({
    viewBox: "0 0 16 16",
    fill: "none",
    height: sizeIcon,
    width: sizeIcon
  }, otherProps), /*#__PURE__*/React.createElement("path", {
    d: "m5.426 4.587.78.767 2.578-2.578a.6.6 0 0 1 .84.852L7.056 6.206l2.578 2.578a.6.6 0 0 1-.851.84L6.206 7.056l-.78.78a1.799 1.799 0 1 1-.839-.852l.767-.78-.779-.779a1.799 1.799 0 1 1 .851-.839Zm7.974 1.02a.6.6 0 0 1 .6.599v.6a.6.6 0 1 1-1.2 0 .6.6 0 0 1 0-1.2h.6ZM3.208 12.8a.6.6 0 1 1 0 1.199h-.6a.6.6 0 0 1-.6-.6v-.6a.6.6 0 0 1 1.2 0ZM13.4 14h-.6a.6.6 0 1 1 0-1.2.6.6 0 1 1 1.2 0v.6a.6.6 0 0 1-.6.6ZM9.204 5.606h1.199a.6.6 0 0 1 0 1.2h-1.2a.6.6 0 1 1 0-1.2ZM13.4 8.604a.6.6 0 0 1 .6.6v1.199a.6.6 0 0 1-1.2 0v-1.2a.6.6 0 0 1 .6-.599Zm-4.196 4.197h1.199a.6.6 0 1 1 0 1.199h-1.2a.6.6 0 1 1 0-1.2Zm-3.598 0h1.2a.6.6 0 1 1 0 1.199h-1.2a.6.6 0 1 1 0-1.2ZM4.227 9.024a.6.6 0 1 0-.72-.96.6.6 0 0 0 .72.96Zm-.42-4.617a.6.6 0 1 0 0-1.199.6.6 0 0 0 0 1.2Z",
    fill: "currentColor"
  }));
}

Discount.propTypes = {
  color: PropTypes.string,
  className: PropTypes.string,
  size: PropTypes.number,
  onMouseEnter: PropTypes.func,
  onMouseLeave: PropTypes.func,
  rotation: PropTypes.number,
  shade: PropTypes.oneOf(shadesList),
  padding: PropTypes.number
};
Discount.defaultProps = {
  color: "neutral",
  size: 24,
  className: "",
  rotation: 0,
  shade: 500,
  padding: 0,
  onMouseEnter: function onMouseEnter() {},
  onMouseLeave: function onMouseLeave() {}
};
export default Discount;