/** * External dependencies */ import PropTypes from 'prop-types'; import { __ } from '@wordpress/i18n'; import Button from '@woocommerce/base-components/button'; import { ShippingCountryInput } from '@woocommerce/base-components/country-input'; import { ShippingStateInput } from '@woocommerce/base-components/state-input'; import TextInput from '@woocommerce/base-components/text-input'; import { useState } from '@wordpress/element'; import isShallowEqual from '@wordpress/is-shallow-equal'; /** * Internal dependencies */ import './style.scss'; const ShippingCalculatorAddress = ( { address: initialAddress, onUpdate } ) => { const [ address, setAddress ] = useState( initialAddress ); return (
setAddress( { ...address, country: newValue, state: '', } ) } /> setAddress( { ...address, state: newValue, } ) } /> setAddress( { ...address, city: newValue, } ) } /> setAddress( { ...address, postcode: newValue, } ) } /> ); }; ShippingCalculatorAddress.propTypes = { address: PropTypes.shape( { city: PropTypes.string, state: PropTypes.string, postcode: PropTypes.string, country: PropTypes.string, } ), onUpdate: PropTypes.func.isRequired, }; export default ShippingCalculatorAddress;