'use strict';

exports.__esModule = true;

var _extends2 = require('babel-runtime/helpers/extends');

var _extends3 = _interopRequireDefault(_extends2);

var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');

var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _Icon = require('../Icon');

var _Icon2 = _interopRequireDefault(_Icon);

var _ListItem = require('../ListItem');

var _ListItem2 = _interopRequireDefault(_ListItem);

var _ListItemSection = require('../ListItemSection');

var _ListItemSection2 = _interopRequireDefault(_ListItemSection);

var _Checkbox = require('../Checkbox');

var _Checkbox2 = _interopRequireDefault(_Checkbox);

var _lodash = require('lodash');

var _lodash2 = _interopRequireDefault(_lodash);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * @category containers
 * @component select-option
 * @variations collab-ui-react
 */

var _ref = _react2.default.createElement(_Icon2.default, { color: 'blue', name: 'check_20' });

var SelectOption = function (_React$Component) {
  (0, _inherits3.default)(SelectOption, _React$Component);

  function SelectOption() {
    var _temp, _this, _ret;

    (0, _classCallCheck3.default)(this, SelectOption);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = {
      id: _lodash2.default.uniqueId(_this.props.id && _this.props.id + '-' || 'cui-select-option-')
    }, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
  }

  SelectOption.prototype.render = function render() {
    var _props = this.props,
        className = _props.className,
        isMulti = _props.isMulti,
        active = _props.active,
        children = _props.children,
        label = _props.label,
        props = (0, _objectWithoutProperties3.default)(_props, ['className', 'isMulti', 'active', 'children', 'label']);
    var id = this.state.id;


    var separateChildren = isMulti ? _react2.default.createElement(_Checkbox2.default, { htmlId: id + '__checkbox', label: label, checked: active, onChange: function onChange() {} }) : [_react2.default.createElement(
      _ListItemSection2.default,
      { key: 'child-0', position: 'center' },
      label || children
    ), _react2.default.createElement(
      _ListItemSection2.default,
      { key: 'child-1', position: 'right' },
      active && _ref
    )];

    return _react2.default.createElement(
      _ListItem2.default,
      (0, _extends3.default)({
        className: '' + (className && ' ' + className || ''),
        id: id
      }, props),
      separateChildren
    );
  };

  return SelectOption;
}(_react2.default.Component);

SelectOption.displayName = 'SelectOption';
exports.default = SelectOption;


SelectOption.defaultProps = {
  active: false,
  children: null,
  className: '',
  id: '',
  isMulti: false,
  label: ''
};

module.exports = exports['default'];