'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SideGridAside = exports.SideGridContent = exports.SideGrid = undefined;

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

var _string = require('kitten/helpers/utils/string');

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

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var SideGrid = exports.SideGrid = function (_Component) {
  _inherits(SideGrid, _Component);

  function SideGrid() {
    _classCallCheck(this, SideGrid);

    return _possibleConstructorReturn(this, (SideGrid.__proto__ || Object.getPrototypeOf(SideGrid)).apply(this, arguments));
  }

  _createClass(SideGrid, [{
    key: 'render',
    value: function render() {
      var _props = this.props,
          className = _props.className,
          containerClassName = _props.containerClassName,
          rowClassName = _props.rowClassName;
      var _props2 = this.props,
          asidePosition = _props2.asidePosition,
          asideSize = _props2.asideSize;


      asidePosition = _string.stringUtils.upcaseFirst(asidePosition);
      asideSize = _string.stringUtils.upcaseFirst(asideSize);

      var sideGridClassName = (0, _classnames2.default)('k-SideGrid', className, 'k-SideGrid--aside' + asidePosition, 'k-SideGrid--aside' + asideSize);

      return _react2.default.createElement(
        'div',
        { className: sideGridClassName },
        _react2.default.createElement(
          'div',
          {
            className: (0, _classnames2.default)('k-SideGrid__container', containerClassName)
          },
          _react2.default.createElement(
            'div',
            { className: (0, _classnames2.default)('k-SideGrid__row', rowClassName) },
            this.props.children
          )
        )
      );
    }
  }]);

  return SideGrid;
}(_react.Component);

var SideGridContent = exports.SideGridContent = function (_Component2) {
  _inherits(SideGridContent, _Component2);

  function SideGridContent() {
    _classCallCheck(this, SideGridContent);

    return _possibleConstructorReturn(this, (SideGridContent.__proto__ || Object.getPrototypeOf(SideGridContent)).apply(this, arguments));
  }

  _createClass(SideGridContent, [{
    key: 'render',
    value: function render() {
      return _react2.default.createElement(
        'div',
        { className: (0, _classnames2.default)('k-SideGrid__content', this.props.className) },
        this.props.children
      );
    }
  }]);

  return SideGridContent;
}(_react.Component);

var SideGridAside = exports.SideGridAside = function (_Component3) {
  _inherits(SideGridAside, _Component3);

  function SideGridAside() {
    _classCallCheck(this, SideGridAside);

    return _possibleConstructorReturn(this, (SideGridAside.__proto__ || Object.getPrototypeOf(SideGridAside)).apply(this, arguments));
  }

  _createClass(SideGridAside, [{
    key: 'render',
    value: function render() {
      return _react2.default.createElement(
        'div',
        { className: (0, _classnames2.default)('k-SideGrid__aside', this.props.className) },
        _react2.default.createElement(
          'div',
          {
            className: (0, _classnames2.default)('k-SideGrid__asideContent', this.props.contentClassName)
          },
          this.props.children
        )
      );
    }
  }]);

  return SideGridAside;
}(_react.Component);

SideGrid.defaultProps = {
  className: null,
  containerClassName: null,
  rowClassName: null,
  asidePosition: 'end', // 'start' or 'end'
  asideSize: 'default' // 'default', 'small' or 'large'
};

SideGridContent.defaultProps = {
  className: null
};

SideGridAside.defaultProps = {
  className: null,
  contentClassName: null
};