UNPKG

ldx-widgets

Version:

widgets

63 lines (49 loc) 1.38 kB
React = require 'react' ReactDOM = require 'react-dom' FormValidation = require '../mixins/form_validation' {div, select, ul} = React.DOM ### Select Props @props.loading - OPTIONAL - Boolean indicator to determine that the input is loading a value from the server ### Select = React.createClass displayName: 'Select' # Note - See form_validation for required props when using with this mixin mixins: [FormValidation] getDefaultProps: -> { } render: -> {children, value, tabIndex, onChange, className, disabled} = @props # Separate the false evaluations from the validation hash @getErrors() div { className: 'field-wrap select-menu' + @invalidClass }, [ select { className: className ref: 'selectMenu' key: 'selectMenu' tabIndex: tabIndex value: value onChange: onChange disabled: disabled }, children div({ className: 'field-errors-show' key: 'textInputErrorsShow' }, [ div { className: 'field-errors' key: 'textInputErrors' }, ul { className: 'field-errors-list' }, @validationErrors ]) if @validationErrors.length ] getFormData: -> ReactDOM.findDOMNode(@refs.selectMenu).value getValue: -> @getFormData() module.exports = Select