import _Progress from "@alifd/next/es/progress";
import _extends from "@babel/runtime/helpers/extends";
import _Icon from "@alifd/next/es/icon";
import _Box from "@alifd/next/es/box";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["percent", "shape", "size", "state", "progressive", "style", "backgroundColor", "color", "hasBorder", "content", "isContent", "isIcon", "iconSize", "iconColor", "fontSize"];
/* eslint-disable @typescript-eslint/no-shadow */
import * as React from 'react';
import "./index.scss";
var progress = function progress(_ref) {
  var percent = _ref.percent,
    shape = _ref.shape,
    size = _ref.size,
    state = _ref.state,
    progressive = _ref.progressive,
    _ref$style = _ref.style,
    style = _ref$style === void 0 ? {} : _ref$style,
    backgroundColor = _ref.backgroundColor,
    color = _ref.color,
    hasBorder = _ref.hasBorder,
    content = _ref.content,
    isContent = _ref.isContent,
    isIcon = _ref.isIcon,
    iconSize = _ref.iconSize,
    iconColor = _ref.iconColor,
    fontSize = _ref.fontSize,
    otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
  //  if(state){
  //      // eslint-disable-next-line no-alert
  //     alert(state)
  //  }

  var _style = style || {};
  var _otherProps = otherProps || {};
  _otherProps.style = _style;
  var textRender = function textRender(percent) {
    return isContent ? /*#__PURE__*/React.createElement(_Box, null, isIcon !== 'icon' ? /*#__PURE__*/React.createElement(_Box, null, percent, "%") : percent !== 100 ? null : /*#__PURE__*/React.createElement(_Icon, {
      type: "select",
      className: "boxIcon",
      style: {
        fontSize: iconSize + "px",
        color: "" + iconColor
      }
    }), /*#__PURE__*/React.createElement(_Box, {
      style: {
        fontSize: fontSize + "px",
        marginTop: '2px'
      }
    }, content)) : null;
  };
  return /*#__PURE__*/React.createElement(_Progress, _extends({
    percent: percent,
    shape: shape,
    size: size,
    state: state,
    progressive: progressive,
    backgroundColor: backgroundColor,
    color: color,
    hasBorder: hasBorder,
    textRender: textRender
  }, _otherProps));
};
progress.displayName = 'Progress';
export default progress;