import { StepperTypeMap, BeforeNavigate } from '../types'; /** * Registers a before-leave interceptor for the current step. * * The stepper consults it before any move away from this step (`next` / `back` / `goto`) * and performs the move unless the interceptor returns `false`. * * - Declarative: return `false` to block; `true` / `undefined` proceeds. Do NOT call * `goNext`/`goBack`/`goTo` inside the interceptor — the stepper navigates for you. * - Runs before the move, so it is the place to both block and do something first * (e.g. validate then persist a draft). * - One interceptor per step; a later registration replaces the earlier one. * * The callback may be inline — the latest reference is read through a ref, so it is not a * dependency of the registration effect and does not need wrapping in `useCallback`. * * @example * ```tsx * const { setStepData } = useStepperHandlers(); * const form = useZodForm({ schema }); * * useStepperBeforeNavigate(async action => { * if (action.type === 'next' && !(await form.trigger())) return false; // block when invalid * setStepData('company', form.getValues()); // persist on next / back / goto * }); * ``` */ declare function useStepperBeforeNavigate(interceptor: BeforeNavigate): void; export default useStepperBeforeNavigate;