import { Field, FieldDescription, FieldError, FormControl, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@repo/shadcn-ui/components"; import { cn } from "@repo/shadcn-ui/lib/utils"; import React from "react"; import { Controller, type FieldPath, type FieldValues, useFormContext } from "react-hook-form"; import { FormFieldLabel } from "./form-field-label.tsx"; interface SelectFieldItem { value: string; label: string; } type SelectFieldProps = { name: FieldPath; label?: string; description?: string; disabled?: boolean; required?: boolean; readOnly?: boolean; placeholder?: string; items: SelectFieldItem[]; orientation?: "vertical" | "horizontal" | "responsive"; className?: string; inputClassName?: string; }; export function SelectField({ name, label, description, disabled = false, required = false, readOnly = false, placeholder, items, orientation = "vertical", className, inputClassName, }: SelectFieldProps) { const triggerId = React.useId(); const { control, formState } = useFormContext(); const isDisabled = Boolean(disabled || readOnly || formState.isSubmitting); return ( { return ( {label ? ( {label} ) : null} {description ? ( {description} ) : (