UNPKG

@kubit-ui-web/react-components

Version:

Kubit React Components is a customizable, accessible library of React web components, designed to enhance your application's user experience

26 lines 922 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.mapToStepState = void 0; const state_1 = require("../types/state"); const mapToStepState = (steps, currentStep) => { if (!steps?.length) { return []; } const currentStepInBounds = Math.max(0, Math.min(currentStep, steps.length)); const res = steps?.reduce((prev, current, index) => { const isCompleted = index < currentStepInBounds ? state_1.StepperNumberStateType.COMPLETED : state_1.StepperNumberStateType.INACTIVE; const stateStep = index === currentStepInBounds ? state_1.StepperNumberStateType.ACTIVE : isCompleted; return [ ...prev, { name: current, state: stateStep, }, ]; }, []); return res; }; exports.mapToStepState = mapToStepState; //# sourceMappingURL=stepState.js.map