import type { ReactElement } from 'react'; import type { StepDetails } from '../stepper-types.js'; import type { StepperInvalidStep, StepperNavigationPayload, StepperStepProps } from '../Stepper.types.js'; import type { StepData, StepStatus } from '../store/StepperStore.types.js'; /** * What the navigation logic needs to know about one step: its id, whether it * blocks Next while invalid (`required`) and whether it can be navigated to * (`disabled`). * * The flow is the ordered list of `Stepper.Step` elements that are rendered * right now. Steps can be conditional, so the flow changes between renders and * its order is the navigation order. Each entry describes one step of the flow. * The store keeps a step's values and status even after the step left the flow. * @internal */ export type StepFlowEntry = Pick & Required>; /** * Builds the flow from the rendered `Stepper.Step` elements. The result has the * same order as `elements` and applies the defaults `required = true` and * `disabled = false`. It is derived from props on every render, never stored. * @internal */ export declare function getStepFlowEntries(elements: ReadonlyArray>): StepFlowEntry[]; /** * Whether the step is in the flow and not disabled. * @internal */ export declare function isStepEnabled(entries: readonly StepFlowEntry[], stepId: string): boolean; /** * The step id a handler returned, or `undefined` when it returned anything else. * @internal */ export declare function toReturnedStepId(returned: unknown): string | undefined; /** * Payload for `onNext`, `onBack` and `onStepSelected`. * @internal */ export declare function buildNavigationPayload>(entries: readonly StepFlowEntry[], steps: Readonly>, from: string, to: string): StepperNavigationPayload; /** * Step to fall back to when the current one is not in the flow: `defaultStepId` * when it is in the flow, otherwise the first step. * @internal */ export declare function getFallbackStepId(stepIds: readonly string[], defaultStepId: string | undefined): string; /** * Next step after `currentId` that is not disabled, or `undefined` when none follows. * @internal */ export declare function getNextEnabledStepId(entries: readonly StepFlowEntry[], currentId: string): string | undefined; /** * Nearest step before `currentId` that is not disabled, or `undefined` when none precedes. * @internal */ export declare function getPreviousEnabledStepId(entries: readonly StepFlowEntry[], currentId: string): string | undefined; /** * Whether the step's status is `'pending'`, whoever wrote it. * @internal */ export declare function isStepPending(steps: Record, stepId: string): boolean; /** * Whether Next must refuse: only a required step with an invalid status blocks. * @internal */ export declare function isNextBlocked(required: boolean, status: StepStatus | undefined): boolean; /** * Steps in the flow whose status is invalid, in navigation order. * @internal */ export declare function getInvalidSteps(entries: readonly StepFlowEntry[], steps: Readonly>): StepperInvalidStep[]; /** * Required, enabled steps that have never been the current step. * @internal */ export declare function getUnvisitedRequiredStepIds(entries: readonly StepFlowEntry[], visitedStepIds: readonly string[]): string[]; /** * Ids of the invalid steps the Stepper acts on itself, in navigation order. * Optional and disabled steps are left out: the app handles the first, the * user cannot reach the second. * @internal */ export declare function getBlockingStepIds(entries: readonly StepFlowEntry[], invalidSteps: readonly StepperInvalidStep[]): string[]; /** * Values of every step in the flow, keyed by step id. Steps that left the flow * contribute no key. * @internal */ export declare function getSnapshot(entries: readonly StepFlowEntry[], steps: Readonly>): Record; //# sourceMappingURL=step-flow.d.ts.map