From 7750acc41266d88b5549241e03a586a7c7deda17 Mon Sep 17 00:00:00 2001
From: Javier Marquez <javi@arqex.com>
Date: Mon, 27 Feb 2017 11:25:35 +0100
Subject: [PATCH] Bump version to 2.8.7

---
 dist/react-datetime.js |  459 ++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 340 insertions(+), 119 deletions(-)

diff --git a/dist/react-datetime.js b/dist/react-datetime.js
index b9f433d..94fd619 100644
--- a/dist/react-datetime.js
+++ b/dist/react-datetime.js
@@ -1,5 +1,5 @@
 /*
-react-datetime v2.8.6
+react-datetime v2.8.7
 https://github.com/YouCanBookMe/react-datetime
 MIT: https://github.com/YouCanBookMe/react-datetime/raw/master/LICENSE
 */
@@ -12,7 +12,7 @@
 		exports["Datetime"] = factory(require("moment"), require("React"), require("ReactDOM"));
 	else
 		root["Datetime"] = factory(root["moment"], root["React"], root["ReactDOM"]);
-})(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_9__) {
+})(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_10__) {
 return /******/ (function(modules) { // webpackBootstrap
 /******/ 	// The module cache
 /******/ 	var installedModules = {};
@@ -64,23 +64,11 @@
 	var assign = __webpack_require__(1),
 		moment = __webpack_require__(2),
 		React = __webpack_require__(3),
-		DaysView = __webpack_require__(4),
-		MonthsView = __webpack_require__(5),
-		YearsView = __webpack_require__(6),
-		TimeView = __webpack_require__(7)
+		CalendarContainer = __webpack_require__(4)
 	;
 
 	var TYPES = React.PropTypes;
 	var Datetime = React.createClass({
-		mixins: [
-			__webpack_require__(8)
-		],
-		viewComponents: {
-			days: DaysView,
-			months: MonthsView,
-			years: YearsView,
-			time: TimeView
-		},
 		propTypes: {
 			// value: TYPES.object | TYPES.string,
 			// defaultValue: TYPES.object | TYPES.string,
@@ -225,8 +213,7 @@
 			if ( updatedState.open === undefined ) {
 				if ( this.props.closeOnSelect && this.state.currentView !== 'time' ) {
 					updatedState.open = false;
-				}
-				else {
+				} else {
 					updatedState.open = this.state.open;
 				}
 			}
@@ -396,14 +383,19 @@
 				.milliseconds( currentDate.milliseconds() );
 
 			if ( !this.props.value ) {
+				var open = !( this.props.closeOnSelect && close );
+				if ( !open ) {
+					this.props.onBlur( date );
+				}
+
 				this.setState({
 					selectedDate: date,
 					viewDate: date.clone().startOf('month'),
 					inputValue: date.format( this.state.inputFormat ),
-					open: !(this.props.closeOnSelect && close )
+					open: open
 				});
 			} else {
-				if (this.props.closeOnSelect && close) {
+				if ( this.props.closeOnSelect && close ) {
 					this.closeCalendar();
 				}
 			}
@@ -468,8 +460,7 @@
 		},
 
 		render: function() {
-			var Component = this.viewComponents[ this.state.currentView ],
-				DOM = React.DOM,
+			var DOM = React.DOM,
 				className = 'rdt' + (this.props.className ?
 	                  ( Array.isArray( this.props.className ) ?
 	                  ' ' + this.props.className.join( ' ' ) : ' ' + this.props.className) : ''),
@@ -496,7 +487,7 @@
 			return DOM.div({className: className}, children.concat(
 				DOM.div(
 					{ key: 'dt', className: 'rdtPicker' },
-					React.createElement( Component, this.getComponentProps())
+					React.createElement( CalendarContainer, {view: this.state.currentView, viewProps: this.getComponentProps(), onClickOutside: this.handleClickOutside })
 				)
 			));
 		}
@@ -567,6 +558,38 @@
 
 /***/ },
 /* 4 */
+/***/ function(module, exports, __webpack_require__) {
+
+	var React = __webpack_require__(3),
+	  DaysView = __webpack_require__(5),
+	  MonthsView = __webpack_require__(6),
+	  YearsView = __webpack_require__(7),
+	  TimeView = __webpack_require__(8),
+	  onClickOutside = __webpack_require__(9)
+	;
+
+	var CalendarContainer = onClickOutside( React.createClass({
+		viewComponents: {
+			days: DaysView,
+			months: MonthsView,
+			years: YearsView,
+			time: TimeView
+		},
+
+	  render: function() {
+	    return React.createElement( this.viewComponents[ this.props.view ], this.props.viewProps );
+	  },
+
+	  handleClickOutside: function() {
+	    this.props.onClickOutside();
+	  }
+	}));
+
+	module.exports = CalendarContainer;
+
+
+/***/ },
+/* 5 */
 /***/ function(module, exports, __webpack_require__) {
 
 	'use strict';
@@ -652,7 +675,7 @@
 				if ( selected && prevMonth.isSame( selected, 'day' ) )
 					classes += ' rdtActive';
 
-				if (prevMonth.isSame( moment(), 'day' ) )
+				if ( prevMonth.isSame( moment(), 'day' ) )
 					classes += ' rdtToday';
 
 				isDisabled = !isValid( currentDate, selected );
@@ -711,7 +734,7 @@
 
 
 /***/ },
-/* 5 */
+/* 6 */
 /***/ function(module, exports, __webpack_require__) {
 
 	'use strict';
@@ -818,7 +841,7 @@
 
 
 /***/ },
-/* 6 */
+/* 7 */
 /***/ function(module, exports, __webpack_require__) {
 
 	'use strict';
@@ -923,7 +946,7 @@
 
 
 /***/ },
-/* 7 */
+/* 8 */
 /***/ function(module, exports, __webpack_require__) {
 
 	'use strict';
@@ -1152,119 +1175,317 @@
 
 
 /***/ },
-/* 8 */
+/* 9 */
 /***/ function(module, exports, __webpack_require__) {
 
-	'use strict';
+	var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
+	 * A higher-order-component for handling onClickOutside for React components.
+	 */
+	(function(root) {
 
-	// This is extracted from https://github.com/Pomax/react-onclickoutside
-	// And modified to support react 0.13 and react 0.14
+	  // administrative
+	  var registeredComponents = [];
+	  var handlers = [];
+	  var IGNORE_CLASS = 'ignore-react-onclickoutside';
+	  var DEFAULT_EVENTS = ['mousedown', 'touchstart'];
 
-	var React = __webpack_require__(3),
-		version = React.version && React.version.split('.')
-	;
+	  /**
+	   * Check whether some DOM node is our Component's node.
+	   */
+	  var isNodeFound = function(current, componentNode, ignoreClass) {
+	    if (current === componentNode) {
+	      return true;
+	    }
+	    // SVG <use/> elements do not technically reside in the rendered DOM, so
+	    // they do not have classList directly, but they offer a link to their
+	    // corresponding element, which can have classList. This extra check is for
+	    // that case.
+	    // See: http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGUseElement
+	    // Discussion: https://github.com/Pomax/react-onclickoutside/pull/17
+	    if (current.correspondingElement) {
+	      return current.correspondingElement.classList.contains(ignoreClass);
+	    }
+	    return current.classList.contains(ignoreClass);
+	  };
 
-	if ( version && ( version[0] > 0 || version[1] > 13 ) )
-		React = __webpack_require__(9);
+	  /**
+	   * Try to find our node in a hierarchy of nodes, returning the document
+	   * node as highest noode if our node is not found in the path up.
+	   */
+	  var findHighest = function(current, componentNode, ignoreClass) {
+	    if (current === componentNode) {
+	      return true;
+	    }
 
-	// Use a parallel array because we can't use
-	// objects as keys, they get toString-coerced
-	var registeredComponents = [];
-	var handlers = [];
+	    // If source=local then this event came from 'somewhere'
+	    // inside and should be ignored. We could handle this with
+	    // a layered approach, too, but that requires going back to
+	    // thinking in terms of Dom node nesting, running counter
+	    // to React's 'you shouldn't care about the DOM' philosophy.
+	    while(current.parentNode) {
+	      if (isNodeFound(current, componentNode, ignoreClass)) {
+	        return true;
+	      }
+	      current = current.parentNode;
+	    }
+	    return current;
+	  };
 
-	var IGNORE_CLASS = 'ignore-react-onclickoutside';
+	  /**
+	   * Check if the browser scrollbar was clicked
+	   */
+	  var clickedScrollbar = function(evt) {
+	    return document.documentElement.clientWidth <= evt.clientX;
+	  };
 
-	var isSourceFound = function(source, localNode) {
-	 if (source === localNode) {
-	   return true;
-	 }
-	 // SVG <use/> elements do not technically reside in the rendered DOM, so
-	 // they do not have classList directly, but they offer a link to their
-	 // corresponding element, which can have classList. This extra check is for
-	 // that case.
-	 // See: http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGUseElement
-	 // Discussion: https://github.com/Pomax/react-onclickoutside/pull/17
-	 if (source.correspondingElement) {
-	   return source.correspondingElement.classList.contains(IGNORE_CLASS);
-	 }
-	 return source.classList.contains(IGNORE_CLASS);
-	};
+	  /**
+	   * Generate the event handler that checks whether a clicked DOM node
+	   * is inside of, or lives outside of, our Component's node tree.
+	   */
+	  var generateOutsideCheck = function(componentNode, componentInstance, eventHandler, ignoreClass, excludeScrollbar, preventDefault, stopPropagation) {
+	    return function(evt) {
+	      if (preventDefault) {
+	        evt.preventDefault();
+	      }
+	      if (stopPropagation) {
+	        evt.stopPropagation();
+	      }
+	      var current = evt.target;
+	      if((excludeScrollbar && clickedScrollbar(evt)) || (findHighest(current, componentNode, ignoreClass) !== document)) {
+	        return;
+	      }
+	      eventHandler(evt);
+	    };
+	  };
 
-	module.exports = {
-	 componentDidMount: function() {
-	   if (typeof this.handleClickOutside !== 'function')
-	     throw new Error('Component lacks a handleClickOutside(event) function for processing outside click events.');
+	  /**
+	   * This function generates the HOC function that you'll use
+	   * in order to impart onOutsideClick listening to an
+	   * arbitrary component. It gets called at the end of the
+	   * bootstrapping code to yield an instance of the
+	   * onClickOutsideHOC function defined inside setupHOC().
+	   */
+	  function setupHOC(root, React, ReactDOM) {
 
-	   var fn = this.__outsideClickHandler = (function(localNode, eventHandler) {
-	     return function(evt) {
-	       evt.stopPropagation();
-	       var source = evt.target;
-	       var found = false;
-	       // If source=local then this event came from "somewhere"
-	       // inside and should be ignored. We could handle this with
-	       // a layered approach, too, but that requires going back to
-	       // thinking in terms of Dom node nesting, running counter
-	       // to React's "you shouldn't care about the DOM" philosophy.
-	       while (source.parentNode) {
-	         found = isSourceFound(source, localNode);
-	         if (found) return;
-	         source = source.parentNode;
-	       }
-	       eventHandler(evt);
-	     };
-	   }(React.findDOMNode(this), this.handleClickOutside));
+	    // The actual Component-wrapping HOC:
+	    return function onClickOutsideHOC(Component, config) {
+	      var wrapComponentWithOnClickOutsideHandling = React.createClass({
+	        statics: {
+	          /**
+	           * Access the wrapped Component's class.
+	           */
+	          getClass: function() {
+	            if (Component.getClass) {
+	              return Component.getClass();
+	            }
+	            return Component;
+	          }
+	        },
 
-	   var pos = registeredComponents.length;
-	   registeredComponents.push(this);
-	   handlers[pos] = fn;
+	        /**
+	         * Access the wrapped Component's instance.
+	         */
+	        getInstance: function() {
+	          return Component.prototype.isReactComponent ? this.refs.instance : this;
+	        },
 
-	   // If there is a truthy disableOnClickOutside property for this
-	   // component, don't immediately start listening for outside events.
-	   if (!this.props.disableOnClickOutside) {
-	     this.enableOnClickOutside();
-	   }
-	 },
+	        // this is given meaning in componentDidMount
+	        __outsideClickHandler: function() {},
 
-	 componentWillUnmount: function() {
-	   this.disableOnClickOutside();
-	   this.__outsideClickHandler = false;
-	   var pos = registeredComponents.indexOf(this);
-	   if ( pos>-1) {
-	     if (handlers[pos]) {
-	       // clean up so we don't leak memory
-	       handlers.splice(pos, 1);
-	       registeredComponents.splice(pos, 1);
-	     }
-	   }
-	 },
+	        /**
+	         * Add click listeners to the current document,
+	         * linked to this component's state.
+	         */
+	        componentDidMount: function() {
+	          // 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;
+	          }
 
-	 /**
-	  * Can be called to explicitly enable event listening
-	  * for clicks and touches outside of this element.
-	  */
-	 enableOnClickOutside: function() {
-	   var fn = this.__outsideClickHandler;
-	   document.addEventListener('mousedown', fn);
-	   document.addEventListener('touchstart', fn);
-	 },
+	          var instance = this.getInstance();
+	          var clickOutsideHandler;
 
-	 /**
-	  * Can be called to explicitly disable event listening
-	  * for clicks and touches outside of this element.
-	  */
-	 disableOnClickOutside: function() {
-	   var fn = this.__outsideClickHandler;
-	   document.removeEventListener('mousedown', fn);
-	   document.removeEventListener('touchstart', fn);
-	 }
-	};
+	          if(config && typeof config.handleClickOutside === 'function') {
+	            clickOutsideHandler = config.handleClickOutside(instance);
+	            if(typeof clickOutsideHandler !== 'function') {
+	              throw new Error('Component 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)) {
+	              clickOutsideHandler = instance.handleClickOutside.bind(instance);
+	            } else {
+	              clickOutsideHandler = instance.handleClickOutside;
+	            }
+	          } else if(typeof instance.props.handleClickOutside === 'function') {
+	            clickOutsideHandler = instance.props.handleClickOutside;
+	          } else {
+	            throw new Error('Component lacks a handleClickOutside(event) function for processing outside click events.');
+	          }
+
+	          var componentNode = ReactDOM.findDOMNode(instance);
+	          if (componentNode === null) {
+	            console.warn('Antipattern warning: there was no DOM node associated with the component that is being wrapped by outsideClick.');
+	            console.warn([
+	              'This is typically caused by having a component that starts life with a render function that',
+	              'returns `null` (due to a state or props value), so that the component \'exist\' in the React',
+	              'chain of components, but not in the DOM.\n\nInstead, you need to refactor your code so that the',
+	              'decision of whether or not to show your component is handled by the parent, in their render()',
+	              'function.\n\nIn code, rather than:\n\n  A{render(){return check? <.../> : null;}\n  B{render(){<A check=... />}\n\nmake sure that you',
+	              'use:\n\n  A{render(){return <.../>}\n  B{render(){return <...>{ check ? <A/> : null }<...>}}\n\nThat is:',
+	              'the parent is always responsible for deciding whether or not to render any of its children.',
+	              'It is not the child\'s responsibility to decide whether a render instruction from above should',
+	              'get ignored or not by returning `null`.\n\nWhen any component gets its render() function called,',
+	              'that is the signal that it should be rendering its part of the UI. It may in turn decide not to',
+	              'render all of *its* children, but it should never return `null` for itself. It is not responsible',
+	              'for that decision.'
+	            ].join(' '));
+	          }
+
+	          var fn = this.__outsideClickHandler = generateOutsideCheck(
+	            componentNode,
+	            instance,
+	            clickOutsideHandler,
+	            this.props.outsideClickIgnoreClass || IGNORE_CLASS,
+	            this.props.excludeScrollbar || false,
+	            this.props.preventDefault || false,
+	            this.props.stopPropagation || false
+	          );
+
+	          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();
+	          }
+	        },
+
+	        /**
+	        * Track for disableOnClickOutside props changes and enable/disable click outside
+	        */
+	        componentWillReceiveProps: function(nextProps) {
+	          if (this.props.disableOnClickOutside && !nextProps.disableOnClickOutside) {
+	            this.enableOnClickOutside();
+	          } else if (!this.props.disableOnClickOutside && nextProps.disableOnClickOutside) {
+	            this.disableOnClickOutside();
+	          }
+	        },
+
+	        /**
+	         * Remove the document's event listeners
+	         */
+	        componentWillUnmount: function() {
+	          this.disableOnClickOutside();
+	          this.__outsideClickHandler = false;
+	          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);
+	          }
+	        },
+
+	        /**
+	         * Can be called to explicitly enable event listening
+	         * for clicks and touches outside of this element.
+	         */
+	        enableOnClickOutside: function() {
+	          var fn = this.__outsideClickHandler;
+	          if (typeof document !== 'undefined') {
+	            var events = this.props.eventTypes || DEFAULT_EVENTS;
+	            if (!events.forEach) {
+	              events = [events];
+	            }
+	            events.forEach(function (eventName) {
+	              document.addEventListener(eventName, fn);
+	            });
+	          }
+	        },
+
+	        /**
+	         * Can be called to explicitly disable event listening
+	         * for clicks and touches outside of this element.
+	         */
+	        disableOnClickOutside: function() {
+	          var fn = this.__outsideClickHandler;
+	          if (typeof document !== 'undefined') {
+	            var events = this.props.eventTypes || DEFAULT_EVENTS;
+	            if (!events.forEach) {
+	              events = [events];
+	            }
+	            events.forEach(function (eventName) {
+	              document.removeEventListener(eventName, fn);
+	            });
+	          }
+	        },
+
+	        /**
+	         * Pass-through render
+	         */
+	        render: function() {
+	          var passedProps = this.props;
+	          var props = {};
+	          Object.keys(this.props).forEach(function(key) {
+	            if (key !== 'excludeScrollbar') {
+	              props[key] = passedProps[key];
+	            }
+	          });
+	          if (Component.prototype.isReactComponent) {
+	            props.ref = 'instance';
+	          }
+	          props.disableOnClickOutside = this.disableOnClickOutside;
+	          props.enableOnClickOutside = this.enableOnClickOutside;
+	          return React.createElement(Component, props);
+	        }
+	      });
+
+	      // Add display name for React devtools
+	      (function bindWrappedComponentName(c, wrapper) {
+	        var componentName = c.displayName || c.name || 'Component';
+	        wrapper.displayName = 'OnClickOutside(' + componentName + ')';
+	      }(Component, wrapComponentWithOnClickOutsideHandling));
+
+	      return wrapComponentWithOnClickOutsideHandling;
+	    };
+	  }
+
+	  /**
+	   * This function sets up the library in ways that
+	   * work with the various modulde loading solutions
+	   * used in JavaScript land today.
+	   */
+	  function setupBinding(root, factory) {
+	    if (true) {
+	      // AMD. Register as an anonymous module.
+	      !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(3),__webpack_require__(10)], __WEBPACK_AMD_DEFINE_RESULT__ = function(React, ReactDom) {
+	        return factory(root, React, ReactDom);
+	      }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
+	    } else if (typeof exports === 'object') {
+	      // Node. Note that this does not work with strict
+	      // CommonJS, but only CommonJS-like environments
+	      // that support module.exports
+	      module.exports = factory(root, require('react'), require('react-dom'));
+	    } else {
+	      // Browser globals (root is window)
+	      root.onClickOutside = factory(root, React, ReactDOM);
+	    }
+	  }
+
+	  // Make it all happen
+	  setupBinding(root, setupHOC);
+
+	}(this));
 
 
 /***/ },
-/* 9 */
+/* 10 */
 /***/ function(module, exports) {
 
-	module.exports = __WEBPACK_EXTERNAL_MODULE_9__;
+	module.exports = __WEBPACK_EXTERNAL_MODULE_10__;
 
 /***/ }
 /******/ ])

--
Gitblit v1.9.3