"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useStep = void 0;
const react_1 = require("react");
function useStep(steps, initialStepIndex = 0) {
    const [index, setIndex] = (0, react_1.useState)(initialStepIndex);
    return [
        steps[index],
        () => {
            setIndex(index => {
                if (index === steps.length - 1) {
                    return index;
                }
                else {
                    return index + 1;
                }
            });
        },
        () => {
            setIndex(index => {
                if (index === 0) {
                    return index;
                }
                else {
                    return index - 1;
                }
            });
        }
    ];
}
exports.useStep = useStep;
//# sourceMappingURL=use-step.js.map