Repository URL to install this package:
|
Version:
4.0.29 ▾
|
import {
formatPhoneNumber,
removePhoneNumberFormatting,
} from '@skava/utils'
import isValidTelephone from 'src/forms/deps/isValidTelephone'
import isValidEmail from 'src/forms/deps/isValidEmail'
import isValidPassword from 'src/forms/deps/isValidPassword'
import { TextBoxProps, TextBoxState } from '../typings'
export function focusMiddleware(
event: Event,
props: TextBoxProps,
state: TextBoxState
) {
const { validationType } = props
/**
* @todo - this type check should be inside of the method we pass in
*/
if (validationType === 'telephone') {
const value = isValidTelephone(state.value)
// this.state.setValue(value)
} else if (validationType === 'email') {
const value = isValidEmail(state.value)
// this.state.setValue(value)
} else if (validationType === 'password') {
const value = isValidPassword(state.value)
// this.state.setValue(value)
}
}