text: 'use strict';
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
  
  var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  
  var _createClass2 = require('babel-runtime/helpers/createClass');
  
  var _createClass3 = _interopRequireDefault(_createClass2);
  
  var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
  
  var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
  
  var _inherits2 = require('babel-runtime/helpers/inherits');
  
  var _inherits3 = _interopRequireDefault(_inherits2);
  
  var _extends2 = require('babel-runtime/helpers/extends');
  
  var _extends3 = _interopRequireDefault(_extends2);
  
  var _react = require('react');
  
  var _react2 = _interopRequireDefault(_react);
  
  var _propTypes = require('prop-types');
  
  var _propTypes2 = _interopRequireDefault(_propTypes);
  
  var _createStyles = require('../styles/createStyles');
  
  var _createStyles2 = _interopRequireDefault(_createStyles);
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  var Arrow = function Arrow(_ref) {
    var expanded = _ref.expanded,
        styles = _ref.styles;
    return _react2.default.createElement(
      'span',
      { style: (0, _extends3.default)({}, styles.base, expanded ? styles.expanded : styles.collapsed) },
      '\u25B6'
    );
  };
  
  var TreeNode = function (_Component) {
    (0, _inherits3.default)(TreeNode, _Component);
  
    function TreeNode() {
      (0, _classCallCheck3.default)(this, TreeNode);
      return (0, _possibleConstructorReturn3.default)(this, (TreeNode.__proto__ || Object.getPrototypeOf(TreeNode)).apply(this, arguments));
    }
  
    (0, _createClass3.default)(TreeNode, [{
      key: 'render',
      value: function render() {
        var _props = this.props,
            expanded = _props.expanded,
            onClick = _props.onClick,
            children = _props.children,
            nodeRenderer = _props.nodeRenderer,
            title = _props.title,
            shouldShowArrow = _props.shouldShowArrow,
            shouldShowPlaceholder = _props.shouldShowPlaceholder;
        var theme = this.context.theme;
  
        var styles = (0, _createStyles2.default)('TreeNode', theme);
  
        var renderedNode = (0, _react.createElement)(nodeRenderer, this.props);
        var childNodes = expanded ? children : undefined;
  
        return _react2.default.createElement(
          'li',
          { 'aria-expanded': expanded, role: 'treeitem', style: styles.treeNodeBase, title: title },
          _react2.default.createElement(
            'div',
            { style: styles.treeNodePreviewContainer, onClick: onClick },
            shouldShowArrow || _react.Children.count(children) > 0 ? _react2.default.createElement(Arrow, { expanded: expanded, styles: styles.treeNodeArrow }) : shouldShowPlaceholder && _react2.default.createElement(
              'span',
              { style: styles.treeNodePlaceholder },
              '\xA0'
            ),
            renderedNode
          ),
          _react2.default.createElement(
            'ol',
            { role: 'group', style: styles.treeNodeChildNodesContainer },
            childNodes
          )
        );
      }
    }]);
    return TreeNode;
  }(_react.Component);
  
  TreeNode.propTypes = {
    name: _propTypes2.default.string,
    data: _propTypes2.default.any,
  
    expanded: _propTypes2.default.bool,
    shouldShowArrow: _propTypes2.default.bool,
    shouldShowPlaceholder: _propTypes2.default.bool,
  
    nodeRenderer: _propTypes2.default.func,
  
    onClick: _propTypes2.default.func
  };
  
  TreeNode.defaultProps = {
    name: undefined,
    data: undefined,
    expanded: true,
  
    nodeRenderer: function nodeRenderer(_ref2) {
      var name = _ref2.name;
      return _react2.default.createElement(
        'span',
        null,
        name
      );
    },
  
    onClick: function onClick() {},
  
    shouldShowArrow: false,
    shouldShowPlaceholder: true
  };
  
  TreeNode.contextTypes = {
    theme: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]).isRequired
  };
  
  exports.default = TreeNode;