import { Controller } from "react-hook-form" import { Option } from "../../../../types/shared" import FormValidator from "../../../../utils/form-validator" import { NestedForm } from "../../../../utils/nested-form" import InputField from "../../../molecules/input" import { NextSelect } from "../../../molecules/select/next-select" export type AddressLocationFormType = { address_1: string address_2: string | null city: string province: string | null country_code: Option postal_code: string } type AddressLocationFormProps = { requireFields?: Partial> countryOptions?: Option[] form: NestedForm } /** * Re-usable form for address location information, used to create and edit addresses. * Fields are optional, but can be required by passing in a requireFields object. */ const AddressLocationForm = ({ form, countryOptions, requireFields, }: AddressLocationFormProps) => { const { register, path, formState: { errors }, control, } = form return (
{ return ( ) }} />
) } export default AddressLocationForm