import { ID, MaybeArray } from "../../types/index.mjs"; import { RegistryContext } from "../createRegistry/index.mjs"; import { StandardSchemaV1 } from "../useRules/adapters/standard.mjs"; import { RuleAlias } from "../useRules/index.mjs"; import { FormValidationRule } from "../createForm/index.mjs"; import { MaybeRefOrGetter, Ref, ShallowRef } from "vue"; //#region src/composables/createInput/index.d.ts /** Visual state of the input for styling purposes. */ type InputState = 'pristine' | 'valid' | 'invalid'; interface InputOptions { /** Value source — caller owns this ref. */ value: Ref; /** Unique identifier (auto-generated if omitted). */ id?: ID; /** Display label. */ label?: string; /** Form field name. */ name?: string; /** Associate with form by ID. */ form?: string; /** * Form injection key. Must match the parent Form's `namespace`. * * @default 'v0:form' */ formNamespace?: string; /** * Whether required. When true, a presence rule is registered so Form * submit fails on empty values even with `novalidate`. */ required?: boolean; /** Disabled state. */ disabled?: MaybeRefOrGetter; /** Readonly state. */ readonly?: MaybeRefOrGetter; /** Validation rules. */ rules?: (FormValidationRule | RuleAlias | StandardSchemaV1)[]; /** Manual error state override — forces invalid. */ error?: MaybeRefOrGetter; /** Manual error messages — merged with rule-based errors. */ errorMessages?: MaybeRefOrGetter | undefined>; /** Predicate for "has content". */ dirty?: (value: T) => boolean; /** Equality check for pristine tracking. @default === */ equals?: (a: T, b: T) => boolean; } interface InputContext { readonly id: ID; readonly label?: string; readonly name?: string; readonly form?: string; readonly required?: boolean; readonly descriptionId: string; readonly errorId: string; descriptions: RegistryContext; fieldErrors: RegistryContext; hasDescription: Readonly>; hasError: Readonly>; value: Ref; isDirty: Readonly>; isFocused: ShallowRef; isDisabled: Readonly>; isReadonly: Readonly>; isPristine: Readonly>; isTouched: ShallowRef; errors: Readonly>; isValid: Readonly>; isValidating: Readonly>; validate: () => Promise; reset: () => void; state: Readonly>; } declare function createInput(options: InputOptions): InputContext; //#endregion export { InputContext, InputOptions, InputState, createInput };