import React from 'react'; import {Icon} from './common.js'; var requiredFieldWarningStyle = { color: '#cc0000', transition: 'opacity 400ms ease-in', }; var FormField = React.createClass({ _fieldRequiredText: 'This field is required', _type: null, _element: null, propTypes: { type: React.PropTypes.string.isRequired, hidden: React.PropTypes.bool, }, getInitialState: function() { return { adviceState: 'hidden', adviceText: null, } }, componentWillMount: function() { if (['text', 'radio', 'checkbox', 'file'].includes(this.props.type)) { this._element = 'input'; this._type = this.props.type; } else if (this.props.type == 'text-number') { this._element = 'input'; this._type = 'text'; } else { // Non field, e.g.