/** * External dependencies */ import PropTypes from 'prop-types'; import TextInput from '@woocommerce/base-components/text-input'; import { BillingCountryInput, ShippingCountryInput, } from '@woocommerce/base-components/country-input'; import { BillingStateInput, ShippingStateInput, } from '@woocommerce/base-components/state-input'; /** * Internal dependencies */ import defaultAddressFields from './default-address-fields'; import countryAddressFields from './country-address-fields'; /** * Checkout address form. */ const AddressForm = ( { fields = Object.keys( defaultAddressFields ), fieldConfig = {}, onChange, type = 'shipping', values, } ) => { const countryLocale = countryAddressFields[ values.country ] || {}; const addressFields = fields.map( ( field ) => ( { key: field, ...defaultAddressFields[ field ], ...fieldConfig[ field ], ...countryLocale[ field ], } ) ); const sortedAddressFields = addressFields.sort( ( a, b ) => a.index - b.index ); return (