import type { CountryField } from '@payloadcms/plugin-form-builder/types' import type { Control, FieldErrorsImpl } from 'react-hook-form' import { Label } from '@/components/ui/label' import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '@/components/ui/select' import React from 'react' import { Controller } from 'react-hook-form' import { Error } from '../Error' import { Width } from '../Width' import { countryOptions } from './options' export const Country: React.FC< CountryField & { control: Control errors: Partial } > = ({ name, control, errors, label, required, width }) => { return ( { const controlledValue = countryOptions.find((t) => t.value === value) return ( ) }} rules={{ required }} /> {errors[name] && } ) }