Comparing version 3.0.0-alpha.9 to 3.0.0-alpha.10
@@ -69,4 +69,11 @@ 'use strict'; | ||
var SnackbarContext = /*#__PURE__*/React__default.createContext(); | ||
var noOp = function noOp() { | ||
return ''; | ||
}; | ||
var SnackbarContext = /*#__PURE__*/React__default.createContext({ | ||
enqueueSnackbar: noOp, | ||
closeSnackbar: noOp | ||
}); | ||
var breakpoints = { | ||
@@ -170,3 +177,3 @@ downXs: '@media (max-width:599.95px)', | ||
if (timeout != null && typeof timeout !== 'number') { | ||
if (timeout != null && typeof timeout !== 'number' && typeof timeout !== 'string') { | ||
exit = timeout.exit; | ||
@@ -215,3 +222,5 @@ enter = timeout.enter; | ||
}, function () { | ||
_this2.props.onEntered(_this2.node, isAppearing, id); | ||
if (_this2.props.onEntered) { | ||
_this2.props.onEntered(_this2.node, isAppearing, id); | ||
} | ||
}); | ||
@@ -221,7 +230,12 @@ return; | ||
this.props.onEnter(this.node, isAppearing, id); | ||
if (this.props.onEnter) { | ||
this.props.onEnter(this.node, isAppearing, id); | ||
} | ||
this.safeSetState({ | ||
status: ENTERING | ||
}, function () { | ||
_this2.props.onEntering(_this2.node, isAppearing, id); | ||
if (_this2.props.onEntering) { | ||
_this2.props.onEntering(_this2.node, isAppearing, id); | ||
} | ||
@@ -232,3 +246,5 @@ _this2.onTransitionEnd(timeouts.enter, function () { | ||
}, function () { | ||
_this2.props.onEntered(_this2.node, isAppearing, id); | ||
if (_this2.props.onEntered) { | ||
_this2.props.onEntered(_this2.node, isAppearing, id); | ||
} | ||
}); | ||
@@ -251,3 +267,5 @@ }); | ||
}, function () { | ||
_this3.props.onExited(_this3.node, id); | ||
if (_this3.props.onExited) { | ||
_this3.props.onExited(_this3.node, id); | ||
} | ||
}); | ||
@@ -257,7 +275,12 @@ return; | ||
this.props.onExit(this.node, id); | ||
if (this.props.onExit) { | ||
this.props.onExit(this.node, id); | ||
} | ||
this.safeSetState({ | ||
status: EXITING | ||
}, function () { | ||
_this3.props.onExiting(_this3.node, id); | ||
if (_this3.props.onExiting) { | ||
_this3.props.onExiting(_this3.node, id); | ||
} | ||
@@ -268,3 +291,5 @@ _this3.onTransitionEnd(timeouts.exit, function () { | ||
}, function () { | ||
_this3.props.onExited(_this3.node, id); | ||
if (_this3.props.onExited) { | ||
_this3.props.onExited(_this3.node, id); | ||
} | ||
}); | ||
@@ -276,3 +301,3 @@ }); | ||
_proto.cancelNextCallback = function cancelNextCallback() { | ||
if (this.nextCallback !== null) { | ||
if (this.nextCallback !== null && this.nextCallback.cancel) { | ||
this.nextCallback.cancel(); | ||
@@ -293,7 +318,7 @@ this.nextCallback = null; | ||
this.nextCallback = function (event) { | ||
this.nextCallback = function () { | ||
if (active) { | ||
active = false; | ||
_this4.nextCallback = null; | ||
callback(event); | ||
callback(); | ||
} | ||
@@ -357,3 +382,4 @@ }; | ||
function noop() {} | ||
function noop() {// | ||
} | ||
@@ -413,4 +439,2 @@ Transition.defaultProps = { | ||
function getTransitionProps(props) { | ||
var _style$transitionDura; | ||
var timeout = props.timeout, | ||
@@ -421,3 +445,3 @@ _props$style = props.style, | ||
return { | ||
duration: (_style$transitionDura = style.transitionDuration) !== null && _style$transitionDura !== void 0 ? _style$transitionDura : typeof timeout === 'object' ? timeout[mode] || 0 : timeout, | ||
duration: typeof timeout === 'object' ? timeout[mode] || 0 : timeout, | ||
easing: style.transitionTimingFunction, | ||
@@ -448,3 +472,3 @@ delay: style.transitionDelay | ||
// We have to do something with node.scrollTop. | ||
// Otherwise it removed from the compiled code by optimisers | ||
// Otherwise it's removed from the compiled code by optimisers | ||
// eslint-disable-next-line no-self-assign | ||
@@ -508,2 +532,3 @@ node.scrollTop = node.scrollTop; | ||
var later = function later() { | ||
// @ts-ignore | ||
func.apply(_this, args); | ||
@@ -1546,2 +1571,3 @@ }; | ||
return _extends({}, state, { | ||
// @ts-ignore | ||
snacks: [].concat(snacks, [queue[0]]), | ||
@@ -1876,12 +1902,7 @@ queue: queue.slice(1, queue.length) | ||
exports.ENTERED = ENTERED; | ||
exports.ENTERING = ENTERING; | ||
exports.EXITED = EXITED; | ||
exports.EXITING = EXITING; | ||
exports.SnackbarContent = SnackbarContent; | ||
exports.SnackbarProvider = SnackbarProvider; | ||
exports.Transition = Transition; | ||
exports.UNMOUNTED = UNMOUNTED; | ||
exports.useSnackbar = useSnackbar; | ||
exports.withSnackbar = withSnackbar; | ||
//# sourceMappingURL=ee54bh78i.cjs.development.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";function n(n){return n&&"object"==typeof n&&"default"in n?n.default:n}Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=n(e),r=require("react-dom"),i=n(require("clsx")),o=require("goober"),a=n(require("hoist-non-react-statics"));function s(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}function u(n,e,t){return e&&s(n.prototype,e),t&&s(n,t),n}function c(){return(c=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n}).apply(this,arguments)}function l(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e}function d(n,e){if(null==n)return{};var t,r,i={},o=Object.keys(n);for(r=0;r<o.length;r++)e.indexOf(t=o[r])>=0||(i[t]=n[t]);return i}var f=t.createContext(),p=function(n){return n.charAt(0).toUpperCase()+n.slice(1)},m=function(n){return""+p(n.vertical)+p(n.horizontal)},h=function(n){return!!n||0===n},x=function(n){function e(e){var t;t=n.call(this,e)||this;var r,i=e.appear;return t.appearStatus=null,e.in?i?(r="exited",t.appearStatus="entering"):r="entered":r=e.unmountOnExit||e.mountOnEnter?"unmounted":"exited",t.state={status:r},t.nextCallback=null,t}l(e,n),e.getDerivedStateFromProps=function(n,e){return n.in&&"unmounted"===e.status?{status:"exited"}:null};var t=e.prototype;return t.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},t.componentDidUpdate=function(n){var e=null;if(n!==this.props){var t=this.state.status;this.props.in?"entering"!==t&&"entered"!==t&&(e="entering"):"entering"!==t&&"entered"!==t||(e="exiting")}this.updateStatus(!1,e)},t.componentWillUnmount=function(){this.cancelNextCallback()},t.getTimeouts=function(){var n=this.props.timeout,e=n,t=n;return null!=n&&"number"!=typeof n&&(t=n.exit,e=n.enter),{exit:t,enter:e}},t.updateStatus=function(n,e){void 0===n&&(n=!1),null!==e?(this.cancelNextCallback(),"entering"===e?this.performEnter(n):this.performExit()):this.props.unmountOnExit&&"exited"===this.state.status&&this.setState({status:"unmounted"})},t.performEnter=function(n){var e=this,t=this.props,r=t.enter,i=t.id,o=n,a=this.getTimeouts();n||r?(this.props.onEnter(this.node,o,i),this.safeSetState({status:"entering"},(function(){e.props.onEntering(e.node,o,i),e.onTransitionEnd(a.enter,(function(){e.safeSetState({status:"entered"},(function(){e.props.onEntered(e.node,o,i)}))}))}))):this.safeSetState({status:"entered"},(function(){e.props.onEntered(e.node,o,i)}))},t.performExit=function(){var n=this,e=this.props,t=e.exit,r=e.id,i=this.getTimeouts();t?(this.props.onExit(this.node,r),this.safeSetState({status:"exiting"},(function(){n.props.onExiting(n.node,r),n.onTransitionEnd(i.exit,(function(){n.safeSetState({status:"exited"},(function(){n.props.onExited(n.node,r)}))}))}))):this.safeSetState({status:"exited"},(function(){n.props.onExited(n.node,r)}))},t.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},t.safeSetState=function(n,e){e=this.setNextCallback(e),this.setState(n,e)},t.setNextCallback=function(n){var e=this,t=!0;return this.nextCallback=function(r){t&&(t=!1,e.nextCallback=null,n(r))},this.nextCallback.cancel=function(){t=!1},this.nextCallback},t.onTransitionEnd=function(n,e){this.setNextCallback(e),!this.node||null==n&&!this.props.addEndListener?setTimeout(this.nextCallback,0):(this.props.addEndListener&&this.props.addEndListener(this.node,this.nextCallback),null!=n&&setTimeout(this.nextCallback,n))},t.render=function(){var n=this.state.status;if("unmounted"===n)return null;var e=this.props;return(0,e.children)(n,d(e,["children","id","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]))},u(e,[{key:"node",get:function(){var n=this.props.nodeRef.current;if(!n)throw new Error("notistack - Custom snackbar is not refForwarding");return n}}]),e}(t.Component);function g(){}function v(n,e){"function"==typeof n?n(e):n&&(n.current=e)}function E(n,t){return e.useMemo((function(){return null==n&&null==t?null:function(e){v(n,e),v(t,e)}}),[n,t])}function b(n){var e,t=n.timeout,r=n.style,i=void 0===r?{}:r;return{duration:null!==(e=i.transitionDuration)&&void 0!==e?e:"object"==typeof t?t[n.mode]||0:t,easing:i.transitionTimingFunction,delay:i.transitionDelay}}x.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:g,onEntering:g,onEntered:g,onExit:g,onExiting:g,onExited:g};var k=function(n){n.scrollTop=n.scrollTop},y=function(n){return Math.round(n)+"ms"};function C(n,e){void 0===n&&(n=["all"]);var t=e||{},r=t.duration,i=void 0===r?300:r,o=t.easing,a=void 0===o?"cubic-bezier(0.4, 0, 0.2, 1)":o,s=t.delay,u=void 0===s?0:s;return(Array.isArray(n)?n:[n]).map((function(n){var e="string"==typeof i?i:y(i),t="string"==typeof u?u:y(u);return n+" "+e+" "+a+" "+t})).join(",")}function w(n){return function(n){return n&&n.ownerDocument||document}(n).defaultView||window}function S(n,e){if(e){var t=function(n,e){var t,r=e.getBoundingClientRect(),i=w(e);if(e.fakeTransform)t=e.fakeTransform;else{var o=i.getComputedStyle(e);t=o.getPropertyValue("-webkit-transform")||o.getPropertyValue("transform")}var a=0,s=0;if(t&&"none"!==t&&"string"==typeof t){var u=t.split("(")[1].split(")")[0].split(",");a=parseInt(u[4],10),s=parseInt(u[5],10)}switch(n){case"left":return"translateX("+(i.innerWidth+a-r.left)+"px)";case"right":return"translateX(-"+(r.left+r.width-a)+"px)";case"up":return"translateY("+(i.innerHeight+s-r.top)+"px)";default:return"translateY(-"+(r.top+r.height-s)+"px)"}}(n,e);t&&(e.style.webkitTransform=t,e.style.transform=t)}}var T=e.forwardRef((function(n,t){var r=n.children,i=n.direction,o=void 0===i?"down":i,a=n.in,s=n.style,u=n.timeout,l=void 0===u?0:u,f=n.onEnter,p=n.onEntered,m=n.onExit,h=n.onExited,g=d(n,["children","direction","in","style","timeout","onEnter","onEntered","onExit","onExited"]),v=e.useRef(null),y=E(r.ref,v),T=E(y,t),D=e.useCallback((function(){v.current&&S(o,v.current)}),[o]);return e.useEffect((function(){if(!a&&"down"!==o&&"right"!==o){var n=function(n,e){var t;function r(){for(var r=this,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];var s=function(){n.apply(r,o)};clearTimeout(t),t=setTimeout(s,e)}return void 0===e&&(e=166),r.clear=function(){clearTimeout(t)},r}((function(){v.current&&S(o,v.current)})),e=w(v.current);return e.addEventListener("resize",n),function(){n.clear(),e.removeEventListener("resize",n)}}}),[o,a]),e.useEffect((function(){a||D()}),[a,D]),e.createElement(x,Object.assign({appear:!0,nodeRef:v,onEnter:function(n,e,t){S(o,n),k(n),f&&f(n,e,t)},onEntered:p,onEntering:function(n){var e=b({timeout:l,mode:"enter",style:c({},s,{transitionTimingFunction:(null==s?void 0:s.transitionTimingFunction)||"cubic-bezier(0.0, 0, 0.2, 1)"})});n.style.webkitTransition=C("-webkit-transform",e),n.style.transition=C("transform",e),n.style.webkitTransform="none",n.style.transform="none"},onExit:function(n,e){var t=b({timeout:l,mode:"exit",style:c({},s,{transitionTimingFunction:(null==s?void 0:s.transitionTimingFunction)||"cubic-bezier(0.4, 0, 0.6, 1)"})});n.style.webkitTransition=C("-webkit-transform",t),n.style.transition=C("transform",t),S(o,n),m&&m(n,e)},onExited:function(n,e){n.style.webkitTransition="",n.style.transition="",h&&h(n,e)},in:a,timeout:l},g),(function(n,t){return e.cloneElement(r,c({ref:T,style:c({visibility:"exited"!==n||a?void 0:"hidden"},s,{},r.props.style)},t))}))}));T.displayName="Slide";var D=function(n){return t.createElement("svg",Object.assign({viewBox:"0 0 24 24",focusable:"false",style:{fontSize:20,marginInlineEnd:8,userSelect:"none",width:"1em",height:"1em",display:"inline-block",fill:"currentColor",flexShrink:0}},n))},O=function(){return t.createElement(D,null,t.createElement("path",{d:"M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M10 17L5 12L6.41\n 10.59L10 14.17L17.59 6.58L19 8L10 17Z"}))},L=function(){return t.createElement(D,null,t.createElement("path",{d:"M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"}))},N=function(){return t.createElement(D,null,t.createElement("path",{d:"M12,2C17.53,2 22,6.47 22,12C22,17.53 17.53,22 12,22C6.47,22 2,17.53 2,12C2,\n 6.47 6.47,2 12,2M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,\n 13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z"}))},R=function(){return t.createElement(D,null,t.createElement("path",{d:"M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,\n 0 22,12A10,10 0 0,0 12,2Z"}))},q={maxSnack:3,persist:!1,hideIconVariant:!1,disableWindowBlurListener:!1,variant:"default",autoHideDuration:5e3,iconVariant:{default:void 0,success:t.createElement(O,null),warning:t.createElement(L,null),error:t.createElement(N,null),info:t.createElement(R,null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},TransitionComponent:T,transitionDuration:{enter:225,exit:195}};function H(n){return Object.entries(n).reduce((function(n,e){var t;return c({},n,((t={})[e[0]]=o.css(e[1]),t))}),{})}var M=H({root:{height:0},entered:{height:"auto"}}),j=e.forwardRef((function(n,t){var r=n.children,o=n.in,a=n.onExited,s=n.id,u=e.useRef(null),l=e.useRef(null),d=E(t,l),f=function(){return u.current?u.current.clientHeight:0};return e.createElement(x,{id:s,in:o,unmountOnExit:!0,onEnter:function(n){n.style.height="0px"},onEntered:function(n){n.style.height="auto"},onEntering:function(n){var e=f(),t=b({timeout:175,mode:"enter"}),r=t.duration,i=t.easing;n.style.transitionDuration="string"==typeof r?r:r+"ms",n.style.height=e+"px",n.style.transitionTimingFunction=i||""},onExit:function(n){n.style.height=f()+"px"},onExited:a,onExiting:function(n){k(n);var e=b({timeout:175,mode:"exit"}),t=e.duration,r=e.easing;n.style.transitionDuration="string"==typeof t?t:t+"ms",n.style.height="0px",n.style.transitionTimingFunction=r||""},nodeRef:l,timeout:175},(function(n,t){return e.createElement("div",Object.assign({ref:d,className:i(M.root,"entered"===n&&M.entered),style:c({pointerEvents:"all",overflow:"hidden",minHeight:"0px",transition:C("height")},"entered"===n&&{overflow:"visible"},{},"exited"===n&&!o&&{visibility:"hidden"})},t),e.createElement("div",{ref:u,className:"notistack-CollapseWrapper",style:{display:"flex",width:"100%"}},r))}))}));j.displayName="Collapse";var P={right:"left",left:"right",bottom:"up",top:"down"},I=function(n){return"anchorOrigin"+m(n)};function V(n){return n.reduce((function(n,e){return null==e?n:function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];var o=[].concat(r);n.apply(this,o),e.apply(this,o)}}),(function(){}))}var W="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;function A(n){var t=e.useRef(n);return W((function(){t.current=n})),e.useCallback((function(){return t.current.apply(void 0,arguments)}),[])}var z,B=e.forwardRef((function(n,t){var r=n.children,o=n.className,a=n.autoHideDuration,s=n.disableWindowBlurListener,u=void 0!==s&&s,c=n.onClose,l=n.id,d=n.open,f=n.SnackbarProps,p=void 0===f?{}:f,m=e.useRef(),h=A((function(){c&&c.apply(void 0,arguments)})),x=A((function(n){c&&null!=n&&(m.current&&clearTimeout(m.current),m.current=setTimeout((function(){h(null,"timeout",l)}),n))}));e.useEffect((function(){return d&&x(a),function(){m.current&&clearTimeout(m.current)}}),[d,a,x]);var g=function(){m.current&&clearTimeout(m.current)},v=e.useCallback((function(){null!=a&&x(.5*a)}),[a,x]);return e.useEffect((function(){if(!u&&d)return window.addEventListener("focus",v),window.addEventListener("blur",g),function(){window.removeEventListener("focus",v),window.removeEventListener("blur",g)}}),[u,v,d]),e.createElement("div",Object.assign({ref:t},p,{className:i("notistack-Snackbar",o),onMouseEnter:function(n){p.onMouseEnter&&p.onMouseEnter(n),g()},onMouseLeave:function(n){p.onMouseLeave&&p.onMouseLeave(n),v()}}),r)}));B.displayName="Snackbar";var F=H({root:(z={display:"flex",flexWrap:"wrap",flexGrow:1},z["@media (min-width:600px)"]={flexGrow:"initial",minWidth:"288px"},z)}),X=e.forwardRef((function(n,e){var r=n.className,o=d(n,["className"]);return t.createElement("div",Object.assign({ref:e,className:i(F.root,r)},o))}));X.displayName="SnackbarContent";var _=H({root:{backgroundColor:"#313131",fontSize:"0.875rem",lineHeight:1.43,letterSpacing:"0.01071em",color:"#fff",alignItems:"center",padding:"6px 16px",borderRadius:"4px",boxShadow:"0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)"},lessPadding:{paddingLeft:"20px"},default:{backgroundColor:"#313131"},success:{backgroundColor:"#43a047"},error:{backgroundColor:"#d32f2f"},warning:{backgroundColor:"#ff9800"},info:{backgroundColor:"#2196f3"},message:{display:"flex",alignItems:"center",padding:"8px 0"},action:{display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:"16px",marginRight:"-8px"}}),U=e.forwardRef((function(n,e){var r=n.message,o=n.variant,a=n.hideIconVariant,s=n.style,u=n.iconVariant[o],c=n.action;return"function"==typeof c&&(c=c(n.id)),t.createElement(X,{ref:e,role:"alert",style:s,className:i("notistack-MuiContent",_.root,_[o],!a&&u&&_.lessPadding)},t.createElement("div",{id:"notistack-snackbar",className:_.message},a?null:u,r),c&&t.createElement("div",{className:_.action},c))}));U.displayName="MaterialDesignContent";var G,Z,Q,Y,J,K=e.memo(U),$=H({wrappedRoot:{width:"100%",position:"relative",transform:"translateX(0)",top:0,right:0,bottom:0,left:0,minWidth:"288px"}}),nn=function(n){var r=e.useRef(),o=e.useState(!0),a=o[0],s=o[1],u=V([n.snack.onClose,n.onClose]),l=e.useCallback((function(){r.current=setTimeout((function(){s((function(n){return!n}))}),125)}),[]);e.useEffect((function(){return function(){r.current&&clearTimeout(r.current)}}),[]);var f,p=n.snack,m=n.classes,h=n.Component,x=void 0===h?K:h,g=e.useMemo((function(){return function(n){void 0===n&&(n={});var e={containerRoot:!0,containerAnchorOriginTopCenter:!0,containerAnchorOriginBottomCenter:!0,containerAnchorOriginTopRight:!0,containerAnchorOriginBottomRight:!0,containerAnchorOriginTopLeft:!0,containerAnchorOriginBottomLeft:!0};return Object.keys(n).filter((function(n){return!e[n]})).reduce((function(e,t){var r;return c({},e,((r={})[t]=n[t],r))}),{})}(m)}),[m]),v=p.open,E=p.SnackbarProps,b=p.TransitionComponent,k=p.TransitionProps,y=p.transitionDuration,C=p.disableWindowBlurListener,w=p.content,S=d(p,["open","SnackbarProps","TransitionComponent","TransitionProps","transitionDuration","disableWindowBlurListener","content","entered","requestClose","onEnter","onEntered","onExit","onExited"]),T=c({direction:(f=S.anchorOrigin,"center"!==f.horizontal?P[f.horizontal]:P[f.vertical]),timeout:y},k),D=w;"function"==typeof D&&(D=D(S.id,S.message));var O=["onEnter","onEntered","onExit","onExited"].reduce((function(e,t){var r;return c({},e,((r={})[t]=V([n.snack[t],n[t]]),r))}),{});return t.createElement(j,{id:S.id,in:a,onExited:O.onExited},t.createElement(B,{open:v,id:S.id,disableWindowBlurListener:C,autoHideDuration:S.autoHideDuration,className:i($.wrappedRoot,g.root,g[I(S.anchorOrigin)]),SnackbarProps:E,onClose:u},t.createElement(b,Object.assign({},T,{id:S.id,in:v,onExit:O.onExit,onExited:l,onEnter:O.onEnter,onEntered:V([O.onEntered,function(){n.snack.requestClose&&u(null,"instructed",n.snack.id)}])}),D||t.createElement(x,Object.assign({},S)))))},en=H({root:(G={boxSizing:"border-box",display:"flex",maxHeight:"100%",position:"fixed",zIndex:1400,height:"auto",width:"auto",transition:C(["top","right","bottom","left","max-width"],{duration:300,easing:"ease"}),pointerEvents:"none"},G[".notistack-CollapseWrapper"]={padding:"6px 0px",transition:"padding 300ms ease 0ms"},G.maxWidth="calc(100% - 40px)",G["@media (max-width:599.95px)"]={width:"100%",maxWidth:"calc(100% - 32px)"},G),rootDense:(Z={},Z[".notistack-CollapseWrapper"]={padding:"2px 0px"},Z),top:{top:"14px",flexDirection:"column"},bottom:{bottom:"14px",flexDirection:"column-reverse"},left:(Q={left:"20px"},Q["@media (min-width:600px)"]={alignItems:"flex-start"},Q["@media (max-width:599.95px)"]={left:"16px"},Q),right:(Y={right:"20px"},Y["@media (min-width:600px)"]={alignItems:"flex-end"},Y["@media (max-width:599.95px)"]={right:"16px"},Y),center:(J={left:"50%",transform:"translateX(-50%)"},J["@media (min-width:600px)"]={alignItems:"center"},J)}),tn=e.memo((function(n){var e=n.classes,r=void 0===e?{}:e,o=n.anchorOrigin,a=n.dense,s=n.children,u=i("notistack-SnackbarContainer",en[o.vertical],en[o.horizontal],en.root,r.containerRoot,r["containerAnchorOrigin"+m(o)],a&&en.rootDense);return t.createElement("div",{className:u},s)})),rn=function(n){return"string"!=typeof n},on=function(n){function e(e){var t;return(t=n.call(this,e)||this).enqueueSnackbar=function(n,e){void 0===e&&(e={});var r=rn(n)?n:e,o=n;rn(n)&&(o=n.message);var a=r.key,s=r.preventDuplicate,u=d(r,["key","preventDuplicate"]),l=h(a),f=l?a:(new Date).getTime()+Math.random(),p=function(n,e){return function(t,r){return void 0===r&&(r=!1),r?c({},q[t],{},e[t],{},n[t]):"autoHideDuration"===t?(o=e.autoHideDuration,(a=function(n){return"number"==typeof n||null===n})(i=n.autoHideDuration)?i:a(o)?o:q.autoHideDuration):"transitionDuration"===t?function(n,e){var t=function(n,e){return e.some((function(e){return typeof n===e}))};return t(n,["string","number"])?n:t(n,["object"])?c({},q.transitionDuration,{},t(e,["object"])&&e,{},n):t(e,["string","number"])?e:t(e,["object"])?c({},q.transitionDuration,{},e):q.transitionDuration}(n.transitionDuration,e.transitionDuration):n[t]||e[t]||q[t];var i,o,a}}(u,t.props),m=c({id:f},u,{message:o,open:!0,entered:!1,requestClose:!1,persist:p("persist"),action:p("action"),content:p("content"),variant:p("variant"),anchorOrigin:p("anchorOrigin"),disableWindowBlurListener:p("disableWindowBlurListener"),autoHideDuration:p("autoHideDuration"),hideIconVariant:p("hideIconVariant"),TransitionComponent:p("TransitionComponent"),transitionDuration:p("transitionDuration"),TransitionProps:p("TransitionProps",!0),iconVariant:p("iconVariant",!0),style:p("style",!0),SnackbarProps:p("SnackbarProps",!0),className:i(t.props.className,u.className)});return m.persist&&(m.autoHideDuration=void 0),t.setState((function(n){if(void 0===s&&t.props.preventDuplicate||s){var e=function(n){return l?n.id===f:n.message===o},r=n.queue.findIndex(e)>-1,i=n.snacks.findIndex(e)>-1;if(r||i)return n}return t.handleDisplaySnack(c({},n,{queue:[].concat(n.queue,[m])}))})),f},t.handleDisplaySnack=function(n){return n.snacks.length>=t.maxSnack?t.handleDismissOldest(n):t.processQueue(n)},t.processQueue=function(n){var e=n.queue;return e.length>0?c({},n,{snacks:[].concat(n.snacks,[e[0]]),queue:e.slice(1,e.length)}):n},t.handleDismissOldest=function(n){if(n.snacks.some((function(n){return!n.open||n.requestClose})))return n;var e=!1,r=!1;n.snacks.reduce((function(n,e){return n+(e.open&&e.persist?1:0)}),0)===t.maxSnack&&(r=!0);var i=n.snacks.map((function(n){return e||n.persist&&!r?c({},n):(e=!0,n.entered?(n.onClose&&n.onClose(null,"maxsnack",n.id),t.props.onClose&&t.props.onClose(null,"maxsnack",n.id),c({},n,{open:!1})):c({},n,{requestClose:!0}))}));return c({},n,{snacks:i})},t.handleEnteredSnack=function(n,e,r){if(!h(r))throw new Error("handleEnteredSnack Cannot be called with undefined key");t.setState((function(n){return{snacks:n.snacks.map((function(n){return n.id===r?c({},n,{entered:!0}):c({},n)}))}}))},t.handleCloseSnack=function(n,e,r){t.props.onClose&&t.props.onClose(n,e,r);var i=void 0===r;t.setState((function(n){var e=n.queue;return{snacks:n.snacks.map((function(n){return i||n.id===r?c({},n,n.entered?{open:!1}:{requestClose:!0}):c({},n)})),queue:e.filter((function(n){return n.id!==r}))}}))},t.closeSnackbar=function(n){var e=t.state.snacks.find((function(e){return e.id===n}));h(n)&&e&&e.onClose&&e.onClose(null,"instructed",n),t.handleCloseSnack(null,"instructed",n)},t.handleExitedSnack=function(n,e){if(!h(e))throw new Error("handleExitedSnack Cannot be called with undefined key");t.setState((function(n){var r=t.processQueue(c({},n,{snacks:n.snacks.filter((function(n){return n.id!==e}))}));return 0===r.queue.length?r:t.handleDismissOldest(r)}))},t.state={snacks:[],queue:[],contextValue:{enqueueSnackbar:t.enqueueSnackbar,closeSnackbar:t.closeSnackbar}},t}return l(e,n),e.prototype.render=function(){var n=this,e=this.state.contextValue,i=this.props,o=i.domRoot,a=i.children,s=i.dense,u=void 0!==s&&s,l=i.Components,d=void 0===l?{}:l,p=i.classes,h=this.state.snacks.reduce((function(n,e){var t,r=m(e.anchorOrigin);return c({},n,((t={})[r]=[].concat(n[r]||[],[e]),t))}),{}),x=Object.keys(h).map((function(e){var r=h[e];return t.createElement(tn,{key:e,dense:u,anchorOrigin:r[0].anchorOrigin,classes:p},r.map((function(e){return t.createElement(nn,{key:e.id,snack:e,classes:p,Component:d[e.variant],onClose:n.handleCloseSnack,onEnter:n.props.onEnter,onExit:n.props.onExit,onExited:V([n.handleExitedSnack,n.props.onExited]),onEntered:V([n.handleEnteredSnack,n.props.onEntered])})})))}));return t.createElement(f.Provider,{value:e},a,o?r.createPortal(x,o):x)},u(e,[{key:"maxSnack",get:function(){return this.props.maxSnack||q.maxSnack}}]),e}(e.Component);exports.ENTERED="entered",exports.ENTERING="entering",exports.EXITED="exited",exports.EXITING="exiting",exports.SnackbarContent=X,exports.SnackbarProvider=on,exports.Transition=x,exports.UNMOUNTED="unmounted",exports.useSnackbar=function(){return e.useContext(f)},exports.withSnackbar=function(n){var e=t.forwardRef((function(e,r){return t.createElement(f.Consumer,null,(function(i){return t.createElement(n,c({},e,{ref:r,enqueueSnackbar:i.enqueueSnackbar,closeSnackbar:i.closeSnackbar}))}))}));return a(e,n),e}; | ||
"use strict";function n(n){return n&&"object"==typeof n&&"default"in n?n.default:n}Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=n(e),r=require("react-dom"),i=n(require("clsx")),o=require("goober"),a=n(require("hoist-non-react-statics"));function s(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}function u(n,e,t){return e&&s(n.prototype,e),t&&s(n,t),n}function c(){return(c=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n}).apply(this,arguments)}function l(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e}function d(n,e){if(null==n)return{};var t,r,i={},o=Object.keys(n);for(r=0;r<o.length;r++)e.indexOf(t=o[r])>=0||(i[t]=n[t]);return i}var f=function(){return""},p=t.createContext({enqueueSnackbar:f,closeSnackbar:f}),m=function(n){return n.charAt(0).toUpperCase()+n.slice(1)},h=function(n){return""+m(n.vertical)+m(n.horizontal)},x=function(n){return!!n||0===n},g=function(n){function e(e){var t;t=n.call(this,e)||this;var r,i=e.appear;return t.appearStatus=null,e.in?i?(r="exited",t.appearStatus="entering"):r="entered":r=e.unmountOnExit||e.mountOnEnter?"unmounted":"exited",t.state={status:r},t.nextCallback=null,t}l(e,n),e.getDerivedStateFromProps=function(n,e){return n.in&&"unmounted"===e.status?{status:"exited"}:null};var t=e.prototype;return t.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},t.componentDidUpdate=function(n){var e=null;if(n!==this.props){var t=this.state.status;this.props.in?"entering"!==t&&"entered"!==t&&(e="entering"):"entering"!==t&&"entered"!==t||(e="exiting")}this.updateStatus(!1,e)},t.componentWillUnmount=function(){this.cancelNextCallback()},t.getTimeouts=function(){var n=this.props.timeout,e=n,t=n;return null!=n&&"number"!=typeof n&&"string"!=typeof n&&(t=n.exit,e=n.enter),{exit:t,enter:e}},t.updateStatus=function(n,e){void 0===n&&(n=!1),null!==e?(this.cancelNextCallback(),"entering"===e?this.performEnter(n):this.performExit()):this.props.unmountOnExit&&"exited"===this.state.status&&this.setState({status:"unmounted"})},t.performEnter=function(n){var e=this,t=this.props,r=t.enter,i=t.id,o=n,a=this.getTimeouts();n||r?(this.props.onEnter&&this.props.onEnter(this.node,o,i),this.safeSetState({status:"entering"},(function(){e.props.onEntering&&e.props.onEntering(e.node,o,i),e.onTransitionEnd(a.enter,(function(){e.safeSetState({status:"entered"},(function(){e.props.onEntered&&e.props.onEntered(e.node,o,i)}))}))}))):this.safeSetState({status:"entered"},(function(){e.props.onEntered&&e.props.onEntered(e.node,o,i)}))},t.performExit=function(){var n=this,e=this.props,t=e.exit,r=e.id,i=this.getTimeouts();t?(this.props.onExit&&this.props.onExit(this.node,r),this.safeSetState({status:"exiting"},(function(){n.props.onExiting&&n.props.onExiting(n.node,r),n.onTransitionEnd(i.exit,(function(){n.safeSetState({status:"exited"},(function(){n.props.onExited&&n.props.onExited(n.node,r)}))}))}))):this.safeSetState({status:"exited"},(function(){n.props.onExited&&n.props.onExited(n.node,r)}))},t.cancelNextCallback=function(){null!==this.nextCallback&&this.nextCallback.cancel&&(this.nextCallback.cancel(),this.nextCallback=null)},t.safeSetState=function(n,e){e=this.setNextCallback(e),this.setState(n,e)},t.setNextCallback=function(n){var e=this,t=!0;return this.nextCallback=function(){t&&(t=!1,e.nextCallback=null,n())},this.nextCallback.cancel=function(){t=!1},this.nextCallback},t.onTransitionEnd=function(n,e){this.setNextCallback(e),!this.node||null==n&&!this.props.addEndListener?setTimeout(this.nextCallback,0):(this.props.addEndListener&&this.props.addEndListener(this.node,this.nextCallback),null!=n&&setTimeout(this.nextCallback,n))},t.render=function(){var n=this.state.status;if("unmounted"===n)return null;var e=this.props;return(0,e.children)(n,d(e,["children","id","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]))},u(e,[{key:"node",get:function(){var n=this.props.nodeRef.current;if(!n)throw new Error("notistack - Custom snackbar is not refForwarding");return n}}]),e}(t.Component);function v(){}function E(n,e){"function"==typeof n?n(e):n&&(n.current=e)}function b(n,t){return e.useMemo((function(){return null==n&&null==t?null:function(e){E(n,e),E(t,e)}}),[n,t])}function k(n){var e=n.timeout,t=n.style,r=void 0===t?{}:t;return{duration:"object"==typeof e?e[n.mode]||0:e,easing:r.transitionTimingFunction,delay:r.transitionDelay}}g.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:v,onEntering:v,onEntered:v,onExit:v,onExiting:v,onExited:v};var y=function(n){n.scrollTop=n.scrollTop},C=function(n){return Math.round(n)+"ms"};function S(n,e){void 0===n&&(n=["all"]);var t=e||{},r=t.duration,i=void 0===r?300:r,o=t.easing,a=void 0===o?"cubic-bezier(0.4, 0, 0.2, 1)":o,s=t.delay,u=void 0===s?0:s;return(Array.isArray(n)?n:[n]).map((function(n){var e="string"==typeof i?i:C(i),t="string"==typeof u?u:C(u);return n+" "+e+" "+a+" "+t})).join(",")}function w(n){return function(n){return n&&n.ownerDocument||document}(n).defaultView||window}function T(n,e){if(e){var t=function(n,e){var t,r=e.getBoundingClientRect(),i=w(e);if(e.fakeTransform)t=e.fakeTransform;else{var o=i.getComputedStyle(e);t=o.getPropertyValue("-webkit-transform")||o.getPropertyValue("transform")}var a=0,s=0;if(t&&"none"!==t&&"string"==typeof t){var u=t.split("(")[1].split(")")[0].split(",");a=parseInt(u[4],10),s=parseInt(u[5],10)}switch(n){case"left":return"translateX("+(i.innerWidth+a-r.left)+"px)";case"right":return"translateX(-"+(r.left+r.width-a)+"px)";case"up":return"translateY("+(i.innerHeight+s-r.top)+"px)";default:return"translateY(-"+(r.top+r.height-s)+"px)"}}(n,e);t&&(e.style.webkitTransform=t,e.style.transform=t)}}var L=e.forwardRef((function(n,t){var r=n.children,i=n.direction,o=void 0===i?"down":i,a=n.in,s=n.style,u=n.timeout,l=void 0===u?0:u,f=n.onEnter,p=n.onEntered,m=n.onExit,h=n.onExited,x=d(n,["children","direction","in","style","timeout","onEnter","onEntered","onExit","onExited"]),v=e.useRef(null),E=b(r.ref,v),C=b(E,t),L=e.useCallback((function(){v.current&&T(o,v.current)}),[o]);return e.useEffect((function(){if(!a&&"down"!==o&&"right"!==o){var n=function(n,e){var t;function r(){for(var r=this,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];var s=function(){n.apply(r,o)};clearTimeout(t),t=setTimeout(s,e)}return void 0===e&&(e=166),r.clear=function(){clearTimeout(t)},r}((function(){v.current&&T(o,v.current)})),e=w(v.current);return e.addEventListener("resize",n),function(){n.clear(),e.removeEventListener("resize",n)}}}),[o,a]),e.useEffect((function(){a||L()}),[a,L]),e.createElement(g,Object.assign({appear:!0,nodeRef:v,onEnter:function(n,e,t){T(o,n),y(n),f&&f(n,e,t)},onEntered:p,onEntering:function(n){var e=k({timeout:l,mode:"enter",style:c({},s,{transitionTimingFunction:(null==s?void 0:s.transitionTimingFunction)||"cubic-bezier(0.0, 0, 0.2, 1)"})});n.style.webkitTransition=S("-webkit-transform",e),n.style.transition=S("transform",e),n.style.webkitTransform="none",n.style.transform="none"},onExit:function(n,e){var t=k({timeout:l,mode:"exit",style:c({},s,{transitionTimingFunction:(null==s?void 0:s.transitionTimingFunction)||"cubic-bezier(0.4, 0, 0.6, 1)"})});n.style.webkitTransition=S("-webkit-transform",t),n.style.transition=S("transform",t),T(o,n),m&&m(n,e)},onExited:function(n,e){n.style.webkitTransition="",n.style.transition="",h&&h(n,e)},in:a,timeout:l},x),(function(n,t){return e.cloneElement(r,c({ref:C,style:c({visibility:"exited"!==n||a?void 0:"hidden"},s,{},r.props.style)},t))}))}));L.displayName="Slide";var O=function(n){return t.createElement("svg",Object.assign({viewBox:"0 0 24 24",focusable:"false",style:{fontSize:20,marginInlineEnd:8,userSelect:"none",width:"1em",height:"1em",display:"inline-block",fill:"currentColor",flexShrink:0}},n))},D=function(){return t.createElement(O,null,t.createElement("path",{d:"M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M10 17L5 12L6.41\n 10.59L10 14.17L17.59 6.58L19 8L10 17Z"}))},q=function(){return t.createElement(O,null,t.createElement("path",{d:"M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"}))},N=function(){return t.createElement(O,null,t.createElement("path",{d:"M12,2C17.53,2 22,6.47 22,12C22,17.53 17.53,22 12,22C6.47,22 2,17.53 2,12C2,\n 6.47 6.47,2 12,2M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,\n 13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z"}))},R=function(){return t.createElement(O,null,t.createElement("path",{d:"M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,\n 0 22,12A10,10 0 0,0 12,2Z"}))},H={maxSnack:3,persist:!1,hideIconVariant:!1,disableWindowBlurListener:!1,variant:"default",autoHideDuration:5e3,iconVariant:{default:void 0,success:t.createElement(D,null),warning:t.createElement(q,null),error:t.createElement(N,null),info:t.createElement(R,null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},TransitionComponent:L,transitionDuration:{enter:225,exit:195}};function M(n){return Object.entries(n).reduce((function(n,e){var t;return c({},n,((t={})[e[0]]=o.css(e[1]),t))}),{})}var j=M({root:{height:0},entered:{height:"auto"}}),P=e.forwardRef((function(n,t){var r=n.children,o=n.in,a=n.onExited,s=n.id,u=e.useRef(null),l=e.useRef(null),d=b(t,l),f=function(){return u.current?u.current.clientHeight:0};return e.createElement(g,{id:s,in:o,unmountOnExit:!0,onEnter:function(n){n.style.height="0px"},onEntered:function(n){n.style.height="auto"},onEntering:function(n){var e=f(),t=k({timeout:175,mode:"enter"}),r=t.duration,i=t.easing;n.style.transitionDuration="string"==typeof r?r:r+"ms",n.style.height=e+"px",n.style.transitionTimingFunction=i||""},onExit:function(n){n.style.height=f()+"px"},onExited:a,onExiting:function(n){y(n);var e=k({timeout:175,mode:"exit"}),t=e.duration,r=e.easing;n.style.transitionDuration="string"==typeof t?t:t+"ms",n.style.height="0px",n.style.transitionTimingFunction=r||""},nodeRef:l,timeout:175},(function(n,t){return e.createElement("div",Object.assign({ref:d,className:i(j.root,"entered"===n&&j.entered),style:c({pointerEvents:"all",overflow:"hidden",minHeight:"0px",transition:S("height")},"entered"===n&&{overflow:"visible"},{},"exited"===n&&!o&&{visibility:"hidden"})},t),e.createElement("div",{ref:u,className:"notistack-CollapseWrapper",style:{display:"flex",width:"100%"}},r))}))}));P.displayName="Collapse";var V={right:"left",left:"right",bottom:"up",top:"down"},W=function(n){return"anchorOrigin"+h(n)};function A(n){return n.reduce((function(n,e){return null==e?n:function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];var o=[].concat(r);n.apply(this,o),e.apply(this,o)}}),(function(){}))}var I="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;function z(n){var t=e.useRef(n);return I((function(){t.current=n})),e.useCallback((function(){return t.current.apply(void 0,arguments)}),[])}var B,F=e.forwardRef((function(n,t){var r=n.children,o=n.className,a=n.autoHideDuration,s=n.disableWindowBlurListener,u=void 0!==s&&s,c=n.onClose,l=n.id,d=n.open,f=n.SnackbarProps,p=void 0===f?{}:f,m=e.useRef(),h=z((function(){c&&c.apply(void 0,arguments)})),x=z((function(n){c&&null!=n&&(m.current&&clearTimeout(m.current),m.current=setTimeout((function(){h(null,"timeout",l)}),n))}));e.useEffect((function(){return d&&x(a),function(){m.current&&clearTimeout(m.current)}}),[d,a,x]);var g=function(){m.current&&clearTimeout(m.current)},v=e.useCallback((function(){null!=a&&x(.5*a)}),[a,x]);return e.useEffect((function(){if(!u&&d)return window.addEventListener("focus",v),window.addEventListener("blur",g),function(){window.removeEventListener("focus",v),window.removeEventListener("blur",g)}}),[u,v,d]),e.createElement("div",Object.assign({ref:t},p,{className:i("notistack-Snackbar",o),onMouseEnter:function(n){p.onMouseEnter&&p.onMouseEnter(n),g()},onMouseLeave:function(n){p.onMouseLeave&&p.onMouseLeave(n),v()}}),r)}));F.displayName="Snackbar";var _=M({root:(B={display:"flex",flexWrap:"wrap",flexGrow:1},B["@media (min-width:600px)"]={flexGrow:"initial",minWidth:"288px"},B)}),X=e.forwardRef((function(n,e){var r=n.className,o=d(n,["className"]);return t.createElement("div",Object.assign({ref:e,className:i(_.root,r)},o))}));X.displayName="SnackbarContent";var Z=M({root:{backgroundColor:"#313131",fontSize:"0.875rem",lineHeight:1.43,letterSpacing:"0.01071em",color:"#fff",alignItems:"center",padding:"6px 16px",borderRadius:"4px",boxShadow:"0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)"},lessPadding:{paddingLeft:"20px"},default:{backgroundColor:"#313131"},success:{backgroundColor:"#43a047"},error:{backgroundColor:"#d32f2f"},warning:{backgroundColor:"#ff9800"},info:{backgroundColor:"#2196f3"},message:{display:"flex",alignItems:"center",padding:"8px 0"},action:{display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:"16px",marginRight:"-8px"}}),Q=e.forwardRef((function(n,e){var r=n.message,o=n.variant,a=n.hideIconVariant,s=n.style,u=n.iconVariant[o],c=n.action;return"function"==typeof c&&(c=c(n.id)),t.createElement(X,{ref:e,role:"alert",style:s,className:i("notistack-MuiContent",Z.root,Z[o],!a&&u&&Z.lessPadding)},t.createElement("div",{id:"notistack-snackbar",className:Z.message},a?null:u,r),c&&t.createElement("div",{className:Z.action},c))}));Q.displayName="MaterialDesignContent";var U,G,Y,J,K,$=e.memo(Q),nn=M({wrappedRoot:{width:"100%",position:"relative",transform:"translateX(0)",top:0,right:0,bottom:0,left:0,minWidth:"288px"}}),en=function(n){var r=e.useRef(),o=e.useState(!0),a=o[0],s=o[1],u=A([n.snack.onClose,n.onClose]),l=e.useCallback((function(){r.current=setTimeout((function(){s((function(n){return!n}))}),125)}),[]);e.useEffect((function(){return function(){r.current&&clearTimeout(r.current)}}),[]);var f,p=n.snack,m=n.classes,h=n.Component,x=void 0===h?$:h,g=e.useMemo((function(){return function(n){void 0===n&&(n={});var e={containerRoot:!0,containerAnchorOriginTopCenter:!0,containerAnchorOriginBottomCenter:!0,containerAnchorOriginTopRight:!0,containerAnchorOriginBottomRight:!0,containerAnchorOriginTopLeft:!0,containerAnchorOriginBottomLeft:!0};return Object.keys(n).filter((function(n){return!e[n]})).reduce((function(e,t){var r;return c({},e,((r={})[t]=n[t],r))}),{})}(m)}),[m]),v=p.open,E=p.SnackbarProps,b=p.TransitionComponent,k=p.TransitionProps,y=p.transitionDuration,C=p.disableWindowBlurListener,S=p.content,w=d(p,["open","SnackbarProps","TransitionComponent","TransitionProps","transitionDuration","disableWindowBlurListener","content","entered","requestClose","onEnter","onEntered","onExit","onExited"]),T=c({direction:(f=w.anchorOrigin,"center"!==f.horizontal?V[f.horizontal]:V[f.vertical]),timeout:y},k),L=S;"function"==typeof L&&(L=L(w.id,w.message));var O=["onEnter","onEntered","onExit","onExited"].reduce((function(e,t){var r;return c({},e,((r={})[t]=A([n.snack[t],n[t]]),r))}),{});return t.createElement(P,{id:w.id,in:a,onExited:O.onExited},t.createElement(F,{open:v,id:w.id,disableWindowBlurListener:C,autoHideDuration:w.autoHideDuration,className:i(nn.wrappedRoot,g.root,g[W(w.anchorOrigin)]),SnackbarProps:E,onClose:u},t.createElement(b,Object.assign({},T,{id:w.id,in:v,onExit:O.onExit,onExited:l,onEnter:O.onEnter,onEntered:A([O.onEntered,function(){n.snack.requestClose&&u(null,"instructed",n.snack.id)}])}),L||t.createElement(x,Object.assign({},w)))))},tn=M({root:(U={boxSizing:"border-box",display:"flex",maxHeight:"100%",position:"fixed",zIndex:1400,height:"auto",width:"auto",transition:S(["top","right","bottom","left","max-width"],{duration:300,easing:"ease"}),pointerEvents:"none"},U[".notistack-CollapseWrapper"]={padding:"6px 0px",transition:"padding 300ms ease 0ms"},U.maxWidth="calc(100% - 40px)",U["@media (max-width:599.95px)"]={width:"100%",maxWidth:"calc(100% - 32px)"},U),rootDense:(G={},G[".notistack-CollapseWrapper"]={padding:"2px 0px"},G),top:{top:"14px",flexDirection:"column"},bottom:{bottom:"14px",flexDirection:"column-reverse"},left:(Y={left:"20px"},Y["@media (min-width:600px)"]={alignItems:"flex-start"},Y["@media (max-width:599.95px)"]={left:"16px"},Y),right:(J={right:"20px"},J["@media (min-width:600px)"]={alignItems:"flex-end"},J["@media (max-width:599.95px)"]={right:"16px"},J),center:(K={left:"50%",transform:"translateX(-50%)"},K["@media (min-width:600px)"]={alignItems:"center"},K)}),rn=e.memo((function(n){var e=n.classes,r=void 0===e?{}:e,o=n.anchorOrigin,a=n.dense,s=n.children,u=i("notistack-SnackbarContainer",tn[o.vertical],tn[o.horizontal],tn.root,r.containerRoot,r["containerAnchorOrigin"+h(o)],a&&tn.rootDense);return t.createElement("div",{className:u},s)})),on=function(n){return"string"!=typeof n},an=function(n){function e(e){var t;return(t=n.call(this,e)||this).enqueueSnackbar=function(n,e){void 0===e&&(e={});var r=on(n)?n:e,o=n;on(n)&&(o=n.message);var a=r.key,s=r.preventDuplicate,u=d(r,["key","preventDuplicate"]),l=x(a),f=l?a:(new Date).getTime()+Math.random(),p=function(n,e){return function(t,r){return void 0===r&&(r=!1),r?c({},H[t],{},e[t],{},n[t]):"autoHideDuration"===t?(o=e.autoHideDuration,(a=function(n){return"number"==typeof n||null===n})(i=n.autoHideDuration)?i:a(o)?o:H.autoHideDuration):"transitionDuration"===t?function(n,e){var t=function(n,e){return e.some((function(e){return typeof n===e}))};return t(n,["string","number"])?n:t(n,["object"])?c({},H.transitionDuration,{},t(e,["object"])&&e,{},n):t(e,["string","number"])?e:t(e,["object"])?c({},H.transitionDuration,{},e):H.transitionDuration}(n.transitionDuration,e.transitionDuration):n[t]||e[t]||H[t];var i,o,a}}(u,t.props),m=c({id:f},u,{message:o,open:!0,entered:!1,requestClose:!1,persist:p("persist"),action:p("action"),content:p("content"),variant:p("variant"),anchorOrigin:p("anchorOrigin"),disableWindowBlurListener:p("disableWindowBlurListener"),autoHideDuration:p("autoHideDuration"),hideIconVariant:p("hideIconVariant"),TransitionComponent:p("TransitionComponent"),transitionDuration:p("transitionDuration"),TransitionProps:p("TransitionProps",!0),iconVariant:p("iconVariant",!0),style:p("style",!0),SnackbarProps:p("SnackbarProps",!0),className:i(t.props.className,u.className)});return m.persist&&(m.autoHideDuration=void 0),t.setState((function(n){if(void 0===s&&t.props.preventDuplicate||s){var e=function(n){return l?n.id===f:n.message===o},r=n.queue.findIndex(e)>-1,i=n.snacks.findIndex(e)>-1;if(r||i)return n}return t.handleDisplaySnack(c({},n,{queue:[].concat(n.queue,[m])}))})),f},t.handleDisplaySnack=function(n){return n.snacks.length>=t.maxSnack?t.handleDismissOldest(n):t.processQueue(n)},t.processQueue=function(n){var e=n.queue;return e.length>0?c({},n,{snacks:[].concat(n.snacks,[e[0]]),queue:e.slice(1,e.length)}):n},t.handleDismissOldest=function(n){if(n.snacks.some((function(n){return!n.open||n.requestClose})))return n;var e=!1,r=!1;n.snacks.reduce((function(n,e){return n+(e.open&&e.persist?1:0)}),0)===t.maxSnack&&(r=!0);var i=n.snacks.map((function(n){return e||n.persist&&!r?c({},n):(e=!0,n.entered?(n.onClose&&n.onClose(null,"maxsnack",n.id),t.props.onClose&&t.props.onClose(null,"maxsnack",n.id),c({},n,{open:!1})):c({},n,{requestClose:!0}))}));return c({},n,{snacks:i})},t.handleEnteredSnack=function(n,e,r){if(!x(r))throw new Error("handleEnteredSnack Cannot be called with undefined key");t.setState((function(n){return{snacks:n.snacks.map((function(n){return n.id===r?c({},n,{entered:!0}):c({},n)}))}}))},t.handleCloseSnack=function(n,e,r){t.props.onClose&&t.props.onClose(n,e,r);var i=void 0===r;t.setState((function(n){var e=n.queue;return{snacks:n.snacks.map((function(n){return i||n.id===r?c({},n,n.entered?{open:!1}:{requestClose:!0}):c({},n)})),queue:e.filter((function(n){return n.id!==r}))}}))},t.closeSnackbar=function(n){var e=t.state.snacks.find((function(e){return e.id===n}));x(n)&&e&&e.onClose&&e.onClose(null,"instructed",n),t.handleCloseSnack(null,"instructed",n)},t.handleExitedSnack=function(n,e){if(!x(e))throw new Error("handleExitedSnack Cannot be called with undefined key");t.setState((function(n){var r=t.processQueue(c({},n,{snacks:n.snacks.filter((function(n){return n.id!==e}))}));return 0===r.queue.length?r:t.handleDismissOldest(r)}))},t.state={snacks:[],queue:[],contextValue:{enqueueSnackbar:t.enqueueSnackbar,closeSnackbar:t.closeSnackbar}},t}return l(e,n),e.prototype.render=function(){var n=this,e=this.state.contextValue,i=this.props,o=i.domRoot,a=i.children,s=i.dense,u=void 0!==s&&s,l=i.Components,d=void 0===l?{}:l,f=i.classes,m=this.state.snacks.reduce((function(n,e){var t,r=h(e.anchorOrigin);return c({},n,((t={})[r]=[].concat(n[r]||[],[e]),t))}),{}),x=Object.keys(m).map((function(e){var r=m[e];return t.createElement(rn,{key:e,dense:u,anchorOrigin:r[0].anchorOrigin,classes:f},r.map((function(e){return t.createElement(en,{key:e.id,snack:e,classes:f,Component:d[e.variant],onClose:n.handleCloseSnack,onEnter:n.props.onEnter,onExit:n.props.onExit,onExited:A([n.handleExitedSnack,n.props.onExited]),onEntered:A([n.handleEnteredSnack,n.props.onEntered])})})))}));return t.createElement(p.Provider,{value:e},a,o?r.createPortal(x,o):x)},u(e,[{key:"maxSnack",get:function(){return this.props.maxSnack||H.maxSnack}}]),e}(e.Component);exports.SnackbarContent=X,exports.SnackbarProvider=an,exports.Transition=g,exports.useSnackbar=function(){return e.useContext(p)},exports.withSnackbar=function(n){var e=t.forwardRef((function(e,r){return t.createElement(p.Consumer,null,(function(i){return t.createElement(n,c({},e,{ref:r,enqueueSnackbar:i.enqueueSnackbar,closeSnackbar:i.closeSnackbar}))}))}));return a(e,n),e}; | ||
//# sourceMappingURL=ee54bh78i.cjs.production.min.js.map |
@@ -62,4 +62,11 @@ import React__default, { useMemo, forwardRef, useRef, useCallback, useEffect, createElement, cloneElement, useLayoutEffect, memo, useState, Component, useContext } from 'react'; | ||
var SnackbarContext = /*#__PURE__*/React__default.createContext(); | ||
var noOp = function noOp() { | ||
return ''; | ||
}; | ||
var SnackbarContext = /*#__PURE__*/React__default.createContext({ | ||
enqueueSnackbar: noOp, | ||
closeSnackbar: noOp | ||
}); | ||
var breakpoints = { | ||
@@ -163,3 +170,3 @@ downXs: '@media (max-width:599.95px)', | ||
if (timeout != null && typeof timeout !== 'number') { | ||
if (timeout != null && typeof timeout !== 'number' && typeof timeout !== 'string') { | ||
exit = timeout.exit; | ||
@@ -208,3 +215,5 @@ enter = timeout.enter; | ||
}, function () { | ||
_this2.props.onEntered(_this2.node, isAppearing, id); | ||
if (_this2.props.onEntered) { | ||
_this2.props.onEntered(_this2.node, isAppearing, id); | ||
} | ||
}); | ||
@@ -214,7 +223,12 @@ return; | ||
this.props.onEnter(this.node, isAppearing, id); | ||
if (this.props.onEnter) { | ||
this.props.onEnter(this.node, isAppearing, id); | ||
} | ||
this.safeSetState({ | ||
status: ENTERING | ||
}, function () { | ||
_this2.props.onEntering(_this2.node, isAppearing, id); | ||
if (_this2.props.onEntering) { | ||
_this2.props.onEntering(_this2.node, isAppearing, id); | ||
} | ||
@@ -225,3 +239,5 @@ _this2.onTransitionEnd(timeouts.enter, function () { | ||
}, function () { | ||
_this2.props.onEntered(_this2.node, isAppearing, id); | ||
if (_this2.props.onEntered) { | ||
_this2.props.onEntered(_this2.node, isAppearing, id); | ||
} | ||
}); | ||
@@ -244,3 +260,5 @@ }); | ||
}, function () { | ||
_this3.props.onExited(_this3.node, id); | ||
if (_this3.props.onExited) { | ||
_this3.props.onExited(_this3.node, id); | ||
} | ||
}); | ||
@@ -250,7 +268,12 @@ return; | ||
this.props.onExit(this.node, id); | ||
if (this.props.onExit) { | ||
this.props.onExit(this.node, id); | ||
} | ||
this.safeSetState({ | ||
status: EXITING | ||
}, function () { | ||
_this3.props.onExiting(_this3.node, id); | ||
if (_this3.props.onExiting) { | ||
_this3.props.onExiting(_this3.node, id); | ||
} | ||
@@ -261,3 +284,5 @@ _this3.onTransitionEnd(timeouts.exit, function () { | ||
}, function () { | ||
_this3.props.onExited(_this3.node, id); | ||
if (_this3.props.onExited) { | ||
_this3.props.onExited(_this3.node, id); | ||
} | ||
}); | ||
@@ -269,3 +294,3 @@ }); | ||
_proto.cancelNextCallback = function cancelNextCallback() { | ||
if (this.nextCallback !== null) { | ||
if (this.nextCallback !== null && this.nextCallback.cancel) { | ||
this.nextCallback.cancel(); | ||
@@ -286,7 +311,7 @@ this.nextCallback = null; | ||
this.nextCallback = function (event) { | ||
this.nextCallback = function () { | ||
if (active) { | ||
active = false; | ||
_this4.nextCallback = null; | ||
callback(event); | ||
callback(); | ||
} | ||
@@ -350,3 +375,4 @@ }; | ||
function noop() {} | ||
function noop() {// | ||
} | ||
@@ -406,4 +432,2 @@ Transition.defaultProps = { | ||
function getTransitionProps(props) { | ||
var _style$transitionDura; | ||
var timeout = props.timeout, | ||
@@ -414,3 +438,3 @@ _props$style = props.style, | ||
return { | ||
duration: (_style$transitionDura = style.transitionDuration) !== null && _style$transitionDura !== void 0 ? _style$transitionDura : typeof timeout === 'object' ? timeout[mode] || 0 : timeout, | ||
duration: typeof timeout === 'object' ? timeout[mode] || 0 : timeout, | ||
easing: style.transitionTimingFunction, | ||
@@ -441,3 +465,3 @@ delay: style.transitionDelay | ||
// We have to do something with node.scrollTop. | ||
// Otherwise it removed from the compiled code by optimisers | ||
// Otherwise it's removed from the compiled code by optimisers | ||
// eslint-disable-next-line no-self-assign | ||
@@ -501,2 +525,3 @@ node.scrollTop = node.scrollTop; | ||
var later = function later() { | ||
// @ts-ignore | ||
func.apply(_this, args); | ||
@@ -1541,2 +1566,3 @@ }; | ||
return _extends({}, state, { | ||
// @ts-ignore | ||
snacks: [].concat(snacks, [queue[0]]), | ||
@@ -1871,3 +1897,3 @@ queue: queue.slice(1, queue.length) | ||
export { ENTERED, ENTERING, EXITED, EXITING, SnackbarContent, SnackbarProvider, Transition, UNMOUNTED, useSnackbar, withSnackbar }; | ||
export { SnackbarContent, SnackbarProvider, Transition, useSnackbar, withSnackbar }; | ||
//# sourceMappingURL=ee54bh78i.esm.js.map |
@@ -43,4 +43,13 @@ import * as React from 'react'; | ||
type TransitionComponent = React.JSXElementConstructor<TransitionProps & { children: React.ReactElement<any, any> }>; | ||
export type TransitionStatus = 'entering' | 'entered' | 'exiting' | 'exited' | 'unmounted'; | ||
export interface CustomTransitionProps extends Omit<TransitionProps, 'children'> { | ||
children: (status: TransitionStatus, childProps: Record<string, any>) => React.ReactNode; | ||
nodeRef: React.RefObject<HTMLDivElement>; | ||
appear?: boolean; | ||
addEndListener?: (node: HTMLDivElement, callback: () => void) => void; | ||
onEntering?: TransitionEnterHandler; | ||
onExiting?: TransitionExitHandler; | ||
} | ||
/** | ||
@@ -83,3 +92,3 @@ * @category Shared | ||
*/ | ||
timeout?: number | TransitionDuration | 'auto'; | ||
timeout?: number | TransitionDuration; | ||
/** | ||
@@ -200,13 +209,7 @@ * Enable or disable enter transitions. | ||
/** | ||
* The component used for the transition. notistack supports 4 transitions | ||
* out of the box. You can also create your own transitions using react-transition-group. | ||
* ```jsx | ||
* import { Fade } from 'notistack'; | ||
* import { Grow } from 'notistack'; | ||
* import { Slide } from 'notistack'; | ||
* import { Zoom } from 'notistack'; | ||
* ``` | ||
* The component used for the transition. See how you can use a different transition: | ||
* https://notistack.com/examples/advanced/custom-transition | ||
* @default Slide | ||
*/ | ||
TransitionComponent?: TransitionComponent; | ||
TransitionComponent?: React.JSXElementConstructor<TransitionProps & { children: React.ReactElement<any, any> }>; | ||
/** | ||
@@ -223,6 +226,2 @@ * The duration for the transition, in milliseconds. | ||
* ``` | ||
* or auto-adjust based on dimensions of the snackbar (Only applicable if TransitionComponent is Grow) | ||
* ```js | ||
* transitionDuration="auto" | ||
* ``` | ||
* @default { enter: 225, exit: 195 } | ||
@@ -421,5 +420,2 @@ */ | ||
export declare const Slide: TransitionComponent; | ||
export declare const Grow: TransitionComponent; | ||
export declare const Fade: TransitionComponent; | ||
export declare const Zoom: TransitionComponent; | ||
export declare const Transition: React.JSXElementConstructor<CustomTransitionProps>; |
{ | ||
"name": "ee54bh78i", | ||
"version": "3.0.0-alpha.9", | ||
"version": "3.0.0-alpha.10", | ||
"description": "", | ||
"main": "./index.js", | ||
"module": "./ee54bh78i.esm.js", | ||
"module": "./notistack.esm.js", | ||
"types": "./index.d.ts", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "tsdx build --transpileOnly --entry ./src/index.js", | ||
"build": "tsdx build --entry ./src/index.js", | ||
"watch": "tsdx watch --transpileOnly --entry ./src/index.js", | ||
"docs": "rimraf typedoc.json && typedoc --tsconfig", | ||
"lint": "eslint . --ext .js,.jsx,.ts,.tsx", | ||
"prerelease": "npm run build && npm run postversion", | ||
"postversion": "cp package.json dist", | ||
"copy": "cp package.json README.md LICENSE.md dist", | ||
"prerelease": "npm run build && npm run copy", | ||
"postversion": "npm run copy", | ||
"release:alpha": "np --tag alpha" | ||
@@ -17,0 +18,0 @@ }, |
Sorry, the diff of this file is not supported yet
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
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
465585
3686