import type { ComputedRef, Ref } from 'vue'; import { useContextFactory } from '@robonen/vue'; export type StepperOrientation = 'horizontal' | 'vertical'; export type StepperDirection = 'ltr' | 'rtl'; export type StepperState = 'completed' | 'active' | 'inactive'; export interface StepperRootContext { /** Currently active step (1-based). */ value: Ref; /** Total registered items, tracked through the Collection. */ total: ComputedRef; /** Orientation of the stepper — drives arrow-key axis. */ orientation: Ref; /** Writing direction. */ direction: Ref; /** When `true`, steps must be completed in order. */ linear: Ref; /** Whether the whole stepper is disabled. */ disabled: Ref; goToStep: (step: number) => void; onTriggerKeyDown: (event: KeyboardEvent, el: HTMLElement) => void; } export interface StepperItemContext { step: Ref; state: Ref; disabled: Ref; focusable: Ref; titleId: string; descriptionId: string; } export const { inject: useStepperRootContext, provide: provideStepperRootContext, } = useContextFactory('stepper'); export const { inject: useStepperItemContext, provide: provideStepperItemContext, } = useContextFactory('stepper-item');