import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
import _Steps from "antd/es/steps";
var _excluded = ["style", "steps", "flag"];
import * as React from 'react';
import { useState, useEffect } from 'react';
import "./index.less";
var Step = _Steps.Step;
var description = 'This is a description.';
var item = [{
  title: 'Finished',
  description: description,
  icon: 'add'
}, {
  title: 'In Progress',
  description: description,
  subTitle: 'Left 00:00:08'
}, {
  title: 'Waiting',
  description: description
}];
var antSteps = function antSteps(_ref) {
  var style = _ref.style,
    steps = _ref.steps,
    flag = _ref.flag,
    otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
  var _useState = useState(item),
    items = _useState[0],
    setItems = _useState[1];
  useEffect(function () {
    setItems(steps);
  }, [steps]);
  var _useState2 = useState(''),
    ID = _useState2[0],
    setID = _useState2[1];
  useEffect(function () {
    setID("steps_" + uuid());
  }, []);
  return /*#__PURE__*/React.createElement(_Steps, _extends({
    id: ID
  }, otherProps, {
    style: _extends({}, style, {
      display: flag ? 'none' : ''
    })
  }), items === null || items === void 0 ? void 0 : items.map(function (item, index) {
    return /*#__PURE__*/React.createElement(Step, {
      title: item.title,
      description: item.description,
      subTitle: item.subTitle,
      key: index
    });
  }));
};
antSteps.displayName = 'antSteps';
export default antSteps;
export function uuid() {
  return (Math.random() * 1e6 >> 0).toString(36);
}