import React__default from 'react';
import classnames from 'classnames';

var styles = {"ProgressBar":"p9AgTzIbTwY-","SteppedProgressBar":"w8NAw4ZMB6g-","wrapper":"d4oS-DGtcKA-","spinning":"f58JiDXlkHA-"};

var sizes = {"smaller":"dylWWgubHwM-","small":"z92YJQrscvI-","base":"DKfNM1to61A-","spinning":"GHfs7cB4nQQ-"};

function ProgressBarStepped({ currentStep, totalSteps, percentage, size = "base", UNSAFE_className, UNSAFE_style, }) {
    const steppedProgressBarClassName = classnames(styles.ProgressBar, styles.SteppedProgressBar, sizes[size]);
    const ariaLabel = `progress, ${currentStep} out of ${totalSteps}`;
    return (React__default.createElement("div", { role: "progressbar", className: classnames(styles.wrapper, UNSAFE_className), "data-testid": "progressbar-wrapper", style: UNSAFE_style, "aria-valuenow": percentage, "aria-valuetext": ariaLabel }, Array.from({ length: totalSteps }).map((_, index) => {
        const step = index + 1;
        const value = step <= currentStep ? 100 : 0;
        return (React__default.createElement("progress", { key: step, className: steppedProgressBarClassName, value: value, "data-testid": "progress-step" },
            value,
            "%"));
    })));
}

/**
 * @deprecated Use `ProgressIndicator` from
 * `@jobber/components/ProgressIndicator` instead.
 */
function ProgressBar({ currentStep, totalSteps, size = "base", variation = "progress", UNSAFE_className, UNSAFE_style, }) {
    const percentage = (currentStep / totalSteps) * 100;
    const progressBarClassName = classnames(styles.ProgressBar, sizes[size]);
    if (variation === "stepped") {
        return (React__default.createElement(ProgressBarStepped, { currentStep: currentStep, totalSteps: totalSteps, percentage: percentage, size: size, UNSAFE_className: UNSAFE_className, UNSAFE_style: UNSAFE_style }));
    }
    return (React__default.createElement("progress", { className: classnames(progressBarClassName, UNSAFE_className), style: UNSAFE_style, max: totalSteps, value: currentStep },
        percentage,
        "%"));
}

export { ProgressBar as P };
