import { Controller, type Control, type FieldPath, type FieldValues } from "react-hook-form" import { DatePicker, type DatePickerProps } from "@/components/calendar/date-picker" import { FormFieldShell, type FormFieldShellProps } from "@/components/form/form-field-shell" export type FormDatePickerProps< TFieldValues extends FieldValues = FieldValues, TName extends FieldPath = FieldPath, > = Omit & Pick & { control: Control name: TName fieldClassName?: string emptyValue?: unknown onValueChange?: (value: string) => void } function FormDatePicker< TFieldValues extends FieldValues = FieldValues, TName extends FieldPath = FieldPath, >({ control, name, label, description, required, className, fieldClassName, emptyValue = "", onValueChange, ...props }: FormDatePickerProps) { return ( ( { field.onChange(nextValue || emptyValue) onValueChange?.(nextValue) }} {...props} /> )} /> ) } export { FormDatePicker }