From 2ec393feb1729ef229f531297201e6fc6fd8c8c0 Mon Sep 17 00:00:00 2001 From: Yusuke Yagyu Date: Thu, 31 Aug 2017 12:10:33 +0900 Subject: [PATCH] build site docs --- docs-site/bundle.js | 832 ++++++++++++++++++++++++++++---------------- 1 file changed, 535 insertions(+), 297 deletions(-) diff --git a/docs-site/bundle.js b/docs-site/bundle.js index 547cd3563..1ffe0ca02 100644 --- a/docs-site/bundle.js +++ b/docs-site/bundle.js @@ -650,45 +650,43 @@ var warning = emptyFunction; if (false) { - (function () { - var printWarning = function printWarning(format) { - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - var argIndex = 0; - var message = 'Warning: ' + format.replace(/%s/g, function () { - return args[argIndex++]; - }); - if (typeof console !== 'undefined') { - console.error(message); - } - try { - // --- Welcome to debugging React --- - // This error was thrown as a convenience so that you can use this stack - // to find the callsite that caused this warning to fire. - throw new Error(message); - } catch (x) {} - }; + var printWarning = function printWarning(format) { + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } - warning = function warning(condition, format) { - if (format === undefined) { - throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); - } + var argIndex = 0; + var message = 'Warning: ' + format.replace(/%s/g, function () { + return args[argIndex++]; + }); + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; - if (format.indexOf('Failed Composite propType: ') === 0) { - return; // Ignore CompositeComponent proptype check. - } + warning = function warning(condition, format) { + if (format === undefined) { + throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); + } - if (!condition) { - for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { - args[_key2 - 2] = arguments[_key2]; - } + if (format.indexOf('Failed Composite propType: ') === 0) { + return; // Ignore CompositeComponent proptype check. + } - printWarning.apply(undefined, [format].concat(args)); + if (!condition) { + for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { + args[_key2 - 2] = arguments[_key2]; } - }; - })(); + + printWarning.apply(undefined, [format].concat(args)); + } + }; } module.exports = warning; @@ -1116,7 +1114,7 @@ /***/ }), /* 15 */ -[534, 6], +[536, 6], /* 16 */ /***/ (function(module, exports, __webpack_require__) { @@ -5936,7 +5934,7 @@ /***/ }), /* 50 */ -[534, 35], +[536, 35], /* 51 */ /***/ (function(module, exports, __webpack_require__) { @@ -17417,18 +17415,11 @@ /** * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @typechecks */ @@ -20468,7 +20459,7 @@ var _example_components2 = _interopRequireDefault(_example_components); - var _hero_example = __webpack_require__(533); + var _hero_example = __webpack_require__(535); var _hero_example2 = _interopRequireDefault(_hero_example); @@ -20751,25 +20742,33 @@ var _multi_month_drp2 = _interopRequireDefault(_multi_month_drp); - var _children = __webpack_require__(527); + var _multi_month_previous = __webpack_require__(527); + + var _multi_month_previous2 = _interopRequireDefault(_multi_month_previous); + + var _children = __webpack_require__(528); var _children2 = _interopRequireDefault(_children); - var _portal = __webpack_require__(528); + var _portal = __webpack_require__(529); var _portal2 = _interopRequireDefault(_portal); - var _inline_portal = __webpack_require__(529); + var _inline_portal = __webpack_require__(530); var _inline_portal2 = _interopRequireDefault(_inline_portal); - var _raw_change = __webpack_require__(530); + var _raw_change = __webpack_require__(531); var _raw_change2 = _interopRequireDefault(_raw_change); - __webpack_require__(531); + var _dont_close_onSelect = __webpack_require__(532); + + var _dont_close_onSelect2 = _interopRequireDefault(_dont_close_onSelect); + + __webpack_require__(533); - __webpack_require__(532); + __webpack_require__(534); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -20895,12 +20894,18 @@ }, { title: 'Multiple months with year dropdown', component: _react2.default.createElement(_multi_month_drp2.default, null) + }, { + title: 'Show previous months', + component: _react2.default.createElement(_multi_month_previous2.default, null) }, { title: 'Children', component: _react2.default.createElement(_children2.default, null) }, { title: 'Get raw input value on change', component: _react2.default.createElement(_raw_change2.default, null) + }, { + title: 'Don\'t hide calendar on date selection', + component: _react2.default.createElement(_dont_close_onSelect2.default, null) }], _this.renderExamples = function () { return _this.examples.map(function (example, index) { return _react2.default.createElement( @@ -38669,7 +38674,8 @@ utcOffset: (0, _moment2.default)().utcOffset(), monthsShown: 1, - withPortal: false + withPortal: false, + shouldCloseOnSelect: true }; } }]); @@ -38774,7 +38780,9 @@ return _this.preventFocusTimeout; }); _this.setSelected(date, event); - if (!_this.props.inline) { + if (!_this.props.shouldCloseOnSelect) { + _this.setPreSelection(date); + } else if (!_this.props.inline) { _this.setOpen(false); } }; @@ -38839,6 +38847,7 @@ event.preventDefault(); if (_moment2.default.isMoment(_this.state.preSelection) || _moment2.default.isDate(_this.state.preSelection)) { _this.handleSelect(copy, event); + !_this.props.shouldCloseOnSelect && _this.setPreSelection(copy); } else { _this.setOpen(false); } @@ -38847,8 +38856,7 @@ _this.setOpen(false); } else if (eventKey === 'Tab') { _this.setOpen(false); - } - if (!_this.props.disabledKeyboardNavigation) { + } else if (!_this.props.disabledKeyboardNavigation) { var newSelection = void 0; switch (eventKey) { case 'ArrowLeft': @@ -38991,7 +38999,9 @@ _createClass(DatePicker, [{ key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { - if (this.props.inline && !this.props.selected.isSame(nextProps.selected, 'month')) { + var currentMonth = this.props.selected && this.props.selected.month(); + var nextMonth = nextProps.selected && nextProps.selected.month(); + if (this.props.inline && currentMonth !== nextMonth) { this.setPreSelection(nextProps.selected); } } @@ -39109,7 +39119,8 @@ value: _propTypes2.default.string, weekLabel: _propTypes2.default.string, withPortal: _propTypes2.default.bool, - yearDropdownItemNumber: _propTypes2.default.number + yearDropdownItemNumber: _propTypes2.default.number, + shouldCloseOnSelect: _propTypes2.default.bool }; exports.default = DatePicker; @@ -39385,8 +39396,10 @@ _this.renderMonths = function () { var monthList = []; + var monthsToSubtract = _this.props.showPreviousMonths ? _this.props.monthsShown - 1 : 0; + var fromMonthDate = _this.state.date.clone().subtract(monthsToSubtract, 'M'); for (var i = 0; i < _this.props.monthsShown; ++i) { - var monthDate = _this.state.date.clone().add(i, 'M'); + var monthDate = fromMonthDate.clone().add(i, 'M'); var monthKey = 'month-' + i; monthList.push(_react2.default.createElement( 'div', @@ -39511,6 +39524,7 @@ selectsEnd: _propTypes2.default.bool, selectsStart: _propTypes2.default.bool, showMonthDropdown: _propTypes2.default.bool, + showPreviousMonths: _propTypes2.default.bool, showWeekNumbers: _propTypes2.default.bool, showYearDropdown: _propTypes2.default.bool, startDate: _propTypes2.default.object, @@ -55802,12 +55816,8 @@ 'use strict'; - Object.defineProperty(exports, "__esModule", { - value: true - }); - - 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; }; }(); - + exports.__esModule = true; + exports.IGNORE_CLASS_NAME = undefined; exports.default = onClickOutsideHOC; var _react = __webpack_require__(2); @@ -55832,6 +55842,9 @@ var registeredComponents = []; var handlers = []; + var touchEvents = ['touchstart', 'touchmove']; + var IGNORE_CLASS_NAME = exports.IGNORE_CLASS_NAME = 'ignore-react-onclickoutside'; + /** * This function generates the HOC function that you'll use * in order to impart onOutsideClick listening to an @@ -55846,8 +55859,6 @@ _inherits(onClickOutside, _Component); function onClickOutside() { - var _ref; - var _temp, _this, _ret; _classCallCheck(this, onClickOutside); @@ -55856,15 +55867,22 @@ args[_key] = arguments[_key]; } - return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = onClickOutside.__proto__ || Object.getPrototypeOf(onClickOutside)).call.apply(_ref, [this].concat(args))), _this), _this.__outsideClickHandler = null, _this.enableOnClickOutside = function () { + return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.__outsideClickHandler = null, _this.enableOnClickOutside = function () { var fn = _this.__outsideClickHandler; if (fn && typeof document !== 'undefined') { var events = _this.props.eventTypes; if (!events.forEach) { events = [events]; } + events.forEach(function (eventName) { - var handlerOptions = !_this.props.preventDefault && ['touchstart', 'touchmove'].indexOf(eventName) !== -1 ? { passive: true } : null; + var handlerOptions = null; + var isTouchEvent = touchEvents.indexOf(eventName) !== -1; + + if (isTouchEvent) { + handlerOptions = { passive: !_this.props.preventDefault }; + } + document.addEventListener(eventName, fn, handlerOptions); }); } @@ -55884,182 +55902,166 @@ }, _temp), _possibleConstructorReturn(_this, _ret); } - _createClass(onClickOutside, [{ - key: 'getInstance', - - - /** - * Access the WrappedComponent's instance. - */ - value: function getInstance() { - if (!WrappedComponent.prototype.isReactComponent) { - return this; - } - var ref = this.instanceRef; - return ref.getInstance ? ref.getInstance() : ref; + /** + * Access the WrappedComponent's instance. + */ + onClickOutside.prototype.getInstance = function getInstance() { + if (!WrappedComponent.prototype.isReactComponent) { + return this; } + var ref = this.instanceRef; + return ref.getInstance ? ref.getInstance() : ref; + }; - // this is given meaning in componentDidMount/componentDidUpdate - - }, { - key: 'componentDidMount', + // this is given meaning in componentDidMount/componentDidUpdate - /** - * Add click listeners to the current document, - * linked to this component's state. - */ - value: function componentDidMount() { - // If we are in an environment without a DOM such - // as shallow rendering or snapshots then we exit - // early to prevent any unhandled errors being thrown. - if (typeof document === 'undefined' || !document.createElement) { - return; - } + /** + * Add click listeners to the current document, + * linked to this component's state. + */ + onClickOutside.prototype.componentDidMount = function componentDidMount() { + // If we are in an environment without a DOM such + // as shallow rendering or snapshots then we exit + // early to prevent any unhandled errors being thrown. + if (typeof document === 'undefined' || !document.createElement) { + return; + } - var instance = this.getInstance(); + var instance = this.getInstance(); - if (config && typeof config.handleClickOutside === 'function') { - this.__clickOutsideHandlerProp = config.handleClickOutside(instance); - if (typeof this.__clickOutsideHandlerProp !== 'function') { - throw new Error('WrappedComponent lacks a function for processing outside click events specified by the handleClickOutside config option.'); - } - } else if (typeof instance.handleClickOutside === 'function') { - if (_react.Component.prototype.isPrototypeOf(instance)) { - this.__clickOutsideHandlerProp = instance.handleClickOutside.bind(instance); - } else { - this.__clickOutsideHandlerProp = instance.handleClickOutside; - } - } else if (typeof instance.props.handleClickOutside === 'function') { - this.__clickOutsideHandlerProp = instance.props.handleClickOutside; - } else { - throw new Error('WrappedComponent lacks a handleClickOutside(event) function for processing outside click events.'); + if (config && typeof config.handleClickOutside === 'function') { + this.__clickOutsideHandlerProp = config.handleClickOutside(instance); + if (typeof this.__clickOutsideHandlerProp !== 'function') { + throw new Error('WrappedComponent lacks a function for processing outside click events specified by the handleClickOutside config option.'); } - - // TODO: try to get rid of this, could be done with function ref, might be problematic for SFC though, they do not expose refs - if ((0, _reactDom.findDOMNode)(instance) === null) { - return; + } else if (typeof instance.handleClickOutside === 'function') { + if (_react.Component.prototype.isPrototypeOf(instance)) { + this.__clickOutsideHandlerProp = instance.handleClickOutside.bind(instance); + } else { + this.__clickOutsideHandlerProp = instance.handleClickOutside; } + } else if (typeof instance.props.handleClickOutside === 'function') { + this.__clickOutsideHandlerProp = instance.props.handleClickOutside; + } else { + throw new Error('WrappedComponent lacks a handleClickOutside(event) function for processing outside click events.'); + } - this.addOutsideClickHandler(); + // TODO: try to get rid of this, could be done with function ref, might be problematic for SFC though, they do not expose refs + if ((0, _reactDom.findDOMNode)(instance) === null) { + return; } - /** - * Track for disableOnClickOutside props changes and enable/disable click outside - */ + this.addOutsideClickHandler(); + }; - }, { - key: 'componentWillReceiveProps', - value: function componentWillReceiveProps(nextProps) { - if (this.props.disableOnClickOutside && !nextProps.disableOnClickOutside) { - this.enableOnClickOutside(); - } else if (!this.props.disableOnClickOutside && nextProps.disableOnClickOutside) { - this.disableOnClickOutside(); - } - } - }, { - key: 'componentDidUpdate', - value: function componentDidUpdate() { - var componentNode = (0, _reactDom.findDOMNode)(this.getInstance()); + /** + * Track for disableOnClickOutside props changes and enable/disable click outside + */ - if (componentNode === null && this.__outsideClickHandler) { - this.removeOutsideClickHandler(); - return; - } - if (componentNode !== null && !this.__outsideClickHandler) { - this.addOutsideClickHandler(); - return; - } + onClickOutside.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { + if (this.props.disableOnClickOutside && !nextProps.disableOnClickOutside) { + this.enableOnClickOutside(); + } else if (!this.props.disableOnClickOutside && nextProps.disableOnClickOutside) { + this.disableOnClickOutside(); } + }; - /** - * Remove all document's event listeners for this component - */ + onClickOutside.prototype.componentDidUpdate = function componentDidUpdate() { + var componentNode = (0, _reactDom.findDOMNode)(this.getInstance()); - }, { - key: 'componentWillUnmount', - value: function componentWillUnmount() { + if (componentNode === null && this.__outsideClickHandler) { this.removeOutsideClickHandler(); + return; } - /** - * Can be called to explicitly enable event listening - * for clicks and touches outside of this element. - */ + if (componentNode !== null && !this.__outsideClickHandler) { + this.addOutsideClickHandler(); + return; + } + }; + /** + * Remove all document's event listeners for this component + */ - /** - * Can be called to explicitly disable event listening - * for clicks and touches outside of this element. - */ - }, { - key: 'addOutsideClickHandler', - value: function addOutsideClickHandler() { - var fn = this.__outsideClickHandler = (0, _generateOutsideCheck2.default)((0, _reactDom.findDOMNode)(this.getInstance()), this.__clickOutsideHandlerProp, this.props.outsideClickIgnoreClass, this.props.excludeScrollbar, this.props.preventDefault, this.props.stopPropagation); + onClickOutside.prototype.componentWillUnmount = function componentWillUnmount() { + this.removeOutsideClickHandler(); + }; - var pos = registeredComponents.length; - registeredComponents.push(this); - handlers[pos] = fn; + /** + * Can be called to explicitly enable event listening + * for clicks and touches outside of this element. + */ - // If there is a truthy disableOnClickOutside property for this - // component, don't immediately start listening for outside events. - if (!this.props.disableOnClickOutside) { - this.enableOnClickOutside(); - } - } - }, { - key: 'removeOutsideClickHandler', - value: function removeOutsideClickHandler() { - this.disableOnClickOutside(); - this.__outsideClickHandler = false; - var pos = registeredComponents.indexOf(this); + /** + * Can be called to explicitly disable event listening + * for clicks and touches outside of this element. + */ - if (pos > -1) { - // clean up so we don't leak memory - if (handlers[pos]) { - handlers.splice(pos, 1); - } - registeredComponents.splice(pos, 1); - } + + onClickOutside.prototype.addOutsideClickHandler = function addOutsideClickHandler() { + var fn = this.__outsideClickHandler = (0, _generateOutsideCheck2.default)((0, _reactDom.findDOMNode)(this.getInstance()), this.__clickOutsideHandlerProp, this.props.outsideClickIgnoreClass, this.props.excludeScrollbar, this.props.preventDefault, this.props.stopPropagation); + + var pos = registeredComponents.length; + registeredComponents.push(this); + handlers[pos] = fn; + + // If there is a truthy disableOnClickOutside property for this + // component, don't immediately start listening for outside events. + if (!this.props.disableOnClickOutside) { + this.enableOnClickOutside(); } - }, { - key: 'render', + }; + onClickOutside.prototype.removeOutsideClickHandler = function removeOutsideClickHandler() { + this.disableOnClickOutside(); + this.__outsideClickHandler = false; - /** - * Pass-through render - */ - value: function render() { - var _this2 = this; - - var props = Object.keys(this.props).filter(function (prop) { - return prop !== 'excludeScrollbar'; - }).reduce(function (props, prop) { - props[prop] = _this2.props[prop]; - return props; - }, {}); - - if (WrappedComponent.prototype.isReactComponent) { - props.ref = this.getRef; - } else { - props.wrappedRef = this.getRef; + var pos = registeredComponents.indexOf(this); + + if (pos > -1) { + // clean up so we don't leak memory + if (handlers[pos]) { + handlers.splice(pos, 1); } + registeredComponents.splice(pos, 1); + } + }; - props.disableOnClickOutside = this.disableOnClickOutside; - props.enableOnClickOutside = this.enableOnClickOutside; + /** + * Pass-through render + */ + onClickOutside.prototype.render = function render() { + var _this2 = this; + + var props = Object.keys(this.props).filter(function (prop) { + return prop !== 'excludeScrollbar'; + }).reduce(function (props, prop) { + props[prop] = _this2.props[prop]; + return props; + }, {}); - return (0, _react.createElement)(WrappedComponent, props); + if (WrappedComponent.prototype.isReactComponent) { + props.ref = this.getRef; + } else { + props.wrappedRef = this.getRef; } - }]); + + props.disableOnClickOutside = this.disableOnClickOutside; + props.enableOnClickOutside = this.enableOnClickOutside; + + return (0, _react.createElement)(WrappedComponent, props); + }; return onClickOutside; }(_react.Component), _class.displayName = 'OnClickOutside(' + (WrappedComponent.displayName || WrappedComponent.name || 'Component') + ')', _class.defaultProps = { eventTypes: ['mousedown', 'touchstart'], excludeScrollbar: config && config.excludeScrollbar || false, - outsideClickIgnoreClass: 'ignore-react-onclickoutside', + outsideClickIgnoreClass: IGNORE_CLASS_NAME, preventDefault: false, stopPropagation: false }, _class.getClass = function () { @@ -56073,9 +56075,7 @@ "use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); + exports.__esModule = true; exports.default = generateOutsideCheck; /** * Check whether some DOM node is our Component's node. @@ -57585,11 +57585,7 @@ top = _this$state$data$offs.top, left = _this$state$data$offs.left; - if (!left) { - return { top: +top }; - } else { - return { left: +left }; - } + return { top: top, left: left }; } }, _temp), _possibleConstructorReturn(_this, _ret); } @@ -57616,7 +57612,7 @@ this._updatePopper(); } - if (lastProps.children !== this.props.children) { + if (this._popper && lastProps.children !== this.props.children) { this._popper.scheduleUpdate(); } } @@ -57747,7 +57743,31 @@ /* 491 */ /***/ (function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(global) {(function (global, factory) { + /* WEBPACK VAR INJECTION */(function(global) {/**! + * @fileOverview Kickass library to create and place poppers near their reference elements. + * @version 1.12.5 + * @license + * Copyright (c) 2016 Federico Zivolo and contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + (function (global, factory) { true ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global.Popper = factory()); @@ -57901,13 +57921,38 @@ return getScrollParent(getParentNode(element)); } + /** + * Returns the offset parent of the given element + * @method + * @memberof Popper.Utils + * @argument {Element} element + * @returns {Element} offset parent + */ + function getOffsetParent(element) { + // NOTE: 1 DOM access here + var offsetParent = element && element.offsetParent; + var nodeName = offsetParent && offsetParent.nodeName; + + if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') { + return window.document.documentElement; + } + + // .offsetParent will return the closest TD or TABLE in case + // no offsetParent is present, I hate this job... + if (['TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') { + return getOffsetParent(offsetParent); + } + + return offsetParent; + } + function isOffsetContainer(element) { var nodeName = element.nodeName; if (nodeName === 'BODY') { return false; } - return nodeName === 'HTML' || element.firstElementChild.offsetParent === element; + return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element; } /** @@ -57925,25 +57970,6 @@ return node; } - /** - * Returns the offset parent of the given element - * @method - * @memberof Popper.Utils - * @argument {Element} element - * @returns {Element} offset parent - */ - function getOffsetParent(element) { - // NOTE: 1 DOM access here - var offsetParent = element && element.offsetParent; - var nodeName = offsetParent && offsetParent.nodeName; - - if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') { - return window.document.documentElement; - } - - return offsetParent; - } - /** * Finds the offset parent common to the two provided nodes * @method @@ -58066,7 +58092,7 @@ }; function getSize(axis, body, html, computedStyle) { - return Math.max(body['offset' + axis], html['client' + axis], html['offset' + axis], isIE10$1() ? html['offset' + axis] + computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')] + computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')] : 0); + return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE10$1() ? html['offset' + axis] + computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')] + computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')] : 0); } function getWindowSizes() { @@ -58080,7 +58106,62 @@ }; } - var _extends$2 = 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 classCallCheck = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + }; + + 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 defineProperty = function (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 _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; + }; /** * Given element offsets, generate an output similar to getBoundingClientRect @@ -58090,7 +58171,7 @@ * @returns {Object} ClientRect like output */ function getClientRect(offsets) { - return _extends$2({}, offsets, { + return _extends({}, offsets, { right: offsets.left + offsets.width, bottom: offsets.top + offsets.height }); @@ -58294,8 +58375,6 @@ return boundaries; } - var _extends$1 = 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; }; - function getArea(_ref) { var width = _ref.width, height = _ref.height; @@ -58341,7 +58420,7 @@ }; var sortedAreas = Object.keys(rects).map(function (key) { - return _extends$1({ + return _extends({ key: key }, rects[key], { area: getArea(rects[key]) @@ -58539,6 +58618,7 @@ var data = { instance: this, styles: {}, + arrowStyles: {}, attributes: {}, flipped: false, offsets: {} @@ -58591,10 +58671,10 @@ * @method * @memberof Popper.Utils * @argument {String} property (camelCase) - * @returns {String} prefixed property (camelCase) + * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix) */ function getSupportedPropertyName(property) { - var prefixes = [false, 'ms', 'webkit', 'moz', 'o']; + var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O']; var upperProp = property.charAt(0).toUpperCase() + property.slice(1); for (var i = 0; i < prefixes.length - 1; i++) { @@ -58783,9 +58863,9 @@ // they will be set as HTML attributes of the element setAttributes(data.instance.popper, data.attributes); - // if the arrow style has been computed, apply the arrow style - if (data.offsets.arrow) { - setStyles(data.arrowElement, data.offsets.arrow); + // if arrowElement is defined and arrowStyles has some properties + if (data.arrowElement && Object.keys(data.arrowStyles).length) { + setStyles(data.arrowElement, data.arrowStyles); } return data; @@ -58819,8 +58899,6 @@ return options; } - var _extends$3 = 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; }; - /** * @function * @memberof Modifiers @@ -58907,9 +58985,10 @@ 'x-placement': data.placement }; - // Update attributes and styles of `data` - data.attributes = attributes; - data.styles = _extends$3({}, styles, data.styles); + // Update `data` attributes, styles and arrowStyles + data.attributes = _extends({}, attributes, data.attributes); + data.styles = _extends({}, styles, data.styles); + data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles); return data; } @@ -58982,13 +59061,15 @@ var isVertical = ['left', 'right'].indexOf(placement) !== -1; var len = isVertical ? 'height' : 'width'; - var side = isVertical ? 'top' : 'left'; + var sideCapitalized = isVertical ? 'Top' : 'Left'; + var side = sideCapitalized.toLowerCase(); var altSide = isVertical ? 'left' : 'top'; var opSide = isVertical ? 'bottom' : 'right'; var arrowElementSize = getOuterSizes(arrowElement)[len]; // - // extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction + // extends keepTogether behavior making sure the popper and its + // reference have enough pixels in conjuction // // top/left side @@ -59004,7 +59085,9 @@ var center = reference[side] + reference[len] / 2 - arrowElementSize / 2; // Compute the sideValue using the updated popper offsets - var sideValue = center - getClientRect(data.offsets.popper)[side]; + // take popper margin in account because we don't have this info available + var popperMarginSide = getStyleComputedProperty(data.instance.popper, 'margin' + sideCapitalized).replace('px', ''); + var sideValue = center - getClientRect(data.offsets.popper)[side] - popperMarginSide; // prevent arrowElement from being placed not contiguously to its popper sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0); @@ -59087,8 +59170,6 @@ return counter ? arr.reverse() : arr; } - var _extends$4 = 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 BEHAVIORS = { FLIP: 'flip', CLOCKWISE: 'clockwise', @@ -59177,7 +59258,7 @@ // this object contains `position`, we want to preserve it along with // any additional property we may add in the future - data.offsets.popper = _extends$4({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement)); + data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement)); data = runModifiers(data.instance.modifiers, data, 'flip'); } @@ -59327,9 +59408,9 @@ } else { return a.concat(b); } - }, [] + }, []) // Here we convert the string values into number values (in px) - ).map(function (str) { + .map(function (str) { return toValue(str, measurement, popperOffsets, referenceOffsets); }); }); @@ -59388,10 +59469,6 @@ return data; } - var _extends$5 = 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; }; - - 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; } - /** * @function * @memberof Modifiers @@ -59421,7 +59498,7 @@ if (popper[placement] < boundaries[placement] && !options.escapeWithReference) { value = Math.max(popper[placement], boundaries[placement]); } - return _defineProperty({}, placement, value); + return defineProperty({}, placement, value); }, secondary: function secondary(placement) { var mainSide = placement === 'right' ? 'left' : 'top'; @@ -59429,13 +59506,13 @@ if (popper[placement] > boundaries[placement] && !options.escapeWithReference) { value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height)); } - return _defineProperty({}, mainSide, value); + return defineProperty({}, mainSide, value); } }; order.forEach(function (placement) { var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary'; - popper = _extends$5({}, popper, check[side](placement)); + popper = _extends({}, popper, check[side](placement)); }); data.offsets.popper = popper; @@ -59443,10 +59520,6 @@ return data; } - var _extends$6 = 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; }; - - function _defineProperty$1(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; } - /** * @function * @memberof Modifiers @@ -59470,11 +59543,11 @@ var measurement = isVertical ? 'width' : 'height'; var shiftOffsets = { - start: _defineProperty$1({}, side, reference[side]), - end: _defineProperty$1({}, side, reference[side] + reference[measurement] - popper[measurement]) + start: defineProperty({}, side, reference[side]), + end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement]) }; - data.offsets.popper = _extends$6({}, popper, shiftOffsets[shiftvariation]); + data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]); } return data; @@ -59536,7 +59609,7 @@ var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1; - popper[isHoriz ? 'left' : 'top'] = reference[placement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0); + popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0); data.placement = getOppositePlacement(placement); data.offsets.popper = getClientRect(popper); @@ -59614,6 +59687,9 @@ * '10 - 5vh + 3%' * '-10px + 5vh, 5px - 6%' * ``` + * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap + * > with their reference element, unfortunately, you will have to disable the `flip` modifier. + * > More on this [reading this issue](https://github.com/FezVrasta/popper.js/issues/373) * * @memberof modifiers * @inner @@ -59876,6 +59952,7 @@ * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier * @property {Object} data.styles Any CSS property defined here will be applied to the popper, it expects the JavaScript nomenclature (eg. `marginBottom`) + * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow, it expects the JavaScript nomenclature (eg. `marginBottom`) * @property {Object} data.boundaries Offsets of the popper boundaries * @property {Object} data.offsets The measurements of popper, reference and arrow elements. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values @@ -59955,12 +60032,6 @@ * @param {dataObject} data */ - 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 _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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - // Utils // Methods var Popper = function () { @@ -59976,8 +60047,7 @@ var _this = this; var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - - _classCallCheck(this, Popper); + classCallCheck(this, Popper); this.scheduleUpdate = function () { return requestAnimationFrame(_this.update); @@ -60011,9 +60081,9 @@ return _extends({ name: name }, _this.options.modifiers[name]); - } + }) // sort the modifiers by order - ).sort(function (a, b) { + .sort(function (a, b) { return a.order - b.order; }); @@ -60043,7 +60113,7 @@ // class prototype and break stuff like Sinon stubs - _createClass(Popper, [{ + createClass(Popper, [{ key: 'update', value: function update$$1() { return update.call(this); @@ -60089,7 +60159,6 @@ */ }]); - return Popper; }(); @@ -63290,6 +63359,91 @@ 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 MultiMonthPrevious = function (_React$Component) { + _inherits(MultiMonthPrevious, _React$Component); + + function MultiMonthPrevious(props) { + _classCallCheck(this, MultiMonthPrevious); + + var _this = _possibleConstructorReturn(this, (MultiMonthPrevious.__proto__ || Object.getPrototypeOf(MultiMonthPrevious)).call(this, props)); + + _this.handleChange = function (date) { + _this.setState({ + startDate: date + }); + }; + + _this.state = { + startDate: (0, _moment2.default)() + }; + return _this; + } + + _createClass(MultiMonthPrevious, [{ + key: 'render', + value: function render() { + return _react2.default.createElement( + 'div', + { className: 'row' }, + _react2.default.createElement( + 'pre', + { className: 'column example__code' }, + _react2.default.createElement( + 'code', + { className: 'jsx' }, + '\n\n' + ) + ), + _react2.default.createElement( + 'div', + { className: 'column' }, + _react2.default.createElement(_reactDatepicker2.default, { + monthsShown: 2, + onChange: this.handleChange, + showPreviousMonths: true, + selected: this.state.startDate }) + ) + ); + } + }]); + + return MultiMonthPrevious; + }(_react2.default.Component); + + exports.default = MultiMonthPrevious; + +/***/ }), +/* 528 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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 = __webpack_require__(2); + + var _react2 = _interopRequireDefault(_react); + + var _reactDatepicker = __webpack_require__(352); + + var _reactDatepicker2 = _interopRequireDefault(_reactDatepicker); + + var _moment = __webpack_require__(354); + + var _moment2 = _interopRequireDefault(_moment); + + 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 Children = function (_React$Component) { _inherits(Children, _React$Component); @@ -63350,7 +63504,7 @@ exports.default = Children; /***/ }), -/* 528 */ +/* 529 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -63434,7 +63588,7 @@ exports.default = WithPortal; /***/ }), -/* 529 */ +/* 530 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -63529,7 +63683,7 @@ exports.default = InlinePortalVersion; /***/ }), -/* 530 */ +/* 531 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -63625,15 +63779,99 @@ exports.default = RawChanges; /***/ }), -/* 531 */ +/* 532 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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 = __webpack_require__(2); + + var _react2 = _interopRequireDefault(_react); + + var _reactDatepicker = __webpack_require__(352); + + var _reactDatepicker2 = _interopRequireDefault(_reactDatepicker); + + var _moment = __webpack_require__(354); + + var _moment2 = _interopRequireDefault(_moment); + + 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 DontCloseOnSelect = function (_React$Component) { + _inherits(DontCloseOnSelect, _React$Component); + + function DontCloseOnSelect(props) { + _classCallCheck(this, DontCloseOnSelect); + + var _this = _possibleConstructorReturn(this, (DontCloseOnSelect.__proto__ || Object.getPrototypeOf(DontCloseOnSelect)).call(this, props)); + + _this.handleChange = function (date) { + _this.setState({ + startDate: date + }); + }; + + _this.state = { + startDate: (0, _moment2.default)() + }; + return _this; + } + + _createClass(DontCloseOnSelect, [{ + key: 'render', + value: function render() { + return _react2.default.createElement( + 'div', + { className: 'row' }, + _react2.default.createElement( + 'pre', + { className: 'column example__code' }, + _react2.default.createElement( + 'code', + { className: 'jsx' }, + '\n\n' + ) + ), + _react2.default.createElement( + 'div', + { className: 'column' }, + _react2.default.createElement(_reactDatepicker2.default, { + selected: this.state.startDate, + onChange: this.handleChange, + shouldCloseOnSelect: false }) + ) + ); + } + }]); + + return DontCloseOnSelect; + }(_react2.default.Component); + + exports.default = DontCloseOnSelect; + +/***/ }), +/* 533 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), -/* 532 */ -531, -/* 533 */ +/* 534 */ +533, +/* 535 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -63700,7 +63938,7 @@ exports.default = HeroExample; /***/ }), -/* 534 */ +/* 536 */ /***/ (function(module, exports, __webpack_require__, __webpack_module_template_argument_0__) { /**