Repository URL to install this package:
|
Version:
1.1.8 ▾
|
import {
formatPhoneNumber,
removePhoneNumberFormatting,
} from 'uxui-modules/utils/formatPhoneNumber'
import { TextBoxProps, TextBoxState } from '../typings'
export function focusMiddleware(event: Event, props: TextBoxProps, state: TextBoxState) {
const { validationType } = props
// onFocus: handleFocus,
// onValidation: handleValidation,
if (
validationType !== 'confirmPassword' &&
validationType !== 'expiryMonth' &&
validationType !== 'expiryYear'
) {
state.validateInput(event)
if (validationType === 'telephone') {
// state.value = formatPhoneNumber(state.value)
const value = formatPhoneNumber(state.value)
state.setValue(value)
}
}
console.debug('[input] TextBox.focus')
console.info('{state.value} ', state.value)
}