/**
* External dependencies
*/
import PropTypes from 'prop-types';
import { decodeEntities } from '@wordpress/html-entities';
/**
* Internal dependencies
*/
import TextInput from '../text-input';
import Select from '../select';
const StateInput = ( {
className,
counties,
country,
label,
onChange,
value = '',
} ) => {
const countryCounties = counties[ country ];
if ( ! countryCounties || Object.keys( countryCounties ).length === 0 ) {
return (
);
}
const options = Object.keys( countryCounties ).map( ( key ) => ( {
key,
name: decodeEntities( countryCounties[ key ] ),
} ) );
return (