Repository URL to install this package:
|
Version:
1.1.14 ▾
|
import {
formatPhoneNumber,
removePhoneNumberFormatting,
} from 'uxui-modules/utils/formatPhoneNumber'
import { TextBoxProps, TextBoxState, TextBoxComponent } from '../typings'
export function blurMiddleware(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 = removePhoneNumberFormatting(state.value)
state.setValue(value)
}
console.debug('[input] TextBox.blur')
console.info('{value, isValid} ', state.value, state.isValid || state.isValidInput)
}