UNPKG

gov-gui

Version:

Gov UI Component Library Typscript Build

58 lines (57 loc) 2.22 kB
import { EventEmitter } from '../../stencil-public-runtime'; import { GlobalProps } from '../../global/global-styles-helper'; import { AnimationProps } from '../../global/animation-helpers'; export declare class GovStepper implements GlobalProps, AnimationProps { el: HTMLElement; currentStep: number; steps: string[]; isSubmitting: boolean; submitStatus: 'idle' | 'success' | 'error'; stepErrorMessage: string; variant: 'horizontal' | 'vertical'; validateStep: (step: number) => Promise<boolean> | boolean; onSubmit: () => Promise<void>; nextText: string; prevText: string; submitText: string; resetOnSubmit: boolean; maxStepsVisible: number; stepChanged: EventEmitter<number>; stepSubmitted: EventEmitter<Record<string, string>>; stepError: EventEmitter<Error>; animation?: string; animationDelay?: '2s' | '3s' | '4s' | '5s'; animationSpeed?: 'slow' | 'slower' | 'fast' | 'faster'; private allClasses; handleStepChange(newValue: number): void; watchAnimations(): void; watchAnimationsDelay(): void; watchAnimationsSpeed(): void; componentWillLoad(): void; provideClass(): void; private handleStepTransition; private handleSubmit; /** * Helper: Returns the current value from a custom component. * For gov-input and gov-radiobutton, it attempts to use the public 'value' property; * for gov-checkbox, it returns the public 'checked' property. */ private getValueFromComponent; /** * Collects input data from all custom components (gov-input, gov-radiobutton, gov-checkbox) * present in the stepper. */ private collectInputData; /** * Validates all required fields within the current step. * This queries for custom elements marked with [required] and uses the helper function * to determine if they have a non-empty value (or are checked, for checkboxes). * If there are validation errors, an error message is stored in `stepErrorMessage`. */ private areInputsValid; /** * Resets all custom input components by calling their reset() method, if available. */ private resetInputs; render(): any; }