webpackHotUpdate(4,{

/***/ "./module/index.js":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(module) {/* unused harmony export defaultWidth */
/* unused harmony export defaultTransitionEasing */
/* unused harmony export minimalWidthForPushedOutContent */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LayoutContext; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__("./node_modules/react/cjs/react.development.js");
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_is_callable__ = __webpack_require__("./node_modules/is-callable/index.js");
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_is_callable___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_is_callable__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__styles__ = __webpack_require__("./module/styles.js");
var _jsxFileName = '/Users/hakonmartinholmsenkrogh/Documents/www/react-layout/module/index.js';

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; }; }();

(function () {
  var enterModule = __webpack_require__("./node_modules/react-hot-loader/patch.js").enterModule;

  enterModule && enterModule(module);
})();

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 defaultWidth = '300px';
var defaultTransitionEasing = 'cubic-bezier(0.41, 0.03, 0, 0.96)';

var speed = 250;

// The minimal width in px for the pushed out content
var minimalWidthForPushedOutContent = 65;

var LayoutContext = __WEBPACK_IMPORTED_MODULE_0_react___default.a.createContext();

var CrystallizeLayout = function (_Component) {
  _inherits(CrystallizeLayout, _Component);

  function CrystallizeLayout() {
    var _ref;

    var _temp, _this, _ret;

    _classCallCheck(this, CrystallizeLayout);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = CrystallizeLayout.__proto__ || Object.getPrototypeOf(CrystallizeLayout)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
      showLeft: false,
      showRight: false,
      widthOverride: null
    }, _this.activeWidthOverrides = {
      left: false,
      right: false,
      get any() {
        return this.left || this.right;
      }
    }, _this.animating = false, _this.startWidthOverride = function (side) {
      _this.activeWidthOverrides[side] = true;
    }, _this.handleWindowResize = function () {
      clearTimeout(_this.widthOverrideSetTimeout);
      _this.widthOverrideSetTimeout = setTimeout(function () {
        _this.setState({
          widthOverride: window.innerWidth - minimalWidthForPushedOutContent + 'px'
        });
      }, 25);

      // Set the current visible viewport to a custom variable
      var vh = window.innerHeight * 0.01;
      document.documentElement.style.setProperty('--vh', vh + 'px');
    }, _this.stopWidthOverride = function (side) {
      _this.activeWidthOverrides[side] = false;

      if (!_this.activeWidthOverrides.any) {
        clearTimeout(_this.widthOverrideSetTimeout);
      }
    }, _this.listenForMediaChange = function () {
      var _this$props = _this.props,
          _this$props$width = _this$props.width,
          width = _this$props$width === undefined ? defaultWidth : _this$props$width,
          leftWidth = _this$props.leftWidth,
          rightWidth = _this$props.rightWidth;


      var left = leftWidth || width;
      var right = rightWidth || width;

      _this.leftMql = window.matchMedia('(min-width: ' + (parseInt(left, 10) + minimalWidthForPushedOutContent) + 'px)');
      _this.leftMql.addListener(_this.handleLeftMediaChange);
      _this.handleLeftMediaChange(_this.leftMql);

      _this.rightMql = window.matchMedia('(min-width: ' + (parseInt(right, 10) + minimalWidthForPushedOutContent) + 'px)');
      _this.rightMql.addListener(_this.handleRightMediaChange);
      _this.handleRightMediaChange(_this.rightMql);
    }, _this.handleLeftMediaChange = function (mql) {
      var theScreenIsTooSmallForMenu = !mql.matches;
      if (theScreenIsTooSmallForMenu) {
        _this.startWidthOverride('left');
      } else {
        _this.stopWidthOverride('left');
      }
    }, _this.handleRightMediaChange = function (mql) {
      var theScreenIsTooSmallForMenu = !mql.matches;
      if (theScreenIsTooSmallForMenu) {
        _this.startWidthOverride('right');
      } else {
        _this.stopWidthOverride('right');
      }
    }, _this.stopListenForMediaChange = function () {
      _this.leftMql.removeListener(_this.handleLeftMediaChange);
      _this.rightMql.removeListener(_this.handleRightMediaChange);
      _this.stopWidthOverride('left');
      _this.stopWidthOverride('right');
    }, _this.onToggle = function (_ref2) {
      var left = _ref2.left,
          right = _ref2.right;

      if (_this.animating) {
        return Promise.resolve();
      }

      return new Promise(function (resolve) {
        _this.animating = true;

        var showASide = left || right;

        // Blur any active element
        if (document.activeElement) {
          document.activeElement.blur();
        }

        // Ensure we disable scroll before the animation kicks in
        if (showASide) {
          _this.disableScroll(true);
        }

        _this.setState({
          showLeft: left,
          showRight: right
        }, function () {
          setTimeout(function () {
            _this.animating = false;

            // Enable the scroll after the animation is done
            if (!showASide) {
              _this.disableScroll(false);
            }

            resolve();
          }, speed);
        });
      });
    }, _this.onOverlayClick = function (e) {
      e.preventDefault();
      _this.contextActions.hideBoth();
    }, _this.contextActions = {
      showLeft: function showLeft() {
        return _this.onToggle({ left: true, right: false });
      },
      hideLeft: function hideLeft() {
        return _this.onToggle({ left: false });
      },
      toggleLeft: function toggleLeft() {
        return _this.onToggle({ left: !_this.state.leftShown, right: false });
      },
      showRight: function showRight() {
        return _this.onToggle({ right: true, left: false });
      },
      hideRight: function hideRight() {
        return _this.onToggle({ right: false });
      },
      toggleRight: function toggleRight() {
        return _this.onToggle({ right: !_this.state.rightShown, left: false });
      },
      hideBoth: function hideBoth() {
        return _this.onToggle({ left: false, right: false });
      }
    }, _temp), _possibleConstructorReturn(_this, _ret);
  }

  _createClass(CrystallizeLayout, [{
    key: 'componentDidMount',
    value: function componentDidMount() {
      speed = parseInt(this.props.speed || 300);

      this.listenForMediaChange();
      this.handleWindowResize();
      window.addEventListener('resize', this.handleWindowResize, false);
    }
  }, {
    key: 'componentWillUnmount',
    value: function componentWillUnmount() {
      this.stopListenForMediaChange();

      window.removeEventListener('resize', this.handleWindowResize);
    }
  }, {
    key: 'disableScroll',
    value: function disableScroll(stop) {
      if (!this.defaultBodyOverflow) {
        var style = getComputedStyle(document.body);
        this.defaultBodyOverflow = style.overflow;
      }
      document.body.style.overflow = stop ? 'hidden' : this.defaultBodyOverflow;
    }
  }, {
    key: 'render',
    value: function render() {
      var _props = this.props,
          left = _props.left,
          right = _props.right,
          _props$width = _props.width,
          width = _props$width === undefined ? defaultWidth : _props$width,
          _props$transitionEasi = _props.transitionEasing,
          transitionEasing = _props$transitionEasi === undefined ? defaultTransitionEasing : _props$transitionEasi,
          leftWidth = _props.leftWidth,
          rightWidth = _props.rightWidth,
          blurContentOnShow = _props.blurContentOnShow,
          _props$transitionProp = _props.transitionProp,
          transitionProp = _props$transitionProp === undefined ? 'left' : _props$transitionProp,
          children = _props.children;
      var widthOverride = this.state.widthOverride;


      var leftWidthToUse = this.activeWidthOverrides.left ? widthOverride : leftWidth || width;
      var rightWidthToUse = this.activeWidthOverrides.right ? widthOverride : rightWidth || width;

      var _state = this.state,
          showLeft = _state.showLeft,
          showRight = _state.showRight;


      var contentPushed = '0px';
      if (showLeft) {
        contentPushed = leftWidthToUse;
      } else if (showRight) {
        contentPushed = '-' + rightWidthToUse;
      }

      var LeftCmp = left || null;
      var RightCmp = right || null;

      // Enable the blur content on show prop setting
      var blurContentOnShowProp = blurContentOnShow;
      if (blurContentOnShow && typeof blurContentOnShow === 'boolean') {
        blurContentOnShowProp = '3px';
      }

      var exposedState = {
        leftShown: showLeft,
        rightShown: showRight,
        contentPushed: contentPushed
      };

      return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
        LayoutContext.Provider,
        {
          value: {
            state: exposedState,
            actions: this.contextActions
          },
          __source: {
            fileName: _jsxFileName,
            lineNumber: 229
          }
        },
        __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
          __WEBPACK_IMPORTED_MODULE_2__styles__["d" /* Outer */],
          {
            showLeft: showLeft,
            showRight: showRight,
            leftWidth: leftWidthToUse,
            rightWidth: rightWidthToUse,
            speed: speed,
            transitionProp: transitionProp,
            transitionEasing: transitionEasing,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 235
            }
          },
          (showLeft || showRight) && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_2__styles__["a" /* ClickOverlay */], {
            showLeft: showLeft,
            showRight: showRight,
            leftWidth: leftWidthToUse,
            rightWidth: rightWidthToUse,
            onClick: this.onOverlayClick,
            transitionProp: transitionProp,
            transitionEasing: transitionEasing,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 245
            }
          }),
          __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
            __WEBPACK_IMPORTED_MODULE_2__styles__["b" /* Content */],
            {
              leftShown: showLeft,
              rightShown: showRight,
              blurContentOnShow: blurContentOnShowProp,
              speed: speed,
              transitionProp: transitionProp,
              transitionEasing: transitionEasing,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 255
              }
            },
            children
          ),
          LeftCmp && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
            __WEBPACK_IMPORTED_MODULE_2__styles__["c" /* Left */],
            {
              width: leftWidthToUse,
              show: showLeft,
              speed: speed,
              transitionProp: transitionProp,
              transitionEasing: transitionEasing,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 266
              }
            },
            __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(LeftCmp, { shown: showLeft, __source: {
                fileName: _jsxFileName,
                lineNumber: 273
              }
            })
          ),
          RightCmp && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
            __WEBPACK_IMPORTED_MODULE_2__styles__["e" /* Right */],
            {
              width: rightWidthToUse,
              show: showRight,
              speed: speed,
              transitionProp: transitionProp,
              transitionEasing: transitionEasing,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 277
              }
            },
            __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(RightCmp, { shown: showRight, __source: {
                fileName: _jsxFileName,
                lineNumber: 284
              }
            })
          )
        )
      );
    }
  }, {
    key: '__reactstandin__regenerateByEval',
    value: function __reactstandin__regenerateByEval(key, code) {
      this[key] = eval(code);
    }
  }]);

  return CrystallizeLayout;
}(__WEBPACK_IMPORTED_MODULE_0_react__["Component"]);

