text: 'use strict';
  
  Object.defineProperty(exports, "__esModule", {
  	value: true
  });
  exports.default = exports.Context = 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 _propTypes = require('prop-types');
  
  var _propTypes2 = _interopRequireDefault(_propTypes);
  
  var _createReactContext = require('create-react-context');
  
  var _createReactContext2 = _interopRequireDefault(_createReactContext);
  
  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 Context = exports.Context = (0, _createReactContext2.default)();
  
  // export const contextPropTypes = {
  // 	menuIsExpanded     : PropTypes.bool.isRequired,
  // 	toggleMenu         : PropTypes.func.isRequired,
  // 	registerMenu       : PropTypes.func.isRequired,
  // 	registerMenuButton : PropTypes.func.isRequired,
  // 	setTogglerCooldown : PropTypes.func.isRequired,
  // 	getTogglerNode     : PropTypes.func.isRequired
  // }
  
  var PageAndMenu = function (_Component) {
  	_inherits(PageAndMenu, _Component);
  
  	function PageAndMenu() {
  		_classCallCheck(this, PageAndMenu);
  
  		// `state` is placed here to so that it's initialized
  		// after all instance methods because it references them.
  		var _this = _possibleConstructorReturn(this, (PageAndMenu.__proto__ || Object.getPrototypeOf(PageAndMenu)).call(this));
  
  		_this.toggleMenu = function (show) {
  			_this.menu.toggle(show, function () {
  				_this.setState({
  					menuIsExpanded: _this.menu.isShown()
  				});
  				// Focus the menu when it's expanded.
  				// Focus the menu button when menu is collapsed.
  				if (_this.menu.isShown()) {
  					var menu = _this.menu.menu();
  					menu && menu.focus && menu.focus();
  				} else {
  					_this.menuButton.element().focus();
  				}
  			});
  		};
  
  		_this.registerMenu = function (menu) {
  			if (_this.menu) {
  				throw new Error('[react-responsive-ui] There already is a menu registered for this page.');
  			}
  			_this.menu = menu;
  			// Return `.unregister()`.
  			return function () {
  				return _this.menu = undefined;
  			};
  		};
  
  		_this.registerMenuButton = function (menuButton) {
  			if (_this.menuButton) {
  				throw new Error('[react-responsive-ui] There already is a menu button registered for this page.');
  			}
  			_this.menuButton = menuButton;
  			// Return `.unregister()`.
  			return function () {
  				return _this.menuButton = undefined;
  			};
  		};
  
  		_this.setTogglerCooldown = function () {
  			return _this.menuButton.setCooldown();
  		};
  
  		_this.getTogglerNode = function () {
  			return _this.menuButton.element();
  		};
  
  		_this.state = {
  			// Using `undefined` for `menuIsExpanded` instead of `false`
  			// because menu icon uses it to determine whether
  			// the button has been activated yet.
  			menuIsExpanded: undefined, // false,
  			toggleMenu: _this.toggleMenu,
  			registerMenu: _this.registerMenu,
  			registerMenuButton: _this.registerMenuButton,
  			setTogglerCooldown: _this.setTogglerCooldown,
  			getTogglerNode: _this.getTogglerNode
  		};
  		return _this;
  	}
  
  	_createClass(PageAndMenu, [{
  		key: 'render',
  		value: function render() {
  			return _react2.default.createElement(
  				Context.Provider,
  				{ value: this.state },
  				_react2.default.createElement('div', this.props)
  			);
  		}
  	}]);
  
  	return PageAndMenu;
  }(_react.Component);
  
  exports.default = PageAndMenu;
  //# sourceMappingURL=PageAndMenu.js.map