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 Balance(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 24 24",
    fill: "none",
    height: sizeIcon,
    width: sizeIcon
  }, otherProps), /*#__PURE__*/React.createElement("path", {
    d: "M22.964 13.823a.943.943 0 0 0-.028-.175l-2.305-6.137A2.995 2.995 0 0 0 22 5a1 1 0 0 0-2 0 1 1 0 0 1-1.882.473A2.894 2.894 0 0 0 15.54 4H13V3a1 1 0 0 0-2 0v1H8.46a2.893 2.893 0 0 0-2.578 1.473A1 1 0 0 1 4 5a1 1 0 0 0-2 0 2.995 2.995 0 0 0 1.369 2.511l-2.305 6.137a.949.949 0 0 0-.028.175A.95.95 0 0 0 1 14c0 .01.003.018.003.027 0 .013.003.025.004.039a3.994 3.994 0 0 0 7.986 0c.001-.014.004-.026.004-.039 0-.01.003-.018.003-.027a.95.95 0 0 0-.036-.177.949.949 0 0 0-.028-.175L6.629 7.504A2.99 2.99 0 0 0 7.643 6.42.917.917 0 0 1 8.46 6H11v14H8a1 1 0 0 0 0 2h8a1 1 0 0 0 0-2h-3V6h2.54a.917.917 0 0 1 .817.42c.242.44.59.814 1.014 1.084l-2.307 6.144a.952.952 0 0 0-.028.175A.95.95 0 0 0 15 14c0 .01.003.018.003.027 0 .013.003.025.004.039a3.994 3.994 0 0 0 7.986 0c.001-.014.004-.026.004-.039 0-.01.003-.018.003-.027a.943.943 0 0 0-.036-.177ZM5 8.856 6.556 13H3.444L5 8.856ZM6.723 15A2.023 2.023 0 0 1 5 16a2 2 0 0 1-1.731-1h3.454ZM19 8.856 20.556 13h-3.112L19 8.856ZM19 16a2 2 0 0 1-1.731-1h3.454A2.023 2.023 0 0 1 19 16Z",
    fill: "currentColor"
  }));
}

Balance.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
};
Balance.defaultProps = {
  color: "neutral",
  size: 24,
  className: "",
  rotation: 0,
  shade: 500,
  padding: 0,
  onMouseEnter: function onMouseEnter() {},
  onMouseLeave: function onMouseLeave() {}
};
export default Balance;