content: import React from 'react';
  
  export const ChoiceMixin = {
  
    //@@viewOn:mixins
    //@@viewOff:mixins
  
    //@@viewOn:statics
    statics: {
      UU5_Forms_GroupMixin: {
        classNames: {
          main: 'uu5-forms-choice'
        }
      }
    },
    //@@viewOff:statics
  
    //@@viewOn:propTypes
    propTypes: {
      placeholder: React.PropTypes.string,
      required: React.PropTypes.bool,
      requiredMessage: React.PropTypes.any,
      buttonHidden: React.PropTypes.bool,
      glyphiconOpened: React.PropTypes.string,
      glyphiconClosed: React.PropTypes.string
    },
    //@@viewOff:propTypes
  
    //@@viewOn:getDefaultProps
    getDefaultProps: function () {
      return {
        placeholder: null,
        required: false,
        requiredMessage: 'Select some item',
        buttonHidden: false,
        glyphiconOpened: 'uu-glyphicon-arrow-up',
        glyphiconClosed: 'uu-glyphicon-arrow-down'
      };
    },
    //@@viewOff:getDefaultProps
  
    //@@viewOn:standardComponentLifeCycle
    //@@viewOff:standardComponentLifeCycle
  
    //@@viewOn:interface
    isValid () {
      var feedback = this.getFeedback();
      var value = this.getValue();
      var result = true;
  
      if (this.props.required && (!value || value.length < 1)) {
        this.setError(this.props.requiredMessage);
        result = false;
      } else if (feedback === 'error') {
        result = false;
      } else if (typeof this.isValid_ === 'function') {
        result = this.isValid_();
      }
  
      if (result && this.props.onValidate) {
        var validation = this.props.onValidate(value, this);
        if (validation && typeof validation === 'object') {
          if (validation.feedback === 'error') {
            result = false;
          }
        }
      }
  
      return result;
    },
  //@@viewOff:interface
  
    //@@viewOn:overridingMethods
    //@@viewOff:overridingMethods
  
    //@@viewOn:componentSpecificHelpers
    //@@viewOff:componentSpecificHelpers
  
    //@@viewOn:render
    //@@viewOff:render
  };
  
  export default ChoiceMixin;