import { InjectionKey, Ref } from 'vue';
import { RuleItem } from 'async-validator';
import { ComponentSize } from '../../../xiaoye-primitives/index.js';
import { FormProp } from './utils.js';
export type FormTrigger = "blur" | "change";
export type ValidateState = "idle" | "validating" | "success" | "error";
export interface XyFormRule extends RuleItem {
    required?: boolean;
    trigger?: FormTrigger | FormTrigger[];
}
export type FormRules = Record<string, XyFormRule[]>;
export interface FormFieldContext {
    prop?: string;
    propKey?: string;
    element?: HTMLElement | null;
    validate: (trigger?: FormTrigger) => Promise<boolean>;
    clearValidate: () => void;
    resetField: () => void;
}
export interface FormProps {
    model: Record<string, unknown>;
    rules?: FormRules;
    labelWidth?: string | number;
    labelPosition?: "left" | "top";
    size?: ComponentSize;
    inline?: boolean;
    disabled?: boolean;
    scrollToError?: boolean;
    validateOnRuleChange?: boolean;
}
export interface FormContext {
    props: FormProps;
    addField: (field: FormFieldContext) => void;
    removeField: (field: FormFieldContext) => void;
    resetFields: (props?: FormProp | FormProp[]) => void;
}
export interface FormInstance {
    validate: () => Promise<boolean>;
    validateField: (prop?: FormProp | FormProp[], trigger?: FormTrigger) => Promise<boolean>;
    resetFields: (prop?: FormProp | FormProp[]) => void;
    clearValidate: (prop?: FormProp | FormProp[]) => void;
}
export interface FormItemContext {
    prop?: FormProp;
    inputId: string;
    messageId: string;
    message: Ref<string>;
    validateState: Ref<ValidateState>;
    disabled: Ref<boolean>;
    validate: (trigger?: FormTrigger) => Promise<boolean>;
    clearValidate: () => void;
}
export declare const formKey: InjectionKey<FormContext>;
export declare const formItemKey: InjectionKey<FormItemContext>;
