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 Image(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 22 24",
    fill: "none",
    height: sizeIcon,
    width: sizeIcon
  }, otherProps), /*#__PURE__*/React.createElement("path", {
    d: "M17.417 4H4.583a2.64 2.64 0 0 0-1.944.879A3.144 3.144 0 0 0 1.833 7v10c0 .796.29 1.559.806 2.121A2.64 2.64 0 0 0 4.583 20h12.834a2.64 2.64 0 0 0 1.944-.879A3.144 3.144 0 0 0 20.167 17V7a3.14 3.14 0 0 0-.806-2.121A2.639 2.639 0 0 0 17.417 4ZM4.583 18a.88.88 0 0 1-.648-.293A1.048 1.048 0 0 1 3.667 17v-2.42l3.025-3.29a.879.879 0 0 1 .641-.286c.24 0 .47.103.642.286l6.15 6.71H4.584Zm13.75-1c0 .265-.096.52-.268.707a.88.88 0 0 1-.648.293h-.706l-3.493-3.83.807-.88a.879.879 0 0 1 .642-.286c.24 0 .47.103.641.286l3.025 3.29V17Zm0-3.24-1.723-1.87a2.686 2.686 0 0 0-1.943-.853c-.725 0-1.421.305-1.944.853l-.806.88-2.64-2.88a2.686 2.686 0 0 0-1.944-.853c-.724 0-1.42.305-1.943.853l-1.723 1.87V7c0-.265.096-.52.268-.707A.88.88 0 0 1 4.583 6h12.834a.88.88 0 0 1 .648.293c.172.187.268.442.268.707v6.76Z",
    fill: "currentColor"
  }));
}

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