import * as React from "react"; import { type Control, type FieldPath, type FieldValues, type RegisterOptions } from "react-hook-form"; import { type DateRangeInputProps, type DateRangeValue } from "@/components/ui/input/date-range"; import { type DateInputProps } from "@/components/ui/input/date"; import { type InputClearableProps, type InputSearchProps } from "@/components/ui/input"; import { type MaskedInputProps } from "@/components/ui/input/masked"; import { type MoneyInputProps } from "@/components/ui/input/money"; import { type PhoneInputProps } from "@/components/ui/input/phone"; import { type QuantityInputProps } from "@/components/ui/input/quantity"; import { type FormFieldShellControlProps } from "@/components/form/form-field-shell"; export type FormInputKind = "text" | "search" | "password" | "phone" | "date" | "date-range" | "clearable" | "masked" | "money" | "quantity"; export type FormInputPhoneInputValueMode = "raw" | "masked"; type TextInputElementChangeEvent = React.ChangeEvent; type FormTextInputControlProps = Omit, "name" | "value" | "defaultValue"> & { onChange?: (event: TextInputElementChangeEvent) => void; }; type FormControlledFieldProps> = FormFieldShellControlProps & { control: Control; name: TName; rules?: RegisterOptions; fieldClassName?: string; id?: string; }; export type FormTextInputProps = FieldPath> = Omit & FormControlledFieldProps & { kind?: "text"; transformIn?: (value: unknown) => string | number | readonly string[] | undefined; transformOut?: (event: TextInputElementChangeEvent) => unknown; }; export type FormInputSearchVariantProps = FieldPath> = Omit & FormControlledFieldProps & { kind: "search"; onValueChange?: (value: string) => void; }; export type FormInputPasswordVariantProps = FieldPath> = Omit, "name" | "value" | "defaultValue"> & { kind: "password"; onValueChange?: (value: string) => void; min?: never; max?: never; } & FormControlledFieldProps; export type FormInputPhoneVariantProps = FieldPath> = Omit & FormControlledFieldProps & { kind: "phone"; valueMode?: FormInputPhoneInputValueMode; onValueChange?: (value: string, rawValue: string, maskedValue: string) => void; }; export type FormInputDateVariantProps = FieldPath> = Omit & FormControlledFieldProps & { kind: "date"; emptyValue?: unknown; onValueChange?: (value: string) => void; }; export type FormInputDateRangeVariantProps = FieldPath> = Omit & FormControlledFieldProps & { kind: "date-range"; onValueChange?: (value: DateRangeValue) => void; }; export type FormInputClearableVariantProps = FieldPath> = Omit & FormControlledFieldProps & { kind: "clearable"; emptyValue?: unknown; onValueChange?: (value: string) => void; }; export type FormInputMaskedVariantProps = FieldPath> = Omit & FormControlledFieldProps & { kind: "masked"; valueMode?: "masked" | "raw"; onValueChange?: (maskedValue: string, rawValue: string) => void; }; export type FormInputMoneyVariantProps = FieldPath> = Omit & FormControlledFieldProps & { kind: "money"; emptyValue?: unknown; onValueChange?: (value: number | null, rawValue: string) => void; }; export type FormInputQuantityVariantProps = FieldPath> = Omit & FormControlledFieldProps & { kind: "quantity"; emptyValue?: unknown; onValueChange?: (value: number | null) => void; }; export type FormInputProps = FieldPath> = FormTextInputProps | FormInputSearchVariantProps | FormInputPasswordVariantProps | FormInputPhoneVariantProps | FormInputDateVariantProps | FormInputDateRangeVariantProps | FormInputClearableVariantProps | FormInputMaskedVariantProps | FormInputMoneyVariantProps | FormInputQuantityVariantProps; declare function FormInput = FieldPath>(props: FormInputProps): React.JSX.Element; export { FormInput };