import React, { useMemo, forwardRef } from "react";
import classnames from "classnames";
import { StyledStep, StyledSteps } from "./Styles";
export const Steps = /*#__PURE__*/forwardRef((_ref, ref) => {
  let {
    numberOfSteps,
    activeStep,
    progressive = false,
    wrapperClassName
  } = _ref;
  const steps = useMemo(() => {
    // fastest way to generate an array of N numbers
    const a = [];
    let b = numberOfSteps;
    while (b--) {
      a[b] = b + 1;
    }
    return a;
  }, [numberOfSteps]);
  const activeSteps = useMemo(() => {
    if (!progressive) {
      return [activeStep];
    }
    return steps.filter(step => {
      return step <= activeStep;
    });
  }, [activeStep, progressive, steps]);
  return /*#__PURE__*/React.createElement(StyledSteps, {
    className: classnames("c-steps-wrapper", wrapperClassName),
    ref: ref
  }, steps.map(step => {
    return /*#__PURE__*/React.createElement(StyledStep, {
      key: "step-" + step,
      $isActiveStep: activeSteps.indexOf(step) > -1
    });
  }));
});
Steps.displayName = "Steps";
//# sourceMappingURL=Steps.js.map