UNPKG

use-wizard

Version:

A dead-easy-to-use light-weight react hook to handle multi-paths wizards (and simple wizards too) and navigate into them.

25 lines 1.23 kB
"use strict"; var __spreadArrays = (this && this.__spreadArrays) || function () { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.nextStep = void 0; var isStepLastOfLasts_1 = require("./nextStep/isStepLastOfLasts"); var getNextStep_1 = require("./nextStep/getNextStep"); var nextStep = function (args) { return function () { args.setPoppedHistory([]); if (args.wizardType === "linearN") { return args.setHistory(function (ps) { return __spreadArrays(ps, [ps[ps.length - 1] + 1]); }); } if (isStepLastOfLasts_1.isStepLastOfLasts(args.options, args.history[args.history.length - 1])) { return console.log("Wizard warning: impossible to process nextStep(), you hit the last step"); } args.setHistory(function (ps) { return __spreadArrays(ps, [getNextStep_1.getNextStep(args.history[args.history.length - 1], args.options)]); }); return; }; }; exports.nextStep = nextStep; //# sourceMappingURL=nextStep.js.map