var _default = CrystallizeLayout;
/* harmony default export */ __webpack_exports__["b"] = (_default);
;

(function () {
  var reactHotLoader = __webpack_require__("./node_modules/react-hot-loader/patch.js").default;

  var leaveModule = __webpack_require__("./node_modules/react-hot-loader/patch.js").leaveModule;

  if (!reactHotLoader) {
    return;
  }

  reactHotLoader.register(defaultWidth, 'defaultWidth', '/Users/hakonmartinholmsenkrogh/Documents/www/react-layout/module/index.js');
  reactHotLoader.register(defaultTransitionEasing, 'defaultTransitionEasing', '/Users/hakonmartinholmsenkrogh/Documents/www/react-layout/module/index.js');
  reactHotLoader.register(speed, 'speed', '/Users/hakonmartinholmsenkrogh/Documents/www/react-layout/module/index.js');
  reactHotLoader.register(minimalWidthForPushedOutContent, 'minimalWidthForPushedOutContent', '/Users/hakonmartinholmsenkrogh/Documents/www/react-layout/module/index.js');
  reactHotLoader.register(LayoutContext, 'LayoutContext', '/Users/hakonmartinholmsenkrogh/Documents/www/react-layout/module/index.js');
  reactHotLoader.register(CrystallizeLayout, 'CrystallizeLayout', '/Users/hakonmartinholmsenkrogh/Documents/www/react-layout/module/index.js');
  reactHotLoader.register(_default, 'default', '/Users/hakonmartinholmsenkrogh/Documents/www/react-layout/module/index.js');
  leaveModule(module);
})();

;
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__("./node_modules/next/node_modules/webpack/buildin/harmony-module.js")(module)))

/***/ })

})
//# sourceMappingURL=4.47210b57d244820e8bd8.hot-update.js.map