fix(LOY-398): fix language select by creating FormSelect wrapper * fix(LOY-398): fix language select by creating FormSelect wrapper Approved-by: Erik Tiekstra Approved-by: Anton Gunnarsson
26 lines
554 B
TypeScript
26 lines
554 B
TypeScript
'use client'
|
|
|
|
import { useController } from 'react-hook-form'
|
|
|
|
import { Select } from '../../Select'
|
|
|
|
import { SelectProps } from '../../Select/types'
|
|
|
|
export function FormSelect({ label, items, name }: SelectProps) {
|
|
const { field, fieldState } = useController({
|
|
name,
|
|
})
|
|
return (
|
|
<Select
|
|
items={items}
|
|
label={label}
|
|
isInvalid={fieldState.invalid}
|
|
name={name}
|
|
onBlur={field.onBlur}
|
|
onSelectionChange={(c) => field.onChange(c ?? '')}
|
|
selectedKey={field.value}
|
|
data-testid={name}
|
|
/>
|
|
)
|
|
}
|