react-toastify
Advanced tools
Comparing version 2.2.1 to 3.0.0-beta-1
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("prop-types"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","prop-types","react-dom"],e):"object"==typeof exports?exports.ReactToastify=e(require("react"),require("prop-types"),require("react-dom")):t.ReactToastify=e(t.react,t["prop-types"],t["react-dom"])}(this,function(t,e,n){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=6)}([function(e,n){e.exports=t},function(t,n){t.exports=e},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.POSITION={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},e.TYPE={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"},e.ACTION={SHOW:"SHOW_TOAST",CLEAR:"CLEAR_TOAST",MOUNTED:"CONTAINER_MOUNTED"}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=[];return Object.keys(t).forEach(function(n){return e.push(t[n])}),e}},function(t,e,n){"use strict";function o(t){return Object.prototype.toString.call(t).slice(8,-1)}function r(t){return"Number"===o(t)&&!isNaN(t)&&t>0}function i(t){return t.isRequired=function(e,n,o){if(void 0===e[n])return new Error("The prop "+n+" is marked as required in \n "+o+", but its value is undefined.");t(e,n,o)},t}Object.defineProperty(e,"__esModule",{value:!0}),e.falseOrElement=e.falseOrNumber=void 0,e.typeOf=o,e.isValidDelay=r;var s=n(0);e.falseOrNumber=i(function(t,e,n){var o=t[e];return!1===o||r(o)?null:new Error(n+" expect "+e+" \n to be a valid Number > 0 or equal to false. "+o+" given.")}),e.falseOrElement=i(function(t,e,n){var o=t[e];return!1===o||(0,s.isValidElement)(o)?null:new Error(n+" expect "+e+" \n to be a valid react element or equal to false. "+o+" given.")})},function(t,e,n){"use strict";function o(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}Object.defineProperty(e,"__esModule",{value:!0});var r={eventList:new Map,on:function(t,e){return this.eventList.has(t)||this.eventList.set(t,[]),this.eventList.get(t).push(e),this},off:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return this.eventList.delete(t)},emit:function(t){for(var e=this,n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return this.eventList.has(t)?(this.eventList.get(t).forEach(function(t){return setTimeout(function(){return t.call.apply(t,[e].concat(o(r)))},0)}),!0):(console.warn("<"+t+"> Event is not registered. Did you forgot to bind the event ?"),!1)}};e.default=r},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.toast=e.ToastContainer=void 0;var r=n(7),i=o(r),s=n(17),a=o(s);e.ToastContainer=i.default,e.toast=a.default},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},p=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),f=n(0),d=o(f),h=n(1),y=o(h),m=n(8),v=o(m),O=n(10),b=o(O),E=n(12),g=o(E),T=n(13),C=o(T),N=n(2),x=n(5),_=o(x),P=n(3),S=o(P),k=n(4),j=function(t){function e(){var t,n,o,r;s(this,e);for(var i=arguments.length,u=Array(i),l=0;l<i;l++)u[l]=arguments[l];return n=o=a(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(u))),o.state={toast:[]},o.collection={},o.isToastActive=function(t){return-1!==o.state.toast.indexOf(parseInt(t,10))},r=n,a(o,r)}return u(e,t),p(e,[{key:"componentDidMount",value:function(){var t=this,e=N.ACTION.SHOW,n=N.ACTION.CLEAR,o=N.ACTION.MOUNTED;_.default.on(e,function(e,n){return t.show(e,n)}).on(n,function(e){return null!==e?t.removeToast(e):t.clear()}).emit(o,this)}},{key:"componentWillUnmount",value:function(){_.default.off(N.ACTION.SHOW),_.default.off(N.ACTION.CLEAR)}},{key:"removeToast",value:function(t){this.setState({toast:this.state.toast.filter(function(e){return e!==parseInt(t,10)})})}},{key:"with",value:function(t,e){return(0,f.cloneElement)(t,c({},e,t.props))}},{key:"makeCloseButton",value:function(t,e){var n=this,o=this.props.closeButton;return((0,f.isValidElement)(t)||!1===t)&&(o=t),!1!==o&&this.with(o,{closeToast:function(){return n.removeToast(e)}})}},{key:"getAutoCloseDelay",value:function(t){return!1===t||(0,k.isValidDelay)(t)?t:this.props.autoClose}},{key:"isFunction",value:function(t){return!!(t&&t.constructor&&t.call&&t.apply)}},{key:"canBeRendered",value:function(t){return(0,f.isValidElement)(t)||"String"===(0,k.typeOf)(t)||"Number"===(0,k.typeOf)(t)}},{key:"show",value:function(t,e){var n=this;if(!this.canBeRendered(t))throw new Error("The element you provided cannot be rendered. You provided an element of type "+(void 0===t?"undefined":l(t)));var o=e.toastId,s=function(){return n.removeToast(o)},a={id:o,type:e.type,closeButton:this.makeCloseButton(e.closeButton,o),position:e.position||this.props.position,transition:e.transition||this.props.transition,pauseOnHover:null!==e.pauseOnHover?e.pauseOnHover:this.props.pauseOnHover,closeOnClick:null!==e.closeOnClick?e.closeOnClick:this.props.closeOnClick,className:e.className||this.props.toastClassName,bodyClassName:e.bodyClassName||this.props.bodyClassName,progressClassName:e.progressClassName||this.props.progressClassName};this.isFunction(e.onOpen)&&(a.onOpen=e.onOpen),this.isFunction(e.onClose)&&(a.onClose=e.onClose),a.autoClose=this.getAutoCloseDelay(!1!==e.autoClose?parseInt(e.autoClose,10):e.autoClose),a.hideProgressBar="boolean"==typeof e.hideProgressBar?e.hideProgressBar:this.props.hideProgressBar,a.closeToast=s,(0,f.isValidElement)(t)&&"String"!==(0,k.typeOf)(t.type)&&(t=this.with(t,{closeToast:s})),this.collection=c({},this.collection,i({},o,{content:this.makeToast(t,a),position:a.position})),this.setState({toast:[].concat(r(this.state.toast),[o])})}},{key:"makeToast",value:function(t,e){return d.default.createElement(b.default,c({},e,{key:"toast-"+e.id}),t)}},{key:"clear",value:function(){this.setState({toast:[]})}},{key:"hasToast",value:function(){return this.state.toast.length>0}},{key:"getContainerProps",value:function(t,e){var n={className:"toastify toastify--"+t,style:e?{pointerEvents:"none"}:{}};return null!==this.props.className&&(n.className=n.className+" "+this.props.className),null!==this.props.style&&(n.style=c({},this.props.style,n.style)),n}},{key:"renderToast",value:function(){var t=this,e={};return(this.props.newestOnTop?Object.keys(this.collection).reverse():Object.keys(this.collection)).forEach(function(n){var o=t.collection[n];e[o.position]||(e[o.position]=[]),-1!==t.state.toast.indexOf(parseInt(n,10))?e[o.position].push(o.content):(e[o.position].push(null),delete t.collection[n])}),Object.keys(e).map(function(n){var o=1===e[n].length&&null===e[n][0];return d.default.createElement(v.default,c({},t.getContainerProps(n,o),{key:"container-"+n}),e[n])})}},{key:"render",value:function(){return d.default.createElement("div",null,this.renderToast())}}]),e}(f.Component);j.propTypes={position:y.default.oneOf((0,S.default)(N.POSITION)),autoClose:k.falseOrNumber,closeButton:k.falseOrElement,hideProgressBar:y.default.bool,pauseOnHover:y.default.bool,closeOnClick:y.default.bool,newestOnTop:y.default.bool,className:y.default.string,style:y.default.object,toastClassName:y.default.string,bodyClassName:y.default.string,progressClassName:y.default.string,transition:y.default.func},j.defaultProps={position:N.POSITION.TOP_RIGHT,transition:C.default,autoClose:5e3,hideProgressBar:!1,closeButton:d.default.createElement(g.default,null),pauseOnHover:!0,closeOnClick:!0,newestOnTop:!1,className:null,style:null,toastClassName:"",bodyClassName:"",progressClassName:""},e.default=j},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(t,e){var n={};for(var o in t)e.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},l=n(1),c=o(l),p=n(0),f=o(p),d=n(9),h=Object.values||function(t){return Object.keys(t).map(function(e){return t[e]})},y=(c.default.any,c.default.node,c.default.bool,c.default.bool,c.default.bool,c.default.func,{component:"div",childFactory:function(t){return t}}),m=function(t){function e(n,o){i(this,e);var r=s(this,t.call(this,n,o));return r.handleExited=function(t,e,n){var o=(0,d.getChildMapping)(r.props.children);t in o||(n&&n(e),r.setState(function(e){var n=u({},e.children);return delete n[t],{children:n}}))},r.state={children:(0,d.getChildMapping)(n.children,function(t){var e=function(e){r.handleExited(t.key,e,t.props.onExited)};return(0,p.cloneElement)(t,{onExited:e,in:!0,appear:r.getProp(t,"appear"),enter:r.getProp(t,"enter"),exit:r.getProp(t,"exit")})})},r}return a(e,t),e.prototype.getChildContext=function(){return{transitionGroup:{isMounting:!this.appeared}}},e.prototype.getProp=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.props;return null!=n[e]?n[e]:t.props[e]},e.prototype.componentDidMount=function(){this.appeared=!0},e.prototype.componentWillReceiveProps=function(t){var e=this,n=this.state.children,o=(0,d.getChildMapping)(t.children),r=(0,d.mergeChildMappings)(n,o);Object.keys(r).forEach(function(i){var s=r[i];if((0,p.isValidElement)(s)){var a=function(t){e.handleExited(s.key,t,s.props.onExited)},u=i in n,l=i in o,c=n[i],f=(0,p.isValidElement)(c)&&!c.props.in;!l||u&&!f?l||!u||f?l&&u&&(0,p.isValidElement)(c)&&(r[i]=(0,p.cloneElement)(s,{onExited:a,in:c.props.in,exit:e.getProp(s,"exit",t),enter:e.getProp(s,"enter",t)})):r[i]=(0,p.cloneElement)(s,{in:!1}):r[i]=(0,p.cloneElement)(s,{onExited:a,in:!0,exit:e.getProp(s,"exit",t),enter:e.getProp(s,"enter",t)})}}),this.setState({children:r})},e.prototype.render=function(){var t=this.props,e=t.component,n=t.childFactory,o=r(t,["component","childFactory"]),i=this.state.children;return delete o.appear,delete o.enter,delete o.exit,f.default.createElement(e,o,h(i).map(n))},e}(f.default.Component);m.childContextTypes={transitionGroup:c.default.object.isRequired},m.propTypes={},m.defaultProps=y,e.default=m,t.exports=e.default},function(t,e,n){"use strict";function o(t,e){var n=function(t){return e&&(0,i.isValidElement)(t)?e(t):t},o=Object.create(null);return t&&i.Children.map(t,function(t){return t}).forEach(function(t){o[t.key]=n(t)}),o}function r(t,e){function n(n){return n in e?e[n]:t[n]}t=t||{},e=e||{};var o=Object.create(null),r=[];for(var i in t)i in e?r.length&&(o[i]=r,r=[]):r.push(i);var s=void 0,a={};for(var u in e){if(o[u])for(s=0;s<o[u].length;s++){var l=o[u][s];a[o[u][s]]=n(l)}a[u]=n(u)}for(s=0;s<r.length;s++)a[r[s]]=n(r[s]);return a}e.__esModule=!0,e.getChildMapping=o,e.mergeChildMappings=r;var i=n(0)},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),u=n(0),l=o(u),c=n(1),p=o(c),f=n(11),d=o(f),h=n(2),y=n(3),m=o(y),v=n(4),O=function(t){function e(){var t,n,o,s;r(this,e);for(var a=arguments.length,u=Array(a),l=0;l<a;l++)u[l]=arguments[l];return n=o=i(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(u))),o.state={isRunning:!0},o.handleVisibility=function(){return o.setState({isRunning:!document.hidden})},o.pauseToast=function(){o.setState({isRunning:!1})},o.playToast=function(){o.setState({isRunning:!0})},s=n,i(o,s)}return s(e,t),a(e,[{key:"componentDidMount",value:function(){null!==this.props.onOpen&&this.props.onOpen(this.getChildrenProps()),document.addEventListener("visibilitychange",this.handleVisibility)}},{key:"componentWillUnmount",value:function(){null!==this.props.onClose&&this.props.onClose(this.getChildrenProps()),document.removeEventListener("visibilitychange",this.handleVisibility)}},{key:"getChildrenProps",value:function(){return this.props.children.props}},{key:"getToastProps",value:function(){var t={className:"toastify-content toastify-content--"+this.props.type+" "+this.props.className};return!1!==this.props.autoClose&&!0===this.props.pauseOnHover&&(t.onMouseEnter=this.pauseToast,t.onMouseLeave=this.playToast),this.props.closeOnClick&&(t.onClick=this.props.closeToast),t}},{key:"render",value:function(){var t=this.props,e=t.closeButton,n=t.children,o=t.autoClose,r=t.type,i=t.hideProgressBar,s=t.closeToast,a=t.transition,u=t.position,c=t.onExited,p=a;return l.default.createElement(p,{in:this.props.in,appear:!0,unmountOnExit:!0,onExited:c,position:u},l.default.createElement("div",this.getToastProps(),l.default.createElement("div",{className:"toastify__body "+this.props.bodyClassName},n),!1!==e&&e,!1!==o&&l.default.createElement(d.default,{delay:o,isRunning:this.state.isRunning,closeToast:s,hide:i,type:r,className:this.props.progressClassName})))}}]),e}(u.Component);O.propTypes={closeButton:v.falseOrElement.isRequired,autoClose:v.falseOrNumber.isRequired,children:p.default.node.isRequired,closeToast:p.default.func.isRequired,position:p.default.oneOf((0,m.default)(h.POSITION)).isRequired,pauseOnHover:p.default.bool.isRequired,closeOnClick:p.default.bool.isRequired,transition:p.default.func.isRequired,in:p.default.bool,onExited:p.default.func,hideProgressBar:p.default.bool,onOpen:p.default.func,onClose:p.default.func,type:p.default.oneOf((0,m.default)(h.TYPE)),className:p.default.string,bodyClassName:p.default.string,progressClassName:p.default.string},O.defaultProps={type:h.TYPE.DEFAULT,in:!0,hideProgressBar:!1,onOpen:null,onClose:null,className:"",bodyClassName:"",progressClassName:""},e.default=O},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(t){var e=t.delay,n=t.isRunning,o=t.closeToast,r=t.type,i=t.hide,a=t.className,u={animationDuration:e+"ms",animationPlayState:n?"running":"paused"};return u.WebkitAnimationPlayState=u.animationPlayState,i&&(u.opacity=0),s.default.createElement("div",{className:"toastify__progress toastify__progress--"+r+" "+a,style:u,onAnimationEnd:o})}Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),s=o(i),a=n(1),u=o(a),l=n(2);r.propTypes={delay:u.default.number.isRequired,isRunning:u.default.bool.isRequired,closeToast:u.default.func.isRequired,type:u.default.string,hide:u.default.bool,className:u.default.string},r.defaultProps={type:l.TYPE.DEFAULT,hide:!1,className:""},e.default=r},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(t){var e=t.closeToast;return s.default.createElement("button",{className:"toastify__close",type:"button",onClick:e},"✖")}Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),s=o(i),a=n(1),u=o(a);r.propTypes={closeToast:u.default.func},e.default=r},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(t,e){var n={};for(var o in t)e.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function i(t){var e=t.children,n=t.position,o=r(t,["children","position"]);return u.default.createElement(c.default,s({},o,{timeout:750,onEnter:function(t){t.classList.add("toast-enter--"+n),t.classList.add("toastify-animated")},onExit:function(t){t.classList.remove("toast-enter--"+n),t.classList.remove("toastify-animated"),t.classList.add("toast-exit--"+n),t.classList.add("toastify-animated")}}),e)}Object.defineProperty(e,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},a=n(0),u=o(a),l=n(14),c=o(l);e.default=i},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function r(t,e){var n={};for(var o in t)e.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(){}e.__esModule=!0,e.EXITING=e.ENTERED=e.ENTERING=e.EXITED=e.UNMOUNTED=void 0;var l=n(1),c=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(l),p=n(0),f=o(p),d=n(15),h=o(d),y=(n(16),e.UNMOUNTED="unmounted"),m=e.EXITED="exited",v=e.ENTERING="entering",O=e.ENTERED="entered",b=e.EXITING="exiting",E=function(t){function e(n,o){i(this,e);var r=s(this,t.call(this,n,o)),a=o.transitionGroup,u=a&&!a.isMounting?n.enter:n.appear,l=void 0;return r.nextStatus=null,n.in?u?(l=m,r.nextStatus=v):l=O:l=n.unmountOnExit||n.mountOnEnter?y:m,r.state={status:l},r.nextCallback=null,r}return a(e,t),e.prototype.getChildContext=function(){return{transitionGroup:null}},e.prototype.componentDidMount=function(){this.updateStatus(!0)},e.prototype.componentWillReceiveProps=function(t){var e=this.pendingState||this.state,n=e.status;t.in?(n===y&&this.setState({status:m}),n!==v&&n!==O&&(this.nextStatus=v)):n!==v&&n!==O||(this.nextStatus=b)},e.prototype.componentDidUpdate=function(){this.updateStatus()},e.prototype.componentWillUnmount=function(){this.cancelNextCallback()},e.prototype.getTimeouts=function(){var t=this.props.timeout,e=void 0,n=void 0,o=void 0;return e=n=o=t,null!=t&&"number"!=typeof t&&(e=t.exit,n=t.enter,o=t.appear),{exit:e,enter:n,appear:o}},e.prototype.updateStatus=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.nextStatus;if(null!==e){this.nextStatus=null,this.cancelNextCallback();var n=h.default.findDOMNode(this);e===v?this.performEnter(n,t):this.performExit(n)}else this.props.unmountOnExit&&this.state.status===m&&this.setState({status:y})},e.prototype.performEnter=function(t,e){var n=this,o=this.props.enter,r=this.context.transitionGroup?this.context.transitionGroup.isMounting:e,i=this.getTimeouts();if(!e&&!o)return void this.safeSetState({status:O},function(){n.props.onEntered(t)});this.props.onEnter(t,r),this.safeSetState({status:v},function(){n.props.onEntering(t,r),n.onTransitionEnd(t,i.enter,function(){n.safeSetState({status:O},function(){n.props.onEntered(t,r)})})})},e.prototype.performExit=function(t){var e=this,n=this.props.exit,o=this.getTimeouts();if(!n)return void this.safeSetState({status:m},function(){e.props.onExited(t)});this.props.onExit(t),this.safeSetState({status:b},function(){e.props.onExiting(t),e.onTransitionEnd(t,o.exit,function(){e.safeSetState({status:m},function(){e.props.onExited(t)})})})},e.prototype.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},e.prototype.safeSetState=function(t,e){var n=this;this.pendingState=t,e=this.setNextCallback(e),this.setState(t,function(){n.pendingState=null,e()})},e.prototype.setNextCallback=function(t){var e=this,n=!0;return this.nextCallback=function(o){n&&(n=!1,e.nextCallback=null,t(o))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},e.prototype.onTransitionEnd=function(t,e,n){this.setNextCallback(n),t?(this.props.addEndListener&&this.props.addEndListener(t,this.nextCallback),null!=e&&setTimeout(this.nextCallback,e)):setTimeout(this.nextCallback,0)},e.prototype.render=function(){var t=this.state.status;if(t===y)return null;var e=this.props,n=e.children,o=r(e,["children"]);if(delete o.in,delete o.mountOnEnter,delete o.unmountOnExit,delete o.appear,delete o.enter,delete o.exit,delete o.timeout,delete o.addEndListener,delete o.onEnter,delete o.onEntering,delete o.onEntered,delete o.onExit,delete o.onExiting,delete o.onExited,"function"==typeof n)return n(t,o);var i=f.default.Children.only(n);return f.default.cloneElement(i,o)},e}(f.default.Component);E.contextTypes={transitionGroup:c.object},E.childContextTypes={transitionGroup:function(){}},E.propTypes={},E.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:u,onEntering:u,onEntered:u,onExit:u,onExiting:u,onExited:u},E.UNMOUNTED=0,E.EXITED=1,E.ENTERING=2,E.ENTERED=3,E.EXITING=4,e.default=E},function(t,e){t.exports=n},function(t,e,n){"use strict";function o(t){var e="transition"+t+"Timeout",n="transition"+t;return function(t){if(t[n]){if(null==t[e])return new Error(e+" wasn't supplied to CSSTransitionGroup: this can cause unreliable animations and won't be supported in a future version of React. See https://fb.me/react-animation-transition-group-timeout for more information.");if("number"!=typeof t[e])return new Error(e+" must be a number (in milliseconds)")}return null}}e.__esModule=!0,e.classNamesShape=e.timeoutsShape=void 0,e.transitionTimeout=o;var r=n(1),i=function(t){return t&&t.__esModule?t:{default:t}}(r);e.timeoutsShape=i.default.oneOfType([i.default.number,i.default.shape({enter:i.default.number,exit:i.default.number}).isRequired]),e.classNamesShape=i.default.oneOfType([i.default.string,i.default.shape({enter:i.default.string,exit:i.default.string,active:i.default.string}),i.default.shape({enter:i.default.string,enterActive:i.default.string,exit:i.default.string,exitActive:i.default.string})])},function(t,e,n){"use strict";function o(t){return i({},l,t,{toastId:++f})}function r(t,e){return null!==c?a.default.emit(u.ACTION.SHOW,t,e):p.push({action:u.ACTION.SHOW,content:t,options:e}),e.toastId}Object.defineProperty(e,"__esModule",{value:!0});var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},s=n(5),a=function(t){return t&&t.__esModule?t:{default:t}}(s),u=n(2),l={type:u.TYPE.DEFAULT,autoClose:null,closeButton:null,hideProgressBar:null,position:null,pauseOnHover:null,closeOnClick:null,className:null,bodyClassName:null,progressClassName:null,tansition:null},c=null,p=[],f=0,d=i(function(t,e){return r(t,o(e))},{success:function(t,e){return r(t,i(o(e),{type:u.TYPE.SUCCESS}))},info:function(t,e){return r(t,i(o(e),{type:u.TYPE.INFO}))},warn:function(t,e){return r(t,i(o(e),{type:u.TYPE.WARNING}))},warning:function(t,e){return r(t,i(o(e),{type:u.TYPE.WARNING}))},error:function(t,e){return r(t,i(o(e),{type:u.TYPE.ERROR}))},dismiss:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return a.default.emit(u.ACTION.CLEAR,t)},isActive:function(){return!1}},{POSITION:u.POSITION,TYPE:u.TYPE});a.default.on(u.ACTION.MOUNTED,function(t){c=t,d.isActive=function(t){return c.isToastActive(t)},p.forEach(function(t){a.default.emit(t.action,t.content,t.options)}),p=[]}),e.default=d}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("prop-types"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","prop-types","react-dom"],t):"object"==typeof exports?exports.ReactToastify=t(require("react"),require("prop-types"),require("react-dom")):e.ReactToastify=t(e.react,e["prop-types"],e["react-dom"])}(this,function(e,t,n){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=13)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(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,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e){return Ue.speedy(e)}function s(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];$e=!!e}function u(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t=(0,ze.default)(t),t?$e?t.reduce(function(e,t){return e["data-simulate-"+c(t)]="",e},{}):(Je||(console.warn("can't simulate without once calling simulations(true)"),Je=!0),Ve||Xe||Ke||(console.warn("don't use simulation outside dev"),Ke=!0),{}):{}}function l(e){Qe=!!e}function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e.toLowerCase().replace(/[^a-z0-9]/g,t)}function f(e){var t=JSON.stringify(e),n=(0,He.default)(t).toString(36);return e.label&&e.label.length>0&&Ve?c(e.label.join("."),"-")+"-"+n:n}function d(e){var t=Object.keys(e).filter(function(e){return"toString"!==e});return 1===t.length&&!!/data\-css\-([a-zA-Z0-9\-_]+)/.exec(t[0])}function p(e){var t=Object.keys(e).filter(function(e){return"toString"!==e});if(1!==t.length)throw new Error("not a rule");var n=/data\-css\-([a-zA-Z0-9\-_]+)/,r=n.exec(t[0]);if(!r)throw new Error("not a rule");return r[1]}function h(e){if(-1===e.indexOf(","))return[e];for(var t,n=[],r=[],o=0;t=et.exec(e);)switch(t[0]){case"(":o++;break;case")":o--;break;case",":if(o)break;n.push(t.index)}for(t=n.length;t--;)r.unshift(e.slice(n[t]+1)),e=e.slice(0,n[t]);return r.unshift(e),r}function m(e,t){if(!e)return t.replace(/\&/g,"");if(!t)return".css-"+e+",[data-css-"+e+"]";var n=h(t).map(function(t){return t.indexOf("&")>=0?[t.replace(/\&/gm,".css-"+e),t.replace(/\&/gm,"[data-css-"+e+"]")].join(","):".css-"+e+t+",[data-css-"+e+"]"+t}).join(",");return $e&&/^\&\:/.exec(t)&&!/\s/.exec(t)&&(n+=",.css-"+e+"[data-simulate-"+c(t)+"],[data-css-"+e+"][data-simulate-"+c(t)+"]"),n}function y(e){var t=e.selector,n=e.style,r=Ye.transform({selector:t,style:n});return r.selector+"{"+(0,De.createMarkupForStyles)(r.style)+"}"}function b(e){var t=void 0,n=void 0,r=void 0,o=void 0;return Object.keys(e).forEach(function(i){i.indexOf("&")>=0?(n=n||{},n[i]=e[i]):0===i.indexOf("@media")?(r=r||{},r[i]=b(e[i])):0===i.indexOf("@supports")?(o=o||{},o[i]=b(e[i])):"label"===i?e.label.length>0&&(t=t||{},t.label=Qe?e.label.join("."):""):(t=t||{},t[i]=e[i])}),{plain:t,selects:n,medias:r,supports:o}}function g(e,t){var n=[],r=t.plain,o=t.selects,i=t.medias,a=t.supports;return r&&n.push(y({style:r,selector:m(e)})),o&&Object.keys(o).forEach(function(t){return n.push(y({style:o[t],selector:m(e,t)}))}),i&&Object.keys(i).forEach(function(t){return n.push(t+"{"+g(e,i[t]).join("")+"}")}),a&&Object.keys(a).forEach(function(t){return n.push(t+"{"+g(e,a[t]).join("")+"}")}),n}function v(e){if(!tt[e.id]){tt[e.id]=!0;var t=b(e.style),n=g(e.id,t);tt[e.id]=!!Ze||n,n.forEach(function(e){return Ue.insert(e)})}}function O(e){nt[e.id]||(nt[e.id]=e)}function x(e){if(d(e)){var t=nt[p(e)];if(null==t)throw new Error("[glamor] an unexpected rule cache miss occurred. This is probably a sign of multiple glamor instances in your app. See https://github.com/threepointone/glamor/issues/79");return t}return e}function E(e){if(O(e),v(e),rt[e.id])return rt[e.id];var t=i({},"data-css-"+e.id,Qe?e.label||"":"");return Object.defineProperty(t,"toString",{enumerable:!1,value:function(){return"css-"+e.id}}),rt[e.id]=t,t}function T(e){for(var t=[":",".","[",">"," "],n=!1,r=e.charAt(0),o=0;o<t.length;o++)if(r===t[o]){n=!0;break}return n||e.indexOf("&")>=0}function k(e,t){var n=h(e).map(function(e){return e.indexOf("&")>=0?e:"&"+e});return h(t).map(function(e){return e.indexOf("&")>=0?e:"&"+e}).reduce(function(e,t){return e.concat(n.map(function(e){return t.replace(/\&/g,e)}))},[]).join(",")}function w(e,t){return e?"@media "+e.substring(6)+" and "+t.substring(6):t}function _(e){return 0===e.indexOf("@media")}function C(e){return 0===e.indexOf("@supports")}function P(e,t){return e?"@supports "+e.substring(9)+" and "+t.substring(9):t}function S(e){for(var t=[],n=0;n<e.length;n++)t=Array.isArray(e[n])?t.concat(S(e[n])):t.concat(e[n]);return t}function j(e,t){var n=t.selector,r=void 0===n?"":n,o=t.mq,i=void 0===o?"":o,a=t.supp,s=void 0===a?"":a,u=t.src,l=void 0===u?{}:u;Array.isArray(l)||(l=[l]),l=S(l),l.forEach(function(t){if(d(t)){var n=x(t);if("css"!==n.type)throw new Error("cannot merge this rule");t=n.style}t=(0,ze.default)(t),t&&t.composes&&j(e,{selector:r,mq:i,supp:s,src:t.composes}),Object.keys(t||{}).forEach(function(n){if(T(n))ot[n]&&ot[n].forEach(function(o){return j(e,{selector:k(r,o),mq:i,supp:s,src:t[n]})}),j(e,{selector:k(r,n),mq:i,supp:s,src:t[n]});else if(_(n))j(e,{selector:r,mq:w(i,n),supp:s,src:t[n]});else if(C(n))j(e,{selector:r,mq:i,supp:P(s,n),src:t[n]});else if("composes"===n);else{var o=e;s&&(o[s]=o[s]||{},o=o[s]),i&&(o[i]=o[i]||{},o=o[i]),r&&(o[r]=o[r]||{},o=o[r]),"label"===n?Qe&&(e.label=e.label.concat(t.label)):o[n]=t[n]}})})}function N(e){var t={label:[]};return j(t,{src:e}),E({id:f(t),style:t,label:Qe?t.label.join("."):"",type:"css"})}function M(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(t[0]&&t[0].length&&t[0].raw)throw new Error("you forgot to include glamor/babel in your babel plugins.");return t=(0,ze.default)(t),t?ut(t):it}function R(e){if(!tt[e.id]){var t=Object.keys(e.keyframes).map(function(t){var n=Ye.keyframes.transform({id:e.id,name:t,style:e.keyframes[t]});return n.name+"{"+(0,De.createMarkupForStyles)(n.style)+"}"}).join(""),n=["-webkit-","-moz-","-o-",""].map(function(n){return"@"+n+"keyframes "+e.name+"_"+e.id+"{"+t+"}"});n.forEach(function(e){return Ue.insert(e)}),tt[e.id]=!!Ze||n}}function A(e){if(!tt[e.id]){var t="@font-face{"+(0,De.createMarkupForStyles)(e.font)+"}";Ue.insert(t),tt[e.id]=!!Ze||[t]}}function I(e){(0,Be.default)(tt,e.reduce(function(e,t){return e[t]=!0,e},{}))}function W(){tt=Ue.inserted={},nt=Ue.registered={},rt={},Ue.flush(),Ue.inject()}function B(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e?M(i({},e,n)):lt(n)}function L(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return M(i({},e+" &",n))}function D(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return M(i({},"@media "+e,n))}function F(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return M(i({},e,n))}function z(e){return F(":active",e)}function q(e){return F(":any",e)}function G(e){return F(":checked",e)}function H(e){return F(":disabled",e)}function U(e){return F(":empty",e)}function Y(e){return F(":enabled",e)}function V(e){return F(":default",e)}function X(e){return F(":first",e)}function Z(e){return F(":first-child",e)}function $(e){return F(":first-of-type",e)}function J(e){return F(":fullscreen",e)}function K(e){return F(":focus",e)}function Q(e){return F(":hover",e)}function ee(e){return F(":indeterminate",e)}function te(e){return F(":in-range",e)}function ne(e){return F(":invalid",e)}function re(e){return F(":last-child",e)}function oe(e){return F(":last-of-type",e)}function ie(e){return F(":left",e)}function ae(e){return F(":link",e)}function se(e){return F(":only-child",e)}function ue(e){return F(":only-of-type",e)}function le(e){return F(":optional",e)}function ce(e){return F(":out-of-range",e)}function fe(e){return F(":read-only",e)}function de(e){return F(":read-write",e)}function pe(e){return F(":required",e)}function he(e){return F(":right",e)}function me(e){return F(":root",e)}function ye(e){return F(":scope",e)}function be(e){return F(":target",e)}function ge(e){return F(":valid",e)}function ve(e){return F(":visited",e)}function Oe(e,t){return F(":dir("+e+")",t)}function xe(e,t){return F(":lang("+e+")",t)}function Ee(e,t){var n=e.split(",").map(function(e){return e.trim()}).map(function(e){return":not("+e+")"});return 1===n.length?F(":not("+e+")",t):B(n.join(""),t)}function Te(e,t){return F(":nth-child("+e+")",t)}function ke(e,t){return F(":nth-last-child("+e+")",t)}function we(e,t){return F(":nth-last-of-type("+e+")",t)}function _e(e,t){return F(":nth-of-type("+e+")",t)}function Ce(e){return F("::after",e)}function Pe(e){return F("::before",e)}function Se(e){return F("::first-letter",e)}function je(e){return F("::first-line",e)}function Ne(e){return F("::selection",e)}function Me(e){return F("::backdrop",e)}function Re(e){return M({"::placeholder":e})}function Ae(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t=(0,ze.default)(t),t?t.map(function(e){var t={label:[]};return j(t,{src:e}),g(f(t),b(t)).join("")}).join(""):""}function Ie(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t=(0,ze.default)(t),t?t.map(function(e){p(e);var t=Object.keys(e)[0];return t+'="'+(e[t]||"")+'"'}).join(" "):""}Object.defineProperty(t,"__esModule",{value:!0}),t.compose=t.merge=t.$=t.style=t.presets=t.keyframes=t.fontFace=t.insertGlobal=t.insertRule=t.plugins=t.styleSheet=void 0,t.speedy=a,t.simulations=s,t.simulate=u,t.cssLabels=l,t.isLikeRule=d,t.idFor=p,t.css=M,t.rehydrate=I,t.flush=W,t.select=B,t.parent=L,t.media=D,t.pseudo=F,t.active=z,t.any=q,t.checked=G,t.disabled=H,t.empty=U,t.enabled=Y,t._default=V,t.first=X,t.firstChild=Z,t.firstOfType=$,t.fullscreen=J,t.focus=K,t.hover=Q,t.indeterminate=ee,t.inRange=te,t.invalid=ne,t.lastChild=re,t.lastOfType=oe,t.left=ie,t.link=ae,t.onlyChild=se,t.onlyOfType=ue,t.optional=le,t.outOfRange=ce,t.readOnly=fe,t.readWrite=de,t.required=pe,t.right=he,t.root=me,t.scope=ye,t.target=be,t.valid=ge,t.visited=ve,t.dir=Oe,t.lang=xe,t.not=Ee,t.nthChild=Te,t.nthLastChild=ke,t.nthLastOfType=we,t.nthOfType=_e,t.after=Ce,t.before=Pe,t.firstLetter=Se,t.firstLine=je,t.selection=Ne,t.backdrop=Me,t.placeholder=Re,t.cssFor=Ae,t.attribsFor=Ie;var We=n(6),Be=r(We),Le=n(15),De=n(7),Fe=n(24),ze=r(Fe),qe=n(25),Ge=n(42),He=r(Ge),Ue=t.styleSheet=new Le.StyleSheet;Ue.inject();var Ye=t.plugins=Ue.plugins=new qe.PluginSet([qe.prefixes,qe.contentWrap,qe.fallbacks]);Ye.media=new qe.PluginSet,Ye.fontFace=new qe.PluginSet,Ye.keyframes=new qe.PluginSet([qe.prefixes,qe.fallbacks]);var Ve=!1,Xe=!1,Ze="undefined"!=typeof window,$e=Ve,Je=!1,Ke=!1,Qe=Ve,et=/[(),]|"(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\//g,tt=Ue.inserted={},nt=Ue.registered={},rt={},ot={"::placeholder":["::-webkit-input-placeholder","::-moz-placeholder","::-ms-input-placeholder"],":fullscreen":[":-webkit-full-screen",":-moz-full-screen",":-ms-fullscreen"]},it={};Object.defineProperty(it,"toString",{enumerable:!1,value:function(){return"css-nil"}});var at="undefined"!=typeof WeakMap?[it,new WeakMap,new WeakMap,new WeakMap]:[it],st=!1,ut="undefined"!=typeof WeakMap?function(e){return function(t){if(at[t.length]){for(var n=at[t.length],r=0;r<t.length-1;)n.has(t[r])||n.set(t[r],new WeakMap),n=n.get(t[r]),r++;if(n.has(t[t.length-1])){var i=n.get(t[r]);if(nt[i.toString().substring(4)])return i}}var a=e(t);if(at[t.length]){for(var s=0,u=at[t.length];s<t.length-1;)u=u.get(t[s]),s++;try{u.set(t[s],a)}catch(e){if(Ve&&!st){var l;st=!0,(l=console).warn.apply(l,["failed setting the WeakMap cache for args:"].concat(o(t))),console.warn("this should NOT happen, please file a bug on the github repo.")}}}return a}}(N):N;M.insert=function(e){var t={id:f(e),css:e,type:"raw"};O(t),tt[t.id]||(Ue.insert(t.css),tt[t.id]=!!Ze||[t.css])},t.insertRule=M.insert,M.global=function(e,t){if(t=(0,ze.default)(t))return M.insert(y({selector:e,style:t}))},t.insertGlobal=M.global,M.keyframes=function(e,t){t||(t=e,e="animation"),t=(0,ze.default)(t)||{};var n={id:f({name:e,kfs:t}),type:"keyframes",name:e,keyframes:t};return O(n),R(n),e+"_"+n.id},M.fontFace=function(e){e=(0,ze.default)(e);var t={id:f(e),type:"font-face",font:e};return O(t),A(t),e.fontFamily};var lt=(t.fontFace=M.fontFace,t.keyframes=M.keyframes,t.presets={mobile:"(min-width: 400px)",Mobile:"@media (min-width: 400px)",phablet:"(min-width: 550px)",Phablet:"@media (min-width: 550px)",tablet:"(min-width: 750px)",Tablet:"@media (min-width: 750px)",desktop:"(min-width: 1000px)",Desktop:"@media (min-width: 1000px)",hd:"(min-width: 1200px)",Hd:"@media (min-width: 1200px)"},t.style=M);t.$=B,t.merge=M,t.compose=M},function(e,t,n){"use strict";function r(e){return"string"==typeof e&&o.test(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o=/-webkit-|-moz-|-ms-/;e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.POSITION={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},t.TYPE={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"},t.ACTION={SHOW:"SHOW_TOAST",CLEAR:"CLEAR_TOAST",MOUNTED:"CONTAINER_MOUNTED"}},function(e,t,n){"use strict";function r(e){Object.keys(e).forEach(function(t){var n=e[t];o.hasOwnProperty(t)&&"string"==typeof n&&(o[t]=n)})}Object.defineProperty(t,"__esModule",{value:!0}),t.defineStyle=r;var o={width:"320px",colorDefault:"#fff",colorInfo:"#3498db",colorSuccess:"#07bc0c",colorWarning:"#f1c40f",colorError:"#e74c3c",colorProgressDefault:"linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #34aadc, #5856d6, #ff2d55)",mobile:"only screen and (max-width : 480px)"};t.default=o},function(e,t,n){"use strict";function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,s,u=r(e),l=1;l<arguments.length;l++){n=Object(arguments[l]);for(var c in n)i.call(n,c)&&(u[c]=n[c]);if(o){s=o(n);for(var f=0;f<s.length;f++)a.call(n,s[f])&&(u[s[f]]=n[s[f]])}}return u}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n="";for(var r in e){var o=0===r.indexOf("--");if(e.hasOwnProperty(r)&&"label"!==r){var i=e[r];null!=i&&(o?n+=r+":"+i+";":(n+=p(r)+":",n+=(0,s.default)(r,i,t)+";"))}}return n||null}Object.defineProperty(t,"__esModule",{value:!0}),t.processStyleName=void 0,t.createMarkupForStyles=o;var i=n(16),a=(r(i),n(18)),s=r(a),u=n(21),l=r(u),c=n(23),f=r(c),d=n(8),p=(r(d),t.processStyleName=(0,f.default)(l.default))},function(e,t,n){"use strict";var r=n(20),o=r;e.exports=o},function(e,t,n){"use strict";function r(e){return e.charAt(0).toUpperCase()+e.slice(1)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=[];return Object.keys(e).forEach(function(n){return t.push(e[n])}),t}},function(e,t,n){"use strict";function r(e){return Object.prototype.toString.call(e).slice(8,-1)}function o(e){return"Number"===r(e)&&!isNaN(e)&&e>0}function i(e){return e.isRequired=function(t,n,r){if(void 0===t[n])return new Error("The prop "+n+" is marked as required in \n "+r+", but its value is undefined.");e(t,n,r)},e}Object.defineProperty(t,"__esModule",{value:!0}),t.falseOrElement=t.falseOrNumber=void 0,t.typeOf=r,t.isValidDelay=o;var a=n(0);t.falseOrNumber=i(function(e,t,n){var r=e[t];return!1===r||o(r)?null:new Error(n+" expect "+t+" \n to be a valid Number > 0 or equal to false. "+r+" given.")}),t.falseOrElement=i(function(e,t,n){var r=e[t];return!1===r||(0,a.isValidElement)(r)?null:new Error(n+" expect "+t+" \n to be a valid react element or equal to false. "+r+" given.")})},function(e,t,n){"use strict";function r(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)}Object.defineProperty(t,"__esModule",{value:!0});var o={eventList:new Map,on:function(e,t){return this.eventList.has(e)||this.eventList.set(e,[]),this.eventList.get(e).push(t),this},off:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return this.eventList.delete(e)},emit:function(e){for(var t=this,n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return this.eventList.has(e)?(this.eventList.get(e).forEach(function(e){return setTimeout(function(){return e.call.apply(e,[t].concat(r(o)))},0)}),!0):(console.warn("<"+e+"> Event is not registered. Did you forgot to bind the event ?"),!1)}};t.default=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.style=t.toast=t.ToastContainer=void 0;var o=n(14),i=r(o),a=n(53),s=r(a),u=n(5);t.ToastContainer=i.default,t.toast=s.default,t.style=u.defineStyle},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(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){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)}function u(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 l="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},c=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}}(),f=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},d=n(0),p=r(d),h=n(1),m=r(h),y=n(2),b=n(43),g=r(b),v=n(45),O=r(v),x=n(47),E=r(x),T=n(48),k=r(T),w=n(4),_=n(5),C=r(_),P=n(12),S=r(P),j=n(10),N=r(j),M=n(11),R=function(){return(0,y.css)(u({zIndex:999,position:"fixed",padding:"4px",width:C.default.width,boxSizing:"border-box",color:"#fff"},"@media "+C.default.mobile,{width:"100vw",padding:0}))},A=function(e){var t=void 0,n="-"+parseInt(C.default.width,10)/2+"px";switch(e){case w.POSITION.TOP_LEFT:t={top:"1em",left:"1em"};break;case w.POSITION.TOP_CENTER:t={top:"1em",left:"50%",marginLeft:n};break;case w.POSITION.TOP_RIGHT:default:t={top:"1em",right:"1em"};break;case w.POSITION.BOTTOM_LEFT:t={bottom:"1em",left:"1em"};break;case w.POSITION.BOTTOM_CENTER:t={bottom:"1em",left:"50%",marginLeft:n};break;case w.POSITION.BOTTOM_RIGHT:t={bottom:"1em",right:"1em"}}return(0,y.css)(t,(0,y.css)(u({},"@media "+C.default.mobile,f({left:0,margin:0,position:"fixed"},"top"===e.substring(0,3)?{top:0}:{bottom:0}))))},I=function(e){function t(){var e,n,r,o;i(this,t);for(var s=arguments.length,u=Array(s),l=0;l<s;l++)u[l]=arguments[l];return n=r=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),r.state={toast:[]},r.collection={},r.isToastActive=function(e){return-1!==r.state.toast.indexOf(parseInt(e,10))},o=n,a(r,o)}return s(t,e),c(t,[{key:"componentDidMount",value:function(){var e=this,t=w.ACTION.SHOW,n=w.ACTION.CLEAR,r=w.ACTION.MOUNTED;S.default.on(t,function(t,n){return e.show(t,n)}).on(n,function(t){return null!==t?e.removeToast(t):e.clear()}).emit(r,this)}},{key:"componentWillUnmount",value:function(){S.default.off(w.ACTION.SHOW),S.default.off(w.ACTION.CLEAR)}},{key:"removeToast",value:function(e){this.setState({toast:this.state.toast.filter(function(t){return t!==parseInt(e,10)})})}},{key:"with",value:function(e,t){return(0,d.cloneElement)(e,f({},t,e.props))}},{key:"makeCloseButton",value:function(e,t,n){var r=this,o=this.props.closeButton;return((0,d.isValidElement)(e)||!1===e)&&(o=e),!1!==o&&this.with(o,{closeToast:function(){return r.removeToast(t)},type:n})}},{key:"getAutoCloseDelay",value:function(e){return!1===e||(0,M.isValidDelay)(e)?e:this.props.autoClose}},{key:"isFunction",value:function(e){return!!(e&&e.constructor&&e.call&&e.apply)}},{key:"canBeRendered",value:function(e){return(0,d.isValidElement)(e)||"String"===(0,M.typeOf)(e)||"Number"===(0,M.typeOf)(e)}},{key:"show",value:function(e,t){var n=this;if(!this.canBeRendered(e))throw new Error("The element you provided cannot be rendered. You provided an element of type "+(void 0===e?"undefined":l(e)));var r=t.toastId,i=function(){return n.removeToast(r)},a={id:r,type:t.type,closeButton:this.makeCloseButton(t.closeButton,r,t.type),position:t.position||this.props.position,transition:t.transition||this.props.transition,pauseOnHover:null!==t.pauseOnHover?t.pauseOnHover:this.props.pauseOnHover,closeOnClick:null!==t.closeOnClick?t.closeOnClick:this.props.closeOnClick,className:t.className||this.props.toastClassName,bodyClassName:t.bodyClassName||this.props.bodyClassName,progressClassName:t.progressClassName||this.props.progressClassName};this.isFunction(t.onOpen)&&(a.onOpen=t.onOpen),this.isFunction(t.onClose)&&(a.onClose=t.onClose),a.autoClose=this.getAutoCloseDelay(!1!==t.autoClose?parseInt(t.autoClose,10):t.autoClose),a.hideProgressBar="boolean"==typeof t.hideProgressBar?t.hideProgressBar:this.props.hideProgressBar,a.closeToast=i,(0,d.isValidElement)(e)&&"String"!==(0,M.typeOf)(e.type)&&(e=this.with(e,{closeToast:i})),this.collection=f({},this.collection,u({},r,{content:this.makeToast(e,a),position:a.position})),this.setState({toast:[].concat(o(this.state.toast),[r])})}},{key:"makeToast",value:function(e,t){return p.default.createElement(O.default,f({},t,{key:"toast-"+t.id}),e)}},{key:"clear",value:function(){this.setState({toast:[]})}},{key:"getContainerProps",value:function(e){var t={style:e?{pointerEvents:"none"}:{}};return null!==this.props.className&&(t.className=this.props.className),null!==this.props.style&&(t.style=f({},this.props.style,t.style)),t}},{key:"renderToast",value:function(){var e=this,t={};return(this.props.newestOnTop?Object.keys(this.collection).reverse():Object.keys(this.collection)).forEach(function(n){var r=e.collection[n];t[r.position]||(t[r.position]=[]),-1!==e.state.toast.indexOf(parseInt(n,10))?t[r.position].push(r.content):(t[r.position].push(null),delete e.collection[n])}),Object.keys(t).map(function(n){var r=1===t[n].length&&null===t[n][0];return p.default.createElement(g.default,f({},R(),A(n),e.getContainerProps(r),{key:"container-"+n}),t[n])})}},{key:"render",value:function(){return p.default.createElement("div",null,this.renderToast())}}]),t}(d.Component);I.propTypes={position:m.default.oneOf((0,N.default)(w.POSITION)),autoClose:M.falseOrNumber,closeButton:M.falseOrElement,hideProgressBar:m.default.bool,pauseOnHover:m.default.bool,closeOnClick:m.default.bool,newestOnTop:m.default.bool,className:m.default.oneOfType([m.default.string,m.default.object]),style:m.default.object,toastClassName:m.default.oneOfType([m.default.string,m.default.object]),bodyClassName:m.default.oneOfType([m.default.string,m.default.object]),progressClassName:m.default.oneOfType([m.default.string,m.default.object]),transition:m.default.func},I.defaultProps={position:w.POSITION.TOP_RIGHT,transition:k.default,autoClose:5e3,hideProgressBar:!1,closeButton:p.default.createElement(E.default,null),pauseOnHover:!0,closeOnClick:!0,newestOnTop:!1,className:null,style:null,toastClassName:"",bodyClassName:"",progressClassName:""},t.default=I},function(e,t,n){"use strict";function r(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 o(e){return e[e.length-1]}function i(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function a(){var e=document.createElement("style");return e.type="text/css",e.setAttribute("data-glamor",""),e.appendChild(document.createTextNode("")),(document.head||document.getElementsByTagName("head")[0]).appendChild(e),e}function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.speedy,n=void 0===t?!f&&!d:t,r=e.maxLength,o=void 0===r?c&&p?4e3:65e3:r;this.isSpeedy=n,this.sheet=void 0,this.tags=[],this.maxLength=o,this.ctr=0}Object.defineProperty(t,"__esModule",{value:!0}),t.StyleSheet=s;var u=n(6),l=function(e){return e&&e.__esModule?e:{default:e}}(u),c="undefined"!=typeof window,f=!1,d=!1,p=function(){if(c){var e=document.createElement("div");return e.innerHTML="\x3c!--[if lt IE 10]><i></i><![endif]--\x3e",1===e.getElementsByTagName("i").length}}();(0,l.default)(s.prototype,{getSheet:function(){return i(o(this.tags))},inject:function(){var e=this;if(this.injected)throw new Error("already injected stylesheet!");c?this.tags[0]=a():this.sheet={cssRules:[],insertRule:function(t){e.sheet.cssRules.push({cssText:t})}},this.injected=!0},speedy:function(e){if(0!==this.ctr)throw new Error("cannot change speedy mode after inserting any rule to sheet. Either call speedy("+e+") earlier in your app, or call flush() before speedy("+e+")");this.isSpeedy=!!e},_insert:function(e){try{var t=this.getSheet();t.insertRule(e,-1!==e.indexOf("@import")?0:t.cssRules.length)}catch(t){f&&console.warn("whoops, illegal rule inserted",e)}},insert:function(e){if(c)if(this.isSpeedy&&this.getSheet().insertRule)this._insert(e);else if(-1!==e.indexOf("@import")){var t=o(this.tags);t.insertBefore(document.createTextNode(e),t.firstChild)}else o(this.tags).appendChild(document.createTextNode(e));else this.sheet.insertRule(e,-1!==e.indexOf("@import")?0:this.sheet.cssRules.length);return this.ctr++,c&&this.ctr%this.maxLength==0&&this.tags.push(a()),this.ctr-1},delete:function(e){return this.replace(e,"")},flush:function(){c?(this.tags.forEach(function(e){return e.parentNode.removeChild(e)}),this.tags=[],this.sheet=null,this.ctr=0):this.sheet.cssRules=[],this.injected=!1},rules:function(){if(!c)return this.sheet.cssRules;var e=[];return this.tags.forEach(function(t){return e.splice.apply(e,[e.length,0].concat(r(Array.from(i(t).cssRules))))}),e}})},function(e,t,n){"use strict";function r(e){return o(e.replace(i,"ms-"))}var o=n(17),i=/^-ms-/;e.exports=r},function(e,t,n){"use strict";function r(e){return e.replace(o,function(e,t){return t.toUpperCase()})}var o=/-(.)/g;e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n){return null==t||"boolean"==typeof t||""===t?"":isNaN(t)||0===t||u.hasOwnProperty(e)&&u[e]?""+t:("string"==typeof t&&(t=t.trim()),t+"px")}Object.defineProperty(t,"__esModule",{value:!0});var i=n(19),a=r(i),s=n(8),u=(r(s),a.default.isUnitlessNumber);t.default=o},function(e,t,n){"use strict";function r(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}Object.defineProperty(t,"__esModule",{value:!0});var o={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowStart:!0,gridRowEnd:!0,gridColumn:!0,gridColumnStart:!0,gridColumnEnd:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},i=["Webkit","ms","Moz","O"];Object.keys(o).forEach(function(e){i.forEach(function(t){o[r(t,e)]=o[e]})});var a={background:{backgroundAttachment:!0,backgroundColor:!0,backgroundImage:!0,backgroundPositionX:!0,backgroundPositionY:!0,backgroundRepeat:!0},backgroundPosition:{backgroundPositionX:!0,backgroundPositionY:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0},outline:{outlineWidth:!0,outlineStyle:!0,outlineColor:!0}},s={isUnitlessNumber:o,shorthandPropertyExpansions:a};t.default=s},function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";function r(e){return o(e).replace(i,"-ms-")}var o=n(22),i=/^ms-/;e.exports=r},function(e,t,n){"use strict";function r(e){return e.replace(o,"-$1").toLowerCase()}var o=/([A-Z])/g;e.exports=r},function(e,t,n){"use strict";function r(e){var t={};return function(n){return t.hasOwnProperty(n)||(t[n]=e.call(this,n)),t[n]}}e.exports=r},function(e,t,n){"use strict";function r(e){return null===e||void 0===e||!1===e||"object"===(void 0===e?"undefined":s(e))&&0===Object.keys(e).length}function o(e){if(r(e))return null;if("object"!==(void 0===e?"undefined":s(e)))return e;for(var t={},n=Object.keys(e),o=!1,i=0;i<n.length;i++){var u=e[n[i]],l=a(u);null!==l&&l===u||(o=!0),null!==l&&(t[n[i]]=l)}return 0===Object.keys(t).length?null:o?t:e}function i(e){var t=!1,n=[];return e.forEach(function(e){var r=a(e);null!==r&&r===e||(t=!0),null!==r&&n.push(r)}),0==n.length?null:t?n:e}function a(e){return Array.isArray(e)?i(e):o(e)}Object.defineProperty(t,"__esModule",{value:!0});var s="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};t.default=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){this.fns=e||[]}function i(e){if(Object.keys(e.style).map(function(t){return Array.isArray(e.style[t])}).indexOf(!0)>=0){var t=e.style,n=Object.keys(t).reduce(function(e,n){return e[n]=Array.isArray(t[n])?t[n].join("; "+(0,f.processStyleName)(n)+": "):t[n],e},{});return(0,c.default)({},e,{style:n})}return e}function a(e){if(e.style.content){var t=e.style.content;return h.indexOf(t)>=0?e:/^(attr|calc|counters?|url)\(/.test(t)?e:t.charAt(0)!==t.charAt(t.length-1)||'"'!==t.charAt(0)&&"'"!==t.charAt(0)?u({},e,{style:u({},e.style,{content:'"'+t+'"'})}):e}return e}function s(e){return(0,c.default)({},e,{style:(0,p.default)(u({},e.style))})}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 r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.PluginSet=o,t.fallbacks=i,t.contentWrap=a,t.prefixes=s;var l=n(6),c=r(l),f=n(7),d=n(26),p=r(d);(0,c.default)(o.prototype,{add:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];n.forEach(function(t){e.fns.indexOf(t)>=0||(e.fns=[t].concat(e.fns))})},remove:function(e){this.fns=this.fns.filter(function(t){return t!==e})},clear:function(){this.fns=[]},transform:function(e){return this.fns.reduce(function(e,t){return t(e)},e)}});var h=["normal","none","counter","open-quote","close-quote","no-open-quote","no-close-quote","initial","inherit"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){for(var t in e){var n=e[t],r=(0,c.default)(N,t,n,e,M);r&&(e[t]=r),(0,u.default)(M,t,e)}return e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var i=n(27),a=r(i),s=n(28),u=r(s),l=n(29),c=r(l),f=n(30),d=r(f),p=n(31),h=r(p),m=n(32),y=r(m),b=n(33),g=r(b),v=n(34),O=r(v),x=n(35),E=r(x),T=n(36),k=r(T),w=n(37),_=r(w),C=n(38),P=r(C),S=n(39),j=r(S),N=[h.default,d.default,y.default,O.default,E.default,k.default,_.default,P.default,j.default,g.default],M=a.default.prefixMap},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=["Webkit"],o=["Moz"],i=["ms"],a=["Webkit","Moz"],s=["Webkit","ms"],u=["Webkit","Moz","ms"];t.default={plugins:[],prefixMap:{appearance:a,userSelect:u,textEmphasisPosition:r,textEmphasis:r,textEmphasisStyle:r,textEmphasisColor:r,boxDecorationBreak:r,clipPath:r,maskImage:r,maskMode:r,maskRepeat:r,maskPosition:r,maskClip:r,maskOrigin:r,maskSize:r,maskComposite:r,mask:r,maskBorderSource:r,maskBorderMode:r,maskBorderSlice:r,maskBorderWidth:r,maskBorderOutset:r,maskBorderRepeat:r,maskBorder:r,maskType:r,textDecorationStyle:r,textDecorationSkip:r,textDecorationLine:r,textDecorationColor:r,filter:r,fontFeatureSettings:r,breakAfter:u,breakBefore:u,breakInside:u,columnCount:a,columnFill:a,columnGap:a,columnRule:a,columnRuleColor:a,columnRuleStyle:a,columnRuleWidth:a,columns:a,columnSpan:a,columnWidth:a,writingMode:s,flex:r,flexBasis:r,flexDirection:r,flexGrow:r,flexFlow:r,flexShrink:r,flexWrap:r,alignContent:r,alignItems:r,alignSelf:r,justifyContent:r,order:r,transform:r,transformOrigin:r,transformOriginX:r,transformOriginY:r,backfaceVisibility:r,perspective:r,perspectiveOrigin:r,transformStyle:r,transformOriginZ:r,animation:r,animationDelay:r,animationDirection:r,animationFillMode:r,animationDuration:r,animationIterationCount:r,animationName:r,animationPlayState:r,animationTimingFunction:r,backdropFilter:r,fontKerning:r,scrollSnapType:s,scrollSnapPointsX:s,scrollSnapPointsY:s,scrollSnapDestination:s,scrollSnapCoordinate:s,shapeImageThreshold:r,shapeImageMargin:r,shapeImageOutside:r,hyphens:u,flowInto:s,flowFrom:s,regionFragment:s,textAlignLast:o,tabSize:o,wrapFlow:i,wrapThrough:i,wrapMargin:i,gridTemplateColumns:i,gridTemplateRows:i,gridTemplateAreas:i,gridTemplate:i,gridAutoColumns:i,gridAutoRows:i,gridAutoFlow:i,grid:i,gridRowStart:i,gridColumnStart:i,gridRowEnd:i,gridRow:i,gridColumn:i,gridColumnEnd:i,gridColumnGap:i,gridRowGap:i,gridArea:i,gridGap:i,textSizeAdjust:s,borderImage:r,borderImageOutset:r,borderImageRepeat:r,borderImageSlice:r,borderImageSource:r,borderImageWidth:r,transitionDelay:r,transitionDuration:r,transitionProperty:r,transitionTimingFunction:r}},e.exports=t.default},function(e,t,n){"use strict";function r(e,t,n){if(e.hasOwnProperty(t))for(var r=e[t],o=0,a=r.length;o<a;++o)n[r[o]+(0,i.default)(t)]=n[t]}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o=n(9),i=function(e){return e&&e.__esModule?e:{default:e}}(o);e.exports=t.default},function(e,t,n){"use strict";function r(e,t,n,r,o){for(var i=0,a=e.length;i<a;++i){var s=e[i](t,n,r,o);if(s)return s}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t,n){"use strict";function r(e,t){if("cursor"===e&&i.hasOwnProperty(t))return o.map(function(e){return e+t})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o=["-webkit-","-moz-",""],i={"zoom-in":!0,"zoom-out":!0,grab:!0,grabbing:!0};e.exports=t.default},function(e,t,n){"use strict";function r(e,t){if("string"==typeof t&&!(0,i.default)(t)&&t.indexOf("cross-fade(")>-1)return a.map(function(e){return t.replace(/cross-fade\(/g,e+"cross-fade(")})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o=n(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a=["-webkit-",""];e.exports=t.default},function(e,t,n){"use strict";function r(e,t){if("string"==typeof t&&!(0,i.default)(t)&&t.indexOf("filter(")>-1)return a.map(function(e){return t.replace(/filter\(/g,e+"filter(")})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o=n(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a=["-webkit-",""];e.exports=t.default},function(e,t,n){"use strict";function r(e,t){if("display"===e&&o.hasOwnProperty(t))return o[t]}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o={flex:["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex","flex"],"inline-flex":["-webkit-inline-box","-moz-inline-box","-ms-inline-flexbox","-webkit-inline-flex","inline-flex"]};e.exports=t.default},function(e,t,n){"use strict";function r(e,t,n){"flexDirection"===e&&"string"==typeof t&&(t.indexOf("column")>-1?n.WebkitBoxOrient="vertical":n.WebkitBoxOrient="horizontal",t.indexOf("reverse")>-1?n.WebkitBoxDirection="reverse":n.WebkitBoxDirection="normal"),i.hasOwnProperty(e)&&(n[i[e]]=o[t]||t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o={"space-around":"justify","space-between":"justify","flex-start":"start","flex-end":"end","wrap-reverse":"multiple",wrap:"multiple"},i={alignItems:"WebkitBoxAlign",justifyContent:"WebkitBoxPack",flexWrap:"WebkitBoxLines"};e.exports=t.default},function(e,t,n){"use strict";function r(e,t){if("string"==typeof t&&!(0,i.default)(t)&&s.test(t))return a.map(function(e){return e+t})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o=n(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a=["-webkit-","-moz-",""],s=/linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient/;e.exports=t.default},function(e,t,n){"use strict";function r(e,t){if("string"==typeof t&&!(0,i.default)(t)&&t.indexOf("image-set(")>-1)return a.map(function(e){return t.replace(/image-set\(/g,e+"image-set(")})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o=n(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a=["-webkit-",""];e.exports=t.default},function(e,t,n){"use strict";function r(e,t){if("position"===e&&"sticky"===t)return["-webkit-sticky","sticky"]}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t,n){"use strict";function r(e,t){if(i.hasOwnProperty(e)&&a.hasOwnProperty(t))return o.map(function(e){return e+t})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o=["-webkit-","-moz-",""],i={maxHeight:!0,maxWidth:!0,width:!0,height:!0,columnWidth:!0,minWidth:!0,minHeight:!0},a={"min-content":!0,"max-content":!0,"fill-available":!0,"fit-content":!0,"contain-floats":!0};e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if((0,l.default)(e))return e;for(var n=e.split(/,(?![^()]*(?:\([^()]*\))?\))/g),r=0,o=n.length;r<o;++r){var i=n[r],a=[i];for(var u in t){var c=(0,s.default)(u);if(i.indexOf(c)>-1&&"order"!==c)for(var f=t[u],d=0,h=f.length;d<h;++d)a.unshift(i.replace(c,p[f[d]]+c))}n[r]=a.join(",")}return n.join(",")}function i(e,t,n,r){if("string"==typeof t&&d.hasOwnProperty(e)){var i=o(t,r),a=i.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function(e){return!/-moz-|-ms-/.test(e)}).join(",");if(e.indexOf("Webkit")>-1)return a;var s=i.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function(e){return!/-webkit-|-ms-/.test(e)}).join(",");return e.indexOf("Moz")>-1?s:(n["Webkit"+(0,f.default)(e)]=a,n["Moz"+(0,f.default)(e)]=s,i)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var a=n(40),s=r(a),u=n(3),l=r(u),c=n(9),f=r(c),d={transition:!0,transitionProperty:!0,WebkitTransition:!0,WebkitTransitionProperty:!0,MozTransition:!0,MozTransitionProperty:!0},p={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-"};e.exports=t.default},function(e,t,n){"use strict";function r(e){return(0,i.default)(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o=n(41),i=function(e){return e&&e.__esModule?e:{default:e}}(o);e.exports=t.default},function(e,t,n){"use strict";function r(e){return e in a?a[e]:a[e]=e.replace(o,"-$&").toLowerCase().replace(i,"-ms-")}var o=/[A-Z]/g,i=/^ms-/,a={};e.exports=r},function(e,t,n){"use strict";function r(e,t){for(var n=1540483477,r=t^e.length,s=e.length,u=0;s>=4;){var l=o(e,u);l=a(l,n),l^=l>>>24,l=a(l,n),r=a(r,n),r^=l,u+=4,s-=4}switch(s){case 3:r^=i(e,u),r^=e.charCodeAt(u+2)<<16,r=a(r,n);break;case 2:r^=i(e,u),r=a(r,n);break;case 1:r^=e.charCodeAt(u),r=a(r,n)}return r^=r>>>13,r=a(r,n),(r^=r>>>15)>>>0}function o(e,t){return e.charCodeAt(t++)+(e.charCodeAt(t++)<<8)+(e.charCodeAt(t++)<<16)+(e.charCodeAt(t)<<24)}function i(e,t){return e.charCodeAt(t++)+(e.charCodeAt(t++)<<8)}function a(e,t){return e|=0,t|=0,(65535&e)*t+(((e>>>16)*t&65535)<<16)|0}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(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)}t.__esModule=!0;var u=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(1),c=r(l),f=n(0),d=r(f),p=n(44),h=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},m=(c.default.any,c.default.node,c.default.bool,c.default.bool,c.default.bool,c.default.func,{component:"div",childFactory:function(e){return e}}),y=function(e){function t(n,r){i(this,t);var o=a(this,e.call(this,n,r));return o.handleExited=function(e,t,n){var r=(0,p.getChildMapping)(o.props.children);e in r||(n&&n(t),o.setState(function(t){var n=u({},t.children);return delete n[e],{children:n}}))},o.state={children:(0,p.getChildMapping)(n.children,function(e){var t=function(t){o.handleExited(e.key,t,e.props.onExited)};return(0,f.cloneElement)(e,{onExited:t,in:!0,appear:o.getProp(e,"appear"),enter:o.getProp(e,"enter"),exit:o.getProp(e,"exit")})})},o}return s(t,e),t.prototype.getChildContext=function(){return{transitionGroup:{isMounting:!this.appeared}}},t.prototype.getProp=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.props;return null!=n[t]?n[t]:e.props[t]},t.prototype.componentDidMount=function(){this.appeared=!0},t.prototype.componentWillReceiveProps=function(e){var t=this,n=this.state.children,r=(0,p.getChildMapping)(e.children),o=(0,p.mergeChildMappings)(n,r);Object.keys(o).forEach(function(i){var a=o[i];if((0,f.isValidElement)(a)){var s=function(e){t.handleExited(a.key,e,a.props.onExited)},u=i in n,l=i in r,c=n[i],d=(0,f.isValidElement)(c)&&!c.props.in;!l||u&&!d?l||!u||d?l&&u&&(0,f.isValidElement)(c)&&(o[i]=(0,f.cloneElement)(a,{onExited:s,in:c.props.in,exit:t.getProp(a,"exit",e),enter:t.getProp(a,"enter",e)})):o[i]=(0,f.cloneElement)(a,{in:!1}):o[i]=(0,f.cloneElement)(a,{onExited:s,in:!0,exit:t.getProp(a,"exit",e),enter:t.getProp(a,"enter",e)})}}),this.setState({children:o})},t.prototype.render=function(){var e=this.props,t=e.component,n=e.childFactory,r=o(e,["component","childFactory"]),i=this.state.children;return delete r.appear,delete r.enter,delete r.exit,d.default.createElement(t,r,h(i).map(n))},t}(d.default.Component);y.childContextTypes={transitionGroup:c.default.object.isRequired},y.propTypes={},y.defaultProps=m,t.default=y,e.exports=t.default},function(e,t,n){"use strict";function r(e,t){var n=function(e){return t&&(0,i.isValidElement)(e)?t(e):e},r=Object.create(null);return e&&i.Children.map(e,function(e){return e}).forEach(function(e){r[e.key]=n(e)}),r}function o(e,t){function n(n){return n in t?t[n]:e[n]}e=e||{},t=t||{};var r=Object.create(null),o=[];for(var i in e)i in t?o.length&&(r[i]=o,o=[]):o.push(i);var a=void 0,s={};for(var u in t){if(r[u])for(a=0;a<r[u].length;a++){var l=r[u][a];s[r[u][a]]=n(l)}s[u]=n(u)}for(a=0;a<o.length;a++)s[o[a]]=n(o[a]);return s}t.__esModule=!0,t.getChildMapping=r,t.mergeChildMappings=o;var i=n(0)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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)}function s(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 u=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}}(),l=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},c=n(0),f=r(c),d=n(1),p=r(d),h=n(2),m=n(46),y=r(m),b=n(4),g=n(5),v=r(g),O=n(10),x=r(O),E=n(11),T=function(e){return(0,h.css)(l({position:"relative",minHeight:"48px",marginBottom:"1rem",padding:"8px",borderRadius:"1px",boxShadow:"0 1px 10px 0 rgba(0, 0, 0, .1), 0 2px 15px 0 rgba(0, 0, 0, .05)",display:"flex",justifyContent:"space-between",maxHeight:"800px",overflow:"hidden",fontFamily:"sans-serif",cursor:"pointer",background:v.default["color"+e.charAt(0).toUpperCase()+e.slice(1)]},"default"===e?{color:"#aaa"}:{},s({},"@media "+v.default.mobile,{marginBottom:0})))},k=(0,h.css)({margin:"auto 0",flex:1}),w=function(e){function t(){var e,n,r,a;o(this,t);for(var s=arguments.length,u=Array(s),l=0;l<s;l++)u[l]=arguments[l];return n=r=i(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),r.state={isRunning:!0},r.handleVisibility=function(){return r.setState({isRunning:!document.hidden})},r.pauseToast=function(){r.setState({isRunning:!1})},r.playToast=function(){r.setState({isRunning:!0})},a=n,i(r,a)}return a(t,e),u(t,[{key:"componentDidMount",value:function(){null!==this.props.onOpen&&this.props.onOpen(this.getChildrenProps()),document.addEventListener("visibilitychange",this.handleVisibility)}},{key:"componentWillUnmount",value:function(){null!==this.props.onClose&&this.props.onClose(this.getChildrenProps()),document.removeEventListener("visibilitychange",this.handleVisibility)}},{key:"getChildrenProps",value:function(){return this.props.children.props}},{key:"getToastProps",value:function(){var e={};return!1!==this.props.autoClose&&!0===this.props.pauseOnHover&&(e.onMouseEnter=this.pauseToast,e.onMouseLeave=this.playToast),this.props.closeOnClick&&(e.onClick=this.props.closeToast),e}},{key:"render",value:function(){var e=this.props,t=e.closeButton,n=e.children,r=e.autoClose,o=e.type,i=e.hideProgressBar,a=e.closeToast,s=e.transition,u=e.position,c=e.onExited,d=e.className,p=e.bodyClassName,h=e.progressClassName;return f.default.createElement(s,{in:this.props.in,appear:!0,unmountOnExit:!0,onExited:c,position:u},f.default.createElement("div",l({},T(o),this.getToastProps(),{className:d}),f.default.createElement("div",l({},k,{className:p}),n),!1!==t&&t,!1!==r&&f.default.createElement(y.default,{delay:r,isRunning:this.state.isRunning,closeToast:a,hide:i,type:o,className:h})))}}]),t}(c.Component);w.propTypes={closeButton:E.falseOrElement.isRequired,autoClose:E.falseOrNumber.isRequired,children:p.default.node.isRequired,closeToast:p.default.func.isRequired,position:p.default.oneOf((0,x.default)(b.POSITION)).isRequired,pauseOnHover:p.default.bool.isRequired,closeOnClick:p.default.bool.isRequired,transition:p.default.func.isRequired,in:p.default.bool,onExited:p.default.func,hideProgressBar:p.default.bool,onOpen:p.default.func,onClose:p.default.func,type:p.default.oneOf((0,x.default)(b.TYPE)),className:p.default.oneOfType([p.default.string,p.default.object]),bodyClassName:p.default.oneOfType([p.default.string,p.default.object]),progressClassName:p.default.oneOfType([p.default.string,p.default.object])},w.defaultProps={type:b.TYPE.DEFAULT,in:!0,hideProgressBar:!1,onOpen:null,onClose:null,className:"",bodyClassName:"",progressClassName:""},t.default=w},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.delay,n=e.isRunning,r=e.closeToast,o=e.type,a=e.hide,u=e.className,l={animationDuration:t+"ms",animationPlayState:n?"running":"paused"};return l.WebkitAnimationPlayState=l.animationPlayState,a&&(l.opacity=0),s.default.createElement("div",i({},m(o),{className:u,style:l,onAnimationEnd:r}))}Object.defineProperty(t,"__esModule",{value:!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},a=n(0),s=r(a),u=n(1),l=r(u),c=n(2),f=n(4),d=n(5),p=r(d),h=c.css.keyframes("track-progress",{"0%":{width:"100%"},"100%":{width:0}}),m=function(e){return(0,c.css)(i({position:"absolute",bottom:0,left:0,width:0,height:"5px",zIndex:999,opacity:.7,animation:h+" linear 1",backgroundColor:"rgba(255,255,255,.7)"},"default"===e?{background:p.default.colorProgressDefault}:{}))};o.propTypes={delay:l.default.number.isRequired,isRunning:l.default.bool.isRequired,closeToast:l.default.func.isRequired,type:l.default.string,hide:l.default.bool,className:l.default.oneOfType([l.default.string,l.default.object])},o.defaultProps={type:f.TYPE.DEFAULT,hide:!1,className:""},t.default=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.closeToast,n=e.type;return s.default.createElement("button",i({},f("default"===n),{type:"button",onClick:t}),"✖")}Object.defineProperty(t,"__esModule",{value:!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},a=n(0),s=r(a),u=n(1),l=r(u),c=n(2),f=function(e){return(0,c.css)({padding:0,color:e?"#000":"#fff",fontWeight:"bold",fontSize:"14px",background:"transparent",outline:"none",border:"none",cursor:"pointer",opacity:e?"0.3":"0.7",transition:".3s ease",alignSelf:"flex-start",":hover, :focus":{opacity:1}})};o.propTypes={closeToast:l.default.func},t.default=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e){var t=e.children,n=e.position,r=o(e,["children","position"]),i=m(n),s=i.enter,l=i.exit;return u.default.createElement(c.default,a({},r,{timeout:750,onEnter:function(e){e.classList.add(s)},onExit:function(e){e.classList.remove(s),e.classList.add(l)}}),t)}Object.defineProperty(t,"__esModule",{value:!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},s=n(0),u=r(s),l=n(49),c=r(l),f=n(2),d=n(52),p=r(d),h={animationDuration:"0.75s",animationFillMode:"both"},m=function(e){var t=(0,p.default)(e),n=t.enter,r=t.exit,o=f.css.keyframes("enter",a({"from, 60%, 75%, 90%, to":{animationTimingFunction:"cubic-bezier(0.215, 0.610, 0.355, 1.000)"}},n)),i=f.css.keyframes("exit",r);return{enter:(0,f.css)(a({},h,{animationName:o})),exit:(0,f.css)(a({},h,{animationName:i}))}};t.default=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(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)}function u(){}t.__esModule=!0,t.EXITING=t.ENTERED=t.ENTERING=t.EXITED=t.UNMOUNTED=void 0;var l=n(1),c=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(l),f=n(0),d=r(f),p=n(50),h=r(p),m=(n(51),t.UNMOUNTED="unmounted"),y=t.EXITED="exited",b=t.ENTERING="entering",g=t.ENTERED="entered",v=t.EXITING="exiting",O=function(e){function t(n,r){i(this,t);var o=a(this,e.call(this,n,r)),s=r.transitionGroup,u=s&&!s.isMounting?n.enter:n.appear,l=void 0;return o.nextStatus=null,n.in?u?(l=y,o.nextStatus=b):l=g:l=n.unmountOnExit||n.mountOnEnter?m:y,o.state={status:l},o.nextCallback=null,o}return s(t,e),t.prototype.getChildContext=function(){return{transitionGroup:null}},t.prototype.componentDidMount=function(){this.updateStatus(!0)},t.prototype.componentWillReceiveProps=function(e){var t=this.pendingState||this.state,n=t.status;e.in?(n===m&&this.setState({status:y}),n!==b&&n!==g&&(this.nextStatus=b)):n!==b&&n!==g||(this.nextStatus=v)},t.prototype.componentDidUpdate=function(){this.updateStatus()},t.prototype.componentWillUnmount=function(){this.cancelNextCallback()},t.prototype.getTimeouts=function(){var e=this.props.timeout,t=void 0,n=void 0,r=void 0;return t=n=r=e,null!=e&&"number"!=typeof e&&(t=e.exit,n=e.enter,r=e.appear),{exit:t,enter:n,appear:r}},t.prototype.updateStatus=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.nextStatus;if(null!==t){this.nextStatus=null,this.cancelNextCallback();var n=h.default.findDOMNode(this);t===b?this.performEnter(n,e):this.performExit(n)}else this.props.unmountOnExit&&this.state.status===y&&this.setState({status:m})},t.prototype.performEnter=function(e,t){var n=this,r=this.props.enter,o=this.context.transitionGroup?this.context.transitionGroup.isMounting:t,i=this.getTimeouts();if(!t&&!r)return void this.safeSetState({status:g},function(){n.props.onEntered(e)});this.props.onEnter(e,o),this.safeSetState({status:b},function(){n.props.onEntering(e,o),n.onTransitionEnd(e,i.enter,function(){n.safeSetState({status:g},function(){n.props.onEntered(e,o)})})})},t.prototype.performExit=function(e){var t=this,n=this.props.exit,r=this.getTimeouts();if(!n)return void this.safeSetState({status:y},function(){t.props.onExited(e)});this.props.onExit(e),this.safeSetState({status:v},function(){t.props.onExiting(e),t.onTransitionEnd(e,r.exit,function(){t.safeSetState({status:y},function(){t.props.onExited(e)})})})},t.prototype.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},t.prototype.safeSetState=function(e,t){var n=this;this.pendingState=e,t=this.setNextCallback(t),this.setState(e,function(){n.pendingState=null,t()})},t.prototype.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},t.prototype.onTransitionEnd=function(e,t,n){this.setNextCallback(n),e?(this.props.addEndListener&&this.props.addEndListener(e,this.nextCallback),null!=t&&setTimeout(this.nextCallback,t)):setTimeout(this.nextCallback,0)},t.prototype.render=function(){var e=this.state.status;if(e===m)return null;var t=this.props,n=t.children,r=o(t,["children"]);if(delete r.in,delete r.mountOnEnter,delete r.unmountOnExit,delete r.appear,delete r.enter,delete r.exit,delete r.timeout,delete r.addEndListener,delete r.onEnter,delete r.onEntering,delete r.onEntered,delete r.onExit,delete r.onExiting,delete r.onExited,"function"==typeof n)return n(e,r);var i=d.default.Children.only(n);return d.default.cloneElement(i,r)},t}(d.default.Component);O.contextTypes={transitionGroup:c.object},O.childContextTypes={transitionGroup:function(){}},O.propTypes={},O.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:u,onEntering:u,onEntered:u,onExit:u,onExiting:u,onExited:u},O.UNMOUNTED=0,O.EXITED=1,O.ENTERING=2,O.ENTERED=3,O.EXITING=4,t.default=O},function(e,t){e.exports=n},function(e,t,n){"use strict";function r(e){var t="transition"+e+"Timeout",n="transition"+e;return function(e){if(e[n]){if(null==e[t])return new Error(t+" wasn't supplied to CSSTransitionGroup: this can cause unreliable animations and won't be supported in a future version of React. See https://fb.me/react-animation-transition-group-timeout for more information.");if("number"!=typeof e[t])return new Error(t+" must be a number (in milliseconds)")}return null}}t.__esModule=!0,t.classNamesShape=t.timeoutsShape=void 0,t.transitionTimeout=r;var o=n(1),i=function(e){return e&&e.__esModule?e:{default:e}}(o);t.timeoutsShape=i.default.oneOfType([i.default.number,i.default.shape({enter:i.default.number,exit:i.default.number}).isRequired]),t.classNamesShape=i.default.oneOfType([i.default.string,i.default.shape({enter:i.default.string,exit:i.default.string,active:i.default.string}),i.default.shape({enter:i.default.string,enterActive:i.default.string,exit:i.default.string,exitActive:i.default.string})])},function(e,t,n){"use strict";function r(e){switch(e){case o.POSITION.TOP_RIGHT:case o.POSITION.BOTTOM_RIGHT:default:return{enter:{from:{opacity:0,transform:"translate3d(3000px, 0, 0)"},"60%":{opacity:1,transform:"translate3d(-25px, 0, 0)"},"75%":{transform:"translate3d(10px, 0, 0)"},"90%":{transform:"translate3d(-5px, 0, 0)"},to:{transform:"none"}},exit:{"20%":{opacity:1,transform:"translate3d(-20px, 0, 0)"},to:{opacity:0,transform:"translate3d(2000px, 0, 0)"}}};case o.POSITION.TOP_LEFT:case o.POSITION.BOTTOM_LEFT:return{enter:{"0%":{opacity:0,transform:"translate3d(-3000px, 0, 0)"},"60%":{opacity:1,transform:"translate3d(25px, 0, 0)"},"75%":{transform:"translate3d(-10px, 0, 0)"},"90%":{transform:"translate3d(5px, 0, 0)"},to:{transform:"none"}},exit:{"20%":{opacity:1,transform:"translate3d(20px, 0, 0)"},to:{opacity:0,transform:"translate3d(-2000px, 0, 0)"}}};case o.POSITION.BOTTOM_CENTER:return{enter:{from:{opacity:0,transform:"translate3d(0, 3000px, 0)"},"60%":{opacity:1,transform:"translate3d(0, -20px, 0)"},"75%":{transform:"translate3d(0, 10px, 0)"},"90%":{transform:"translate3d(0, -5px, 0)"},to:{transform:"translate3d(0, 0, 0)"}},exit:{"20%":{transform:"translate3d(0, 10px, 0)"},"40%, 45%":{opacity:1,transform:"translate3d(0, -20px, 0)"},to:{opacity:0,transform:"translate3d(0, 2000px, 0)"}}};case o.POSITION.TOP_CENTER:return{enter:{"0%":{opacity:0,transform:"translate3d(0, -3000px, 0)"},"60%":{opacity:1,transform:"translate3d(0, 25px, 0)"},"75%":{transform:"translate3d(0, -10px, 0)"},"90%":{transform:"translate3d(0, 5px, 0)"},to:{transform:"none"}},exit:{"20%":{transform:"translate3d(0, -10px, 0)"},"40%, 45%":{opacity:1,transform:"translate3d(0, 20px, 0)"},to:{opacity:0,transform:"translate3d(0, -2000px, 0)"}}}}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o=n(4)},function(e,t,n){"use strict";function r(e){return i({},l,e,{toastId:++d})}function o(e,t){return null!==c?s.default.emit(u.ACTION.SHOW,e,t):f.push({action:u.ACTION.SHOW,content:e,options:t}),t.toastId}Object.defineProperty(t,"__esModule",{value:!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},a=n(12),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=n(4),l={type:u.TYPE.DEFAULT,autoClose:null,closeButton:null,hideProgressBar:null,position:null,pauseOnHover:null,closeOnClick:null,className:null,bodyClassName:null,progressClassName:null,transition:null},c=null,f=[],d=0,p=i(function(e,t){return o(e,r(t))},{success:function(e,t){return o(e,i(r(t),{type:u.TYPE.SUCCESS}))},info:function(e,t){return o(e,i(r(t),{type:u.TYPE.INFO}))},warn:function(e,t){return o(e,i(r(t),{type:u.TYPE.WARNING}))},warning:function(e,t){return o(e,i(r(t),{type:u.TYPE.WARNING}))},error:function(e,t){return o(e,i(r(t),{type:u.TYPE.ERROR}))},dismiss:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return c&&s.default.emit(u.ACTION.CLEAR,e)},isActive:function(){return!1}},{POSITION:u.POSITION,TYPE:u.TYPE});s.default.on(u.ACTION.MOUNTED,function(e){c=e,p.isActive=function(e){return c.isToastActive(e)},f.forEach(function(e){s.default.emit(e.action,e.content,e.options)}),f=[]}),t.default=p}])}); | ||
//# sourceMappingURL=ReactToastify.min.js.map |
import * as React from "react"; | ||
import Transition from "react-transition-group/Transition"; | ||
import Transition from "react-transition-group/Transition"; | ||
export let toast: Toast; | ||
type ToastType = "info" | "success" | "warning" | "error" | "default"; | ||
type styleProps = { | ||
width?: string, | ||
colorDefault?: string, | ||
colorInfo?: string, | ||
colorSuccess?: string, | ||
colorWarning?: string, | ||
colorError?: string, | ||
colorProgressDefault?: string, | ||
mobile?: string, | ||
} | ||
interface Toast { | ||
@@ -22,5 +35,5 @@ success(content: React.ReactNode, options?: ToastOptions): number; | ||
closeButton?: React.ReactNode | false; | ||
progressClassName?: string; | ||
className?: string; | ||
bodyClassName?: string; | ||
progressClassName?: string | object; | ||
className?: string | object; | ||
bodyClassName?: string | object; | ||
hideProgressBar?: boolean; | ||
@@ -33,2 +46,3 @@ transition?: Transition; | ||
onClose?: () => void; | ||
type?: ToastType; | ||
} | ||
@@ -39,5 +53,7 @@ | ||
style?: object; | ||
toastClassName?: string; | ||
toastClassName?: string | object; | ||
} | ||
export class ToastContainer extends React.Component<ToastContainerProps> {} | ||
export function style(props: styleProps): void; |
@@ -7,2 +7,5 @@ 'use strict'; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /* eslint react/require-default-props: 0 */ | ||
var _react = require('react'); | ||
@@ -16,15 +19,35 @@ | ||
var _glamor = require('glamor'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/* eslint react/require-default-props: 0 */ | ||
var rule = function rule(isDefault) { | ||
return (0, _glamor.css)({ | ||
padding: 0, | ||
color: isDefault ? "#000" : "#fff", | ||
fontWeight: "bold", | ||
fontSize: "14px", | ||
background: "transparent", | ||
outline: "none", | ||
border: "none", | ||
cursor: "pointer", | ||
opacity: isDefault ? "0.3" : "0.7", | ||
transition: ".3s ease", | ||
alignSelf: "flex-start", | ||
":hover, :focus": { | ||
opacity: 1 | ||
} | ||
}); | ||
}; | ||
function DefaultCloseButton(_ref) { | ||
var closeToast = _ref.closeToast; | ||
var closeToast = _ref.closeToast, | ||
type = _ref.type; | ||
return _react2.default.createElement( | ||
'button', | ||
{ | ||
className: 'toastify__close', | ||
_extends({}, rule(type === "default"), { | ||
type: 'button', | ||
onClick: closeToast | ||
}, | ||
}), | ||
'\u2716' | ||
@@ -31,0 +54,0 @@ ); |
@@ -17,2 +17,8 @@ "use strict"; | ||
var _glamor = require("glamor"); | ||
var _animation2 = require("./animation"); | ||
var _animation3 = _interopRequireDefault(_animation2); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -22,2 +28,25 @@ | ||
var animate = { | ||
animationDuration: "0.75s", | ||
animationFillMode: "both" | ||
}; | ||
var animation = function animation(pos) { | ||
var _getAnimation = (0, _animation3.default)(pos), | ||
enter = _getAnimation.enter, | ||
exit = _getAnimation.exit; | ||
var enterAnimation = _glamor.css.keyframes('enter', _extends({ | ||
"from, 60%, 75%, 90%, to": { | ||
animationTimingFunction: "cubic-bezier(0.215, 0.610, 0.355, 1.000)" | ||
} | ||
}, enter)); | ||
var exitAnimation = _glamor.css.keyframes('exit', exit); | ||
return { | ||
enter: (0, _glamor.css)(_extends({}, animate, { animationName: enterAnimation })), | ||
exit: (0, _glamor.css)(_extends({}, animate, { animationName: exitAnimation })) | ||
}; | ||
}; | ||
function DefaultTransition(_ref) { | ||
@@ -28,2 +57,6 @@ var children = _ref.children, | ||
var _animation = animation(position), | ||
enter = _animation.enter, | ||
exit = _animation.exit; | ||
return _react2.default.createElement( | ||
@@ -34,10 +67,7 @@ _Transition2.default, | ||
onEnter: function onEnter(node) { | ||
node.classList.add("toast-enter--" + position); | ||
node.classList.add("toastify-animated"); | ||
node.classList.add(enter); | ||
}, | ||
onExit: function onExit(node) { | ||
node.classList.remove("toast-enter--" + position); | ||
node.classList.remove("toastify-animated"); | ||
node.classList.add("toast-exit--" + position); | ||
node.classList.add("toastify-animated"); | ||
node.classList.remove(enter); | ||
node.classList.add(exit); | ||
} | ||
@@ -44,0 +74,0 @@ }), |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.toast = exports.ToastContainer = undefined; | ||
exports.style = exports.toast = exports.ToastContainer = undefined; | ||
@@ -17,5 +17,8 @@ var _ToastContainer = require('./ToastContainer'); | ||
var _style = require('./style'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.ToastContainer = _ToastContainer2.default; | ||
exports.toast = _toaster2.default; | ||
exports.toast = _toaster2.default; | ||
exports.style = _style.defineStyle; |
@@ -7,2 +7,4 @@ 'use strict'; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _react = require('react'); | ||
@@ -16,6 +18,31 @@ | ||
var _glamor = require('glamor'); | ||
var _constant = require('./constant'); | ||
var _style = require('./style'); | ||
var _style2 = _interopRequireDefault(_style); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var trackProgress = _glamor.css.keyframes('track-progress', { | ||
"0%": { width: "100%" }, | ||
"100%": { width: 0 } | ||
}); | ||
var progress = function progress(type) { | ||
return (0, _glamor.css)(_extends({ | ||
position: "absolute", | ||
bottom: 0, | ||
left: 0, | ||
width: 0, | ||
height: "5px", | ||
zIndex: 999, | ||
opacity: 0.7, | ||
animation: trackProgress + ' linear 1', | ||
backgroundColor: "rgba(255,255,255,.7)" | ||
}, type === "default" ? { background: _style2.default.colorProgressDefault } : {})); | ||
}; | ||
function ProgressBar(_ref) { | ||
@@ -39,7 +66,7 @@ var delay = _ref.delay, | ||
return _react2.default.createElement('div', { | ||
className: 'toastify__progress toastify__progress--' + type + ' ' + className, | ||
return _react2.default.createElement('div', _extends({}, progress(type), { | ||
className: className, | ||
style: style, | ||
onAnimationEnd: closeToast | ||
}); | ||
})); | ||
} | ||
@@ -76,3 +103,3 @@ | ||
*/ | ||
className: _propTypes2.default.string | ||
className: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]) | ||
}; | ||
@@ -79,0 +106,0 @@ |
@@ -9,2 +9,4 @@ "use strict"; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _react = require("react"); | ||
@@ -18,2 +20,4 @@ | ||
var _glamor = require("glamor"); | ||
var _ProgressBar = require("./ProgressBar"); | ||
@@ -25,2 +29,6 @@ | ||
var _style = require("./style"); | ||
var _style2 = _interopRequireDefault(_style); | ||
var _objectValues = require("./util/objectValues"); | ||
@@ -40,2 +48,29 @@ | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var toast = function toast(type) { | ||
return (0, _glamor.css)(_extends({ | ||
position: "relative", | ||
minHeight: "48px", | ||
marginBottom: "1rem", | ||
padding: "8px", | ||
borderRadius: "1px", | ||
boxShadow: "0 1px 10px 0 rgba(0, 0, 0, .1), 0 2px 15px 0 rgba(0, 0, 0, .05)", | ||
display: "flex", | ||
justifyContent: "space-between", | ||
maxHeight: "800px", | ||
overflow: "hidden", | ||
fontFamily: "sans-serif", | ||
cursor: "pointer", | ||
background: _style2.default["color" + type.charAt(0).toUpperCase() + type.slice(1)] | ||
}, type === "default" ? { color: "#aaa" } : {}, _defineProperty({}, "@media " + _style2.default.mobile, { | ||
marginBottom: 0 | ||
}))); | ||
}; | ||
var body = (0, _glamor.css)({ | ||
margin: "auto 0", | ||
flex: 1 | ||
}); | ||
var Toast = function (_Component) { | ||
@@ -86,5 +121,3 @@ _inherits(Toast, _Component); | ||
value: function getToastProps() { | ||
var toastProps = { | ||
className: "toastify-content toastify-content--" + this.props.type + " " + this.props.className | ||
}; | ||
var toastProps = {}; | ||
@@ -110,9 +143,10 @@ if (this.props.autoClose !== false && this.props.pauseOnHover === true) { | ||
closeToast = _props.closeToast, | ||
transition = _props.transition, | ||
Transition = _props.transition, | ||
position = _props.position, | ||
onExited = _props.onExited; | ||
onExited = _props.onExited, | ||
className = _props.className, | ||
bodyClassName = _props.bodyClassName, | ||
progressClassName = _props.progressClassName; | ||
var Transition = transition; | ||
return _react2.default.createElement( | ||
@@ -123,6 +157,6 @@ Transition, | ||
"div", | ||
this.getToastProps(), | ||
_extends({}, toast(type), this.getToastProps(), { className: className }), | ||
_react2.default.createElement( | ||
"div", | ||
{ className: "toastify__body " + this.props.bodyClassName }, | ||
_extends({}, body, { className: bodyClassName }), | ||
children | ||
@@ -137,3 +171,3 @@ ), | ||
type: type, | ||
className: this.props.progressClassName | ||
className: progressClassName | ||
}) | ||
@@ -163,5 +197,5 @@ ) | ||
type: _propTypes2.default.oneOf((0, _objectValues2.default)(_constant.TYPE)), | ||
className: _propTypes2.default.string, | ||
bodyClassName: _propTypes2.default.string, | ||
progressClassName: _propTypes2.default.string | ||
className: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]), | ||
bodyClassName: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]), | ||
progressClassName: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]) | ||
}; | ||
@@ -168,0 +202,0 @@ Toast.defaultProps = { |
@@ -9,6 +9,6 @@ "use strict"; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _react = require("react"); | ||
@@ -22,2 +22,4 @@ | ||
var _glamor = require("glamor"); | ||
var _TransitionGroup = require("react-transition-group/TransitionGroup"); | ||
@@ -41,2 +43,6 @@ | ||
var _style = require("./style"); | ||
var _style2 = _interopRequireDefault(_style); | ||
var _EventManager = require("./util/EventManager"); | ||
@@ -56,4 +62,2 @@ | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -65,2 +69,68 @@ | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var container = function container() { | ||
return (0, _glamor.css)(_defineProperty({ | ||
zIndex: 999, | ||
position: "fixed", | ||
padding: "4px", | ||
width: _style2.default.width, | ||
boxSizing: "border-box", | ||
color: "#fff" | ||
}, "@media " + _style2.default.mobile, { | ||
width: "100vw", | ||
padding: 0 | ||
})); | ||
}; | ||
var toastPosition = function toastPosition(pos) { | ||
var rule = void 0; | ||
var marginLeft = "-" + parseInt(_style2.default.width, 10) / 2 + "px"; | ||
switch (pos) { | ||
case _constant.POSITION.TOP_LEFT: | ||
rule = { | ||
top: "1em", | ||
left: "1em" | ||
}; | ||
break; | ||
case _constant.POSITION.TOP_CENTER: | ||
rule = { | ||
top: "1em", | ||
left: "50%", | ||
marginLeft: marginLeft | ||
}; | ||
break; | ||
case _constant.POSITION.TOP_RIGHT: | ||
default: | ||
rule = { | ||
top: "1em", | ||
right: "1em" | ||
}; | ||
break; | ||
case _constant.POSITION.BOTTOM_LEFT: | ||
rule = { | ||
bottom: "1em", | ||
left: "1em" | ||
}; | ||
break; | ||
case _constant.POSITION.BOTTOM_CENTER: | ||
rule = { | ||
bottom: "1em", | ||
left: "50%", | ||
marginLeft: marginLeft | ||
}; | ||
break; | ||
case _constant.POSITION.BOTTOM_RIGHT: | ||
rule = { | ||
bottom: "1em", | ||
right: "1em" | ||
}; | ||
} | ||
return (0, _glamor.css)(rule, (0, _glamor.css)(_defineProperty({}, "@media " + _style2.default.mobile, _extends({ | ||
left: 0, | ||
margin: 0, | ||
position: "fixed" | ||
}, pos.substring(0, 3) === "top" ? { top: 0 } : { bottom: 0 })))); | ||
}; | ||
var ToastContainer = function (_Component) { | ||
@@ -124,3 +194,3 @@ _inherits(ToastContainer, _Component); | ||
key: "makeCloseButton", | ||
value: function makeCloseButton(toastClose, toastId) { | ||
value: function makeCloseButton(toastClose, toastId, type) { | ||
var _this3 = this; | ||
@@ -137,3 +207,4 @@ | ||
return _this3.removeToast(toastId); | ||
} | ||
}, | ||
type: type | ||
}); | ||
@@ -171,3 +242,3 @@ } | ||
type: options.type, | ||
closeButton: this.makeCloseButton(options.closeButton, toastId), | ||
closeButton: this.makeCloseButton(options.closeButton, toastId, options.type), | ||
position: options.position || this.props.position, | ||
@@ -222,11 +293,5 @@ transition: options.transition || this.props.transition, | ||
}, { | ||
key: "hasToast", | ||
value: function hasToast() { | ||
return this.state.toast.length > 0; | ||
} | ||
}, { | ||
key: "getContainerProps", | ||
value: function getContainerProps(pos, disablePointer) { | ||
value: function getContainerProps(disablePointer) { | ||
var props = { | ||
className: "toastify toastify--" + pos, | ||
style: disablePointer ? { pointerEvents: "none" } : {} | ||
@@ -236,3 +301,3 @@ }; | ||
if (this.props.className !== null) { | ||
props.className = props.className + " " + this.props.className; | ||
props.className = this.props.className; | ||
} | ||
@@ -271,3 +336,3 @@ | ||
_TransitionGroup2.default, | ||
_extends({}, _this5.getContainerProps(position, disablePointer), { | ||
_extends({}, container(), toastPosition(position), _this5.getContainerProps(disablePointer), { | ||
key: "container-" + position | ||
@@ -332,3 +397,3 @@ }), | ||
*/ | ||
className: _propTypes2.default.string, | ||
className: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]), | ||
@@ -343,3 +408,3 @@ /** | ||
*/ | ||
toastClassName: _propTypes2.default.string, | ||
toastClassName: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]), | ||
@@ -349,3 +414,3 @@ /** | ||
*/ | ||
bodyClassName: _propTypes2.default.string, | ||
bodyClassName: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]), | ||
@@ -355,3 +420,3 @@ /** | ||
*/ | ||
progressClassName: _propTypes2.default.string, | ||
progressClassName: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]), | ||
@@ -358,0 +423,0 @@ /** |
@@ -34,3 +34,3 @@ 'use strict'; | ||
progressClassName: null, | ||
tansition: null | ||
transition: null | ||
}; | ||
@@ -85,3 +85,3 @@ | ||
var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; | ||
return _EventManager2.default.emit(_constant.ACTION.CLEAR, id); | ||
return container && _EventManager2.default.emit(_constant.ACTION.CLEAR, id); | ||
}, | ||
@@ -88,0 +88,0 @@ isActive: function isActive() { |
{ | ||
"name": "react-toastify", | ||
"version": "2.2.1", | ||
"version": "3.0.0-beta-1", | ||
"description": "React notification made easy", | ||
@@ -22,6 +22,3 @@ "keywords": [ | ||
"prebuild": "npm run test", | ||
"build": "NODE_ENV=production ./scripts/build.sh", | ||
"postbuild": "npm run style", | ||
"prestyle": "sass src/scss/main.scss dist/ReactToastify.css", | ||
"style": "postcss --use autoprefixer -b 'last 2 versions' < dist/ReactToastify.css | cssnano --no-zindex --no-reduceIdents > dist/ReactToastify.min.css" | ||
"build": "NODE_ENV=production ./scripts/build.sh" | ||
}, | ||
@@ -39,2 +36,3 @@ "repository": { | ||
"dependencies": { | ||
"glamor": "^2.20.40", | ||
"prop-types": "^15.6.0", | ||
@@ -53,3 +51,2 @@ "react-transition-group": "^2.2.1" | ||
"@types/react-transition-group": "^2.0.6", | ||
"autoprefixer": "^7.1.4", | ||
"babel-cli": "^6.26.0", | ||
@@ -63,4 +60,2 @@ "babel-eslint": "^8.0.1", | ||
"coveralls": "^3.0.0", | ||
"cssnano": "^3.10.0", | ||
"cssnano-cli": "^1.0.5", | ||
"enzyme": "^3.0.0", | ||
@@ -76,4 +71,2 @@ "enzyme-adapter-react-16": "^1.0.0", | ||
"jest-cli": "^21.2.1", | ||
"postcss": "^5.2.5", | ||
"postcss-cli": "^3.2.0", | ||
"raf": "^3.3.2", | ||
@@ -80,0 +73,0 @@ "react": "^16.0.0", |
257
README.md
@@ -16,2 +16,3 @@ # React Toastify [![Build Status](https://travis-ci.org/fkhadra/react-toastify.svg?branch=master)](https://travis-ci.org/fkhadra/react-toastify) [![npm](https://img.shields.io/npm/dm/react-toastify.svg)]() [![npm](https://img.shields.io/npm/v/react-toastify.svg)]() [![license](https://img.shields.io/github/license/fkhadra/react-toastify.svg?maxAge=2592000)]() [![Coverage Status](https://coveralls.io/repos/github/fkhadra/react-toastify/badge.svg?branch=master)](https://coveralls.io/github/fkhadra/react-toastify?branch=master) | ||
* [Features](#features) | ||
* [Migrate from v2 to v3](#migrate-from-v2-to-v3) | ||
* [Usage](#usage) | ||
@@ -23,6 +24,8 @@ * [Simple](#simple) | ||
* [Define hook](#define-hook) | ||
* [Add an undo option to a toast](#add-an-undo-option-to-a-toast) | ||
* [Set a custom close button or simply remove it](#set-a-custom-close-button-or-simply-remove-it) | ||
* [ :fire: Define a custom enter and exit transition :fire: ](#define-a-custom-enter-and-exit-transition) | ||
* [Define your style](#define-your-style) | ||
* [Replace default sass variable](#replace-default-sass-variable) | ||
* [Replace global style](#replace-global-style) | ||
* [Style with className](#style-with-classname) | ||
* [Mobile](#mobile) | ||
@@ -45,8 +48,2 @@ * [Api](#api) | ||
``` | ||
If you use a style loader you can import the stylesheet as follow : | ||
```javascript | ||
import 'react-toastify/dist/ReactToastify.min.css' | ||
``` | ||
@@ -63,3 +60,13 @@ ## Features | ||
- Super easy to customize | ||
- Use glamor for styling | ||
## Migrate from v2 to v3 | ||
The v3 rely on glamor for styling. Using css classes is still fine but | ||
you may need to replace your css classes by a glamor rule in some case. | ||
No more css file to import ! | ||
Style helper added to mimic sass variables. | ||
## Usage | ||
@@ -74,3 +81,2 @@ | ||
import { ToastContainer, toast } from 'react-toastify'; | ||
import 'react-toastify/dist/ReactToastify.min.css'; | ||
@@ -84,12 +90,4 @@ class App extends Component { | ||
<button onClick={this.notify}>Notify !</button> | ||
{/* One container to rule them all! */} | ||
<ToastContainer | ||
position="top-right" | ||
autoClose={5000} | ||
hideProgressBar={false} | ||
newestOnTop={false} | ||
closeOnClick | ||
pauseOnHover | ||
/> | ||
{/*Can be written <ToastContainer />. Props defined are the same as the default one. */} | ||
{/* One container to rule them all! */} | ||
<ToastContainer /> | ||
</div> | ||
@@ -132,5 +130,3 @@ ); | ||
toast("Custom Style Notification !", { | ||
position: toast.POSITION.BOTTOM_RIGHT, | ||
className: 'dark-toast', | ||
progressClassName: 'transparent-progress' | ||
position: toast.POSITION.BOTTOM_RIGHT | ||
}); | ||
@@ -146,3 +142,2 @@ }; | ||
**** | ||
@@ -163,3 +158,3 @@ ### Remove a toast programmatically | ||
notify = () => this.toastId = toast("Lorem ipsum dolor"); | ||
Define hook | ||
dismiss = () => toast.dismiss(this.toastId); | ||
@@ -230,3 +225,103 @@ | ||
``` | ||
### Add an undo option to a toast | ||
[![Edit l2qkywz7xl](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/l2qkywz7xl) | ||
```javascript | ||
const ToastUndo = ({ id, undo, closeToast }) => { | ||
function handleClick(){ | ||
undo(id); | ||
closeToast(); | ||
} | ||
return ( | ||
<div> | ||
<h3> | ||
Row Deleted <button onClick={handleClick}>UNDO</button> | ||
</h3> | ||
</div> | ||
); | ||
} | ||
class App extends Component { | ||
state = { | ||
collection: data, | ||
// Buffer | ||
toRemove: [] | ||
}; | ||
// Remove the row id from the buffer | ||
undo = id => { | ||
this.setState({ | ||
toRemove: this.state.toRemove.filter(v => v !== id) | ||
}); | ||
} | ||
// Remove definetly | ||
cleanCollection = () => this.setState({ | ||
// Return element which are not included in toRemove | ||
collection: this.state.collection.filter(v => !this.state.toRemove.includes(v.id)), | ||
//Cleanup the buffer | ||
toRemove: [] | ||
}); | ||
// Remove row from render process | ||
// then display the toast with undo action available | ||
removeRow = e => { | ||
const id = e.target.dataset.rowId; | ||
this.setState({ | ||
toRemove: [...this.state.toRemove, id] | ||
}); | ||
toast(<ToastUndo undo={this.undo} id={id} />, { | ||
// hook will be called whent the component unmount | ||
onClose: this.cleanCollection | ||
}); | ||
}; | ||
renderRows() { | ||
const { collection, toRemove } = this.state; | ||
// Render all the element wich are not present in toRemove | ||
// Im using data-attribute to grab the row id | ||
return collection.filter(v => !toRemove.includes(v.id)).map(v => ( | ||
<tr key={v.id}> | ||
<td>{v.firstName}</td> | ||
<td>{v.lastName}</td> | ||
<td>{v.email}</td> | ||
<td> | ||
<button onClick={this.removeRow} data-row-id={v.id}> | ||
Delete | ||
</button> | ||
</td> | ||
</tr> | ||
)); | ||
} | ||
render() { | ||
// Dont close the toast on click | ||
return ( | ||
<div style={styles}> | ||
<table> | ||
<tbody> | ||
<tr> | ||
<th>name</th> | ||
<th>firstname</th> | ||
<th>gender</th> | ||
<th /> | ||
</tr> | ||
{this.renderRows()} | ||
</tbody> | ||
</table> | ||
<ToastContainer closeOnClick={false} /> | ||
</div> | ||
); | ||
} | ||
} | ||
``` | ||
### Set a custom close button or simply remove it | ||
@@ -268,3 +363,5 @@ | ||
![toastify_custom_trans](https://user-images.githubusercontent.com/5574267/31049179-0d52e14c-a62e-11e7-9abd-b0d169a0fadc.gif) | ||
- I'll use the zoom animation from animate.css | ||
I'll use the zoom animation from animate.css. Of course, you could create the animation using glamor. | ||
```css | ||
@@ -317,3 +414,3 @@ /* style.css*/ | ||
import Transition from 'react-transition-group/Transition'; | ||
import 'style.css'; | ||
import './style.css'; | ||
@@ -367,26 +464,25 @@ // Any transition created with react-transition-group/Transition will work ! | ||
Taste and colours are not always the same ! You have several options. | ||
#### Replace global style | ||
- Overwrite ```toastify-content``` and ```toastify__progress``` | ||
- Create two css classes and pass them to a toast | ||
```javascript | ||
import { style } from "react-toastify"; | ||
```css | ||
.dark-toast{ | ||
background: #323232; | ||
color: #fff; | ||
} | ||
style({ | ||
width: "320px", | ||
colorDefault: "#fff", | ||
colorInfo: "#3498db", | ||
colorSuccess: "#07bc0c", | ||
colorWarning: "#f1c40f", | ||
colorError: "#e74c3c", | ||
colorProgressDefault: "linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #34aadc, #5856d6, #ff2d55)", | ||
mobile: "only screen and (max-width : 480px)", | ||
}); | ||
``` | ||
.dark-toast > .toastify__close{ | ||
color: #fff; | ||
} | ||
#### Style with className | ||
.transparent-progress{ | ||
background: rgba(255,255,255,.7); | ||
} | ||
className can be a css class or a glamor rule. | ||
.fancy-progress{ | ||
background: repeating-radial-gradient(red, yellow 10%, green 15%); | ||
} | ||
``` | ||
⚠️ Use a glamor rule rather than a css class when you want to override a property cause glamor stylesheet | ||
will be injected last ⚠️ | ||
@@ -396,2 +492,3 @@ ```javascript | ||
import { toast } from 'react-toastify'; | ||
import { css } from 'glamor'; | ||
@@ -401,17 +498,13 @@ class Style extends Component { | ||
toast("Dark style notification with default type progress bar",{ | ||
className: 'dark-toast', | ||
autoClose: 5000 | ||
className: css({ | ||
background: "black" | ||
}), | ||
bodyClassName: "grow-font-size" | ||
}); | ||
toast("Dark style with transparent progress bar, the one used with others types.",{ | ||
className: 'dark-toast', | ||
progressClassName: 'transparent-progress', | ||
autoClose: 5000 | ||
toast("Fancy progress bar.",{ | ||
progressClassName: css({ | ||
background: "repeating-radial-gradient(red, yellow 10%, green 15%)" | ||
}) | ||
}); | ||
toast("Dark style with ugly progress bar",{ | ||
className: 'dark-toast', | ||
progressClassName: 'fancy-progress', | ||
autoClose: 5000 | ||
}); | ||
}; | ||
@@ -425,3 +518,3 @@ | ||
- Or pass your classes to the ToastContainer to set the classes for all your toast in one shot. | ||
You could apply glamor rules or css classes gloablly: | ||
@@ -435,3 +528,5 @@ | ||
toastClassName="dark-toast" | ||
progressClassName="transparent-progress" | ||
progressClassName={css({ | ||
height: "2px" | ||
})} | ||
/> | ||
@@ -443,33 +538,2 @@ {/*Component*/} | ||
### Replace default sass variable | ||
If you use a sass loader you could replace the default variable to suits your needs. | ||
- Define your variable: | ||
```css | ||
/* Below the variable you can replace */ | ||
$rt-toast-width: 320px !default; | ||
$rt-toast-background: #ffffff !default; | ||
$rt-font-color: #999 !default; | ||
$rt-font-size: 13px !default; | ||
$rt-animation-duration: 0.75s !default; | ||
$rt-color-default: #fff !default; | ||
$rt-color-info: #3498db !default; | ||
$rt-color-success: #07bc0c !default; | ||
$rt-color-warning: #f1c40f !default; | ||
$rt-color-error: #e74c3c !default; | ||
$rt-color-progress-default: linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #34aadc, #5856d6, #ff2d55) !default; | ||
$rt-smartphone-portrait: "only screen and (max-width : 480px)" !default; | ||
``` | ||
- Include the file and voila! | ||
```css | ||
@include 'my_custom_variables'; | ||
@include 'react-toastify/src/scss/main'; | ||
``` | ||
### Mobile | ||
@@ -495,7 +559,7 @@ | ||
| newestOnTop | bool | false | Display newest toast on top | | ||
| className | string | - | Add optional classes to the container | | ||
| className | string\|glamor rule | - | Add optional classes to the container | | ||
| style | object | - | Add optional inline style to the container | | ||
| toastClassName | string | - | Add optional classes to the toast | | ||
| bodyClassName | string | - | Add optional classes to the toast body | | ||
| progressClassName | string | - | Add optional classes to the progress bar | | ||
| toastClassName | string\|glamor rule | - | Add optional classes to the toast | | ||
| bodyClassName | string\|glamor rule | - | Add optional classes to the toast body | | ||
| progressClassName | string\|glamor rule | - | Add optional classes to the progress bar | | ||
@@ -563,2 +627,9 @@ | ||
### V3.0.0 | ||
- Switched to styled component with glamor | ||
- Added style helper to replace sass variables | ||
- Test suite improved | ||
- Typescript definition improved | ||
### V2.2.1 | ||
@@ -565,0 +636,0 @@ |
/* eslint react/require-default-props: 0 */ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { css } from "glamor"; | ||
function DefaultCloseButton({ closeToast }) { | ||
const rule = isDefault => css({ | ||
padding: 0, | ||
color: isDefault ? "#000" : "#fff", | ||
fontWeight: "bold", | ||
fontSize: "14px", | ||
background: "transparent", | ||
outline: "none", | ||
border: "none", | ||
cursor: "pointer", | ||
opacity: isDefault ? "0.3" : "0.7", | ||
transition: ".3s ease", | ||
alignSelf: "flex-start", | ||
":hover, :focus": { | ||
opacity: 1 | ||
} | ||
}); | ||
function DefaultCloseButton({ closeToast, type }) { | ||
return ( | ||
<button | ||
className="toastify__close" | ||
{...rule(type === "default")} | ||
type="button" | ||
@@ -10,0 +29,0 @@ onClick={closeToast} |
import React from "react"; | ||
import Transition from "react-transition-group/Transition"; | ||
import { css } from "glamor"; | ||
import getAnimation from "./animation"; | ||
const animate = { | ||
animationDuration: "0.75s", | ||
animationFillMode: "both" | ||
}; | ||
const animation = pos => { | ||
const { enter, exit } = getAnimation(pos); | ||
const enterAnimation = css.keyframes('enter', { | ||
"from, 60%, 75%, 90%, to": { | ||
animationTimingFunction: "cubic-bezier(0.215, 0.610, 0.355, 1.000)" | ||
}, | ||
...enter, | ||
}); | ||
const exitAnimation = css.keyframes('exit', exit) | ||
return { | ||
enter: css({...animate, animationName: enterAnimation}), | ||
exit: css({...animate, animationName: exitAnimation}), | ||
}; | ||
} | ||
function DefaultTransition({ children, position, ...props }) { | ||
const { enter, exit } = animation(position); | ||
return ( | ||
@@ -10,10 +37,7 @@ <Transition | ||
onEnter={node => { | ||
node.classList.add(`toast-enter--${position}`); | ||
node.classList.add("toastify-animated"); | ||
node.classList.add(enter); | ||
}} | ||
onExit={node => { | ||
node.classList.remove(`toast-enter--${position}`); | ||
node.classList.remove("toastify-animated"); | ||
node.classList.add(`toast-exit--${position}`); | ||
node.classList.add("toastify-animated"); | ||
node.classList.remove(enter); | ||
node.classList.add(exit); | ||
}} | ||
@@ -20,0 +44,0 @@ > |
import ToastContainer from './ToastContainer'; | ||
import toaster from './toaster'; | ||
import { defineStyle } from './style'; | ||
export { ToastContainer, toaster as toast }; | ||
export { ToastContainer, toaster as toast, defineStyle as style }; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { css } from "glamor"; | ||
import { TYPE } from './constant'; | ||
import style from "./style"; | ||
const trackProgress = css.keyframes('track-progress', { | ||
"0%": { width: "100%" }, | ||
"100%": { width: 0 } | ||
}); | ||
const progress = type => css({ | ||
position: "absolute", | ||
bottom: 0, | ||
left: 0, | ||
width: 0, | ||
height: "5px", | ||
zIndex: 999, | ||
opacity: 0.7, | ||
animation: `${trackProgress} linear 1`, | ||
backgroundColor: "rgba(255,255,255,.7)", | ||
...type === "default" ? { background: style.colorProgressDefault } : {} | ||
}); | ||
function ProgressBar({ delay, isRunning, closeToast, type, hide, className }) { | ||
@@ -19,3 +39,4 @@ const style = { | ||
<div | ||
className={`toastify__progress toastify__progress--${type} ${className}`} | ||
{...progress(type)} | ||
className={className} | ||
style={style} | ||
@@ -56,3 +77,3 @@ onAnimationEnd={closeToast} | ||
*/ | ||
className: PropTypes.string | ||
className: PropTypes.oneOfType([PropTypes.string, PropTypes.object]) | ||
}; | ||
@@ -59,0 +80,0 @@ |
import React, { Component } from "react"; | ||
import PropTypes from "prop-types"; | ||
import { css } from "glamor"; | ||
import ProgressBar from "./ProgressBar"; | ||
import { POSITION, TYPE } from "./constant"; | ||
import style from "./style"; | ||
import objectValues from "./util/objectValues"; | ||
import { falseOrElement, falseOrNumber } from "./util/propValidator"; | ||
const toast = type => css({ | ||
position: "relative", | ||
minHeight: "48px", | ||
marginBottom: "1rem", | ||
padding: "8px", | ||
borderRadius: "1px", | ||
boxShadow: "0 1px 10px 0 rgba(0, 0, 0, .1), 0 2px 15px 0 rgba(0, 0, 0, .05)", | ||
display: "flex", | ||
justifyContent: "space-between", | ||
maxHeight: "800px", | ||
overflow: "hidden", | ||
fontFamily: "sans-serif", | ||
cursor: "pointer", | ||
background: style[`color${type.charAt(0).toUpperCase()}${type.slice(1)}`], | ||
...type === "default" ? { color: "#aaa" } : {}, | ||
[`@media ${style.mobile}`]: { | ||
marginBottom: 0 | ||
} | ||
}); | ||
const body = css({ | ||
margin: "auto 0", | ||
flex: 1 | ||
}); | ||
class Toast extends Component { | ||
@@ -25,5 +52,5 @@ static propTypes = { | ||
type: PropTypes.oneOf(objectValues(TYPE)), | ||
className: PropTypes.string, | ||
bodyClassName: PropTypes.string, | ||
progressClassName: PropTypes.string | ||
className: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), | ||
bodyClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), | ||
progressClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.object]) | ||
}; | ||
@@ -63,6 +90,3 @@ | ||
getToastProps() { | ||
const toastProps = { | ||
className: `toastify-content toastify-content--${this.props.type} ${this | ||
.props.className}` | ||
}; | ||
const toastProps = {}; | ||
@@ -95,13 +119,14 @@ if (this.props.autoClose !== false && this.props.pauseOnHover === true) { | ||
closeToast, | ||
transition, | ||
transition: Transition, | ||
position, | ||
onExited | ||
onExited, | ||
className, | ||
bodyClassName, | ||
progressClassName | ||
} = this.props; | ||
const Transition = transition; | ||
return ( | ||
<Transition in={this.props.in} appear unmountOnExit onExited={onExited} position={position}> | ||
<div {...this.getToastProps()}> | ||
<div className={`toastify__body ${this.props.bodyClassName}`}> | ||
<div {...toast(type)} {...this.getToastProps()} className={className}> | ||
<div {...body} className={bodyClassName}> | ||
{children} | ||
@@ -117,3 +142,3 @@ </div> | ||
type={type} | ||
className={this.props.progressClassName} | ||
className={progressClassName} | ||
/> | ||
@@ -120,0 +145,0 @@ )} |
import React, { Component, isValidElement, cloneElement } from "react"; | ||
import PropTypes from "prop-types"; | ||
import { css } from "glamor"; | ||
import TransitionGroup from "react-transition-group/TransitionGroup"; | ||
@@ -9,2 +10,3 @@ | ||
import { POSITION, ACTION } from "./constant"; | ||
import style from "./style"; | ||
import EventManager from "./util/EventManager"; | ||
@@ -19,2 +21,68 @@ import objectValues from "./util/objectValues"; | ||
const container = () => css({ | ||
zIndex: 999, | ||
position: "fixed", | ||
padding: "4px", | ||
width: style.width, | ||
boxSizing: "border-box", | ||
color: "#fff", | ||
[`@media ${style.mobile}`]: { | ||
width: "100vw", | ||
padding: 0 | ||
} | ||
}); | ||
const toastPosition = pos => { | ||
let rule; | ||
const marginLeft = `-${parseInt(style.width,10)/2}px`; | ||
switch (pos) { | ||
case POSITION.TOP_LEFT: | ||
rule = { | ||
top: "1em", | ||
left: "1em" | ||
}; | ||
break; | ||
case POSITION.TOP_CENTER: | ||
rule = { | ||
top: "1em", | ||
left: "50%", | ||
marginLeft: marginLeft | ||
}; | ||
break; | ||
case POSITION.TOP_RIGHT: | ||
default: | ||
rule = { | ||
top: "1em", | ||
right: "1em" | ||
}; | ||
break; | ||
case POSITION.BOTTOM_LEFT: | ||
rule = { | ||
bottom: "1em", | ||
left: "1em" | ||
}; | ||
break; | ||
case POSITION.BOTTOM_CENTER: | ||
rule = { | ||
bottom: "1em", | ||
left: "50%", | ||
marginLeft: marginLeft | ||
}; | ||
break; | ||
case POSITION.BOTTOM_RIGHT: | ||
rule = { | ||
bottom: "1em", | ||
right: "1em" | ||
}; | ||
} | ||
return css(rule, css({ | ||
[`@media ${style.mobile}`]: { | ||
left: 0, | ||
margin: 0, | ||
position: "fixed", | ||
...pos.substring(0,3) === "top" ? { top: 0 } : { bottom: 0 } | ||
} | ||
})); | ||
}; | ||
class ToastContainer extends Component { | ||
@@ -60,3 +128,3 @@ static propTypes = { | ||
*/ | ||
className: PropTypes.string, | ||
className: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), | ||
@@ -71,3 +139,3 @@ /** | ||
*/ | ||
toastClassName: PropTypes.string, | ||
toastClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), | ||
@@ -77,3 +145,3 @@ /** | ||
*/ | ||
bodyClassName: PropTypes.string, | ||
bodyClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), | ||
@@ -83,3 +151,3 @@ /** | ||
*/ | ||
progressClassName: PropTypes.string, | ||
progressClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), | ||
@@ -139,3 +207,3 @@ /** | ||
makeCloseButton(toastClose, toastId) { | ||
makeCloseButton(toastClose, toastId, type) { | ||
let closeButton = this.props.closeButton; | ||
@@ -150,3 +218,4 @@ | ||
: this.with(closeButton, { | ||
closeToast: () => this.removeToast(toastId) | ||
closeToast: () => this.removeToast(toastId), | ||
type: type | ||
}); | ||
@@ -182,3 +251,3 @@ } | ||
type: options.type, | ||
closeButton: this.makeCloseButton(options.closeButton, toastId), | ||
closeButton: this.makeCloseButton(options.closeButton, toastId, options.type), | ||
position: options.position || this.props.position, | ||
@@ -244,9 +313,4 @@ transition: options.transition || this.props.transition, | ||
hasToast() { | ||
return this.state.toast.length > 0; | ||
} | ||
getContainerProps(pos, disablePointer) { | ||
getContainerProps(disablePointer) { | ||
const props = { | ||
className: `toastify toastify--${pos}`, | ||
style: disablePointer ? { pointerEvents: "none" } : {} | ||
@@ -256,7 +320,7 @@ }; | ||
if (this.props.className !== null) { | ||
props.className = `${props.className} ${this.props.className}`; | ||
props.className = this.props.className; | ||
} | ||
if (this.props.style !== null) { | ||
props.style = Object.assign({}, this.props.style, props.style); | ||
props.style = {...this.props.style, ...props.style}; | ||
} | ||
@@ -292,3 +356,5 @@ | ||
<TransitionGroup | ||
{...this.getContainerProps(position, disablePointer)} | ||
{...container()} | ||
{...toastPosition(position)} | ||
{...this.getContainerProps(disablePointer)} | ||
key={`container-${position}`} | ||
@@ -295,0 +361,0 @@ > |
@@ -21,3 +21,3 @@ /* | ||
progressClassName: null, | ||
tansition: null | ||
transition: null | ||
}; | ||
@@ -60,3 +60,3 @@ | ||
error: (content, options) => emitEvent(content, Object.assign(mergeOptions(options), { type: TYPE.ERROR })), | ||
dismiss: (id = null) => EventManager.emit(ACTION.CLEAR, id), | ||
dismiss: (id = null) => container && EventManager.emit(ACTION.CLEAR, id), | ||
isActive: () => false | ||
@@ -63,0 +63,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
758921
25
2301
786
5
36
2
+ Addedglamor@^2.20.40
+ Addedasap@2.0.6(transitive)
+ Addedbowser@1.9.4(transitive)
+ Addedcore-js@1.2.7(transitive)
+ Addedcss-in-js-utils@2.0.1(transitive)
+ Addedencoding@0.1.13(transitive)
+ Addedfbjs@0.8.18(transitive)
+ Addedglamor@2.20.40(transitive)
+ Addedhyphenate-style-name@1.1.0(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addedinline-style-prefixer@3.0.8(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedisobject@3.0.1(transitive)
+ Addedisomorphic-fetch@2.2.1(transitive)
+ Addednode-fetch@1.7.3(transitive)
+ Addedpromise@7.3.1(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsetimmediate@1.0.5(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedua-parser-js@0.7.39(transitive)
+ Addedwhatwg-fetch@3.6.20(transitive)