diff --git a/src/runtime/components/Form.vue b/src/runtime/components/Form.vue index fe4b451c..8c8fd06a 100644 --- a/src/runtime/components/Form.vue +++ b/src/runtime/components/Form.vue @@ -12,14 +12,34 @@ const form = tv({ extend: tv(theme), ...(appConfigForm.ui?.form || {}) }) export interface FormProps { id?: string | number + /** Schema to validate the form state. Supports Standard Schema objects, Yup, Joi, and Superstructs. */ schema?: FormSchema + /** An object representing the current state of the form. */ state: Partial + /** + * Custom validation function to validate the form state. + * @param state - The current state of the form. + * @returns A promise that resolves to an array of FormError objects, or an array of FormError objects directly. + */ validate?: (state: Partial) => Promise | FormError[] + /** + * The list of input events that trigger the form validation. + * @defaultValue `['blur', 'change', 'input']` + */ validateOn?: FormInputEvents[] + /** Disable all inputs inside the form. */ disabled?: boolean + /** + * Delay in milliseconds before validating the form on input events. + * @defaultValue `300` + */ validateOnInputDelay?: number - class?: any + /** + * If true, schema transformations will be applied to the state on submit. + * @defaultValue `true` + */ transform?: boolean + class?: any onSubmit?: ((event: FormSubmitEvent) => void | Promise) | (() => void | Promise) } diff --git a/src/runtime/components/FormField.vue b/src/runtime/components/FormField.vue index c10b7dab..7fd32a7e 100644 --- a/src/runtime/components/FormField.vue +++ b/src/runtime/components/FormField.vue @@ -31,7 +31,12 @@ export interface FormFieldProps { */ size?: FormFieldVariants['size'] required?: boolean + /** If true, validation on input will be active immediately instead of waiting for a blur event. */ eagerValidation?: boolean + /** + * Delay in milliseconds before validating the form on input events. + * @defaultValue `300` + */ validateOnInputDelay?: number class?: any ui?: Partial