import { useState } from "react"; import { Controller, ControllerProps, FieldValues, FieldPath, useFormContext, UseControllerProps, } from "react-hook-form"; import { FormGroup, Select, SelectOption, SelectProps, ValidatedOptions, } from "@patternfly/react-core"; type Option = { key: string; value: string; }; type SelectControlProps< T extends FieldValues, P extends FieldPath = FieldPath > = Omit< SelectProps, "name" | "onToggle" | "selections" | "onSelect" | "onClear" | "isOpen" > & UseControllerProps & { name: string; label?: string; options: string[] | Option[]; controller: Omit; }; export const SelectControl = < T extends FieldValues, P extends FieldPath = FieldPath >({ name, label, options, controller, ...rest }: SelectControlProps) => { const { control, formState: { errors }, } = useFormContext(); const [open, setOpen] = useState(false); return ( ( )} /> ); };