mithril-materialized
Version:
A materialize library for mithril.
59 lines (58 loc) • 2.04 kB
TypeScript
import { FactoryComponent, Attributes, Vnode } from 'mithril';
export interface WizardStep {
/** Unique identifier for the step */
id?: string;
/** Title of the step */
title: string;
/** Optional subtitle or description */
subtitle?: string;
/** Icon for the step (material icons) */
icon?: string;
/** Whether this step is optional */
optional?: boolean;
/** Whether this step is disabled */
disabled?: boolean;
/** Custom validation function */
validate?: () => boolean | Promise<boolean>;
/** Content to render for this step - function that returns vnode(s) */
vnode: () => Vnode<any, any> | Vnode<any, any>[];
}
export interface WizardAttrs extends Attributes {
/** Array of wizard steps */
steps: WizardStep[];
/** Current active step index */
currentStep?: number;
/** Callback when step changes */
onStepChange?: (stepIndex: number, stepId: string) => void;
/** Callback when wizard is completed */
onComplete?: () => void;
/** Whether to show step numbers */
showStepNumbers?: boolean;
/** Whether navigation is linear (cannot skip steps) */
linear?: boolean;
/** Custom class for the wizard container */
className?: string;
/** Whether to show navigation buttons */
showNavigation?: boolean;
/** Custom labels for navigation buttons */
labels?: {
next?: string;
previous?: string;
complete?: string;
skip?: string;
optional?: string;
};
/** Orientation of the stepper */
orientation?: 'horizontal' | 'vertical';
/** Whether to allow clicking on step headers to navigate */
allowHeaderNavigation?: boolean;
}
/**
* Wizard/Stepper Component
* A multi-step interface for guiding users through a process
*/
export declare const Wizard: FactoryComponent<WizardAttrs>;
/**
* Simple linear stepper for forms
*/
export declare const Stepper: FactoryComponent<Pick<WizardAttrs, 'steps' | 'currentStep' | 'onStepChange' | 'className'>>;