import { ScopedProps } from '@stepperize/react'; import { IconComponentType } from '../../utils/types'; import { StepperStatus } from '@viasat/beam-shared/components/stepper'; import { StepperProps } from './Stepper'; export interface Step { heading?: string; id: string; markerContent?: IconComponentType | number | string; status?: StepperStatus; body?: React.ReactNode | string; } export type Metadata = ScopedProps['initialMetadata']; /** * Stepper initialization config. */ export interface Config { /** * The id of the step to start with. */ initialStep?: string; /** * Optional server-driven metadata for steps. Use this to resume the stepper in a specific state. * The Metadata object is a map of step ids to metadata objects, used for handling the status of the steps - see the processMetadata function. * It can contain any additional data you want to associate with the step. */ initialMetadata?: Metadata; /** * If true, navigation is not restricted to immediate neighbors. */ skipSteps?: boolean; /** * A function to validate the current step before transitioning. */ validateStep?: (stepId: string) => Promise; } /** * Initialize a Stepper from your `steps` and `config`, then destructure the returned * `Stepper` component and helpers and render them: `const { Stepper, all, getStatus, * goToNextStep, goToPrevStep } = useBeamStepper(steps, config);` then render `` * with a `` per step (e.g. `all.map(s => )`) * and advance with `goToNextStep()` / `goToPrevStep()` / `goToStep(id)`. */ export declare const useBeamStepper: (steps: Step[], config: Config) => { utils: import('@stepperize/core').Utils; resetStepper: () => void; getStatus: (stepId: string) => any; goToStep: (stepId: string) => void; goToNextStep: () => void | null; goToPrevStep: () => void | null; all: Step[]; current: Step; isLast: boolean; isFirst: boolean; next: () => void; prev: () => void; get: (id: Id) => Extract; goTo: (id: string) => void; reset: () => void; beforeNext: (callback: () => Promise | boolean) => Promise | void; afterNext: (callback: () => Promise | void) => Promise | void; beforePrev: (callback: () => Promise | boolean) => Promise | void; afterPrev: (callback: () => Promise | void) => Promise | void; beforeGoTo: (id: string, callback: () => Promise | boolean) => Promise | void; afterGoTo: (id: string, callback: () => Promise | void) => Promise | void; when: (id: Id | [Id, ...boolean[]], whenFn: (step: Extract) => R1, elseFn?: ((step: Exclude) => R2) | undefined) => R1 | R2; switch: (when: import("@stepperize/core").Get.Switch) => R; match: (state: State, matches: import("@stepperize/core").Get.Switch) => R | null; metadata: Record; setMetadata: (id: string, values: M) => void; getMetadata: (id: string) => M; resetMetadata: (keepInitialMetadata?: boolean) => void; Stepper: { ({ children, ...props }: StepperProps): import("react/jsx-runtime").JSX.Element; Step: (props: import('./Stepper.Step').StepperStepProps) => import("react/jsx-runtime").JSX.Element; Marker: ({ children, status, "className": _className, "aria-label": ariaLabel, onClick, ...props }: import('./Stepper.Marker').StepperMarkerProps) => import("react/jsx-runtime").JSX.Element; Heading: ({ className: _className, children, onClick, ...props }: import('./Stepper.Heading').StepperStepProps) => import("react/jsx-runtime").JSX.Element; Body: import('react').FC, HTMLDivElement>, "ref">>; Context: import('react').Context; Provider: import('react').Provider; Statuses: { readonly Incomplete: "incomplete"; readonly Current: "current"; readonly Complete: "complete"; readonly Error: "error"; }; displayName: string; }; }; /** * This function processes the metadata for the steps in the stepper. * It initializes the status of each step based on the provided metadata and ensures that only one step is marked as "current". * The status of a step can be provided either on the step itself or in the metadata. The metadata takes precedence and it defaults to "incomplete". * If no step is marked as "current", the first step in the list will be set to "current". * If multiple steps are marked as "current", an error will be thrown. */ export declare const processMetadata: (steps: Step[], metadata?: NonNullable) => Record;