import { TextControl } from '@wordpress/components';

const TextField = ( { field, value, onChange } ) => {
	const inputType = field.inputType ?? field.type ?? 'text';

	return (
		<TextControl
			label={ field.label }
			value={ value ?? '' }
			onChange={ onChange }
			help={ field.help }
			required={ field.required }
			type={ inputType }
		/>
	);
};

export default TextField;
