diff --git a/dist/index.d.ts b/dist/index.d.ts
index 4b208397b30693e124aa0d8802be41104bb4ae23..8c9d448c9e10173616d58ac3ab443ea726bb2806 100644
--- a/dist/index.d.ts
+++ b/dist/index.d.ts
@@ -3,7 +3,7 @@ import { CSSProperties } from 'react';
 import * as goober from 'goober';
 
 declare type ToastType = 'success' | 'error' | 'loading' | 'blank' | 'custom';
-declare type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
+declare type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'center-right' | 'center-left';
 declare type Renderable = JSX.Element | string | null;
 interface IconTheme {
     primary: string;
diff --git a/dist/index.js b/dist/index.js
index 3cf68f6f3f944047d29538341561ed58d6484823..34dd98b4d79a6dace516caa4435d214d1c920804 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1,4 +1,4 @@
-"use strict";var Y=Object.create;var E=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var K=Object.getPrototypeOf,Z=Object.prototype.hasOwnProperty;var ee=(e,t)=>{for(var o in t)E(e,o,{get:t[o],enumerable:!0})},j=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of G(t))!Z.call(e,r)&&r!==o&&E(e,r,{get:()=>t[r],enumerable:!(s=q(t,r))||s.enumerable});return e};var W=(e,t,o)=>(o=e!=null?Y(K(e)):{},j(t||!e||!e.__esModule?E(o,"default",{value:e,enumerable:!0}):o,e)),te=e=>j(E({},"__esModule",{value:!0}),e);var Ve={};ee(Ve,{CheckmarkIcon:()=>F,ErrorIcon:()=>w,LoaderIcon:()=>M,ToastBar:()=>$,ToastIcon:()=>U,Toaster:()=>J,default:()=>_e,resolveValue:()=>u,toast:()=>n,useToaster:()=>V,useToasterStore:()=>_});module.exports=te(Ve);var oe=e=>typeof e=="function",u=(e,t)=>oe(e)?e(t):e;var Q=(()=>{let e=0;return()=>(++e).toString()})(),R=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})();var k=require("react"),re=20;var v=new Map,se=1e3,X=e=>{if(v.has(e))return;let t=setTimeout(()=>{v.delete(e),l({type:4,toastId:e})},se);v.set(e,t)},ae=e=>{let t=v.get(e);t&&clearTimeout(t)},H=(e,t)=>{switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,re)};case 1:return t.toast.id&&ae(t.toast.id),{...e,toasts:e.toasts.map(a=>a.id===t.toast.id?{...a,...t.toast}:a)};case 2:let{toast:o}=t;return e.toasts.find(a=>a.id===o.id)?H(e,{type:1,toast:o}):H(e,{type:0,toast:o});case 3:let{toastId:s}=t;return s?X(s):e.toasts.forEach(a=>{X(a.id)}),{...e,toasts:e.toasts.map(a=>a.id===s||s===void 0?{...a,visible:!1}:a)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(a=>a.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let r=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(a=>({...a,pauseDuration:a.pauseDuration+r}))}}},I=[],D={toasts:[],pausedAt:void 0},l=e=>{D=H(D,e),I.forEach(t=>{t(D)})},ie={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},_=(e={})=>{let[t,o]=(0,k.useState)(D);(0,k.useEffect)(()=>(I.push(o),()=>{let r=I.indexOf(o);r>-1&&I.splice(r,1)}),[t]);let s=t.toasts.map(r=>{var a,c;return{...e,...e[r.type],...r,duration:r.duration||((a=e[r.type])==null?void 0:a.duration)||(e==null?void 0:e.duration)||ie[r.type],style:{...e.style,...(c=e[r.type])==null?void 0:c.style,...r.style}}});return{...t,toasts:s}};var ce=(e,t="blank",o)=>({createdAt:Date.now(),visible:!0,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...o,id:(o==null?void 0:o.id)||Q()}),S=e=>(t,o)=>{let s=ce(t,e,o);return l({type:2,toast:s}),s.id},n=(e,t)=>S("blank")(e,t);n.error=S("error");n.success=S("success");n.loading=S("loading");n.custom=S("custom");n.dismiss=e=>{l({type:3,toastId:e})};n.remove=e=>l({type:4,toastId:e});n.promise=(e,t,o)=>{let s=n.loading(t.loading,{...o,...o==null?void 0:o.loading});return e.then(r=>(n.success(u(t.success,r),{id:s,...o,...o==null?void 0:o.success}),r)).catch(r=>{n.error(u(t.error,r),{id:s,...o,...o==null?void 0:o.error})}),e};var A=require("react");var pe=(e,t)=>{l({type:1,toast:{id:e,height:t}})},de=()=>{l({type:5,time:Date.now()})},V=e=>{let{toasts:t,pausedAt:o}=_(e);(0,A.useEffect)(()=>{if(o)return;let a=Date.now(),c=t.map(i=>{if(i.duration===1/0)return;let d=(i.duration||0)+i.pauseDuration-(a-i.createdAt);if(d<0){i.visible&&n.dismiss(i.id);return}return setTimeout(()=>n.dismiss(i.id),d)});return()=>{c.forEach(i=>i&&clearTimeout(i))}},[t,o]);let s=(0,A.useCallback)(()=>{o&&l({type:6,time:Date.now()})},[o]),r=(0,A.useCallback)((a,c)=>{let{reverseOrder:i=!1,gutter:d=8,defaultPosition:p}=c||{},g=t.filter(m=>(m.position||p)===(a.position||p)&&m.height),z=g.findIndex(m=>m.id===a.id),O=g.filter((m,B)=>B<z&&m.visible).length;return g.filter(m=>m.visible).slice(...i?[O+1]:[0,O]).reduce((m,B)=>m+(B.height||0)+d,0)},[t]);return{toasts:t,handlers:{updateHeight:pe,startPause:de,endPause:s,calculateOffset:r}}};var T=W(require("react")),b=require("goober");var y=W(require("react")),x=require("goober");var h=require("goober"),me=h.keyframes`
+"use strict";var Y=Object.create;var E=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var K=Object.getPrototypeOf,Z=Object.prototype.hasOwnProperty;var ee=(e,t)=>{for(var o in t)E(e,o,{get:t[o],enumerable:!0})},j=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of G(t))!Z.call(e,r)&&r!==o&&E(e,r,{get:()=>t[r],enumerable:!(s=q(t,r))||s.enumerable});return e};var W=(e,t,o)=>(o=e!=null?Y(K(e)):{},j(t||!e||!e.__esModule?E(o,"default",{value:e,enumerable:!0}):o,e)),te=e=>j(E({},"__esModule",{value:!0}),e);var Ve={};ee(Ve,{CheckmarkIcon:()=>F,ErrorIcon:()=>w,LoaderIcon:()=>M,ToastBar:()=>$,ToastIcon:()=>U,Toaster:()=>J,default:()=>_e,resolveValue:()=>m,toast:()=>i,useToaster:()=>V,useToasterStore:()=>_});module.exports=te(Ve);var oe=e=>typeof e=="function",m=(e,t)=>oe(e)?e(t):e;var Q=(()=>{let e=0;return()=>(++e).toString()})(),R=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})();var k=require("react"),re=20;var v=new Map,se=1e3,X=e=>{if(v.has(e))return;let t=setTimeout(()=>{v.delete(e),l({type:4,toastId:e})},se);v.set(e,t)},ae=e=>{let t=v.get(e);t&&clearTimeout(t)},H=(e,t)=>{switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,re)};case 1:return t.toast.id&&ae(t.toast.id),{...e,toasts:e.toasts.map(a=>a.id===t.toast.id?{...a,...t.toast}:a)};case 2:let{toast:o}=t;return e.toasts.find(a=>a.id===o.id)?H(e,{type:1,toast:o}):H(e,{type:0,toast:o});case 3:let{toastId:s}=t;return s?X(s):e.toasts.forEach(a=>{X(a.id)}),{...e,toasts:e.toasts.map(a=>a.id===s||s===void 0?{...a,visible:!1}:a)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(a=>a.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let r=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(a=>({...a,pauseDuration:a.pauseDuration+r}))}}},I=[],D={toasts:[],pausedAt:void 0},l=e=>{D=H(D,e),I.forEach(t=>{t(D)})},ne={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},_=(e={})=>{let[t,o]=(0,k.useState)(D);(0,k.useEffect)(()=>(I.push(o),()=>{let r=I.indexOf(o);r>-1&&I.splice(r,1)}),[t]);let s=t.toasts.map(r=>{var a,c;return{...e,...e[r.type],...r,duration:r.duration||((a=e[r.type])==null?void 0:a.duration)||(e==null?void 0:e.duration)||ne[r.type],style:{...e.style,...(c=e[r.type])==null?void 0:c.style,...r.style}}});return{...t,toasts:s}};var ce=(e,t="blank",o)=>({createdAt:Date.now(),visible:!0,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...o,id:(o==null?void 0:o.id)||Q()}),S=e=>(t,o)=>{let s=ce(t,e,o);return l({type:2,toast:s}),s.id},i=(e,t)=>S("blank")(e,t);i.error=S("error");i.success=S("success");i.loading=S("loading");i.custom=S("custom");i.dismiss=e=>{l({type:3,toastId:e})};i.remove=e=>l({type:4,toastId:e});i.promise=(e,t,o)=>{let s=i.loading(t.loading,{...o,...o==null?void 0:o.loading});return e.then(r=>(i.success(m(t.success,r),{id:s,...o,...o==null?void 0:o.success}),r)).catch(r=>{i.error(m(t.error,r),{id:s,...o,...o==null?void 0:o.error})}),e};var A=require("react");var pe=(e,t)=>{l({type:1,toast:{id:e,height:t}})},de=()=>{l({type:5,time:Date.now()})},V=e=>{let{toasts:t,pausedAt:o}=_(e);(0,A.useEffect)(()=>{if(o)return;let a=Date.now(),c=t.map(n=>{if(n.duration===1/0)return;let d=(n.duration||0)+n.pauseDuration-(a-n.createdAt);if(d<0){n.visible&&i.dismiss(n.id);return}return setTimeout(()=>i.dismiss(n.id),d)});return()=>{c.forEach(n=>n&&clearTimeout(n))}},[t,o]);let s=(0,A.useCallback)(()=>{o&&l({type:6,time:Date.now()})},[o]),r=(0,A.useCallback)((a,c)=>{let{reverseOrder:n=!1,gutter:d=8,defaultPosition:p}=c||{},g=t.filter(u=>(u.position||p)===(a.position||p)&&u.height),z=g.findIndex(u=>u.id===a.id),O=g.filter((u,B)=>B<z&&u.visible).length;return g.filter(u=>u.visible).slice(...n?[O+1]:[0,O]).reduce((u,B)=>u+(B.height||0)+d,0)},[t]);return{toasts:t,handlers:{updateHeight:pe,startPause:de,endPause:s,calculateOffset:r}}};var f=W(require("react")),b=require("goober");var y=W(require("react")),x=require("goober");var h=require("goober"),ue=h.keyframes`
 from {
   transform: scale(0) rotate(45deg);
 	opacity: 0;
@@ -6,7 +6,7 @@ from {
 to {
  transform: scale(1) rotate(45deg);
   opacity: 1;
-}`,ue=h.keyframes`
+}`,me=h.keyframes`
 from {
   transform: scale(0);
   opacity: 0;
@@ -31,14 +31,14 @@ to {
   position: relative;
   transform: rotate(45deg);
 
-  animation: ${me} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
+  animation: ${ue} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
     forwards;
   animation-delay: 100ms;
 
   &:after,
   &:before {
     content: '';
-    animation: ${ue} 0.15s ease-out forwards;
+    animation: ${me} 0.15s ease-out forwards;
     animation-delay: 150ms;
     position: absolute;
     border-radius: 3px;
@@ -55,7 +55,7 @@ to {
     animation-delay: 180ms;
     transform: rotate(90deg);
   }
-`;var C=require("goober"),Te=C.keyframes`
+`;var C=require("goober"),fe=C.keyframes`
   from {
     transform: rotate(0deg);
   }
@@ -70,8 +70,8 @@ to {
   border-radius: 100%;
   border-color: ${e=>e.secondary||"#e0e0e0"};
   border-right-color: ${e=>e.primary||"#616161"};
-  animation: ${Te} 1s linear infinite;
-`;var P=require("goober"),fe=P.keyframes`
+  animation: ${fe} 1s linear infinite;
+`;var P=require("goober"),Te=P.keyframes`
 from {
   transform: scale(0) rotate(45deg);
 	opacity: 0;
@@ -102,7 +102,7 @@ to {
   position: relative;
   transform: rotate(45deg);
 
-  animation: ${fe} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
+  animation: ${Te} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
     forwards;
   animation-delay: 100ms;
   &:after {
@@ -169,10 +169,10 @@ to {
   color: inherit;
   flex: 1 1 auto;
   white-space: pre-line;
-`,ve=(e,t)=>{let s=e.includes("top")?1:-1,[r,a]=R()?[Pe,Oe]:[Se(s),Ae(s)];return{animation:t?`${(0,b.keyframes)(r)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${(0,b.keyframes)(a)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},$=T.memo(({toast:e,position:t,style:o,children:s})=>{let r=e.height?ve(e.position||t||"top-center",e.visible):{opacity:0},a=T.createElement(U,{toast:e}),c=T.createElement(Re,{...e.ariaProps},u(e.message,e));return T.createElement(Ee,{className:e.className,style:{...r,...o,...e.style}},typeof s=="function"?s({icon:a,message:c}):T.createElement(T.Fragment,null,a,c))});var N=require("goober"),f=W(require("react"));(0,N.setup)(f.createElement);var Ie=({id:e,className:t,style:o,onHeightUpdate:s,children:r})=>{let a=f.useCallback(c=>{if(c){let i=()=>{let d=c.getBoundingClientRect().height;s(e,d)};i(),new MutationObserver(i).observe(c,{subtree:!0,childList:!0,characterData:!0})}},[e,s]);return f.createElement("div",{ref:a,className:t,style:o},r)},De=(e,t)=>{let o=e.includes("top"),s=o?{top:0}:{bottom:0},r=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:R()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(o?1:-1)}px)`,...s,...r}},ke=N.css`
+`,ve=(e,t)=>{let s=e.includes("top")?1:-1,[r,a]=R()?[Pe,Oe]:[Se(s),Ae(s)];return{animation:t?`${(0,b.keyframes)(r)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${(0,b.keyframes)(a)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},$=f.memo(({toast:e,position:t,style:o,children:s})=>{let r=e.height?ve(e.position||t||"top-center",e.visible):{opacity:0},a=f.createElement(U,{toast:e}),c=f.createElement(Re,{...e.ariaProps},m(e.message,e));return f.createElement(Ee,{className:e.className,style:{...r,...o,...e.style}},typeof s=="function"?s({icon:a,message:c}):f.createElement(f.Fragment,null,a,c))});var N=require("goober"),T=W(require("react"));(0,N.setup)(T.createElement);var Ie=({id:e,className:t,style:o,onHeightUpdate:s,children:r})=>{let a=T.useCallback(c=>{if(c){let n=()=>{let d=c.getBoundingClientRect().height;s(e,d)};n(),new MutationObserver(n).observe(c,{subtree:!0,childList:!0,characterData:!0})}},[e,s]);return T.createElement("div",{ref:a,className:t,style:o},r)},De=(e,t)=>{let o=e.includes("top")||e.includes("center-"),s=o?{top:e.includes("center-")?"50%":0}:{bottom:0},r=e.includes("center-right")?{justifyContent:"flex-end"}:e.includes("center-left")?{justifyContent:"flex-start"}:e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:R()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(o?1:-1)}px)`,...s,...r}},ke=N.css`
   z-index: 9999;
   > * {
     pointer-events: auto;
   }
-`,L=16,J=({reverseOrder:e,position:t="top-center",toastOptions:o,gutter:s,children:r,containerStyle:a,containerClassName:c})=>{let{toasts:i,handlers:d}=V(o);return f.createElement("div",{style:{position:"fixed",zIndex:9999,top:L,left:L,right:L,bottom:L,pointerEvents:"none",...a},className:c,onMouseEnter:d.startPause,onMouseLeave:d.endPause},i.map(p=>{let g=p.position||t,z=d.calculateOffset(p,{reverseOrder:e,gutter:s,defaultPosition:t}),O=De(g,z);return f.createElement(Ie,{id:p.id,key:p.id,onHeightUpdate:d.updateHeight,className:p.visible?ke:"",style:O},p.type==="custom"?u(p.message,p):r?r(p):f.createElement($,{toast:p,position:g}))}))};var _e=n;0&&(module.exports={CheckmarkIcon,ErrorIcon,LoaderIcon,ToastBar,ToastIcon,Toaster,resolveValue,toast,useToaster,useToasterStore});
+`,L=16,J=({reverseOrder:e,position:t="top-center",toastOptions:o,gutter:s,children:r,containerStyle:a,containerClassName:c})=>{let{toasts:n,handlers:d}=V(o);return T.createElement("div",{style:{position:"fixed",zIndex:9999,top:L,left:L,right:L,bottom:L,pointerEvents:"none",...a},className:c,onMouseEnter:d.startPause,onMouseLeave:d.endPause},n.map(p=>{let g=p.position||t,z=d.calculateOffset(p,{reverseOrder:e,gutter:s,defaultPosition:t}),O=De(g,z);return T.createElement(Ie,{id:p.id,key:p.id,onHeightUpdate:d.updateHeight,className:p.visible?ke:"",style:O},p.type==="custom"?m(p.message,p):r?r(p):T.createElement($,{toast:p,position:g}))}))};var _e=i;0&&(module.exports={CheckmarkIcon,ErrorIcon,LoaderIcon,ToastBar,ToastIcon,Toaster,resolveValue,toast,useToaster,useToasterStore});
 //# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/dist/index.js.map b/dist/index.js.map
index d7510655f2644f5a0b9d8c104d0a6d23ee4a7717..53d2c71f53732a2041b232d1a73593d16e025723 100644
--- a/dist/index.js.map
+++ b/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.ts","../src/core/types.ts","../src/core/utils.ts","../src/core/store.ts","../src/core/toast.ts","../src/core/use-toaster.ts","../src/components/toast-bar.tsx","../src/components/toast-icon.tsx","../src/components/error.tsx","../src/components/loader.tsx","../src/components/checkmark.tsx","../src/components/toaster.tsx"],"sourcesContent":["import { toast } from './core/toast';\n\nexport * from './headless';\n\nexport { ToastBar } from './components/toast-bar';\nexport { ToastIcon } from './components/toast-icon';\nexport { Toaster } from './components/toaster';\nexport { CheckmarkIcon } from './components/checkmark';\nexport { ErrorIcon } from './components/error';\nexport { LoaderIcon } from './components/loader';\n\nexport { toast };\nexport default toast;\n","import { CSSProperties } from 'react';\n\nexport type ToastType = 'success' | 'error' | 'loading' | 'blank' | 'custom';\nexport type ToastPosition =\n  | 'top-left'\n  | 'top-center'\n  | 'top-right'\n  | 'bottom-left'\n  | 'bottom-center'\n  | 'bottom-right';\n\nexport type Renderable = JSX.Element | string | null;\n\nexport interface IconTheme {\n  primary: string;\n  secondary: string;\n}\n\nexport type ValueFunction<TValue, TArg> = (arg: TArg) => TValue;\nexport type ValueOrFunction<TValue, TArg> =\n  | TValue\n  | ValueFunction<TValue, TArg>;\n\nconst isFunction = <TValue, TArg>(\n  valOrFunction: ValueOrFunction<TValue, TArg>\n): valOrFunction is ValueFunction<TValue, TArg> =>\n  typeof valOrFunction === 'function';\n\nexport const resolveValue = <TValue, TArg>(\n  valOrFunction: ValueOrFunction<TValue, TArg>,\n  arg: TArg\n): TValue => (isFunction(valOrFunction) ? valOrFunction(arg) : valOrFunction);\n\nexport interface Toast {\n  type: ToastType;\n  id: string;\n  message: ValueOrFunction<Renderable, Toast>;\n  icon?: Renderable;\n  duration?: number;\n  pauseDuration: number;\n  position?: ToastPosition;\n\n  ariaProps: {\n    role: 'status' | 'alert';\n    'aria-live': 'assertive' | 'off' | 'polite';\n  };\n\n  style?: CSSProperties;\n  className?: string;\n  iconTheme?: IconTheme;\n\n  createdAt: number;\n  visible: boolean;\n  height?: number;\n}\n\nexport type ToastOptions = Partial<\n  Pick<\n    Toast,\n    | 'id'\n    | 'icon'\n    | 'duration'\n    | 'ariaProps'\n    | 'className'\n    | 'style'\n    | 'position'\n    | 'iconTheme'\n  >\n>;\n\nexport type DefaultToastOptions = ToastOptions & {\n  [key in ToastType]?: ToastOptions;\n};\n\nexport interface ToasterProps {\n  position?: ToastPosition;\n  toastOptions?: DefaultToastOptions;\n  reverseOrder?: boolean;\n  gutter?: number;\n  containerStyle?: React.CSSProperties;\n  containerClassName?: string;\n  children?: (toast: Toast) => JSX.Element;\n}\n\nexport interface ToastWrapperProps {\n  id: string;\n  className?: string;\n  style?: React.CSSProperties;\n  onHeightUpdate: (id: string, height: number) => void;\n  children?: React.ReactNode;\n}\n","export const genId = (() => {\n  let count = 0;\n  return () => {\n    return (++count).toString();\n  };\n})();\n\nexport const prefersReducedMotion = (() => {\n  // Cache result\n  let shouldReduceMotion: boolean | undefined = undefined;\n\n  return () => {\n    if (shouldReduceMotion === undefined && typeof window !== 'undefined') {\n      const mediaQuery = matchMedia('(prefers-reduced-motion: reduce)');\n      shouldReduceMotion = !mediaQuery || mediaQuery.matches;\n    }\n    return shouldReduceMotion;\n  };\n})();\n","import { useEffect, useState } from 'react';\nimport { DefaultToastOptions, Toast, ToastType } from './types';\n\nconst TOAST_LIMIT = 20;\n\nexport enum ActionType {\n  ADD_TOAST,\n  UPDATE_TOAST,\n  UPSERT_TOAST,\n  DISMISS_TOAST,\n  REMOVE_TOAST,\n  START_PAUSE,\n  END_PAUSE,\n}\n\ntype Action =\n  | {\n      type: ActionType.ADD_TOAST;\n      toast: Toast;\n    }\n  | {\n      type: ActionType.UPSERT_TOAST;\n      toast: Toast;\n    }\n  | {\n      type: ActionType.UPDATE_TOAST;\n      toast: Partial<Toast>;\n    }\n  | {\n      type: ActionType.DISMISS_TOAST;\n      toastId?: string;\n    }\n  | {\n      type: ActionType.REMOVE_TOAST;\n      toastId?: string;\n    }\n  | {\n      type: ActionType.START_PAUSE;\n      time: number;\n    }\n  | {\n      type: ActionType.END_PAUSE;\n      time: number;\n    };\n\ninterface State {\n  toasts: Toast[];\n  pausedAt: number | undefined;\n}\n\nconst toastTimeouts = new Map<Toast['id'], ReturnType<typeof setTimeout>>();\n\nexport const TOAST_EXPIRE_DISMISS_DELAY = 1000;\n\nconst addToRemoveQueue = (toastId: string) => {\n  if (toastTimeouts.has(toastId)) {\n    return;\n  }\n\n  const timeout = setTimeout(() => {\n    toastTimeouts.delete(toastId);\n    dispatch({\n      type: ActionType.REMOVE_TOAST,\n      toastId: toastId,\n    });\n  }, TOAST_EXPIRE_DISMISS_DELAY);\n\n  toastTimeouts.set(toastId, timeout);\n};\n\nconst clearFromRemoveQueue = (toastId: string) => {\n  const timeout = toastTimeouts.get(toastId);\n  if (timeout) {\n    clearTimeout(timeout);\n  }\n};\n\nexport const reducer = (state: State, action: Action): State => {\n  switch (action.type) {\n    case ActionType.ADD_TOAST:\n      return {\n        ...state,\n        toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),\n      };\n\n    case ActionType.UPDATE_TOAST:\n      //  ! Side effects !\n      if (action.toast.id) {\n        clearFromRemoveQueue(action.toast.id);\n      }\n\n      return {\n        ...state,\n        toasts: state.toasts.map((t) =>\n          t.id === action.toast.id ? { ...t, ...action.toast } : t\n        ),\n      };\n\n    case ActionType.UPSERT_TOAST:\n      const { toast } = action;\n      return state.toasts.find((t) => t.id === toast.id)\n        ? reducer(state, { type: ActionType.UPDATE_TOAST, toast })\n        : reducer(state, { type: ActionType.ADD_TOAST, toast });\n\n    case ActionType.DISMISS_TOAST:\n      const { toastId } = action;\n\n      // ! Side effects ! - This could be execrated into a dismissToast() action, but I'll keep it here for simplicity\n      if (toastId) {\n        addToRemoveQueue(toastId);\n      } else {\n        state.toasts.forEach((toast) => {\n          addToRemoveQueue(toast.id);\n        });\n      }\n\n      return {\n        ...state,\n        toasts: state.toasts.map((t) =>\n          t.id === toastId || toastId === undefined\n            ? {\n                ...t,\n                visible: false,\n              }\n            : t\n        ),\n      };\n    case ActionType.REMOVE_TOAST:\n      if (action.toastId === undefined) {\n        return {\n          ...state,\n          toasts: [],\n        };\n      }\n      return {\n        ...state,\n        toasts: state.toasts.filter((t) => t.id !== action.toastId),\n      };\n\n    case ActionType.START_PAUSE:\n      return {\n        ...state,\n        pausedAt: action.time,\n      };\n\n    case ActionType.END_PAUSE:\n      const diff = action.time - (state.pausedAt || 0);\n\n      return {\n        ...state,\n        pausedAt: undefined,\n        toasts: state.toasts.map((t) => ({\n          ...t,\n          pauseDuration: t.pauseDuration + diff,\n        })),\n      };\n  }\n};\n\nconst listeners: Array<(state: State) => void> = [];\n\nlet memoryState: State = { toasts: [], pausedAt: undefined };\n\nexport const dispatch = (action: Action) => {\n  memoryState = reducer(memoryState, action);\n  listeners.forEach((listener) => {\n    listener(memoryState);\n  });\n};\n\nexport const defaultTimeouts: {\n  [key in ToastType]: number;\n} = {\n  blank: 4000,\n  error: 4000,\n  success: 2000,\n  loading: Infinity,\n  custom: 4000,\n};\n\nexport const useStore = (toastOptions: DefaultToastOptions = {}): State => {\n  const [state, setState] = useState<State>(memoryState);\n  useEffect(() => {\n    listeners.push(setState);\n    return () => {\n      const index = listeners.indexOf(setState);\n      if (index > -1) {\n        listeners.splice(index, 1);\n      }\n    };\n  }, [state]);\n\n  const mergedToasts = state.toasts.map((t) => ({\n    ...toastOptions,\n    ...toastOptions[t.type],\n    ...t,\n    duration:\n      t.duration ||\n      toastOptions[t.type]?.duration ||\n      toastOptions?.duration ||\n      defaultTimeouts[t.type],\n    style: {\n      ...toastOptions.style,\n      ...toastOptions[t.type]?.style,\n      ...t.style,\n    },\n  }));\n\n  return {\n    ...state,\n    toasts: mergedToasts,\n  };\n};\n","import {\n  Renderable,\n  Toast,\n  ToastOptions,\n  ToastType,\n  DefaultToastOptions,\n  ValueOrFunction,\n  resolveValue,\n} from './types';\nimport { genId } from './utils';\nimport { dispatch, ActionType } from './store';\n\ntype Message = ValueOrFunction<Renderable, Toast>;\n\ntype ToastHandler = (message: Message, options?: ToastOptions) => string;\n\nconst createToast = (\n  message: Message,\n  type: ToastType = 'blank',\n  opts?: ToastOptions\n): Toast => ({\n  createdAt: Date.now(),\n  visible: true,\n  type,\n  ariaProps: {\n    role: 'status',\n    'aria-live': 'polite',\n  },\n  message,\n  pauseDuration: 0,\n  ...opts,\n  id: opts?.id || genId(),\n});\n\nconst createHandler =\n  (type?: ToastType): ToastHandler =>\n  (message, options) => {\n    const toast = createToast(message, type, options);\n    dispatch({ type: ActionType.UPSERT_TOAST, toast });\n    return toast.id;\n  };\n\nconst toast = (message: Message, opts?: ToastOptions) =>\n  createHandler('blank')(message, opts);\n\ntoast.error = createHandler('error');\ntoast.success = createHandler('success');\ntoast.loading = createHandler('loading');\ntoast.custom = createHandler('custom');\n\ntoast.dismiss = (toastId?: string) => {\n  dispatch({\n    type: ActionType.DISMISS_TOAST,\n    toastId,\n  });\n};\n\ntoast.remove = (toastId?: string) =>\n  dispatch({ type: ActionType.REMOVE_TOAST, toastId });\n\ntoast.promise = <T>(\n  promise: Promise<T>,\n  msgs: {\n    loading: Renderable;\n    success: ValueOrFunction<Renderable, T>;\n    error: ValueOrFunction<Renderable, any>;\n  },\n  opts?: DefaultToastOptions\n) => {\n  const id = toast.loading(msgs.loading, { ...opts, ...opts?.loading });\n\n  promise\n    .then((p) => {\n      toast.success(resolveValue(msgs.success, p), {\n        id,\n        ...opts,\n        ...opts?.success,\n      });\n      return p;\n    })\n    .catch((e) => {\n      toast.error(resolveValue(msgs.error, e), {\n        id,\n        ...opts,\n        ...opts?.error,\n      });\n    });\n\n  return promise;\n};\n\nexport { toast };\n","import { useEffect, useCallback } from 'react';\nimport { dispatch, ActionType, useStore } from './store';\nimport { toast } from './toast';\nimport { DefaultToastOptions, Toast, ToastPosition } from './types';\n\nconst updateHeight = (toastId: string, height: number) => {\n  dispatch({\n    type: ActionType.UPDATE_TOAST,\n    toast: { id: toastId, height },\n  });\n};\nconst startPause = () => {\n  dispatch({\n    type: ActionType.START_PAUSE,\n    time: Date.now(),\n  });\n};\n\nexport const useToaster = (toastOptions?: DefaultToastOptions) => {\n  const { toasts, pausedAt } = useStore(toastOptions);\n\n  useEffect(() => {\n    if (pausedAt) {\n      return;\n    }\n\n    const now = Date.now();\n    const timeouts = toasts.map((t) => {\n      if (t.duration === Infinity) {\n        return;\n      }\n\n      const durationLeft =\n        (t.duration || 0) + t.pauseDuration - (now - t.createdAt);\n\n      if (durationLeft < 0) {\n        if (t.visible) {\n          toast.dismiss(t.id);\n        }\n        return;\n      }\n      return setTimeout(() => toast.dismiss(t.id), durationLeft);\n    });\n\n    return () => {\n      timeouts.forEach((timeout) => timeout && clearTimeout(timeout));\n    };\n  }, [toasts, pausedAt]);\n\n  const endPause = useCallback(() => {\n    if (pausedAt) {\n      dispatch({ type: ActionType.END_PAUSE, time: Date.now() });\n    }\n  }, [pausedAt]);\n\n  const calculateOffset = useCallback(\n    (\n      toast: Toast,\n      opts?: {\n        reverseOrder?: boolean;\n        gutter?: number;\n        defaultPosition?: ToastPosition;\n      }\n    ) => {\n      const { reverseOrder = false, gutter = 8, defaultPosition } = opts || {};\n\n      const relevantToasts = toasts.filter(\n        (t) =>\n          (t.position || defaultPosition) ===\n            (toast.position || defaultPosition) && t.height\n      );\n      const toastIndex = relevantToasts.findIndex((t) => t.id === toast.id);\n      const toastsBefore = relevantToasts.filter(\n        (toast, i) => i < toastIndex && toast.visible\n      ).length;\n\n      const offset = relevantToasts\n        .filter((t) => t.visible)\n        .slice(...(reverseOrder ? [toastsBefore + 1] : [0, toastsBefore]))\n        .reduce((acc, t) => acc + (t.height || 0) + gutter, 0);\n\n      return offset;\n    },\n    [toasts]\n  );\n\n  return {\n    toasts,\n    handlers: {\n      updateHeight,\n      startPause,\n      endPause,\n      calculateOffset,\n    },\n  };\n};\n","import * as React from 'react';\nimport { styled, keyframes } from 'goober';\n\nimport { Toast, ToastPosition, resolveValue, Renderable } from '../core/types';\nimport { ToastIcon } from './toast-icon';\nimport { prefersReducedMotion } from '../core/utils';\n\nconst enterAnimation = (factor: number) => `\n0% {transform: translate3d(0,${factor * -200}%,0) scale(.6); opacity:.5;}\n100% {transform: translate3d(0,0,0) scale(1); opacity:1;}\n`;\n\nconst exitAnimation = (factor: number) => `\n0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}\n100% {transform: translate3d(0,${factor * -150}%,-1px) scale(.6); opacity:0;}\n`;\n\nconst fadeInAnimation = `0%{opacity:0;} 100%{opacity:1;}`;\nconst fadeOutAnimation = `0%{opacity:1;} 100%{opacity:0;}`;\n\nconst ToastBarBase = styled('div')`\n  display: flex;\n  align-items: center;\n  background: #fff;\n  color: #363636;\n  line-height: 1.3;\n  will-change: transform;\n  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05);\n  max-width: 350px;\n  pointer-events: auto;\n  padding: 8px 10px;\n  border-radius: 8px;\n`;\n\nconst Message = styled('div')`\n  display: flex;\n  justify-content: center;\n  margin: 4px 10px;\n  color: inherit;\n  flex: 1 1 auto;\n  white-space: pre-line;\n`;\n\ninterface ToastBarProps {\n  toast: Toast;\n  position?: ToastPosition;\n  style?: React.CSSProperties;\n  children?: (components: {\n    icon: Renderable;\n    message: Renderable;\n  }) => Renderable;\n}\n\nconst getAnimationStyle = (\n  position: ToastPosition,\n  visible: boolean\n): React.CSSProperties => {\n  const top = position.includes('top');\n  const factor = top ? 1 : -1;\n\n  const [enter, exit] = prefersReducedMotion()\n    ? [fadeInAnimation, fadeOutAnimation]\n    : [enterAnimation(factor), exitAnimation(factor)];\n\n  return {\n    animation: visible\n      ? `${keyframes(enter)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`\n      : `${keyframes(exit)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`,\n  };\n};\n\nexport const ToastBar: React.FC<ToastBarProps> = React.memo(\n  ({ toast, position, style, children }) => {\n    const animationStyle: React.CSSProperties = toast.height\n      ? getAnimationStyle(\n          toast.position || position || 'top-center',\n          toast.visible\n        )\n      : { opacity: 0 };\n\n    const icon = <ToastIcon toast={toast} />;\n    const message = (\n      <Message {...toast.ariaProps}>\n        {resolveValue(toast.message, toast)}\n      </Message>\n    );\n\n    return (\n      <ToastBarBase\n        className={toast.className}\n        style={{\n          ...animationStyle,\n          ...style,\n          ...toast.style,\n        }}\n      >\n        {typeof children === 'function' ? (\n          children({\n            icon,\n            message,\n          })\n        ) : (\n          <>\n            {icon}\n            {message}\n          </>\n        )}\n      </ToastBarBase>\n    );\n  }\n);\n","import * as React from 'react';\nimport { styled, keyframes } from 'goober';\n\nimport { Toast } from '../core/types';\nimport { ErrorIcon, ErrorTheme } from './error';\nimport { LoaderIcon, LoaderTheme } from './loader';\nimport { CheckmarkIcon, CheckmarkTheme } from './checkmark';\n\nconst StatusWrapper = styled('div')`\n  position: absolute;\n`;\n\nconst IndicatorWrapper = styled('div')`\n  position: relative;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  min-width: 20px;\n  min-height: 20px;\n`;\n\nconst enter = keyframes`\nfrom {\n  transform: scale(0.6);\n  opacity: 0.4;\n}\nto {\n  transform: scale(1);\n  opacity: 1;\n}`;\n\nexport const AnimatedIconWrapper = styled('div')`\n  position: relative;\n  transform: scale(0.6);\n  opacity: 0.4;\n  min-width: 20px;\n  animation: ${enter} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)\n    forwards;\n`;\n\nexport type IconThemes = Partial<{\n  success: CheckmarkTheme;\n  error: ErrorTheme;\n  loading: LoaderTheme;\n}>;\n\nexport const ToastIcon: React.FC<{\n  toast: Toast;\n}> = ({ toast }) => {\n  const { icon, type, iconTheme } = toast;\n  if (icon !== undefined) {\n    if (typeof icon === 'string') {\n      return <AnimatedIconWrapper>{icon}</AnimatedIconWrapper>;\n    } else {\n      return icon;\n    }\n  }\n\n  if (type === 'blank') {\n    return null;\n  }\n\n  return (\n    <IndicatorWrapper>\n      <LoaderIcon {...iconTheme} />\n      {type !== 'loading' && (\n        <StatusWrapper>\n          {type === 'error' ? (\n            <ErrorIcon {...iconTheme} />\n          ) : (\n            <CheckmarkIcon {...iconTheme} />\n          )}\n        </StatusWrapper>\n      )}\n    </IndicatorWrapper>\n  );\n};\n","import { styled, keyframes } from 'goober';\n\nconst circleAnimation = keyframes`\nfrom {\n  transform: scale(0) rotate(45deg);\n\topacity: 0;\n}\nto {\n transform: scale(1) rotate(45deg);\n  opacity: 1;\n}`;\n\nconst firstLineAnimation = keyframes`\nfrom {\n  transform: scale(0);\n  opacity: 0;\n}\nto {\n  transform: scale(1);\n  opacity: 1;\n}`;\n\nconst secondLineAnimation = keyframes`\nfrom {\n  transform: scale(0) rotate(90deg);\n\topacity: 0;\n}\nto {\n  transform: scale(1) rotate(90deg);\n\topacity: 1;\n}`;\n\nexport interface ErrorTheme {\n  primary?: string;\n  secondary?: string;\n}\n\nexport const ErrorIcon = styled('div')<ErrorTheme>`\n  width: 20px;\n  opacity: 0;\n  height: 20px;\n  border-radius: 10px;\n  background: ${(p) => p.primary || '#ff4b4b'};\n  position: relative;\n  transform: rotate(45deg);\n\n  animation: ${circleAnimation} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)\n    forwards;\n  animation-delay: 100ms;\n\n  &:after,\n  &:before {\n    content: '';\n    animation: ${firstLineAnimation} 0.15s ease-out forwards;\n    animation-delay: 150ms;\n    position: absolute;\n    border-radius: 3px;\n    opacity: 0;\n    background: ${(p) => p.secondary || '#fff'};\n    bottom: 9px;\n    left: 4px;\n    height: 2px;\n    width: 12px;\n  }\n\n  &:before {\n    animation: ${secondLineAnimation} 0.15s ease-out forwards;\n    animation-delay: 180ms;\n    transform: rotate(90deg);\n  }\n`;\n","import { styled, keyframes } from 'goober';\n\nconst rotate = keyframes`\n  from {\n    transform: rotate(0deg);\n  }\n  to {\n    transform: rotate(360deg);\n  }\n`;\n\nexport interface LoaderTheme {\n  primary?: string;\n  secondary?: string;\n}\n\nexport const LoaderIcon = styled('div')<LoaderTheme>`\n  width: 12px;\n  height: 12px;\n  box-sizing: border-box;\n  border: 2px solid;\n  border-radius: 100%;\n  border-color: ${(p) => p.secondary || '#e0e0e0'};\n  border-right-color: ${(p) => p.primary || '#616161'};\n  animation: ${rotate} 1s linear infinite;\n`;\n","import { styled, keyframes } from 'goober';\n\nconst circleAnimation = keyframes`\nfrom {\n  transform: scale(0) rotate(45deg);\n\topacity: 0;\n}\nto {\n  transform: scale(1) rotate(45deg);\n\topacity: 1;\n}`;\n\nconst checkmarkAnimation = keyframes`\n0% {\n\theight: 0;\n\twidth: 0;\n\topacity: 0;\n}\n40% {\n  height: 0;\n\twidth: 6px;\n\topacity: 1;\n}\n100% {\n  opacity: 1;\n  height: 10px;\n}`;\n\nexport interface CheckmarkTheme {\n  primary?: string;\n  secondary?: string;\n}\n\nexport const CheckmarkIcon = styled('div')<CheckmarkTheme>`\n  width: 20px;\n  opacity: 0;\n  height: 20px;\n  border-radius: 10px;\n  background: ${(p) => p.primary || '#61d345'};\n  position: relative;\n  transform: rotate(45deg);\n\n  animation: ${circleAnimation} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)\n    forwards;\n  animation-delay: 100ms;\n  &:after {\n    content: '';\n    box-sizing: border-box;\n    animation: ${checkmarkAnimation} 0.2s ease-out forwards;\n    opacity: 0;\n    animation-delay: 200ms;\n    position: absolute;\n    border-right: 2px solid;\n    border-bottom: 2px solid;\n    border-color: ${(p) => p.secondary || '#fff'};\n    bottom: 6px;\n    left: 6px;\n    height: 10px;\n    width: 6px;\n  }\n`;\n","import { css, setup } from 'goober';\nimport * as React from 'react';\nimport {\n  resolveValue,\n  ToasterProps,\n  ToastPosition,\n  ToastWrapperProps,\n} from '../core/types';\nimport { useToaster } from '../core/use-toaster';\nimport { prefersReducedMotion } from '../core/utils';\nimport { ToastBar } from './toast-bar';\n\nsetup(React.createElement);\n\nconst ToastWrapper = ({\n  id,\n  className,\n  style,\n  onHeightUpdate,\n  children,\n}: ToastWrapperProps) => {\n  const ref = React.useCallback(\n    (el: HTMLElement | null) => {\n      if (el) {\n        const updateHeight = () => {\n          const height = el.getBoundingClientRect().height;\n          onHeightUpdate(id, height);\n        };\n        updateHeight();\n        new MutationObserver(updateHeight).observe(el, {\n          subtree: true,\n          childList: true,\n          characterData: true,\n        });\n      }\n    },\n    [id, onHeightUpdate]\n  );\n\n  return (\n    <div ref={ref} className={className} style={style}>\n      {children}\n    </div>\n  );\n};\n\nconst getPositionStyle = (\n  position: ToastPosition,\n  offset: number\n): React.CSSProperties => {\n  const top = position.includes('top');\n  const verticalStyle: React.CSSProperties = top ? { top: 0 } : { bottom: 0 };\n  const horizontalStyle: React.CSSProperties = position.includes('center')\n    ? {\n        justifyContent: 'center',\n      }\n    : position.includes('right')\n    ? {\n        justifyContent: 'flex-end',\n      }\n    : {};\n  return {\n    left: 0,\n    right: 0,\n    display: 'flex',\n    position: 'absolute',\n    transition: prefersReducedMotion()\n      ? undefined\n      : `all 230ms cubic-bezier(.21,1.02,.73,1)`,\n    transform: `translateY(${offset * (top ? 1 : -1)}px)`,\n    ...verticalStyle,\n    ...horizontalStyle,\n  };\n};\n\nconst activeClass = css`\n  z-index: 9999;\n  > * {\n    pointer-events: auto;\n  }\n`;\n\nconst DEFAULT_OFFSET = 16;\n\nexport const Toaster: React.FC<ToasterProps> = ({\n  reverseOrder,\n  position = 'top-center',\n  toastOptions,\n  gutter,\n  children,\n  containerStyle,\n  containerClassName,\n}) => {\n  const { toasts, handlers } = useToaster(toastOptions);\n\n  return (\n    <div\n      style={{\n        position: 'fixed',\n        zIndex: 9999,\n        top: DEFAULT_OFFSET,\n        left: DEFAULT_OFFSET,\n        right: DEFAULT_OFFSET,\n        bottom: DEFAULT_OFFSET,\n        pointerEvents: 'none',\n        ...containerStyle,\n      }}\n      className={containerClassName}\n      onMouseEnter={handlers.startPause}\n      onMouseLeave={handlers.endPause}\n    >\n      {toasts.map((t) => {\n        const toastPosition = t.position || position;\n        const offset = handlers.calculateOffset(t, {\n          reverseOrder,\n          gutter,\n          defaultPosition: position,\n        });\n        const positionStyle = getPositionStyle(toastPosition, offset);\n\n        return (\n          <ToastWrapper\n            id={t.id}\n            key={t.id}\n            onHeightUpdate={handlers.updateHeight}\n            className={t.visible ? activeClass : ''}\n            style={positionStyle}\n          >\n            {t.type === 'custom' ? (\n              resolveValue(t.message, t)\n            ) : children ? (\n              children(t)\n            ) : (\n              <ToastBar toast={t} position={toastPosition} />\n            )}\n          </ToastWrapper>\n        );\n      })}\n    </div>\n  );\n};\n"],"mappings":"4jBAAA,gOCuBA,GAAM,IAAa,AACjB,GAEA,MAAO,IAAkB,WAEd,EAAe,CAC1B,EACA,IACY,GAAW,CAAa,EAAI,EAAc,CAAG,EAAI,EC/BxD,GAAM,GAAS,KAAM,CAC1B,GAAI,GAAQ,EACZ,MAAO,IACG,GAAE,GAAO,SAAS,CAE9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ACpE,EAAuC,EAAS,SAAS,QAAQ,EACnE,CACE,eAAgB,QAClB,EACA,EAAS,SAAS,OAAO,EACzB,CACE,eAAgB,UAClB,EACA,CAAC,EACL,MAAO,CACL,KAAM,EACN,MAAO,EACP,QAAS,OACT,SAAU,WACV,WAAY,EAAqB,EAC7B,OACA,yCACJ,UAAW,cAAc,EAAU,GAAM,EAAI,SAC7C,GAAG,EACH,GAAG,CACL,CACF,EAEM,GAAc;AAAA;AAAA;AAAA;AAAA;AAAA,EAOd,EAAiB,GAEV,EAAkC,CAAC,CAC9C,eACA,WAAW,aACX,eACA,SACA,WACA,iBACA,wBACI,CACJ,GAAM,CAAE,SAAQ,YAAa,EAAW,CAAY,EAEpD,MACE,iBAAC,OACC,MAAO,CACL,SAAU,QACV,OAAQ,KACR,IAAK,EACL,KAAM,EACN,MAAO,EACP,OAAQ,EACR,cAAe,OACf,GAAG,CACL,EACA,UAAW,EACX,aAAc,EAAS,WACvB,aAAc,EAAS,UAEtB,EAAO,IAAI,AAAC,GAAM,CACjB,GAAM,GAAgB,EAAE,UAAY,EAC9B,EAAS,EAAS,gBAAgB,EAAG,CACzC,eACA,SACA,gBAAiB,CACnB,CAAC,EACK,EAAgB,GAAiB,EAAe,CAAM,EAE5D,MACE,iBAAC,IACC,GAAI,EAAE,GACN,IAAK,EAAE,GACP,eAAgB,EAAS,aACzB,UAAW,EAAE,QAAU,GAAc,GACrC,MAAO,GAEN,EAAE,OAAS,SACV,EAAa,EAAE,QAAS,CAAC,EACvB,EACF,EAAS,CAAC,EAEV,gBAAC,GAAS,MAAO,EAAG,SAAU,EAAe,CAEjD,CAEJ,CAAC,CACH,CAEJ,EXhIA,GAAO,IAAQ","names":[]}
\ No newline at end of file
+{"version":3,"sources":["../src/index.ts","../src/core/types.ts","../src/core/utils.ts","../src/core/store.ts","../src/core/toast.ts","../src/core/use-toaster.ts","../src/components/toast-bar.tsx","../src/components/toast-icon.tsx","../src/components/error.tsx","../src/components/loader.tsx","../src/components/checkmark.tsx","../src/components/toaster.tsx"],"sourcesContent":["import { toast } from './core/toast';\r\n\r\nexport * from './headless';\r\n\r\nexport { ToastBar } from './components/toast-bar';\r\nexport { ToastIcon } from './components/toast-icon';\r\nexport { Toaster } from './components/toaster';\r\nexport { CheckmarkIcon } from './components/checkmark';\r\nexport { ErrorIcon } from './components/error';\r\nexport { LoaderIcon } from './components/loader';\r\n\r\nexport { toast };\r\nexport default toast;\r\n","import { CSSProperties } from 'react';\r\n\r\nexport type ToastType = 'success' | 'error' | 'loading' | 'blank' | 'custom';\r\nexport type ToastPosition =\r\n  | 'top-left'\r\n  | 'top-center'\r\n  | 'top-right'\r\n  | 'bottom-left'\r\n  | 'bottom-center'\r\n  | 'bottom-right'\r\n  | 'center-right'\r\n  | 'center-left';\r\n\r\nexport type Renderable = JSX.Element | string | null;\r\n\r\nexport interface IconTheme {\r\n  primary: string;\r\n  secondary: string;\r\n}\r\n\r\nexport type ValueFunction<TValue, TArg> = (arg: TArg) => TValue;\r\nexport type ValueOrFunction<TValue, TArg> =\r\n  | TValue\r\n  | ValueFunction<TValue, TArg>;\r\n\r\nconst isFunction = <TValue, TArg>(\r\n  valOrFunction: ValueOrFunction<TValue, TArg>\r\n): valOrFunction is ValueFunction<TValue, TArg> =>\r\n  typeof valOrFunction === 'function';\r\n\r\nexport const resolveValue = <TValue, TArg>(\r\n  valOrFunction: ValueOrFunction<TValue, TArg>,\r\n  arg: TArg\r\n): TValue => (isFunction(valOrFunction) ? valOrFunction(arg) : valOrFunction);\r\n\r\nexport interface Toast {\r\n  type: ToastType;\r\n  id: string;\r\n  message: ValueOrFunction<Renderable, Toast>;\r\n  icon?: Renderable;\r\n  duration?: number;\r\n  pauseDuration: number;\r\n  position?: ToastPosition;\r\n\r\n  ariaProps: {\r\n    role: 'status' | 'alert';\r\n    'aria-live': 'assertive' | 'off' | 'polite';\r\n  };\r\n\r\n  style?: CSSProperties;\r\n  className?: string;\r\n  iconTheme?: IconTheme;\r\n\r\n  createdAt: number;\r\n  visible: boolean;\r\n  height?: number;\r\n}\r\n\r\nexport type ToastOptions = Partial<\r\n  Pick<\r\n    Toast,\r\n    | 'id'\r\n    | 'icon'\r\n    | 'duration'\r\n    | 'ariaProps'\r\n    | 'className'\r\n    | 'style'\r\n    | 'position'\r\n    | 'iconTheme'\r\n  >\r\n>;\r\n\r\nexport type DefaultToastOptions = ToastOptions & {\r\n  [key in ToastType]?: ToastOptions;\r\n};\r\n\r\nexport interface ToasterProps {\r\n  position?: ToastPosition;\r\n  toastOptions?: DefaultToastOptions;\r\n  reverseOrder?: boolean;\r\n  gutter?: number;\r\n  containerStyle?: React.CSSProperties;\r\n  containerClassName?: string;\r\n  children?: (toast: Toast) => JSX.Element;\r\n}\r\n\r\nexport interface ToastWrapperProps {\r\n  id: string;\r\n  className?: string;\r\n  style?: React.CSSProperties;\r\n  onHeightUpdate: (id: string, height: number) => void;\r\n  children?: React.ReactNode;\r\n}\r\n","export const genId = (() => {\r\n  let count = 0;\r\n  return () => {\r\n    return (++count).toString();\r\n  };\r\n})();\r\n\r\nexport const prefersReducedMotion = (() => {\r\n  // Cache result\r\n  let shouldReduceMotion: boolean | undefined = undefined;\r\n\r\n  return () => {\r\n    if (shouldReduceMotion === undefined && typeof window !== 'undefined') {\r\n      const mediaQuery = matchMedia('(prefers-reduced-motion: reduce)');\r\n      shouldReduceMotion = !mediaQuery || mediaQuery.matches;\r\n    }\r\n    return shouldReduceMotion;\r\n  };\r\n})();\r\n","import { useEffect, useState } from 'react';\r\nimport { DefaultToastOptions, Toast, ToastType } from './types';\r\n\r\nconst TOAST_LIMIT = 20;\r\n\r\nexport enum ActionType {\r\n  ADD_TOAST,\r\n  UPDATE_TOAST,\r\n  UPSERT_TOAST,\r\n  DISMISS_TOAST,\r\n  REMOVE_TOAST,\r\n  START_PAUSE,\r\n  END_PAUSE,\r\n}\r\n\r\ntype Action =\r\n  | {\r\n      type: ActionType.ADD_TOAST;\r\n      toast: Toast;\r\n    }\r\n  | {\r\n      type: ActionType.UPSERT_TOAST;\r\n      toast: Toast;\r\n    }\r\n  | {\r\n      type: ActionType.UPDATE_TOAST;\r\n      toast: Partial<Toast>;\r\n    }\r\n  | {\r\n      type: ActionType.DISMISS_TOAST;\r\n      toastId?: string;\r\n    }\r\n  | {\r\n      type: ActionType.REMOVE_TOAST;\r\n      toastId?: string;\r\n    }\r\n  | {\r\n      type: ActionType.START_PAUSE;\r\n      time: number;\r\n    }\r\n  | {\r\n      type: ActionType.END_PAUSE;\r\n      time: number;\r\n    };\r\n\r\ninterface State {\r\n  toasts: Toast[];\r\n  pausedAt: number | undefined;\r\n}\r\n\r\nconst toastTimeouts = new Map<Toast['id'], ReturnType<typeof setTimeout>>();\r\n\r\nexport const TOAST_EXPIRE_DISMISS_DELAY = 1000;\r\n\r\nconst addToRemoveQueue = (toastId: string) => {\r\n  if (toastTimeouts.has(toastId)) {\r\n    return;\r\n  }\r\n\r\n  const timeout = setTimeout(() => {\r\n    toastTimeouts.delete(toastId);\r\n    dispatch({\r\n      type: ActionType.REMOVE_TOAST,\r\n      toastId: toastId,\r\n    });\r\n  }, TOAST_EXPIRE_DISMISS_DELAY);\r\n\r\n  toastTimeouts.set(toastId, timeout);\r\n};\r\n\r\nconst clearFromRemoveQueue = (toastId: string) => {\r\n  const timeout = toastTimeouts.get(toastId);\r\n  if (timeout) {\r\n    clearTimeout(timeout);\r\n  }\r\n};\r\n\r\nexport const reducer = (state: State, action: Action): State => {\r\n  switch (action.type) {\r\n    case ActionType.ADD_TOAST:\r\n      return {\r\n        ...state,\r\n        toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),\r\n      };\r\n\r\n    case ActionType.UPDATE_TOAST:\r\n      //  ! Side effects !\r\n      if (action.toast.id) {\r\n        clearFromRemoveQueue(action.toast.id);\r\n      }\r\n\r\n      return {\r\n        ...state,\r\n        toasts: state.toasts.map((t) =>\r\n          t.id === action.toast.id ? { ...t, ...action.toast } : t\r\n        ),\r\n      };\r\n\r\n    case ActionType.UPSERT_TOAST:\r\n      const { toast } = action;\r\n      return state.toasts.find((t) => t.id === toast.id)\r\n        ? reducer(state, { type: ActionType.UPDATE_TOAST, toast })\r\n        : reducer(state, { type: ActionType.ADD_TOAST, toast });\r\n\r\n    case ActionType.DISMISS_TOAST:\r\n      const { toastId } = action;\r\n\r\n      // ! Side effects ! - This could be execrated into a dismissToast() action, but I'll keep it here for simplicity\r\n      if (toastId) {\r\n        addToRemoveQueue(toastId);\r\n      } else {\r\n        state.toasts.forEach((toast) => {\r\n          addToRemoveQueue(toast.id);\r\n        });\r\n      }\r\n\r\n      return {\r\n        ...state,\r\n        toasts: state.toasts.map((t) =>\r\n          t.id === toastId || toastId === undefined\r\n            ? {\r\n                ...t,\r\n                visible: false,\r\n              }\r\n            : t\r\n        ),\r\n      };\r\n    case ActionType.REMOVE_TOAST:\r\n      if (action.toastId === undefined) {\r\n        return {\r\n          ...state,\r\n          toasts: [],\r\n        };\r\n      }\r\n      return {\r\n        ...state,\r\n        toasts: state.toasts.filter((t) => t.id !== action.toastId),\r\n      };\r\n\r\n    case ActionType.START_PAUSE:\r\n      return {\r\n        ...state,\r\n        pausedAt: action.time,\r\n      };\r\n\r\n    case ActionType.END_PAUSE:\r\n      const diff = action.time - (state.pausedAt || 0);\r\n\r\n      return {\r\n        ...state,\r\n        pausedAt: undefined,\r\n        toasts: state.toasts.map((t) => ({\r\n          ...t,\r\n          pauseDuration: t.pauseDuration + diff,\r\n        })),\r\n      };\r\n  }\r\n};\r\n\r\nconst listeners: Array<(state: State) => void> = [];\r\n\r\nlet memoryState: State = { toasts: [], pausedAt: undefined };\r\n\r\nexport const dispatch = (action: Action) => {\r\n  memoryState = reducer(memoryState, action);\r\n  listeners.forEach((listener) => {\r\n    listener(memoryState);\r\n  });\r\n};\r\n\r\nexport const defaultTimeouts: {\r\n  [key in ToastType]: number;\r\n} = {\r\n  blank: 4000,\r\n  error: 4000,\r\n  success: 2000,\r\n  loading: Infinity,\r\n  custom: 4000,\r\n};\r\n\r\nexport const useStore = (toastOptions: DefaultToastOptions = {}): State => {\r\n  const [state, setState] = useState<State>(memoryState);\r\n  useEffect(() => {\r\n    listeners.push(setState);\r\n    return () => {\r\n      const index = listeners.indexOf(setState);\r\n      if (index > -1) {\r\n        listeners.splice(index, 1);\r\n      }\r\n    };\r\n  }, [state]);\r\n\r\n  const mergedToasts = state.toasts.map((t) => ({\r\n    ...toastOptions,\r\n    ...toastOptions[t.type],\r\n    ...t,\r\n    duration:\r\n      t.duration ||\r\n      toastOptions[t.type]?.duration ||\r\n      toastOptions?.duration ||\r\n      defaultTimeouts[t.type],\r\n    style: {\r\n      ...toastOptions.style,\r\n      ...toastOptions[t.type]?.style,\r\n      ...t.style,\r\n    },\r\n  }));\r\n\r\n  return {\r\n    ...state,\r\n    toasts: mergedToasts,\r\n  };\r\n};\r\n","import {\r\n  Renderable,\r\n  Toast,\r\n  ToastOptions,\r\n  ToastType,\r\n  DefaultToastOptions,\r\n  ValueOrFunction,\r\n  resolveValue,\r\n} from './types';\r\nimport { genId } from './utils';\r\nimport { dispatch, ActionType } from './store';\r\n\r\ntype Message = ValueOrFunction<Renderable, Toast>;\r\n\r\ntype ToastHandler = (message: Message, options?: ToastOptions) => string;\r\n\r\nconst createToast = (\r\n  message: Message,\r\n  type: ToastType = 'blank',\r\n  opts?: ToastOptions\r\n): Toast => ({\r\n  createdAt: Date.now(),\r\n  visible: true,\r\n  type,\r\n  ariaProps: {\r\n    role: 'status',\r\n    'aria-live': 'polite',\r\n  },\r\n  message,\r\n  pauseDuration: 0,\r\n  ...opts,\r\n  id: opts?.id || genId(),\r\n});\r\n\r\nconst createHandler =\r\n  (type?: ToastType): ToastHandler =>\r\n  (message, options) => {\r\n    const toast = createToast(message, type, options);\r\n    dispatch({ type: ActionType.UPSERT_TOAST, toast });\r\n    return toast.id;\r\n  };\r\n\r\nconst toast = (message: Message, opts?: ToastOptions) =>\r\n  createHandler('blank')(message, opts);\r\n\r\ntoast.error = createHandler('error');\r\ntoast.success = createHandler('success');\r\ntoast.loading = createHandler('loading');\r\ntoast.custom = createHandler('custom');\r\n\r\ntoast.dismiss = (toastId?: string) => {\r\n  dispatch({\r\n    type: ActionType.DISMISS_TOAST,\r\n    toastId,\r\n  });\r\n};\r\n\r\ntoast.remove = (toastId?: string) =>\r\n  dispatch({ type: ActionType.REMOVE_TOAST, toastId });\r\n\r\ntoast.promise = <T>(\r\n  promise: Promise<T>,\r\n  msgs: {\r\n    loading: Renderable;\r\n    success: ValueOrFunction<Renderable, T>;\r\n    error: ValueOrFunction<Renderable, any>;\r\n  },\r\n  opts?: DefaultToastOptions\r\n) => {\r\n  const id = toast.loading(msgs.loading, { ...opts, ...opts?.loading });\r\n\r\n  promise\r\n    .then((p) => {\r\n      toast.success(resolveValue(msgs.success, p), {\r\n        id,\r\n        ...opts,\r\n        ...opts?.success,\r\n      });\r\n      return p;\r\n    })\r\n    .catch((e) => {\r\n      toast.error(resolveValue(msgs.error, e), {\r\n        id,\r\n        ...opts,\r\n        ...opts?.error,\r\n      });\r\n    });\r\n\r\n  return promise;\r\n};\r\n\r\nexport { toast };\r\n","import { useEffect, useCallback } from 'react';\r\nimport { dispatch, ActionType, useStore } from './store';\r\nimport { toast } from './toast';\r\nimport { DefaultToastOptions, Toast, ToastPosition } from './types';\r\n\r\nconst updateHeight = (toastId: string, height: number) => {\r\n  dispatch({\r\n    type: ActionType.UPDATE_TOAST,\r\n    toast: { id: toastId, height },\r\n  });\r\n};\r\nconst startPause = () => {\r\n  dispatch({\r\n    type: ActionType.START_PAUSE,\r\n    time: Date.now(),\r\n  });\r\n};\r\n\r\nexport const useToaster = (toastOptions?: DefaultToastOptions) => {\r\n  const { toasts, pausedAt } = useStore(toastOptions);\r\n\r\n  useEffect(() => {\r\n    if (pausedAt) {\r\n      return;\r\n    }\r\n\r\n    const now = Date.now();\r\n    const timeouts = toasts.map((t) => {\r\n      if (t.duration === Infinity) {\r\n        return;\r\n      }\r\n\r\n      const durationLeft =\r\n        (t.duration || 0) + t.pauseDuration - (now - t.createdAt);\r\n\r\n      if (durationLeft < 0) {\r\n        if (t.visible) {\r\n          toast.dismiss(t.id);\r\n        }\r\n        return;\r\n      }\r\n      return setTimeout(() => toast.dismiss(t.id), durationLeft);\r\n    });\r\n\r\n    return () => {\r\n      timeouts.forEach((timeout) => timeout && clearTimeout(timeout));\r\n    };\r\n  }, [toasts, pausedAt]);\r\n\r\n  const endPause = useCallback(() => {\r\n    if (pausedAt) {\r\n      dispatch({ type: ActionType.END_PAUSE, time: Date.now() });\r\n    }\r\n  }, [pausedAt]);\r\n\r\n  const calculateOffset = useCallback(\r\n    (\r\n      toast: Toast,\r\n      opts?: {\r\n        reverseOrder?: boolean;\r\n        gutter?: number;\r\n        defaultPosition?: ToastPosition;\r\n      }\r\n    ) => {\r\n      const { reverseOrder = false, gutter = 8, defaultPosition } = opts || {};\r\n\r\n      const relevantToasts = toasts.filter(\r\n        (t) =>\r\n          (t.position || defaultPosition) ===\r\n            (toast.position || defaultPosition) && t.height\r\n      );\r\n      const toastIndex = relevantToasts.findIndex((t) => t.id === toast.id);\r\n      const toastsBefore = relevantToasts.filter(\r\n        (toast, i) => i < toastIndex && toast.visible\r\n      ).length;\r\n\r\n      const offset = relevantToasts\r\n        .filter((t) => t.visible)\r\n        .slice(...(reverseOrder ? [toastsBefore + 1] : [0, toastsBefore]))\r\n        .reduce((acc, t) => acc + (t.height || 0) + gutter, 0);\r\n\r\n      return offset;\r\n    },\r\n    [toasts]\r\n  );\r\n\r\n  return {\r\n    toasts,\r\n    handlers: {\r\n      updateHeight,\r\n      startPause,\r\n      endPause,\r\n      calculateOffset,\r\n    },\r\n  };\r\n};\r\n","import * as React from 'react';\r\nimport { styled, keyframes } from 'goober';\r\n\r\nimport { Toast, ToastPosition, resolveValue, Renderable } from '../core/types';\r\nimport { ToastIcon } from './toast-icon';\r\nimport { prefersReducedMotion } from '../core/utils';\r\n\r\nconst enterAnimation = (factor: number) => `\r\n0% {transform: translate3d(0,${factor * -200}%,0) scale(.6); opacity:.5;}\r\n100% {transform: translate3d(0,0,0) scale(1); opacity:1;}\r\n`;\r\n\r\nconst exitAnimation = (factor: number) => `\r\n0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}\r\n100% {transform: translate3d(0,${factor * -150}%,-1px) scale(.6); opacity:0;}\r\n`;\r\n\r\nconst fadeInAnimation = `0%{opacity:0;} 100%{opacity:1;}`;\r\nconst fadeOutAnimation = `0%{opacity:1;} 100%{opacity:0;}`;\r\n\r\nconst ToastBarBase = styled('div')`\r\n  display: flex;\r\n  align-items: center;\r\n  background: #fff;\r\n  color: #363636;\r\n  line-height: 1.3;\r\n  will-change: transform;\r\n  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05);\r\n  max-width: 350px;\r\n  pointer-events: auto;\r\n  padding: 8px 10px;\r\n  border-radius: 8px;\r\n`;\r\n\r\nconst Message = styled('div')`\r\n  display: flex;\r\n  justify-content: center;\r\n  margin: 4px 10px;\r\n  color: inherit;\r\n  flex: 1 1 auto;\r\n  white-space: pre-line;\r\n`;\r\n\r\ninterface ToastBarProps {\r\n  toast: Toast;\r\n  position?: ToastPosition;\r\n  style?: React.CSSProperties;\r\n  children?: (components: {\r\n    icon: Renderable;\r\n    message: Renderable;\r\n  }) => Renderable;\r\n}\r\n\r\nconst getAnimationStyle = (\r\n  position: ToastPosition,\r\n  visible: boolean\r\n): React.CSSProperties => {\r\n  const top = position.includes('top');\r\n  const factor = top ? 1 : -1;\r\n\r\n  const [enter, exit] = prefersReducedMotion()\r\n    ? [fadeInAnimation, fadeOutAnimation]\r\n    : [enterAnimation(factor), exitAnimation(factor)];\r\n\r\n  return {\r\n    animation: visible\r\n      ? `${keyframes(enter)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`\r\n      : `${keyframes(exit)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`,\r\n  };\r\n};\r\n\r\nexport const ToastBar: React.FC<ToastBarProps> = React.memo(\r\n  ({ toast, position, style, children }) => {\r\n    const animationStyle: React.CSSProperties = toast.height\r\n      ? getAnimationStyle(\r\n          toast.position || position || 'top-center',\r\n          toast.visible\r\n        )\r\n      : { opacity: 0 };\r\n\r\n    const icon = <ToastIcon toast={toast} />;\r\n    const message = (\r\n      <Message {...toast.ariaProps}>\r\n        {resolveValue(toast.message, toast)}\r\n      </Message>\r\n    );\r\n\r\n    return (\r\n      <ToastBarBase\r\n        className={toast.className}\r\n        style={{\r\n          ...animationStyle,\r\n          ...style,\r\n          ...toast.style,\r\n        }}\r\n      >\r\n        {typeof children === 'function' ? (\r\n          children({\r\n            icon,\r\n            message,\r\n          })\r\n        ) : (\r\n          <>\r\n            {icon}\r\n            {message}\r\n          </>\r\n        )}\r\n      </ToastBarBase>\r\n    );\r\n  }\r\n);\r\n","import * as React from 'react';\r\nimport { styled, keyframes } from 'goober';\r\n\r\nimport { Toast } from '../core/types';\r\nimport { ErrorIcon, ErrorTheme } from './error';\r\nimport { LoaderIcon, LoaderTheme } from './loader';\r\nimport { CheckmarkIcon, CheckmarkTheme } from './checkmark';\r\n\r\nconst StatusWrapper = styled('div')`\r\n  position: absolute;\r\n`;\r\n\r\nconst IndicatorWrapper = styled('div')`\r\n  position: relative;\r\n  display: flex;\r\n  justify-content: center;\r\n  align-items: center;\r\n  min-width: 20px;\r\n  min-height: 20px;\r\n`;\r\n\r\nconst enter = keyframes`\r\nfrom {\r\n  transform: scale(0.6);\r\n  opacity: 0.4;\r\n}\r\nto {\r\n  transform: scale(1);\r\n  opacity: 1;\r\n}`;\r\n\r\nexport const AnimatedIconWrapper = styled('div')`\r\n  position: relative;\r\n  transform: scale(0.6);\r\n  opacity: 0.4;\r\n  min-width: 20px;\r\n  animation: ${enter} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)\r\n    forwards;\r\n`;\r\n\r\nexport type IconThemes = Partial<{\r\n  success: CheckmarkTheme;\r\n  error: ErrorTheme;\r\n  loading: LoaderTheme;\r\n}>;\r\n\r\nexport const ToastIcon: React.FC<{\r\n  toast: Toast;\r\n}> = ({ toast }) => {\r\n  const { icon, type, iconTheme } = toast;\r\n  if (icon !== undefined) {\r\n    if (typeof icon === 'string') {\r\n      return <AnimatedIconWrapper>{icon}</AnimatedIconWrapper>;\r\n    } else {\r\n      return icon;\r\n    }\r\n  }\r\n\r\n  if (type === 'blank') {\r\n    return null;\r\n  }\r\n\r\n  return (\r\n    <IndicatorWrapper>\r\n      <LoaderIcon {...iconTheme} />\r\n      {type !== 'loading' && (\r\n        <StatusWrapper>\r\n          {type === 'error' ? (\r\n            <ErrorIcon {...iconTheme} />\r\n          ) : (\r\n            <CheckmarkIcon {...iconTheme} />\r\n          )}\r\n        </StatusWrapper>\r\n      )}\r\n    </IndicatorWrapper>\r\n  );\r\n};\r\n","import { styled, keyframes } from 'goober';\r\n\r\nconst circleAnimation = keyframes`\r\nfrom {\r\n  transform: scale(0) rotate(45deg);\r\n\topacity: 0;\r\n}\r\nto {\r\n transform: scale(1) rotate(45deg);\r\n  opacity: 1;\r\n}`;\r\n\r\nconst firstLineAnimation = keyframes`\r\nfrom {\r\n  transform: scale(0);\r\n  opacity: 0;\r\n}\r\nto {\r\n  transform: scale(1);\r\n  opacity: 1;\r\n}`;\r\n\r\nconst secondLineAnimation = keyframes`\r\nfrom {\r\n  transform: scale(0) rotate(90deg);\r\n\topacity: 0;\r\n}\r\nto {\r\n  transform: scale(1) rotate(90deg);\r\n\topacity: 1;\r\n}`;\r\n\r\nexport interface ErrorTheme {\r\n  primary?: string;\r\n  secondary?: string;\r\n}\r\n\r\nexport const ErrorIcon = styled('div')<ErrorTheme>`\r\n  width: 20px;\r\n  opacity: 0;\r\n  height: 20px;\r\n  border-radius: 10px;\r\n  background: ${(p) => p.primary || '#ff4b4b'};\r\n  position: relative;\r\n  transform: rotate(45deg);\r\n\r\n  animation: ${circleAnimation} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)\r\n    forwards;\r\n  animation-delay: 100ms;\r\n\r\n  &:after,\r\n  &:before {\r\n    content: '';\r\n    animation: ${firstLineAnimation} 0.15s ease-out forwards;\r\n    animation-delay: 150ms;\r\n    position: absolute;\r\n    border-radius: 3px;\r\n    opacity: 0;\r\n    background: ${(p) => p.secondary || '#fff'};\r\n    bottom: 9px;\r\n    left: 4px;\r\n    height: 2px;\r\n    width: 12px;\r\n  }\r\n\r\n  &:before {\r\n    animation: ${secondLineAnimation} 0.15s ease-out forwards;\r\n    animation-delay: 180ms;\r\n    transform: rotate(90deg);\r\n  }\r\n`;\r\n","import { styled, keyframes } from 'goober';\r\n\r\nconst rotate = keyframes`\r\n  from {\r\n    transform: rotate(0deg);\r\n  }\r\n  to {\r\n    transform: rotate(360deg);\r\n  }\r\n`;\r\n\r\nexport interface LoaderTheme {\r\n  primary?: string;\r\n  secondary?: string;\r\n}\r\n\r\nexport const LoaderIcon = styled('div')<LoaderTheme>`\r\n  width: 12px;\r\n  height: 12px;\r\n  box-sizing: border-box;\r\n  border: 2px solid;\r\n  border-radius: 100%;\r\n  border-color: ${(p) => p.secondary || '#e0e0e0'};\r\n  border-right-color: ${(p) => p.primary || '#616161'};\r\n  animation: ${rotate} 1s linear infinite;\r\n`;\r\n","import { styled, keyframes } from 'goober';\r\n\r\nconst circleAnimation = keyframes`\r\nfrom {\r\n  transform: scale(0) rotate(45deg);\r\n\topacity: 0;\r\n}\r\nto {\r\n  transform: scale(1) rotate(45deg);\r\n\topacity: 1;\r\n}`;\r\n\r\nconst checkmarkAnimation = keyframes`\r\n0% {\r\n\theight: 0;\r\n\twidth: 0;\r\n\topacity: 0;\r\n}\r\n40% {\r\n  height: 0;\r\n\twidth: 6px;\r\n\topacity: 1;\r\n}\r\n100% {\r\n  opacity: 1;\r\n  height: 10px;\r\n}`;\r\n\r\nexport interface CheckmarkTheme {\r\n  primary?: string;\r\n  secondary?: string;\r\n}\r\n\r\nexport const CheckmarkIcon = styled('div')<CheckmarkTheme>`\r\n  width: 20px;\r\n  opacity: 0;\r\n  height: 20px;\r\n  border-radius: 10px;\r\n  background: ${(p) => p.primary || '#61d345'};\r\n  position: relative;\r\n  transform: rotate(45deg);\r\n\r\n  animation: ${circleAnimation} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)\r\n    forwards;\r\n  animation-delay: 100ms;\r\n  &:after {\r\n    content: '';\r\n    box-sizing: border-box;\r\n    animation: ${checkmarkAnimation} 0.2s ease-out forwards;\r\n    opacity: 0;\r\n    animation-delay: 200ms;\r\n    position: absolute;\r\n    border-right: 2px solid;\r\n    border-bottom: 2px solid;\r\n    border-color: ${(p) => p.secondary || '#fff'};\r\n    bottom: 6px;\r\n    left: 6px;\r\n    height: 10px;\r\n    width: 6px;\r\n  }\r\n`;\r\n","import { css, setup } from 'goober';\r\nimport * as React from 'react';\r\nimport {\r\n  resolveValue,\r\n  ToasterProps,\r\n  ToastPosition,\r\n  ToastWrapperProps,\r\n} from '../core/types';\r\nimport { useToaster } from '../core/use-toaster';\r\nimport { prefersReducedMotion } from '../core/utils';\r\nimport { ToastBar } from './toast-bar';\r\n\r\nsetup(React.createElement);\r\n\r\nconst ToastWrapper = ({\r\n  id,\r\n  className,\r\n  style,\r\n  onHeightUpdate,\r\n  children,\r\n}: ToastWrapperProps) => {\r\n  const ref = React.useCallback(\r\n    (el: HTMLElement | null) => {\r\n      if (el) {\r\n        const updateHeight = () => {\r\n          const height = el.getBoundingClientRect().height;\r\n          onHeightUpdate(id, height);\r\n        };\r\n        updateHeight();\r\n        new MutationObserver(updateHeight).observe(el, {\r\n          subtree: true,\r\n          childList: true,\r\n          characterData: true,\r\n        });\r\n      }\r\n    },\r\n    [id, onHeightUpdate]\r\n  );\r\n\r\n  return (\r\n    <div ref={ref} className={className} style={style}>\r\n      {children}\r\n    </div>\r\n  );\r\n};\r\n\r\nconst getPositionStyle = (\r\n  position: ToastPosition,\r\n  offset: number\r\n): React.CSSProperties => {\r\n  const top = position.includes('top') || position.includes('center-');\r\n  const verticalStyle: React.CSSProperties = top\r\n    ? {\r\n        top: position.includes('center-') ? '50%' : 0,\r\n      }\r\n    : { bottom: 0 };\r\n  const horizontalStyle: React.CSSProperties = position.includes('center-right')\r\n    ? { justifyContent: 'flex-end' }\r\n    : position.includes('center-left')\r\n    ? { justifyContent: 'flex-start' }\r\n    : position.includes('center')\r\n    ? {\r\n        justifyContent: 'center',\r\n      }\r\n    : position.includes('right')\r\n    ? {\r\n        justifyContent: 'flex-end',\r\n      }\r\n    : {};\r\n  return {\r\n    left: 0,\r\n    right: 0,\r\n    display: 'flex',\r\n    position: 'absolute',\r\n    transition: prefersReducedMotion()\r\n      ? undefined\r\n      : `all 230ms cubic-bezier(.21,1.02,.73,1)`,\r\n    transform: `translateY(${offset * (top ? 1 : -1)}px)`,\r\n    ...verticalStyle,\r\n    ...horizontalStyle,\r\n  };\r\n};\r\n\r\nconst activeClass = css`\r\n  z-index: 9999;\r\n  > * {\r\n    pointer-events: auto;\r\n  }\r\n`;\r\n\r\nconst DEFAULT_OFFSET = 16;\r\n\r\nexport const Toaster: React.FC<ToasterProps> = ({\r\n  reverseOrder,\r\n  position = 'top-center',\r\n  toastOptions,\r\n  gutter,\r\n  children,\r\n  containerStyle,\r\n  containerClassName,\r\n}) => {\r\n  const { toasts, handlers } = useToaster(toastOptions);\r\n\r\n  return (\r\n    <div\r\n      style={{\r\n        position: 'fixed',\r\n        zIndex: 9999,\r\n        top: DEFAULT_OFFSET,\r\n        left: DEFAULT_OFFSET,\r\n        right: DEFAULT_OFFSET,\r\n        bottom: DEFAULT_OFFSET,\r\n        pointerEvents: 'none',\r\n        ...containerStyle,\r\n      }}\r\n      className={containerClassName}\r\n      onMouseEnter={handlers.startPause}\r\n      onMouseLeave={handlers.endPause}\r\n    >\r\n      {toasts.map((t) => {\r\n        const toastPosition = t.position || position;\r\n        const offset = handlers.calculateOffset(t, {\r\n          reverseOrder,\r\n          gutter,\r\n          defaultPosition: position,\r\n        });\r\n        const positionStyle = getPositionStyle(toastPosition, offset);\r\n\r\n        return (\r\n          <ToastWrapper\r\n            id={t.id}\r\n            key={t.id}\r\n            onHeightUpdate={handlers.updateHeight}\r\n            className={t.visible ? activeClass : ''}\r\n            style={positionStyle}\r\n          >\r\n            {t.type === 'custom' ? (\r\n              resolveValue(t.message, t)\r\n            ) : children ? (\r\n              children(t)\r\n            ) : (\r\n              <ToastBar toast={t} position={toastPosition} />\r\n            )}\r\n          </ToastWrapper>\r\n        );\r\n      })}\r\n    </div>\r\n  );\r\n};\r\n"],"mappings":"4jBAAA,gOCyBA,GAAM,IAAa,AACjB,GAEA,MAAO,IAAkB,WAEd,EAAe,CAC1B,EACA,IACY,GAAW,CAAa,EAAI,EAAc,CAAG,EAAI,ECjCxD,GAAM,GAAS,KAAM,CAC1B,GAAI,GAAQ,EACZ,MAAO,IACG,GAAE,GAAO,SAAS,CAE9B,GAAG,EAEU,EAAwB,KAAM,CAEzC,GAAI,GAEJ,MAAO,IAAM,CACX,GAAI,IAAuB,QAAa,MAAO,QAAW,IAAa,CACrE,GAAM,GAAa,WAAW,kCAAkC,EAChE,EAAqB,CAAC,GAAc,EAAW,OACjD,CACA,MAAO,EACT,CACF,GAAG,EClBH,MAAoC,iBAG9B,GAAc,GA+CpB,GAAM,GAAgB,GAAI,KAEb,GAA6B,IAEpC,EAAmB,AAAC,GAAoB,CAC5C,GAAI,EAAc,IAAI,CAAO,EAC3B,OAGF,GAAM,GAAU,WAAW,IAAM,CAC/B,EAAc,OAAO,CAAO,EAC5B,EAAS,CACP,KAAM,EACN,QAAS,CACX,CAAC,CACH,EAAG,EAA0B,EAE7B,EAAc,IAAI,EAAS,CAAO,CACpC,EAEM,GAAuB,AAAC,GAAoB,CAChD,GAAM,GAAU,EAAc,IAAI,CAAO,EACzC,AAAI,GACF,aAAa,CAAO,CAExB,EAEa,EAAU,CAAC,EAAc,IAA0B,CAC9D,OAAQ,EAAO,UACR,GACH,MAAO,CACL,GAAG,EACH,OAAQ,CAAC,EAAO,MAAO,GAAG,EAAM,MAAM,EAAE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A,UAAW,EACX,aAAc,EAAS,WACvB,aAAc,EAAS,UAEtB,EAAO,IAAI,AAAC,GAAM,CACjB,GAAM,GAAgB,EAAE,UAAY,EAC9B,EAAS,EAAS,gBAAgB,EAAG,CACzC,eACA,SACA,gBAAiB,CACnB,CAAC,EACK,EAAgB,GAAiB,EAAe,CAAM,EAE5D,MACE,iBAAC,IACC,GAAI,EAAE,GACN,IAAK,EAAE,GACP,eAAgB,EAAS,aACzB,UAAW,EAAE,QAAU,GAAc,GACrC,MAAO,GAEN,EAAE,OAAS,SACV,EAAa,EAAE,QAAS,CAAC,EACvB,EACF,EAAS,CAAC,EAEV,gBAAC,GAAS,MAAO,EAAG,SAAU,EAAe,CAEjD,CAEJ,CAAC,CACH,CAEJ,EXxIA,GAAO,IAAQ","names":[]}
\ No newline at end of file
diff --git a/dist/index.mjs b/dist/index.mjs
index 9d9e5a07f2526134ccffc5d501ad60baa913e6ba..c36187d9f1d5a05b493f5032e868d0a56c4869b8 100644
--- a/dist/index.mjs
+++ b/dist/index.mjs
@@ -1,4 +1,4 @@
-var W=e=>typeof e=="function",T=(e,t)=>W(e)?e(t):e;var U=(()=>{let e=0;return()=>(++e).toString()})(),b=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})();import{useEffect as H,useState as j}from"react";var Q=20;var S=new Map,X=1e3,$=e=>{if(S.has(e))return;let t=setTimeout(()=>{S.delete(e),u({type:4,toastId:e})},X);S.set(e,t)},J=e=>{let t=S.get(e);t&&clearTimeout(t)},v=(e,t)=>{switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,Q)};case 1:return t.toast.id&&J(t.toast.id),{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case 2:let{toast:o}=t;return e.toasts.find(r=>r.id===o.id)?v(e,{type:1,toast:o}):v(e,{type:0,toast:o});case 3:let{toastId:s}=t;return s?$(s):e.toasts.forEach(r=>{$(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===s||s===void 0?{...r,visible:!1}:r)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let a=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(r=>({...r,pauseDuration:r.pauseDuration+a}))}}},A=[],P={toasts:[],pausedAt:void 0},u=e=>{P=v(P,e),A.forEach(t=>{t(P)})},Y={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},I=(e={})=>{let[t,o]=j(P);H(()=>(A.push(o),()=>{let a=A.indexOf(o);a>-1&&A.splice(a,1)}),[t]);let s=t.toasts.map(a=>{var r,c;return{...e,...e[a.type],...a,duration:a.duration||((r=e[a.type])==null?void 0:r.duration)||(e==null?void 0:e.duration)||Y[a.type],style:{...e.style,...(c=e[a.type])==null?void 0:c.style,...a.style}}});return{...t,toasts:s}};var G=(e,t="blank",o)=>({createdAt:Date.now(),visible:!0,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...o,id:(o==null?void 0:o.id)||U()}),h=e=>(t,o)=>{let s=G(t,e,o);return u({type:2,toast:s}),s.id},n=(e,t)=>h("blank")(e,t);n.error=h("error");n.success=h("success");n.loading=h("loading");n.custom=h("custom");n.dismiss=e=>{u({type:3,toastId:e})};n.remove=e=>u({type:4,toastId:e});n.promise=(e,t,o)=>{let s=n.loading(t.loading,{...o,...o==null?void 0:o.loading});return e.then(a=>(n.success(T(t.success,a),{id:s,...o,...o==null?void 0:o.success}),a)).catch(a=>{n.error(T(t.error,a),{id:s,...o,...o==null?void 0:o.error})}),e};import{useEffect as K,useCallback as L}from"react";var Z=(e,t)=>{u({type:1,toast:{id:e,height:t}})},ee=()=>{u({type:5,time:Date.now()})},D=e=>{let{toasts:t,pausedAt:o}=I(e);K(()=>{if(o)return;let r=Date.now(),c=t.map(i=>{if(i.duration===1/0)return;let d=(i.duration||0)+i.pauseDuration-(r-i.createdAt);if(d<0){i.visible&&n.dismiss(i.id);return}return setTimeout(()=>n.dismiss(i.id),d)});return()=>{c.forEach(i=>i&&clearTimeout(i))}},[t,o]);let s=L(()=>{o&&u({type:6,time:Date.now()})},[o]),a=L((r,c)=>{let{reverseOrder:i=!1,gutter:d=8,defaultPosition:p}=c||{},g=t.filter(m=>(m.position||p)===(r.position||p)&&m.height),E=g.findIndex(m=>m.id===r.id),x=g.filter((m,R)=>R<E&&m.visible).length;return g.filter(m=>m.visible).slice(...i?[x+1]:[0,x]).reduce((m,R)=>m+(R.height||0)+d,0)},[t]);return{toasts:t,handlers:{updateHeight:Z,startPause:ee,endPause:s,calculateOffset:a}}};import*as l from"react";import{styled as B,keyframes as z}from"goober";import*as y from"react";import{styled as C,keyframes as me}from"goober";import{styled as te,keyframes as k}from"goober";var oe=k`
+var W=e=>typeof e=="function",f=(e,t)=>W(e)?e(t):e;var U=(()=>{let e=0;return()=>(++e).toString()})(),b=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})();import{useEffect as H,useState as j}from"react";var Q=20;var S=new Map,X=1e3,$=e=>{if(S.has(e))return;let t=setTimeout(()=>{S.delete(e),m({type:4,toastId:e})},X);S.set(e,t)},J=e=>{let t=S.get(e);t&&clearTimeout(t)},v=(e,t)=>{switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,Q)};case 1:return t.toast.id&&J(t.toast.id),{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case 2:let{toast:o}=t;return e.toasts.find(r=>r.id===o.id)?v(e,{type:1,toast:o}):v(e,{type:0,toast:o});case 3:let{toastId:s}=t;return s?$(s):e.toasts.forEach(r=>{$(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===s||s===void 0?{...r,visible:!1}:r)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let a=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(r=>({...r,pauseDuration:r.pauseDuration+a}))}}},A=[],P={toasts:[],pausedAt:void 0},m=e=>{P=v(P,e),A.forEach(t=>{t(P)})},Y={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},I=(e={})=>{let[t,o]=j(P);H(()=>(A.push(o),()=>{let a=A.indexOf(o);a>-1&&A.splice(a,1)}),[t]);let s=t.toasts.map(a=>{var r,c;return{...e,...e[a.type],...a,duration:a.duration||((r=e[a.type])==null?void 0:r.duration)||(e==null?void 0:e.duration)||Y[a.type],style:{...e.style,...(c=e[a.type])==null?void 0:c.style,...a.style}}});return{...t,toasts:s}};var G=(e,t="blank",o)=>({createdAt:Date.now(),visible:!0,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...o,id:(o==null?void 0:o.id)||U()}),h=e=>(t,o)=>{let s=G(t,e,o);return m({type:2,toast:s}),s.id},i=(e,t)=>h("blank")(e,t);i.error=h("error");i.success=h("success");i.loading=h("loading");i.custom=h("custom");i.dismiss=e=>{m({type:3,toastId:e})};i.remove=e=>m({type:4,toastId:e});i.promise=(e,t,o)=>{let s=i.loading(t.loading,{...o,...o==null?void 0:o.loading});return e.then(a=>(i.success(f(t.success,a),{id:s,...o,...o==null?void 0:o.success}),a)).catch(a=>{i.error(f(t.error,a),{id:s,...o,...o==null?void 0:o.error})}),e};import{useEffect as K,useCallback as L}from"react";var Z=(e,t)=>{m({type:1,toast:{id:e,height:t}})},ee=()=>{m({type:5,time:Date.now()})},D=e=>{let{toasts:t,pausedAt:o}=I(e);K(()=>{if(o)return;let r=Date.now(),c=t.map(n=>{if(n.duration===1/0)return;let d=(n.duration||0)+n.pauseDuration-(r-n.createdAt);if(d<0){n.visible&&i.dismiss(n.id);return}return setTimeout(()=>i.dismiss(n.id),d)});return()=>{c.forEach(n=>n&&clearTimeout(n))}},[t,o]);let s=L(()=>{o&&m({type:6,time:Date.now()})},[o]),a=L((r,c)=>{let{reverseOrder:n=!1,gutter:d=8,defaultPosition:p}=c||{},g=t.filter(u=>(u.position||p)===(r.position||p)&&u.height),E=g.findIndex(u=>u.id===r.id),x=g.filter((u,R)=>R<E&&u.visible).length;return g.filter(u=>u.visible).slice(...n?[x+1]:[0,x]).reduce((u,R)=>u+(R.height||0)+d,0)},[t]);return{toasts:t,handlers:{updateHeight:Z,startPause:ee,endPause:s,calculateOffset:a}}};import*as l from"react";import{styled as B,keyframes as z}from"goober";import*as y from"react";import{styled as C,keyframes as ue}from"goober";import{styled as te,keyframes as k}from"goober";var oe=k`
 from {
   transform: scale(0) rotate(45deg);
 	opacity: 0;
@@ -55,7 +55,7 @@ to {
     animation-delay: 180ms;
     transform: rotate(90deg);
   }
-`;import{styled as ae,keyframes as ie}from"goober";var ne=ie`
+`;import{styled as ae,keyframes as ne}from"goober";var ie=ne`
   from {
     transform: rotate(0deg);
   }
@@ -70,7 +70,7 @@ to {
   border-radius: 100%;
   border-color: ${e=>e.secondary||"#e0e0e0"};
   border-right-color: ${e=>e.primary||"#616161"};
-  animation: ${ne} 1s linear infinite;
+  animation: ${ie} 1s linear infinite;
 `;import{styled as ce,keyframes as N}from"goober";var pe=N`
 from {
   transform: scale(0) rotate(45deg);
@@ -120,7 +120,7 @@ to {
     height: 10px;
     width: 6px;
   }
-`;var ue=C("div")`
+`;var me=C("div")`
   position: absolute;
 `,le=C("div")`
   position: relative;
@@ -129,7 +129,7 @@ to {
   align-items: center;
   min-width: 20px;
   min-height: 20px;
-`,Te=me`
+`,fe=ue`
 from {
   transform: scale(0.6);
   opacity: 0.4;
@@ -137,14 +137,14 @@ from {
 to {
   transform: scale(1);
   opacity: 1;
-}`,fe=C("div")`
+}`,Te=C("div")`
   position: relative;
   transform: scale(0.6);
   opacity: 0.4;
   min-width: 20px;
-  animation: ${Te} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
+  animation: ${fe} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
     forwards;
-`,M=({toast:e})=>{let{icon:t,type:o,iconTheme:s}=e;return t!==void 0?typeof t=="string"?y.createElement(fe,null,t):t:o==="blank"?null:y.createElement(le,null,y.createElement(V,{...s}),o!=="loading"&&y.createElement(ue,null,o==="error"?y.createElement(_,{...s}):y.createElement(w,{...s})))};var ye=e=>`
+`,M=({toast:e})=>{let{icon:t,type:o,iconTheme:s}=e;return t!==void 0?typeof t=="string"?y.createElement(Te,null,t):t:o==="blank"?null:y.createElement(le,null,y.createElement(V,{...s}),o!=="loading"&&y.createElement(me,null,o==="error"?y.createElement(_,{...s}):y.createElement(w,{...s})))};var ye=e=>`
 0% {transform: translate3d(0,${e*-200}%,0) scale(.6); opacity:.5;}
 100% {transform: translate3d(0,0,0) scale(1); opacity:1;}
 `,ge=e=>`
@@ -169,10 +169,10 @@ to {
   color: inherit;
   flex: 1 1 auto;
   white-space: pre-line;
-`,Ae=(e,t)=>{let s=e.includes("top")?1:-1,[a,r]=b()?[he,xe]:[ye(s),ge(s)];return{animation:t?`${z(a)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${z(r)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},F=l.memo(({toast:e,position:t,style:o,children:s})=>{let a=e.height?Ae(e.position||t||"top-center",e.visible):{opacity:0},r=l.createElement(M,{toast:e}),c=l.createElement(Se,{...e.ariaProps},T(e.message,e));return l.createElement(be,{className:e.className,style:{...a,...o,...e.style}},typeof s=="function"?s({icon:r,message:c}):l.createElement(l.Fragment,null,r,c))});import{css as Pe,setup as Oe}from"goober";import*as f from"react";Oe(f.createElement);var Ee=({id:e,className:t,style:o,onHeightUpdate:s,children:a})=>{let r=f.useCallback(c=>{if(c){let i=()=>{let d=c.getBoundingClientRect().height;s(e,d)};i(),new MutationObserver(i).observe(c,{subtree:!0,childList:!0,characterData:!0})}},[e,s]);return f.createElement("div",{ref:r,className:t,style:o},a)},Re=(e,t)=>{let o=e.includes("top"),s=o?{top:0}:{bottom:0},a=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:b()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(o?1:-1)}px)`,...s,...a}},ve=Pe`
+`,Ae=(e,t)=>{let s=e.includes("top")?1:-1,[a,r]=b()?[he,xe]:[ye(s),ge(s)];return{animation:t?`${z(a)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${z(r)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},F=l.memo(({toast:e,position:t,style:o,children:s})=>{let a=e.height?Ae(e.position||t||"top-center",e.visible):{opacity:0},r=l.createElement(M,{toast:e}),c=l.createElement(Se,{...e.ariaProps},f(e.message,e));return l.createElement(be,{className:e.className,style:{...a,...o,...e.style}},typeof s=="function"?s({icon:r,message:c}):l.createElement(l.Fragment,null,r,c))});import{css as Pe,setup as Oe}from"goober";import*as T from"react";Oe(T.createElement);var Ee=({id:e,className:t,style:o,onHeightUpdate:s,children:a})=>{let r=T.useCallback(c=>{if(c){let n=()=>{let d=c.getBoundingClientRect().height;s(e,d)};n(),new MutationObserver(n).observe(c,{subtree:!0,childList:!0,characterData:!0})}},[e,s]);return T.createElement("div",{ref:r,className:t,style:o},a)},Re=(e,t)=>{let o=e.includes("top")||e.includes("center-"),s=o?{top:e.includes("center-")?"50%":0}:{bottom:0},a=e.includes("center-right")?{justifyContent:"flex-end"}:e.includes("center-left")?{justifyContent:"flex-start"}:e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:b()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(o?1:-1)}px)`,...s,...a}},ve=Pe`
   z-index: 9999;
   > * {
     pointer-events: auto;
   }
-`,O=16,Ie=({reverseOrder:e,position:t="top-center",toastOptions:o,gutter:s,children:a,containerStyle:r,containerClassName:c})=>{let{toasts:i,handlers:d}=D(o);return f.createElement("div",{style:{position:"fixed",zIndex:9999,top:O,left:O,right:O,bottom:O,pointerEvents:"none",...r},className:c,onMouseEnter:d.startPause,onMouseLeave:d.endPause},i.map(p=>{let g=p.position||t,E=d.calculateOffset(p,{reverseOrder:e,gutter:s,defaultPosition:t}),x=Re(g,E);return f.createElement(Ee,{id:p.id,key:p.id,onHeightUpdate:d.updateHeight,className:p.visible?ve:"",style:x},p.type==="custom"?T(p.message,p):a?a(p):f.createElement(F,{toast:p,position:g}))}))};var _t=n;export{w as CheckmarkIcon,_ as ErrorIcon,V as LoaderIcon,F as ToastBar,M as ToastIcon,Ie as Toaster,_t as default,T as resolveValue,n as toast,D as useToaster,I as useToasterStore};
+`,O=16,Ie=({reverseOrder:e,position:t="top-center",toastOptions:o,gutter:s,children:a,containerStyle:r,containerClassName:c})=>{let{toasts:n,handlers:d}=D(o);return T.createElement("div",{style:{position:"fixed",zIndex:9999,top:O,left:O,right:O,bottom:O,pointerEvents:"none",...r},className:c,onMouseEnter:d.startPause,onMouseLeave:d.endPause},n.map(p=>{let g=p.position||t,E=d.calculateOffset(p,{reverseOrder:e,gutter:s,defaultPosition:t}),x=Re(g,E);return T.createElement(Ee,{id:p.id,key:p.id,onHeightUpdate:d.updateHeight,className:p.visible?ve:"",style:x},p.type==="custom"?f(p.message,p):a?a(p):T.createElement(F,{toast:p,position:g}))}))};var _t=i;export{w as CheckmarkIcon,_ as ErrorIcon,V as LoaderIcon,F as ToastBar,M as ToastIcon,Ie as Toaster,_t as default,f as resolveValue,i as toast,D as useToaster,I as useToasterStore};
 //# sourceMappingURL=index.mjs.map
\ No newline at end of file
diff --git a/dist/index.mjs.map b/dist/index.mjs.map
index 43971e037c7a5c4986c7cad876afff9d85dd0da0..c71b1f52b35a2a880d78f53e2c8376ae2dd7227f 100644
--- a/dist/index.mjs.map
+++ b/dist/index.mjs.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/core/types.ts","../src/core/utils.ts","../src/core/store.ts","../src/core/toast.ts","../src/core/use-toaster.ts","../src/components/toast-bar.tsx","../src/components/toast-icon.tsx","../src/components/error.tsx","../src/components/loader.tsx","../src/components/checkmark.tsx","../src/components/toaster.tsx","../src/index.ts"],"sourcesContent":["import { CSSProperties } from 'react';\n\nexport type ToastType = 'success' | 'error' | 'loading' | 'blank' | 'custom';\nexport type ToastPosition =\n  | 'top-left'\n  | 'top-center'\n  | 'top-right'\n  | 'bottom-left'\n  | 'bottom-center'\n  | 'bottom-right';\n\nexport type Renderable = JSX.Element | string | null;\n\nexport interface IconTheme {\n  primary: string;\n  secondary: string;\n}\n\nexport type ValueFunction<TValue, TArg> = (arg: TArg) => TValue;\nexport type ValueOrFunction<TValue, TArg> =\n  | TValue\n  | ValueFunction<TValue, TArg>;\n\nconst isFunction = <TValue, TArg>(\n  valOrFunction: ValueOrFunction<TValue, TArg>\n): valOrFunction is ValueFunction<TValue, TArg> =>\n  typeof valOrFunction === 'function';\n\nexport const resolveValue = <TValue, TArg>(\n  valOrFunction: ValueOrFunction<TValue, TArg>,\n  arg: TArg\n): TValue => (isFunction(valOrFunction) ? valOrFunction(arg) : valOrFunction);\n\nexport interface Toast {\n  type: ToastType;\n  id: string;\n  message: ValueOrFunction<Renderable, Toast>;\n  icon?: Renderable;\n  duration?: number;\n  pauseDuration: number;\n  position?: ToastPosition;\n\n  ariaProps: {\n    role: 'status' | 'alert';\n    'aria-live': 'assertive' | 'off' | 'polite';\n  };\n\n  style?: CSSProperties;\n  className?: string;\n  iconTheme?: IconTheme;\n\n  createdAt: number;\n  visible: boolean;\n  height?: number;\n}\n\nexport type ToastOptions = Partial<\n  Pick<\n    Toast,\n    | 'id'\n    | 'icon'\n    | 'duration'\n    | 'ariaProps'\n    | 'className'\n    | 'style'\n    | 'position'\n    | 'iconTheme'\n  >\n>;\n\nexport type DefaultToastOptions = ToastOptions & {\n  [key in ToastType]?: ToastOptions;\n};\n\nexport interface ToasterProps {\n  position?: ToastPosition;\n  toastOptions?: DefaultToastOptions;\n  reverseOrder?: boolean;\n  gutter?: number;\n  containerStyle?: React.CSSProperties;\n  containerClassName?: string;\n  children?: (toast: Toast) => JSX.Element;\n}\n\nexport interface ToastWrapperProps {\n  id: string;\n  className?: string;\n  style?: React.CSSProperties;\n  onHeightUpdate: (id: string, height: number) => void;\n  children?: React.ReactNode;\n}\n","export const genId = (() => {\n  let count = 0;\n  return () => {\n    return (++count).toString();\n  };\n})();\n\nexport const prefersReducedMotion = (() => {\n  // Cache result\n  let shouldReduceMotion: boolean | undefined = undefined;\n\n  return () => {\n    if (shouldReduceMotion === undefined && typeof window !== 'undefined') {\n      const mediaQuery = matchMedia('(prefers-reduced-motion: reduce)');\n      shouldReduceMotion = !mediaQuery || mediaQuery.matches;\n    }\n    return shouldReduceMotion;\n  };\n})();\n","import { useEffect, useState } from 'react';\nimport { DefaultToastOptions, Toast, ToastType } from './types';\n\nconst TOAST_LIMIT = 20;\n\nexport enum ActionType {\n  ADD_TOAST,\n  UPDATE_TOAST,\n  UPSERT_TOAST,\n  DISMISS_TOAST,\n  REMOVE_TOAST,\n  START_PAUSE,\n  END_PAUSE,\n}\n\ntype Action =\n  | {\n      type: ActionType.ADD_TOAST;\n      toast: Toast;\n    }\n  | {\n      type: ActionType.UPSERT_TOAST;\n      toast: Toast;\n    }\n  | {\n      type: ActionType.UPDATE_TOAST;\n      toast: Partial<Toast>;\n    }\n  | {\n      type: ActionType.DISMISS_TOAST;\n      toastId?: string;\n    }\n  | {\n      type: ActionType.REMOVE_TOAST;\n      toastId?: string;\n    }\n  | {\n      type: ActionType.START_PAUSE;\n      time: number;\n    }\n  | {\n      type: ActionType.END_PAUSE;\n      time: number;\n    };\n\ninterface State {\n  toasts: Toast[];\n  pausedAt: number | undefined;\n}\n\nconst toastTimeouts = new Map<Toast['id'], ReturnType<typeof setTimeout>>();\n\nexport const TOAST_EXPIRE_DISMISS_DELAY = 1000;\n\nconst addToRemoveQueue = (toastId: string) => {\n  if (toastTimeouts.has(toastId)) {\n    return;\n  }\n\n  const timeout = setTimeout(() => {\n    toastTimeouts.delete(toastId);\n    dispatch({\n      type: ActionType.REMOVE_TOAST,\n      toastId: toastId,\n    });\n  }, TOAST_EXPIRE_DISMISS_DELAY);\n\n  toastTimeouts.set(toastId, timeout);\n};\n\nconst clearFromRemoveQueue = (toastId: string) => {\n  const timeout = toastTimeouts.get(toastId);\n  if (timeout) {\n    clearTimeout(timeout);\n  }\n};\n\nexport const reducer = (state: State, action: Action): State => {\n  switch (action.type) {\n    case ActionType.ADD_TOAST:\n      return {\n        ...state,\n        toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),\n      };\n\n    case ActionType.UPDATE_TOAST:\n      //  ! Side effects !\n      if (action.toast.id) {\n        clearFromRemoveQueue(action.toast.id);\n      }\n\n      return {\n        ...state,\n        toasts: state.toasts.map((t) =>\n          t.id === action.toast.id ? { ...t, ...action.toast } : t\n        ),\n      };\n\n    case ActionType.UPSERT_TOAST:\n      const { toast } = action;\n      return state.toasts.find((t) => t.id === toast.id)\n        ? reducer(state, { type: ActionType.UPDATE_TOAST, toast })\n        : reducer(state, { type: ActionType.ADD_TOAST, toast });\n\n    case ActionType.DISMISS_TOAST:\n      const { toastId } = action;\n\n      // ! Side effects ! - This could be execrated into a dismissToast() action, but I'll keep it here for simplicity\n      if (toastId) {\n        addToRemoveQueue(toastId);\n      } else {\n        state.toasts.forEach((toast) => {\n          addToRemoveQueue(toast.id);\n        });\n      }\n\n      return {\n        ...state,\n        toasts: state.toasts.map((t) =>\n          t.id === toastId || toastId === undefined\n            ? {\n                ...t,\n                visible: false,\n              }\n            : t\n        ),\n      };\n    case ActionType.REMOVE_TOAST:\n      if (action.toastId === undefined) {\n        return {\n          ...state,\n          toasts: [],\n        };\n      }\n      return {\n        ...state,\n        toasts: state.toasts.filter((t) => t.id !== action.toastId),\n      };\n\n    case ActionType.START_PAUSE:\n      return {\n        ...state,\n        pausedAt: action.time,\n      };\n\n    case ActionType.END_PAUSE:\n      const diff = action.time - (state.pausedAt || 0);\n\n      return {\n        ...state,\n        pausedAt: undefined,\n        toasts: state.toasts.map((t) => ({\n          ...t,\n          pauseDuration: t.pauseDuration + diff,\n        })),\n      };\n  }\n};\n\nconst listeners: Array<(state: State) => void> = [];\n\nlet memoryState: State = { toasts: [], pausedAt: undefined };\n\nexport const dispatch = (action: Action) => {\n  memoryState = reducer(memoryState, action);\n  listeners.forEach((listener) => {\n    listener(memoryState);\n  });\n};\n\nexport const defaultTimeouts: {\n  [key in ToastType]: number;\n} = {\n  blank: 4000,\n  error: 4000,\n  success: 2000,\n  loading: Infinity,\n  custom: 4000,\n};\n\nexport const useStore = (toastOptions: DefaultToastOptions = {}): State => {\n  const [state, setState] = useState<State>(memoryState);\n  useEffect(() => {\n    listeners.push(setState);\n    return () => {\n      const index = listeners.indexOf(setState);\n      if (index > -1) {\n        listeners.splice(index, 1);\n      }\n    };\n  }, [state]);\n\n  const mergedToasts = state.toasts.map((t) => ({\n    ...toastOptions,\n    ...toastOptions[t.type],\n    ...t,\n    duration:\n      t.duration ||\n      toastOptions[t.type]?.duration ||\n      toastOptions?.duration ||\n      defaultTimeouts[t.type],\n    style: {\n      ...toastOptions.style,\n      ...toastOptions[t.type]?.style,\n      ...t.style,\n    },\n  }));\n\n  return {\n    ...state,\n    toasts: mergedToasts,\n  };\n};\n","import {\n  Renderable,\n  Toast,\n  ToastOptions,\n  ToastType,\n  DefaultToastOptions,\n  ValueOrFunction,\n  resolveValue,\n} from './types';\nimport { genId } from './utils';\nimport { dispatch, ActionType } from './store';\n\ntype Message = ValueOrFunction<Renderable, Toast>;\n\ntype ToastHandler = (message: Message, options?: ToastOptions) => string;\n\nconst createToast = (\n  message: Message,\n  type: ToastType = 'blank',\n  opts?: ToastOptions\n): Toast => ({\n  createdAt: Date.now(),\n  visible: true,\n  type,\n  ariaProps: {\n    role: 'status',\n    'aria-live': 'polite',\n  },\n  message,\n  pauseDuration: 0,\n  ...opts,\n  id: opts?.id || genId(),\n});\n\nconst createHandler =\n  (type?: ToastType): ToastHandler =>\n  (message, options) => {\n    const toast = createToast(message, type, options);\n    dispatch({ type: ActionType.UPSERT_TOAST, toast });\n    return toast.id;\n  };\n\nconst toast = (message: Message, opts?: ToastOptions) =>\n  createHandler('blank')(message, opts);\n\ntoast.error = createHandler('error');\ntoast.success = createHandler('success');\ntoast.loading = createHandler('loading');\ntoast.custom = createHandler('custom');\n\ntoast.dismiss = (toastId?: string) => {\n  dispatch({\n    type: ActionType.DISMISS_TOAST,\n    toastId,\n  });\n};\n\ntoast.remove = (toastId?: string) =>\n  dispatch({ type: ActionType.REMOVE_TOAST, toastId });\n\ntoast.promise = <T>(\n  promise: Promise<T>,\n  msgs: {\n    loading: Renderable;\n    success: ValueOrFunction<Renderable, T>;\n    error: ValueOrFunction<Renderable, any>;\n  },\n  opts?: DefaultToastOptions\n) => {\n  const id = toast.loading(msgs.loading, { ...opts, ...opts?.loading });\n\n  promise\n    .then((p) => {\n      toast.success(resolveValue(msgs.success, p), {\n        id,\n        ...opts,\n        ...opts?.success,\n      });\n      return p;\n    })\n    .catch((e) => {\n      toast.error(resolveValue(msgs.error, e), {\n        id,\n        ...opts,\n        ...opts?.error,\n      });\n    });\n\n  return promise;\n};\n\nexport { toast };\n","import { useEffect, useCallback } from 'react';\nimport { dispatch, ActionType, useStore } from './store';\nimport { toast } from './toast';\nimport { DefaultToastOptions, Toast, ToastPosition } from './types';\n\nconst updateHeight = (toastId: string, height: number) => {\n  dispatch({\n    type: ActionType.UPDATE_TOAST,\n    toast: { id: toastId, height },\n  });\n};\nconst startPause = () => {\n  dispatch({\n    type: ActionType.START_PAUSE,\n    time: Date.now(),\n  });\n};\n\nexport const useToaster = (toastOptions?: DefaultToastOptions) => {\n  const { toasts, pausedAt } = useStore(toastOptions);\n\n  useEffect(() => {\n    if (pausedAt) {\n      return;\n    }\n\n    const now = Date.now();\n    const timeouts = toasts.map((t) => {\n      if (t.duration === Infinity) {\n        return;\n      }\n\n      const durationLeft =\n        (t.duration || 0) + t.pauseDuration - (now - t.createdAt);\n\n      if (durationLeft < 0) {\n        if (t.visible) {\n          toast.dismiss(t.id);\n        }\n        return;\n      }\n      return setTimeout(() => toast.dismiss(t.id), durationLeft);\n    });\n\n    return () => {\n      timeouts.forEach((timeout) => timeout && clearTimeout(timeout));\n    };\n  }, [toasts, pausedAt]);\n\n  const endPause = useCallback(() => {\n    if (pausedAt) {\n      dispatch({ type: ActionType.END_PAUSE, time: Date.now() });\n    }\n  }, [pausedAt]);\n\n  const calculateOffset = useCallback(\n    (\n      toast: Toast,\n      opts?: {\n        reverseOrder?: boolean;\n        gutter?: number;\n        defaultPosition?: ToastPosition;\n      }\n    ) => {\n      const { reverseOrder = false, gutter = 8, defaultPosition } = opts || {};\n\n      const relevantToasts = toasts.filter(\n        (t) =>\n          (t.position || defaultPosition) ===\n            (toast.position || defaultPosition) && t.height\n      );\n      const toastIndex = relevantToasts.findIndex((t) => t.id === toast.id);\n      const toastsBefore = relevantToasts.filter(\n        (toast, i) => i < toastIndex && toast.visible\n      ).length;\n\n      const offset = relevantToasts\n        .filter((t) => t.visible)\n        .slice(...(reverseOrder ? [toastsBefore + 1] : [0, toastsBefore]))\n        .reduce((acc, t) => acc + (t.height || 0) + gutter, 0);\n\n      return offset;\n    },\n    [toasts]\n  );\n\n  return {\n    toasts,\n    handlers: {\n      updateHeight,\n      startPause,\n      endPause,\n      calculateOffset,\n    },\n  };\n};\n","import * as React from 'react';\nimport { styled, keyframes } from 'goober';\n\nimport { Toast, ToastPosition, resolveValue, Renderable } from '../core/types';\nimport { ToastIcon } from './toast-icon';\nimport { prefersReducedMotion } from '../core/utils';\n\nconst enterAnimation = (factor: number) => `\n0% {transform: translate3d(0,${factor * -200}%,0) scale(.6); opacity:.5;}\n100% {transform: translate3d(0,0,0) scale(1); opacity:1;}\n`;\n\nconst exitAnimation = (factor: number) => `\n0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}\n100% {transform: translate3d(0,${factor * -150}%,-1px) scale(.6); opacity:0;}\n`;\n\nconst fadeInAnimation = `0%{opacity:0;} 100%{opacity:1;}`;\nconst fadeOutAnimation = `0%{opacity:1;} 100%{opacity:0;}`;\n\nconst ToastBarBase = styled('div')`\n  display: flex;\n  align-items: center;\n  background: #fff;\n  color: #363636;\n  line-height: 1.3;\n  will-change: transform;\n  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05);\n  max-width: 350px;\n  pointer-events: auto;\n  padding: 8px 10px;\n  border-radius: 8px;\n`;\n\nconst Message = styled('div')`\n  display: flex;\n  justify-content: center;\n  margin: 4px 10px;\n  color: inherit;\n  flex: 1 1 auto;\n  white-space: pre-line;\n`;\n\ninterface ToastBarProps {\n  toast: Toast;\n  position?: ToastPosition;\n  style?: React.CSSProperties;\n  children?: (components: {\n    icon: Renderable;\n    message: Renderable;\n  }) => Renderable;\n}\n\nconst getAnimationStyle = (\n  position: ToastPosition,\n  visible: boolean\n): React.CSSProperties => {\n  const top = position.includes('top');\n  const factor = top ? 1 : -1;\n\n  const [enter, exit] = prefersReducedMotion()\n    ? [fadeInAnimation, fadeOutAnimation]\n    : [enterAnimation(factor), exitAnimation(factor)];\n\n  return {\n    animation: visible\n      ? `${keyframes(enter)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`\n      : `${keyframes(exit)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`,\n  };\n};\n\nexport const ToastBar: React.FC<ToastBarProps> = React.memo(\n  ({ toast, position, style, children }) => {\n    const animationStyle: React.CSSProperties = toast.height\n      ? getAnimationStyle(\n          toast.position || position || 'top-center',\n          toast.visible\n        )\n      : { opacity: 0 };\n\n    const icon = <ToastIcon toast={toast} />;\n    const message = (\n      <Message {...toast.ariaProps}>\n        {resolveValue(toast.message, toast)}\n      </Message>\n    );\n\n    return (\n      <ToastBarBase\n        className={toast.className}\n        style={{\n          ...animationStyle,\n          ...style,\n          ...toast.style,\n        }}\n      >\n        {typeof children === 'function' ? (\n          children({\n            icon,\n            message,\n          })\n        ) : (\n          <>\n            {icon}\n            {message}\n          </>\n        )}\n      </ToastBarBase>\n    );\n  }\n);\n","import * as React from 'react';\nimport { styled, keyframes } from 'goober';\n\nimport { Toast } from '../core/types';\nimport { ErrorIcon, ErrorTheme } from './error';\nimport { LoaderIcon, LoaderTheme } from './loader';\nimport { CheckmarkIcon, CheckmarkTheme } from './checkmark';\n\nconst StatusWrapper = styled('div')`\n  position: absolute;\n`;\n\nconst IndicatorWrapper = styled('div')`\n  position: relative;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  min-width: 20px;\n  min-height: 20px;\n`;\n\nconst enter = keyframes`\nfrom {\n  transform: scale(0.6);\n  opacity: 0.4;\n}\nto {\n  transform: scale(1);\n  opacity: 1;\n}`;\n\nexport const AnimatedIconWrapper = styled('div')`\n  position: relative;\n  transform: scale(0.6);\n  opacity: 0.4;\n  min-width: 20px;\n  animation: ${enter} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)\n    forwards;\n`;\n\nexport type IconThemes = Partial<{\n  success: CheckmarkTheme;\n  error: ErrorTheme;\n  loading: LoaderTheme;\n}>;\n\nexport const ToastIcon: React.FC<{\n  toast: Toast;\n}> = ({ toast }) => {\n  const { icon, type, iconTheme } = toast;\n  if (icon !== undefined) {\n    if (typeof icon === 'string') {\n      return <AnimatedIconWrapper>{icon}</AnimatedIconWrapper>;\n    } else {\n      return icon;\n    }\n  }\n\n  if (type === 'blank') {\n    return null;\n  }\n\n  return (\n    <IndicatorWrapper>\n      <LoaderIcon {...iconTheme} />\n      {type !== 'loading' && (\n        <StatusWrapper>\n          {type === 'error' ? (\n            <ErrorIcon {...iconTheme} />\n          ) : (\n            <CheckmarkIcon {...iconTheme} />\n          )}\n        </StatusWrapper>\n      )}\n    </IndicatorWrapper>\n  );\n};\n","import { styled, keyframes } from 'goober';\n\nconst circleAnimation = keyframes`\nfrom {\n  transform: scale(0) rotate(45deg);\n\topacity: 0;\n}\nto {\n transform: scale(1) rotate(45deg);\n  opacity: 1;\n}`;\n\nconst firstLineAnimation = keyframes`\nfrom {\n  transform: scale(0);\n  opacity: 0;\n}\nto {\n  transform: scale(1);\n  opacity: 1;\n}`;\n\nconst secondLineAnimation = keyframes`\nfrom {\n  transform: scale(0) rotate(90deg);\n\topacity: 0;\n}\nto {\n  transform: scale(1) rotate(90deg);\n\topacity: 1;\n}`;\n\nexport interface ErrorTheme {\n  primary?: string;\n  secondary?: string;\n}\n\nexport const ErrorIcon = styled('div')<ErrorTheme>`\n  width: 20px;\n  opacity: 0;\n  height: 20px;\n  border-radius: 10px;\n  background: ${(p) => p.primary || '#ff4b4b'};\n  position: relative;\n  transform: rotate(45deg);\n\n  animation: ${circleAnimation} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)\n    forwards;\n  animation-delay: 100ms;\n\n  &:after,\n  &:before {\n    content: '';\n    animation: ${firstLineAnimation} 0.15s ease-out forwards;\n    animation-delay: 150ms;\n    position: absolute;\n    border-radius: 3px;\n    opacity: 0;\n    background: ${(p) => p.secondary || '#fff'};\n    bottom: 9px;\n    left: 4px;\n    height: 2px;\n    width: 12px;\n  }\n\n  &:before {\n    animation: ${secondLineAnimation} 0.15s ease-out forwards;\n    animation-delay: 180ms;\n    transform: rotate(90deg);\n  }\n`;\n","import { styled, keyframes } from 'goober';\n\nconst rotate = keyframes`\n  from {\n    transform: rotate(0deg);\n  }\n  to {\n    transform: rotate(360deg);\n  }\n`;\n\nexport interface LoaderTheme {\n  primary?: string;\n  secondary?: string;\n}\n\nexport const LoaderIcon = styled('div')<LoaderTheme>`\n  width: 12px;\n  height: 12px;\n  box-sizing: border-box;\n  border: 2px solid;\n  border-radius: 100%;\n  border-color: ${(p) => p.secondary || '#e0e0e0'};\n  border-right-color: ${(p) => p.primary || '#616161'};\n  animation: ${rotate} 1s linear infinite;\n`;\n","import { styled, keyframes } from 'goober';\n\nconst circleAnimation = keyframes`\nfrom {\n  transform: scale(0) rotate(45deg);\n\topacity: 0;\n}\nto {\n  transform: scale(1) rotate(45deg);\n\topacity: 1;\n}`;\n\nconst checkmarkAnimation = keyframes`\n0% {\n\theight: 0;\n\twidth: 0;\n\topacity: 0;\n}\n40% {\n  height: 0;\n\twidth: 6px;\n\topacity: 1;\n}\n100% {\n  opacity: 1;\n  height: 10px;\n}`;\n\nexport interface CheckmarkTheme {\n  primary?: string;\n  secondary?: string;\n}\n\nexport const CheckmarkIcon = styled('div')<CheckmarkTheme>`\n  width: 20px;\n  opacity: 0;\n  height: 20px;\n  border-radius: 10px;\n  background: ${(p) => p.primary || '#61d345'};\n  position: relative;\n  transform: rotate(45deg);\n\n  animation: ${circleAnimation} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)\n    forwards;\n  animation-delay: 100ms;\n  &:after {\n    content: '';\n    box-sizing: border-box;\n    animation: ${checkmarkAnimation} 0.2s ease-out forwards;\n    opacity: 0;\n    animation-delay: 200ms;\n    position: absolute;\n    border-right: 2px solid;\n    border-bottom: 2px solid;\n    border-color: ${(p) => p.secondary || '#fff'};\n    bottom: 6px;\n    left: 6px;\n    height: 10px;\n    width: 6px;\n  }\n`;\n","import { css, setup } from 'goober';\nimport * as React from 'react';\nimport {\n  resolveValue,\n  ToasterProps,\n  ToastPosition,\n  ToastWrapperProps,\n} from '../core/types';\nimport { useToaster } from '../core/use-toaster';\nimport { prefersReducedMotion } from '../core/utils';\nimport { ToastBar } from './toast-bar';\n\nsetup(React.createElement);\n\nconst ToastWrapper = ({\n  id,\n  className,\n  style,\n  onHeightUpdate,\n  children,\n}: ToastWrapperProps) => {\n  const ref = React.useCallback(\n    (el: HTMLElement | null) => {\n      if (el) {\n        const updateHeight = () => {\n          const height = el.getBoundingClientRect().height;\n          onHeightUpdate(id, height);\n        };\n        updateHeight();\n        new MutationObserver(updateHeight).observe(el, {\n          subtree: true,\n          childList: true,\n          characterData: true,\n        });\n      }\n    },\n    [id, onHeightUpdate]\n  );\n\n  return (\n    <div ref={ref} className={className} style={style}>\n      {children}\n    </div>\n  );\n};\n\nconst getPositionStyle = (\n  position: ToastPosition,\n  offset: number\n): React.CSSProperties => {\n  const top = position.includes('top');\n  const verticalStyle: React.CSSProperties = top ? { top: 0 } : { bottom: 0 };\n  const horizontalStyle: React.CSSProperties = position.includes('center')\n    ? {\n        justifyContent: 'center',\n      }\n    : position.includes('right')\n    ? {\n        justifyContent: 'flex-end',\n      }\n    : {};\n  return {\n    left: 0,\n    right: 0,\n    display: 'flex',\n    position: 'absolute',\n    transition: prefersReducedMotion()\n      ? undefined\n      : `all 230ms cubic-bezier(.21,1.02,.73,1)`,\n    transform: `translateY(${offset * (top ? 1 : -1)}px)`,\n    ...verticalStyle,\n    ...horizontalStyle,\n  };\n};\n\nconst activeClass = css`\n  z-index: 9999;\n  > * {\n    pointer-events: auto;\n  }\n`;\n\nconst DEFAULT_OFFSET = 16;\n\nexport const Toaster: React.FC<ToasterProps> = ({\n  reverseOrder,\n  position = 'top-center',\n  toastOptions,\n  gutter,\n  children,\n  containerStyle,\n  containerClassName,\n}) => {\n  const { toasts, handlers } = useToaster(toastOptions);\n\n  return (\n    <div\n      style={{\n        position: 'fixed',\n        zIndex: 9999,\n        top: DEFAULT_OFFSET,\n        left: DEFAULT_OFFSET,\n        right: DEFAULT_OFFSET,\n        bottom: DEFAULT_OFFSET,\n        pointerEvents: 'none',\n        ...containerStyle,\n      }}\n      className={containerClassName}\n      onMouseEnter={handlers.startPause}\n      onMouseLeave={handlers.endPause}\n    >\n      {toasts.map((t) => {\n        const toastPosition = t.position || position;\n        const offset = handlers.calculateOffset(t, {\n          reverseOrder,\n          gutter,\n          defaultPosition: position,\n        });\n        const positionStyle = getPositionStyle(toastPosition, offset);\n\n        return (\n          <ToastWrapper\n            id={t.id}\n            key={t.id}\n            onHeightUpdate={handlers.updateHeight}\n            className={t.visible ? activeClass : ''}\n            style={positionStyle}\n          >\n            {t.type === 'custom' ? (\n              resolveValue(t.message, t)\n            ) : children ? (\n              children(t)\n            ) : (\n              <ToastBar toast={t} position={toastPosition} />\n            )}\n          </ToastWrapper>\n        );\n      })}\n    </div>\n  );\n};\n","import { toast } from './core/toast';\n\nexport * from './headless';\n\nexport { ToastBar } from './components/toast-bar';\nexport { ToastIcon } from './components/toast-icon';\nexport { Toaster } from './components/toaster';\nexport { CheckmarkIcon } from './components/checkmark';\nexport { ErrorIcon } from './components/error';\nexport { LoaderIcon } from './components/loader';\n\nexport { toast };\nexport default toast;\n"],"mappings":"AAuBA,GAAM,GAAa,AACjB,GAEA,MAAO,IAAkB,WAEd,EAAe,CAC1B,EACA,IACY,EAAW,CAAa,EAAI,EAAc,CAAG,EAAI,EC/BxD,GAAM,GAAS,KAAM,CAC1B,GAAI,GAAQ,EACZ,MAAO,IACG,GAAE,GAAO,SAAS,CAE9B,GAAG,EAEU,EAAwB,KAAM,CAEzC,GAAI,GAEJ,MAAO,IAAM,CACX,GAAI,IAAuB,QAAa,MAAO,QAAW,IAAa,CACrE,GAAM,GAAa,WAAW,kCAAkC,EAChE,EAAqB,CAAC,GAAc,EAAW,OACjD,CACA,MAAO,EACT,CACF,GAAG,EClBH,gDAGA,GAAM,GAAc,GA+CpB,GAAM,GAAgB,GAAI,KAEb,EAA6B,IAEpC,EAAmB,AAAC,GAAoB,CAC5C,GAAI,EAAc,IAAI,CAAO,EAC3B,OAGF,GAAM,GAAU,WAAW,IAAM,CAC/B,EAAc,OAAO,CAAO,EAC5B,EAAS,CACP,KAAM,EACN,QAAS,CACX,CAAC,CACH,EAAG,CAA0B,EAE7B,EAAc,IAAI,EAAS,CAAO,CACpC,EAEM,EAAuB,AAAC,GAAoB,CAChD,GAAM,GAAU,EAAc,IAAI,CAAO,EACzC,AAAI,GACF,aAAa,CAAO,CAExB,EAEa,EAAU,CAAC,EAAc,IAA0B,CAC9D,OAAQ,EAAO,UACR,GACH,MAAO,CACL,GAAG,EACH,OAAQ,CAAC,EAAO,MAAO,GAAG,E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E,iBAAC,IACC,GAAI,EAAE,GACN,IAAK,EAAE,GACP,eAAgB,EAAS,aACzB,UAAW,EAAE,QAAU,GAAc,GACrC,MAAO,GAEN,EAAE,OAAS,SACV,EAAa,EAAE,QAAS,CAAC,EACvB,EACF,EAAS,CAAC,EAEV,gBAAC,GAAS,MAAO,EAAG,SAAU,EAAe,CAEjD,CAEJ,CAAC,CACH,CAEJ,EChIA,GAAO,IAAQ","names":[]}
\ No newline at end of file
+{"version":3,"sources":["../src/core/types.ts","../src/core/utils.ts","../src/core/store.ts","../src/core/toast.ts","../src/core/use-toaster.ts","../src/components/toast-bar.tsx","../src/components/toast-icon.tsx","../src/components/error.tsx","../src/components/loader.tsx","../src/components/checkmark.tsx","../src/components/toaster.tsx","../src/index.ts"],"sourcesContent":["import { CSSProperties } from 'react';\r\n\r\nexport type ToastType = 'success' | 'error' | 'loading' | 'blank' | 'custom';\r\nexport type ToastPosition =\r\n  | 'top-left'\r\n  | 'top-center'\r\n  | 'top-right'\r\n  | 'bottom-left'\r\n  | 'bottom-center'\r\n  | 'bottom-right'\r\n  | 'center-right'\r\n  | 'center-left';\r\n\r\nexport type Renderable = JSX.Element | string | null;\r\n\r\nexport interface IconTheme {\r\n  primary: string;\r\n  secondary: string;\r\n}\r\n\r\nexport type ValueFunction<TValue, TArg> = (arg: TArg) => TValue;\r\nexport type ValueOrFunction<TValue, TArg> =\r\n  | TValue\r\n  | ValueFunction<TValue, TArg>;\r\n\r\nconst isFunction = <TValue, TArg>(\r\n  valOrFunction: ValueOrFunction<TValue, TArg>\r\n): valOrFunction is ValueFunction<TValue, TArg> =>\r\n  typeof valOrFunction === 'function';\r\n\r\nexport const resolveValue = <TValue, TArg>(\r\n  valOrFunction: ValueOrFunction<TValue, TArg>,\r\n  arg: TArg\r\n): TValue => (isFunction(valOrFunction) ? valOrFunction(arg) : valOrFunction);\r\n\r\nexport interface Toast {\r\n  type: ToastType;\r\n  id: string;\r\n  message: ValueOrFunction<Renderable, Toast>;\r\n  icon?: Renderable;\r\n  duration?: number;\r\n  pauseDuration: number;\r\n  position?: ToastPosition;\r\n\r\n  ariaProps: {\r\n    role: 'status' | 'alert';\r\n    'aria-live': 'assertive' | 'off' | 'polite';\r\n  };\r\n\r\n  style?: CSSProperties;\r\n  className?: string;\r\n  iconTheme?: IconTheme;\r\n\r\n  createdAt: number;\r\n  visible: boolean;\r\n  height?: number;\r\n}\r\n\r\nexport type ToastOptions = Partial<\r\n  Pick<\r\n    Toast,\r\n    | 'id'\r\n    | 'icon'\r\n    | 'duration'\r\n    | 'ariaProps'\r\n    | 'className'\r\n    | 'style'\r\n    | 'position'\r\n    | 'iconTheme'\r\n  >\r\n>;\r\n\r\nexport type DefaultToastOptions = ToastOptions & {\r\n  [key in ToastType]?: ToastOptions;\r\n};\r\n\r\nexport interface ToasterProps {\r\n  position?: ToastPosition;\r\n  toastOptions?: DefaultToastOptions;\r\n  reverseOrder?: boolean;\r\n  gutter?: number;\r\n  containerStyle?: React.CSSProperties;\r\n  containerClassName?: string;\r\n  children?: (toast: Toast) => JSX.Element;\r\n}\r\n\r\nexport interface ToastWrapperProps {\r\n  id: string;\r\n  className?: string;\r\n  style?: React.CSSProperties;\r\n  onHeightUpdate: (id: string, height: number) => void;\r\n  children?: React.ReactNode;\r\n}\r\n","export const genId = (() => {\r\n  let count = 0;\r\n  return () => {\r\n    return (++count).toString();\r\n  };\r\n})();\r\n\r\nexport const prefersReducedMotion = (() => {\r\n  // Cache result\r\n  let shouldReduceMotion: boolean | undefined = undefined;\r\n\r\n  return () => {\r\n    if (shouldReduceMotion === undefined && typeof window !== 'undefined') {\r\n      const mediaQuery = matchMedia('(prefers-reduced-motion: reduce)');\r\n      shouldReduceMotion = !mediaQuery || mediaQuery.matches;\r\n    }\r\n    return shouldReduceMotion;\r\n  };\r\n})();\r\n","import { useEffect, useState } from 'react';\r\nimport { DefaultToastOptions, Toast, ToastType } from './types';\r\n\r\nconst TOAST_LIMIT = 20;\r\n\r\nexport enum ActionType {\r\n  ADD_TOAST,\r\n  UPDATE_TOAST,\r\n  UPSERT_TOAST,\r\n  DISMISS_TOAST,\r\n  REMOVE_TOAST,\r\n  START_PAUSE,\r\n  END_PAUSE,\r\n}\r\n\r\ntype Action =\r\n  | {\r\n      type: ActionType.ADD_TOAST;\r\n      toast: Toast;\r\n    }\r\n  | {\r\n      type: ActionType.UPSERT_TOAST;\r\n      toast: Toast;\r\n    }\r\n  | {\r\n      type: ActionType.UPDATE_TOAST;\r\n      toast: Partial<Toast>;\r\n    }\r\n  | {\r\n      type: ActionType.DISMISS_TOAST;\r\n      toastId?: string;\r\n    }\r\n  | {\r\n      type: ActionType.REMOVE_TOAST;\r\n      toastId?: string;\r\n    }\r\n  | {\r\n      type: ActionType.START_PAUSE;\r\n      time: number;\r\n    }\r\n  | {\r\n      type: ActionType.END_PAUSE;\r\n      time: number;\r\n    };\r\n\r\ninterface State {\r\n  toasts: Toast[];\r\n  pausedAt: number | undefined;\r\n}\r\n\r\nconst toastTimeouts = new Map<Toast['id'], ReturnType<typeof setTimeout>>();\r\n\r\nexport const TOAST_EXPIRE_DISMISS_DELAY = 1000;\r\n\r\nconst addToRemoveQueue = (toastId: string) => {\r\n  if (toastTimeouts.has(toastId)) {\r\n    return;\r\n  }\r\n\r\n  const timeout = setTimeout(() => {\r\n    toastTimeouts.delete(toastId);\r\n    dispatch({\r\n      type: ActionType.REMOVE_TOAST,\r\n      toastId: toastId,\r\n    });\r\n  }, TOAST_EXPIRE_DISMISS_DELAY);\r\n\r\n  toastTimeouts.set(toastId, timeout);\r\n};\r\n\r\nconst clearFromRemoveQueue = (toastId: string) => {\r\n  const timeout = toastTimeouts.get(toastId);\r\n  if (timeout) {\r\n    clearTimeout(timeout);\r\n  }\r\n};\r\n\r\nexport const reducer = (state: State, action: Action): State => {\r\n  switch (action.type) {\r\n    case ActionType.ADD_TOAST:\r\n      return {\r\n        ...state,\r\n        toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),\r\n      };\r\n\r\n    case ActionType.UPDATE_TOAST:\r\n      //  ! Side effects !\r\n      if (action.toast.id) {\r\n        clearFromRemoveQueue(action.toast.id);\r\n      }\r\n\r\n      return {\r\n        ...state,\r\n        toasts: state.toasts.map((t) =>\r\n          t.id === action.toast.id ? { ...t, ...action.toast } : t\r\n        ),\r\n      };\r\n\r\n    case ActionType.UPSERT_TOAST:\r\n      const { toast } = action;\r\n      return state.toasts.find((t) => t.id === toast.id)\r\n        ? reducer(state, { type: ActionType.UPDATE_TOAST, toast })\r\n        : reducer(state, { type: ActionType.ADD_TOAST, toast });\r\n\r\n    case ActionType.DISMISS_TOAST:\r\n      const { toastId } = action;\r\n\r\n      // ! Side effects ! - This could be execrated into a dismissToast() action, but I'll keep it here for simplicity\r\n      if (toastId) {\r\n        addToRemoveQueue(toastId);\r\n      } else {\r\n        state.toasts.forEach((toast) => {\r\n          addToRemoveQueue(toast.id);\r\n        });\r\n      }\r\n\r\n      return {\r\n        ...state,\r\n        toasts: state.toasts.map((t) =>\r\n          t.id === toastId || toastId === undefined\r\n            ? {\r\n                ...t,\r\n                visible: false,\r\n              }\r\n            : t\r\n        ),\r\n      };\r\n    case ActionType.REMOVE_TOAST:\r\n      if (action.toastId === undefined) {\r\n        return {\r\n          ...state,\r\n          toasts: [],\r\n        };\r\n      }\r\n      return {\r\n        ...state,\r\n        toasts: state.toasts.filter((t) => t.id !== action.toastId),\r\n      };\r\n\r\n    case ActionType.START_PAUSE:\r\n      return {\r\n        ...state,\r\n        pausedAt: action.time,\r\n      };\r\n\r\n    case ActionType.END_PAUSE:\r\n      const diff = action.time - (state.pausedAt || 0);\r\n\r\n      return {\r\n        ...state,\r\n        pausedAt: undefined,\r\n        toasts: state.toasts.map((t) => ({\r\n          ...t,\r\n          pauseDuration: t.pauseDuration + diff,\r\n        })),\r\n      };\r\n  }\r\n};\r\n\r\nconst listeners: Array<(state: State) => void> = [];\r\n\r\nlet memoryState: State = { toasts: [], pausedAt: undefined };\r\n\r\nexport const dispatch = (action: Action) => {\r\n  memoryState = reducer(memoryState, action);\r\n  listeners.forEach((listener) => {\r\n    listener(memoryState);\r\n  });\r\n};\r\n\r\nexport const defaultTimeouts: {\r\n  [key in ToastType]: number;\r\n} = {\r\n  blank: 4000,\r\n  error: 4000,\r\n  success: 2000,\r\n  loading: Infinity,\r\n  custom: 4000,\r\n};\r\n\r\nexport const useStore = (toastOptions: DefaultToastOptions = {}): State => {\r\n  const [state, setState] = useState<State>(memoryState);\r\n  useEffect(() => {\r\n    listeners.push(setState);\r\n    return () => {\r\n      const index = listeners.indexOf(setState);\r\n      if (index > -1) {\r\n        listeners.splice(index, 1);\r\n      }\r\n    };\r\n  }, [state]);\r\n\r\n  const mergedToasts = state.toasts.map((t) => ({\r\n    ...toastOptions,\r\n    ...toastOptions[t.type],\r\n    ...t,\r\n    duration:\r\n      t.duration ||\r\n      toastOptions[t.type]?.duration ||\r\n      toastOptions?.duration ||\r\n      defaultTimeouts[t.type],\r\n    style: {\r\n      ...toastOptions.style,\r\n      ...toastOptions[t.type]?.style,\r\n      ...t.style,\r\n    },\r\n  }));\r\n\r\n  return {\r\n    ...state,\r\n    toasts: mergedToasts,\r\n  };\r\n};\r\n","import {\r\n  Renderable,\r\n  Toast,\r\n  ToastOptions,\r\n  ToastType,\r\n  DefaultToastOptions,\r\n  ValueOrFunction,\r\n  resolveValue,\r\n} from './types';\r\nimport { genId } from './utils';\r\nimport { dispatch, ActionType } from './store';\r\n\r\ntype Message = ValueOrFunction<Renderable, Toast>;\r\n\r\ntype ToastHandler = (message: Message, options?: ToastOptions) => string;\r\n\r\nconst createToast = (\r\n  message: Message,\r\n  type: ToastType = 'blank',\r\n  opts?: ToastOptions\r\n): Toast => ({\r\n  createdAt: Date.now(),\r\n  visible: true,\r\n  type,\r\n  ariaProps: {\r\n    role: 'status',\r\n    'aria-live': 'polite',\r\n  },\r\n  message,\r\n  pauseDuration: 0,\r\n  ...opts,\r\n  id: opts?.id || genId(),\r\n});\r\n\r\nconst createHandler =\r\n  (type?: ToastType): ToastHandler =>\r\n  (message, options) => {\r\n    const toast = createToast(message, type, options);\r\n    dispatch({ type: ActionType.UPSERT_TOAST, toast });\r\n    return toast.id;\r\n  };\r\n\r\nconst toast = (message: Message, opts?: ToastOptions) =>\r\n  createHandler('blank')(message, opts);\r\n\r\ntoast.error = createHandler('error');\r\ntoast.success = createHandler('success');\r\ntoast.loading = createHandler('loading');\r\ntoast.custom = createHandler('custom');\r\n\r\ntoast.dismiss = (toastId?: string) => {\r\n  dispatch({\r\n    type: ActionType.DISMISS_TOAST,\r\n    toastId,\r\n  });\r\n};\r\n\r\ntoast.remove = (toastId?: string) =>\r\n  dispatch({ type: ActionType.REMOVE_TOAST, toastId });\r\n\r\ntoast.promise = <T>(\r\n  promise: Promise<T>,\r\n  msgs: {\r\n    loading: Renderable;\r\n    success: ValueOrFunction<Renderable, T>;\r\n    error: ValueOrFunction<Renderable, any>;\r\n  },\r\n  opts?: DefaultToastOptions\r\n) => {\r\n  const id = toast.loading(msgs.loading, { ...opts, ...opts?.loading });\r\n\r\n  promise\r\n    .then((p) => {\r\n      toast.success(resolveValue(msgs.success, p), {\r\n        id,\r\n        ...opts,\r\n        ...opts?.success,\r\n      });\r\n      return p;\r\n    })\r\n    .catch((e) => {\r\n      toast.error(resolveValue(msgs.error, e), {\r\n        id,\r\n        ...opts,\r\n        ...opts?.error,\r\n      });\r\n    });\r\n\r\n  return promise;\r\n};\r\n\r\nexport { toast };\r\n","import { useEffect, useCallback } from 'react';\r\nimport { dispatch, ActionType, useStore } from './store';\r\nimport { toast } from './toast';\r\nimport { DefaultToastOptions, Toast, ToastPosition } from './types';\r\n\r\nconst updateHeight = (toastId: string, height: number) => {\r\n  dispatch({\r\n    type: ActionType.UPDATE_TOAST,\r\n    toast: { id: toastId, height },\r\n  });\r\n};\r\nconst startPause = () => {\r\n  dispatch({\r\n    type: ActionType.START_PAUSE,\r\n    time: Date.now(),\r\n  });\r\n};\r\n\r\nexport const useToaster = (toastOptions?: DefaultToastOptions) => {\r\n  const { toasts, pausedAt } = useStore(toastOptions);\r\n\r\n  useEffect(() => {\r\n    if (pausedAt) {\r\n      return;\r\n    }\r\n\r\n    const now = Date.now();\r\n    const timeouts = toasts.map((t) => {\r\n      if (t.duration === Infinity) {\r\n        return;\r\n      }\r\n\r\n      const durationLeft =\r\n        (t.duration || 0) + t.pauseDuration - (now - t.createdAt);\r\n\r\n      if (durationLeft < 0) {\r\n        if (t.visible) {\r\n          toast.dismiss(t.id);\r\n        }\r\n        return;\r\n      }\r\n      return setTimeout(() => toast.dismiss(t.id), durationLeft);\r\n    });\r\n\r\n    return () => {\r\n      timeouts.forEach((timeout) => timeout && clearTimeout(timeout));\r\n    };\r\n  }, [toasts, pausedAt]);\r\n\r\n  const endPause = useCallback(() => {\r\n    if (pausedAt) {\r\n      dispatch({ type: ActionType.END_PAUSE, time: Date.now() });\r\n    }\r\n  }, [pausedAt]);\r\n\r\n  const calculateOffset = useCallback(\r\n    (\r\n      toast: Toast,\r\n      opts?: {\r\n        reverseOrder?: boolean;\r\n        gutter?: number;\r\n        defaultPosition?: ToastPosition;\r\n      }\r\n    ) => {\r\n      const { reverseOrder = false, gutter = 8, defaultPosition } = opts || {};\r\n\r\n      const relevantToasts = toasts.filter(\r\n        (t) =>\r\n          (t.position || defaultPosition) ===\r\n            (toast.position || defaultPosition) && t.height\r\n      );\r\n      const toastIndex = relevantToasts.findIndex((t) => t.id === toast.id);\r\n      const toastsBefore = relevantToasts.filter(\r\n        (toast, i) => i < toastIndex && toast.visible\r\n      ).length;\r\n\r\n      const offset = relevantToasts\r\n        .filter((t) => t.visible)\r\n        .slice(...(reverseOrder ? [toastsBefore + 1] : [0, toastsBefore]))\r\n        .reduce((acc, t) => acc + (t.height || 0) + gutter, 0);\r\n\r\n      return offset;\r\n    },\r\n    [toasts]\r\n  );\r\n\r\n  return {\r\n    toasts,\r\n    handlers: {\r\n      updateHeight,\r\n      startPause,\r\n      endPause,\r\n      calculateOffset,\r\n    },\r\n  };\r\n};\r\n","import * as React from 'react';\r\nimport { styled, keyframes } from 'goober';\r\n\r\nimport { Toast, ToastPosition, resolveValue, Renderable } from '../core/types';\r\nimport { ToastIcon } from './toast-icon';\r\nimport { prefersReducedMotion } from '../core/utils';\r\n\r\nconst enterAnimation = (factor: number) => `\r\n0% {transform: translate3d(0,${factor * -200}%,0) scale(.6); opacity:.5;}\r\n100% {transform: translate3d(0,0,0) scale(1); opacity:1;}\r\n`;\r\n\r\nconst exitAnimation = (factor: number) => `\r\n0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}\r\n100% {transform: translate3d(0,${factor * -150}%,-1px) scale(.6); opacity:0;}\r\n`;\r\n\r\nconst fadeInAnimation = `0%{opacity:0;} 100%{opacity:1;}`;\r\nconst fadeOutAnimation = `0%{opacity:1;} 100%{opacity:0;}`;\r\n\r\nconst ToastBarBase = styled('div')`\r\n  display: flex;\r\n  align-items: center;\r\n  background: #fff;\r\n  color: #363636;\r\n  line-height: 1.3;\r\n  will-change: transform;\r\n  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05);\r\n  max-width: 350px;\r\n  pointer-events: auto;\r\n  padding: 8px 10px;\r\n  border-radius: 8px;\r\n`;\r\n\r\nconst Message = styled('div')`\r\n  display: flex;\r\n  justify-content: center;\r\n  margin: 4px 10px;\r\n  color: inherit;\r\n  flex: 1 1 auto;\r\n  white-space: pre-line;\r\n`;\r\n\r\ninterface ToastBarProps {\r\n  toast: Toast;\r\n  position?: ToastPosition;\r\n  style?: React.CSSProperties;\r\n  children?: (components: {\r\n    icon: Renderable;\r\n    message: Renderable;\r\n  }) => Renderable;\r\n}\r\n\r\nconst getAnimationStyle = (\r\n  position: ToastPosition,\r\n  visible: boolean\r\n): React.CSSProperties => {\r\n  const top = position.includes('top');\r\n  const factor = top ? 1 : -1;\r\n\r\n  const [enter, exit] = prefersReducedMotion()\r\n    ? [fadeInAnimation, fadeOutAnimation]\r\n    : [enterAnimation(factor), exitAnimation(factor)];\r\n\r\n  return {\r\n    animation: visible\r\n      ? `${keyframes(enter)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`\r\n      : `${keyframes(exit)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`,\r\n  };\r\n};\r\n\r\nexport const ToastBar: React.FC<ToastBarProps> = React.memo(\r\n  ({ toast, position, style, children }) => {\r\n    const animationStyle: React.CSSProperties = toast.height\r\n      ? getAnimationStyle(\r\n          toast.position || position || 'top-center',\r\n          toast.visible\r\n        )\r\n      : { opacity: 0 };\r\n\r\n    const icon = <ToastIcon toast={toast} />;\r\n    const message = (\r\n      <Message {...toast.ariaProps}>\r\n        {resolveValue(toast.message, toast)}\r\n      </Message>\r\n    );\r\n\r\n    return (\r\n      <ToastBarBase\r\n        className={toast.className}\r\n        style={{\r\n          ...animationStyle,\r\n          ...style,\r\n          ...toast.style,\r\n        }}\r\n      >\r\n        {typeof children === 'function' ? (\r\n          children({\r\n            icon,\r\n            message,\r\n          })\r\n        ) : (\r\n          <>\r\n            {icon}\r\n            {message}\r\n          </>\r\n        )}\r\n      </ToastBarBase>\r\n    );\r\n  }\r\n);\r\n","import * as React from 'react';\r\nimport { styled, keyframes } from 'goober';\r\n\r\nimport { Toast } from '../core/types';\r\nimport { ErrorIcon, ErrorTheme } from './error';\r\nimport { LoaderIcon, LoaderTheme } from './loader';\r\nimport { CheckmarkIcon, CheckmarkTheme } from './checkmark';\r\n\r\nconst StatusWrapper = styled('div')`\r\n  position: absolute;\r\n`;\r\n\r\nconst IndicatorWrapper = styled('div')`\r\n  position: relative;\r\n  display: flex;\r\n  justify-content: center;\r\n  align-items: center;\r\n  min-width: 20px;\r\n  min-height: 20px;\r\n`;\r\n\r\nconst enter = keyframes`\r\nfrom {\r\n  transform: scale(0.6);\r\n  opacity: 0.4;\r\n}\r\nto {\r\n  transform: scale(1);\r\n  opacity: 1;\r\n}`;\r\n\r\nexport const AnimatedIconWrapper = styled('div')`\r\n  position: relative;\r\n  transform: scale(0.6);\r\n  opacity: 0.4;\r\n  min-width: 20px;\r\n  animation: ${enter} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)\r\n    forwards;\r\n`;\r\n\r\nexport type IconThemes = Partial<{\r\n  success: CheckmarkTheme;\r\n  error: ErrorTheme;\r\n  loading: LoaderTheme;\r\n}>;\r\n\r\nexport const ToastIcon: React.FC<{\r\n  toast: Toast;\r\n}> = ({ toast }) => {\r\n  const { icon, type, iconTheme } = toast;\r\n  if (icon !== undefined) {\r\n    if (typeof icon === 'string') {\r\n      return <AnimatedIconWrapper>{icon}</AnimatedIconWrapper>;\r\n    } else {\r\n      return icon;\r\n    }\r\n  }\r\n\r\n  if (type === 'blank') {\r\n    return null;\r\n  }\r\n\r\n  return (\r\n    <IndicatorWrapper>\r\n      <LoaderIcon {...iconTheme} />\r\n      {type !== 'loading' && (\r\n        <StatusWrapper>\r\n          {type === 'error' ? (\r\n            <ErrorIcon {...iconTheme} />\r\n          ) : (\r\n            <CheckmarkIcon {...iconTheme} />\r\n          )}\r\n        </StatusWrapper>\r\n      )}\r\n    </IndicatorWrapper>\r\n  );\r\n};\r\n","import { styled, keyframes } from 'goober';\r\n\r\nconst circleAnimation = keyframes`\r\nfrom {\r\n  transform: scale(0) rotate(45deg);\r\n\topacity: 0;\r\n}\r\nto {\r\n transform: scale(1) rotate(45deg);\r\n  opacity: 1;\r\n}`;\r\n\r\nconst firstLineAnimation = keyframes`\r\nfrom {\r\n  transform: scale(0);\r\n  opacity: 0;\r\n}\r\nto {\r\n  transform: scale(1);\r\n  opacity: 1;\r\n}`;\r\n\r\nconst secondLineAnimation = keyframes`\r\nfrom {\r\n  transform: scale(0) rotate(90deg);\r\n\topacity: 0;\r\n}\r\nto {\r\n  transform: scale(1) rotate(90deg);\r\n\topacity: 1;\r\n}`;\r\n\r\nexport interface ErrorTheme {\r\n  primary?: string;\r\n  secondary?: string;\r\n}\r\n\r\nexport const ErrorIcon = styled('div')<ErrorTheme>`\r\n  width: 20px;\r\n  opacity: 0;\r\n  height: 20px;\r\n  border-radius: 10px;\r\n  background: ${(p) => p.primary || '#ff4b4b'};\r\n  position: relative;\r\n  transform: rotate(45deg);\r\n\r\n  animation: ${circleAnimation} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)\r\n    forwards;\r\n  animation-delay: 100ms;\r\n\r\n  &:after,\r\n  &:before {\r\n    content: '';\r\n    animation: ${firstLineAnimation} 0.15s ease-out forwards;\r\n    animation-delay: 150ms;\r\n    position: absolute;\r\n    border-radius: 3px;\r\n    opacity: 0;\r\n    background: ${(p) => p.secondary || '#fff'};\r\n    bottom: 9px;\r\n    left: 4px;\r\n    height: 2px;\r\n    width: 12px;\r\n  }\r\n\r\n  &:before {\r\n    animation: ${secondLineAnimation} 0.15s ease-out forwards;\r\n    animation-delay: 180ms;\r\n    transform: rotate(90deg);\r\n  }\r\n`;\r\n","import { styled, keyframes } from 'goober';\r\n\r\nconst rotate = keyframes`\r\n  from {\r\n    transform: rotate(0deg);\r\n  }\r\n  to {\r\n    transform: rotate(360deg);\r\n  }\r\n`;\r\n\r\nexport interface LoaderTheme {\r\n  primary?: string;\r\n  secondary?: string;\r\n}\r\n\r\nexport const LoaderIcon = styled('div')<LoaderTheme>`\r\n  width: 12px;\r\n  height: 12px;\r\n  box-sizing: border-box;\r\n  border: 2px solid;\r\n  border-radius: 100%;\r\n  border-color: ${(p) => p.secondary || '#e0e0e0'};\r\n  border-right-color: ${(p) => p.primary || '#616161'};\r\n  animation: ${rotate} 1s linear infinite;\r\n`;\r\n","import { styled, keyframes } from 'goober';\r\n\r\nconst circleAnimation = keyframes`\r\nfrom {\r\n  transform: scale(0) rotate(45deg);\r\n\topacity: 0;\r\n}\r\nto {\r\n  transform: scale(1) rotate(45deg);\r\n\topacity: 1;\r\n}`;\r\n\r\nconst checkmarkAnimation = keyframes`\r\n0% {\r\n\theight: 0;\r\n\twidth: 0;\r\n\topacity: 0;\r\n}\r\n40% {\r\n  height: 0;\r\n\twidth: 6px;\r\n\topacity: 1;\r\n}\r\n100% {\r\n  opacity: 1;\r\n  height: 10px;\r\n}`;\r\n\r\nexport interface CheckmarkTheme {\r\n  primary?: string;\r\n  secondary?: string;\r\n}\r\n\r\nexport const CheckmarkIcon = styled('div')<CheckmarkTheme>`\r\n  width: 20px;\r\n  opacity: 0;\r\n  height: 20px;\r\n  border-radius: 10px;\r\n  background: ${(p) => p.primary || '#61d345'};\r\n  position: relative;\r\n  transform: rotate(45deg);\r\n\r\n  animation: ${circleAnimation} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)\r\n    forwards;\r\n  animation-delay: 100ms;\r\n  &:after {\r\n    content: '';\r\n    box-sizing: border-box;\r\n    animation: ${checkmarkAnimation} 0.2s ease-out forwards;\r\n    opacity: 0;\r\n    animation-delay: 200ms;\r\n    position: absolute;\r\n    border-right: 2px solid;\r\n    border-bottom: 2px solid;\r\n    border-color: ${(p) => p.secondary || '#fff'};\r\n    bottom: 6px;\r\n    left: 6px;\r\n    height: 10px;\r\n    width: 6px;\r\n  }\r\n`;\r\n","import { css, setup } from 'goober';\r\nimport * as React from 'react';\r\nimport {\r\n  resolveValue,\r\n  ToasterProps,\r\n  ToastPosition,\r\n  ToastWrapperProps,\r\n} from '../core/types';\r\nimport { useToaster } from '../core/use-toaster';\r\nimport { prefersReducedMotion } from '../core/utils';\r\nimport { ToastBar } from './toast-bar';\r\n\r\nsetup(React.createElement);\r\n\r\nconst ToastWrapper = ({\r\n  id,\r\n  className,\r\n  style,\r\n  onHeightUpdate,\r\n  children,\r\n}: ToastWrapperProps) => {\r\n  const ref = React.useCallback(\r\n    (el: HTMLElement | null) => {\r\n      if (el) {\r\n        const updateHeight = () => {\r\n          const height = el.getBoundingClientRect().height;\r\n          onHeightUpdate(id, height);\r\n        };\r\n        updateHeight();\r\n        new MutationObserver(updateHeight).observe(el, {\r\n          subtree: true,\r\n          childList: true,\r\n          characterData: true,\r\n        });\r\n      }\r\n    },\r\n    [id, onHeightUpdate]\r\n  );\r\n\r\n  return (\r\n    <div ref={ref} className={className} style={style}>\r\n      {children}\r\n    </div>\r\n  );\r\n};\r\n\r\nconst getPositionStyle = (\r\n  position: ToastPosition,\r\n  offset: number\r\n): React.CSSProperties => {\r\n  const top = position.includes('top') || position.includes('center-');\r\n  const verticalStyle: React.CSSProperties = top\r\n    ? {\r\n        top: position.includes('center-') ? '50%' : 0,\r\n      }\r\n    : { bottom: 0 };\r\n  const horizontalStyle: React.CSSProperties = position.includes('center-right')\r\n    ? { justifyContent: 'flex-end' }\r\n    : position.includes('center-left')\r\n    ? { justifyContent: 'flex-start' }\r\n    : position.includes('center')\r\n    ? {\r\n        justifyContent: 'center',\r\n      }\r\n    : position.includes('right')\r\n    ? {\r\n        justifyContent: 'flex-end',\r\n      }\r\n    : {};\r\n  return {\r\n    left: 0,\r\n    right: 0,\r\n    display: 'flex',\r\n    position: 'absolute',\r\n    transition: prefersReducedMotion()\r\n      ? undefined\r\n      : `all 230ms cubic-bezier(.21,1.02,.73,1)`,\r\n    transform: `translateY(${offset * (top ? 1 : -1)}px)`,\r\n    ...verticalStyle,\r\n    ...horizontalStyle,\r\n  };\r\n};\r\n\r\nconst activeClass = css`\r\n  z-index: 9999;\r\n  > * {\r\n    pointer-events: auto;\r\n  }\r\n`;\r\n\r\nconst DEFAULT_OFFSET = 16;\r\n\r\nexport const Toaster: React.FC<ToasterProps> = ({\r\n  reverseOrder,\r\n  position = 'top-center',\r\n  toastOptions,\r\n  gutter,\r\n  children,\r\n  containerStyle,\r\n  containerClassName,\r\n}) => {\r\n  const { toasts, handlers } = useToaster(toastOptions);\r\n\r\n  return (\r\n    <div\r\n      style={{\r\n        position: 'fixed',\r\n        zIndex: 9999,\r\n        top: DEFAULT_OFFSET,\r\n        left: DEFAULT_OFFSET,\r\n        right: DEFAULT_OFFSET,\r\n        bottom: DEFAULT_OFFSET,\r\n        pointerEvents: 'none',\r\n        ...containerStyle,\r\n      }}\r\n      className={containerClassName}\r\n      onMouseEnter={handlers.startPause}\r\n      onMouseLeave={handlers.endPause}\r\n    >\r\n      {toasts.map((t) => {\r\n        const toastPosition = t.position || position;\r\n        const offset = handlers.calculateOffset(t, {\r\n          reverseOrder,\r\n          gutter,\r\n          defaultPosition: position,\r\n        });\r\n        const positionStyle = getPositionStyle(toastPosition, offset);\r\n\r\n        return (\r\n          <ToastWrapper\r\n            id={t.id}\r\n            key={t.id}\r\n            onHeightUpdate={handlers.updateHeight}\r\n            className={t.visible ? activeClass : ''}\r\n            style={positionStyle}\r\n          >\r\n            {t.type === 'custom' ? (\r\n              resolveValue(t.message, t)\r\n            ) : children ? (\r\n              children(t)\r\n            ) : (\r\n              <ToastBar toast={t} position={toastPosition} />\r\n            )}\r\n          </ToastWrapper>\r\n        );\r\n      })}\r\n    </div>\r\n  );\r\n};\r\n","import { toast } from './core/toast';\r\n\r\nexport * from './headless';\r\n\r\nexport { ToastBar } from './components/toast-bar';\r\nexport { ToastIcon } from './components/toast-icon';\r\nexport { Toaster } from './components/toaster';\r\nexport { CheckmarkIcon } from './components/checkmark';\r\nexport { ErrorIcon } from './components/error';\r\nexport { LoaderIcon } from './components/loader';\r\n\r\nexport { toast };\r\nexport default toast;\r\n"],"mappings":"AAyBA,GAAM,GAAa,AACjB,GAEA,MAAO,IAAkB,WAEd,EAAe,CAC1B,EACA,IACY,EAAW,CAAa,EAAI,EAAc,CAAG,EAAI,ECjCxD,GAAM,GAAS,KAAM,CAC1B,GAAI,GAAQ,EACZ,MAAO,IACG,GAAE,GAAO,SAAS,CAE9B,GAAG,EAEU,EAAwB,KAAM,CAEzC,GAAI,GAEJ,MAAO,IAAM,CACX,GAAI,IAAuB,QAAa,MAAO,QAAW,IAAa,CACrE,GAAM,GAAa,WAAW,kCAAkC,EAChE,EAAqB,CAAC,GAAc,EAAW,OACjD,CACA,MAAO,EACT,CACF,GAAG,EClBH,gDAGA,GAAM,GAAc,GA+CpB,GAAM,GAAgB,GAAI,KAEb,EAA6B,IAEpC,EAA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yCACJ,UAAW,cAAc,EAAU,GAAM,EAAI,SAC7C,GAAG,EACH,GAAG,CACL,CACF,EAEM,GAAc;AAAA;AAAA;AAAA;AAAA;AAAA,EAOd,EAAiB,GAEV,GAAkC,CAAC,CAC9C,eACA,WAAW,aACX,eACA,SACA,WACA,iBACA,wBACI,CACJ,GAAM,CAAE,SAAQ,YAAa,EAAW,CAAY,EAEpD,MACE,iBAAC,OACC,MAAO,CACL,SAAU,QACV,OAAQ,KACR,IAAK,EACL,KAAM,EACN,MAAO,EACP,OAAQ,EACR,cAAe,OACf,GAAG,CACL,EACA,UAAW,EACX,aAAc,EAAS,WACvB,aAAc,EAAS,UAEtB,EAAO,IAAI,AAAC,GAAM,CACjB,GAAM,GAAgB,EAAE,UAAY,EAC9B,EAAS,EAAS,gBAAgB,EAAG,CACzC,eACA,SACA,gBAAiB,CACnB,CAAC,EACK,EAAgB,GAAiB,EAAe,CAAM,EAE5D,MACE,iBAAC,IACC,GAAI,EAAE,GACN,IAAK,EAAE,GACP,eAAgB,EAAS,aACzB,UAAW,EAAE,QAAU,GAAc,GACrC,MAAO,GAEN,EAAE,OAAS,SACV,EAAa,EAAE,QAAS,CAAC,EACvB,EACF,EAAS,CAAC,EAEV,gBAAC,GAAS,MAAO,EAAG,SAAU,EAAe,CAEjD,CAEJ,CAAC,CACH,CAEJ,ECxIA,GAAO,IAAQ","names":[]}
\ No newline at end of file
diff --git a/src/components/toaster.tsx b/src/components/toaster.tsx
index 16182faddcaa2b6d2c40d448068db6421f39b64c..9d03025e1b04dc511091a10918f2fe53aad57fc1 100644
--- a/src/components/toaster.tsx
+++ b/src/components/toaster.tsx
@@ -48,9 +48,17 @@ const getPositionStyle = (
   position: ToastPosition,
   offset: number
 ): React.CSSProperties => {
-  const top = position.includes('top');
-  const verticalStyle: React.CSSProperties = top ? { top: 0 } : { bottom: 0 };
-  const horizontalStyle: React.CSSProperties = position.includes('center')
+  const top = position.includes('top') || position.includes('center-');
+  const verticalStyle: React.CSSProperties = top
+    ? {
+        top: position.includes('center-') ? '50%' : 0,
+      }
+    : { bottom: 0 };
+  const horizontalStyle: React.CSSProperties = position.includes('center-right')
+    ? { justifyContent: 'flex-end' }
+    : position.includes('center-left')
+    ? { justifyContent: 'flex-start' }
+    : position.includes('center')
     ? {
         justifyContent: 'center',
       }
diff --git a/src/core/types.ts b/src/core/types.ts
index cd6f67af4cea51b73ce9225c2f6fd9ff0c3e0d2e..4789baa61b9a40ac9726777a8d1a1f93bc09d2b2 100644
--- a/src/core/types.ts
+++ b/src/core/types.ts
@@ -7,7 +7,9 @@ export type ToastPosition =
   | 'top-right'
   | 'bottom-left'
   | 'bottom-center'
-  | 'bottom-right';
+  | 'bottom-right'
+  | 'center-right'
+  | 'center-left';
 
 export type Renderable = JSX.Element | string | null;
 