marquex
2015-08-22 b735500cd24f029c583b9052c7f0900997ed7ff8
dist/react-datetime.js
@@ -1,5 +1,5 @@
/*
react-datetime v1.1.0
react-datetime v1.1.1
https://github.com/arqex/react-datetime
MIT: https://github.com/arqex/react-datetime/raw/master/LICENSE
*/
@@ -113,7 +113,7 @@
/* 9 */
/***/ function(module, exports, __webpack_require__) {
   eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**\n * A mixin for handling (effectively) onClickOutside for React components.\n * Note that we're not intercepting any events in this approach, and we're\n * not using double events for capturing and discarding in layers or wrappers.\n *\n * The idea is that components define function\n *\n *   handleClickOutside: function() { ... }\n *\n * If no such function is defined, an error will be thrown, as this means\n * either it still needs to be written, or the component should not be using\n * this mixing since it will not exhibit onClickOutside behaviour.\n *\n */\n(function (root, factory) {\n  if (true) {\n    // AMD. Register as an anonymous module.\n    !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n  } else if (typeof exports === 'object') {\n    // Node. Note that this does not work with strict\n    // CommonJS, but only CommonJS-like environments\n    // that support module.exports\n    module.exports = factory();\n  } else {\n    // Browser globals (root is window)\n    root.OnClickOutside = factory();\n  }\n}(this, function () {\n  \"use strict\";\n\n  // Use a parallel array because we can't use\n  // objects as keys, they get toString-coerced\n  var registeredComponents = [];\n  var handlers = [];\n\n  var IGNORE_CLASS = 'ignore-react-onclickoutside';\n\n  return {\n    componentDidMount: function() {\n      if(!this.handleClickOutside)\n        throw new Error(\"Component lacks a handleClickOutside(event) function for processing outside click events.\");\n\n      var fn = this.__outsideClickHandler = (function(localNode, eventHandler) {\n        return function(evt) {\n          var source = evt.target;\n          var found = false;\n          // If source=local then this event came from \"somewhere\"\n          // inside and should be ignored. We could handle this with\n          // a layered approach, too, but that requires going back to\n          // thinking in terms of Dom node nesting, running counter\n          // to React's \"you shouldn't care about the DOM\" philosophy.\n          while(source.parentNode) {\n            found = (source === localNode || source.classList.contains(IGNORE_CLASS));\n            if(found) return;\n            source = source.parentNode;\n          }\n          eventHandler(evt);\n        }\n      }(this.getDOMNode(), this.handleClickOutside));\n\n      var pos = registeredComponents.length;\n      registeredComponents.push(this);\n      handlers[pos] = fn;\n\n      // If there is a truthy disableOnClickOutside property for this\n      // component, don't immediately start listening for outside events.\n      if (!this.props.disableOnClickOutside) {\n        this.enableOnClickOutside();\n      }\n    },\n\n    componentWillUnmount: function() {\n      this.disableOnClickOutside();\n      this.__outsideClickHandler = false;\n      var pos = registeredComponents.indexOf(this);\n      if( pos>-1) {\n        if (handlers[pos]) {\n          // clean up so we don't leak memory\n          handlers.splice(pos, 1);\n          registeredComponents.splice(pos, 1);\n        }\n      }\n    },\n\n    /**\n     * Can be called to explicitly enable event listening\n     * for clicks and touches outside of this element.\n     */\n    enableOnClickOutside: function() {\n      var fn = this.__outsideClickHandler;\n      document.addEventListener(\"mousedown\", fn);\n      document.addEventListener(\"touchstart\", fn);\n    },\n\n    /**\n     * Can be called to explicitly disable event listening\n     * for clicks and touches outside of this element.\n     */\n    disableOnClickOutside: function(fn) {\n      var fn = this.__outsideClickHandler;\n      document.removeEventListener(\"mousedown\", fn);\n      document.removeEventListener(\"touchstart\", fn);\n    }\n  };\n\n}));\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/react-onclickoutside/index.js\n ** module id = 9\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/react-onclickoutside/index.js?");
   eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**\n * A mixin for handling (effectively) onClickOutside for React components.\n * Note that we're not intercepting any events in this approach, and we're\n * not using double events for capturing and discarding in layers or wrappers.\n *\n * The idea is that components define function\n *\n *   handleClickOutside: function() { ... }\n *\n * If no such function is defined, an error will be thrown, as this means\n * either it still needs to be written, or the component should not be using\n * this mixing since it will not exhibit onClickOutside behaviour.\n *\n */\n(function (root, factory) {\n  if (true) {\n    // AMD. Register as an anonymous module.\n    !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(3)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n  } else if (typeof exports === 'object') {\n    // Node. Note that this does not work with strict\n    // CommonJS, but only CommonJS-like environments\n    // that support module.exports\n    module.exports = factory(require('react'));\n  } else {\n    // Browser globals (root is window)\n    root.OnClickOutside = factory(React);\n  }\n}(this, function (React) {\n  \"use strict\";\n\n  // Use a parallel array because we can't use\n  // objects as keys, they get toString-coerced\n  var registeredComponents = [];\n  var handlers = [];\n\n  var IGNORE_CLASS = 'ignore-react-onclickoutside';\n\n  var isSourceFound = function(source, localNode) {\n    if (source === localNode) {\n      return true;\n    }\n    // SVG <use/> elements do not technically reside in the rendered DOM, so\n    // they do not have classList directly, but they offer a link to their\n    // corresponding element, which can have classList. This extra check is for\n    // that case.\n    // See: http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGUseElement\n    // Discussion: https://github.com/Pomax/react-onclickoutside/pull/17\n    if (source.correspondingElement) {\n      return source.correspondingElement.classList.contains(IGNORE_CLASS);\n    }\n    return source.classList.contains(IGNORE_CLASS);\n  };\n\n  return {\n    componentDidMount: function() {\n      if(!this.handleClickOutside)\n        throw new Error(\"Component lacks a handleClickOutside(event) function for processing outside click events.\");\n\n      var fn = this.__outsideClickHandler = (function(localNode, eventHandler) {\n        return function(evt) {\n          var source = evt.target;\n          var found = false;\n          // If source=local then this event came from \"somewhere\"\n          // inside and should be ignored. We could handle this with\n          // a layered approach, too, but that requires going back to\n          // thinking in terms of Dom node nesting, running counter\n          // to React's \"you shouldn't care about the DOM\" philosophy.\n          while(source.parentNode) {\n            found = isSourceFound(source, localNode);\n            if(found) return;\n            source = source.parentNode;\n          }\n          eventHandler(evt);\n        }\n      }(React.findDOMNode(this), this.handleClickOutside));\n\n      var pos = registeredComponents.length;\n      registeredComponents.push(this);\n      handlers[pos] = fn;\n\n      // If there is a truthy disableOnClickOutside property for this\n      // component, don't immediately start listening for outside events.\n      if (!this.props.disableOnClickOutside) {\n        this.enableOnClickOutside();\n      }\n    },\n\n    componentWillUnmount: function() {\n      this.disableOnClickOutside();\n      this.__outsideClickHandler = false;\n      var pos = registeredComponents.indexOf(this);\n      if( pos>-1) {\n        if (handlers[pos]) {\n          // clean up so we don't leak memory\n          handlers.splice(pos, 1);\n          registeredComponents.splice(pos, 1);\n        }\n      }\n    },\n\n    /**\n     * Can be called to explicitly enable event listening\n     * for clicks and touches outside of this element.\n     */\n    enableOnClickOutside: function() {\n      var fn = this.__outsideClickHandler;\n      document.addEventListener(\"mousedown\", fn);\n      document.addEventListener(\"touchstart\", fn);\n    },\n\n    /**\n     * Can be called to explicitly disable event listening\n     * for clicks and touches outside of this element.\n     */\n    disableOnClickOutside: function(fn) {\n      var fn = this.__outsideClickHandler;\n      document.removeEventListener(\"mousedown\", fn);\n      document.removeEventListener(\"touchstart\", fn);\n    }\n  };\n\n}));\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/react-onclickoutside/index.js\n ** module id = 9\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/react-onclickoutside/index.js?");
/***/ }
/******/ ])