import type { Control, FieldPath, FieldValues } from "react-hook-form"; import { FormField, FormItem, FormLabel } from "~/components/ui/form"; import { FunctionSelector } from "./FunctionSelector"; import { useAllFunctionConfigs } from "~/context/config"; interface FunctionFormFieldProps { control: Control; name: FieldPath; hideDefaultFunction?: boolean; label?: string; onSelect?: (value: string) => void; } export function FunctionFormField({ control, name, hideDefaultFunction = false, label = "Function", onSelect, }: FunctionFormFieldProps) { const functions = useAllFunctionConfigs(); return ( ( {label}
{ field.onChange(value); onSelect?.(value); }} functions={functions} hideDefaultFunction={hideDefaultFunction} ariaLabel={label} />
)} /> ); }