'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');

var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);

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 _react = require('react');

var _react2 = _interopRequireDefault(_react);

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

var _propTypes2 = _interopRequireDefault(_propTypes);

var _PaneSectionContent = require('./styles/PaneSectionContent');

var _PaneSectionContent2 = _interopRequireDefault(_PaneSectionContent);

var _PaneSectionTitle = require('./styles/PaneSectionTitle');

var _PaneSectionTitle2 = _interopRequireDefault(_PaneSectionTitle);

var _PaneSectionWrap = require('./styles/PaneSectionWrap');

var _PaneSectionWrap2 = _interopRequireDefault(_PaneSectionWrap);

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

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

  function PaneSection() {
    (0, _classCallCheck3.default)(this, PaneSection);
    return (0, _possibleConstructorReturn3.default)(this, (PaneSection.__proto__ || (0, _getPrototypeOf2.default)(PaneSection)).apply(this, arguments));
  }

  (0, _createClass3.default)(PaneSection, [{
    key: 'render',
    value: function render() {
      var _props = this.props,
          title = _props.title,
          children = _props.children,
          id = _props.id,
          className = _props.className,
          Wrap = _props.Wrap,
          Title = _props.Title,
          Content = _props.Content;

      return _react2.default.createElement(
        Wrap,
        { id: id, className: className },
        title ? _react2.default.createElement(
          Title,
          null,
          title
        ) : null,
        _react2.default.createElement(
          Content,
          null,
          children
        )
      );
    }
  }]);
  return PaneSection;
}(_react2.default.Component);

PaneSection.propTypes = {
  /**
   * Optional title for the top of the pane section.
   */
  title: _propTypes2.default.string,
  /**
   * Pane section contents.
   */
  children: _propTypes2.default.node.isRequired,
  /**
   * Adds an id to the section.
   */
  id: _propTypes2.default.string,
  /**
   * Adds a class name to the section.
   */
  className: _propTypes2.default.string,
  /**
   * A component to render the content of the pane section
   */
  Content: _propTypes2.default.func,
  /**
   * A component to render the title of the pane section
   */
  Title: _propTypes2.default.func,
  /**
   * A component to render the outer wrapper of the pane section
   */
  Wrap: _propTypes2.default.func
};
PaneSection.defaultProps = {
  title: null,
  id: null,
  className: null,
  Content: _PaneSectionContent2.default,
  Title: _PaneSectionTitle2.default,
  Wrap: _PaneSectionWrap2.default
};
exports.default = PaneSection;