import {useController} from 'react-hook-form'; import {mergeProps} from '@react-aria/utils'; import React from 'react'; import {ComboBox, ComboboxProps} from './combobox'; type Props = ComboboxProps & { name: string; selectionMode?: 'single'; }; export function FormComboBox({children, ...props}: Props) { const { field: {onChange, onBlur, value = '', ref}, fieldState: {invalid, error}, } = useController({ name: props.name, }); const formProps: Partial> = { onSelectionChange: onChange, onBlur, selectedValue: value, defaultInputValue: value, invalid, errorMessage: error?.message, }; return ( {children} ); }