Socket
Socket
Sign inDemoInstall

react-view-pager

Package Overview
Dependencies
27
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.0-prerelease.2 to 0.5.0-prerelease.3

13

CHANGELOG.md
## CHANGELOG
### 0.5.0-prerelease.3
emit `viewChange` when `viewsToShow` options have changed
`beforeViewChange` -> `onViewChange`
`afterViewChange` -> `onRest`
Allow `autoSize` prop to size `width` and/or `height`
Use `verticalAlign: top` on views to keep them in frame when using `autoSize`
Added mandatory `View` component that replaces previous views that were cloned. This will help us keep some control over props that need to be applied.
### 0.5.0-prerelease.2

@@ -3,0 +16,0 @@ Fixes updating props after mount

6

dist/react-view-pager.min.js
/*!
* React View Pager 0.5.0-prerelease.2
* React View Pager 0.5.0-prerelease.3
* https://github.com/souporserious/react-view-pager
* Copyright (c) 2016 React View Pager Authors
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom"),require("react-motion"),require("get-prefix")):"function"==typeof define&&define.amd?define(["react","react-dom","react-motion","get-prefix"],t):"object"==typeof exports?exports.ReactViewPager=t(require("react"),require("react-dom"),require("react-motion"),require("get-prefix")):e.ReactViewPager=t(e.React,e.ReactDOM,e.ReactMotion,e.getPrefix)}(this,function(e,t,n,i){return function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return e[i].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="dist/",t(0)}([function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.AnimatedView=t.ImageView=t.Track=t.Frame=t.ViewPager=void 0;var r=n(1),o=i(r),a=n(10),s=i(a),u=n(16),c=i(u),p=n(20),f=i(p),l=n(21),h=i(l),y=n(9),d=i(y);t.ViewPager=o.default,t.Frame=s.default,t.Track=c.default,t.ImageView=f.default,t.AnimatedView=h.default,t.utils=d.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){var n={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),c=n(2),p=(i(c),n(3)),f=i(p),l=function(e){function t(e){o(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),i=new f.default,r=function(){return n.forceUpdate()};return i.on("viewChange",r),i.on("hydrated",r),n._pager=i,n}return s(t,e),u(t,[{key:"getChildContext",value:function(){return{pager:this._pager}}},{key:"componentDidMount",value:function(){var e=this;requestAnimationFrame(function(){e._pager.hydrate()})}},{key:"componentWillUnmount",value:function(){this._pager.destroy()}},{key:"getInstance",value:function(){return this._pager}},{key:"render",value:function(){var e=this.props,t=e.tag,n=r(e,["tag"]);return(0,c.createElement)(t,n)}}]),t}(c.Component);l.childContextTypes={pager:c.PropTypes.instanceOf(f.default)},l.propTypes={tag:c.PropTypes.string},l.defaultProps={tag:"div"},t.default=l,e.exports=t.default},function(t,n){t.exports=e},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){var n={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),p=n(4),f=i(p),l=n(5),h=i(l),y=n(8),d=i(y),v=n(9),g=function(e){function t(e){var n=e.index,i=r(e,["index"]);o(this,t);var s=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,i));return s.index=n,s.isCurrent=!1,s.setTarget(),s.setOrigin(),s}return s(t,e),c(t,[{key:"setTarget",value:function(){var e=this.pager.getStartCoords(this.index);this.pager.options.align&&(e+=this.pager.getAlignOffset(this)),this.target=e}},{key:"setOrigin",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.pager.trackPosition;this.origin=this.target-e}}]),t}(d.default),w=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.resize=function(){n.hydrate(),n.emit("resize")},n.hydrate=function(){n.frame&&n.frame.setSize(),n.track&&n.track.setSize(),n.views.forEach(function(e){e.setSize(),e.setTarget()}),n.setPositionValue(),n.setViewStyles(),n.emit("hydrated")},n.options=u({viewsToShow:"auto",viewsToMove:1,align:0,contain:!1,axis:"x",autoSize:!1,animations:[],infinite:!1,instant:!1,swipe:!0,swipeThreshold:.5,flickTimeout:300,accessibility:!0},e),n.views=[],n.currentIndex=0,n.currentView=null,n.currentTween=0,n.trackPosition=0,n.isSwiping=!1,n.animationBus=new h.default({animations:n.options.animations,origin:function(e){return e.origin}}),"undefined"==typeof window?a(n):(window.addEventListener("resize",n.resize),n)}return s(t,e),c(t,[{key:"setOptions",value:function(e){this.options=u({},this.options,e),this.animationBus.animations=this.options.animations}},{key:"destroy",value:function(){window.removeEventListener("resize",this.resize)}},{key:"addFrame",value:function(e){this.frame=new d.default({node:e,pager:this}),this.hydrate()}},{key:"addTrack",value:function(e){this.track=new d.default({node:e,pager:this}),this.hydrate()}},{key:"addView",value:function(e){var t=this.views.length,n=new g({node:e,index:t,pager:this});return this.views.push(n),this.currentView||this.setCurrentView(0,t,!0),this.emit("viewAdded"),this.hydrate(),n}},{key:"removeView",value:function(e){this.views=this.views.filter(function(t){return e!==t}),this.emit("viewRemoved"),this.hydrate()}},{key:"prev",value:function(){this.setCurrentView(-1)}},{key:"next",value:function(){this.setCurrentView(1)}},{key:"setCurrentView",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.currentIndex,n=arguments[2],i=this.options,r=i.viewsToMove,o=i.infinite,a=t+e*r,s=this.currentIndex,u=o?a:(0,v.clamp)(a,0,this.views.length-1),c=this.getView(s),p=this.getView(u);if(this.currentIndex=u,this.currentView=p,c.isCurrent=!1,p.isCurrent=!0,this.setPositionValue(),!n){this.getNumericViewsToShow(),this.views.length;this.emit("viewChange",this.getCurrentViewIndicies())}}},{key:"setPositionValue",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.currentView?this.currentView.target:0;if(!this.isSwiping){var t=this.options,n=t.viewsToShow,i=t.autoSize,r=t.infinite,o=t.contain,a=this.getTrackSize();if(r&&(e-=(Math.floor(this.currentIndex/this.views.length)||0)*a),o){var s="auto"===n&&i||n<=1?0:this.getFrameSize({autoSize:!1});e=(0,v.clamp)(e,s-a,0)}}this.trackPosition=e}},{key:"setViewStyles",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.options,n=t.infinite,i=t.align,r=(this.getFrameSize(),this.getTrackSize()),o=(0,v.modulo)(e,-r);this.views.reduce(function(t,a,s){var u=a.getSize(),c=t+u,p=t;return c+u*i<Math.abs(o)?(n&&(p+=r-t),a.inBounds=!1):a.inBounds=!0,a.setPosition(p),a.setOrigin(e),c},0)}},{key:"getNumericViewsToShow",value:function(){return isNaN(this.options.viewsToShow)?1:this.options.viewsToShow}},{key:"getMaxDimensions",value:function(e){var t=this,n=this.options.axis,i=[],r=[];return e.forEach(function(e){var n=isNaN(e)?e:t.getView(e);i.push(n.getSize("width")),r.push(n.getSize("height"))}),{width:"x"===n?(0,v.sum)(i):(0,v.max)(i),height:"y"===n?(0,v.sum)(r):(0,v.max)(r)}}},{key:"getCurrentViewIndicies",value:function(){var e=this.options,t=e.infinite,n=e.contain,i=[],r=isNaN(this.options.viewsToShow)?1:this.options.viewsToShow,o=this.currentIndex,a=this.currentIndex+(r-1);if(n){o=(0,v.clamp)(o,0,this.views.length-r),a=(0,v.clamp)(a,0,this.views.length-1);for(var s=o;s<=a;s++)i.push(s)}else for(var u=o;u<=a;u++)i.push(t?(0,v.modulo)(u,this.views.length):(0,v.clamp)(u,0,this.views.length-1));return i}},{key:"getFrameSize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.autoSize,n=void 0===t?this.options.autoSize:t,i=e.fullSize,r=void 0!==i&&i,o={width:0,height:0};if(this.views.length)if(n){var a=this.getCurrentViewIndicies();o=this.getMaxDimensions(a)}else this.frame&&(o={width:this.frame.getSize("width"),height:this.frame.getSize("height")});return r?o:o["x"===this.options.axis?"width":"height"]}},{key:"getTrackSize",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=e?this.views.length:this.views.length-1,n=0;return this.views.slice(0,t).forEach(function(e){n+=e.getSize()}),n}},{key:"getView",value:function(e){return this.views[(0,v.modulo)(e,this.views.length)]}},{key:"getStartCoords",value:function(e){var t=0;return this.views.slice(0,e).forEach(function(e){t-=e.getSize()}),t}},{key:"getAlignOffset",value:function(e){var t=this.getFrameSize({autoSize:!1}),n=e.getSize();return(t-n)*this.options.align}},{key:"getPositionValue",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.trackPosition,t=this.options,n=t.infinite,i=(t.contain,{x:0,y:0});if(this.currentTween=e,n){var r=this.getTrackSize();e=(0,v.modulo)(e,-r)||0}return this.emit("scroll",{progress:e/this.getTrackSize(!1),position:e}),i[this.options.axis]=e,i}},{key:"resetViews",value:function(){this.setCurrentView(0,(0,v.modulo)(this.currentIndex,this.views.length),!0)}}]),t}(f.default);t.default=w,e.exports=t.default},function(e,t){"use strict";e.exports=function(e){var t={},n=[];e=e||this,e.on=function(e,n,i){(t[e]=t[e]||[]).push([n,i])},e.off=function(e,i){e||(t={});for(var r=t[e]||n,o=r.length=i?r.length:0;o--;)i==r[o][0]&&r.splice(o,1)},e.emit=function(e){for(var i,r=t[e]||n,o=r.length>0?r.slice(0,r.length):r,a=0;i=o[a++];)i[0].apply(i[1],n.slice.call(arguments,1))}}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(6),s=i(a),u={perspective:"px",rotate:"deg",rotateX:"deg",rotateY:"deg",rotateZ:"deg",scale:"",scaleX:"",scaleY:"",scaleZ:"",skew:"deg",skewX:"deg",skewY:"deg",translateX:"px",translateY:"px",translateZ:"px"},c=Object.keys(u),p=function(){function e(t){var n=t.animations,i=t.element,o=t.origin;r(this,e),this.animations=n,this.element=i,this.origin=o}return o(e,[{key:"getStyles",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.element,t=this.origin(e),n=[],i={};return this.animations.forEach(function(e){var r=e.prop,o=e.unit||u[r]||"",a=(0,s.default)(e.stops)(t);c.indexOf(r)>-1?n.push(r+"("+a+o+")"):i[r]=""+a+o}),n.length&&(i.transform=n.join(" ")),i}},{key:"applyStyles",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.element,t=this.getStyles(e);Object.keys(t).forEach(function(n){return e.style[n]=t[n]})}}]),e}();t.default=p,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e){var t=[],n=[],i=[],r=[];e.forEach(function(e){var o=s(e,2),a=o[0],u=o[1];t.push(a),isNaN(u)?(n.push(parseInt(u.substr(1,2),16)),i.push(parseInt(u.substr(3,2),16)),r.push(parseInt(u.substr(5,2),16))):n.push(u)});var o=(0,c.default)(t,n);if(!i.length||!r.length)return function(e){return o(e)};var u=function(){var e=(0,c.default)(t,i),n=(0,c.default)(t,r);return{v:function(t){return"rgb("+Math.round(o(t))+", "+Math.round(e(t))+", "+Math.round(n(t))+")"}}}();return"object"===("undefined"==typeof u?"undefined":a(u))?u.v:void 0}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(t,"__esModule",{value:!0});var a="function"==typeof Symbol&&"symbol"===o(Symbol.iterator)?function(e){return"undefined"==typeof e?"undefined":o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":"undefined"==typeof e?"undefined":o(e)},s=function(){function e(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.default=r;var u=n(7),c=i(u);e.exports=t.default},function(e,t){"use strict";function n(e,t){return function(n){if(n<=e[0])return t[0];if(n>=e[e.length-1])return t[e.length-1];for(var i=0,r=e.length-1;r-i>1;){var o=i+r>>1;n<e[o]?r=o:i=o}return t[i]+(t[r]-t[i])/(e[r]-e[i])*(n-e[i])}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(){function e(t){var i=t.node,r=t.pager,o=t.width,a=t.height;n(this,e),this.node=i,this.pager=r,this.x=this.y=0,this.setSize(o,a)}return i(e,[{key:"setSize",value:function(e,t){this.width=e||this.node.offsetWidth,this.height=t||this.node.offsetHeight}},{key:"setPosition",value:function(e){this[this.pager.options.axis]=e}},{key:"getSize",value:function(e){if("width"===e||"height"===e)return this[e];var t=this.pager.options.axis;return this["x"===t?"width":"height"]}},{key:"getPosition",value:function(){return this[this.pager.options.axis]}}]),e}();t.default=r,e.exports=t.default},function(e,t){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function i(e,t){return(e%t+t)%t}function r(e,t,n){return Math.min(Math.max(t,e),n)}function o(e){return e.reduce(function(e,t){return e+t},0)}function a(e){return Math.max.apply(null,e)}function s(e,t,r){return[].concat(n(Array(t-e))).map(function(t,n){return i(e+n,r)})}Object.defineProperty(t,"__esModule",{value:!0}),t.modulo=i,t.clamp=r,t.sum=o,t.max=a,t.range=s},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),c=n(2),p=i(c),f=n(11),l=(i(f),n(12)),h=n(3),y=i(h),d=n(13),v=i(d),g=n(14),w=i(g),b=n(15),m=i(b),_={tag:c.PropTypes.any,autoSize:c.PropTypes.bool,accessibility:c.PropTypes.bool,springConfig:c.PropTypes.objectOf(c.PropTypes.number)},x=function(e){function t(e){r(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n._setFrameSize=function(){var e=n.context.pager.getFrameSize({fullSize:!0});e.width&&e.height&&n.setState(e,function(){n.state.instant&&n.setState({instant:!1})})},n.state={width:0,height:0,instant:!0},n._hydrate=!1,n}return a(t,e),u(t,[{key:"componentWillMount",value:function(){var e=this.context.pager;e.setOptions(this.props),this._swipe=new v.default(e),this._keyboard=new w.default(e)}},{key:"componentDidMount",value:function(){var e=this.context.pager;e.addFrame((0,f.findDOMNode)(this)),this._setFrameSize(),e.on("viewAdded",this._setFrameSize),e.on("viewChange",this._setFrameSize)}},{key:"componentWillReceiveProps",value:function(e){this.props.autoSize===e.autoSize&&this.props.accessibility===e.accessibility||(this.context.pager.setOptions(e),this._hydrate=!0)}},{key:"componentDidUpdate",value:function(e){this._hydrate&&(this.context.pager.hydrate(),this._hydrate=!1)}},{key:"_getFrameStyle",value:function(){var e=this.state,t=e.width,n=e.height,i=e.instant;return{maxWidth:i?t:(0,l.spring)(t),height:i?n:(0,l.spring)(n)}}},{key:"_renderFrame",value:function(e){var t=(this.context.pager,this.props),n=t.tag,i=t.accessibility,r=(0,m.default)(s({},this._swipe.getEvents(),this._keyboard.getEvents(),{tabIndex:i?0:null}),this.props,_);return(0,c.createElement)(n,s({},r,{style:s({},e,r.style)}))}},{key:"render",value:function(){var e=this,t=(this.state.height,{position:"relative",overflow:"hidden"});return this.props.autoSize?p.default.createElement(l.Motion,{style:this._getFrameStyle()},function(n){return n.maxWidth&&(t.maxWidth=n.maxWidth),n.height&&(t.height=n.height),e._renderFrame(t)}):this._renderFrame(t)}}]),t}(c.Component);x.contextTypes={pager:c.PropTypes.instanceOf(y.default)},x.propTypes=_,x.defaultProps={tag:"div",autoSize:!1,accessibility:!0,springConfig:l.presets.noWobble},t.default=x,e.exports=t.default},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return e.touches&&e.touches[0]||e}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function(){function e(t){var r=this;n(this,e),this._onSwipeStart=function(e){var t=i(e),n=t.pageX,o=t.pageY;r.pager.isSwiping=!0,r._swipeStart={x:n,y:o},r._swipeDiff={x:0,y:0},r._isFlick=!0,setTimeout(function(){r._isFlick=!1},r.pager.options.flickTimeout),r.pager.emit("swipeStart")},this._onSwipeMove=function(e){if(r.pager.isSwiping){var t=r.pager.options,n=t.swipeThreshold,o=t.axis,a=i(e),s=a.pageX,u=a.pageY;if(r._trackStart||(r._trackStart=r.pager.currentTween),r._swipeDiff={x:r._swipeStart.x-s,y:r._swipeStart.y-u},r._isSwipe(n)){e.preventDefault(),e.stopPropagation();var c=r._swipeDiff[o],p=r._trackStart-c;r.pager.setPositionValue(p),r.pager.emit("swipeMove")}}},this._onSwipeEnd=function(){var e=r.pager.options,t=e.swipeThreshold,n=e.viewsToMove,i=e.axis,o=(e.infinite,r._isFlick?t:r.pager.currentView.getSize()*n*t);r.pager.isSwiping=!1,r._trackStart=!1,(r._swipeDiff.x||r._swipeDiff.y)&&(r._isSwipe(o)?r._swipeDiff[i]<0?r.pager.prev():r.pager.next():r.pager.setPositionValue()),r.pager.emit("swipeEnd")},this._onSwipePast=function(){r.pager.isSwiping&&r._onSwipeEnd()},this.pager=t,this._trackStart=!1,this._swipeStart=this._swipeDiff={x:0,y:0}}return r(e,[{key:"_isSwipe",value:function(e){var t=this._swipeDiff,n=t.x,i=t.y;return"x"===this.pager.options.axis?Math.abs(n)>Math.max(e,Math.abs(i)):Math.abs(n)<Math.max(e,Math.abs(i))}},{key:"getEvents",value:function(){var e=this.pager.options.swipe,t={};return e!==!0&&"mouse"!==e||(t.onMouseDown=this._onSwipeStart,t.onMouseMove=this._onSwipeMove,t.onMouseUp=this._onSwipeEnd,t.onMouseLeave=this._onSwipePast),e!==!0&&"touch"!==e||(t.onTouchStart=this._onSwipeStart,t.onTouchMove=this._onSwipeMove,t.onTouchEnd=this._onSwipeEnd),t}}]),e}();t.default=o,e.exports=t.default},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(9),a=function(){function e(t){var n=this;i(this,e),this._handleKeyDown=function(e){switch(e.key){case"ArrowUp":case"ArrowLeft":return void n.pager.prev();case"ArrowDown":case"ArrowRight":case" ":return void n.pager.next();case"Home":return void n.pager.setCurrentView(0,0);case"End":return void n.pager.setCurrentView(0,n.pager.views.length-1)}for(var t=(0,o.clamp)(n.pager.views.length,0,9),i=1;i<=t;i++)+e.key===i&&n.pager.setCurrentView(0,i-1)},this.pager=t}return r(e,[{key:"getEvents",value:function(){var e={};return this.pager.options.accessibility&&(e.onKeyDown=this._handleKeyDown),e}}]),e}();t.default=a,e.exports=t.default},function(e,t){"use strict";function n(e,t,n){for(var i in t)t.hasOwnProperty(i)&&!n[i]&&(e[i]=t[i]);return e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},f=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(2),h=i(l),y=n(11),d=(i(y),n(12)),v=n(3),g=i(v),w=n(17),b=i(w),m=n(18),_=i(m),x=n(15),S=i(x),O=n(19)("transform"),P=function(e){function t(){var e,n,i,r;a(this,t);for(var o=arguments.length,u=Array(o),c=0;c<o;c++)u[c]=arguments[c];return n=i=s(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),i.state={x:0,y:0},r=n,s(i,r)}return u(t,e),f(t,[{key:"componentWillReceiveProps",value:function(e){var t=this,n=e.trackPosition,i=this.context.pager;i.setViewStyles(n),this.setState(i.getPositionValue(n)),this.props.trackPosition!==n&&requestAnimationFrame(function(){return t.props.onScroll(n/i.getTrackSize(!1)*-1,n)})}},{key:"_renderViews",value:function(e){return l.Children.map(this.props.children,function(t){return h.default.createElement(b.default,{trackSize:e,children:t})})}},{key:"render",value:function(){var e=this.context.pager,t=this.props,n=t.tag,i=(t.trackPosition,t.children),a=o(t,["tag","trackPosition","children"]),s=this.state,u=s.x,c=s.y,f=e.getTrackSize(),h=p({},a.style,r({},O,"translate3d("+u+"px, "+c+"px, 0)"));if(f){var y=e.options,d=y.axis,v=y.viewsToShow,g="x"===d?"width":"height";h[g]="auto"===v?f:l.Children.count(i)/v*100+"%"}return(0,l.createElement)(n,p({},a,{style:h}),this._renderViews(f))}}]),t}(l.Component);P.propTypes=k,P.contextTypes={pager:l.PropTypes.instanceOf(g.default)};var T=function(){return null},k={tag:l.PropTypes.any,currentView:l.PropTypes.any,viewsToShow:l.PropTypes.oneOfType([l.PropTypes.number,l.PropTypes.oneOf(["auto"])]),viewsToMove:l.PropTypes.number,align:l.PropTypes.number,contain:l.PropTypes.bool,axis:l.PropTypes.oneOf(["x","y"]),animations:l.PropTypes.array,infinite:l.PropTypes.bool,instant:l.PropTypes.bool,swipe:l.PropTypes.oneOf([!0,!1,"mouse","touch"]),swipeThreshold:l.PropTypes.number,flickTimeout:l.PropTypes.number,springConfig:l.PropTypes.objectOf(l.PropTypes.number),onSwipeStart:l.PropTypes.func,onSwipeMove:l.PropTypes.func,onSwipeEnd:l.PropTypes.func,onScroll:l.PropTypes.func,beforeViewChange:l.PropTypes.func,afterViewChange:l.PropTypes.func},j=function(e,t){return e.viewsToShow!==t.viewsToShow||e.viewsToMove!==t.viewsToMove||e.align!==t.align||e.axis!==t.axis||e.animations!==t.animations||e.infinite!==t.infinite||e.swipe!==t.swipe||e.swipeThreshold!==t.swipeThreshold||e.flickTimeout!==t.flickTimeout},M=function(e){function t(){var e,n,i,r;a(this,t);for(var o=arguments.length,u=Array(o),c=0;c<o;c++)u[c]=arguments[c];return n=i=s(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),i.state={instant:!1},i._currentTween=0,i._hydrate=!1,i._handleOnRest=function(){i.props.infinite&&!i.state.instant&&(i.context.pager.resetViews(),i._setValueInstantly(!0,!0)),i.props.afterViewChange()},r=n,s(i,r)}return u(t,e),f(t,[{key:"componentWillMount",value:function(){this.context.pager.setOptions(this.props)}},{key:"componentDidMount",value:function(){var e=this,t=this.context.pager;t.addTrack((0,y.findDOMNode)(this)),this.scrollTo((0,_.default)(this.props.currentView,this.props.children)),t.on("hydrated",function(){return e._setValueInstantly(!0,!0)}),t.on("swipeMove",function(){return e._setValueInstantly(!0)}),t.on("swipeEnd",function(){return e._setValueInstantly(!1)}),t.on("swipeStart",this.props.onSwipeStart),t.on("swipeMove",this.props.onSwipeMove),t.on("swipeEnd",this.props.onSwipeEnd),t.on("viewChange",this.props.beforeViewChange)}},{key:"componentWillReceiveProps",value:function(e){var t=e.currentView,n=e.instant,i=e.children;this.props.instant!==n&&this._setValueInstantly(n),void 0!==("undefined"==typeof t?"undefined":c(t))&&this.props.currentView!==t&&this.scrollTo((0,_.default)(t,i)),j(this.props,e)&&(this.context.pager.setOptions(e),this._hydrate=!0)}},{key:"componentDidUpdate",value:function(e){this._hydrate&&(this.context.pager.hydrate(),this._hydrate=!1)}},{key:"prev",value:function(){this.context.pager.prev()}},{key:"next",value:function(){this.context.pager.next()}},{key:"scrollTo",value:function(e){this.context.pager.setCurrentView(0,e)}},{key:"_setValueInstantly",value:function(e,t){var n=this;this.setState({instant:e},function(){t&&n.setState({instant:!1})})}},{key:"_getTrackStyle",value:function(){var e=this.context.pager.trackPosition;return this.state.instant||(e=(0,d.spring)(e,this.props.springConfig)),{trackPosition:e}}},{key:"render",value:function(){var e=this.props,t=e.tag,n=e.onScroll,i=o(e,["tag","onScroll"]);return h.default.createElement(d.Motion,{style:this._getTrackStyle(),onRest:this._handleOnRest},function(e){var r=e.trackPosition;return(0,l.createElement)(P,(0,S.default)({trackPosition:r,tag:t,onScroll:n},i,k))})}}]),t}(l.Component);M.propTypes=k,M.defaultProps={tag:"div",currentView:0,viewsToShow:1,viewsToMove:1,align:0,contain:!1,axis:"x",infinite:!1,instant:!1,swipe:!0,swipeThreshold:.5,flickTimeout:300,springConfig:d.presets.noWobble,onSwipeStart:T,onSwipeMove:T,onSwipeEnd:T,onScroll:T,beforeViewChange:T,afterViewChange:T},M.contextTypes={pager:l.PropTypes.instanceOf(g.default)},t.default=M,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){var n={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),p=n(2),f=(i(p),n(11)),l=(i(f),n(3)),h=i(l),y=function(e){function t(){var e,n,i,r;o(this,t);for(var s=arguments.length,u=Array(s),c=0;c<s;c++)u[c]=arguments[c];return n=i=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),i._viewInstance=null,r=n,a(i,r)}return s(t,e),c(t,[{key:"getChildContext",value:function(){return{view:this._viewInstance}}},{key:"componentDidMount",value:function(){this._viewInstance=this.context.pager.addView((0,f.findDOMNode)(this)),this.forceUpdate()}},{key:"componentWillUnmount",value:function(){this.context.pager.removeView(this._viewInstance)}},{key:"render",value:function(){var e=this.context.pager,t=e.options,n=t.viewsToShow,i=t.axis,o=this.props,a=(o.trackSize,o.children),s=r(o,["trackSize","children"]),c=p.Children.only(a),f=u({},c.props.style);return"x"===i&&(f.display="inline-block"),"auto"!==n&&e.views.length&&(f["x"===i?"width":"height"]=100/e.views.length+"%"),this._viewInstance&&(e.options.infinite&&!this._viewInstance.inBounds&&(f.position="relative",f["y"===i?"top":"left"]=this._viewInstance.getPosition()),f=u({},f,e.animationBus.getStyles(this._viewInstance))),(0,p.cloneElement)(c,u({},s,{style:f}))}}]),t}(p.Component);y.contextTypes={pager:p.PropTypes.instanceOf(h.default)},y.childContextTypes={view:p.PropTypes.any},t.default=y,e.exports=t.default},function(e,t,n){"use strict";function i(e,t){var n=null;return r.Children.forEach(t,function(t,i){if(t.key===e||i===e)return void(n=i)}),n}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var r=n(2);e.exports=t.default},function(e,t){e.exports=i},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),c=n(2),p=(i(c),n(3)),f=i(p),l=function(e){function t(){var e,n,i,a;r(this,t);for(var s=arguments.length,u=Array(s),c=0;c<s;c++)u[c]=arguments[c];return n=i=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),i._handleLoaded=function(e){i.context.pager.hydrate(),"function"==typeof i.props.onLoad&&i.props.onLoad(e)},a=n,o(i,a)}return a(t,e),u(t,[{key:"render",value:function(){return(0,c.createElement)("img",s({},this.props,{onLoad:this._handleLoaded}))}}]),t}(c.Component);l.contextTypes={pager:c.PropTypes.instanceOf(f.default)},t.default=l,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){var n={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),p=n(2),f=(i(p),n(5)),l=i(f),h=n(3),y=i(h),d=n(15),v=i(d),g={tag:p.PropTypes.string,index:p.PropTypes.number,animations:p.PropTypes.array},w=function(e){function t(){return o(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return s(t,e),c(t,[{key:"componentWillMount",value:function(){var e=this.props.animations;e.length&&(this._animationBus=new l.default({animations:e,origin:function(e){return e.origin}}))}},{key:"render",value:function(){var e=this.props,t=e.tag,n=e.index,i=r(e,["tag","index"]),o=u({},i.style);if(this._animationBus){var a=this.context.view||this.context.pager.getView(n);a&&(o=u({},i.style,this._animationBus.getStyles(a)))}return(0,p.createElement)(t,(0,v.default)({style:o},this.props,g))}}]),t}(p.Component);w.contextTypes={pager:p.PropTypes.instanceOf(y.default),view:p.PropTypes.any},w.propTypes=g,w.defaultProps={tag:"div",animations:[]},t.default=w,e.exports=t.default}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom"),require("react-motion"),require("get-prefix")):"function"==typeof define&&define.amd?define(["react","react-dom","react-motion","get-prefix"],t):"object"==typeof exports?exports.ReactViewPager=t(require("react"),require("react-dom"),require("react-motion"),require("get-prefix")):e.ReactViewPager=t(e.React,e.ReactDOM,e.ReactMotion,e.getPrefix)}(this,function(e,t,n,i){return function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return e[i].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="dist/",t(0)}([function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.AnimatedView=t.View=t.Track=t.Frame=t.ViewPager=void 0;var r=n(1),o=i(r),a=n(10),s=i(a),u=n(16),c=i(u),p=n(17),f=i(p),l=n(20),h=i(l),y=n(9),d=i(y);t.ViewPager=o.default,t.Frame=s.default,t.Track=c.default,t.View=f.default,t.AnimatedView=h.default,t.utils=d.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){var n={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),c=n(2),p=(i(c),n(3)),f=i(p),l=function(e){function t(e){o(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),i=new f.default,r=function(){return n.forceUpdate()};return i.on("viewChange",r),i.on("hydrated",r),n._pager=i,n}return s(t,e),u(t,[{key:"getChildContext",value:function(){return{pager:this._pager}}},{key:"componentDidMount",value:function(){var e=this;requestAnimationFrame(function(){e._pager.hydrate()})}},{key:"componentWillUnmount",value:function(){this._pager.destroy()}},{key:"getInstance",value:function(){return this._pager}},{key:"render",value:function(){var e=this.props,t=e.tag,n=r(e,["tag"]);return(0,c.createElement)(t,n)}}]),t}(c.Component);l.childContextTypes={pager:c.PropTypes.instanceOf(f.default)},l.propTypes={tag:c.PropTypes.string},l.defaultProps={tag:"div"},t.default=l,e.exports=t.default},function(t,n){t.exports=e},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){var n={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),p=n(4),f=i(p),l=n(5),h=i(l),y=n(8),d=i(y),v=n(9),g=function(e){function t(e){var n=e.index,i=r(e,["index"]);o(this,t);var s=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,i));return s.index=n,s.isCurrent=!1,s.setTarget(),s.setOrigin(),s}return s(t,e),c(t,[{key:"setTarget",value:function(){var e=this.pager.getStartCoords(this.index);this.pager.options.align&&(e+=this.pager.getAlignOffset(this)),this.target=e}},{key:"setOrigin",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.pager.trackPosition;this.origin=this.target-e}}]),t}(d.default),w=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.resize=function(){n.hydrate(),n.emit("resize")},n.hydrate=function(){n.frame&&n.frame.setSize(),n.track&&n.track.setSize(),n.views.forEach(function(e){e.setSize(),e.setTarget()}),n.setPositionValue(),n.setViewStyles(),n.emit("hydrated")},n.options=u({viewsToShow:"auto",viewsToMove:1,align:0,contain:!1,axis:"x",autoSize:!1,animations:[],infinite:!1,instant:!1,swipe:!0,swipeThreshold:.5,flickTimeout:300,accessibility:!0},e),n.views=[],n.currentIndex=0,n.currentView=null,n.currentTween=0,n.trackPosition=0,n.isSwiping=!1,n.animationBus=new h.default({animations:n.options.animations,origin:function(e){return e.origin}}),"undefined"==typeof window?a(n):(window.addEventListener("resize",n.resize),n)}return s(t,e),c(t,[{key:"setOptions",value:function(e){var t=this.options;this.options=u({},this.options,e),this.animationBus.animations=this.options.animations,t.viewsToShow!==this.options.viewsToShow&&this.emit("viewChange",this.getCurrentViewIndicies())}},{key:"destroy",value:function(){window.removeEventListener("resize",this.resize)}},{key:"addFrame",value:function(e){this.frame=new d.default({node:e,pager:this}),this.hydrate()}},{key:"addTrack",value:function(e){this.track=new d.default({node:e,pager:this}),this.hydrate()}},{key:"addView",value:function(e){var t=this.views.length,n=new g({node:e,index:t,pager:this});this.views.push(n),this.currentView||this.setCurrentView(0,t,!0),this.emit("viewAdded");var i=e.querySelectorAll("img"),r=i.length;if(r)for(var o=0;o<r;o++)i[o].onload=this.hydrate;return e instanceof HTMLImageElement?e.onload=this.hydrate:this.hydrate(),n}},{key:"removeView",value:function(e){this.views=this.views.filter(function(t){return e!==t}),this.emit("viewRemoved"),this.hydrate()}},{key:"prev",value:function(){this.setCurrentView(-1)}},{key:"next",value:function(){this.setCurrentView(1)}},{key:"setCurrentView",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.currentIndex,n=arguments[2],i=this.options,r=i.viewsToMove,o=i.infinite,a=t+e*r,s=this.currentIndex,u=o?a:(0,v.clamp)(a,0,this.views.length-1),c=this.getView(s),p=this.getView(u);this.currentIndex=u,this.currentView=p,c.isCurrent=!1,p.isCurrent=!0,this.setPositionValue(),n||this.emit("viewChange",this.getCurrentViewIndicies())}},{key:"setPositionValue",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.currentView?this.currentView.target:0;if(!this.isSwiping){var t=this.options,n=t.viewsToShow,i=t.autoSize,r=t.infinite,o=t.contain,a=this.getTrackSize();if(r&&(e-=(Math.floor(this.currentIndex/this.views.length)||0)*a),o){var s="auto"===n&&i||n<=1?0:this.getFrameSize({autoSize:!1});e=(0,v.clamp)(e,s-a,0)}}this.trackPosition=e}},{key:"setViewStyles",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.options,n=t.infinite,i=t.align,r=(this.getFrameSize(),this.getTrackSize()),o=(0,v.modulo)(e,-r);this.views.reduce(function(t,a,s){var u=a.getSize(),c=t+u,p=t;return c+u*i<Math.abs(o)?(n&&(p+=r-t),a.inBounds=!1):a.inBounds=!0,a.setPosition(p),a.setOrigin(e),c},0)}},{key:"getNumericViewsToShow",value:function(){return isNaN(this.options.viewsToShow)?1:this.options.viewsToShow}},{key:"getMaxDimensions",value:function(e){var t=this,n=this.options.axis,i=[],r=[];return e.forEach(function(e){var n=isNaN(e)?e:t.getView(e);i.push(n.getSize("width")),r.push(n.getSize("height"))}),{width:"x"===n?(0,v.sum)(i):(0,v.max)(i),height:"y"===n?(0,v.sum)(r):(0,v.max)(r)}}},{key:"getCurrentViewIndicies",value:function(){var e=this.options,t=e.infinite,n=e.contain,i=[],r=isNaN(this.options.viewsToShow)?1:this.options.viewsToShow,o=this.currentIndex,a=this.currentIndex+(r-1);if(n){o=(0,v.clamp)(o,0,this.views.length-r),a=(0,v.clamp)(a,0,this.views.length-1);for(var s=o;s<=a;s++)i.push(s)}else for(var u=o;u<=a;u++)i.push(t?(0,v.modulo)(u,this.views.length):(0,v.clamp)(u,0,this.views.length-1));return i}},{key:"getFrameSize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.autoSize,n=void 0===t?this.options.autoSize:t,i=e.fullSize,r=void 0!==i&&i,o={width:0,height:0};if(this.views.length)if(n){var a=this.getCurrentViewIndicies();o=this.getMaxDimensions(a)}else this.frame&&(o={width:this.frame.getSize("width"),height:this.frame.getSize("height")});return r?o:o["x"===this.options.axis?"width":"height"]}},{key:"getTrackSize",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=e?this.views.length:this.views.length-1,n=0;return this.views.slice(0,t).forEach(function(e){n+=e.getSize()}),n}},{key:"getView",value:function(e){return this.views[(0,v.modulo)(e,this.views.length)]}},{key:"getStartCoords",value:function(e){var t=0;return this.views.slice(0,e).forEach(function(e){t-=e.getSize()}),t}},{key:"getAlignOffset",value:function(e){var t=this.getFrameSize({autoSize:!1}),n=e.getSize();return(t-n)*this.options.align}},{key:"getPositionValue",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.trackPosition,t=this.options,n=t.infinite,i=(t.contain,{x:0,y:0});if(this.currentTween=e,n){var r=this.getTrackSize();e=(0,v.modulo)(e,-r)||0}return this.emit("scroll",{progress:e/this.getTrackSize(!1),position:e}),i[this.options.axis]=e,i}},{key:"resetViews",value:function(){this.setCurrentView(0,(0,v.modulo)(this.currentIndex,this.views.length),!0)}}]),t}(f.default);t.default=w,e.exports=t.default},function(e,t){"use strict";e.exports=function(e){var t={},n=[];e=e||this,e.on=function(e,n,i){(t[e]=t[e]||[]).push([n,i])},e.off=function(e,i){e||(t={});for(var r=t[e]||n,o=r.length=i?r.length:0;o--;)i==r[o][0]&&r.splice(o,1)},e.emit=function(e){for(var i,r=t[e]||n,o=r.length>0?r.slice(0,r.length):r,a=0;i=o[a++];)i[0].apply(i[1],n.slice.call(arguments,1))}}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=n(6),s=i(a),u={perspective:"px",rotate:"deg",rotateX:"deg",rotateY:"deg",rotateZ:"deg",scale:"",scaleX:"",scaleY:"",scaleZ:"",skew:"deg",skewX:"deg",skewY:"deg",translateX:"px",translateY:"px",translateZ:"px"},c=Object.keys(u),p=function(){function e(t){var n=t.animations,i=t.element,o=t.origin;r(this,e),this.animations=n,this.element=i,this.origin=o}return o(e,[{key:"getStyles",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.element,t=this.origin(e),n=[],i={};return this.animations.forEach(function(e){var r=e.prop,o=e.unit||u[r]||"",a=(0,s.default)(e.stops)(t);c.indexOf(r)>-1?n.push(r+"("+a+o+")"):i[r]=""+a+o}),n.length&&(i.transform=n.join(" ")),i}},{key:"applyStyles",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.element,t=this.getStyles(e);Object.keys(t).forEach(function(n){return e.style[n]=t[n]})}}]),e}();t.default=p,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e){var t=[],n=[],i=[],r=[];e.forEach(function(e){var o=s(e,2),a=o[0],u=o[1];t.push(a),isNaN(u)?(n.push(parseInt(u.substr(1,2),16)),i.push(parseInt(u.substr(3,2),16)),r.push(parseInt(u.substr(5,2),16))):n.push(u)});var o=(0,c.default)(t,n);if(!i.length||!r.length)return function(e){return o(e)};var u=function(){var e=(0,c.default)(t,i),n=(0,c.default)(t,r);return{v:function(t){return"rgb("+Math.round(o(t))+", "+Math.round(e(t))+", "+Math.round(n(t))+")"}}}();return"object"===("undefined"==typeof u?"undefined":a(u))?u.v:void 0}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(t,"__esModule",{value:!0});var a="function"==typeof Symbol&&"symbol"===o(Symbol.iterator)?function(e){return"undefined"==typeof e?"undefined":o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":"undefined"==typeof e?"undefined":o(e)},s=function(){function e(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.default=r;var u=n(7),c=i(u);e.exports=t.default},function(e,t){"use strict";function n(e,t){return function(n){if(n<=e[0])return t[0];if(n>=e[e.length-1])return t[e.length-1];for(var i=0,r=e.length-1;r-i>1;){var o=i+r>>1;n<e[o]?r=o:i=o}return t[i]+(t[r]-t[i])/(e[r]-e[i])*(n-e[i])}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(){function e(t){var i=t.node,r=t.pager,o=t.width,a=t.height;n(this,e),this.node=i,this.pager=r,this.x=this.y=0,this.setSize(o,a)}return i(e,[{key:"setSize",value:function(e,t){this.width=e||this.node.offsetWidth,this.height=t||this.node.offsetHeight}},{key:"setPosition",value:function(e){this[this.pager.options.axis]=e}},{key:"getSize",value:function(e){if("width"===e||"height"===e)return this[e];var t=this.pager.options.axis;return this["x"===t?"width":"height"]}},{key:"getPosition",value:function(){return this[this.pager.options.axis]}}]),e}();t.default=r,e.exports=t.default},function(e,t){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function i(e,t){return(e%t+t)%t}function r(e,t,n){return Math.min(Math.max(t,e),n)}function o(e){return e.reduce(function(e,t){return e+t},0)}function a(e){return Math.max.apply(null,e)}function s(e,t,r){return[].concat(n(Array(t-e))).map(function(t,n){return i(e+n,r)})}Object.defineProperty(t,"__esModule",{value:!0}),t.modulo=i,t.clamp=r,t.sum=o,t.max=a,t.range=s},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),c=n(2),p=i(c),f=n(11),l=(i(f),n(12)),h=n(3),y=i(h),d=n(13),v=i(d),g=n(14),w=i(g),m=n(15),b=i(m),_={tag:c.PropTypes.any,autoSize:c.PropTypes.oneOf([!0,!1,"width","height"]),accessibility:c.PropTypes.bool,springConfig:c.PropTypes.objectOf(c.PropTypes.number)},S=function(e){function t(e){r(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n._setFrameSize=function(){var e=n.context.pager.getFrameSize({fullSize:!0});e.width&&e.height&&n.setState(e,function(){n.state.instant&&n.setState({instant:!1})})},n.state={width:0,height:0,instant:!0},n._hydrate=!1,n}return a(t,e),u(t,[{key:"componentWillMount",value:function(){var e=this.context.pager;e.setOptions(this.props),this._swipe=new v.default(e),this._keyboard=new w.default(e)}},{key:"componentDidMount",value:function(){var e=this.context.pager;e.addFrame((0,f.findDOMNode)(this)),this._setFrameSize(),e.on("viewAdded",this._setFrameSize),e.on("viewChange",this._setFrameSize)}},{key:"componentWillReceiveProps",value:function(e){this.props.autoSize===e.autoSize&&this.props.accessibility===e.accessibility||(this.context.pager.setOptions(e),this._hydrate=!0)}},{key:"componentDidUpdate",value:function(e){this._hydrate&&(this.context.pager.hydrate(),this._hydrate=!1)}},{key:"_getFrameStyle",value:function(){var e=this.state,t=e.width,n=e.height,i=e.instant;return{maxWidth:i?t:(0,l.spring)(t),height:i?n:(0,l.spring)(n)}}},{key:"_renderFrame",value:function(e){var t=(this.context.pager,this.props),n=t.tag,i=t.accessibility,r=(0,b.default)(s({},this._swipe.getEvents(),this._keyboard.getEvents(),{tabIndex:i?0:null}),this.props,_);return(0,c.createElement)(n,s({},r,{style:s({},e,r.style)}))}},{key:"render",value:function(){var e=this,t=this.props.autoSize,n=(this.state.height,{position:"relative",overflow:"hidden"});return t?p.default.createElement(l.Motion,{style:this._getFrameStyle()},function(i){return t!==!0&&"width"!==t||!i.maxWidth||(n.maxWidth=i.maxWidth),t!==!0&&"height"!==t||!i.height||(n.height=i.height),e._renderFrame(n)}):this._renderFrame(n)}}]),t}(c.Component);S.contextTypes={pager:c.PropTypes.instanceOf(y.default)},S.propTypes=_,S.defaultProps={tag:"div",autoSize:!1,accessibility:!0,springConfig:l.presets.noWobble},t.default=S,e.exports=t.default},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return e.touches&&e.touches[0]||e}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function(){function e(t){var r=this;n(this,e),this._onSwipeStart=function(e){var t=i(e),n=t.pageX,o=t.pageY;r.pager.isSwiping=!0,r._swipeStart={x:n,y:o},r._swipeDiff={x:0,y:0},r._isFlick=!0,setTimeout(function(){r._isFlick=!1},r.pager.options.flickTimeout),r.pager.emit("swipeStart")},this._onSwipeMove=function(e){if(r.pager.isSwiping){var t=r.pager.options,n=t.swipeThreshold,o=t.axis,a=i(e),s=a.pageX,u=a.pageY;if(r._trackStart||(r._trackStart=r.pager.currentTween),r._swipeDiff={x:r._swipeStart.x-s,y:r._swipeStart.y-u},r._isSwipe(n)){e.preventDefault(),e.stopPropagation();var c=r._swipeDiff[o],p=r._trackStart-c;r.pager.setPositionValue(p),r.pager.emit("swipeMove")}}},this._onSwipeEnd=function(){var e=r.pager.options,t=e.swipeThreshold,n=e.viewsToMove,i=e.axis,o=(e.infinite,r._isFlick?t:r.pager.currentView.getSize()*n*t);r.pager.isSwiping=!1,r._trackStart=!1,(r._swipeDiff.x||r._swipeDiff.y)&&(r._isSwipe(o)?r._swipeDiff[i]<0?r.pager.prev():r.pager.next():r.pager.setPositionValue()),r.pager.emit("swipeEnd")},this._onSwipePast=function(){r.pager.isSwiping&&r._onSwipeEnd()},this.pager=t,this._trackStart=!1,this._swipeStart=this._swipeDiff={x:0,y:0}}return r(e,[{key:"_isSwipe",value:function(e){var t=this._swipeDiff,n=t.x,i=t.y;return"x"===this.pager.options.axis?Math.abs(n)>Math.max(e,Math.abs(i)):Math.abs(n)<Math.max(e,Math.abs(i))}},{key:"getEvents",value:function(){var e=this.pager.options.swipe,t={};return e!==!0&&"mouse"!==e||(t.onMouseDown=this._onSwipeStart,t.onMouseMove=this._onSwipeMove,t.onMouseUp=this._onSwipeEnd,t.onMouseLeave=this._onSwipePast),e!==!0&&"touch"!==e||(t.onTouchStart=this._onSwipeStart,t.onTouchMove=this._onSwipeMove,t.onTouchEnd=this._onSwipeEnd),t}}]),e}();t.default=o,e.exports=t.default},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(9),a=function(){function e(t){var n=this;i(this,e),this._handleKeyDown=function(e){switch(e.key){case"ArrowUp":case"ArrowLeft":return void n.pager.prev();case"ArrowDown":case"ArrowRight":case" ":return void n.pager.next();case"Home":return void n.pager.setCurrentView(0,0);case"End":return void n.pager.setCurrentView(0,n.pager.views.length-1)}for(var t=(0,o.clamp)(n.pager.views.length,0,9),i=1;i<=t;i++)+e.key===i&&n.pager.setCurrentView(0,i-1)},this.pager=t}return r(e,[{key:"getEvents",value:function(){var e={};return this.pager.options.accessibility&&(e.onKeyDown=this._handleKeyDown),e}}]),e}();t.default=a,e.exports=t.default},function(e,t){"use strict";function n(e,t,n){for(var i in t)t.hasOwnProperty(i)&&!n[i]&&(e[i]=t[i]);return e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},f=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(2),h=i(l),y=n(11),d=(i(y),n(12)),v=n(3),g=i(v),w=n(17),m=(i(w),n(18)),b=i(m),_=n(15),S=i(_),x=n(19)("transform"),P=function(e){function t(){var e,n,i,r;a(this,t);for(var o=arguments.length,u=Array(o),c=0;c<o;c++)u[c]=arguments[c];return n=i=s(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),i.state={x:0,y:0},r=n,s(i,r)}return u(t,e),f(t,[{key:"componentWillReceiveProps",value:function(e){var t=this,n=e.trackPosition,i=this.context.pager;i.setViewStyles(n),this.setState(i.getPositionValue(n)),this.props.trackPosition!==n&&requestAnimationFrame(function(){return t.props.onScroll(n/i.getTrackSize(!1)*-1,n)})}},{key:"_renderViews",value:function(e){return l.Children.map(this.props.children,function(t){return(0,l.cloneElement)(t,{trackSize:e})})}},{key:"render",value:function(){var e=this.context.pager,t=this.props,n=t.tag,i=(t.trackPosition,t.children),a=o(t,["tag","trackPosition","children"]),s=this.state,u=s.x,c=s.y,f=e.getTrackSize(),h=p({},a.style,r({},x,"translate3d("+u+"px, "+c+"px, 0)"));if(f){var y=e.options,d=y.axis,v=y.viewsToShow,g="x"===d?"width":"height";h[g]="auto"===v?f:l.Children.count(i)/v*100+"%"}return(0,l.createElement)(n,p({},a,{style:h}),this._renderViews(f))}}]),t}(l.Component);P.propTypes=T,P.contextTypes={pager:l.PropTypes.instanceOf(g.default)};var O=function(){return null},T={tag:l.PropTypes.any,currentView:l.PropTypes.any,viewsToShow:l.PropTypes.oneOfType([l.PropTypes.number,l.PropTypes.oneOf(["auto"])]),viewsToMove:l.PropTypes.number,align:l.PropTypes.number,contain:l.PropTypes.bool,axis:l.PropTypes.oneOf(["x","y"]),animations:l.PropTypes.array,infinite:l.PropTypes.bool,instant:l.PropTypes.bool,swipe:l.PropTypes.oneOf([!0,!1,"mouse","touch"]),swipeThreshold:l.PropTypes.number,flickTimeout:l.PropTypes.number,springConfig:l.PropTypes.objectOf(l.PropTypes.number),onSwipeStart:l.PropTypes.func,onSwipeMove:l.PropTypes.func,onSwipeEnd:l.PropTypes.func,onScroll:l.PropTypes.func,onViewChange:l.PropTypes.func,onRest:l.PropTypes.func},k=function(e,t){return e.viewsToShow!==t.viewsToShow||e.viewsToMove!==t.viewsToMove||e.align!==t.align||e.axis!==t.axis||e.animations!==t.animations||e.infinite!==t.infinite||e.swipe!==t.swipe||e.swipeThreshold!==t.swipeThreshold||e.flickTimeout!==t.flickTimeout},j=function(e){function t(){var e,n,i,r;a(this,t);for(var o=arguments.length,u=Array(o),c=0;c<o;c++)u[c]=arguments[c];return n=i=s(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),i.state={instant:!1},i._currentTween=0,i._hydrate=!1,i._handleOnRest=function(){i.props.infinite&&!i.state.instant&&(i.context.pager.resetViews(),i._setValueInstantly(!0,!0)),i.props.onRest()},r=n,s(i,r)}return u(t,e),f(t,[{key:"componentWillMount",value:function(){this.context.pager.setOptions(this.props)}},{key:"componentDidMount",value:function(){var e=this,t=this.context.pager;t.addTrack((0,y.findDOMNode)(this)),this.scrollTo((0,b.default)(this.props.currentView,this.props.children)),t.on("hydrated",function(){return e._setValueInstantly(!0,!0)}),t.on("swipeMove",function(){return e._setValueInstantly(!0)}),t.on("swipeEnd",function(){return e._setValueInstantly(!1)}),t.on("swipeStart",this.props.onSwipeStart),t.on("swipeMove",this.props.onSwipeMove),t.on("swipeEnd",this.props.onSwipeEnd),t.on("viewChange",this.props.onViewChange)}},{key:"componentWillReceiveProps",value:function(e){var t=e.currentView,n=e.instant,i=e.children;this.props.instant!==n&&this._setValueInstantly(n),void 0!==("undefined"==typeof t?"undefined":c(t))&&this.props.currentView!==t&&this.scrollTo((0,b.default)(t,i)),k(this.props,e)&&(this.context.pager.setOptions(e),this._hydrate=!0)}},{key:"componentDidUpdate",value:function(e){this._hydrate&&(this.context.pager.hydrate(),this._hydrate=!1)}},{key:"prev",value:function(){this.context.pager.prev()}},{key:"next",value:function(){this.context.pager.next()}},{key:"scrollTo",value:function(e){this.context.pager.setCurrentView(0,e)}},{key:"_setValueInstantly",value:function(e,t){var n=this;this.setState({instant:e},function(){t&&n.setState({instant:!1})})}},{key:"_getTrackStyle",value:function(){var e=this.context.pager.trackPosition;return this.state.instant||(e=(0,d.spring)(e,this.props.springConfig)),{trackPosition:e}}},{key:"render",value:function(){var e=this.props,t=e.tag,n=e.onScroll,i=o(e,["tag","onScroll"]);return h.default.createElement(d.Motion,{style:this._getTrackStyle(),onRest:this._handleOnRest},function(e){var r=e.trackPosition;return(0,l.createElement)(P,(0,S.default)({trackPosition:r,tag:t,onScroll:n},i,T))})}}]),t}(l.Component);j.propTypes=T,j.defaultProps={tag:"div",currentView:0,viewsToShow:1,viewsToMove:1,align:0,contain:!1,axis:"x",infinite:!1,instant:!1,swipe:!0,swipeThreshold:.5,flickTimeout:300,springConfig:d.presets.noWobble,onSwipeStart:O,onSwipeMove:O,onSwipeEnd:O,onScroll:O,onViewChange:O,onRest:O},j.contextTypes={pager:l.PropTypes.instanceOf(g.default)},t.default=j,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){var n={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),p=n(2),f=(i(p),n(11)),l=(i(f),n(3)),h=i(l),y=function(e){function t(){var e,n,i,r;o(this,t);for(var s=arguments.length,u=Array(s),c=0;c<s;c++)u[c]=arguments[c];return n=i=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),i._viewInstance=null,r=n,a(i,r)}return s(t,e),c(t,[{key:"getChildContext",value:function(){return{view:this._viewInstance}}},{key:"componentDidMount",value:function(){this._viewInstance=this.context.pager.addView((0,f.findDOMNode)(this)),this.forceUpdate()}},{key:"componentWillUnmount",value:function(){this.context.pager.removeView(this._viewInstance)}},{key:"render",value:function(){var e=this.context.pager,t=e.options,n=t.viewsToShow,i=t.axis,o=this.props,a=o.tag,s=(o.trackSize,r(o,["tag","trackSize"])),c=u({},this.props.style);return"x"===i&&(c.display="inline-block",c.verticalAlign="top"),"auto"!==n&&e.views.length&&(c["x"===i?"width":"height"]=100/e.views.length+"%"),this._viewInstance&&(e.options.infinite&&!this._viewInstance.inBounds&&(c.position="relative",c["y"===i?"top":"left"]=this._viewInstance.getPosition()),c=u({},c,e.animationBus.getStyles(this._viewInstance))),(0,p.createElement)(a,u({},s,{style:c}))}}]),t}(p.Component);y.contextTypes={pager:p.PropTypes.instanceOf(h.default)},y.childContextTypes={view:p.PropTypes.any},y.propTypes={tag:p.PropTypes.any},y.defaultProps={tag:"div"},t.default=y,e.exports=t.default},function(e,t,n){"use strict";function i(e,t){var n=null;return r.Children.forEach(t,function(t,i){if(t.key===e||i===e)return void(n=i)}),n}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var r=n(2);
e.exports=t.default},function(e,t){e.exports=i},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){var n={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),p=n(2),f=(i(p),n(5)),l=i(f),h=n(3),y=i(h),d=n(15),v=i(d),g={tag:p.PropTypes.string,index:p.PropTypes.number,animations:p.PropTypes.array},w=function(e){function t(){return o(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return s(t,e),c(t,[{key:"componentWillMount",value:function(){var e=this.props.animations;e.length&&(this._animationBus=new l.default({animations:e,origin:function(e){return e.origin}}))}},{key:"render",value:function(){var e=this.props,t=e.tag,n=e.index,i=r(e,["tag","index"]),o=u({},i.style);if(this._animationBus){var a=this.context.view||this.context.pager.getView(n);a&&(o=u({},i.style,this._animationBus.getStyles(a)))}return(0,p.createElement)(t,(0,v.default)({style:o},this.props,g))}}]),t}(p.Component);w.contextTypes={pager:p.PropTypes.instanceOf(y.default),view:p.PropTypes.any},w.propTypes=g,w.defaultProps={tag:"div",animations:[]},t.default=w,e.exports=t.default}])});

@@ -47,3 +47,3 @@ 'use strict';

tag: _react.PropTypes.any,
autoSize: _react.PropTypes.bool,
autoSize: _react.PropTypes.oneOf([true, false, 'width', 'height']),
accessibility: _react.PropTypes.bool,

@@ -158,2 +158,3 @@ springConfig: _react.PropTypes.objectOf(_react.PropTypes.number)

var autoSize = this.props.autoSize;
var height = this.state.height;

@@ -166,3 +167,3 @@

if (this.props.autoSize) {
if (autoSize) {
return _react2.default.createElement(

@@ -172,6 +173,6 @@ _reactMotion.Motion,

function (dimensions) {
if (dimensions.maxWidth) {
if ((autoSize === true || autoSize === 'width') && dimensions.maxWidth) {
style.maxWidth = dimensions.maxWidth;
}
if (dimensions.height) {
if ((autoSize === true || autoSize === 'height') && dimensions.height) {
style.height = dimensions.height;

@@ -178,0 +179,0 @@ }

@@ -143,2 +143,4 @@ 'use strict';

value: function setOptions(options) {
var lastOptions = this.options;
// spread new options over the old ones

@@ -149,2 +151,7 @@ this.options = _extends({}, this.options, options);

this.animationBus.animations = this.options.animations;
// fire a viewChange event with the new indicies if viewsToShow has changed
if (lastOptions.viewsToShow !== this.options.viewsToShow) {
this.emit('viewChange', this.getCurrentViewIndicies());
}
}

@@ -190,4 +197,23 @@ }, {

// with each view added we need to re-calculate widths and positions
this.hydrate();
// however, if there are any images present we need to wait until
// they have loaded to hydrate
var childImages = node.querySelectorAll('img');
var childImagesLength = childImages.length;
if (childImagesLength) {
for (var i = 0; i < childImagesLength; i++) {
childImages[i].onload = this.hydrate;
}
}
// if the view itself is an image then we wait for it to load
if (node instanceof HTMLImageElement) {
node.onload = this.hydrate;
}
// otherwise just run a hydration right now
else {
this.hydrate();
}
return view;

@@ -249,4 +275,2 @@ }

if (!suppressEvent) {
var viewsToShow = this.getNumericViewsToShow();
var viewCount = this.views.length;
this.emit('viewChange', this.getCurrentViewIndicies());

@@ -253,0 +277,0 @@ }

@@ -6,3 +6,3 @@ 'use strict';

});
exports.utils = exports.AnimatedView = exports.ImageView = exports.Track = exports.Frame = exports.ViewPager = undefined;
exports.utils = exports.AnimatedView = exports.View = exports.Track = exports.Frame = exports.ViewPager = undefined;

@@ -21,5 +21,5 @@ var _ViewPager2 = require('./ViewPager');

var _ImageView2 = require('./ImageView');
var _View2 = require('./View');
var _ImageView3 = _interopRequireDefault(_ImageView2);
var _View3 = _interopRequireDefault(_View2);

@@ -39,4 +39,4 @@ var _AnimatedView2 = require('./AnimatedView');

exports.Track = _Track3.default;
exports.ImageView = _ImageView3.default;
exports.View = _View3.default;
exports.AnimatedView = _AnimatedView3.default;
exports.utils = _utils3.default;

@@ -105,3 +105,3 @@ 'use strict';

return _react.Children.map(this.props.children, function (child) {
return _react2.default.createElement(_View2.default, { trackSize: trackSize, children: child });
return (0, _react.cloneElement)(child, { trackSize: trackSize });
});

@@ -169,2 +169,4 @@ }

flickTimeout: _react.PropTypes.number,
// rightToLeft: PropTypes.bool,
// lazyLoad: PropTypes.bool,
springConfig: _react.PropTypes.objectOf(_react.PropTypes.number),

@@ -175,8 +177,4 @@ onSwipeStart: _react.PropTypes.func,

onScroll: _react.PropTypes.func,
// rightToLeft: PropTypes.bool,
// lazyLoad: PropTypes.bool,
beforeViewChange: _react.PropTypes.func,
afterViewChange: _react.PropTypes.func
// beforeAnimation: PropTypes.func,
// afterAnimation: PropTypes.func
onViewChange: _react.PropTypes.func,
onRest: _react.PropTypes.func
};

@@ -212,3 +210,3 @@ var isNotEqual = function isNotEqual(current, next) {

_this3.props.afterViewChange();
_this3.props.onRest();
}, _temp2), _possibleConstructorReturn(_this3, _ret2);

@@ -251,3 +249,3 @@ }

pager.on('swipeEnd', this.props.onSwipeEnd);
pager.on('viewChange', this.props.beforeViewChange);
pager.on('viewChange', this.props.onViewChange);
}

@@ -366,4 +364,4 @@ }, {

onScroll: noop,
beforeViewChange: noop,
afterViewChange: noop
onViewChange: noop,
onRest: noop
};

@@ -370,0 +368,0 @@ Track.contextTypes = {

@@ -77,8 +77,7 @@ 'use strict';

var _props = this.props,
tag = _props.tag,
trackSize = _props.trackSize,
children = _props.children,
restProps = _objectWithoutProperties(_props, ['trackSize', 'children']);
restProps = _objectWithoutProperties(_props, ['tag', 'trackSize']);
var child = _react.Children.only(children);
var style = _extends({}, child.props.style);
var style = _extends({}, this.props.style);

@@ -88,2 +87,3 @@ // we need to position views inline when using the x axis

style.display = 'inline-block';
style.verticalAlign = 'top';
}

@@ -97,3 +97,3 @@

if (this._viewInstance) {
// make sure view stays in frame
// make sure view stays in frame when using infinite option
if (pager.options.infinite && !this._viewInstance.inBounds) {

@@ -108,3 +108,3 @@ style.position = 'relative';

return (0, _react.cloneElement)(child, _extends({}, restProps, { style: style }));
return (0, _react.createElement)(tag, _extends({}, restProps, { style: style }));
}

@@ -122,3 +122,9 @@ }]);

};
View.propTypes = {
tag: _react.PropTypes.any
};
View.defaultProps = {
tag: 'div'
};
exports.default = View;
module.exports = exports['default'];
{
"name": "react-view-pager",
"version": "0.5.0-prerelease.2",
"version": "0.5.0-prerelease.3",
"description": "View-Pager/Slider/Carousel powered by React Motion.",

@@ -5,0 +5,0 @@ "main": "lib/react-view-pager.js",

@@ -22,5 +22,5 @@ ## React View Pager (Prerelease)

```js
import { ViewPager, Frame, Track } from 'react-view-pager'
import { ViewPager, Frame, Track, View } from 'react-view-pager'
<ViewPager>
<ViewPager tag="main">
<Frame className="frame">

@@ -33,6 +33,6 @@ <Track

>
<div className="view">1</div>
<div className="view">2</div>
<div className="view">3</div>
<div className="view">4</div>
<View className="view">1</View>
<View className="view">2</View>
<View className="view">3</View>
<View className="view">4</View>
</Track>

@@ -59,3 +59,4 @@ </Frame>

Mandatory wrapper component that connects child components together.
### `tag`: PropTypes.string
The HTML tag for this element. Defaults to `div`.

@@ -67,5 +68,5 @@ ## `Frame` Props

### `autoSize`: PropTypes.bool
### `autoSize`: PropTypes.oneOf([true, false, 'width', 'height'])
Animates the wrapper's width and height to fit the current view. Defaults to `false`.
Animates the wrapper's width and/or height to fit the current view. Defaults to `false`.

@@ -176,9 +177,9 @@ ### `accessibility`: PropTypes.bool

### `beforeViewChange`: PropTypes.func
### `onViewChange`: PropTypes.func
Prop callback fired before view change. Passes back the newly selected indicies.
Prop callback fired when view changes. Passes back the newly selected indicies.
### `afterViewChange`: PropTypes.func
### `onRest`: PropTypes.func
Prop callback fired after view change.
Prop callback fired after track scrolling animation settles.

@@ -198,2 +199,7 @@ ### Public methods

## `View` Props
### `tag`: PropTypes.string
The HTML tag for this element. Defaults to `div`.
## Running Locally

@@ -200,0 +206,0 @@

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc