text: !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Tappable=e()}}(function(){return function e(t,o,s){function n(r,c){if(!o[r]){if(!t[r]){var h="function"==typeof require&&require;if(!c&&h)return h(r,!0);if(i)return i(r,!0);var l=new Error("Cannot find module '"+r+"'");throw l.code="MODULE_NOT_FOUND",l}var p=o[r]={exports:{}};t[r][0].call(p.exports,function(e){var o=t[r][1][e];return n(o?o:e)},p,p.exports,e,t,o,s)}return o[r].exports}for(var i="function"==typeof require&&require,r=0;r<s.length;r++)n(s[r]);return n}({1:[function(e,t,o){"use strict";var s=e("./TappableMixin"),n=e("./getComponent"),i=e("./touchStyles"),r=n([s]);t.exports=r,t.exports.touchStyles=i,t.exports.Mixin=s},{"./TappableMixin":2,"./getComponent":3,"./touchStyles":4}],2:[function(e,t,o){"use strict";function s(e){return e?{pageX:e.pageX,pageY:e.pageY,clientX:e.clientX,clientY:e.clientY}:{}}var n=window.React,i={propTypes:{moveThreshold:n.PropTypes.number,activeDelay:n.PropTypes.number,pressDelay:n.PropTypes.number,pressMoveThreshold:n.PropTypes.number,preventDefault:n.PropTypes.bool,stopPropagation:n.PropTypes.bool,onTap:n.PropTypes.func,onPress:n.PropTypes.func,onTouchStart:n.PropTypes.func,onTouchMove:n.PropTypes.func,onTouchEnd:n.PropTypes.func,onMouseDown:n.PropTypes.func,onMouseUp:n.PropTypes.func,onMouseMove:n.PropTypes.func,onMouseOut:n.PropTypes.func},getDefaultProps:function(){return{activeDelay:0,moveThreshold:100,pressDelay:1e3,pressMoveThreshold:5}},getInitialState:function(){return{isActive:!1,touchActive:!1,pinchActive:!1}},componentWillUnmount:function(){this.cleanupScrollDetection(),this.cancelPressDetection(),this.clearActiveTimeout()},processEvent:function(e){this.props.preventDefault&&e.preventDefault(),this.props.stopPropagation&&e.stopPropagation()},onTouchStart:function(e){this.props.onTouchStart&&this.props.onTouchStart(e)===!1||(this.processEvent(e),window._blockMouseEvents=!0,1===e.touches.length?(this._initialTouch=this._lastTouch=s(e.touches[0]),this.initScrollDetection(),this.initPressDetection(e,this.endTouch),this._activeTimeout=setTimeout(this.makeActive,this.props.activeDelay)):this.onPinchStart&&(this.props.onPinchStart||this.props.onPinchMove||this.props.onPinchEnd)&&2===e.touches.length&&this.onPinchStart(e))},makeActive:function(){this.isMounted()&&(this.clearActiveTimeout(),this.setState({isActive:!0}))},clearActiveTimeout:function(){clearTimeout(this._activeTimeout),this._activeTimeout=!1},initScrollDetection:function(){this._scrollPos={top:0,left:0},this._scrollParents=[],this._scrollParentPos=[];for(var e=this.getDOMNode();e;)(e.scrollHeight>e.offsetHeight||e.scrollWidth>e.offsetWidth)&&(this._scrollParents.push(e),this._scrollParentPos.push(e.scrollTop+e.scrollLeft),this._scrollPos.top+=e.scrollTop,this._scrollPos.left+=e.scrollLeft),e=e.parentNode},calculateMovement:function(e){return{x:Math.abs(e.clientX-this._initialTouch.clientX),y:Math.abs(e.clientY-this._initialTouch.clientY)}},detectScroll:function(){for(var e={top:0,left:0},t=0;t<this._scrollParents.length;t++)e.top+=this._scrollParents[t].scrollTop,e.left+=this._scrollParents[t].scrollLeft;return!(e.top===this._scrollPos.top&&e.left===this._scrollPos.left)},cleanupScrollDetection:function(){this._scrollParents=void 0,this._scrollPos=void 0},initPressDetection:function(e,t){this.props.onPress&&(this._pressTimeout=setTimeout(function(){this.props.onPress(e),t()}.bind(this),this.props.pressDelay))},cancelPressDetection:function(){clearTimeout(this._pressTimeout)},onTouchMove:function(e){if(this._initialTouch){if(this.processEvent(e),this.detectScroll())return this.endTouch(e);this.props.onTouchMove&&this.props.onTouchMove(e),this._lastTouch=s(e.touches[0]);var t=this.calculateMovement(this._lastTouch);(t.x>this.props.pressMoveThreshold||t.y>this.props.pressMoveThreshold)&&this.cancelPressDetection(),t.x>this.props.moveThreshold||t.y>this.props.moveThreshold?this.state.isActive?this.setState({isActive:!1}):this._activeTimeout&&this.clearActiveTimeout():this.state.isActive||this._activeTimeout||this.setState({isActive:!0})}else this._initialPinch&&2===e.touches.length&&this.onPinchMove&&(this.onPinchMove(e),e.preventDefault())},onTouchEnd:function(e){var t=this;if(this._initialTouch){this.processEvent(e);var o,s=this.calculateMovement(this._lastTouch);s.x<=this.props.moveThreshold&&s.y<=this.props.moveThreshold&&this.props.onTap&&(e.preventDefault(),o=function(){var o=t._scrollParents.map(function(e){return e.scrollTop+e.scrollLeft}),s=t._scrollParentPos.some(function(e,t){return e!==o[t]});s||t.props.onTap(e)}),this.endTouch(e,o)}else this.onPinchEnd&&this._initialPinch&&e.touches.length+e.changedTouches.length===2&&(this.onPinchEnd(e),e.preventDefault())},endTouch:function(e,t){this.cancelPressDetection(),this.clearActiveTimeout(),e&&this.props.onTouchEnd&&this.props.onTouchEnd(e),this._initialTouch=null,this._lastTouch=null,t&&t(),this.state.isActive&&this.setState({isActive:!1})},onMouseDown:function(e){return window._blockMouseEvents?void(window._blockMouseEvents=!1):void(this.props.onMouseDown&&this.props.onMouseDown(e)===!1||(this.processEvent(e),this.initPressDetection(e,this.endMouseEvent),this._mouseDown=!0,this.setState({isActive:!0})))},onMouseMove:function(e){!window._blockMouseEvents&&this._mouseDown&&(this.processEvent(e),this.props.onMouseMove&&this.props.onMouseMove(e))},onMouseUp:function(e){!window._blockMouseEvents&&this._mouseDown&&(this.processEvent(e),this.props.onMouseUp&&this.props.onMouseUp(e),this.props.onTap&&this.props.onTap(e),this.endMouseEvent())},onMouseOut:function(e){!window._blockMouseEvents&&this._mouseDown&&(this.processEvent(e),this.props.onMouseOut&&this.props.onMouseOut(e),this.endMouseEvent())},endMouseEvent:function(){this.cancelPressDetection(),this._mouseDown=!1,this.setState({isActive:!1})},cancelTap:function(){this.endTouch(),this._mouseDown=!1},handlers:function(){return{onTouchStart:this.onTouchStart,onTouchMove:this.onTouchMove,onTouchEnd:this.onTouchEnd,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onMouseMove:this.onMouseMove,onMouseOut:this.onMouseOut}}};t.exports=i},{}],3:[function(e,t,o){"use strict";var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(e[s]=o[s])}return e},n=window.React,i=e("./touchStyles");t.exports=function(e){return n.createClass({displayName:"Tappable",mixins:e,propTypes:{component:n.PropTypes.any,className:n.PropTypes.string,classBase:n.PropTypes.string,style:n.PropTypes.object,disabled:n.PropTypes.bool},getDefaultProps:function(){return{component:"span",classBase:"Tappable"}},render:function(){var e=this.props,t=e.classBase+(this.state.isActive?"-active":"-inactive");e.className&&(t+=" "+e.className);var o={};s(o,i,e.style);var r=s({},e,{style:o,className:t,disabled:e.disabled,handlers:this.handlers},this.handlers());return delete r.onTap,delete r.onPress,delete r.onPinchStart,delete r.onPinchMove,delete r.onPinchEnd,delete r.moveThreshold,delete r.pressDelay,delete r.pressMoveThreshold,delete r.preventDefault,delete r.stopPropagation,delete r.component,n.createElement(e.component,r,e.children)}})}},{"./touchStyles":4}],4:[function(e,t,o){"use strict";var s={WebkitTapHighlightColor:"rgba(0,0,0,0)",WebkitTouchCallout:"none",WebkitUserSelect:"none",KhtmlUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",userSelect:"none",cursor:"pointer"};t.exports=s},{}]},{},[1])(1)});