'use strict';

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

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _getClassName2 = require('babel-plugin-react-css-modules/dist/browser/getClassName');

var _getClassName3 = _interopRequireDefault(_getClassName2);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

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

var _propTypes2 = _interopRequireDefault(_propTypes);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

var _Column = require('./Column');

var _Column2 = _interopRequireDefault(_Column);

var _Row = require('./Row');

var _Row2 = _interopRequireDefault(_Row);

var _BlocksWrapper = require('./BlocksWrapper');

var _BlocksWrapper2 = _interopRequireDefault(_BlocksWrapper);

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

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var _styleModuleImportMap = {
  './section.scss': {
    'base': 'flive_section_base',
    'size-xs': 'flive_section_size-xs',
    'size-sm': 'flive_section_size-sm',
    'size-md': 'flive_section_size-md',
    'size-lg': 'flive_section_size-lg',
    'size-full': 'flive_section_size-full',
    'with-margin-bottom': 'flive_section_with-margin-bottom',
    'with-margin-top': 'flive_section_with-margin-top',
    'clear-fix': 'flive_section_clear-fix'
  }
};

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

var propTypes = {
  /** @ignore */
  className: _propTypes2.default.string,
  component: _propTypes2.default.string,
  size: _propTypes2.default.oneOf(['xs', 'sm', 'md', 'lg', 'full']),
  marginBottom: _propTypes2.default.bool,
  marginTop: _propTypes2.default.bool,
  clearFix: _propTypes2.default.bool,
  /** @deprecatad use "size" instead */
  maxSize: _propTypes2.default.oneOf(['xs', 'sm', 'md', 'lg', 'full'])
};

var defaultProps = {
  className: undefined,
  component: 'section',
  size: 'lg',
  maxSize: 'lg', // deprecated
  marginBottom: false,
  marginTop: false,
  clearFix: false
};

var Section = function Section(_ref) {
  var _classNames;

  var className = _ref.className,
      clearFix = _ref.clearFix,
      Component = _ref.component,
      marginBottom = _ref.marginBottom,
      marginTop = _ref.marginTop,
      size = _ref.size,
      maxSize = _ref.maxSize,
      props = _objectWithoutProperties(_ref, ['className', 'clearFix', 'component', 'marginBottom', 'marginTop', 'size', 'maxSize']);

  return _react2.default.createElement(Component, _extends({}, props, {
    className: (className ? className + ' ' : '') + (0, _getClassName3.default)((0, _classnames2.default)('base', (_classNames = {}, _defineProperty(_classNames, 'size-' + (size || maxSize), size || maxSize), _defineProperty(_classNames, 'with-margin-bottom', marginBottom), _defineProperty(_classNames, 'with-margin-top', marginTop), _defineProperty(_classNames, 'clear-fix', clearFix), _classNames)), _styleModuleImportMap)
  }));
};

Section.propTypes = propTypes;
Section.defaultProps = defaultProps;
Section.Column = _Column2.default;
Section.Row = _Row2.default;
Section.BlocksWrapper = _BlocksWrapper2.default;

exports.default = Section;
module.exports = exports['default'];