import { Controller, type Control, type FieldPath, type FieldValues } from "react-hook-form" import { DateRangePicker, type DateRangePickerProps } from "@/components/calendar/date-range-picker" import { FormFieldShell, type FormFieldShellProps } from "@/components/form/form-field-shell" export type FormDateRangePickerProps = Omit< DateRangePickerProps, "value" | "onValueChange" > & Pick & { control: Control fromName: FieldPath toName: FieldPath emptyValue?: unknown onValueChange?: (value: { from?: string; to?: string }) => void } function FormDateRangePicker({ control, fromName, toName, label, description, required, className, emptyValue = "", onValueChange, ...props }: FormDateRangePickerProps) { return ( ( ( { fromField.onChange(value.from || emptyValue) toField.onChange(value.to || emptyValue) onValueChange?.({ from: value.from || undefined, to: value.to || undefined }) }} {...props} /> )} /> )} /> ) } export { FormDateRangePicker }