"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.pageWidths = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _react = _interopRequireDefault(require("react"));

var _classnames = _interopRequireDefault(require("classnames"));

var _js = require("../../globals/js");

var _excluded = ["background", "backgroundStyle", "children", "className", "pageWidth", "mobilePageWidth", "spacing"];
var prefix = _js.settings.prefix;
var pageWidths = ['sm', 'md', 'lg', 'full'];
/** Wrapper can wrap it's content in a specific width depending on if the application has a full or fixed width. */

exports.pageWidths = pageWidths;

var Wrapper = function Wrapper(props) {
  var _classNames;

  var background = props.background,
      backgroundStyle = props.backgroundStyle,
      children = props.children,
      className = props.className,
      pageWidth = props.pageWidth,
      mobilePageWidth = props.mobilePageWidth,
      spacing = props.spacing,
      other = (0, _objectWithoutProperties2.default)(props, _excluded);
  var wrapperClasses = (0, _classnames.default)((_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(prefix, "--wrapper"), true), (0, _defineProperty2.default)(_classNames, "".concat(prefix, "--wrapper--width-lg"), pageWidth === 'narrow' || pageWidth === 'lg'), (0, _defineProperty2.default)(_classNames, "".concat(prefix, "--wrapper--width-md"), pageWidth === 'narrower' || pageWidth === 'md'), (0, _defineProperty2.default)(_classNames, "".concat(prefix, "--wrapper--width-sm"), pageWidth === 'narrowest' || pageWidth === 'sm'), (0, _defineProperty2.default)(_classNames, "".concat(prefix, "--wrapper--width-xs"), pageWidth === 'narrowest' || pageWidth === 'xs'), (0, _defineProperty2.default)(_classNames, "".concat(prefix, "--wrapper--width-mobile-full"), mobilePageWidth === 'full'), (0, _defineProperty2.default)(_classNames, "".concat(prefix, "--wrapper--spacing-md"), spacing === 'md'), (0, _defineProperty2.default)(_classNames, "".concat(prefix, "--wrapper--spacing-xl"), spacing === 'xl'), (0, _defineProperty2.default)(_classNames, "".concat(className), className), _classNames));

  if (background || backgroundStyle) {
    var _classNames2;

    var backgroundClasses = (0, _classnames.default)((_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, "".concat(prefix, "--wrapper--background-lighter"), background === 'lighter'), (0, _defineProperty2.default)(_classNames2, "".concat(prefix, "--wrapper--background-dark"), background === 'dark'), _classNames2));
    return /*#__PURE__*/_react.default.createElement("div", {
      className: backgroundClasses,
      style: backgroundStyle
    }, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
      className: wrapperClasses
    }, other), children));
  } else {
    return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
      className: wrapperClasses
    }, other), children);
  }
};

Wrapper.propTypes = {
  /**
   * The content which should be displayed
   */
  children: _propTypes.default.node,

  /**
  Specify additional className which will be added
  */
  className: _propTypes.default.string,

  /**
    `xs` `sm` `md` `lg`:  Set the maximum width of the Wrapper content `xs`: `500px` `sm`: `700px` `md`:`1000px` `lg`: `1200px` 
  */
  pageWidth: _propTypes.default.oneOf(['sm', 'md', 'lg', 'full']),

  /**
    Width on mobile devices
  */
  mobilePageWidth: _propTypes.default.string,

  /**
    `full` `sm` `md` `lg`:  Width on mobile devices `full`: `100%`      
  */
  spacing: _propTypes.default.string
};
var _default = Wrapper;
exports.default = _default;