import { ID, MaybeArray } from "../../types/index.mjs"; import { AtomProps } from "../Atom/Atom.vue.mjs"; import "../Atom/index.mjs"; import { RegistryContext } from "../../composables/createRegistry/index.mjs"; import { StandardSchemaV1 } from "../../composables/useRules/adapters/standard.mjs"; import { RuleAlias } from "../../composables/useRules/index.mjs"; import { FormValidationRule } from "../../composables/createForm/index.mjs"; import { InputState } from "../../composables/createInput/index.mjs"; import { MaybeRefOrGetter, Ref, ShallowRef } from "vue"; //#region src/components/Input/InputRoot.vue.d.ts /** Base validation trigger event */ type ValidateEvent = 'blur' | 'input' | 'submit'; /** When to trigger validation, with optional lazy/eager modifier */ type ValidateOn = ValidateEvent | 'lazy' | 'eager' | 'blur lazy' | 'input lazy' | 'submit lazy' | 'blur eager' | 'input eager' | 'submit eager' | 'lazy blur' | 'lazy input' | 'lazy submit' | 'eager blur' | 'eager input' | 'eager submit'; interface InputRootContext { /** Unique identifier */ readonly id: ID; /** Optional display label */ readonly label?: string; /** Form field name */ readonly name?: string; /** Input type */ readonly type: Readonly>; /** Associate with form by ID */ readonly form?: string; /** Whether this input is required */ readonly required?: boolean; /** ID for description element (aria-describedby) */ readonly descriptionId: string; /** ID for error element (aria-errormessage) */ readonly errorId: string; /** Registry of mounted Description sub-components */ descriptions: RegistryContext; /** Registry of mounted Error sub-components */ fieldErrors: RegistryContext; /** Whether a Description sub-component is mounted */ hasDescription: Readonly>; /** Whether an Error sub-component is mounted */ hasError: Readonly>; /** Current input value — write to update both v-model and validation */ value: Ref; /** Whether this input has content */ isDirty: Readonly>; /** Whether this input is focused */ isFocused: ShallowRef; /** Whether this input is disabled */ isDisabled: Readonly>; /** Whether this input is readonly */ isReadonly: Readonly>; /** Merged validation + manual error messages */ errors: Readonly>; /** Whether the field is valid (null = unvalidated, accounts for error prop) */ isValid: Readonly>; /** Whether the field value hasn't changed since mount/reset */ isPristine: Readonly>; /** Whether async validation is in progress */ isValidating: Readonly>; /** Validate the input */ validate: () => Promise; /** Reset the input to initial state */ reset: () => void; } interface InputRootProps extends AtomProps { /** Unique identifier (auto-generated if not provided) */ id?: ID; /** Optional display label */ label?: string; /** Form field name */ name?: string; /** Input type */ type?: string; /** Associate with form by ID */ form?: string; /** Disables this input */ disabled?: boolean | MaybeRefOrGetter; /** Makes this input readonly */ readonly?: boolean | MaybeRefOrGetter; /** Whether this input is required */ required?: boolean; /** Validation rules */ rules?: (FormValidationRule | RuleAlias | StandardSchemaV1)[]; /** When to trigger validation */ validateOn?: ValidateOn; /** Manual error state override — forces invalid regardless of validation */ error?: boolean; /** Manual error messages — merged with rule-based errors */ errorMessages?: MaybeArray; /** Namespace for context provision to children */ namespace?: string; /** Namespace for connecting to parent Form. Must match Form's namespace. */ formNamespace?: string; } interface InputRootSlotProps { /** Unique identifier */ id: ID; /** Optional display label */ label?: string; /** Current input value */ value: string; /** Whether this input has content */ isDirty: boolean; /** Whether this input is focused */ isFocused: boolean; /** Merged error messages */ errors: string[]; /** Whether the field is valid */ isValid: boolean | null; /** Whether the field value hasn't changed */ isPristine: boolean; /** Whether async validation is in progress */ isValidating: boolean; /** Whether this input is disabled */ isDisabled: boolean; /** Whether this input is readonly */ isReadonly: boolean; /** Validate the input */ validate: () => Promise; /** Reset the input */ reset: () => void; /** Attributes to bind to the root element */ attrs: { 'data-state': InputState; 'data-dirty': true | undefined; 'data-focused': true | undefined; 'data-disabled': true | undefined; 'data-readonly': true | undefined; }; } declare const useInputRoot: (key: string, defaultValue?: InputRootContext | undefined) => InputRootContext, provideInputRoot: (key: string, context: InputRootContext, app?: import("vue").App) => InputRootContext; /** Parsed form of a `validateOn` expression */ interface ParsedValidateOn { event: ValidateEvent; modifier?: 'lazy' | 'eager'; } /** * Parse a `validateOn` expression into its event and modifier parts. * Unknown tokens are ignored; the event defaults to `'blur'`. */ declare function parseValidateOn(value: ValidateOn): ParsedValidateOn; declare const _default: typeof __VLS_export; declare const __VLS_export: __VLS_WithSlots any; "update:model-value": (value: string) => any; "update:focused": (...args: unknown[]) => any; }, string, import("vue").PublicProps, Readonly & Readonly<{ "onUpdate:modelValue"?: ((value: string) => any) | undefined; "onUpdate:model-value"?: ((value: string) => any) | undefined; "onUpdate:focused"?: ((...args: unknown[]) => any) | undefined; }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, { default: (props: InputRootSlotProps) => any; }>; type __VLS_WithSlots = T & { new (): { $slots: S; }; }; //#endregion export { InputRootContext, InputRootProps, InputRootSlotProps, ParsedValidateOn, ValidateEvent, ValidateOn, _default as default, parseValidateOn, provideInputRoot, useInputRoot };