import type { FieldValues, UseFormReturn } from "react-hook-form"; import { type FormTextFieldProps } from "../../molecules/TextField"; import { type FormTextAreaFieldProps } from "../../molecules/TextAreaField"; import { type FormComboBoxFieldProps, type Option } from "../../molecules/ComboBoxField"; import type { PathOf } from "./paths"; import { type FormCheckBoxFieldProps } from "../../molecules/CheckBoxField"; import { type FormMultiCheckboxFieldProps } from "../../molecules/MultiCheckBoxField"; export type ComponentKind = "input" | "textarea" | "combobox" | "checkbox" | "multicheckbox"; type BaseFieldRef = { name: PathOf; label?: string; colSpan?: number; containerClassName?: string; }; export type Direction = "col" | "floating" | "row" | null | undefined; export type InputFieldRef = BaseFieldRef & { component: "input"; inputProps?: Omit; }; export type TextAreaFieldRef = BaseFieldRef & { component: "textarea"; textareaProps?: Omit; }; export type ComboboxOption = { label: string; value: string; }; export type ComboboxFieldRef = BaseFieldRef & { component: "combobox"; items: ComboboxOption[]; comboProps?: Omit; }; export type CheckBoxFieldRef = BaseFieldRef & { component: "checkbox"; checkboxProps?: Omit; }; export type MultiCheckboxFieldRef = BaseFieldRef & { component: "multicheckbox"; options: Option[]; multiCheckboxProps?: Omit; }; export type FieldRef = InputFieldRef | TextAreaFieldRef | ComboboxFieldRef | CheckBoxFieldRef | MultiCheckboxFieldRef; export type FieldPropsBase> = { field: F; methods: UseFormReturn; path: string; direction?: Direction; }; export type FieldPropsFor = K extends "input" ? FieldPropsBase> : K extends "textarea" ? FieldPropsBase> : K extends "combobox" ? FieldPropsBase> : K extends "checkbox" ? FieldPropsBase> : K extends "multicheckbox" ? FieldPropsBase> : never; export type Renderers = { input?: (p: FieldPropsFor<"input", T>) => React.ReactNode; textarea?: (p: FieldPropsFor<"textarea", T>) => React.ReactNode; combobox?: (p: FieldPropsFor<"combobox", T>) => React.ReactNode; checkbox?: (p: FieldPropsFor<"checkbox", T>) => React.ReactNode; multicheckbox?: (p: FieldPropsFor<"multicheckbox", T>) => React.ReactNode; }; type RendererDefaults = { input?: Omit; textarea?: Omit; combobox?: Omit; checkbox?: Omit; multicheckbox?: Omit; }; export declare function createDefaultRenderers({ defaultDirection, defaults, }: { defaults?: RendererDefaults; defaultDirection?: Direction; }): Renderers; export {};