import { Field, FieldDescription, FieldError, InputGroup, InputGroupAddon, InputGroupInput, } from "@repo/shadcn-ui/components"; import { cn } from "@repo/shadcn-ui/lib/utils"; import * as React from "react"; import { type FieldPath, type FieldValues, useFormContext } from "react-hook-form"; import { FormFieldLabel } from "./form-field-label.tsx"; import type { NativeInputProps } from "./types.ts"; type DatePickerFieldProps = Omit & { name: FieldPath; label?: string; description?: string; reserveDescriptionSpace?: boolean; orientation?: "vertical" | "horizontal" | "responsive"; inputClassName?: string; }; export const DatePickerField = ({ name, label, description, reserveDescriptionSpace = false, required = false, readOnly = false, orientation = "vertical", className, inputClassName, ...inputRest }: DatePickerFieldProps) => { const { register, formState, getFieldState } = useFormContext(); const inputId = React.useId(); const disabled = formState.isSubmitting || inputRest.disabled; const presetProps = { type: "date", autoComplete: "off", spellCheck: false, }; const rightIcon = null; //; // Obtener error del campo (tipado seguro) const fieldError = getFieldState(name, formState).error; return ( {label ? ( {label} ) : null} {rightIcon && ( )} {description ? ( {description} ) : reserveDescriptionSpace ? (