Repository URL to install this package:
|
Version:
2.1.2-perf.5 ▾
|
import React from 'react';
import { isUndefined } from 'exotic';
import TextBox from "../../../../../inputs/TextBox";
import { validators } from "../../../../../forms/deps/_validators";
import { InputChain } from "../../../../../forms/input/InputChain";
class TextBoxInput extends InputChain {
constructor() {
super(...arguments);
this.validate = () => {
const state = this.get('state');
const props = this.get('props');
/**
* !!!!!!!!
* @note - this uses props.validationType while the others use state
*/
this.isValid = validators.isValid(state.value, props.validationType);
};
}
/**
* this handles all text inputs, and is the default
* @note !!!! added || true so it is always the fallback
*/
static isSatisfiedByProps(props) {
const typesSupported = ['text', 'confirmPassword', 'telephone'];
return isUndefined(props.type) || typesSupported.includes(props.type) || props.identity !== 'SecurityCode' && props.type === 'password' || true;
}
render() {
const props = this.get('props');
const attributes = Object.assign({}, props);
return React.createElement(TextBox, Object.assign({}, attributes));
}
}
export { TextBoxInput };
export default TextBoxInput; //# sourceMappingURL=TextInput.js.map