import _extends from "@babel/runtime/helpers/extends";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["background", "backgroundStyle", "children", "className", "pageWidth", "mobilePageWidth", "spacing"];
import PropTypes from 'prop-types';
import React from 'react';
import classNames from 'classnames';
import { settings } from '../../globals/js';
var prefix = settings.prefix;
export 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. */

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 = _objectWithoutProperties(props, _excluded);

  var wrapperClasses = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(prefix, "--wrapper"), true), _defineProperty(_classNames, "".concat(prefix, "--wrapper--width-lg"), pageWidth === 'narrow' || pageWidth === 'lg'), _defineProperty(_classNames, "".concat(prefix, "--wrapper--width-md"), pageWidth === 'narrower' || pageWidth === 'md'), _defineProperty(_classNames, "".concat(prefix, "--wrapper--width-sm"), pageWidth === 'narrowest' || pageWidth === 'sm'), _defineProperty(_classNames, "".concat(prefix, "--wrapper--width-xs"), pageWidth === 'narrowest' || pageWidth === 'xs'), _defineProperty(_classNames, "".concat(prefix, "--wrapper--width-mobile-full"), mobilePageWidth === 'full'), _defineProperty(_classNames, "".concat(prefix, "--wrapper--spacing-md"), spacing === 'md'), _defineProperty(_classNames, "".concat(prefix, "--wrapper--spacing-xl"), spacing === 'xl'), _defineProperty(_classNames, "".concat(className), className), _classNames));

  if (background || backgroundStyle) {
    var _classNames2;

    var backgroundClasses = classNames((_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefix, "--wrapper--background-lighter"), background === 'lighter'), _defineProperty(_classNames2, "".concat(prefix, "--wrapper--background-dark"), background === 'dark'), _classNames2));
    return /*#__PURE__*/React.createElement("div", {
      className: backgroundClasses,
      style: backgroundStyle
    }, /*#__PURE__*/React.createElement("div", _extends({
      className: wrapperClasses
    }, other), children));
  } else {
    return /*#__PURE__*/React.createElement("div", _extends({
      className: wrapperClasses
    }, other), children);
  }
};

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

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

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

  /**
    Width on mobile devices
  */
  mobilePageWidth: PropTypes.string,

  /**
    `full` `sm` `md` `lg`:  Width on mobile devices `full`: `100%`      
  */
  spacing: PropTypes.string
};
export default Wrapper;