type Validation = { max_length?: number; min_length?: number; regex?: string; }; type Option = { label: string; value: string; }; /** * Union type of all supported field types for better type identification and intellisense. */ type FieldType = "text" | "email" | "number" | "password" | "tel" | "url" | "date" | "color" | "hidden" | "textarea" | "select" | "checkbox" | "boolean" | "radio" | "file" | "avatar" | "table" | "users" | "timezone" | "audio_select" | "tags" | "field-select" | "group" | "row"; type BaseField = { label?: string; key: string; placeholder?: string; name?: string; type?: FieldType | string; required?: boolean; validation?: Validation; /** * Hint text displayed below the input field (after the input). */ hint_text?: string; /** * Description text displayed below the label (before the input). * Use this to provide context about the field. */ description?: string; direction?: "horizontal" | "vertical"; options?: Option[]; default?: string | boolean; width?: string; accept?: string; multiple?: boolean; icon?: string; option_label?: string; /** * For the `tags` field only. * Restrict which values are accepted as tags. * Each entry is a validator type: 'email' | 'number' | 'url' | 'text'. * If multiple types are provided, a tag is accepted when it passes ANY of them. * Including 'text' (or leaving the array empty) accepts everything. * @example ['email'] // only valid email addresses * @example ['email', 'number'] // valid email OR a number */ tag_types?: Array<'email' | 'number' | 'url' | 'text'>; }; type RowField = { label?: string; type: "row"; items: BaseField[]; description?: string; direction?: "horizontal" | "vertical"; }; type GroupField = { label?: string; type: "group"; items: Field[]; description?: string; header?: { title?: string; description?: string; }; }; type Field = BaseField | RowField | GroupField; type FormData = { id: string; code: string; form_name: string; default_values?: Record; submit_config?: SubmitConfig; fields: Field[]; }; type SubmitConfig = { url: string; api_token?: string; additional_data?: Record; }; interface RenderedForm { element: HTMLFormElement; validate: () => Array<{ element: HTMLElement; message: string; }>; getValues: (asFormData?: boolean) => globalThis.FormData | Record; onSubmit: (callback: (data: globalThis.FormData | Record, event: Event) => void) => void; } type RenderOptions = { onSubmit?: (data: any, error?: any) => void; onSubmitResult?: (response: any, error: Error | string | null) => void; enableAutoSubmit?: boolean; style?: "bootstrap" | undefined | null; submit_config?: SubmitConfig; }; declare function renderForm(element: string | HTMLElement, data: FormData, options?: RenderOptions): RenderedForm | null; declare const FormsLib: { renderForm: typeof renderForm; }; declare const _default: { FormsLib: { renderForm: typeof renderForm; }; }; export { type BaseField, type FieldType, type FormData, FormsLib, type Option, type RenderOptions, type RenderedForm, type SubmitConfig, type Validation, _default as default };