import { Field, FieldDescription, FieldError, FieldLabel, FormControl, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@repo/shadcn-ui/components"; import { cn } from "@repo/shadcn-ui/lib/utils"; import { type Control, Controller, type FieldPath, type FieldValues, useController, useFormState, } from "react-hook-form"; import { useTranslation } from "../../locales/i18n.ts"; type SelectFieldProps = { control: Control; name: FieldPath; label?: string; description?: string; disabled?: boolean; required?: boolean; readOnly?: boolean; placeholder?: string; items: Array<{ value: string; label: string }>; orientation?: "vertical" | "horizontal" | "responsive"; className?: string; inputClassName?: string; }; export function SelectField({ control, name, items, label, placeholder, description, disabled = false, required = false, readOnly = false, orientation = "vertical", className, inputClassName, }: SelectFieldProps) { const { t } = useTranslation(); const { isSubmitting } = useFormState({ control, name }); const { field, fieldState } = useController({ control, name }); const isDisabled = disabled || readOnly; return ( { return ( {label && {label}} {description || "\u00A0"} ); }} /> ); }