Comparing version 3.0.0-alpha.1 to 3.0.0-alpha.5
@@ -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 u(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 s(n,e,t){return e&&u(n.prototype,e),t&&u(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"]))},s(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 g(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,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:v,onEntering:v,onEntered:v,onExit:v,onExiting:v,onExited:v};var b=function(n){return Math.round(n)+"ms"};function y(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,u=t.delay,s=void 0===u?0:u;return(Array.isArray(n)?n:[n]).map((function(n){var e="string"==typeof i?i:b(i),t="string"==typeof s?s:b(s);return n+" "+e+" "+a+" "+t})).join(",")}function C(n){return n&&n.ownerDocument||document}function w(n){return C(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,u=0;if(t&&"none"!==t&&"string"==typeof t){var s=t.split("(")[1].split(")")[0].split(",");a=parseInt(s[4],10),u=parseInt(s[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+u-r.top)+"px)";default:return"translateY(-"+(r.top+r.height-u)+"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,u=n.style,s=n.timeout,l=void 0===s?0:s,f=n.onEnter,p=n.onEntered,m=n.onExit,h=n.onExited,v=d(n,["children","direction","in","style","timeout","onEnter","onEntered","onExit","onExited"]),E=e.useRef(null),b=g(r.ref,E),C=g(b,t),L=e.useCallback((function(){E.current&&S(o,E.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 u=function(){n.apply(r,o)};clearTimeout(t),t=setTimeout(u,e)}return void 0===e&&(e=166),r.clear=function(){clearTimeout(t)},r}((function(){E.current&&S(o,E.current)})),e=w(E.current);return e.addEventListener("resize",n),function(){n.clear(),e.removeEventListener("resize",n)}}}),[o,a]),e.useEffect((function(){a||L()}),[a,L]),e.createElement(x,Object.assign({appear:!0,nodeRef:E,onEnter:function(n,e,t){S(o,n),function(n){n.scrollTop=n.scrollTop}(n),f&&f(n,e,t)},onEntered:p,onEntering:function(n){var e=k({timeout:l,mode:"enter",style:c({},u,{transitionTimingFunction:(null==u?void 0:u.transitionTimingFunction)||"cubic-bezier(0.0, 0, 0.2, 1)"})});n.style.webkitTransition=y("-webkit-transform",e),n.style.transition=y("transform",e),n.style.webkitTransform="none",n.style.transform="none"},onExit:function(n,e){var t=k({timeout:l,mode:"exit",style:c({},u,{transitionTimingFunction:(null==u?void 0:u.transitionTimingFunction)||"cubic-bezier(0.4, 0, 0.6, 1)"})});n.style.webkitTransition=y("-webkit-transform",t),n.style.transition=y("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},v),(function(n,t){return e.cloneElement(r,c({ref:C,style:c({visibility:"exited"!==n||a?void 0:"hidden"},u,{},r.props.style)},t))}))})),T=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(T,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"}))},D=function(){return t.createElement(T,null,t.createElement("path",{d:"M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"}))},R=function(){return t.createElement(T,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"}))},H=function(){return t.createElement(T,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(D,null),error:t.createElement(R,null),info:t.createElement(H,null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},TransitionComponent:L,transitionDuration:{enter:225,exit:195}};function M(n){if(!n)return 0;var e=n/36;return Math.round(10*(4+15*Math.pow(e,.25)+e/5))}function P(n){return Object.entries(n).reduce((function(n,e){var t;return c({},n,((t={})[e[0]]=o.css(e[1]),t))}),{})}var j=P({root:{height:0},entered:{height:"auto"}}),N=e.forwardRef((function(n,t){var r=n.children,o=n.style,a=n.timeout,u=void 0===a?300:a,s=n.in,l=n.onEnter,f=n.onEntered,p=n.onExit,m=n.onExited,h=d(n,["children","style","timeout","in","onEnter","onEntered","onExit","onExited","direction"]),v=e.useRef(),E=e.useRef(null),b=e.useRef();e.useEffect((function(){return function(){v.current&&clearTimeout(v.current)}}),[]);var C=e.useRef(null),w=g(t,C),S=function(){return E.current?E.current.clientHeight:0};return e.createElement(x,Object.assign({in:s,onEnter:function(n,e,t){n.style.height="0px",l&&l(n,e,t)},onEntered:function(n,e,t){n.style.height="auto",f&&f(n,e,t)},onEntering:function(n){var e=S(),t=k({style:o,timeout:u,mode:"enter"}),r=t.duration,i=t.easing;if("auto"===u){var a=M(e);n.style.transitionDuration=a+"ms",b.current=a}else n.style.transitionDuration="string"==typeof r?r:r+"ms";n.style.height=e+"px",n.style.transitionTimingFunction=i||""},onExit:function(n,e){n.style.height=S()+"px",p&&p(n,e)},onExited:m,onExiting:function(n){var e=S(),t=k({style:o,timeout:u,mode:"exit"}),r=t.duration,i=t.easing;if("auto"===u){var a=M(e);n.style.transitionDuration=a+"ms",b.current=a}else n.style.transitionDuration="string"==typeof r?r:r+"ms";n.style.height="0px",n.style.transitionTimingFunction=i||""},addEndListener:function(n){"auto"===u&&(v.current=setTimeout(n,b.current||0))},nodeRef:C,timeout:"auto"===u?null:u},h),(function(n,t){return e.createElement("div",Object.assign({ref:w,className:i(j.root,"entered"===n&&j.entered),style:c({pointerEvents:"all",overflow:"hidden",minHeight:"0px",transition:y("height")},"entered"===n&&{overflow:"visible"},{},"exited"===n&&!s&&{visibility:"hidden"},{},o)},t),e.createElement("div",{ref:E,className:"notistack-CollapseWrapper",style:{display:"flex"}},e.createElement("div",{style:{width:"100%"}},r)))}))})),A={right:"left",left:"right",bottom:"up",top:"down"},W=function(n){return"anchorOrigin"+m(n)};function V(n,e){return n.reduce((function(n,t){return null==t?n:function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];var a=[].concat(i);e&&-1===a.indexOf(e)&&a.push(e),n.apply(this,a),t.apply(this,a)}}),(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)}),[])}function B(n){return n.substring(2).toLowerCase()}function F(n){var t=n.children,r=n.onClickAway,i=e.useRef(!1),o=e.useRef(null),a=e.useRef(!1),u=e.useRef(!1);e.useEffect((function(){return setTimeout((function(){a.current=!0}),0),function(){a.current=!1}}),[]);var s=g(t.ref,o),c=z((function(n){var e=u.current;u.current=!1;var t=C(o.current);!a.current||!o.current||"clientX"in n&&function(n,e){return e.documentElement.clientWidth<n.clientX||e.documentElement.clientHeight<n.clientY}(n,t)||(i.current?i.current=!1:(n.composedPath?n.composedPath().indexOf(o.current)>-1:!t.documentElement.contains(n.target)||o.current.contains(n.target))||e||r(n))})),l=function(n){return function(e){u.current=!0;var r=t.props[n];r&&r(e)}},d={ref:s};return d.onTouchEnd=l("onTouchEnd"),e.useEffect((function(){var n=B("onTouchEnd"),e=C(o.current),t=function(){i.current=!0};return e.addEventListener(n,c),e.addEventListener("touchmove",t),function(){e.removeEventListener(n,c),e.removeEventListener("touchmove",t)}}),[c,"onTouchEnd"]),d.onClick=l("onClick"),e.useEffect((function(){var n=B("onClick"),e=C(o.current);return e.addEventListener(n,c),function(){e.removeEventListener(n,c)}}),[c,"onClick"]),e.createElement(e.Fragment,null,e.cloneElement(t,d))}var X,_,Z,Q,U,Y,G=e.forwardRef((function(n,t){var r=n.children,o=n.className,a=n.autoHideDuration,u=n.disableWindowBlurListener,s=void 0!==u&&u,c=n.onClose,l=n.open,d=n.SnackbarProps,f=void 0===d?{}:d,p=e.useRef(),m=z((function(n){c&&c.apply(void 0,n)})),h=z((function(n){c&&null!=n&&(p.current&&clearTimeout(p.current),p.current=setTimeout((function(){m(null,"timeout")}),n))}));e.useEffect((function(){return l&&h(a),function(){p.current&&clearTimeout(p.current)}}),[l,a,h]);var x=function(){p.current&&clearTimeout(p.current)},v=e.useCallback((function(){null!=a&&h(.5*a)}),[a,h]);return e.useEffect((function(){if(!s&&l)return window.addEventListener("focus",v),window.addEventListener("blur",x),function(){window.removeEventListener("focus",v),window.removeEventListener("blur",x)}}),[s,v,l]),e.createElement(F,{onClickAway:function(n){c&&c(n,"clickaway")}},e.createElement("div",Object.assign({ref:t},f,{className:i("notistack-Snackbar",o),onMouseEnter:function(n){f.onMouseEnter&&f.onMouseEnter(n),x()},onMouseLeave:function(n){f.onMouseLeave&&f.onMouseLeave(n),v()}}),r))})),J=P({root:(X={display:"flex",flexWrap:"wrap",flexGrow:1},X["@media (min-width:600px)"]={flexGrow:"initial",minWidth:"288px"},X)}),K=e.forwardRef((function(n,e){var r=n.className,o=d(n,["className"]);return t.createElement("div",Object.assign({ref:e,className:i(J.root,r)},o))})),$=P({root:{backgroundColor:"#313131",fontFamily:'"Roboto", "Helvetica", "Arial", sans-serif',fontWeight:400,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"}}),nn=e.memo(e.forwardRef((function(n,e){var r=n.message,o=n.variant,a=n.hideIconVariant,u=n.style,s=n.iconVariant[o],c=n.action;return"function"==typeof c&&(c=c(n.id)),t.createElement(K,{ref:e,role:"alert",style:u,className:i("notistack-MuiContent",$.root,$[o],!a&&s&&$.lessPadding)},t.createElement("div",{id:"notistack-snackbar",className:$.message},a?null:s,r),c&&t.createElement("div",{className:$.action},c))}))),en=P({wrappedRoot:{position:"relative",transform:"translateX(0)",top:0,right:0,bottom:0,left:0,minWidth:"288px"}}),tn=function(n){var r=e.useRef(),o=e.useState(!0),a=o[0],u=o[1],s=V([n.snack.onClose,n.onClose],n.snack.id),l=e.useCallback((function(){r.current=setTimeout((function(){u((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?nn:h,v=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]),E=p.open,g=p.SnackbarProps,k=p.TransitionComponent,b=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"]),L=c({direction:(f=S.anchorOrigin,"center"!==f.horizontal?A[f.horizontal]:A[f.vertical]),timeout:y},b),T=w;"function"==typeof T&&(T=T(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(N,{id:S.id,unmountOnExit:!0,timeout:175,in:a,onExited:O.onExited},t.createElement(G,{open:E,disableWindowBlurListener:C,autoHideDuration:S.autoHideDuration,className:i(en.wrappedRoot,v.root,v[W(S.anchorOrigin)]),SnackbarProps:g,onClose:s},t.createElement(k,Object.assign({},L,{id:S.id,in:E,onExit:O.onExit,onExited:l,onEnter:O.onEnter,onEntered:V([O.onEntered,function(){n.snack.requestClose&&s(null,"instructed")}])}),T||t.createElement(x,Object.assign({},S)))))},rn=P({root:(_={boxSizing:"border-box",display:"flex",maxHeight:"100%",position:"fixed",zIndex:1400,height:"auto",width:"auto",transition:y(["top","right","bottom","left","max-width"],{duration:300,easing:"ease"}),pointerEvents:"none"},_[".notistack-CollapseWrapper"]={padding:"6px 0px",transition:"padding 300ms ease 0ms"},_.maxWidth="calc(100% - 40px)",_["@media (max-width:599.95px)"]={width:"100%",maxWidth:"calc(100% - 32px)"},_),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:(U={right:"20px"},U["@media (min-width:600px)"]={alignItems:"flex-end"},U["@media (max-width:599.95px)"]={right:"16px"},U),center:(Y={left:"50%",transform:"translateX(-50%)"},Y["@media (min-width:600px)"]={alignItems:"center"},Y)}),on=e.memo((function(n){var e=n.classes,r=void 0===e?{}:e,o=n.anchorOrigin,a=n.dense,u=n.children,s=i("notistack-SnackbarContainer",rn[o.vertical],rn[o.horizontal],rn.root,r.containerRoot,r["containerAnchorOrigin"+m(o)],a&&rn.rootDense);return t.createElement("div",{className:s},u)})),an=function(n){return"string"!=typeof n},un=function(n){function e(e){var t;return(t=n.call(this,e)||this).enqueueSnackbar=function(n,e){void 0===e&&(e={});var r=an(n)?n:e,o=n;an(n)&&(o=n.message);var a=r.key,u=r.preventDuplicate,s=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}}(s,t.props),m=c({id:f},s,{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,s.className)});return m.persist&&(m.autoHideDuration=void 0),t.setState((function(n){if(void 0===u&&t.props.preventDuplicate||u){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){if(t.props.onClose&&t.props.onClose(n,e,r),"clickaway"!==e){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,u=i.dense,s=void 0!==u&&u,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(on,{key:e,dense:s,anchorOrigin:r[0].anchorOrigin,classes:p},r.map((function(e){return t.createElement(tn,{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)},s(e,[{key:"maxSnack",get:function(){return this.props.maxSnack||q.maxSnack}}]),e}(e.Component);exports.SnackbarContent=K,exports.SnackbarProvider=un,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=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 E(){}function v(n,e){"function"==typeof n?n(e):n&&(n.current=e)}function g(n,t){return e.useMemo((function(){return null==n&&null==t?null:function(e){v(n,e),v(t,e)}}),[n,t])}function y(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:E,onEntering:E,onEntered:E,onExit:E,onExiting:E,onExited:E};var b=function(n){n.scrollTop=n.scrollTop},k=function(n){return Math.round(n)+"ms"};function w(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:k(i),t="string"==typeof u?u:k(u);return n+" "+e+" "+a+" "+t})).join(",")}function C(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=C(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,E=d(n,["children","direction","in","style","timeout","onEnter","onEntered","onExit","onExited"]),v=e.useRef(null),k=g(r.ref,v),T=g(k,t),O=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=C(v.current);return e.addEventListener("resize",n),function(){n.clear(),e.removeEventListener("resize",n)}}}),[o,a]),e.useEffect((function(){a||O()}),[a,O]),e.createElement(x,Object.assign({appear:!0,nodeRef:v,onEnter:function(n,e,t){S(o,n),b(n),f&&f(n,e,t)},onEntered:p,onEntering:function(n){var e=y({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=w("-webkit-transform",e),n.style.transition=w("transform",e),n.style.webkitTransform="none",n.style.transform="none"},onExit:function(n,e){var t=y({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=w("-webkit-transform",t),n.style.transition=w("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},E),(function(n,t){return e.cloneElement(r,c({ref:T,style:c({visibility:"exited"!==n||a?void 0:"hidden"},s,{},r.props.style)},t))}))})),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))},L=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"}))},D=function(){return t.createElement(O,null,t.createElement("path",{d:"M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"}))},R=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"}))},j=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(L,null),warning:t.createElement(D,null),error:t.createElement(R,null),info:t.createElement(j,null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},TransitionComponent:T,transitionDuration:{enter:225,exit:195}};function M(n){if(!n)return 0;var e=n/36;return Math.round(10*(4+15*Math.pow(e,.25)+e/5))}function q(n){return Object.entries(n).reduce((function(n,e){var t;return c({},n,((t={})[e[0]]=o.css(e[1]),t))}),{})}var P=q({root:{height:0},entered:{height:"auto"}}),N=e.forwardRef((function(n,t){var r=n.children,o=n.style,a=n.timeout,s=void 0===a?300:a,u=n.in,l=n.onEnter,f=n.onEntered,p=n.onExit,m=n.onExited,h=d(n,["children","style","timeout","in","onEnter","onEntered","onExit","onExited","direction"]),E=e.useRef(),v=e.useRef(null),b=e.useRef();e.useEffect((function(){return function(){E.current&&clearTimeout(E.current)}}),[]);var k=e.useRef(null),C=g(t,k),S=function(){return v.current?v.current.clientHeight:0};return e.createElement(x,Object.assign({in:u,onEnter:function(n,e,t){n.style.height="0px",l&&l(n,e,t)},onEntered:function(n,e,t){n.style.height="auto",f&&f(n,e,t)},onEntering:function(n){var e=S(),t=y({style:o,timeout:s,mode:"enter"}),r=t.duration,i=t.easing;if("auto"===s){var a=M(e);n.style.transitionDuration=a+"ms",b.current=a}else n.style.transitionDuration="string"==typeof r?r:r+"ms";n.style.height=e+"px",n.style.transitionTimingFunction=i||""},onExit:function(n,e){n.style.height=S()+"px",p&&p(n,e)},onExited:m,onExiting:function(n){var e=S(),t=y({style:o,timeout:s,mode:"exit"}),r=t.duration,i=t.easing;if("auto"===s){var a=M(e);n.style.transitionDuration=a+"ms",b.current=a}else n.style.transitionDuration="string"==typeof r?r:r+"ms";n.style.height="0px",n.style.transitionTimingFunction=i||""},addEndListener:function(n){"auto"===s&&(E.current=setTimeout(n,b.current||0))},nodeRef:k,timeout:"auto"===s?null:s},h),(function(n,t){return e.createElement("div",Object.assign({ref:C,className:i(P.root,"entered"===n&&P.entered),style:c({pointerEvents:"all",overflow:"hidden",minHeight:"0px",transition:w("height")},"entered"===n&&{overflow:"visible"},{},"exited"===n&&!u&&{visibility:"hidden"},{},o)},t),e.createElement("div",{ref:v,className:"notistack-CollapseWrapper",style:{display:"flex"}},e.createElement("div",{style:{width:"100%"}},r)))}))})),V={right:"left",left:"right",bottom:"up",top:"down"},W=function(n){return"anchorOrigin"+m(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,_,Z,X,G,Q=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 E=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",E),function(){window.removeEventListener("focus",v),window.removeEventListener("blur",E)}}),[u,v,d]),e.createElement("div",Object.assign({ref:t},p,{className:i("notistack-Snackbar",o),onMouseEnter:function(n){p.onMouseEnter&&p.onMouseEnter(n),E()},onMouseLeave:function(n){p.onMouseLeave&&p.onMouseLeave(n),v()}}),r)})),U=q({root:(B={display:"flex",flexWrap:"wrap",flexGrow:1},B["@media (min-width:600px)"]={flexGrow:"initial",minWidth:"288px"},B)}),Y=e.forwardRef((function(n,e){var r=n.className,o=d(n,["className"]);return t.createElement("div",Object.assign({ref:e,className:i(U.root,r)},o))})),J=q({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"}}),K=e.memo(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(Y,{ref:e,role:"alert",style:s,className:i("notistack-MuiContent",J.root,J[o],!a&&u&&J.lessPadding)},t.createElement("div",{id:"notistack-snackbar",className:J.message},a?null:u,r),c&&t.createElement("div",{className:J.action},c))}))),$=q({wrappedRoot:{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=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?K:h,E=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,g=p.SnackbarProps,y=p.TransitionComponent,b=p.TransitionProps,k=p.transitionDuration,w=p.disableWindowBlurListener,C=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?V[f.horizontal]:V[f.vertical]),timeout:k},b),O=C;"function"==typeof O&&(O=O(S.id,S.message));var L=["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(N,{id:S.id,unmountOnExit:!0,timeout:175,in:a,onExited:L.onExited},t.createElement(Q,{open:v,id:S.id,disableWindowBlurListener:w,autoHideDuration:S.autoHideDuration,className:i($.wrappedRoot,E.root,E[W(S.anchorOrigin)]),SnackbarProps:g,onClose:u},t.createElement(y,Object.assign({},T,{id:S.id,in:v,onExit:L.onExit,onExited:l,onEnter:L.onEnter,onEntered:A([L.onEntered,function(){n.snack.requestClose&&u(null,"instructed",n.snack.id)}])}),O||t.createElement(x,Object.assign({},S)))))},en=q({root:(F={boxSizing:"border-box",display:"flex",maxHeight:"100%",position:"fixed",zIndex:1400,height:"auto",width:"auto",transition:w(["top","right","bottom","left","max-width"],{duration:300,easing:"ease"}),pointerEvents:"none"},F[".notistack-CollapseWrapper"]={padding:"6px 0px",transition:"padding 300ms ease 0ms"},F.maxWidth="calc(100% - 40px)",F["@media (max-width:599.95px)"]={width:"100%",maxWidth:"calc(100% - 32px)"},F),rootDense:(_={},_[".notistack-CollapseWrapper"]={padding:"2px 0px"},_),top:{top:"14px",flexDirection:"column"},bottom:{bottom:"14px",flexDirection:"column-reverse"},left:(Z={left:"20px"},Z["@media (min-width:600px)"]={alignItems:"flex-start"},Z["@media (max-width:599.95px)"]={left:"16px"},Z),right:(X={right:"20px"},X["@media (min-width:600px)"]={alignItems:"flex-end"},X["@media (max-width:599.95px)"]={right:"16px"},X),center:(G={left:"50%",transform:"translateX(-50%)"},G["@media (min-width:600px)"]={alignItems:"center"},G)}),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({},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(!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){if(t.props.onClose&&t.props.onClose(n,e,r),"clickaway"!==e){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:A([n.handleExitedSnack,n.props.onExited]),onEntered:A([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||H.maxSnack}}]),e}(e.Component),an={entering:{opacity:1},entered:{opacity:1}},sn=e.forwardRef((function(n,t){var r=n.children,i=n.in,o=n.timeout,a=void 0===o?0:o,s=n.style,u=n.onEnter,l=n.onEntered,f=n.onExit,p=n.onExited,m=d(n,["children","in","timeout","style","onEnter","onEntered","onExit","onExited","direction"]),h=e.useRef(null),E=g(r.ref,t),v=g(h,E);return e.createElement(x,Object.assign({appear:!0,in:i,nodeRef:h,onEnter:function(n,e,t){b(n);var r=y({style:s,timeout:a,mode:"enter"});n.style.webkitTransition=w("opacity",r),n.style.transition=w("opacity",r),u&&u(n,e,t)},onEntered:l,onExit:function(n,e){var t=y({style:s,timeout:a,mode:"exit"});n.style.webkitTransition=w("opacity",t),n.style.transition=w("opacity",t),f&&f(n,e)},onExited:p,timeout:a},m),(function(n,t){return e.cloneElement(r,c({style:c({opacity:0,visibility:"exited"!==n||i?void 0:"hidden"},an[n],{},s,{},r.props.style),ref:v},t))}))}));function un(n){return"scale("+n+", "+Math.pow(n,2)+")"}var cn={entering:{opacity:1,transform:un(1)},entered:{opacity:1,transform:"none"}},ln=e.forwardRef((function(n,t){var r=n.children,i=n.in,o=n.style,a=n.timeout,s=void 0===a?"auto":a,u=n.onEnter,l=n.onEntered,f=n.onExit,p=n.onExited,m=d(n,["children","in","style","timeout","onEnter","onEntered","onExit","onExited"]),h=e.useRef(),E=e.useRef(),v=e.useRef(null),k=g(r.ref,v),C=g(k,t);return e.useEffect((function(){return function(){h.current&&clearTimeout(h.current)}}),[]),e.createElement(x,Object.assign({appear:!0,in:i,nodeRef:v,onEnter:function(n,e,t){b(n);var r=y({style:o,timeout:s,mode:"enter"}),i=r.delay,a=r.easing,c=r.duration;"string"==typeof c&&(c=M(n.clientHeight),E.current=c),n.style.transition=[w("opacity",{duration:c,delay:i}),w("transform",{delay:i,easing:a,duration:.666*c})].join(","),u&&u(n,e,t)},onEntered:l,onExit:function(n,e){var t=y({style:o,timeout:s,mode:"exit"}),r=t.delay,i=t.easing,a=t.duration;"string"==typeof a&&(a=M(n.clientHeight),E.current=a),n.style.transition=[w("opacity",{duration:a,delay:r}),w("transform",{easing:i,duration:.666*a,delay:r||.333*a})].join(","),n.style.opacity="0",n.style.transform=un(.75),f&&f(n,e)},onExited:p,addEndListener:function(n){"auto"===s&&(h.current=setTimeout(n,E.current||0))},timeout:"auto"===s?null:s},m),(function(n,t){return e.cloneElement(r,c({style:c({opacity:0,transform:un(.75),visibility:"exited"!==n||i?void 0:"hidden"},cn[n],{},o,{},r.props.style),ref:C},t))}))})),dn={entering:{transform:"none"},entered:{transform:"none"}},fn=e.forwardRef((function(n,t){var r=n.children,i=n.in,o=n.style,a=n.timeout,s=void 0===a?0:a,u=n.onEnter,l=n.onEntered,f=n.onExit,p=n.onExited,m=d(n,["children","in","style","timeout","onEnter","onEntered","onExit","onExited","direction"]),h=e.useRef(null),E=g(r.ref,t),v=g(h,E);return e.createElement(x,Object.assign({appear:!0,in:i,nodeRef:h,onEnter:function(n,e,t){b(n);var r=y({style:o,timeout:s,mode:"enter"});n.style.webkitTransition=w("transform",r),n.style.transition=w("transform",r),u&&u(n,e,t)},onEntered:l,onExit:function(n,e){var t=y({style:o,timeout:s,mode:"exit"});n.style.webkitTransition=w("transform",t),n.style.transition=w("transform",t),f&&f(n,e)},onExited:p,timeout:s},m),(function(n,t){return e.cloneElement(r,c({style:c({transform:"scale(0)",visibility:"exited"!==n||i?void 0:"hidden"},dn[n],{},o,{},r.props.style),ref:v},t))}))}));exports.Fade=sn,exports.Grow=ln,exports.Slide=T,exports.SnackbarContent=Y,exports.SnackbarProvider=on,exports.Zoom=fn,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}; | ||
//# sourceMappingURL=ee54bh78i.cjs.production.min.js.map |
171
index.d.ts
import * as React from 'react'; | ||
export interface TransitionDuration { enter?: number, exit?: number } | ||
export type RequiredBy<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>; | ||
/** | ||
* type MyType = { | ||
* a: string | ||
* b: never | ||
* } | ||
* | ||
* OmitNever<MyType> --> { a: string } | ||
*/ | ||
type OmitNever<T> = Pick< | ||
T, | ||
{ | ||
[Prop in keyof T]: [T[Prop]] extends [never] ? never : Prop; | ||
}[keyof T] | ||
>; | ||
/** | ||
* type Type1 = { a: string; b: number } | ||
* type Type2 = { b: boolean; c: string } | ||
* | ||
* Override<Type1, Type2> --> { | ||
* a: string | ||
* b: boolean | ||
* c: string | ||
* } | ||
*/ | ||
type Override<T, U> = Omit<T, keyof U> & U; | ||
type MarkInvalidVariantAsNever<T> = { | ||
[Key in keyof T]: T[Key] extends true ? T[Key] : T[Key] extends Record<string, unknown> ? T[Key] : never; | ||
}; | ||
type GetWhitelistedVariants<V extends string, U> = OmitNever<MarkInvalidVariantAsNever<Override<Record<V, true>, U>>>; | ||
export interface TransitionDuration { | ||
enter?: number; | ||
exit?: number; | ||
} | ||
type TransitionComponent = React.JSXElementConstructor<TransitionProps & { children: React.ReactElement<any, any> }>; | ||
/** | ||
* @category Shared | ||
@@ -31,2 +71,7 @@ */ | ||
/** | ||
* Id/key of the snackbar this transition belongs to. Used in transition callbacks | ||
* (e.g. onExited) to identify which snackbar has exited. | ||
*/ | ||
id: SnackbarKey; | ||
/** | ||
* Show the component; triggers the enter or exit states | ||
@@ -74,7 +119,14 @@ */ | ||
type RequiredBy<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>> | ||
export type ClassNameMap<ClassKey extends string = string> = Record<ClassKey, string>; | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
interface VariantOverrides {} | ||
type VariantMap = GetWhitelistedVariants<BaseVariant, VariantOverrides>; | ||
type BaseVariant = 'default' | 'error' | 'success' | 'warning' | 'info'; | ||
export type VariantType = keyof VariantMap; | ||
export type SnackbarKey = string | number; | ||
export type VariantType = 'default' | 'error' | 'success' | 'warning' | 'info'; | ||
export type CloseReason = 'timeout' | 'clickaway' | 'maxsnack' | 'instructed'; | ||
@@ -84,11 +136,14 @@ | ||
export type SnackbarAction = React.ReactNode | ((key: SnackbarKey) => React.ReactNode); | ||
export type SnackbarContentCallback = React.ReactNode | ((key: SnackbarKey, message: SnackbarMessage) => React.ReactNode); | ||
export type SnackbarContentCallback = | ||
| React.ReactNode | ||
| ((key: SnackbarKey, message?: SnackbarMessage) => React.ReactNode); | ||
export type TransitionCloseHandler = (event: React.SyntheticEvent<any> | null, reason: CloseReason, key?: SnackbarKey) => void; | ||
export type TransitionCloseHandler = ( | ||
event: React.SyntheticEvent<any> | null, | ||
reason: CloseReason, | ||
key?: SnackbarKey | ||
) => void; | ||
export type TransitionEnterHandler = (node: HTMLElement, isAppearing: boolean, key: SnackbarKey) => void; | ||
export type TransitionExitHandler = (node: HTMLElement, key: SnackbarKey) => void; | ||
type AnyComponentMap = Record<string, React.ComponentType<any>>; | ||
type VariantsOf<T> = { [K in keyof T]: K extends string ? K : never; }[keyof T]; | ||
export type SnackbarClassKey = | ||
@@ -124,3 +179,3 @@ | 'root' | ||
*/ | ||
export interface SharedProps<V> extends Partial<TransitionHandlerProps> { | ||
export interface SharedProps<V extends VariantType = VariantType> extends Partial<TransitionHandlerProps> { | ||
className?: string; | ||
@@ -150,10 +205,10 @@ style?: React.CSSProperties; | ||
* ```jsx | ||
* import Fade from 'notistack/transitions/Fade'; | ||
* import Grow from 'notistack/transitions/Grow'; | ||
* import Slide from 'notistack/transitions/Slide'; | ||
* import Zoom from 'notistack/transitions/Zoom'; | ||
* import { Fade } from 'notistack'; | ||
* import { Grow } from 'notistack'; | ||
* import { Slide } from 'notistack'; | ||
* import { Zoom } from 'notistack'; | ||
* ``` | ||
* @default Slide | ||
*/ | ||
TransitionComponent?: React.ComponentType<TransitionProps>; | ||
TransitionComponent?: TransitionComponent; | ||
/** | ||
@@ -186,3 +241,3 @@ * The duration for the transition, in milliseconds. | ||
*/ | ||
variant?: V | VariantType; | ||
variant?: V; | ||
/** | ||
@@ -214,4 +269,4 @@ * Ignores displaying multiple snackbars with the same `message` | ||
* @deprecated - Will be removed in future releases. You should use `Components` prop of | ||
* `SnackbarProvider` to display a custom snackbar. This is for your own benefit to have | ||
* more control over your custom snackbars. | ||
* `SnackbarProvider` to display a custom snackbar. This is to have more control over | ||
* custom snackbars. | ||
*/ | ||
@@ -236,3 +291,3 @@ content?: SnackbarContentCallback; | ||
*/ | ||
export interface OptionsObject<V> extends SharedProps<V> { | ||
export interface OptionsObject<V extends VariantType = VariantType> extends SharedProps<V> { | ||
/** | ||
@@ -257,3 +312,12 @@ * Unique identifier to reference a snackbar. | ||
type NeededByInternalSnack = 'style' | 'persist' | 'variant' | 'anchorOrigin' | 'TransitionComponent' | 'TransitionProps' | 'transitionDuration' | 'hideIconVariant' | 'disableWindowBlurListener'; | ||
type NeededByInternalSnack = | ||
| 'style' | ||
| 'persist' | ||
| 'variant' | ||
| 'anchorOrigin' | ||
| 'TransitionComponent' | ||
| 'TransitionProps' | ||
| 'transitionDuration' | ||
| 'hideIconVariant' | ||
| 'disableWindowBlurListener'; | ||
@@ -264,3 +328,5 @@ /** | ||
*/ | ||
export interface InternalSnack<V extends string = VariantType> extends RequiredBy<Omit<OptionsObject<V>, 'key' | 'preventDuplicate'>, NeededByInternalSnack>, InternalSnackAttributes { | ||
export interface InternalSnack | ||
extends RequiredBy<Omit<OptionsObject, 'key' | 'preventDuplicate'>, NeededByInternalSnack>, | ||
InternalSnackAttributes { | ||
id: SnackbarKey; | ||
@@ -271,3 +337,13 @@ message?: SnackbarMessage; | ||
type NotNeededByCustomSnackbar = keyof InternalSnackAttributes | keyof TransitionHandlerProps | 'onClose' | 'SnackbarProps' | 'disableWindowBlurListener' | 'TransitionComponent' | 'transitionDuration' | 'TransitionProps' | 'dense' | 'content'; | ||
type NotNeededByCustomSnackbar = | ||
| keyof InternalSnackAttributes | ||
| keyof TransitionHandlerProps | ||
| 'onClose' | ||
| 'SnackbarProps' | ||
| 'disableWindowBlurListener' | ||
| 'TransitionComponent' | ||
| 'transitionDuration' | ||
| 'TransitionProps' | ||
| 'dense' | ||
| 'content'; | ||
@@ -277,3 +353,3 @@ /** | ||
*/ | ||
export type CustomContentProps<V extends string = VariantType> = Omit<InternalSnack<V>, NotNeededByCustomSnackbar> | ||
export type CustomContentProps = Omit<InternalSnack, NotNeededByCustomSnackbar>; | ||
@@ -283,3 +359,3 @@ /** | ||
*/ | ||
export interface SnackbarProviderProps<V extends keyof T = any, T extends Record<V, React.ComponentType<any>> = any> extends SharedProps<VariantsOf<T>> { | ||
export interface SnackbarProviderProps extends SharedProps { | ||
/** | ||
@@ -289,3 +365,3 @@ * Most of the time this is your App. every component from this point onward | ||
*/ | ||
children: React.ReactNode | React.ReactNode[]; | ||
children?: React.ReactNode | React.ReactNode[]; | ||
/** | ||
@@ -302,3 +378,4 @@ * Denser margins for snackbars. Recommended to be used on mobile devices. | ||
/** | ||
* Valid and exist HTML Node element, used to target `ReactDOM.createPortal` | ||
* Valid HTML Node element, used to target `ReactDOM.createPortal`. If you are | ||
* using this prop, most likely you also want to apply `position: absolute` to SnackbarContainer. | ||
*/ | ||
@@ -313,3 +390,3 @@ domRoot?: HTMLElement; | ||
*/ | ||
iconVariant?: Partial<Record<V, React.ReactNode>>; | ||
iconVariant?: Partial<Record<VariantType, React.ReactNode>>; | ||
/** | ||
@@ -319,30 +396,20 @@ * @ignore | ||
*/ | ||
ref?: React.Ref<SnackbarProvider<any, any>>; | ||
ref?: React.Ref<SnackbarProvider>; | ||
/** | ||
* Mapping between variants and a custom component. | ||
*/ | ||
Components?: T; | ||
Components?: { | ||
[variant in VariantType]?: React.JSXElementConstructor<any>; | ||
}; | ||
} | ||
/** All additional props (custom content props excluded (except message)) */ | ||
type AdditionalProps<P extends CustomContentProps> = Omit<P, keyof CustomContentProps>; | ||
/** Infers type of props passed to a custom component */ | ||
type PropsOfComponent<C> = C extends React.ComponentType<infer P> ? P : never; | ||
type AdditionalPropsOfComponent<C extends React.ComponentType<any>> = AdditionalProps<PropsOfComponent<C>> | ||
type OptionsWithExtraProps<V extends VariantType> = VariantMap[V] extends true | ||
? OptionsObject<V> | ||
: OptionsObject<V> & VariantMap[V]; | ||
declare global { | ||
// eslint-disable-next-line @typescript-eslint/no-namespace | ||
namespace notistack { | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
interface MyCustomMap extends AnyComponentMap { | ||
// [x: string]: React.ComponentType<any> | ||
} | ||
} | ||
interface EnqueueSnackbar { | ||
<V extends VariantType>(options: OptionsWithExtraProps<V> & { message?: SnackbarMessage }): SnackbarKey; | ||
<V extends VariantType>(message: string, options?: OptionsWithExtraProps<V>): SnackbarKey; | ||
} | ||
interface EnqueueSnackbar<T extends notistack.MyCustomMap = notistack.MyCustomMap> { | ||
<V extends VariantsOf<T>>(options: OptionsObject<V> & AdditionalPropsOfComponent<T[V] extends React.ComponentType<any> ? T[V] : never> & { message?: SnackbarMessage }): SnackbarKey | ||
<V extends VariantsOf<T>>(message: string, options?: OptionsObject<V> & AdditionalPropsOfComponent<T[V] extends React.ComponentType<any> ? T[V] : never>): SnackbarKey; | ||
} | ||
export interface ProviderContext { | ||
@@ -353,3 +420,3 @@ enqueueSnackbar: EnqueueSnackbar; | ||
export declare class SnackbarProvider<V extends keyof T, T extends Record<V, React.ComponentType<any>>> extends React.Component<SnackbarProviderProps<V, T>> { | ||
export declare class SnackbarProvider extends React.Component<SnackbarProviderProps> { | ||
enqueueSnackbar: ProviderContext['enqueueSnackbar']; | ||
@@ -360,4 +427,5 @@ | ||
export declare function withSnackbar<P extends ProviderContext>(component: React.ComponentType<P>): | ||
React.ComponentClass<Omit<P, keyof ProviderContext>> & { WrappedComponent: React.ComponentType<P> }; | ||
export declare function withSnackbar<P extends ProviderContext>( | ||
component: React.ComponentType<P> | ||
): React.ComponentClass<Omit<P, keyof ProviderContext>> & { WrappedComponent: React.ComponentType<P> }; | ||
@@ -367,1 +435,6 @@ export declare const SnackbarContent: React.ComponentType<SnackbarContentProps & React.RefAttributes<HTMLDivElement>>; | ||
export declare function useSnackbar(): ProviderContext; | ||
export declare const Slide: TransitionComponent; | ||
export declare const Grow: TransitionComponent; | ||
export declare const Fade: TransitionComponent; | ||
export declare const Zoom: TransitionComponent; |
{ | ||
"name": "ee54bh78i", | ||
"version": "3.0.0-alpha.1", | ||
"description": "Highly customizable notification snackbars (toasts) that can be stacked on top of each other", | ||
"version": "3.0.0-alpha.5", | ||
"description": "", | ||
"main": "./index.js", | ||
@@ -9,12 +9,2 @@ "module": "./notistack.esm.js", | ||
"license": "MIT", | ||
"author": { | ||
"name": "Hossein Dehnokhalaji", | ||
"email": "hossein.dehnavi98@yahoo.com", | ||
"url": "https://github.com/iamhosseindhv/notistack" | ||
}, | ||
"homepage": "https://www.iamhosseindhv.com/notistack", | ||
"repository": { | ||
"url": "git+https://github.com/iamhosseindhv/notistack.git", | ||
"type": "git" | ||
}, | ||
"scripts": { | ||
@@ -27,14 +17,13 @@ "prebuild": "npm run docs", | ||
"prerelease": "npm run build", | ||
"postversion": "cp package.json dist", | ||
"release:alpha": "np --tag alpha" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.8.0 || ^17.0.0", | ||
"react-dom": "^16.8.0 || ^17.0.0" | ||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0", | ||
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/preset-react": "^7.8.3", | ||
"@types/node": "^13.9.0", | ||
"@types/react": "^16.9.23", | ||
"@types/react-dom": "^16.9.5", | ||
"@types/react-is": "^16.7.1", | ||
"@types/react": "^18.0.9", | ||
"@types/react-dom": "^18.0.3", | ||
"@typescript-eslint/eslint-plugin": "^3.9.1", | ||
@@ -49,5 +38,5 @@ "@typescript-eslint/parser": "^3.9.1", | ||
"eslint-plugin-react": "^7.20.6", | ||
"np": "^7.5.0", | ||
"react": "^16.8.0 || ^17.0.0", | ||
"react-dom": "^16.8.0 || ^17.0.0", | ||
"np": "^7.6.1", | ||
"react": "^18.1.0", | ||
"react-dom": "^18.1.0", | ||
"rimraf": "^3.0.2", | ||
@@ -66,34 +55,4 @@ "rollup-plugin-bundle-size": "^1.0.3", | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/iamhosseindhv/notistack/issues" | ||
}, | ||
"funding": { | ||
"type": "opencollective", | ||
"url": "https://opencollective.com/notistack" | ||
}, | ||
"contributors": [ | ||
"Hossein Dehnokhalaji (https://www.iamhosseindhv.com/)" | ||
], | ||
"keywords": [ | ||
"notistack", | ||
"enqueueSnackbar", | ||
"snackbarprovider", | ||
"useSnackbar", | ||
"multiple", | ||
"react", | ||
"javascript", | ||
"material-ui", | ||
"toast", | ||
"redux", | ||
"snackbar", | ||
"stacked", | ||
"notification", | ||
"material design", | ||
"hossein", | ||
"dehnokhalaji", | ||
"iamhosseindhv" | ||
], | ||
"np": { | ||
"branch": "alpha", | ||
"yolo": true, | ||
"yarn": false, | ||
@@ -103,3 +62,7 @@ "contents": "dist", | ||
"releaseDraft": false | ||
}, | ||
"engines": { | ||
"node": ">=12.0.0", | ||
"npm": ">=6.0.0" | ||
} | ||
} |
112
README.md
@@ -1,111 +0,1 @@ | ||
<p align="center"> | ||
<a href="https://iamhosseindhv.com/" rel="noopener" target="_blank"><img width="756" src="https://iamhosseindhv.com/static/projects/notistack-banner.png" alt="notistack logo"></a></p> | ||
</p> | ||
<div align="center"> | ||
[**Notistack**](https://iamhosseindhv.com/notistack) is a notification library which makes it extremely easy to display notifications on your web apps. It is highly customizable and enables you to stack snackbars/toasts on top of one another. | ||
</br> | ||
**Visit [documentation website](https://iamhosseindhv.com/notistack/demos) for demos**. | ||
[![npm version](https://img.shields.io/npm/v/notistack.svg?label=version)](https://www.npmjs.com/package/notistack) | ||
[![npm downloads](https://img.shields.io/npm/dm/notistack.svg)](https://www.npmjs.com/package/notistack) | ||
[![package license](https://img.shields.io/npm/l/notistack.svg)](https://www.npmjs.com/package/notistack) | ||
</div> | ||
| Stacking behaviour | Dismiss oldest when reached maxSnack (3 here)| | ||
| --- | --- | | ||
| <img width="400" src="https://i.imgur.com/MtijvAK.gif"/> | <img width="400" src="https://i.imgur.com/urX47Wn.gif"/>| | ||
Table of Contents | ||
-- | ||
- [How to use](#how-to-use) | ||
- [Online demo](#online-demo) | ||
- [Documentation](https://iamhosseindhv.com/notistack/api) | ||
- [Redux / Mobx support](#redux-and-mobx-support) | ||
## Getting Started | ||
Use your preferred package manager: | ||
``` | ||
npm install notistack | ||
yarn add notistack | ||
``` | ||
### How to use | ||
**1:** Wrap your app inside a `SnackbarProvider` component: (see [docs](https://iamhosseindhv.com/notistack/api) for a full list of available props) | ||
<br /> | ||
**Note:** If you're using material-ui `ThemeProvider`, make sure `SnackbarProvider` is a child of it. | ||
```jsx | ||
import { SnackbarProvider } from 'notistack'; | ||
<SnackbarProvider maxSnack={3}> | ||
<App /> | ||
</SnackbarProvider> | ||
``` | ||
**2:** Export any component that needs to send notification using `withSnackbar`. By doing this, you'll have access to methods `enqueueSnackbar` and `closeSnackbar`, where the former can be used to send snackbars. | ||
```javascript | ||
import { withSnackbar } from 'notistack'; | ||
class MyComponent extends Component { | ||
handleNetworkRequest = () => { | ||
fetchSomeData() | ||
.then(() => this.props.enqueueSnackbar('Successfully fetched the data.')) | ||
.catch(() => this.props.enqueueSnackbar('Failed fetching data.')); | ||
}; | ||
render(){ | ||
//... | ||
}; | ||
}; | ||
export default withSnackbar(MyComponent); | ||
``` | ||
**2 (alternative):** You can use `useSnackbar` hook in your functional components as well. | ||
```javascript | ||
import { useSnackbar } from 'notistack'; | ||
const MyButton = () => { | ||
const { enqueueSnackbar, closeSnackbar } = useSnackbar(); | ||
const handleClick = () => { | ||
enqueueSnackbar('I love hooks'); | ||
}; | ||
return ( | ||
<Button onClick={handleClick}>Show snackbar</Button> | ||
); | ||
} | ||
``` | ||
### Online demo | ||
**Visit [`documentation website`](https://iamhosseindhv.com/notistack/demos) to see all the demos.**</br> | ||
Or play with a minimal working example: [codesandbox](https://codesandbox.io/s/github/iamhosseindhv/notistack/tree/master/examples/simple-example??hidenavigation=1&module=%2FApp.js) </br> | ||
### Redux and Mobx support: | ||
notistack is compatible with state management libraries such as Redux and Mobx. See notistack [documentation](https://iamhosseindhv.com/notistack/demos#redux-/-mobx-example) for more info. | ||
### Contribution | ||
Open an issue and your problem will be solved. | ||
### Author - Contact | ||
Hossein Dehnokhalaji | ||
<a href="https://www.instagram.com/iamhosseindhv"><img src="https://github.com/iamhosseindhv/Rentaly/blob/master/Gifs/instagram.png" alt="Hossein Dehnokhalaji Instagram profile" align="right" width="32" height="32"/></a> | ||
<a href="https://www.linkedin.com/in/iamhosseindhv"><img src="https://github.com/iamhosseindhv/Rentaly/blob/master/Gifs/linkedin.png" alt="Hossein Dehnokhalaji Linkedin profile" align="right" width="32" height="32"/></a> | ||
<a href="mailto:hossein.dehnavi98@yahoo.com"><img src="https://github.com/iamhosseindhv/Rentaly/blob/master/Gifs/contact.png" alt="Hossein Dehnokhalaji email address" align="right" width="32" height="32"/></a> | ||
README |
Sorry, the diff of this file is too big to display
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 too big to display
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 contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
542884
22
4269
0
2
3
1
6