UNPKG

zooid-switch

Version:
7 lines 26.8 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.Switch=t(require("react")):e.Switch=t(e.React)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={exports:{},id:r,loaded:!1};return e[r].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(14)},function(t,n){t.exports=e},function(e,t,n){(function(t){(function(){var n,r,a;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:"undefined"!=typeof t&&null!==t&&t.hrtime?(e.exports=function(){return(n()-a)/1e6},r=t.hrtime,n=function(){var e;return e=r(),1e9*e[0]+e[1]},a=n()):Date.now?(e.exports=function(){return Date.now()-a},a=Date.now()):(e.exports=function(){return(new Date).getTime()-a},a=(new Date).getTime())}).call(this)}).call(t,n(18))},function(e,t,n){(function(t){for(var r=n(2),a="undefined"==typeof window?t:window,i=["moz","webkit"],s="AnimationFrame",o=a["request"+s],l=a["cancel"+s]||a["cancelRequest"+s],u=0;!o&&u<i.length;u++)o=a[i[u]+"Request"+s],l=a[i[u]+"Cancel"+s]||a[i[u]+"CancelRequest"+s];if(!o||!l){var c=0,f=0,p=[],d=1e3/60;o=function(e){if(0===p.length){var t=r(),n=Math.max(0,d-(t-c));c=n+t,setTimeout(function(){var e=p.slice(0);p.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(c)}catch(n){setTimeout(function(){throw n},0)}},Math.round(n))}return p.push({handle:++f,callback:e,cancelled:!1}),f},l=function(e){for(var t=0;t<p.length;t++)p[t].handle===e&&(p[t].cancelled=!0)}}e.exports=function(e){return o.call(a,e)},e.exports.cancel=function(){l.apply(a,arguments)},e.exports.polyfill=function(){a.requestAnimationFrame=o,a.cancelAnimationFrame=l}}).call(t,function(){return this}())},function(e,t){"use strict";function n(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=0);return t}t.__esModule=!0,t.default=n,e.exports=t.default},function(e,t){"use strict";function n(e,t,n){for(var r in t)if(t.hasOwnProperty(r)){if(0!==n[r])return!1;var a="number"==typeof t[r]?t[r]:t[r].val;if(e[r]!==a)return!1}return!0}t.__esModule=!0,t.default=n,e.exports=t.default},function(e,t){"use strict";function n(e,t,n,a,i,s,o){var l=-i*(t-a),u=-s*n,c=l+u,f=n+c*e,p=t+f*e;return Math.abs(f)<o&&Math.abs(p-a)<o?(r[0]=a,r[1]=0,r):(r[0]=p,r[1]=f,r)}t.__esModule=!0,t.default=n;var r=[];e.exports=t.default},function(e,t){"use strict";function n(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]="number"==typeof e[n]?e[n]:e[n].val);return t}t.__esModule=!0,t.default=n,e.exports=t.default},function(e,t,n){var r,a;/*! Copyright (c) 2016 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ !function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var a=typeof r;if("string"===a||"number"===a)e.push(r);else if(Array.isArray(r))e.push(n.apply(null,r));else if("object"===a)for(var s in r)i.call(r,s)&&r[s]&&e.push(s)}}return e.join(" ")}var i={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=n:(r=[],a=function(){return n}.apply(t,r),!(void 0!==a&&(e.exports=a)))}()},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t];n[2]?e.push("@media "+n[2]+"{"+n[1]+"}"):e.push(n[1])}return e.join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},a=0;a<this.length;a++){var i=this[a][0];"number"==typeof i&&(r[i]=!0)}for(a=0;a<t.length;a++){var s=t[a];"number"==typeof s[0]&&r[s[0]]||(n&&!s[2]?s[2]=n:n&&(s[2]="("+s[2]+") and ("+n+")"),e.push(s))}},e}},function(e,t){"use strict";t.__esModule=!0,t.default={noWobble:{stiffness:170,damping:26},gentle:{stiffness:120,damping:14},wobbly:{stiffness:180,damping:12},stiff:{stiffness:210,damping:20}},e.exports=t.default},function(e,t,n){function r(e,t){for(var n=0;n<e.length;n++){var r=e[n],a=d[r.id];if(a){a.refs++;for(var i=0;i<a.parts.length;i++)a.parts[i](r.parts[i]);for(;i<r.parts.length;i++)a.parts.push(u(r.parts[i],t))}else{for(var s=[],i=0;i<r.parts.length;i++)s.push(u(r.parts[i],t));d[r.id]={id:r.id,refs:1,parts:s}}}}function a(e){for(var t=[],n={},r=0;r<e.length;r++){var a=e[r],i=a[0],s=a[1],o=a[2],l=a[3],u={css:s,media:o,sourceMap:l};n[i]?n[i].parts.push(u):t.push(n[i]={id:i,parts:[u]})}return t}function i(e,t){var n=h(),r=_[_.length-1];if("top"===e.insertAt)r?r.nextSibling?n.insertBefore(t,r.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),_.push(t);else{if("bottom"!==e.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");n.appendChild(t)}}function s(e){e.parentNode.removeChild(e);var t=_.indexOf(e);t>=0&&_.splice(t,1)}function o(e){var t=document.createElement("style");return t.type="text/css",i(e,t),t}function l(e){var t=document.createElement("link");return t.rel="stylesheet",i(e,t),t}function u(e,t){var n,r,a;if(t.singleton){var i=b++;n=v||(v=o(t)),r=c.bind(null,n,i,!1),a=c.bind(null,n,i,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=l(t),r=p.bind(null,n),a=function(){s(n),n.href&&URL.revokeObjectURL(n.href)}):(n=o(t),r=f.bind(null,n),a=function(){s(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else a()}}function c(e,t,n,r){var a=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=g(t,a);else{var i=document.createTextNode(a),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(i,s[t]):e.appendChild(i)}}function f(e,t){var n=t.css,r=t.media;if(r&&e.setAttribute("media",r),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function p(e,t){var n=t.css,r=t.sourceMap;r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var a=new Blob([n],{type:"text/css"}),i=e.href;e.href=URL.createObjectURL(a),i&&URL.revokeObjectURL(i)}var d={},y=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},m=y(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),h=y(function(){return document.head||document.getElementsByTagName("head")[0]}),v=null,b=0,_=[];e.exports=function(e,t){t=t||{},"undefined"==typeof t.singleton&&(t.singleton=m()),"undefined"==typeof t.insertAt&&(t.insertAt="bottom");var n=a(e);return r(n,t),function(e){for(var i=[],s=0;s<n.length;s++){var o=n[s],l=d[o.id];l.refs--,i.push(l)}if(e){var u=a(e);r(u,t)}for(var s=0;s<i.length;s++){var l=i[s];if(0===l.refs){for(var c=0;c<l.parts.length;c++)l.parts[c]();delete d[l.id]}}}};var g=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}()},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(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 o(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 l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(8),c=r(u),f=n(17),p=r(f),d=n(1),y=r(d),m=n(13),h=r(m),v=n(26),b=r(v),_={alignLabel:d.PropTypes.oneOf(["left","right"]),className:d.PropTypes.string,disabled:d.PropTypes.bool,label:d.PropTypes.string,onChange:d.PropTypes.func,on:d.PropTypes.bool},g={alignLabel:"left",disabled:!1,label:"",onChange:p.default,on:!1},T=function(e){function t(e){i(this,t);var n=s(this,Object.getPrototypeOf(t).call(this,e));return n.handleClick=function(){n.setState({on:!n.state.on},function(){n.props.onChange(n.state.on)})},n.state={on:n.props.on},n}return o(t,e),l(t,[{key:"render",value:function(){var e=this.props,t=e.alignLabel,n=e.className,r=e.disabled,i=e.label,s=this.state.on,o=(0,c.default)(b.default.root,a({},""+b.default["is-on"],s),a({},""+b.default["is-disabled"],r),b.default["alignLabel-"+t],n);return r&&(this.handleClick=p.default),y.default.createElement("div",{className:o,onClick:this.handleClick},y.default.createElement("label",null,i),y.default.createElement(h.default,{on:s,disabled:r}))}}]),t}(y.default.Component);T.propTypes=_,T.defaultProps=g,t.default=T},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0});var i=n(8),s=r(i),o=n(1),l=r(o),u=n(23),c=n(27),f=r(c),p={on:o.PropTypes.bool.isRequired,disabled:o.PropTypes.bool.isRequired},d={},y=function(e){var t=e.disabled,n=e.on,r=(0,s.default)(f.default.control,a({},""+f.default["is-on"],n),a({},""+f.default["is-disabled"],t));return l.default.createElement("div",{className:r},l.default.createElement("span",{className:f.default.bar}),l.default.createElement(u.Motion,{style:{x:(0,u.spring)(n?16:0,{stiffness:220,damping:26})}},function(e){var t=e.x;return l.default.createElement("span",{className:f.default.thumb,style:{WebkitTransform:"translate3d("+t+"px, 0, 0)",transform:"translate3d("+t+"px, 0, 0)"}})}))};y.propTypes=p,y.defaultProps=d,t.default=y},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(12),i=r(a);t.default=i.default},function(e,t,n){t=e.exports=n(9)(),t.push([e.id,".styles__root___1s578{display:flex;flex-direction:row;align-items:center;cursor:pointer;justify-content:space-between}.styles__checkbox___1LQ0I{opacity:0}.styles__is-disabled___3J9OE{cursor:default}.styles__alignLabel-right___10Bd7{flex-direction:row-reverse}",""]),t.locals={root:"styles__root___1s578",checkbox:"styles__checkbox___1LQ0I","is-disabled":"styles__is-disabled___3J9OE","is-on":"styles__is-on___3hp0d","alignLabel-right":"styles__alignLabel-right___10Bd7"}},function(e,t,n){t=e.exports=n(9)(),t.push([e.id,".styles__control___1ek-H{width:36px;height:24px;position:relative}.styles__bar___BOZSW{position:absolute;top:6px;left:0;display:block;border-radius:6px;height:12px;width:100%;background:rgba(0,0,0,.38);transition:all .4s linear;transition-property:-webkit-transform,background-color;transition-property:transform,background-color}.styles__is-on___3OswC .styles__bar___BOZSW{background:rgba(20,86,143,.5)}.styles__is-disabled___3mopb .styles__bar___BOZSW{background:rgba(0,0,0,.12)}.styles__thumb___2gT-p{display:block;position:absolute;top:2px;left:0;width:20px;height:20px;border-radius:50%;background:#fafafa;box-shadow:0 1px 6px rgba(0,0,0,.117647),0 1px 4px rgba(0,0,0,.117647);transition:all .3s linear;transition-property:background-color}.styles__is-on___3OswC .styles__thumb___2gT-p{background-color:#14568f}.styles__is-disabled___3mopb .styles__thumb___2gT-p{background:#bdbdbd}",""]),t.locals={control:"styles__control___1ek-H",bar:"styles__bar___BOZSW","is-on":"styles__is-on___3OswC","is-disabled":"styles__is-disabled___3mopb",thumb:"styles__thumb___2gT-p"}},function(e,t){function n(){}e.exports=n},function(e,t){function n(){f&&u&&(f=!1,u.length?c=u.concat(c):p=-1,c.length&&r())}function r(){if(!f){var e=s(n);f=!0;for(var t=c.length;t;){for(u=c,c=[];++p<t;)u&&u[p].run();p=-1,t=c.length}u=null,f=!1,o(e)}}function a(e,t){this.fun=e,this.array=t}function i(){}var s,o,l=e.exports={};!function(){try{s=setTimeout}catch(e){s=function(){throw new Error("setTimeout is not defined")}}try{o=clearTimeout}catch(e){o=function(){throw new Error("clearTimeout is not defined")}}}();var u,c=[],f=!1,p=-1;l.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new a(e,t)),1!==c.length||f||s(r,0)},a.prototype.run=function(){this.fun.apply(null,this.array)},l.title="browser",l.browser=!0,l.env={},l.argv=[],l.version="",l.versions={},l.on=i,l.addListener=i,l.once=i,l.off=i,l.removeListener=i,l.removeAllListeners=i,l.emit=i,l.binding=function(e){throw new Error("process.binding is not supported")},l.cwd=function(){return"/"},l.chdir=function(e){throw new Error("process.chdir is not supported")},l.umask=function(){return 0}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=n(4),s=r(i),o=n(7),l=r(o),u=n(6),c=r(u),f=n(2),p=r(f),d=n(3),y=r(d),m=n(5),h=r(m),v=n(1),b=r(v),_=1e3/60,g=b.default.createClass({displayName:"Motion",propTypes:{defaultStyle:v.PropTypes.objectOf(v.PropTypes.number),style:v.PropTypes.objectOf(v.PropTypes.oneOfType([v.PropTypes.number,v.PropTypes.object])).isRequired,children:v.PropTypes.func.isRequired,onRest:v.PropTypes.func},getInitialState:function(){var e=this.props,t=e.defaultStyle,n=e.style,r=t||l.default(n),a=s.default(r);return{currentStyle:r,currentVelocity:a,lastIdealStyle:r,lastIdealVelocity:a}},wasAnimating:!1,animationID:null,prevTime:0,accumulatedTime:0,unreadPropStyle:null,clearUnreadPropStyle:function(e){var t=!1,n=this.state,r=n.currentStyle,i=n.currentVelocity,s=n.lastIdealStyle,o=n.lastIdealVelocity;for(var l in e)if(e.hasOwnProperty(l)){var u=e[l];"number"==typeof u&&(t||(t=!0,r=a({},r),i=a({},i),s=a({},s),o=a({},o)),r[l]=u,i[l]=0,s[l]=u,o[l]=0)}t&&this.setState({currentStyle:r,currentVelocity:i,lastIdealStyle:s,lastIdealVelocity:o})},startAnimationIfNecessary:function(){var e=this;this.animationID=y.default(function(){var t=e.props.style;if(h.default(e.state.currentStyle,t,e.state.currentVelocity))return e.wasAnimating&&e.props.onRest&&e.props.onRest(),e.animationID=null,e.wasAnimating=!1,void(e.accumulatedTime=0);e.wasAnimating=!0;var n=p.default(),r=n-e.prevTime;if(e.prevTime=n,e.accumulatedTime=e.accumulatedTime+r,e.accumulatedTime>10*_&&(e.accumulatedTime=0),0===e.accumulatedTime)return e.animationID=null,void e.startAnimationIfNecessary();var a=(e.accumulatedTime-Math.floor(e.accumulatedTime/_)*_)/_,i=Math.floor(e.accumulatedTime/_),s={},o={},l={},u={};for(var f in t)if(t.hasOwnProperty(f)){var d=t[f];if("number"==typeof d)l[f]=d,u[f]=0,s[f]=d,o[f]=0;else{for(var y=e.state.lastIdealStyle[f],m=e.state.lastIdealVelocity[f],v=0;v<i;v++){var b=c.default(_/1e3,y,m,d.val,d.stiffness,d.damping,d.precision);y=b[0],m=b[1]}var g=c.default(_/1e3,y,m,d.val,d.stiffness,d.damping,d.precision),T=g[0],P=g[1];l[f]=y+(T-y)*a,u[f]=m+(P-m)*a,s[f]=y,o[f]=m}}e.animationID=null,e.accumulatedTime-=i*_,e.setState({currentStyle:l,currentVelocity:u,lastIdealStyle:s,lastIdealVelocity:o}),e.unreadPropStyle=null,e.startAnimationIfNecessary()})},componentDidMount:function(){this.prevTime=p.default(),this.startAnimationIfNecessary()},componentWillReceiveProps:function(e){null!=this.unreadPropStyle&&this.clearUnreadPropStyle(this.unreadPropStyle),this.unreadPropStyle=e.style,null==this.animationID&&(this.prevTime=p.default(),this.startAnimationIfNecessary())},componentWillUnmount:function(){null!=this.animationID&&(y.default.cancel(this.animationID),this.animationID=null)},render:function(){var e=this.props.children(this.state.currentStyle);return e&&b.default.Children.only(e)}});t.default=g,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){for(var r=0;r<e.length;r++)if(!v.default(e[r],t[r],n[r]))return!1;return!0}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=n(4),o=r(s),l=n(7),u=r(l),c=n(6),f=r(c),p=n(2),d=r(p),y=n(3),m=r(y),h=n(5),v=r(h),b=n(1),_=r(b),g=1e3/60,T=_.default.createClass({displayName:"StaggeredMotion",propTypes:{defaultStyles:b.PropTypes.arrayOf(b.PropTypes.objectOf(b.PropTypes.number)),styles:b.PropTypes.func.isRequired,children:b.PropTypes.func.isRequired},getInitialState:function(){var e=this.props,t=e.defaultStyles,n=e.styles,r=t||n().map(u.default),a=r.map(function(e){return o.default(e)});return{currentStyles:r,currentVelocities:a,lastIdealStyles:r,lastIdealVelocities:a}},animationID:null,prevTime:0,accumulatedTime:0,unreadPropStyles:null,clearUnreadPropStyle:function(e){for(var t=this.state,n=t.currentStyles,r=t.currentVelocities,a=t.lastIdealStyles,s=t.lastIdealVelocities,o=!1,l=0;l<e.length;l++){var u=e[l],c=!1;for(var f in u)if(u.hasOwnProperty(f)){var p=u[f];"number"==typeof p&&(c||(c=!0,o=!0,n[l]=i({},n[l]),r[l]=i({},r[l]),a[l]=i({},a[l]),s[l]=i({},s[l])),n[l][f]=p,r[l][f]=0,a[l][f]=p,s[l][f]=0)}}o&&this.setState({currentStyles:n,currentVelocities:r,lastIdealStyles:a,lastIdealVelocities:s})},startAnimationIfNecessary:function(){var e=this;this.animationID=m.default(function(){var t=e.props.styles(e.state.lastIdealStyles);if(a(e.state.currentStyles,t,e.state.currentVelocities))return e.animationID=null,void(e.accumulatedTime=0);var n=d.default(),r=n-e.prevTime;if(e.prevTime=n,e.accumulatedTime=e.accumulatedTime+r,e.accumulatedTime>10*g&&(e.accumulatedTime=0),0===e.accumulatedTime)return e.animationID=null,void e.startAnimationIfNecessary();for(var i=(e.accumulatedTime-Math.floor(e.accumulatedTime/g)*g)/g,s=Math.floor(e.accumulatedTime/g),o=[],l=[],u=[],c=[],p=0;p<t.length;p++){var y=t[p],m={},h={},v={},b={};for(var _ in y)if(y.hasOwnProperty(_)){var T=y[_];if("number"==typeof T)m[_]=T,h[_]=0,v[_]=T,b[_]=0;else{for(var P=e.state.lastIdealStyles[p][_],S=e.state.lastIdealVelocities[p][_],w=0;w<s;w++){var I=f.default(g/1e3,P,S,T.val,T.stiffness,T.damping,T.precision);P=I[0],S=I[1]}var x=f.default(g/1e3,P,S,T.val,T.stiffness,T.damping,T.precision),k=x[0],O=x[1];m[_]=P+(k-P)*i,h[_]=S+(O-S)*i,v[_]=P,b[_]=S}}u[p]=m,c[p]=h,o[p]=v,l[p]=b}e.animationID=null,e.accumulatedTime-=s*g,e.setState({currentStyles:u,currentVelocities:c,lastIdealStyles:o,lastIdealVelocities:l}),e.unreadPropStyles=null,e.startAnimationIfNecessary()})},componentDidMount:function(){this.prevTime=d.default(),this.startAnimationIfNecessary()},componentWillReceiveProps:function(e){null!=this.unreadPropStyles&&this.clearUnreadPropStyle(this.unreadPropStyles),this.unreadPropStyles=e.styles(this.state.lastIdealStyles),null==this.animationID&&(this.prevTime=d.default(),this.startAnimationIfNecessary())},componentWillUnmount:function(){null!=this.animationID&&(m.default.cancel(this.animationID),this.animationID=null)},render:function(){var e=this.props.children(this.state.currentStyles);return e&&_.default.Children.only(e)}});t.default=T,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return null==t?e.map(function(e,t){return{key:e.key,data:e.data,style:n[t]}}):e.map(function(e,r){for(var a=0;a<t.length;a++)if(t[a].key===e.key)return{key:t[a].key,data:t[a].data,style:n[r]};return{key:e.key,data:e.data,style:n[r]}})}function i(e,t,n,r){if(r.length!==t.length)return!1;for(var a=0;a<r.length;a++)if(r[a].key!==t[a].key)return!1;for(var a=0;a<r.length;a++)if(!T.default(e[a],t[a].style,n[a]))return!1;return!0}function s(e,t,n,r,a,i,s,o){for(var l=m.default(n,r,function(e,n){var r=t(n);return null==r?null:T.default(a[e],r,i[e])?null:{key:n.key,data:n.data,style:r}}),c=[],f=[],p=[],d=[],y=0;y<l.length;y++){for(var h=l[y],v=null,b=0;b<n.length;b++)if(n[b].key===h.key){v=b;break}if(null==v){var _=e(h);c[y]=_,p[y]=_;var g=u.default(h.style);f[y]=g,d[y]=g}else c[y]=a[v],p[y]=s[v],f[y]=i[v],d[y]=o[v]}return[l,c,f,p,d]}t.__esModule=!0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=n(4),u=r(l),c=n(7),f=r(c),p=n(6),d=r(p),y=n(22),m=r(y),h=n(2),v=r(h),b=n(3),_=r(b),g=n(5),T=r(g),P=n(1),S=r(P),w=1e3/60,I=S.default.createClass({displayName:"TransitionMotion",propTypes:{defaultStyles:P.PropTypes.arrayOf(P.PropTypes.shape({key:P.PropTypes.string.isRequired,data:P.PropTypes.any,style:P.PropTypes.objectOf(P.PropTypes.number).isRequired})),styles:P.PropTypes.oneOfType([P.PropTypes.func,P.PropTypes.arrayOf(P.PropTypes.shape({key:P.PropTypes.string.isRequired,data:P.PropTypes.any,style:P.PropTypes.objectOf(P.PropTypes.oneOfType([P.PropTypes.number,P.PropTypes.object])).isRequired}))]).isRequired,children:P.PropTypes.func.isRequired,willLeave:P.PropTypes.func,willEnter:P.PropTypes.func},getDefaultProps:function(){return{willEnter:function(e){return f.default(e.style)},willLeave:function(){return null}}},getInitialState:function(){var e=this.props,t=e.defaultStyles,n=e.styles,r=e.willEnter,a=e.willLeave,i="function"==typeof n?n(t):n,o=void 0;o=null==t?i:t.map(function(e){for(var t=0;t<i.length;t++)if(i[t].key===e.key)return i[t];return e});var l=null==t?i.map(function(e){return f.default(e.style)}):t.map(function(e){return f.default(e.style)}),c=null==t?i.map(function(e){return u.default(e.style)}):t.map(function(e){return u.default(e.style)}),p=s(r,a,o,i,l,c,l,c),d=p[0],y=p[1],m=p[2],h=p[3],v=p[4];return{currentStyles:y,currentVelocities:m,lastIdealStyles:h,lastIdealVelocities:v,mergedPropsStyles:d}},animationID:null,prevTime:0,accumulatedTime:0,unreadPropStyles:null,clearUnreadPropStyle:function(e){for(var t=s(this.props.willEnter,this.props.willLeave,this.state.mergedPropsStyles,e,this.state.currentStyles,this.state.currentVelocities,this.state.lastIdealStyles,this.state.lastIdealVelocities),n=t[0],r=t[1],a=t[2],i=t[3],l=t[4],u=0;u<e.length;u++){var c=e[u].style,f=!1;for(var p in c)if(c.hasOwnProperty(p)){var d=c[p];"number"==typeof d&&(f||(f=!0,r[u]=o({},r[u]),a[u]=o({},a[u]),i[u]=o({},i[u]),l[u]=o({},l[u]),n[u]={key:n[u].key,data:n[u].data,style:o({},n[u].style)}),r[u][p]=d,a[u][p]=0,i[u][p]=d,l[u][p]=0,n[u].style[p]=d)}}this.setState({currentStyles:r,currentVelocities:a,mergedPropsStyles:n,lastIdealStyles:i,lastIdealVelocities:l})},startAnimationIfNecessary:function(){var e=this;this.animationID=_.default(function(){var t=e.props.styles,n="function"==typeof t?t(a(e.state.mergedPropsStyles,e.unreadPropStyles,e.state.lastIdealStyles)):t;if(i(e.state.currentStyles,n,e.state.currentVelocities,e.state.mergedPropsStyles))return e.animationID=null,void(e.accumulatedTime=0);var r=v.default(),o=r-e.prevTime;if(e.prevTime=r,e.accumulatedTime=e.accumulatedTime+o,e.accumulatedTime>10*w&&(e.accumulatedTime=0),0===e.accumulatedTime)return e.animationID=null,void e.startAnimationIfNecessary();for(var l=(e.accumulatedTime-Math.floor(e.accumulatedTime/w)*w)/w,u=Math.floor(e.accumulatedTime/w),c=s(e.props.willEnter,e.props.willLeave,e.state.mergedPropsStyles,n,e.state.currentStyles,e.state.currentVelocities,e.state.lastIdealStyles,e.state.lastIdealVelocities),f=c[0],p=c[1],y=c[2],m=c[3],h=c[4],b=0;b<f.length;b++){var _=f[b].style,g={},T={},P={},S={};for(var I in _)if(_.hasOwnProperty(I)){var x=_[I];if("number"==typeof x)g[I]=x,T[I]=0,P[I]=x,S[I]=0;else{for(var k=m[b][I],O=h[b][I],M=0;M<u;M++){var j=d.default(w/1e3,k,O,x.val,x.stiffness,x.damping,x.precision);k=j[0],O=j[1]}var D=d.default(w/1e3,k,O,x.val,x.stiffness,x.damping,x.precision),R=D[0],A=D[1];g[I]=k+(R-k)*l,T[I]=O+(A-O)*l,P[I]=k,S[I]=O}}m[b]=P,h[b]=S,p[b]=g,y[b]=T}e.animationID=null,e.accumulatedTime-=u*w,e.setState({currentStyles:p,currentVelocities:y,lastIdealStyles:m,lastIdealVelocities:h,mergedPropsStyles:f}),e.unreadPropStyles=null,e.startAnimationIfNecessary()})},componentDidMount:function(){this.prevTime=v.default(),this.startAnimationIfNecessary()},componentWillReceiveProps:function(e){this.unreadPropStyles&&this.clearUnreadPropStyle(this.unreadPropStyles),"function"==typeof e.styles?this.unreadPropStyles=e.styles(a(this.state.mergedPropsStyles,this.unreadPropStyles,this.state.lastIdealStyles)):this.unreadPropStyles=e.styles,null==this.animationID&&(this.prevTime=v.default(),this.startAnimationIfNecessary())},componentWillUnmount:function(){null!=this.animationID&&(_.default.cancel(this.animationID),this.animationID=null)},render:function(){var e=a(this.state.mergedPropsStyles,this.unreadPropStyles,this.state.currentStyles),t=this.props.children(e);return t&&S.default.Children.only(t)}});t.default=I,e.exports=t.default},function(e,t){"use strict";function n(e,t,n){for(var r={},a=0;a<e.length;a++)r[e[a].key]=a;for(var i={},a=0;a<t.length;a++)i[t[a].key]=a;for(var s=[],a=0;a<t.length;a++)s[a]=t[a];for(var a=0;a<e.length;a++)if(!i.hasOwnProperty(e[a].key)){var o=n(a,e[a]);null!=o&&s.push(o)}return s.sort(function(e,n){var a=i[e.key],s=i[n.key],o=r[e.key],l=r[n.key];if(null!=a&&null!=s)return i[e.key]-i[n.key];if(null!=o&&null!=l)return r[e.key]-r[n.key];if(null!=a){for(var u=0;u<t.length;u++){var c=t[u].key;if(r.hasOwnProperty(c)){if(a<i[c]&&l>r[c])return-1;if(a>i[c]&&l<r[c])return 1}}return 1}for(var u=0;u<t.length;u++){var c=t[u].key;if(r.hasOwnProperty(c)){if(s<i[c]&&o>r[c])return 1;if(s>i[c]&&o<r[c])return-1}}return-1})}t.__esModule=!0,t.default=n,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e.default:e}t.__esModule=!0;var a=n(19);t.Motion=r(a);var i=n(20);t.StaggeredMotion=r(i);var s=n(21);t.TransitionMotion=r(s);var o=n(25);t.spring=r(o);var l=n(10);t.presets=r(l);var u=n(24);t.reorderKeys=r(u)},function(e,t,n){"use strict";function r(){}t.__esModule=!0,t.default=r;e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){return i({},l,t,{val:e})}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.default=a;var s=n(10),o=r(s),l=i({},o.default.noWobble,{precision:.01});e.exports=t.default},function(e,t,n){var r=n(15);"string"==typeof r&&(r=[[e.id,r,""]]);n(11)(r,{});r.locals&&(e.exports=r.locals)},function(e,t,n){var r=n(16);"string"==typeof r&&(r=[[e.id,r,""]]);n(11)(r,{});r.locals&&(e.exports=r.locals)}])}); //# sourceMappingURL=bundle.js.map