2015-10-15 11:38:45 -04:00
|
|
|
var classNames = require('classnames');
|
2016-05-13 18:48:21 -04:00
|
|
|
var defaults = require('lodash.defaultsdeep');
|
2016-05-12 17:42:04 -04:00
|
|
|
var FRCSelect = require('formsy-react-components').Select;
|
|
|
|
var React = require('react');
|
2016-05-13 18:48:21 -04:00
|
|
|
var validateMixin = require('./validateMixin.jsx');
|
2015-10-15 11:38:45 -04:00
|
|
|
|
|
|
|
require('./select.scss');
|
|
|
|
|
|
|
|
var Select = React.createClass({
|
|
|
|
type: 'Select',
|
|
|
|
propTypes: {
|
|
|
|
|
|
|
|
},
|
|
|
|
render: function () {
|
|
|
|
var classes = classNames(
|
|
|
|
'select',
|
|
|
|
this.props.className
|
|
|
|
);
|
2016-05-13 18:48:21 -04:00
|
|
|
var props = this.props;
|
|
|
|
if (this.props.required && !this.props.value) {
|
|
|
|
props = defaults({}, this.props, {value: this.props.options[0].value});
|
|
|
|
}
|
2015-10-15 11:38:45 -04:00
|
|
|
return (
|
2016-05-13 18:48:21 -04:00
|
|
|
<FRCSelect {... props} className={classes} />
|
2015-10-15 11:38:45 -04:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-05-13 18:48:21 -04:00
|
|
|
module.exports = validateMixin(Select);
|