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 ImageResize(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 15",
    fill: "none",
    height: sizeIcon,
    width: sizeIcon
  }, otherProps), /*#__PURE__*/React.createElement("path", {
    d: "M8.727 6.545h-8A.727.727 0 0 0 0 7.272v6.546c0 .402.326.727.727.727h8a.727.727 0 0 0 .728-.727V7.272a.727.727 0 0 0-.728-.727Zm-4.043 6.546 1.403-1.404a.218.218 0 0 1 .364 0l1.396 1.404H4.684ZM8 11.185l-.524-.516a1.753 1.753 0 0 0-2.421 0l-2.43 2.422h-1.17V8H8v3.185ZM.727 1.535a.727.727 0 0 0 .626-.357.764.764 0 0 0-.088-.979.727.727 0 0 0-.538-.2A.727.727 0 0 0 0 .728V.8a.727.727 0 0 0 .727.734Zm5.753-.08h.138a.727.727 0 1 0 0-1.455H6.48a.727.727 0 1 0 0 1.454ZM.727 4.93a.727.727 0 0 0 .728-.728v-.16a.727.727 0 1 0-1.455 0v.16c0 .402.326.728.727.728ZM9.52 0h-.138a.727.727 0 0 0 0 1.454h.138A.727.727 0 0 0 9.52 0ZM3.57 1.454h.14A.727.727 0 1 0 3.71 0h-.14a.727.727 0 0 0 0 1.454ZM15.274 3.2a.727.727 0 0 0-.728.727v.153a.727.727 0 0 0 1.455 0v-.153a.727.727 0 0 0-.727-.727Zm-3.55 9.89h-.174a.727.727 0 1 0 0 1.455h.175a.727.727 0 1 0 0-1.454ZM15.2 0a.727.727 0 0 0-.655.727c.002.106.027.21.073.305A.727.727 0 0 0 16 .807v-.08A.793.793 0 0 0 15.2 0Zm.073 6.472a.727.727 0 0 0-.728.728v.16a.727.727 0 0 0 1.455 0V7.2a.727.727 0 0 0-.727-.728ZM12.429 0h-.138a.727.727 0 1 0 0 1.454h.138a.727.727 0 0 0 0-1.454Zm2.844 13.09a.675.675 0 0 0-.32.08.727.727 0 0 0-.408.648c0 .402.326.727.728.727a.793.793 0 0 0 .727-.8.727.727 0 0 0-.727-.654Zm0-3.316a.727.727 0 0 0-.728.728v.16a.727.727 0 0 0 1.455 0v-.19a.727.727 0 0 0-.727-.727v.03Z",
    fill: "currentColor"
  }));
}

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