function InputSmart({
		onKeyDown,
		country,
		inputFormat,
		metadata = defaultMetadata,
		//
		// The rest of the properties listed here are just to get the `rest` props
		// that will be passed to the DOM `<input/>` element.
		//
		// `international` property is deprecated and is not used.
		international,
		// `withCountryCallingCode` property is deprecated and is not used.
		withCountryCallingCode,
		...rest
	}, ref) {
		const format = useCallback((value) => {
			// "As you type" formatter.
			const formatter = new AsYouType(country, metadata)

			const prefix = getPrefixForFormattingValueAsPhoneNumber({
				inputFormat,
				country,
				metadata
			})

			// Format the number.
			let text = formatter.input(prefix + value)
			let template = formatter.getTemplate()

			if (prefix) {
				text = removePrefixFromFormattedPhoneNumber(text, prefix)
				// `AsYouType.getTemplate()` can be `undefined`.
				if (template) {
					template = removePrefixFromFormattedPhoneNumber(template, prefix)
				}
			}

			return {
				text,
				template
			}
		}, [
			country,
			metadata
		])

		const _onKeyDown = useInputKeyDownHandler({
			onKeyDown,
			inputFormat
		})

		return (
			<Input
				{...rest}
				ref={ref}
				parse={parsePhoneNumberCharacter}
				format={format}
				onKeyDown={_onKeyDown}
			/>
		)
	}
`InputSmart` is a "smarter" implementation of a `Component`
that can be passed to `<PhoneInput/>`. It parses and formats
the user's and maintains the caret's position in the process.
The caret positioning is maintained using `input-format` library.
Relies on being run in a DOM environment for calling caret positioning functions.